claude-all-hands 1.0.2 → 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 (35) hide show
  1. package/.claude/agents/curator.md +1 -5
  2. package/.claude/agents/documentation-taxonomist.md +255 -0
  3. package/.claude/agents/documentation-writer.md +366 -0
  4. package/.claude/agents/surveyor.md +1 -1
  5. package/.claude/commands/continue.md +12 -10
  6. package/.claude/commands/create-skill.md +2 -2
  7. package/.claude/commands/create-specialist.md +3 -3
  8. package/.claude/commands/debug.md +5 -5
  9. package/.claude/commands/docs-adjust.md +214 -0
  10. package/.claude/commands/docs-audit.md +172 -0
  11. package/.claude/commands/docs-init.md +210 -0
  12. package/.claude/commands/plan.md +6 -6
  13. package/.claude/commands/whats-next.md +2 -2
  14. package/.claude/envoy/README.md +5 -5
  15. package/.claude/envoy/package-lock.json +216 -10
  16. package/.claude/envoy/package.json +9 -0
  17. package/.claude/envoy/src/commands/docs.ts +881 -0
  18. package/.claude/envoy/src/commands/knowledge.ts +33 -42
  19. package/.claude/envoy/src/lib/ast-queries.ts +261 -0
  20. package/.claude/envoy/src/lib/knowledge.ts +176 -124
  21. package/.claude/envoy/src/lib/tree-sitter-utils.ts +301 -0
  22. package/.claude/envoy/src/types/tree-sitter.d.ts +76 -0
  23. package/.claude/hooks/scripts/enforce_research_fetch.py +1 -1
  24. package/.claude/protocols/bug-discovery.yaml +1 -1
  25. package/.claude/protocols/discovery.yaml +1 -1
  26. package/.claude/settings.json +4 -3
  27. package/.claude/skills/discovery-mode/SKILL.md +7 -7
  28. package/.claude/skills/documentation-taxonomy/SKILL.md +287 -0
  29. package/.claude/skills/implementation-mode/SKILL.md +7 -7
  30. package/.claude/skills/knowledge-discovery/SKILL.md +178 -0
  31. package/bin/cli.js +41 -1
  32. package/package.json +1 -1
  33. package/.claude/agents/documentor.md +0 -147
  34. package/.claude/commands/audit-docs.md +0 -94
  35. package/.claude/commands/create-docs.md +0 -100
@@ -7,12 +7,12 @@ Loop through plan prompts, delegate to specialists for implementation, extract d
7
7
  </objective>
8
8
 
9
9
  <context>
10
- Plan status: !`.claude/envoy/envoy plan check`
10
+ Plan status: !`envoy plan check`
11
11
  </context>
12
12
 
13
13
  <process>
14
14
  <step name="get_next_prompts">
15
- Call `.claude/envoy/envoy plan next [-n <count>]`
15
+ Call `envoy plan next [-n <count>]`
16
16
 
17
17
  Returns next available prompts respecting dependencies:
18
18
  - If count > 1: returns independent prompts that can run in parallel
@@ -45,9 +45,10 @@ For each prompt from next:
45
45
  <step name="extract_documentation">
46
46
  After each specialist returns (prompt merged):
47
47
 
48
- Delegate to **documentor agent**:
49
- * "Run the extract-workflow. INPUTS: `{ mode: 'extract', prompt_num: <N>, variant: <V>, feature_branch: <current_branch> }`"
50
- * OUTPUTS: `{ success: true }`
48
+ Call `/docs adjust --diff` to update documentation based on changes.
49
+ * Uses taxonomy-based approach to identify changed areas
50
+ * Writers update relevant documentation with symbol references
51
+ * Returns: `{ success: true }`
51
52
  </step>
52
53
 
53
54
  <step name="loop">
@@ -57,7 +58,7 @@ Repeat steps 1-3 until:
57
58
  </step>
58
59
 
59
60
  <step name="full_review">
60
- Call `.claude/envoy/envoy gemini review --full`
61
+ Call `envoy gemini review --full`
61
62
 
62
63
  Returns: `{ verdict, thoughts?, answered_questions?, suggested_fixes? }`
63
64
 
@@ -80,13 +81,14 @@ If verdict = "failed" OR suggested_fixes exist:
80
81
  </step>
81
82
 
82
83
  <step name="mandatory_doc_audit">
83
- Delegate to **documentor agent**:
84
- * "Run the audit-workflow. INPUTS: `{ mode: 'audit', feature_branch: <current_branch> }`"
85
- * OUTPUTS: `{ success: true }`
84
+ Call `/docs audit` to validate all documentation symbol references.
85
+ * Checks for stale (hash changed) and invalid (symbol deleted) references
86
+ * If issues found: fix automatically or present to user
87
+ * Returns: `{ success: true }`
86
88
  </step>
87
89
 
88
90
  <step name="complete_plan">
89
- Call `.claude/envoy/envoy plan complete`
91
+ Call `envoy plan complete`
90
92
 
91
93
  This:
92
94
  - Generates summary.md
@@ -80,8 +80,8 @@ If "Need changes":
80
80
  Commit any final changes.
81
81
 
82
82
  Check branch status:
83
- - Call `.claude/envoy/envoy git is-base-branch` on parent branch
84
- - If parent is base branch: Create PR via `.claude/envoy/envoy git create-pr --title "<title>" --body "<body>"`
83
+ - Call `envoy git is-base-branch` on parent branch
84
+ - If parent is base branch: Create PR via `envoy git create-pr --title "<title>" --body "<body>"`
85
85
  - If parent has plan matter: Merge back to parent, add updates to curator.md
86
86
 
87
87
  Report completion with next steps.
@@ -9,7 +9,7 @@ Create a new specialist agent tailored to a specific domain. Gathers requirement
9
9
 
10
10
  <context>
11
11
  Current branch: !`git branch --show-current`
12
- Available envoy commands: !`.claude/envoy/envoy --help`
12
+ Available envoy commands: !`envoy --help`
13
13
  Existing agents: !`ls -la .claude/agents/`
14
14
  </context>
15
15
 
@@ -84,8 +84,8 @@ If "Need changes":
84
84
  Commit any final changes.
85
85
 
86
86
  Check branch status:
87
- - Call `.claude/envoy/envoy git is-base-branch` on parent branch
88
- - If parent is base branch: Create PR via `.claude/envoy/envoy git create-pr --title "<title>" --body "<body>"`
87
+ - Call `envoy git is-base-branch` on parent branch
88
+ - If parent is base branch: Create PR via `envoy git create-pr --title "<title>" --body "<body>"`
89
89
  - If parent has plan matter: Merge back to parent, add updates to curator.md
90
90
 
91
91
  Report completion with next steps.
@@ -13,7 +13,7 @@ Modes:
13
13
  </objective>
14
14
 
15
15
  <context>
16
- Plan status: !`.claude/envoy/envoy plan check`
16
+ Plan status: !`envoy plan check`
17
17
  </context>
18
18
 
19
19
  <process>
@@ -30,7 +30,7 @@ Parse $ARGUMENTS for mode flags and bug description:
30
30
 
31
31
  1. Call `envoy plan check` to get status
32
32
  2. If no plan: Create branch from bug description (infer name)
33
- 3. Append bug description: `.claude/envoy/envoy plan append-user-input "<bug_description>"`
33
+ 3. Append bug description: `envoy plan append-user-input "<bug_description>"`
34
34
  4. Delegate to **planner agent**:
35
35
  * "Run the planning-workflow. INPUTS: `{ mode: 'quick', workflow_type: 'debug', feature_branch: <current_branch>, plan_status: <status> }`"
36
36
  * OUTPUTS: `{ success: true }`
@@ -77,7 +77,7 @@ If user chooses "start fresh": create new branch off base, set mode = "create"
77
77
 
78
78
  <step name="write_user_input">
79
79
  Append all gathered context to user_input.md:
80
- `.claude/envoy/envoy plan append-user-input "<all_gathered_context>"`
80
+ `envoy plan append-user-input "<all_gathered_context>"`
81
81
  </step>
82
82
 
83
83
  <step name="specialist_delegation">
@@ -93,7 +93,7 @@ Append all gathered context to user_input.md:
93
93
  </step>
94
94
 
95
95
  <step name="get_findings">
96
- Call `.claude/envoy/envoy plan get-findings` to get bug hypotheses/approaches
96
+ Call `envoy plan get-findings` to get bug hypotheses/approaches
97
97
  </step>
98
98
 
99
99
  <step name="research_delegation">
@@ -107,7 +107,7 @@ For each research objective (known library issues, similar errors, anti-patterns
107
107
  1. Present all clarifying questions from approach documents (bug hypotheses) to user
108
108
  2. AskUserQuestion: "Want to redirect investigation with specific requirements? (clears all findings)"
109
109
  - If yes: clear findings, return to specialist_delegation step
110
- 3. Call `.claude/envoy/envoy plan block-findings-gate`
110
+ 3. Call `envoy plan block-findings-gate`
111
111
  - Returns: `{ thoughts, affected_approaches: [{ specialist_name, approach_number }] }`
112
112
  4. If affected_approaches exist:
113
113
  - Re-delegate to affected specialists with thoughts context
@@ -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>