claude-all-hands 1.0.2 → 1.0.4
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.
- package/.claude/agents/curator.md +1 -5
- package/.claude/agents/documentation-taxonomist.md +255 -0
- package/.claude/agents/documentation-writer.md +366 -0
- package/.claude/agents/surveyor.md +1 -1
- package/.claude/commands/continue.md +12 -10
- package/.claude/commands/create-skill.md +2 -2
- package/.claude/commands/create-specialist.md +3 -3
- package/.claude/commands/debug.md +5 -5
- package/.claude/commands/docs-adjust.md +214 -0
- package/.claude/commands/docs-audit.md +172 -0
- package/.claude/commands/docs-init.md +210 -0
- package/.claude/commands/plan.md +6 -6
- package/.claude/commands/whats-next.md +2 -2
- package/.claude/envoy/README.md +5 -5
- package/.claude/envoy/package-lock.json +216 -10
- package/.claude/envoy/package.json +9 -0
- package/.claude/envoy/src/commands/docs.ts +881 -0
- package/.claude/envoy/src/commands/knowledge.ts +33 -42
- package/.claude/envoy/src/lib/ast-queries.ts +261 -0
- package/.claude/envoy/src/lib/knowledge.ts +176 -124
- package/.claude/envoy/src/lib/tree-sitter-utils.ts +301 -0
- package/.claude/envoy/src/types/tree-sitter.d.ts +76 -0
- package/.claude/hooks/scripts/enforce_research_fetch.py +1 -1
- package/.claude/protocols/bug-discovery.yaml +1 -1
- package/.claude/protocols/discovery.yaml +1 -1
- package/.claude/settings.json +4 -3
- package/.claude/skills/discovery-mode/SKILL.md +7 -7
- package/.claude/skills/documentation-taxonomy/SKILL.md +287 -0
- package/.claude/skills/implementation-mode/SKILL.md +7 -7
- package/.claude/skills/knowledge-discovery/SKILL.md +178 -0
- package/bin/cli.js +41 -1
- package/package.json +1 -1
- package/.claude/agents/documentor.md +0 -147
- package/.claude/commands/audit-docs.md +0 -94
- package/.claude/commands/create-docs.md +0 -100
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-taxonomy
|
|
3
|
+
description: Reference documentation for the taxonomy-based documentation system. Covers envoy docs commands, segmentation strategies, complexity metrics, and symbol reference format.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Provide reference documentation for the taxonomy-based documentation system. Used by documentation-taxonomist and documentation-writer agents.
|
|
8
|
+
</objective>
|
|
9
|
+
|
|
10
|
+
<quick_start>
|
|
11
|
+
```bash
|
|
12
|
+
# Get documentation tree with coverage
|
|
13
|
+
envoy docs tree src/ --depth 3
|
|
14
|
+
|
|
15
|
+
# Get complexity metrics
|
|
16
|
+
envoy docs complexity src/lib/
|
|
17
|
+
|
|
18
|
+
# Format a symbol reference
|
|
19
|
+
envoy docs format-reference src/auth.ts validateToken
|
|
20
|
+
|
|
21
|
+
# Validate all documentation references
|
|
22
|
+
envoy docs validate
|
|
23
|
+
```
|
|
24
|
+
</quick_start>
|
|
25
|
+
|
|
26
|
+
<command_reference>
|
|
27
|
+
## envoy docs tree
|
|
28
|
+
|
|
29
|
+
Get directory tree with documentation coverage indicators.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
envoy docs tree <path> [--depth <n>]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Arguments:**
|
|
36
|
+
- `path`: Directory to analyze
|
|
37
|
+
- `--depth`: Max depth to traverse (default: 3)
|
|
38
|
+
|
|
39
|
+
**Output:**
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"path": "src/",
|
|
43
|
+
"tree": [
|
|
44
|
+
{
|
|
45
|
+
"name": "auth",
|
|
46
|
+
"type": "directory",
|
|
47
|
+
"has_docs": true,
|
|
48
|
+
"doc_path": "docs/auth/README.md",
|
|
49
|
+
"children": [...]
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"coverage": {
|
|
53
|
+
"total": 42,
|
|
54
|
+
"covered": 15,
|
|
55
|
+
"percentage": 36
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## envoy docs complexity
|
|
61
|
+
|
|
62
|
+
Get complexity metrics for file or directory.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
envoy docs complexity <path>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Output (file):**
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"path": "src/auth.ts",
|
|
72
|
+
"type": "file",
|
|
73
|
+
"metrics": {
|
|
74
|
+
"lines": 250,
|
|
75
|
+
"imports": 8,
|
|
76
|
+
"exports": 5,
|
|
77
|
+
"functions": 12,
|
|
78
|
+
"classes": 2
|
|
79
|
+
},
|
|
80
|
+
"estimated_tokens": 2500
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Output (directory):**
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"path": "src/lib/",
|
|
88
|
+
"type": "directory",
|
|
89
|
+
"file_count": 15,
|
|
90
|
+
"metrics": {
|
|
91
|
+
"lines": 3200,
|
|
92
|
+
"imports": 45,
|
|
93
|
+
"exports": 32,
|
|
94
|
+
"functions": 78,
|
|
95
|
+
"classes": 12
|
|
96
|
+
},
|
|
97
|
+
"estimated_tokens": 32000
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## envoy docs format-reference
|
|
102
|
+
|
|
103
|
+
Format a symbol reference with git blame hash.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
envoy docs format-reference <file> <symbol>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Arguments:**
|
|
110
|
+
- `file`: Path to source file
|
|
111
|
+
- `symbol`: Symbol name (function, class, variable, type, interface)
|
|
112
|
+
|
|
113
|
+
**Output:**
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"reference": "[ref:src/auth.ts:validateToken:abc1234]",
|
|
117
|
+
"file": "src/auth.ts",
|
|
118
|
+
"symbol": "validateToken",
|
|
119
|
+
"hash": "abc1234",
|
|
120
|
+
"line_range": { "start": 42, "end": 67 },
|
|
121
|
+
"symbol_type": "function"
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Supported symbol types by language:**
|
|
126
|
+
| Language | Symbols |
|
|
127
|
+
|----------|---------|
|
|
128
|
+
| TypeScript/JavaScript | function, class, variable, type, interface, method, arrowFunction |
|
|
129
|
+
| Python | function, class, variable, method |
|
|
130
|
+
| Go | function, type, method, variable, const |
|
|
131
|
+
| Rust | function, struct, enum, impl, trait, const |
|
|
132
|
+
| Java | class, interface, method, field, enum |
|
|
133
|
+
| Ruby | function, class, module |
|
|
134
|
+
| Swift | function, class, struct, enum, protocol |
|
|
135
|
+
|
|
136
|
+
## envoy docs validate
|
|
137
|
+
|
|
138
|
+
Validate all documentation references for staleness/validity.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
envoy docs validate [--path <docs_path>]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Output:**
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"message": "Validated 42 references",
|
|
148
|
+
"total_refs": 42,
|
|
149
|
+
"stale_count": 3,
|
|
150
|
+
"invalid_count": 1,
|
|
151
|
+
"stale": [
|
|
152
|
+
{
|
|
153
|
+
"doc_file": "docs/auth/README.md",
|
|
154
|
+
"reference": "[ref:src/auth.ts:validateToken:abc1234]",
|
|
155
|
+
"stored_hash": "abc1234",
|
|
156
|
+
"current_hash": "def5678"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"invalid": [
|
|
160
|
+
{
|
|
161
|
+
"doc_file": "docs/api/routes.md",
|
|
162
|
+
"reference": "[ref:src/routes.ts:deletedFunction:xyz789]",
|
|
163
|
+
"reason": "Symbol not found"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
</command_reference>
|
|
169
|
+
|
|
170
|
+
<reference_format>
|
|
171
|
+
## Symbol Reference Format
|
|
172
|
+
|
|
173
|
+
References use the format: `[ref:file:symbol:hash]`
|
|
174
|
+
|
|
175
|
+
**Components:**
|
|
176
|
+
- `file`: Relative path from project root
|
|
177
|
+
- `symbol`: Symbol name (exact match required)
|
|
178
|
+
- `hash`: Short git commit hash (7 chars) from blame
|
|
179
|
+
|
|
180
|
+
**Regex pattern:** `/\[ref:([^:]+):([^:]+):([a-f0-9]+)\]/g`
|
|
181
|
+
|
|
182
|
+
**Examples:**
|
|
183
|
+
```markdown
|
|
184
|
+
The authentication flow starts with [ref:src/auth.ts:validateToken:abc1234].
|
|
185
|
+
|
|
186
|
+
Configuration is handled by [ref:src/config/index.ts:loadConfig:def5678].
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Why this format:**
|
|
190
|
+
- Symbol-based: survives line number changes within file
|
|
191
|
+
- Hash-tracked: enables staleness detection
|
|
192
|
+
- Human-readable: visible in docs, clickable in IDEs
|
|
193
|
+
- Parseable: regex-extractable for validation
|
|
194
|
+
</reference_format>
|
|
195
|
+
|
|
196
|
+
<segmentation_strategies>
|
|
197
|
+
## Segmentation Principles
|
|
198
|
+
|
|
199
|
+
**Size targets:**
|
|
200
|
+
- 1000-3000 tokens per segment (source code)
|
|
201
|
+
- Single segment documentable in one agent pass
|
|
202
|
+
- Balance between parallelism and overhead
|
|
203
|
+
|
|
204
|
+
**Domain grouping:**
|
|
205
|
+
```
|
|
206
|
+
authentication/ → single segment
|
|
207
|
+
api/
|
|
208
|
+
routes/ → segment if > 2000 tokens
|
|
209
|
+
middleware/ → segment if > 2000 tokens
|
|
210
|
+
handlers/ → may need sub-segments
|
|
211
|
+
lib/
|
|
212
|
+
utils/ → often single segment
|
|
213
|
+
core/ → often needs splitting
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Complexity thresholds:**
|
|
217
|
+
| Complexity | Action |
|
|
218
|
+
|------------|--------|
|
|
219
|
+
| < 500 tokens | Combine with adjacent |
|
|
220
|
+
| 500-3000 tokens | Single segment |
|
|
221
|
+
| > 3000 tokens | Split by subdirectory |
|
|
222
|
+
| > 50 functions | Split by functionality |
|
|
223
|
+
|
|
224
|
+
**Depth guidance:**
|
|
225
|
+
| Depth | When to use |
|
|
226
|
+
|-------|-------------|
|
|
227
|
+
| overview | Simple utilities, config, low complexity |
|
|
228
|
+
| detailed | Core business logic, complex flows |
|
|
229
|
+
| comprehensive | Public APIs, libraries, critical paths |
|
|
230
|
+
</segmentation_strategies>
|
|
231
|
+
|
|
232
|
+
<complexity_interpretation>
|
|
233
|
+
## Interpreting Complexity Metrics
|
|
234
|
+
|
|
235
|
+
**Lines of code:**
|
|
236
|
+
- < 100: Simple module
|
|
237
|
+
- 100-500: Standard module
|
|
238
|
+
- 500-1000: Complex module
|
|
239
|
+
- > 1000: Consider splitting
|
|
240
|
+
|
|
241
|
+
**Functions/classes ratio:**
|
|
242
|
+
- High functions, few classes: Utility module
|
|
243
|
+
- Few functions, many classes: OOP-heavy module
|
|
244
|
+
- Balanced: Standard module
|
|
245
|
+
|
|
246
|
+
**Imports:**
|
|
247
|
+
- < 5: Self-contained
|
|
248
|
+
- 5-15: Normal coupling
|
|
249
|
+
- > 15: Highly coupled, document dependencies
|
|
250
|
+
|
|
251
|
+
**Exports:**
|
|
252
|
+
- 1-5: Focused API surface
|
|
253
|
+
- 5-15: Medium API
|
|
254
|
+
- > 15: Large API, needs comprehensive docs
|
|
255
|
+
|
|
256
|
+
**Estimated tokens:**
|
|
257
|
+
- Rough guide: lines × 10
|
|
258
|
+
- Used for segment sizing
|
|
259
|
+
- Not exact, account for variance
|
|
260
|
+
</complexity_interpretation>
|
|
261
|
+
|
|
262
|
+
<parallel_writers>
|
|
263
|
+
## Parallel Writer Pattern
|
|
264
|
+
|
|
265
|
+
Writers work directly on the branch without worktrees. The taxonomist ensures non-overlapping output directories, preventing conflicts.
|
|
266
|
+
|
|
267
|
+
**Segmentation rule:** Each segment gets a unique `output_path` (e.g., `docs/auth/`, `docs/api/`). Writers only modify files within their assigned output directory.
|
|
268
|
+
|
|
269
|
+
**Why no worktrees:** Since each writer owns a distinct directory, there are no file conflicts. This simplifies the workflow and avoids worktree management overhead.
|
|
270
|
+
</parallel_writers>
|
|
271
|
+
|
|
272
|
+
<anti_patterns>
|
|
273
|
+
- Creating docs without symbol references (no traceability)
|
|
274
|
+
- Overlapping segments (causes merge conflicts)
|
|
275
|
+
- Segments too large (> 5000 tokens, agent struggles)
|
|
276
|
+
- Segments too small (< 500 tokens, overhead)
|
|
277
|
+
- Skipping complexity analysis (poor segmentation)
|
|
278
|
+
- Not searching existing docs (duplication)
|
|
279
|
+
- Ignoring depth guidance (inconsistent detail)
|
|
280
|
+
</anti_patterns>
|
|
281
|
+
|
|
282
|
+
<success_criteria>
|
|
283
|
+
- All code snippets have `[ref:...]` format
|
|
284
|
+
- Segments are non-overlapping (enables parallel writers without conflicts)
|
|
285
|
+
- Complexity informs depth decisions
|
|
286
|
+
- Validation passes after commits
|
|
287
|
+
</success_criteria>
|
|
@@ -10,15 +10,15 @@ Execute individual prompts from an active plan. Read prompt → implement → tr
|
|
|
10
10
|
<quick_start>
|
|
11
11
|
```bash
|
|
12
12
|
# 1. Get prompt to implement
|
|
13
|
-
|
|
13
|
+
envoy plans get-prompt <task-number>
|
|
14
14
|
|
|
15
15
|
# 2. Implement using Glob, Grep, Read for context
|
|
16
16
|
|
|
17
17
|
# 3. Track progress
|
|
18
|
-
|
|
18
|
+
envoy plans append-history <task> --summary "Added auth middleware" --files '["src/auth.ts"]'
|
|
19
19
|
|
|
20
20
|
# 4. Get review
|
|
21
|
-
|
|
21
|
+
envoy plans review-prompt <task>
|
|
22
22
|
|
|
23
23
|
# 5. Commit when review passes
|
|
24
24
|
git commit -m "task-<N>: <summary>"
|
|
@@ -28,7 +28,7 @@ git commit -m "task-<N>: <summary>"
|
|
|
28
28
|
<workflow>
|
|
29
29
|
### 1. Get Prompt
|
|
30
30
|
```bash
|
|
31
|
-
|
|
31
|
+
envoy plans get-prompt <task-number>
|
|
32
32
|
```
|
|
33
33
|
Returns: prompt content + existing history
|
|
34
34
|
|
|
@@ -46,14 +46,14 @@ git worktree add .worktrees/task-N-V <branch>
|
|
|
46
46
|
### 4. Track History
|
|
47
47
|
After each significant change:
|
|
48
48
|
```bash
|
|
49
|
-
|
|
49
|
+
envoy plans append-history <task> \
|
|
50
50
|
--summary "Brief description of change" \
|
|
51
51
|
--files '["path/to/changed.ts", "path/to/other.ts"]'
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
### 5. Get Review
|
|
55
55
|
```bash
|
|
56
|
-
|
|
56
|
+
envoy plans review-prompt <task>
|
|
57
57
|
```
|
|
58
58
|
If changes needed → fix → append-history → review again
|
|
59
59
|
|
|
@@ -119,7 +119,7 @@ For each issue:
|
|
|
119
119
|
|
|
120
120
|
### 3. Review Changes
|
|
121
121
|
```bash
|
|
122
|
-
|
|
122
|
+
envoy vertex review --last-commit
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
| Response | Action |
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: knowledge-discovery
|
|
3
|
+
description: Semantic codebase exploration using knowledge base + LSP. Use for context gathering, understanding design decisions, finding implementation patterns. Combines "why" from docs with "where" from code references.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Enable context-efficient codebase exploration by leveraging semantic knowledge search before raw file reads. Knowledge docs capture motivations and design decisions that grep/glob cannot surface. File references in results guide targeted code exploration via LSP or direct reads.
|
|
8
|
+
</objective>
|
|
9
|
+
|
|
10
|
+
<motivation>
|
|
11
|
+
Traditional search (grep, glob) finds **what** exists but not **why**. Knowledge base docs encode:
|
|
12
|
+
- Design motivations and tradeoffs
|
|
13
|
+
- Pattern explanations with rationale
|
|
14
|
+
- Cross-cutting concerns that span multiple files
|
|
15
|
+
- "How we do X" institutional knowledge
|
|
16
|
+
|
|
17
|
+
Searching knowledge first provides semantic context that informs subsequent code exploration. File references embedded in knowledge docs point to implementations, enabling LSP-guided exploration that minimizes context consumption.
|
|
18
|
+
</motivation>
|
|
19
|
+
|
|
20
|
+
<quick_start>
|
|
21
|
+
```bash
|
|
22
|
+
# Semantic search - use full descriptive phrases, not keywords
|
|
23
|
+
envoy knowledge search "how does retry logic handle rate limits in external API calls"
|
|
24
|
+
|
|
25
|
+
# NOT: envoy knowledge search "retry rate limit"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Result interpretation:
|
|
29
|
+
- **High similarity (>0.8)**: Full `full_resource_context` included - read directly
|
|
30
|
+
- **Lower similarity**: Only `description` provided - may need `envoy knowledge read <path>` for full content
|
|
31
|
+
</quick_start>
|
|
32
|
+
|
|
33
|
+
<constraints>
|
|
34
|
+
- Use full phrases for semantic search, not keywords
|
|
35
|
+
- Always check file references in results before doing raw codebase searches
|
|
36
|
+
- LSP required when symbol references present (context-light first)
|
|
37
|
+
- Estimate context cost before large file reads
|
|
38
|
+
</constraints>
|
|
39
|
+
|
|
40
|
+
<workflow>
|
|
41
|
+
### 1. Semantic Search First
|
|
42
|
+
```bash
|
|
43
|
+
envoy knowledge search "<descriptive question about the requirement or concept>"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Interpret Results
|
|
47
|
+
|
|
48
|
+
**High-confidence matches** return full content:
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"similarity": 0.85,
|
|
52
|
+
"full_resource_context": "---\ndescription: ...\n---\n\n# Full doc content..."
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Lower-confidence matches** return descriptions only:
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"similarity": 0.72,
|
|
60
|
+
"description": "Brief description of what the doc covers"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If description seems relevant, fetch full content:
|
|
65
|
+
```bash
|
|
66
|
+
envoy knowledge read "docs/path/to/file.md"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3. Follow File References
|
|
70
|
+
|
|
71
|
+
Knowledge docs embed file references in two forms:
|
|
72
|
+
|
|
73
|
+
**Path + Symbol** (LSP required):
|
|
74
|
+
```
|
|
75
|
+
[ref:.claude/envoy/src/lib/retry.ts:withRetry:fc672da]
|
|
76
|
+
```
|
|
77
|
+
→ Use LSP to explore symbol before reading file
|
|
78
|
+
|
|
79
|
+
**Path Only** (direct read permitted):
|
|
80
|
+
```
|
|
81
|
+
[ref:.claude/envoy/src/commands/gemini.ts::fc672da]
|
|
82
|
+
```
|
|
83
|
+
→ Full file read acceptable
|
|
84
|
+
|
|
85
|
+
### 4. LSP Exploration (when symbol present)
|
|
86
|
+
|
|
87
|
+
Match LSP operation to information need:
|
|
88
|
+
|
|
89
|
+
| Need | LSP Operation |
|
|
90
|
+
|------|---------------|
|
|
91
|
+
| Find callers/usage | `incomingCalls` |
|
|
92
|
+
| Find dependants | `findReferences` |
|
|
93
|
+
| Get signature/types | `hover` |
|
|
94
|
+
| Jump to definition | `goToDefinition` |
|
|
95
|
+
| All symbols in file | `documentSymbol` |
|
|
96
|
+
|
|
97
|
+
**Example flow**:
|
|
98
|
+
```bash
|
|
99
|
+
# 1. Find symbol location
|
|
100
|
+
LSP goToDefinition → retry.ts:78
|
|
101
|
+
|
|
102
|
+
# 2. Understand usage patterns
|
|
103
|
+
LSP incomingCalls → 6 callers in gemini.ts
|
|
104
|
+
|
|
105
|
+
# 3. Only then read relevant implementation
|
|
106
|
+
Read retry.ts (lines 78-120)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 5. Context-Aware Reading
|
|
110
|
+
|
|
111
|
+
After LSP exploration, read only what's needed:
|
|
112
|
+
- Specific function/class implementations
|
|
113
|
+
- Caller contexts that inform usage patterns
|
|
114
|
+
- Avoid reading entire files when LSP provides structure
|
|
115
|
+
</workflow>
|
|
116
|
+
|
|
117
|
+
<examples>
|
|
118
|
+
<example name="Investigating retry patterns">
|
|
119
|
+
```bash
|
|
120
|
+
# 1. Semantic search
|
|
121
|
+
envoy knowledge search "how do we handle retries for external API calls in envoy"
|
|
122
|
+
|
|
123
|
+
# Result includes ref: .claude/envoy/src/lib/retry.ts:withRetry:fc672da
|
|
124
|
+
|
|
125
|
+
# 2. LSP exploration
|
|
126
|
+
LSP documentSymbol retry.ts → find withRetry at line 78
|
|
127
|
+
LSP incomingCalls line 78 → 6 callers in gemini.ts
|
|
128
|
+
|
|
129
|
+
# 3. Targeted read
|
|
130
|
+
Read retry.ts lines 36-125 (isRetryableError + withRetry only)
|
|
131
|
+
```
|
|
132
|
+
</example>
|
|
133
|
+
|
|
134
|
+
<example name="Understanding protocol extension">
|
|
135
|
+
```bash
|
|
136
|
+
# 1. Semantic search
|
|
137
|
+
envoy knowledge search "how are protocols maintained for reusability and extension"
|
|
138
|
+
|
|
139
|
+
# Result includes full context explaining:
|
|
140
|
+
# - extends keyword for inheritance
|
|
141
|
+
# - Step numbering (6.1, 6.2 for insertions, 6+ for augments)
|
|
142
|
+
# - File refs to protocols/debugging.yaml, protocols/implementation.yaml
|
|
143
|
+
|
|
144
|
+
# 2. Path-only reference → direct read
|
|
145
|
+
Read .claude/protocols/debugging.yaml (extends field visible)
|
|
146
|
+
```
|
|
147
|
+
</example>
|
|
148
|
+
|
|
149
|
+
<decision_tree>
|
|
150
|
+
```
|
|
151
|
+
Need codebase context?
|
|
152
|
+
├─ Know specific file/symbol? → Read/LSP directly
|
|
153
|
+
├─ Conceptual question? → envoy knowledge search
|
|
154
|
+
│ ├─ High similarity result? → Use full_resource_context
|
|
155
|
+
│ └─ Lower similarity? → envoy knowledge read if relevant
|
|
156
|
+
│ └─ File references in result?
|
|
157
|
+
│ ├─ Has symbol (path:symbol:hash)? → LSP first
|
|
158
|
+
│ └─ Path only (path::hash)? → Direct read OK
|
|
159
|
+
└─ No knowledge matches? → Fallback to grep/glob
|
|
160
|
+
```
|
|
161
|
+
</decision_tree>
|
|
162
|
+
</examples>
|
|
163
|
+
|
|
164
|
+
<anti_patterns>
|
|
165
|
+
- Using keywords instead of descriptive phrases in knowledge search
|
|
166
|
+
- Reading entire files when LSP can provide structure first
|
|
167
|
+
- Skipping knowledge search and going straight to grep
|
|
168
|
+
- Ignoring file references and re-searching codebase
|
|
169
|
+
- Using findReferences when incomingCalls would suffice (findReferences includes definition)
|
|
170
|
+
</anti_patterns>
|
|
171
|
+
|
|
172
|
+
<success_criteria>
|
|
173
|
+
- Knowledge search invoked before raw codebase exploration
|
|
174
|
+
- File references from knowledge docs used to guide code exploration
|
|
175
|
+
- LSP used for symbol references before large file reads
|
|
176
|
+
- Context budget preserved through targeted reads
|
|
177
|
+
- Design motivations ("why") understood alongside implementation ("what")
|
|
178
|
+
</success_criteria>
|
package/bin/cli.js
CHANGED
|
@@ -4857,7 +4857,8 @@ var yargs_default = Yargs;
|
|
|
4857
4857
|
|
|
4858
4858
|
// src/commands/init.ts
|
|
4859
4859
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
4860
|
-
import { copyFileSync, existsSync as existsSync3, mkdirSync, readFileSync as readFileSync5, renameSync, writeFileSync } from "fs";
|
|
4860
|
+
import { appendFileSync, copyFileSync, existsSync as existsSync3, mkdirSync, readFileSync as readFileSync5, renameSync, writeFileSync } from "fs";
|
|
4861
|
+
import { homedir } from "os";
|
|
4861
4862
|
import { dirname as dirname4, join as join2, resolve as resolve6 } from "path";
|
|
4862
4863
|
import * as readline from "readline";
|
|
4863
4864
|
|
|
@@ -6600,6 +6601,12 @@ function getAllhandsRoot() {
|
|
|
6600
6601
|
}
|
|
6601
6602
|
|
|
6602
6603
|
// src/commands/init.ts
|
|
6604
|
+
var ENVOY_SHELL_FUNCTION = `
|
|
6605
|
+
# AllHands envoy command - resolves to .claude/envoy/envoy from current directory
|
|
6606
|
+
envoy() {
|
|
6607
|
+
"$PWD/.claude/envoy/envoy" "$@"
|
|
6608
|
+
}
|
|
6609
|
+
`;
|
|
6603
6610
|
var MIGRATION_MAP = {
|
|
6604
6611
|
"CLAUDE.md": "CLAUDE.project.md",
|
|
6605
6612
|
".claude/settings.json": ".claude/settings.local.json"
|
|
@@ -6653,6 +6660,28 @@ async function confirm(message) {
|
|
|
6653
6660
|
});
|
|
6654
6661
|
});
|
|
6655
6662
|
}
|
|
6663
|
+
function setupEnvoyShellFunction() {
|
|
6664
|
+
const shell = process.env.SHELL || "";
|
|
6665
|
+
let shellRc = null;
|
|
6666
|
+
if (shell.includes("zsh")) {
|
|
6667
|
+
shellRc = join2(homedir(), ".zshrc");
|
|
6668
|
+
} else if (shell.includes("bash")) {
|
|
6669
|
+
const bashProfile = join2(homedir(), ".bash_profile");
|
|
6670
|
+
const bashRc = join2(homedir(), ".bashrc");
|
|
6671
|
+
shellRc = existsSync3(bashProfile) ? bashProfile : bashRc;
|
|
6672
|
+
}
|
|
6673
|
+
if (!shellRc) {
|
|
6674
|
+
return { added: false, shellRc: null };
|
|
6675
|
+
}
|
|
6676
|
+
if (existsSync3(shellRc)) {
|
|
6677
|
+
const content = readFileSync5(shellRc, "utf-8");
|
|
6678
|
+
if (content.includes("envoy()") || content.includes(".claude/envoy/envoy")) {
|
|
6679
|
+
return { added: false, shellRc };
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
appendFileSync(shellRc, ENVOY_SHELL_FUNCTION);
|
|
6683
|
+
return { added: true, shellRc };
|
|
6684
|
+
}
|
|
6656
6685
|
function migrateExistingFiles(target) {
|
|
6657
6686
|
const migrated = {};
|
|
6658
6687
|
for (const [orig, dest] of Object.entries(MIGRATION_MAP)) {
|
|
@@ -6824,6 +6853,17 @@ CLAUDE.project.md
|
|
|
6824
6853
|
console.log(` Details: ${result.stderr.trim()}`);
|
|
6825
6854
|
}
|
|
6826
6855
|
}
|
|
6856
|
+
console.log("\nSetting up envoy shell command...");
|
|
6857
|
+
const envoyResult = setupEnvoyShellFunction();
|
|
6858
|
+
if (envoyResult.added && envoyResult.shellRc) {
|
|
6859
|
+
console.log(` Added envoy function to ${envoyResult.shellRc}`);
|
|
6860
|
+
console.log(" Run `source " + envoyResult.shellRc + "` or restart terminal to use");
|
|
6861
|
+
} else if (envoyResult.shellRc) {
|
|
6862
|
+
console.log(" envoy function already configured");
|
|
6863
|
+
} else {
|
|
6864
|
+
console.log(" Could not detect shell config (add manually to your shell rc):");
|
|
6865
|
+
console.log(' envoy() { "$PWD/.claude/envoy/envoy" "$@"; }');
|
|
6866
|
+
}
|
|
6827
6867
|
if (!autoYes) {
|
|
6828
6868
|
const remoteResult = git(["remote", "get-url", "origin"], resolvedTarget);
|
|
6829
6869
|
const hasGitHubRemote = remoteResult.success && remoteResult.stdout.includes("github.com");
|