Phase 05: Subagent Codebase Analysis - 2 plans in 2 waves - Plan 05-01: Create gsd-entity-generator subagent (Wave 1) - Plan 05-02: Refactor analyze-codebase to use subagent (Wave 2) - Ready for execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
5.3 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | must_haves | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 05-subagent-codebase-analysis | 01 | execute | 1 |
|
true |
|
Purpose: Define the subagent that generates semantic entity documentation for codebase files. This agent is spawned by /gsd:analyze-codebase with a list of file paths, reads each file, creates entity markdown, and writes directly to .planning/intel/entities/.
Output: agents/gsd-entity-generator.md
<execution_context>
@/.claude/get-shit-done/workflows/execute-plan.md
@/.claude/get-shit-done/templates/summary.md
</execution_context>
Frontmatter:
---
name: gsd-entity-generator
description: Generates semantic entity documentation for codebase files. Spawned by analyze-codebase with file list. Writes entities directly to disk.
tools: Read, Write, Bash
color: cyan
---
Role section:
- Spawned by
/gsd:analyze-codebasewith file paths - Reads source files, analyzes purpose/exports/dependencies
- Writes entity markdown to
.planning/intel/entities/{slug}.md - Returns statistics only (NOT entity contents)
Process sections:
-
parse_file_list- Extract file paths from prompt- Expect: total count, output directory, slug convention, template, file list
-
process_each_file- For each file path:- Read file using Read tool
- Analyze: purpose (why exists), exports (signatures), dependencies (internal wiki-links, external plain text), module type
- Generate slug:
src/lib/db.ts->src-lib-db(replace / and . with -, remove extension, lowercase) - Write entity to
.planning/intel/entities/{slug}.md - Track statistics (created, skipped, errors)
-
return_statistics- Return ONLY:## ENTITY GENERATION COMPLETE **Files processed:** {N} **Entities created:** {M} **Already existed:** {K} **Errors:** {E} Entities written to: .planning/intel/entities/
Entity template section: Include the full entity template from 05-RESEARCH.md (frontmatter with path/type/updated/status, Purpose, Exports, Dependencies with wiki-links, Used By = TBD, Notes optional).
Type heuristics table:
| Type | Indicators |
|---|---|
| api | api/, routes/, endpoints/, route handlers |
| component | components/, React/Vue exports |
| util | utils/, lib/, helpers/ |
| config | config/, .config. |
| hook | hooks/, use* functions |
| service | services/ |
| model | models/, types/ |
| test | .test., .spec. |
| module | default |
Wiki-link rules:
- Internal (starts with
.or@/): convert to slug, wrap in brackets - External (package name): plain text, no brackets
Critical rules:
- WRITE entities directly (never return contents)
- PostToolUse hook syncs to graph.db automatically
- Use EXACT template format (hook parses frontmatter + links)
Success criteria checklist (from research):
- All file paths processed
- Each entity written to correct path
- Frontmatter is valid YAML
- Purpose section is substantive (not "exports X")
- Internal deps use wiki-links
- Statistics returned (not entity contents) File exists and contains:
- Frontmatter with name, description, tools, color
- Role section explaining spawn context
- Process steps (parse, process, return)
- Entity template
- Type heuristics
- Wiki-link rules
- Critical rules matching gsd-codebase-mapper pattern
agents/gsd-entity-generator.mdexists with complete agent definition following gsd-codebase-mapper pattern. Agent is ready to be spawned by analyze-codebase.
<success_criteria> gsd-entity-generator agent definition complete. Agent can be spawned with file paths and will generate semantic entities, writing directly to disk. </success_criteria>
After completion, create `.planning/phases/05-subagent-codebase-analysis/05-01-SUMMARY.md`