ワンクリックで
flow-code-map
Use when user says 'map this codebase', 'document the architecture', 'create codebase map', or /flow-code:map.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when user says 'map this codebase', 'document the architecture', 'create codebase map', or /flow-code:map.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Internal pipeline engine. Manages the entire pipeline (brainstorm, plan, plan-review, work, impl-review, close) via flowctl phase commands. Invoked by /flow-code:go.
Use when exploring requirements before planning. Pressure-tests ideas, generates approaches, and outputs a requirements doc for /flow-code:plan. Supports --auto mode for AI self-interview (no human input needed).
Use when exploring requirements before planning. Pressure-tests ideas, generates approaches, and outputs a requirements doc for /flow-code:plan.
Use when planning features or designing implementation. Triggers on /flow-code:plan with text descriptions or Flow IDs.
Use when reviewing code changes — self-review in Worker Phase 6, impl-review, or PR review. Applies five-axis scoring with severity labels.
Use when implementing a plan or working through a spec. Triggers on /flow-code:work with Flow IDs.
| name | flow-code-map |
| description | Use when user says 'map this codebase', 'document the architecture', 'create codebase map', or /flow-code:map. |
| tier | 2 |
| user-invocable | false |
| context | fork |
Maps codebases of any size using parallel Sonnet subagents. Produces docs/CODEBASE_MAP.md — a persistent architecture reference that accelerates planning, reviews, and auto-improve experiments.
Based on Cartographer (MIT license), integrated into flow-code.
CRITICAL: Opus orchestrates, Sonnet reads. Never read codebase files directly. Always delegate to Sonnet subagents.
Full request: $ARGUMENTS
Examples:
/flow-code:map
/flow-code:map src/
/flow-code:map --update
| Param | Default | Description |
|---|---|---|
| path | . | Directory to map |
--update | auto-detect | Force update mode (only re-map changed files) |
if [[ -f docs/CODEBASE_MAP.md ]]; then
echo "Map exists — checking for changes..."
# Read last_mapped timestamp from frontmatter
head -5 docs/CODEBASE_MAP.md
# Check git changes since
LAST_MAPPED=$(sed -n 's/^last_mapped: //p' docs/CODEBASE_MAP.md)
git log --oneline --since="$LAST_MAPPED" -- . ':!docs/CODEBASE_MAP.md' 2>/dev/null | head -20
fi
If map exists and no changes: Inform user map is current. If map exists with changes: Update mode — only re-analyze changed modules. If no map: Full mapping.
PLUGIN_ROOT="$HOME/.codex"
SCANNER="$PLUGIN_ROOT/skills/flow-code-map/scripts/scan-codebase.py"
# Try uv first (auto-installs tiktoken), fallback to python3
uv run "$SCANNER" . --format json 2>/dev/null || python3 "$SCANNER" . --format json
If tiktoken is missing and uv not available:
pip3 install tiktoken
python3 "$SCANNER" . --format json
From the scan output:
Example assignment:
Subagent 1: src/api/, src/middleware/ (~120k tokens)
Subagent 2: src/components/, src/hooks/ (~140k tokens)
Subagent 3: src/lib/, src/utils/, tests/ (~100k tokens)
CRITICAL: Spawn ALL subagents in a SINGLE message with multiple Task tool calls.
Use subagent_type: "Explore" and model: "sonnet" for each group.
Each subagent prompt:
You are mapping part of a codebase. Read and analyze these files:
[list files]
For each file, document:
1. **Purpose**: One-line description
2. **Exports**: Key functions, classes, types
3. **Imports**: Notable dependencies
4. **Patterns**: Design patterns used
5. **Gotchas**: Non-obvious behavior, warnings
Also identify:
- How these files connect to each other
- Entry points and data flow
- Configuration or environment dependencies
Return your analysis as markdown with clear headers.
After all subagents complete:
Get timestamp:
date -u +"%Y-%m-%dT%H:%M:%SZ"
Create docs/CODEBASE_MAP.md:
---
last_mapped: YYYY-MM-DDTHH:MM:SSZ
total_files: N
total_tokens: N
---
# Codebase Map
> Auto-generated by flow-code:map. Last mapped: [date]
## System Overview
[Mermaid architecture diagram]
## Directory Structure
[Tree with purpose annotations]
## Module Guide
### [Module Name]
**Purpose**: ...
**Entry point**: ...
**Key files**:
| File | Purpose | Tokens |
|------|---------|--------|
**Exports**: ...
**Dependencies**: ...
## Data Flow
[Mermaid sequence diagrams for key flows]
## Conventions
[Naming, patterns, style]
## Gotchas
[Non-obvious behaviors, warnings]
## Navigation Guide
**To add a new API endpoint**: [files to touch]
**To add a new component**: [files to touch]
**To modify auth**: [files to touch]
Add or update codebase summary in AGENTS.md (or AGENTS.md):
## Codebase Overview
[2-3 sentence summary]
**Stack**: [key technologies]
**Structure**: [high-level layout]
For detailed architecture, see [docs/CODEBASE_MAP.md](docs/CODEBASE_MAP.md).
Codebase mapped!
Files: N | Tokens: N | Subagents: N
Map: docs/CODEBASE_MAP.md
The map is now available to:
- Planning scouts (repo-scout, context-scout)
- Auto-improve experiments
- Future /flow-code:map --update runs
When updating an existing map:
last_mapped timestamp