claude-all-hands 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.claude/agents/code-simplifier.md +52 -0
  2. package/.claude/agents/curator.md +186 -246
  3. package/.claude/agents/documentation-taxonomist.md +255 -0
  4. package/.claude/agents/documentation-writer.md +366 -0
  5. package/.claude/agents/planner.md +123 -166
  6. package/.claude/agents/researcher.md +58 -41
  7. package/.claude/agents/surveyor.md +81 -0
  8. package/.claude/agents/worker.md +74 -0
  9. package/.claude/commands/continue.md +122 -0
  10. package/.claude/commands/create-skill.md +107 -0
  11. package/.claude/commands/create-specialist.md +111 -0
  12. package/.claude/commands/curator-audit.md +4 -0
  13. package/.claude/commands/debug.md +183 -0
  14. package/.claude/commands/docs-adjust.md +214 -0
  15. package/.claude/commands/docs-audit.md +172 -0
  16. package/.claude/commands/docs-init.md +210 -0
  17. package/.claude/commands/plan.md +199 -102
  18. package/.claude/commands/validate.md +11 -0
  19. package/.claude/commands/whats-next.md +106 -134
  20. package/.claude/envoy/README.md +5 -5
  21. package/.claude/envoy/envoy +11 -14
  22. package/.claude/envoy/package-lock.json +1594 -0
  23. package/.claude/envoy/package.json +38 -0
  24. package/.claude/envoy/src/cli.ts +126 -0
  25. package/.claude/envoy/src/commands/base.ts +216 -0
  26. package/.claude/envoy/src/commands/docs.ts +881 -0
  27. package/.claude/envoy/src/commands/gemini.ts +999 -0
  28. package/.claude/envoy/src/commands/git.ts +639 -0
  29. package/.claude/envoy/src/commands/index.ts +73 -0
  30. package/.claude/envoy/src/commands/knowledge.ts +178 -0
  31. package/.claude/envoy/src/commands/perplexity.ts +129 -0
  32. package/.claude/envoy/src/commands/plan/core.ts +134 -0
  33. package/.claude/envoy/src/commands/plan/findings.ts +446 -0
  34. package/.claude/envoy/src/commands/plan/gates.ts +672 -0
  35. package/.claude/envoy/src/commands/plan/index.ts +135 -0
  36. package/.claude/envoy/src/commands/plan/lifecycle.ts +648 -0
  37. package/.claude/envoy/src/commands/plan/plan-file.ts +138 -0
  38. package/.claude/envoy/src/commands/plan/prompts.ts +285 -0
  39. package/.claude/envoy/src/commands/plan/protocols.ts +166 -0
  40. package/.claude/envoy/src/commands/repomix.ts +99 -0
  41. package/.claude/envoy/src/commands/tavily.ts +220 -0
  42. package/.claude/envoy/src/commands/xai.ts +168 -0
  43. package/.claude/envoy/src/lib/ast-queries.ts +261 -0
  44. package/.claude/envoy/src/lib/design.ts +41 -0
  45. package/.claude/envoy/src/lib/feedback-schemas.ts +154 -0
  46. package/.claude/envoy/src/lib/findings.ts +215 -0
  47. package/.claude/envoy/src/lib/gates.ts +572 -0
  48. package/.claude/envoy/src/lib/git.ts +132 -0
  49. package/.claude/envoy/src/lib/index.ts +188 -0
  50. package/.claude/envoy/src/lib/knowledge.ts +646 -0
  51. package/.claude/envoy/src/lib/markdown.ts +75 -0
  52. package/.claude/envoy/src/lib/observability.ts +262 -0
  53. package/.claude/envoy/src/lib/paths.ts +130 -0
  54. package/.claude/envoy/src/lib/plan-io.ts +117 -0
  55. package/.claude/envoy/src/lib/prompts.ts +231 -0
  56. package/.claude/envoy/src/lib/protocols.ts +314 -0
  57. package/.claude/envoy/src/lib/repomix.ts +133 -0
  58. package/.claude/envoy/src/lib/retry.ts +138 -0
  59. package/.claude/envoy/src/lib/tree-sitter-utils.ts +301 -0
  60. package/.claude/envoy/src/lib/watcher.ts +167 -0
  61. package/.claude/envoy/src/types/tree-sitter.d.ts +76 -0
  62. package/.claude/envoy/tsconfig.json +21 -0
  63. package/.claude/hooks/scripts/enforce_research_fetch.py +1 -1
  64. package/.claude/hooks/scripts/scan_agents.py +62 -0
  65. package/.claude/hooks/scripts/scan_commands.py +50 -0
  66. package/.claude/hooks/scripts/scan_skills.py +46 -70
  67. package/.claude/hooks/scripts/validate_artifacts.py +128 -0
  68. package/.claude/hooks/startup.sh +26 -24
  69. package/.claude/protocols/bug-discovery.yaml +55 -0
  70. package/.claude/protocols/debugging.yaml +51 -0
  71. package/.claude/protocols/discovery.yaml +53 -0
  72. package/.claude/protocols/implementation.yaml +84 -0
  73. package/.claude/settings.json +38 -97
  74. package/.claude/skills/brainstorming/SKILL.md +54 -0
  75. package/.claude/skills/commands-development/SKILL.md +630 -0
  76. package/.claude/skills/commands-development/references/arguments.md +252 -0
  77. package/.claude/skills/commands-development/references/patterns.md +796 -0
  78. package/.claude/skills/commands-development/references/tool-restrictions.md +376 -0
  79. package/.claude/skills/discovery-mode/SKILL.md +108 -0
  80. package/.claude/skills/documentation-taxonomy/SKILL.md +287 -0
  81. package/.claude/skills/hooks-development/SKILL.md +332 -0
  82. package/.claude/skills/hooks-development/references/command-vs-prompt.md +269 -0
  83. package/.claude/skills/hooks-development/references/examples.md +658 -0
  84. package/.claude/skills/hooks-development/references/hook-types.md +463 -0
  85. package/.claude/skills/hooks-development/references/input-output-schemas.md +469 -0
  86. package/.claude/skills/hooks-development/references/matchers.md +470 -0
  87. package/.claude/skills/hooks-development/references/troubleshooting.md +587 -0
  88. package/.claude/skills/implementation-mode/SKILL.md +171 -0
  89. package/.claude/skills/knowledge-discovery/SKILL.md +178 -0
  90. package/.claude/skills/research-tools/SKILL.md +35 -33
  91. package/.claude/skills/skills-development/SKILL.md +192 -0
  92. package/.claude/skills/skills-development/references/api-security.md +226 -0
  93. package/.claude/skills/skills-development/references/be-clear-and-direct.md +531 -0
  94. package/.claude/skills/skills-development/references/common-patterns.md +595 -0
  95. package/.claude/skills/skills-development/references/core-principles.md +437 -0
  96. package/.claude/skills/skills-development/references/executable-code.md +175 -0
  97. package/.claude/skills/skills-development/references/iteration-and-testing.md +474 -0
  98. package/.claude/skills/skills-development/references/recommended-structure.md +168 -0
  99. package/.claude/skills/skills-development/references/skill-structure.md +372 -0
  100. package/.claude/skills/skills-development/references/use-xml-tags.md +466 -0
  101. package/.claude/skills/skills-development/references/using-scripts.md +113 -0
  102. package/.claude/skills/skills-development/references/using-templates.md +112 -0
  103. package/.claude/skills/skills-development/references/workflows-and-validation.md +510 -0
  104. package/.claude/skills/skills-development/templates/router-skill.md +73 -0
  105. package/.claude/skills/skills-development/templates/simple-skill.md +33 -0
  106. package/.claude/skills/skills-development/workflows/add-reference.md +96 -0
  107. package/.claude/skills/skills-development/workflows/add-script.md +93 -0
  108. package/.claude/skills/skills-development/workflows/add-template.md +74 -0
  109. package/.claude/skills/skills-development/workflows/add-workflow.md +120 -0
  110. package/.claude/skills/skills-development/workflows/audit-skill.md +138 -0
  111. package/.claude/skills/skills-development/workflows/create-domain-expertise-skill.md +605 -0
  112. package/.claude/skills/skills-development/workflows/create-new-skill.md +191 -0
  113. package/.claude/skills/skills-development/workflows/get-guidance.md +121 -0
  114. package/.claude/skills/skills-development/workflows/upgrade-to-router.md +161 -0
  115. package/.claude/skills/skills-development/workflows/verify-skill.md +204 -0
  116. package/.claude/skills/subagents-development/SKILL.md +325 -0
  117. package/.claude/skills/subagents-development/references/context-management.md +567 -0
  118. package/.claude/skills/subagents-development/references/debugging-agents.md +714 -0
  119. package/.claude/skills/subagents-development/references/error-handling-and-recovery.md +502 -0
  120. package/.claude/skills/subagents-development/references/evaluation-and-testing.md +374 -0
  121. package/.claude/skills/subagents-development/references/orchestration-patterns.md +591 -0
  122. package/.claude/skills/subagents-development/references/subagents.md +508 -0
  123. package/.claude/skills/subagents-development/references/writing-subagent-prompts.md +517 -0
  124. package/.claude/statusline.sh +24 -0
  125. package/bin/cli.js +150 -72
  126. package/package.json +1 -1
  127. package/.claude/agents/explorer.md +0 -62
  128. package/.claude/agents/parallel-worker.md +0 -121
  129. package/.claude/commands/curation-fix.md +0 -92
  130. package/.claude/commands/new-branch.md +0 -36
  131. package/.claude/commands/parallel-discovery.md +0 -69
  132. package/.claude/commands/parallel-orchestration.md +0 -99
  133. package/.claude/commands/plan-checkpoint.md +0 -37
  134. package/.claude/envoy/commands/__init__.py +0 -1
  135. package/.claude/envoy/commands/base.py +0 -95
  136. package/.claude/envoy/commands/parallel.py +0 -439
  137. package/.claude/envoy/commands/perplexity.py +0 -86
  138. package/.claude/envoy/commands/plans.py +0 -451
  139. package/.claude/envoy/commands/tavily.py +0 -156
  140. package/.claude/envoy/commands/vertex.py +0 -358
  141. package/.claude/envoy/commands/xai.py +0 -124
  142. package/.claude/envoy/envoy.py +0 -122
  143. package/.claude/envoy/pyrightconfig.json +0 -4
  144. package/.claude/envoy/requirements.txt +0 -2
  145. package/.claude/hooks/capture-queries.sh +0 -3
  146. package/.claude/hooks/scripts/enforce_planning.py +0 -118
  147. package/.claude/hooks/scripts/enforce_rg.py +0 -34
  148. package/.claude/hooks/scripts/validate_skill.py +0 -81
  149. package/.claude/skills/claude-envoy-curation/SKILL.md +0 -162
  150. package/.claude/skills/claude-envoy-usage/SKILL.md +0 -46
  151. package/.claude/skills/command-development/SKILL.md +0 -206
  152. package/.claude/skills/command-development/examples/simple-commands.md +0 -212
  153. package/.claude/skills/command-development/references/frontmatter-reference.md +0 -221
  154. package/.claude/skills/hook-development/SKILL.md +0 -127
  155. package/.claude/skills/hook-development/examples/command-hooks.md +0 -301
  156. package/.claude/skills/hook-development/examples/prompt-hooks.md +0 -114
  157. package/.claude/skills/hook-development/references/event-reference.md +0 -226
  158. package/.claude/skills/repomix-extraction/SKILL.md +0 -91
  159. package/.claude/skills/skill-development/SKILL.md +0 -168
  160. package/.claude/skills/skill-development/examples/complete-skill-examples.md +0 -281
  161. package/.claude/skills/skill-development/references/progressive-disclosure.md +0 -141
  162. package/.claude/skills/skill-development/references/writing-style.md +0 -180
  163. package/.claude/skills/skill-development/scripts/validate-skill.sh +0 -144
  164. package/.claude/skills/specialist-builder/SKILL.md +0 -327
  165. package/.claude/skills/specialist-builder/docs/agent-catalog.md +0 -28
  166. package/.claude/skills/specialist-builder/examples/complete-agent-examples.md +0 -206
  167. package/.claude/skills/specialist-builder/references/system-prompt-patterns.md +0 -281
  168. package/.claude/skills/specialist-builder/references/triggering-examples.md +0 -162
  169. package/.claude/skills/specialist-builder/scripts/validate-agent.sh +0 -137
  170. /package/.claude/{envoy/claude-envoy.py → skills/claude-envoy-patterns/SKILL.md} +0 -0
@@ -0,0 +1,214 @@
1
+ ---
2
+ description: Update documentation incrementally based on code changes
3
+ argument-hint: [--diff] [optional paths or context]
4
+ ---
5
+
6
+ <objective>
7
+ Update documentation incrementally based on recent code changes or user-specified scope. Uses taxonomy-based approach for targeted documentation updates.
8
+ </objective>
9
+
10
+ <context>
11
+ Current branch: !`git branch --show-current`
12
+ Base branch: !`envoy git get-base-branch`
13
+ </context>
14
+
15
+ <main_agent_role>
16
+ Main agent is ORCHESTRATOR ONLY. Do NOT perform any codebase discovery, file analysis, or documentation planning. All discovery work is delegated to the taxonomist agent.
17
+
18
+ Main agent responsibilities:
19
+ 1. Parse arguments (paths, flags, context)
20
+ 2. Verify clean git state
21
+ 3. Delegate to taxonomist with raw inputs
22
+ 4. Orchestrate writers based on taxonomist output
23
+ 5. Handle merging, validation, and PR creation
24
+ </main_agent_role>
25
+
26
+ <process>
27
+ <step name="parse_arguments">
28
+ Parse $ARGUMENTS:
29
+ - `--diff` flag: pass to taxonomist for git-based discovery
30
+ - Paths: pass to taxonomist as scope
31
+ - Context: pass to taxonomist as user guidance
32
+
33
+ Do NOT run discovery commands - pass raw inputs to taxonomist.
34
+ </step>
35
+
36
+ <step name="ensure_committed_state">
37
+ Before delegating to taxonomist, verify clean git state:
38
+
39
+ 1. Check for uncommitted changes:
40
+ ```bash
41
+ git status --porcelain
42
+ ```
43
+
44
+ 2. If changes exist:
45
+ - Use AskUserQuestion: "Uncommitted changes detected. Documentation requires committed state for valid reference hashes."
46
+ - Options:
47
+ - "Commit now" - propose message, gate for approval
48
+ - "Stash and continue" - `git stash`
49
+ - "Cancel" - abort workflow
50
+
51
+ 3. If "Commit now":
52
+ - Run `git diff --cached --stat` for context
53
+ - Propose commit message based on staged changes
54
+ - Gate for user approval
55
+ - Execute: `git add -A && git commit -m "<approved message>"`
56
+
57
+ 4. If "Stash and continue":
58
+ - Execute: `git stash push -m "pre-docs stash"`
59
+ - Note: remind user to `git stash pop` after docs complete
60
+
61
+ 5. Verify clean state before proceeding:
62
+ ```bash
63
+ git status --porcelain
64
+ ```
65
+ Must return empty.
66
+ </step>
67
+
68
+ <step name="delegate_to_taxonomist">
69
+ Delegate to **documentation-taxonomist agent** with adjust-workflow.
70
+
71
+ Taxonomist handles ALL discovery: analyzing codebase, checking existing docs, identifying affected domains, creating directory structure.
72
+
73
+ **INPUTS:**
74
+ ```yaml
75
+ mode: "adjust"
76
+ use_diff: true | false # from --diff flag
77
+ scope_paths: [<paths from arguments, if any>]
78
+ user_request: "<optional context from user>"
79
+ feature_branch: "<current_branch>"
80
+ ```
81
+
82
+ **OUTPUTS:**
83
+ ```yaml
84
+ success: true
85
+ segments:
86
+ - domain: "<domain-name>"
87
+ files: ["<glob-patterns>"]
88
+ output_path: "docs/<domain>/"
89
+ depth: "overview" | "detailed" | "comprehensive"
90
+ notes: "<guidance>"
91
+ action: "create" | "update"
92
+ ```
93
+ </step>
94
+
95
+ <step name="parallel_writers">
96
+ If multiple segments, delegate to **documentation-writer agents** in parallel.
97
+
98
+ If single segment, delegate to single writer.
99
+
100
+ **INPUTS (per writer):**
101
+ ```yaml
102
+ mode: "write"
103
+ domain: "<segment.domain>"
104
+ files: <segment.files>
105
+ output_path: "<segment.output_path>"
106
+ depth: "<segment.depth>"
107
+ notes: "<segment.notes>"
108
+ ```
109
+
110
+ **OUTPUTS:**
111
+ ```yaml
112
+ success: true
113
+ ```
114
+
115
+ Writers work directly on the branch. Taxonomist ensures non-overlapping output directories, so no conflicts occur.
116
+ </step>
117
+
118
+ <step name="validate_and_report">
119
+ Run validation: `envoy docs validate`
120
+
121
+ If stale/invalid refs found:
122
+ - Present findings to user
123
+ - Delegate single writer with fix-workflow if user approves
124
+ </step>
125
+
126
+ <step name="commit_documentation">
127
+ Commit any uncommitted documentation changes (e.g., validation fixes):
128
+
129
+ 1. Check for uncommitted changes in docs/:
130
+ ```bash
131
+ git status --porcelain docs/
132
+ ```
133
+
134
+ 2. If changes exist:
135
+ ```bash
136
+ git add docs/
137
+ git commit -m "docs: update documentation"
138
+ ```
139
+
140
+ 3. Track documentation files for reindex:
141
+ - Get list of doc files created/modified since branch diverged from base:
142
+ ```bash
143
+ git diff --name-only $(git merge-base HEAD <base_branch>)..HEAD -- docs/
144
+ ```
145
+ - Store this list for the reindex step
146
+ </step>
147
+
148
+ <step name="reindex_knowledge">
149
+ Update semantic search index with changed documentation:
150
+
151
+ 1. Build file changes JSON from tracked doc files:
152
+ ```json
153
+ [
154
+ {"path": "docs/domain/index.md", "added": true},
155
+ {"path": "docs/domain/subdomain/index.md", "modified": true}
156
+ ]
157
+ ```
158
+ - Use `added: true` for new files
159
+ - Use `modified: true` for updated files
160
+ - Use `deleted: true` for removed files
161
+
162
+ 2. Call reindex:
163
+ ```bash
164
+ envoy knowledge reindex-from-changes docs --files '<json_array>'
165
+ ```
166
+
167
+ 3. If reindex reports missing references:
168
+ - Log warning but continue (docs may reference code not yet indexed)
169
+ </step>
170
+
171
+ <step name="finalize">
172
+ If in workflow context (called from /continue):
173
+ - Return success without creating PR
174
+ - Let parent workflow handle PR
175
+
176
+ If standalone:
177
+ - Create PR if changes made
178
+ - Report completion
179
+ </step>
180
+ </process>
181
+
182
+ <workflow_integration>
183
+ When called from `/continue` or implementation workflow:
184
+ - Skip PR creation
185
+ - Return `{ success: true }` for workflow to continue
186
+ - Validation warnings go to workflow orchestrator
187
+
188
+ When called standalone:
189
+ - Create PR with changes
190
+ - Present validation results to user
191
+ </workflow_integration>
192
+
193
+ <success_criteria>
194
+ - Changed files identified (if --diff)
195
+ - Taxonomist created targeted segments with non-overlapping output directories
196
+ - Writers updated relevant docs
197
+ - Validation run
198
+ - Documentation committed
199
+ - Knowledge index updated
200
+ - PR created (if standalone)
201
+ </success_criteria>
202
+
203
+ <constraints>
204
+ - MUST NOT perform codebase discovery - delegate ALL discovery to taxonomist
205
+ - MUST NOT run envoy docs tree, envoy docs complexity, or envoy knowledge search
206
+ - MUST verify clean git state before documentation (ensure_committed_state step)
207
+ - MUST delegate to taxonomist for all segmentation and discovery
208
+ - MUST pass --diff flag to taxonomist (not process it directly)
209
+ - MUST work both standalone and in workflow context
210
+ - MUST validate after documentation
211
+ - MUST commit documentation changes before reindex (reindex reads from disk)
212
+ - MUST reindex knowledge base after documentation committed
213
+ - All delegations MUST follow INPUTS/OUTPUTS format
214
+ </constraints>
@@ -0,0 +1,172 @@
1
+ ---
2
+ description: Audit documentation for stale/invalid symbol references
3
+ argument-hint: [--fix] [optional docs path]
4
+ ---
5
+
6
+ <objective>
7
+ Validate all documentation symbol references and fix stale/invalid references via documentation-writer agents. Main agent NEVER fixes documentation directly - writers must review source diffs to ensure prose accuracy.
8
+ </objective>
9
+
10
+ <context>
11
+ Current branch: !`git branch --show-current`
12
+ </context>
13
+
14
+ <critical-constraint>
15
+ **MAIN AGENT MUST NEVER EDIT DOCUMENTATION FILES DIRECTLY.**
16
+
17
+ Even "simple" hash updates require documentation-writer review because:
18
+ - Source file changed since doc was written
19
+ - Writer must diff the source change to verify prose still accurate
20
+ - Prose may need rewriting if implementation semantics changed
21
+ - Only documentation-writer agents have the context and mandate to make doc changes
22
+ </critical-constraint>
23
+
24
+ <process>
25
+ <step name="parse_arguments">
26
+ Parse $ARGUMENTS:
27
+ - `--fix` flag: automatically fix issues after presenting findings
28
+ - Path: specific docs path to audit (default: docs/)
29
+ </step>
30
+
31
+ <step name="run_validation">
32
+ Run validation:
33
+ ```bash
34
+ envoy docs validate [--path <docs_path>]
35
+ ```
36
+
37
+ Parse output - the `by_doc_file` field contains issues grouped by documentation file.
38
+ </step>
39
+
40
+ <step name="present_findings">
41
+ Present findings **grouped by doc file** (matching delegation format):
42
+
43
+ ```markdown
44
+ ## Documentation Audit Results
45
+
46
+ **Total references:** {total_refs}
47
+ **Stale:** {stale_count} | **Invalid:** {invalid_count}
48
+ **Doc files affected:** {affected_file_count}
49
+
50
+ ### By Documentation File
51
+
52
+ **{doc_file_1}** ({issue_count} issues)
53
+ | Type | Reference | Details |
54
+ |------|-----------|---------|
55
+ | stale | `file.ts` | cf5a964 → 6607b05 |
56
+ | invalid | `removed.ts:fn` | file not found |
57
+
58
+ **{doc_file_2}** ({issue_count} issues)
59
+ ...
60
+ ```
61
+
62
+ If no issues:
63
+ - Report "All references valid" and exit
64
+ </step>
65
+
66
+ <step name="user_decision">
67
+ If issues found and `--fix` not provided:
68
+
69
+ AskUserQuestion: "How should we handle these {issue_count} issues across {file_count} doc files?"
70
+ Options:
71
+ - "Fix all" - Delegate to documentation-writers for review and fixes
72
+ - "Skip" - Don't fix, just report
73
+
74
+ If `--fix` provided:
75
+ - Proceed to delegation step automatically
76
+ </step>
77
+
78
+ <step name="batch_and_delegate">
79
+ **Batching for parallel delegation (max 5 agents):**
80
+
81
+ 1. Count affected doc files from `by_doc_file`
82
+ 2. If ≤5 files: one agent per file
83
+ 3. If >5 files: distribute files across 5 agents
84
+ - Agent 1: files 1, 6, 11...
85
+ - Agent 2: files 2, 7, 12...
86
+ - etc.
87
+
88
+ **Delegation format (per agent):**
89
+
90
+ Each agent receives a `doc_files` array (1+ files per agent):
91
+
92
+ ```yaml
93
+ mode: "audit-fix"
94
+ doc_files:
95
+ - path: "<doc file path>"
96
+ stale_refs:
97
+ - reference: "[ref:path/file.ts:symbol:hash]"
98
+ ref_type: "symbol" | "file-only"
99
+ file_path: "path/file.ts"
100
+ symbol_name: "symbol" | null
101
+ stored_hash: "abc1234"
102
+ current_hash: "def5678"
103
+ invalid_refs:
104
+ - reference: "[ref:path/removed.ts:fn:hash]"
105
+ reason: "file not found" | "symbol not found"
106
+ - path: "<another doc file>"
107
+ stale_refs: [...]
108
+ invalid_refs: [...]
109
+ ```
110
+
111
+ **Extract from reference string:**
112
+ - `[ref:path/to/file.ts:symbolName:hash]` → file_path="path/to/file.ts", symbol_name="symbolName"
113
+ - `[ref:path/to/file.yaml::hash]` → file_path="path/to/file.yaml", symbol_name=null
114
+
115
+ **Launch all agents in parallel using single message with multiple Task tool calls.**
116
+
117
+ **Expected output (per agent):**
118
+ ```yaml
119
+ success: true
120
+ doc_files_processed: ["path1", "path2"]
121
+ changes:
122
+ - doc_file: "<path>"
123
+ ref: "<reference>"
124
+ action: "hash_update" | "prose_rewrite" | "ref_removed" | "ref_updated"
125
+ reason: "<why this action>"
126
+ ```
127
+ </step>
128
+
129
+ <step name="verify_and_report">
130
+ After all agents complete:
131
+
132
+ 1. Run validation again:
133
+ ```bash
134
+ envoy docs validate [--path <docs_path>]
135
+ ```
136
+
137
+ 2. If issues remain, report which failed and why
138
+
139
+ 3. Report completion:
140
+ ```markdown
141
+ ## Audit Complete
142
+
143
+ **Agents dispatched:** {agent_count}
144
+ **Files processed:** {file_count}
145
+ **Changes made:**
146
+ - Hash updates: {hash_update_count}
147
+ - Prose rewrites: {prose_rewrite_count}
148
+ - References removed: {ref_removed_count}
149
+ - References updated: {ref_updated_count}
150
+
151
+ **Validation:** {pass|fail with details}
152
+ ```
153
+ </step>
154
+ </process>
155
+
156
+ <success_criteria>
157
+ - Validation run on docs
158
+ - Findings presented grouped by doc file
159
+ - User decision collected (if not --fix)
160
+ - Documentation-writer agents dispatched in parallel (max 5)
161
+ - All agents complete successfully
162
+ - Re-validation passes after fixes
163
+ </success_criteria>
164
+
165
+ <constraints>
166
+ - **NEVER edit documentation files directly** - always delegate to documentation-writer
167
+ - MUST present findings grouped by doc file (matches delegation format)
168
+ - MUST batch files if >5 affected (max 5 parallel agents)
169
+ - MUST launch agents in parallel (single message, multiple Task calls)
170
+ - MUST re-validate after fixes complete
171
+ - MUST report any remaining issues after fix attempt
172
+ </constraints>
@@ -0,0 +1,210 @@
1
+ ---
2
+ description: Initialize documentation for codebase (full documentation generation)
3
+ argument-hint: [...optional paths] [optional context]
4
+ ---
5
+
6
+ <objective>
7
+ Create comprehensive documentation for the codebase from scratch. Uses taxonomy-based approach with parallel documentation writers. Taxonomist ensures non-overlapping output directories, so writers work directly on the branch without conflicts.
8
+ </objective>
9
+
10
+ <context>
11
+ Current branch: !`git branch --show-current`
12
+ Base branch: !`envoy git get-base-branch`
13
+ </context>
14
+
15
+ <main_agent_role>
16
+ Main agent is ORCHESTRATOR ONLY. Do NOT perform any codebase discovery, file analysis, or documentation planning. All discovery work is delegated to the taxonomist agent.
17
+
18
+ Main agent responsibilities:
19
+ 1. Setup branch (create docs branch if on base)
20
+ 2. Parse arguments (paths, context)
21
+ 3. Verify clean git state
22
+ 4. Delegate to taxonomist with raw inputs
23
+ 5. Orchestrate writers based on taxonomist output
24
+ 6. Handle merging, validation, and PR creation
25
+ </main_agent_role>
26
+
27
+ <process>
28
+ <step name="setup_branch">
29
+ Check if current branch equals base branch:
30
+
31
+ **If on base branch:**
32
+ 1. Create docs branch: `docs/init-<timestamp>`
33
+ 2. Document from fresh docs branch
34
+
35
+ **If on feature branch:**
36
+ 1. Stay on current branch
37
+ 2. Document from feature branch state (no branch switching)
38
+ </step>
39
+
40
+ <step name="parse_arguments">
41
+ Parse $ARGUMENTS:
42
+ - Extract paths (pass to taxonomist as scope)
43
+ - Extract optional user context (pass to taxonomist)
44
+
45
+ Do NOT run discovery commands - pass raw inputs to taxonomist.
46
+ </step>
47
+
48
+ <step name="ensure_committed_state">
49
+ Before delegating to taxonomist, verify clean git state:
50
+
51
+ 1. Check for uncommitted changes:
52
+ ```bash
53
+ git status --porcelain
54
+ ```
55
+
56
+ 2. If changes exist:
57
+ - Use AskUserQuestion: "Uncommitted changes detected. Documentation requires committed state for valid reference hashes."
58
+ - Options:
59
+ - "Commit now" - propose message, gate for approval
60
+ - "Stash and continue" - `git stash`
61
+ - "Cancel" - abort workflow
62
+
63
+ 3. If "Commit now":
64
+ - Run `git diff --cached --stat` for context
65
+ - Propose commit message based on staged changes
66
+ - Gate for user approval
67
+ - Execute: `git add -A && git commit -m "<approved message>"`
68
+
69
+ 4. If "Stash and continue":
70
+ - Execute: `git stash push -m "pre-docs stash"`
71
+ - Note: remind user to `git stash pop` after docs complete
72
+
73
+ 5. Verify clean state before proceeding:
74
+ ```bash
75
+ git status --porcelain
76
+ ```
77
+ Must return empty.
78
+ </step>
79
+
80
+ <step name="delegate_to_taxonomist">
81
+ Delegate to **documentation-taxonomist agent** with init-workflow.
82
+
83
+ Taxonomist handles ALL discovery: analyzing codebase structure, checking existing docs, identifying products/features, creating directory structure, assigning writers.
84
+
85
+ **INPUTS:**
86
+ ```yaml
87
+ mode: "init"
88
+ scope_paths: [<paths from arguments, or empty for full codebase>]
89
+ user_request: "<optional context from user>"
90
+ feature_branch: "<current_branch>"
91
+ ```
92
+
93
+ **OUTPUTS:**
94
+ ```yaml
95
+ success: true
96
+ segments:
97
+ - domain: "<domain-name>"
98
+ files: ["<glob-patterns>"]
99
+ output_path: "docs/<domain>/"
100
+ depth: "overview" | "detailed" | "comprehensive"
101
+ notes: "<guidance>"
102
+ ```
103
+ </step>
104
+
105
+ <step name="parallel_writers">
106
+ For each segment from taxonomist, delegate to **documentation-writer agent** in parallel:
107
+
108
+ **INPUTS (per writer):**
109
+ ```yaml
110
+ mode: "write"
111
+ domain: "<segment.domain>"
112
+ files: <segment.files>
113
+ output_path: "<segment.output_path>"
114
+ depth: "<segment.depth>"
115
+ notes: "<segment.notes>"
116
+ ```
117
+
118
+ **OUTPUTS:**
119
+ ```yaml
120
+ success: true
121
+ ```
122
+
123
+ Writers work directly on the branch. Taxonomist ensures non-overlapping output directories, so no conflicts occur.
124
+ </step>
125
+
126
+ <step name="validate_docs">
127
+ Run validation: `envoy docs validate`
128
+
129
+ If stale/invalid refs found:
130
+ - Present findings to user
131
+ - Delegate single writer with fix-workflow if user approves
132
+ </step>
133
+
134
+ <step name="commit_documentation">
135
+ Commit any uncommitted documentation changes (e.g., validation fixes):
136
+
137
+ 1. Check for uncommitted changes in docs/:
138
+ ```bash
139
+ git status --porcelain docs/
140
+ ```
141
+
142
+ 2. If changes exist:
143
+ ```bash
144
+ git add docs/
145
+ git commit -m "docs: finalize documentation"
146
+ ```
147
+
148
+ 3. Track documentation files for reindex:
149
+ - Get list of all doc files created/modified since branch diverged from base:
150
+ ```bash
151
+ git diff --name-only $(git merge-base HEAD <base_branch>)..HEAD -- docs/
152
+ ```
153
+ - Store this list for the reindex step
154
+ </step>
155
+
156
+ <step name="reindex_knowledge">
157
+ Update semantic search index with new documentation:
158
+
159
+ 1. Build file changes JSON from tracked doc files:
160
+ ```json
161
+ [
162
+ {"path": "docs/domain/index.md", "added": true},
163
+ {"path": "docs/domain/subdomain/index.md", "added": true}
164
+ ]
165
+ ```
166
+ - Use `added: true` for new files
167
+ - Use `modified: true` for updated files
168
+
169
+ 2. Call reindex:
170
+ ```bash
171
+ envoy knowledge reindex-from-changes docs --files '<json_array>'
172
+ ```
173
+
174
+ 3. If reindex reports missing references:
175
+ - Log warning but continue (docs may reference code not yet indexed)
176
+ - These will resolve on next full reindex
177
+ </step>
178
+
179
+ <step name="create_pr">
180
+ Create PR:
181
+ ```bash
182
+ envoy git create-pr --title "docs: initialize codebase documentation" --body "<summary>"
183
+ ```
184
+
185
+ Report completion with PR link.
186
+ </step>
187
+ </process>
188
+
189
+ <success_criteria>
190
+ - Branch setup complete (docs branch from base OR stay on feature)
191
+ - Taxonomist segmented codebase with non-overlapping output directories
192
+ - Writers created docs in parallel
193
+ - Validation passed
194
+ - Documentation committed
195
+ - Knowledge index updated
196
+ - PR created
197
+ </success_criteria>
198
+
199
+ <constraints>
200
+ - MUST NOT perform codebase discovery - delegate ALL discovery to taxonomist
201
+ - MUST NOT run envoy docs tree, envoy docs complexity, or envoy knowledge search
202
+ - MUST verify clean git state before documentation (ensure_committed_state step)
203
+ - MUST only create docs branch if already on base branch
204
+ - MUST delegate to taxonomist for all segmentation and discovery
205
+ - MUST run writers in parallel
206
+ - MUST validate before PR
207
+ - MUST commit documentation changes before reindex (reindex reads from disk)
208
+ - MUST reindex knowledge base after documentation committed
209
+ - All delegations MUST follow INPUTS/OUTPUTS format
210
+ </constraints>