Focus-to-Document Mapping
| Focus | Documents Produced |
|---|---|
tech |
STACK.md, INTEGRATIONS.md |
arch |
ARCHITECTURE.md, STRUCTURE.md |
quality |
CONVENTIONS.md, TESTING.md |
concerns |
CONCERNS.md |
tech+arch |
STACK.md, INTEGRATIONS.md, ARCHITECTURE.md, STRUCTURE.md |
Step 1: Parse arguments and resolve focus
Parse the user's input for --focus <area>. Default to tech+arch if not specified.
Validate that the focus is one of: tech, arch, quality, concerns, tech+arch.
If invalid:
Unknown focus area: "{input}". Valid options: tech, arch, quality, concerns, tech+arch
Exit.
Step 2: Check for existing documents
INIT=$(gsd-sdk query init.map-codebase 2>/dev/null || echo "{}")
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
Look up which documents would be produced for the selected focus (from the mapping table above).
For each target document, check if it already exists in .planning/codebase/:
ls -la .planning/codebase/{DOCUMENT}.md 2>/dev/null
If any exist, show their modification dates and ask:
Existing documents found:
- STACK.md (modified 2026-04-03)
- INTEGRATIONS.md (modified 2026-04-01)
Overwrite with fresh scan? [y/N]
If user says no, exit.
Step 3: Create output directory
mkdir -p .planning/codebase
Step 4: Spawn mapper agent
Spawn a single gsd-codebase-mapper agent with the selected focus area:
Task(
prompt="Scan this codebase with focus: {focus}. Write results to .planning/codebase/. Produce only: {document_list}",
subagent_type="gsd-codebase-mapper",
model="{resolved_model}"
)
Step 5: Report
## Scan Complete
**Focus:** {focus}
**Documents produced:**
{list of documents written with line counts}
Use `/gsd-map-codebase` for a comprehensive 4-area parallel scan.