Arguments: [target-path] [--skip-review] [--writers N]. Wherever <arguments> appears below, substitute the text the user typed after the skill name.
Prerequisites
This command requires the upstream agent-teams plugin from wshobson/agents (MIT, Seth Hobson). It provides the agent-teams:task-coordination-strategies and agent-teams:team-communication-protocols skills used below. Install it first:
/plugin marketplace add wshobson/agents
/plugin install agent-teams@claude-code-workflows
The team infrastructure itself (teammate spawning via the Agent tool, plus TaskList) is a native Claude Code feature and needs no plugin, but it is experimental and OFF by default: it requires CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, best set persistently in the env block of ~/.claude/settings.json. As of Claude Code 2.1.178 there are no TeamCreate/TeamDelete tools: the team forms implicitly when the first teammate is spawned, and team resources are cleaned up automatically when the session ends. If teammate spawning is unavailable in this session, stop and tell the user to enable the flag and restart Claude Code; do not fall back to plain subagents without saying so.
Team Codebase Map
Orchestrate the codebase-mapper pipeline using parallel agent teams. Phase 2 runs 6 writers simultaneously, dramatically reducing total documentation time.
Skills to Load
Before starting, invoke these skills:
codebase-mapper:codebase-mapper -- writing guidelines, tone rules, diagram conventions
agent-teams:task-coordination-strategies -- phased task dependencies
agent-teams:team-communication-protocols -- coordination between writers
Pre-flight Checks
- Verify
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 is set
- Parse
<arguments>:
[target-path]: project root to map (default: current working directory)
--skip-review: skip Phase 3 reviewer pass
--writers N: limit parallel writers (default: 6, min: 1, max: 6)
Pipeline Overview
The sequential map-codebase command runs agents one-by-one. This team version parallelizes Phase 2:
Phase 1: Explore (sequential -- 1 agent)
- codebase-explorer builds context brief
|
v
Phase 1b: Interconnect Map (sequential -- 1 agent)
- semantic-interconnect-mapper builds structured facts
(contracts, invariants, domain rules, integration hot-spots)
|
v
Phase 2: Write (parallel -- 6 agents)
- overview-writer --> 01-overview.md, 02-features.md
- tech-writer --> 03-tech-stack.md, 04-architecture.md [reads interconnect]
- flow-writer --> 05-workflows.md, 06-data-model.md [reads interconnect]
- onboarding-writer --> 07-getting-started.md, 08-open-questions.md
- ops-writer --> 09-project-anatomy.md [reads interconnect]
- config-writer --> 10-configuration-guide.md
|
v
Phase 3: Review (sequential -- 1 agent)
- guide-reviewer --> INDEX.md [drift detection]
Phase 1: Explore (Sequential)
Spawn a single explorer agent:
Create output directories:
mkdir -p .codebase-map/_internal
Spawn codebase-mapper:codebase-explorer:
- Task: "Explore the project at {target-path} and write a context brief to
.codebase-map/_internal/context-brief.md. Follow your exploration strategy to understand what the project does, its tech stack, directory structure, key entry points, data model, and main workflows. Read actual code -- do not guess from file names. Include file paths for every claim."
- Wait for completion
Verify .codebase-map/_internal/context-brief.md exists and is non-empty
If missing or empty, stop and report the error
CHECKPOINT: Present a brief summary of what the explorer found. Ask user to confirm before continuing to Phase 1b.
Phase 1b: Interconnect Map (Sequential)
Spawn a single codebase-xray:semantic-interconnect-mapper agent:
Task:
Build the interconnect map for this project.
Primary context source: .codebase-map/_internal/context-brief.md (produced by codebase-explorer).
Target files: the whole project (infer scope from the context brief's directory structure).
Output path: .codebase-map/_internal/interconnect.md
Produce the full structured map following your agent definition: Call Graph (2-3 hop for public entry points), Contracts (formal / structural / implicit), Invariants, Domain Rules, Assumptions (verified / documented / unverified), Integration Hot-Spots, Change Impact Radius, Reviewer Hints.
Every claim must cite file:line. No recommendations, no fixes. Empty sections are acceptable if nothing applies.
Wait for completion
Verify .codebase-map/_internal/interconnect.md exists and contains the required anchors
If missing, continue to Phase 2 in degraded mode (writers use only the context brief) -- log a warning
Phase 2: Parallel Write Team (6 agents)
Spawn a write team with 6 specialists working simultaneously:
- The team forms implicitly when the first writer is spawned (no
TeamCreate step; the team name is session-derived and any team_name passed to the Agent tool is ignored)
- Spawn all 6 agents in parallel:
Agent 1: Overview Writer
subagent_type: codebase-mapper:overview-writer
- Task: "Read
.codebase-map/_internal/context-brief.md, then write .codebase-map/01-overview.md and .codebase-map/02-features.md. Include a Mermaid mindmap in the overview. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."
- Output:
01-overview.md, 02-features.md
Agent 2: Tech Writer
subagent_type: codebase-mapper:tech-writer
- Task: "Read
.codebase-map/_internal/context-brief.md, then write .codebase-map/03-tech-stack.md and .codebase-map/04-architecture.md. Include a Mermaid component/layer diagram in the architecture doc. If .codebase-map/_internal/interconnect.md exists, read its ## Call Graph, ## Contracts, and ## Integration Hot-Spots anchors and cite those structured facts in the architecture doc instead of paraphrasing code. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."
- Output:
03-tech-stack.md, 04-architecture.md
Agent 3: Flow Writer
subagent_type: codebase-mapper:flow-writer
- Task: "Read
.codebase-map/_internal/context-brief.md, then write .codebase-map/05-workflows.md and .codebase-map/06-data-model.md. Include Mermaid flowcharts and sequence diagrams for workflows, and an ER diagram for the data model. If .codebase-map/_internal/interconnect.md exists, read its ## Invariants (especially temporal), ## Integration Hot-Spots, and ## Domain Rules anchors and encode those facts directly in sequence diagrams and data-flow narratives. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."
- Output:
05-workflows.md, 06-data-model.md
Agent 4: Onboarding Writer
subagent_type: codebase-mapper:onboarding-writer
- Task: "Read
.codebase-map/_internal/context-brief.md, then write .codebase-map/07-getting-started.md and .codebase-map/08-open-questions.md. Make getting-started practical with copy-pasteable commands. Make open-questions specific and actionable. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."
- Output:
07-getting-started.md, 08-open-questions.md
Agent 5: Ops Writer
subagent_type: codebase-mapper:ops-writer
- Task: "Read
.codebase-map/_internal/context-brief.md, then write .codebase-map/09-project-anatomy.md. Document the annotated directory tree, every configuration file and what it controls, all environment variables, scripts and executables, startup sequence, and default ports/URLs. If .codebase-map/_internal/interconnect.md exists, read its ## Integration Hot-Spots anchor (rows of type Env/config) and use it as the authoritative list of env vars and config files. Verify claims by reading actual config files and grepping for env var usage. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."
- Output:
09-project-anatomy.md
Agent 6: Config Writer
subagent_type: codebase-mapper:config-writer
- Task: "Read
.codebase-map/_internal/context-brief.md, then write .codebase-map/10-configuration-guide.md. Write a practical guide covering configuration walkthrough, environment profiles, configuration recipes, common day-to-day operations with exact commands, troubleshooting with real error messages from the codebase, and a quick-reference cheat sheet. Verify by reading actual config files and grepping for error messages. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."
- Output:
10-configuration-guide.md
- Monitor
TaskList for completion
- Track: "{completed}/6 writers complete"
Verify: Check that all 10 documents exist:
ls -la .codebase-map/0*.md .codebase-map/10*.md
If any documents are missing, report which ones failed. Continue to Phase 3 with available documents.
Phase 3: Review (Sequential)
Skip if --skip-review.
Spawn a single reviewer agent:
subagent_type: codebase-mapper:guide-reviewer
- Task: "Read all documents in
.codebase-map/ (01 through 10) and the context brief in _internal/. If .codebase-map/_internal/interconnect.md exists, also read its ## Invariants and ## Domain Rules anchors and use the senior-review:defect-taxonomy skill's logic-integrity.md reference to detect documentation-reality drift. Flag any drift as a '⚠ known inconsistency' callout in the affected doc and add a corresponding item to 08-open-questions.md. Review for terminology consistency, add cross-references between documents, fix any AI boilerplate in tone, validate Mermaid diagram syntax, and detect gaps. Apply edits directly. Then write .codebase-map/INDEX.md as the entry point with a navigable summary table and suggested reading paths."
- Wait for completion
Verify: Check that .codebase-map/INDEX.md exists.
Phase 4: Cleanup & Summary
- Send
shutdown_request to all remaining teammates
- Team resources are cleaned up automatically when the session ends; there is no
TeamDelete step
- Present final summary:
Codebase map generated in .codebase-map/ (Team Mode)
## Parallel Execution Summary
- Phase 1 (Explore): 1 agent built context brief
- Phase 2 (Write): 6 agents ran in parallel (saved ~80% writing time)
- Phase 3 (Review): 1 agent unified tone and cross-references
## Output Files
INDEX.md - Entry point and navigation
01-overview.md - Project overview with concept mindmap
02-features.md - Feature catalog
03-tech-stack.md - Technologies and dependencies
04-architecture.md - Code organization with component diagram
05-workflows.md - User and system flows with diagrams
06-data-model.md - Entities and relationships with ER diagram
07-getting-started.md - Developer onboarding guide
08-open-questions.md - Knowledge gaps to clarify
09-project-anatomy.md - Config files, env vars, scripts, directory tree
10-configuration-guide.md - Configuration recipes, operations, troubleshooting
Start reading from INDEX.md
1---2name: team-codebase-map3description: Multi-agent variant of /codebase-mapper:map-codebase: one explorer, 6 writers at once, then a review pass producing INDEX.md. TRIGGER WHEN: the user wants a codebase guide built by parallel writers, typically on a large project.4---56> Arguments: `[target-path] [--skip-review] [--writers N]`. Wherever `<arguments>` appears below, substitute the text the user typed after the skill name.78<!-- Generated by the Daodan compiler for codex. Edit the kernel, never this file. -->910## Prerequisites1112This command requires the upstream `agent-teams` plugin from `wshobson/agents` (MIT, Seth Hobson). It provides the `agent-teams:task-coordination-strategies` and `agent-teams:team-communication-protocols` skills used below. Install it first:1314```15/plugin marketplace add wshobson/agents16/plugin install agent-teams@claude-code-workflows17```1819The team infrastructure itself (teammate spawning via the `Agent` tool, plus TaskList) is a native Claude Code feature and needs no plugin, but it is experimental and OFF by default: it requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`, best set persistently in the `env` block of `~/.claude/settings.json`. As of Claude Code 2.1.178 there are no `TeamCreate`/`TeamDelete` tools: the team forms implicitly when the first teammate is spawned, and team resources are cleaned up automatically when the session ends. If teammate spawning is unavailable in this session, stop and tell the user to enable the flag and restart Claude Code; do not fall back to plain subagents without saying so.2021# Team Codebase Map2223Orchestrate the codebase-mapper pipeline using parallel agent teams. Phase 2 runs 6 writers simultaneously, dramatically reducing total documentation time.2425## Skills to Load2627Before starting, invoke these skills:28- `codebase-mapper:codebase-mapper` -- writing guidelines, tone rules, diagram conventions29- `agent-teams:task-coordination-strategies` -- phased task dependencies30- `agent-teams:team-communication-protocols` -- coordination between writers3132## Pre-flight Checks33341. Verify `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is set352. Parse `<arguments>`:36 - `[target-path]`: project root to map (default: current working directory)37 - `--skip-review`: skip Phase 3 reviewer pass38 - `--writers N`: limit parallel writers (default: 6, min: 1, max: 6)3940## Pipeline Overview4142The sequential map-codebase command runs agents one-by-one. This team version parallelizes Phase 2:4344```45Phase 1: Explore (sequential -- 1 agent)46 - codebase-explorer builds context brief47 |48 v49Phase 1b: Interconnect Map (sequential -- 1 agent)50 - semantic-interconnect-mapper builds structured facts51 (contracts, invariants, domain rules, integration hot-spots)52 |53 v54Phase 2: Write (parallel -- 6 agents)55 - overview-writer --> 01-overview.md, 02-features.md56 - tech-writer --> 03-tech-stack.md, 04-architecture.md [reads interconnect]57 - flow-writer --> 05-workflows.md, 06-data-model.md [reads interconnect]58 - onboarding-writer --> 07-getting-started.md, 08-open-questions.md59 - ops-writer --> 09-project-anatomy.md [reads interconnect]60 - config-writer --> 10-configuration-guide.md61 |62 v63Phase 3: Review (sequential -- 1 agent)64 - guide-reviewer --> INDEX.md [drift detection]65```6667## Phase 1: Explore (Sequential)6869Spawn a single explorer agent:70711. Create output directories:72 ```bash73 mkdir -p .codebase-map/_internal74 ```75762. Spawn `codebase-mapper:codebase-explorer`:77 - Task: "Explore the project at {target-path} and write a context brief to `.codebase-map/_internal/context-brief.md`. Follow your exploration strategy to understand what the project does, its tech stack, directory structure, key entry points, data model, and main workflows. Read actual code -- do not guess from file names. Include file paths for every claim."78 - Wait for completion79803. Verify `.codebase-map/_internal/context-brief.md` exists and is non-empty814. If missing or empty, stop and report the error8283**CHECKPOINT**: Present a brief summary of what the explorer found. Ask user to confirm before continuing to Phase 1b.8485## Phase 1b: Interconnect Map (Sequential)8687Spawn a single `codebase-xray:semantic-interconnect-mapper` agent:88891. Task:90 > Build the interconnect map for this project.91 >92 > Primary context source: `.codebase-map/_internal/context-brief.md` (produced by codebase-explorer).93 > Target files: the whole project (infer scope from the context brief's directory structure).94 > Output path: `.codebase-map/_internal/interconnect.md`95 >96 > Produce the full structured map following your agent definition: Call Graph (2-3 hop for public entry points), Contracts (formal / structural / implicit), Invariants, Domain Rules, Assumptions (verified / documented / unverified), Integration Hot-Spots, Change Impact Radius, Reviewer Hints.97 >98 > Every claim must cite file:line. No recommendations, no fixes. Empty sections are acceptable if nothing applies.991002. Wait for completion1013. Verify `.codebase-map/_internal/interconnect.md` exists and contains the required anchors1024. If missing, continue to Phase 2 in degraded mode (writers use only the context brief) -- log a warning103104## Phase 2: Parallel Write Team (6 agents)105106Spawn a write team with 6 specialists working simultaneously:1071081. The team forms implicitly when the first writer is spawned (no `TeamCreate` step; the team name is session-derived and any `team_name` passed to the `Agent` tool is ignored)1092. Spawn all 6 agents in parallel:110111**Agent 1: Overview Writer**112- `subagent_type`: `codebase-mapper:overview-writer`113- Task: "Read `.codebase-map/_internal/context-brief.md`, then write `.codebase-map/01-overview.md` and `.codebase-map/02-features.md`. Include a Mermaid mindmap in the overview. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."114- Output: `01-overview.md`, `02-features.md`115116**Agent 2: Tech Writer**117- `subagent_type`: `codebase-mapper:tech-writer`118- Task: "Read `.codebase-map/_internal/context-brief.md`, then write `.codebase-map/03-tech-stack.md` and `.codebase-map/04-architecture.md`. Include a Mermaid component/layer diagram in the architecture doc. If `.codebase-map/_internal/interconnect.md` exists, read its `## Call Graph`, `## Contracts`, and `## Integration Hot-Spots` anchors and cite those structured facts in the architecture doc instead of paraphrasing code. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."119- Output: `03-tech-stack.md`, `04-architecture.md`120121**Agent 3: Flow Writer**122- `subagent_type`: `codebase-mapper:flow-writer`123- Task: "Read `.codebase-map/_internal/context-brief.md`, then write `.codebase-map/05-workflows.md` and `.codebase-map/06-data-model.md`. Include Mermaid flowcharts and sequence diagrams for workflows, and an ER diagram for the data model. If `.codebase-map/_internal/interconnect.md` exists, read its `## Invariants` (especially temporal), `## Integration Hot-Spots`, and `## Domain Rules` anchors and encode those facts directly in sequence diagrams and data-flow narratives. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."124- Output: `05-workflows.md`, `06-data-model.md`125126**Agent 4: Onboarding Writer**127- `subagent_type`: `codebase-mapper:onboarding-writer`128- Task: "Read `.codebase-map/_internal/context-brief.md`, then write `.codebase-map/07-getting-started.md` and `.codebase-map/08-open-questions.md`. Make getting-started practical with copy-pasteable commands. Make open-questions specific and actionable. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."129- Output: `07-getting-started.md`, `08-open-questions.md`130131**Agent 5: Ops Writer**132- `subagent_type`: `codebase-mapper:ops-writer`133- Task: "Read `.codebase-map/_internal/context-brief.md`, then write `.codebase-map/09-project-anatomy.md`. Document the annotated directory tree, every configuration file and what it controls, all environment variables, scripts and executables, startup sequence, and default ports/URLs. If `.codebase-map/_internal/interconnect.md` exists, read its `## Integration Hot-Spots` anchor (rows of type Env/config) and use it as the authoritative list of env vars and config files. Verify claims by reading actual config files and grepping for env var usage. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."134- Output: `09-project-anatomy.md`135136**Agent 6: Config Writer**137- `subagent_type`: `codebase-mapper:config-writer`138- Task: "Read `.codebase-map/_internal/context-brief.md`, then write `.codebase-map/10-configuration-guide.md`. Write a practical guide covering configuration walkthrough, environment profiles, configuration recipes, common day-to-day operations with exact commands, troubleshooting with real error messages from the codebase, and a quick-reference cheat sheet. Verify by reading actual config files and grepping for error messages. Follow the writing guidelines -- narrative tone, no AI boilerplate, file paths for every claim."139- Output: `10-configuration-guide.md`1401413. Monitor `TaskList` for completion1424. Track: "{completed}/6 writers complete"143144**Verify:** Check that all 10 documents exist:145```bash146ls -la .codebase-map/0*.md .codebase-map/10*.md147```148149If any documents are missing, report which ones failed. Continue to Phase 3 with available documents.150151## Phase 3: Review (Sequential)152153**Skip if** `--skip-review`.154155Spawn a single reviewer agent:156157- `subagent_type`: `codebase-mapper:guide-reviewer`158- Task: "Read all documents in `.codebase-map/` (01 through 10) and the context brief in `_internal/`. If `.codebase-map/_internal/interconnect.md` exists, also read its `## Invariants` and `## Domain Rules` anchors and use the `senior-review:defect-taxonomy` skill's `logic-integrity.md` reference to detect documentation-reality drift. Flag any drift as a '⚠ known inconsistency' callout in the affected doc and add a corresponding item to 08-open-questions.md. Review for terminology consistency, add cross-references between documents, fix any AI boilerplate in tone, validate Mermaid diagram syntax, and detect gaps. Apply edits directly. Then write `.codebase-map/INDEX.md` as the entry point with a navigable summary table and suggested reading paths."159- Wait for completion160161**Verify:** Check that `.codebase-map/INDEX.md` exists.162163## Phase 4: Cleanup & Summary1641651. Send `shutdown_request` to all remaining teammates1662. Team resources are cleaned up automatically when the session ends; there is no `TeamDelete` step1673. Present final summary:168169```170Codebase map generated in .codebase-map/ (Team Mode)171172## Parallel Execution Summary173- Phase 1 (Explore): 1 agent built context brief174- Phase 2 (Write): 6 agents ran in parallel (saved ~80% writing time)175- Phase 3 (Review): 1 agent unified tone and cross-references176177## Output Files178 INDEX.md - Entry point and navigation179 01-overview.md - Project overview with concept mindmap180 02-features.md - Feature catalog181 03-tech-stack.md - Technologies and dependencies182 04-architecture.md - Code organization with component diagram183 05-workflows.md - User and system flows with diagrams184 06-data-model.md - Entities and relationships with ER diagram185 07-getting-started.md - Developer onboarding guide186 08-open-questions.md - Knowledge gaps to clarify187 09-project-anatomy.md - Config files, env vars, scripts, directory tree188 10-configuration-guide.md - Configuration recipes, operations, troubleshooting189190Start reading from INDEX.md191```