中文版 | English
Repo-aware routing for AI coding CLIs as an installable skill for multiple agent hosts.
AgentRepoRouter installs into OpenClaw, Claude Code, OpenCode, Codex, and Hermes skill locations. It does not replace those tools. It routes tasks to the right repo, preserves each CLI's native agent and skill conventions, and uses structured repo metadata to improve navigation.
flowchart TD
start["Start scripts/install.sh"] --> env["Check Node.js 18+, Git, and TTY support"]
env --> hosts["Detect available agent hosts"]
hosts --> lang["Select skill language: Chinese / English"]
lang --> mode{"Select install mode"}
mode -->|Global| global["Write canonical skill directory: ~/.agents/skills/agent-repo-router"]
mode -->|Single host| single["Write selected host skill directory directly"]
mode -->|Custom hosts| custom["Write canonical directory and link selected hosts"]
global --> installHosts["Resolve installHosts"]
single --> installHosts
custom --> installHosts
installHosts --> clis["Select executionClis"]
clis --> discovery{"Choose project discovery mode"}
discovery -->|Auto scan| autoScan["Scan local projects and collect repo metadata"]
discovery -->|Manual| manual["Enter absolute project paths"]
autoScan --> assets["Detect project-level skills and agents"]
manual --> assets
assets --> mapping["Generate schema v2 repo_mappings.json"]
mapping --> deploy["Deploy SKILL.md and references/guide.*.md"]
deploy --> links{"Need host symlinks?"}
links -->|Global / Custom hosts| symlink["Symlink host skill directories to the canonical directory"]
links -->|Single host| direct["Keep direct host install directory"]
symlink --> validate["Validate repo_mappings.json"]
direct --> validate
validate --> done["Install complete: host can load agent-repo-router"]
flowchart TD
user["User submits a coding task"] --> host["OpenClaw / Claude Code / OpenCode / Codex / Hermes"]
host --> skill["Load agent-repo-router Skill"]
skill --> config["Read references/repo_mappings.json"]
config --> repoDecision{"Can the target repo be resolved confidently?"}
repoDecision -->|User specified repo| targetRepo["Use the user-specified repo"]
repoDecision -->|repo name / alias / task intent match| targetRepo
repoDecision -->|No reliable match| askRepo["Ask the user for the target repo"]
askRepo --> targetRepo
targetRepo --> projectHints["Read aliases, skills, and agents for the repo"]
projectHints --> projectAssets{"Project-level skill / agent matched?"}
projectAssets -->|Yes| projectPlan["Compose skill / agent prompt using the native CLI convention"]
projectAssets -->|No| globalAssets{"Global skill / agent strictly matched?"}
globalAssets -->|Yes| globalPlan["Attach global capability conservatively"]
globalAssets -->|No| fallback["Fallback by executionClis order"]
projectPlan --> chooseCli{"Choose execution CLI"}
globalPlan --> chooseCli
fallback --> chooseCli
chooseCli --> claude["Claude Code: cd repo && claude -p task"]
chooseCli --> opencode["OpenCode: cd repo && opencode run task"]
chooseCli --> cursor["Cursor: cd repo && agent -p task"]
chooseCli --> codex["Codex: cd repo && codex exec task"]
chooseCli --> hermes["Hermes: cd repo && hermes --oneshot task"]
claude --> result["Native CLI runs in the target repo and returns the result"]
opencode --> result
cursor --> result
codex --> result
hermes --> result
Many developers now have more than one coding CLI, more than one repo, and more than one place where custom agents or skills live.
The real problem is often not "how do I run 20 agents in parallel?" It is:
- Which repo should this task run in?
- Which CLI is the best fit for this repo?
- Does this repo already contain a project-level skill or agent I should use first?
- How do I keep one agent-host entry point without flattening away each CLI's native conventions?
AgentRepoRouter is built for that gap.
The best way to understand AgentRepoRouter is:
- OpenClaw, Claude Code, OpenCode, Codex, or Hermes can host the skill.
- AgentRepoRouter is the routing layer for coding work.
- Claude Code, OpenCode, Cursor, Codex, and Hermes stay as the execution backends.
This means AgentRepoRouter is intentionally lighter than a full orchestration runtime. It focuses on entry, routing, repo selection, and native CLI invocation rather than boards, worktrees, PR lifecycle automation, or parallel swarms.
This round of repo research led to three practical conclusions:
- AgentRepoRouter's value is not "beating" heavy orchestrators. Its value is being the thin but useful layer that makes agent hosts repo-aware and CLI-aware for real coding tasks.
- The most important differentiator is preserving native CLI ecosystems instead of inventing a new abstraction that hides them.
- With
aliases, detected projectskills, and detected projectagentsnow embedded inrepo_mappings.json, AgentRepoRouter is no longer just a thin prompt wrapper. It becomes structured routing context that supported hosts can navigate reliably.
# Install from GitHub
curl -fsSL https://raw.githubusercontent.com/wufei-png/AgentRepoRouter/main/scripts/install.sh | bash
# Or local install
bash scripts/install.sh
# Non-interactive install with explicit repositories
bash scripts/install.sh --yes --language zh --repo /absolute/path/to/repo --hosts codex --execution-clis codex
# Non-interactive install by scanning a repository prefix
bash scripts/install.sh --yes --auto-scan \
--scan-root /absolute/path/to/repos-a \
--scan-root /absolute/path/to/repos-b \
--scan-depth 5 --hosts all --execution-clis all
# Review repo aliases and detected project assets
vim ~/.agents/skills/agent-repo-router/references/repo_mappings.json
# Start your host, for example OpenClaw
openclawUser
-> OpenClaw / Claude Code / OpenCode / Codex / Hermes
-> Router Skill
-> repo match via repo name / alias / task intent
-> project-level skill / agent hints from repo_mappings.json
-> direct native CLI execution
scripts/install.shchecks Node.js 18+ and Git, then detects supported agent hosts.- The installer lets you choose language, install mode, install hosts, and execution CLIs separately.
- Default install mode is global: write once to
~/.agents/skills/agent-repo-routerand symlink detected hosts. - Single-host mode installs directly into the selected host skill directory.
- Custom-host mode writes the canonical global copy and symlinks selected hosts.
- Project discovery supports auto scan, repeated
--repoarguments, manual absolute paths, and configurable scan depth. Auto scan accepts multiple repository prefixes, defaults to depth5, and scripts can use--scan-depth NorAGENT_REPO_ROUTER_SCAN_MAX_DEPTH=N. - Non-interactive installs support
--yes,--language zh|en,--install-mode global|single|custom,--hosts,--execution-clis,--existing backup|skip|overwrite,--repo,--auto-scan, and repeated--scan-root. --hosts allmeans all detected install hosts; if none are detected, the installer falls back to the Codex canonical target. Explicit host names are allowed even when the host CLI is not detected.--execution-clis allmeans all detected execution CLIs in the fixed orderclaude-code,opencode,cursor,codex,hermes; explicitly listed execution CLIs must be installed.- Reinstalls default to
--existing backup, which moves real old install targets under${TMPDIR:-/tmp}/agent-repo-router-skill-backups/install-*and creates a freshrepo_mappings.jsoninstead of merging aliases. Existing symlink install targets are unlinked and recreated, not backed up. - The generated repo config includes
aliases, detected project-levelskills, and detected project-levelagents. - The installer writes schema v2
repo_mappings.jsonwithinstallMode,installHosts, andexecutionClis. - The repo includes unit, integration, and E2E tests plus opt-in live OpenClaw E2E coverage.
AgentRepoRouter is delivered as a skill, not as another daemon or control plane. It can be installed directly for one host or installed once globally and linked into multiple host skill directories.
Routing quality depends on repo context. repo_mappings.json is therefore not just a list of paths. It is a small routing catalog:
{
"schemaVersion": 2,
"installMode": "global",
"installHosts": ["global", "openclaw", "claude-code", "opencode", "codex", "hermes"],
"executionClis": ["claude-code", "opencode", "cursor", "codex", "hermes"],
"repos": [
{
"name": "example-backend",
"path": "/path/to/backend",
"aliases": ["backend", "api"],
"skills": {
"claude-code": [
{
"name": "build_and_test",
"description": "Run build and tests before finishing changes."
}
]
},
"agents": {
"claude-code": [
{
"name": "bugfix",
"description": "Fix bugs and regressions with targeted changes."
}
]
}
}
]
}Each CLI already has its own invocation model and project asset conventions. AgentRepoRouter keeps those differences visible and uses them rather than hiding them.
- Claude Code:
claude -p "task"orclaude --agent <name> "task" - OpenCode:
opencode run "task"with prompt-based agent selection - Cursor:
agent -p "task"with prompt-based agent selection - Codex:
codex exec "task"with project-level.agents/skills/,.codex/agents/, andAGENTS.md - Hermes:
hermes --oneshot "task"with Hermes skill conventions
If a repo already has a project-level skill or agent, that should be treated as a strong hint before any global helper is attached.
5. Explicit Fallback Beats Hidden Magic
If nothing matches reliably, AgentRepoRouter falls back using the executionClis order in repo_mappings.json. The behavior stays inspectable and predictable.
The newer aliases and detected skills and agents fields directly improve routing in ways the earlier minimal schema could not:
aliaseslets the host match user language to repo nicknames such asapi,docs, oradmin.skillsgives the router project-level capability hints before the CLI even starts.agentsgives the router project-level specialist hints without forcing weak global matches.- The
references/folder keeps the runtime skill short while moving longer CLI conventions into explicit reference docs.
The projects below are good comparison points, but they optimize for different layers of the stack.
| Project | Primary role | Execution model | What it optimizes for | How it differs from AgentRepoRouter |
|---|---|---|---|---|
| AgentRepoRouter | Repo-aware routing skill for multiple agent hosts | One skill chooses repo, skill, agent, and CLI, then calls the native CLI directly | Unified entry and predictable routing across multiple coding CLIs | Focuses on routing and native convention preservation instead of full orchestration |
| OpenClaw | Local-first personal assistant and control plane | Sessions, channels, skills, tools, and agents under one assistant runtime | Communication surfaces, sessions, skills, local-first assistant behavior | AgentRepoRouter is a coding-focused skill on top of OpenClaw, not a replacement |
| MCO | Parallel multi-CLI orchestration | Dispatch the same prompt to multiple coding CLIs and synthesize the results | Fan-out review, consensus, multi-model comparison | AgentRepoRouter chooses one best-fit path first; MCO is better when you want parallel review or consensus |
| agtx | Multi-agent task board and lifecycle manager | Kanban board, tmux sessions, worktrees, and orchestration agent | Persistent task flow across many agent sessions | AgentRepoRouter is much lighter and does not own task boards or worktree lifecycles |
| Agent Orchestrator | Autonomous PR and CI workflow automation | Dashboard plus agents in isolated worktrees reacting to CI and review feedback | Ticket-to-PR automation at scale | AgentRepoRouter stays as a routing layer and avoids taking over the whole delivery lifecycle |
| metaswarm | Opinionated SDLC orchestration framework | Multi-phase workflow, many personas, review gates, recursive orchestration | Strong process control and self-improving delivery loops | AgentRepoRouter is less opinionated, simpler to adopt, and easier to layer onto an existing OpenClaw setup |
| burn-harness | Continuous developer task queue for coding agents | Background loop pulls tasks, executes work, creates draft PRs, retries failures | Non-stop task throughput | AgentRepoRouter is interactive and routing-oriented rather than a background worker queue |
- Multi-host deployment: install once globally and link detected hosts, or install directly for one host.
- Repo-aware navigation: repo names, aliases, and task intent all contribute to routing.
- Structured project hints: detected project-level skills and agents are stored in config instead of living only in prompt text.
- Low lock-in: the execution step is still the original CLI, not a custom wrapper protocol.
- Native conventions preserved: AgentRepoRouter adapts to Claude Code, OpenCode, Cursor, Codex, and Hermes instead of pretending they are identical.
- Short runtime skill, longer references: the active
SKILL.mdstays readable whilereferences/holds the detailed conventions. - Installer plus validation: repo config is generated and validated automatically.
- Tested baseline: the repo includes unit, integration, E2E, and opt-in live tests.
| CLI | Non-interactive task command | Project or custom config |
|---|---|---|
| Claude Code | claude -p "task" |
~/.claude/agents/, <repo>/.claude/agents/, <repo>/.claude/skills/ |
| OpenCode | opencode run "task" |
~/.config/opencode/agents/, <repo>/.opencode/agents/, <repo>/.opencode/skills/ |
| Cursor | agent -p "task" |
~/.cursor/agents/, <repo>/.cursor/agents/ |
| Codex | codex exec "task" |
~/.codex/config.toml, .codex/config.toml, ~/.codex/agents/, .codex/agents/, .agents/skills/, AGENTS.md |
| Hermes | hermes --oneshot "task" |
~/.hermes/skills/software-development/, host-specific Hermes config |
| Host | Direct skill path |
|---|---|
| OpenClaw | ~/.openclaw/skills/agent-repo-router |
| Claude Code | ~/.claude/skills/agent-repo-router |
| OpenCode | ~/.config/opencode/skills/agent-repo-router |
| Codex | ~/.agents/skills/agent-repo-router |
| Hermes | ~/.hermes/skills/software-development/agent-repo-router |
Codex's current public Agent Skills manual lists user skills under $HOME/.agents/skills; ~/.codex/skills is not the user skill discovery path for this installer.
Codex also officially supports codex exec -C /path/to/repo "task". AgentRepoRouter documentation still uses cd /path && ... examples so the routing pattern stays uniform across CLIs.
User: "Fix the auth bug in the api project, use the repo's build_and_test skill."
Router:
1. Match repo alias `api` -> `example-backend`
2. Read detected project skills -> `build_and_test`
3. Read detected project agents -> `bugfix`
4. Choose the best native CLI path
5. Execute directly in the target repo
Use AgentRepoRouter when you want:
- an existing agent host as the entry point
- multiple repos and multiple coding CLIs
- routing that respects project-level skills and agents
- a lighter layer than full agent swarms or kanban orchestrators
Pair AgentRepoRouter with other tools when needed:
- use MCO when you want the same task reviewed by multiple CLIs in parallel
- use agtx or Agent Orchestrator when you want worktree-heavy lifecycle automation
- use metaswarm when you want a much more opinionated SDLC process
- CLAUDE.md - Full project context
- docs/ARCHITECTURE.md - Current architecture and runtime conventions
- docs/PRODUCT.md - Future roadmap, not current implementation
- docs/advertisement/why-agent-repo-router.md - Recommendation article for potential users
- docs/plans/migration/plan.md - Migration history and implementation plan
- legacy/README.md - Archived legacy materials
