ai-nexus Documentation

Unified rule manager for Claude Code, Cursor, and Codex. Write once, use everywhere, save tokens.

2-3
Relevant Rules Loaded
Out of 30+ installed, only what you need
1 → 3
Write Once, Deploy Everywhere
One .md file auto-converts for all tools
$0.50
AI Routing Cost / Month
Free keyword fallback included

Installation

Install ai-nexus globally with a single command:

$ npx ai-nexus install

Or use interactive mode for full control over what gets installed:

$ npx ai-nexus install -i
Requirements: Node.js 18 or higher.

Quick Start

# Interactive setup (recommended)
npx ai-nexus install -i

# Quick install with defaults
npx ai-nexus install

# Use your team's rules
npx ai-nexus install --rules github.com/your-org/team-rules

# Install in current project only
npx ai-nexus init

Supported Tools

ToolMethodToken overhead
Claude CodeSemantic Router dynamically swaps rules per promptOnly relevant rules loaded
CursorConverts rules to .mdc format; Cursor's built-in search handles filteringDepends on Cursor's search
CodexAggregated AGENTS.md (rules merged into single file)All rules loaded

Commands

CommandDescription
installInstall rules globally (~/.claude/)
install -iInteractive mode — choose tools, rules, template
initInstall in current project (.claude/)
updateSync latest rules (respects local changes)
listShow installed rules
browseOpen rule marketplace in browser
test <prompt>Preview which rules would load
search [keyword]Search community rules from the registry
get <filename>Download a rule from the community registry
add <url>Add rules from a Git repository
remove <name>Remove a rule source
doctorDiagnose installation issues
uninstallRemove ai-nexus installation

Browse Marketplace

Open a web-based marketplace to search, install, and remove rules with one click:

$ npx ai-nexus browse        # default port 3847
$ npx ai-nexus browse 8080   # custom port

The marketplace runs locally on http://localhost:3847 and provides:

ai-nexus browse marketplace
Local only: The server runs on localhost. No data is sent externally. Install/remove only affects your local files.

Testing Rules

Preview which rules would load for a given prompt:

$ npx ai-nexus test "write a react component with hooks"

Selected rules (3):
  rules/essential.md
  skills/react.md

$ npx ai-nexus test --list    # show all registered keywords

How It Works

Claude Code: Semantic Router

A hook runs on every prompt, analyzing what rules you actually need:

# Enable AI routing
export OPENAI_API_KEY=sk-xxx        # or ANTHROPIC_API_KEY
export SEMANTIC_ROUTER_ENABLED=true

Cursor: Rule Converter

ai-nexus converts .md rules to Cursor's .mdc format, adding description and alwaysApply metadata automatically. After conversion, Cursor's built-in semantic search handles rule filtering — ai-nexus does not run a router for Cursor.

Codex: Aggregated Rules

Individual rule files are aggregated into a single AGENTS.md file, which is loaded at session start. No dynamic loading.

Directory Structure

.ai-nexus/ # ai-nexus metadata ├── config/ # Merged rules from all sources ├── sources/ # Cloned Git repositories └── meta.json # Installation info .claude/ # Claude Code ├── hooks/semantic-router.cjs ├── settings.json ├── rules/ → .ai-nexus/config/rules ├── commands/ → .ai-nexus/config/commands ├── skills/ → .ai-nexus/config/skills ├── agents/ → .ai-nexus/config/agents └── contexts/ → .ai-nexus/config/contexts .cursor/rules/ # Cursor (.mdc files) ├── essential.mdc └── commit.mdc .codex/AGENTS.md # Codex

Install Modes

Symlink (default)

$ npx ai-nexus install

Copy

$ npx ai-nexus install --copy
Local priority: Existing files are never overwritten during install or update. Use --force to override.

Rule Format

Rules are markdown files with optional frontmatter:

---
description: When to load this rule (used by semantic router)
---

# Rule Title

Your rule content...

Categories:

DirectoryPurpose
rules/Coding rules (essential, security, commit conventions)
commands/Slash commands (/commit, /review)
skills/Domain knowledge (react, rust, python)
agents/Sub-agents (code reviewer, security checker)
contexts/Context files (@dev, @research)

Team Rules

Share rules across your team via Git:

# Everyone installs from the same source
$ npx ai-nexus install --rules github.com/acme/team-rules

# When rules are updated
$ npx ai-nexus update

Creating a Rules Repository

team-rules/ ├── config/ │ ├── rules/ # Core rules │ ├── commands/ # Slash commands │ ├── skills/ # Domain knowledge │ ├── agents/ # Sub-agents │ ├── contexts/ # Context files │ ├── hooks/ # semantic-router.cjs │ └── settings.json # Claude Code hook config └── README.md

Multi-Source Setup

Combine rules from multiple Git repositories:

# Base company rules
$ npx ai-nexus install --rules github.com/acme/base-rules

# Add frontend team rules
$ npx ai-nexus add github.com/acme/frontend-rules

# Add security rules
$ npx ai-nexus add github.com/acme/security-rules

# Update all at once
$ npx ai-nexus update

Community Registry

Browse and download community-contributed rules directly from GitHub — no npm publish needed.

# List all available rules
$ npx ai-nexus search

# Search by keyword
$ npx ai-nexus search react

# Download a rule
$ npx ai-nexus get react.md

# Specify category when name exists in multiple
$ npx ai-nexus get commit.md --category commands

Or use the web marketplace for a visual experience:

$ npx ai-nexus browse
Contributing: Anyone can contribute rules via PR to the GitHub repo. Rules become available immediately after merge.