multirepo-space
npx skills add https://github.com/tacuchi/multirepo-space --skill multirepo-space
Agent 安装分布
Skill 文档
multirepo-space
Quick routing
User intent â Command:
- “Create/scaffold workspace” â
setup - “Add a repo” â
add(verify workspace exists withstatusfirst) - “Remove/detach repo” â
remove - “Check/verify/health” â
status - Single repo project â DO NOT use this Skill
- Monorepo (Nx/Turborepo) â DO NOT use this Skill
Before running â decision guide
Before executing, think about the workspace design:
- Do these repos share API contracts or interfaces? â they benefit from cross-repo analysis (global agents)
- Is the workspace inside an existing git repo? â git root symlinks will be needed
- Will multiple workspaces coexist in the same git repo? â prefixed symlinks prevent collisions
Ask the user before executing:
- Does the workspace directory already exist? If not, create it first (
mkdir). - Is this a NEW workspace or adding to an EXISTING one? â
setupvsadd. - Are all repo paths absolute? They MUST be absolute â symlinks break with relative paths.
- First time? Always suggest
--dry-runso user can preview changes. - Does the user want global transversal agents? Default is yes. Use
--no-global-agentsto opt out. - Does the user need custom model assignments? Default: coordinator=opus, specialist=sonnet, global=sonnet.
Flags â when to use each
| Flag | Use when | Do NOT use when |
|---|---|---|
--dry-run |
First run, user not familiar with tool | Re-runs after preview was approved |
--yes |
Automated pipelines, user already confirmed in chat | First time, destructive changes |
--verbose |
Debugging, verifying stack detection | Normal execution |
--model-coordinator=MODEL |
User wants a specific model for the coordinator | Using default (opus) |
--model-specialist=MODEL |
User wants a specific model for specialists | Using default (sonnet) |
--model-global=MODEL |
User wants a specific model for global agents | Using default (sonnet) |
--no-global-agents |
User explicitly does not want transversal agents | Default setup (global agents enabled) |
If detect_stack returns “Generic”
The CLI creates the specialist agent without verify commands. Ask the user: “Stack was not auto-detected for [repo]. What is the main language/framework?” Then manually add verify commands to the generated specialist agent file.
When NOT to use this
- Single repo projects â no benefit, just overhead.
- True monorepos (one repo, multiple packages) â use monorepo tools (Nx, Turborepo) instead.
- Repos that must stay completely independent â managed blocks modify external repos’ AGENTS.md/CLAUDE.md.
NEVER
- Run
setupon a populated workspace without confirming with the user first. - Use relative paths for repos â symlinks will break when working directory changes.
- Skip
--dry-runfor first-time users â always suggest preview first. - Assume symlinks always work on Windows â the PowerShell port falls back to junctions when symlinks need elevation, but junctions only support local directories (not network paths).
- Assume workspace exists â verify with
statusbefore runningaddorremove. - Create the workspace directory inside one of the repos â git root detection will find the repo itself, creating circular symlink references.
- Edit managed blocks manually in external repos â they get overwritten on next
add/setup. - Run
addwith a repo whose basename matches an existing alias â the previous specialist gets overwritten without warning. - Modify
settings.jsonmanually â the CLI expects a specific format and manual edits can break parsing inadd/remove. - Run
setup/addwhile another agent is using the workspace â managed blocks and settings can end up in an inconsistent state.
Detect OS and run
- macOS/Linux/WSL:
bash "$SKILL_DIR/scripts/multirepo-space" <subcommand> [args] - Windows PowerShell:
powershell "$SKILL_DIR/scripts/multirepo-space.ps1" <subcommand> [args]
Replace $SKILL_DIR with the absolute path to this skill’s directory.
Templates are in $SKILL_DIR/templates/ â read them to understand what files get generated (e.g., workspace-instructions.md.tmpl, coordinator.md.tmpl, specialist.md.tmpl, global-agent.md.tmpl).
Script behavior summary
The scripts (scripts/multirepo-space for bash, scripts/multirepo-space.ps1 for PowerShell) are fully offline â they make NO network requests and do NOT modify system files.
What each subcommand does:
setup: reads repo manifest files (package.json, pom.xml, etc.) to detect tech stacks, then generates.mdagent files,.claude/settings.json, and symlinks inside the workspace directory. Also appends a managed block toAGENTS.md/CLAUDE.mdin each listed repo. Creates global transversal agents (architecture, style, code-review) unless--no-global-agents. If workspace is nested inside a git repo, creates prefixed symlinks in git root for agent discovery. Saves configuration to.claude/.multirepo-space.conf.add: same as setup but for a single repo added to an existing workspace. Loads config from.multirepo-space.confto preserve original model and global agent settings.remove: deletes the specialist agent file and symlink for a repo, removes the managed block from the repo’sAGENTS.md/CLAUDE.md, and refreshes git root symlinks.status: read-only â checks symlink health, agent file parity, global agents, config persistence, and git root symlink state. Writes nothing.
All extracted values from repo files are sanitized (length-limited, control characters and injection patterns stripped) before being inserted into templates.
Scope of filesystem writes is limited to:
- The workspace directory (files it creates)
AGENTS.md/CLAUDE.mdinside each configured repo (managed block only, delimited by<!-- MULTIREPO_SPACE_MANAGED:START/END -->markers)- Git root
.claude/agents/and.agents/directories (symlinks only, prefixed withws-<name>--)
Agent hierarchy
Coordinator (opus)
âââ architecture-agent (sonnet) â transversal, read-only
âââ style-agent (sonnet) â transversal, read-only
âââ code-review-agent (sonnet) â transversal, read-only
âââ repo-frontend (sonnet) â can invoke global agents
âââ repo-backend (sonnet) â can invoke global agents
- Global agents: read-only, analyze and recommend, never modify code
- Specialists can invoke global agents for analysis within their repo
- Coordinator invokes global agents for cross-repo analysis
Claude Code vs Codex compatibility
.claude/agents/*.mdâ includes YAML frontmatter (model, description, allowedTools).agents/*.mdâ plain markdown only, no frontmatter (Codex/Gemini/Cursor compatible)- Both directories contain identical agent logic, only the frontmatter differs
After running
- Run
status <workspace_path>to verify all symlinks are healthy and agents are in parity. - Check that AGENTS.md and CLAUDE.md exist in both the workspace and each external repo.
- If
setupfailed mid-way, it’s safe to re-run â existing files get overwritten. - To start working:
cd <workspace_path> && claudeorcd <workspace_path> && codex. - If workspace is nested in a git repo, verify git root symlinks with
ls -la <git-root>/.claude/agents/ws-*.
Common issues
- “Workspace path does not exist”: create directory first, then run
setup. - Broken symlinks after moving repos: re-run
setupwith updated absolute paths. - “Permission denied” on Windows: run PowerShell as Administrator for symlink creation.
- Stack not detected: the CLI falls back to “Generic” â specialist agent still gets created, just without stack-specific verify commands.
- Agents not discovered in nested workspace: verify git root symlinks exist. Run
statusto check. Re-runsetupif symlinks are missing. - Partial setup failure (files created but symlinks missing): re-run
setupwith same args â the script overwrites existing files safely and recreates all symlinks. - Global agents not generated: check if
--no-global-agentswas used during setup. Config is saved in.claude/.multirepo-space.conf.