octocode-cli 1.2.0 → 1.2.2
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/README.md +18 -1
- package/out/octocode-cli.js +573 -354
- package/package.json +1 -1
- package/skills/README.md +17 -12
- package/skills/octocode-implement/SKILL.md +65 -60
- package/skills/octocode-local-search/SKILL.md +72 -41
- package/skills/octocode-plan/SKILL.md +431 -0
- package/skills/octocode-pr-review/SKILL.md +43 -1
- package/skills/octocode-research/SKILL.md +43 -101
- package/skills/octocode-roast/SKILL.md +39 -0
- package/skills/octocode-generate/SKILL.md +0 -172
package/package.json
CHANGED
package/skills/README.md
CHANGED
|
@@ -9,8 +9,8 @@ Pre-built Claude Code skills for enhanced AI-assisted research and development.
|
|
|
9
9
|
| `octocode-research` | Evidence-first code forensics (local & GitHub) | PREPARE → DISCOVER → ANALYZE → OUTPUT |
|
|
10
10
|
| `octocode-local-search` | Local-first code exploration and discovery | DISCOVER → PLAN → EXECUTE → VERIFY → OUTPUT |
|
|
11
11
|
| `octocode-implement` | Research-driven feature implementation from specs | SPEC → CONTEXT → PLAN → RESEARCH → IMPLEMENT → VALIDATE |
|
|
12
|
+
| `octocode-plan` | Adaptive research & implementation planning | UNDERSTAND → RESEARCH → PLAN → IMPLEMENT → VERIFY |
|
|
12
13
|
| `octocode-pr-review` | Defects-first PR review across 6+ domains | CONTEXT → CHECKPOINT → ANALYSIS → FINALIZE → REPORT |
|
|
13
|
-
| `octocode-generate` | App scaffolding with stack selection | DISCOVERY → STACK → PLAN → RESEARCH → SCAFFOLD → VALIDATE |
|
|
14
14
|
| `octocode-roast` | Brutally honest code review with comedic flair | SCOPE → ROAST → INVENTORY → SPOTLIGHT → REDEMPTION |
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
@@ -77,6 +77,22 @@ Features:
|
|
|
77
77
|
|
|
78
78
|
Core Principle: "Read 10x more than you write. Measure twice, cut once."
|
|
79
79
|
|
|
80
|
+
### octocode-plan
|
|
81
|
+
|
|
82
|
+
**Use when**: Implementing features requiring research-driven planning, tackling complex multi-step tasks, building new functionality with proper validation, or when you need structured implementation with approval gates.
|
|
83
|
+
|
|
84
|
+
Features:
|
|
85
|
+
- Adaptive execution flow: UNDERSTAND → RESEARCH → PLAN → IMPLEMENT → VERIFY
|
|
86
|
+
- Evidence-based coding with pattern validation from high-quality repos
|
|
87
|
+
- Interactive mode with user checkpoints at key decision points
|
|
88
|
+
- Goal classification (RESEARCH_ONLY, ANALYSIS, CREATION, FEATURE, BUG, REFACTOR)
|
|
89
|
+
- Research synthesis with confidence levels
|
|
90
|
+
- Plan approval gates before implementation
|
|
91
|
+
- Multi-agent parallelization for independent research domains
|
|
92
|
+
- Structured output to `.octocode/plan/{session-name}/`
|
|
93
|
+
|
|
94
|
+
Core Principle: "Research Before Code. Verify Patterns. Follow the Plan. Green Build Required."
|
|
95
|
+
|
|
80
96
|
### octocode-pr-review
|
|
81
97
|
|
|
82
98
|
**Use when**: Reviewing pull requests for bugs, security vulnerabilities, architecture problems, performance issues, and code quality.
|
|
@@ -90,17 +106,6 @@ Domain Reviewers:
|
|
|
90
106
|
- 🚨 Error Handling (swallowed exceptions, poor diagnostics)
|
|
91
107
|
- 🔄 Flow Impact (breaking changes, altered data paths)
|
|
92
108
|
|
|
93
|
-
### octocode-generate
|
|
94
|
-
|
|
95
|
-
**Use when**: Scaffolding new applications with optimal tech stack selection.
|
|
96
|
-
|
|
97
|
-
Supported Frameworks:
|
|
98
|
-
- **Fullstack**: Next.js, T3 Stack, Remix, Nuxt
|
|
99
|
-
- **Frontend**: Vite, Angular
|
|
100
|
-
- **Mobile**: Expo (React Native)
|
|
101
|
-
- **Desktop**: Electron Vite
|
|
102
|
-
- **Backend**: NestJS, Hono, Fastify
|
|
103
|
-
|
|
104
109
|
### octocode-roast
|
|
105
110
|
|
|
106
111
|
**Use when**: You want entertainment with your code review, finding antipatterns, or humorous feedback.
|
|
@@ -24,30 +24,11 @@ Role: **Implementation Agent**. Expert Engineer with surgical precision.
|
|
|
24
24
|
## 2. Scope & Tooling
|
|
25
25
|
|
|
26
26
|
<tools>
|
|
27
|
-
|
|
27
|
+
> 🔍 **For local workspace search & LSP code intelligence, call the `octocode-local-search` skill!**
|
|
28
|
+
> Includes: `localViewStructure`, `localSearchCode`, `localFindFiles`, `localGetFileContent`, `lspGotoDefinition`, `lspFindReferences`, `lspCallHierarchy`
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
| `localViewStructure` | Map codebase architecture |
|
|
32
|
-
| `localSearchCode` | Find implementations, usages |
|
|
33
|
-
| `localFindFiles` | Locate configs, recent changes |
|
|
34
|
-
| `localGetFileContent` | Read implementations deeply |
|
|
35
|
-
|
|
36
|
-
**Octocode LSP** (Semantic Code Intelligence):
|
|
37
|
-
|
|
38
|
-
| Tool | Purpose |
|
|
39
|
-
|------|---------|
|
|
40
|
-
| `lspGotoDefinition` | Trace imports, find source |
|
|
41
|
-
| `lspFindReferences` | Impact analysis |
|
|
42
|
-
| `lspCallHierarchy` | Understand data flow |
|
|
43
|
-
|
|
44
|
-
**Octocode GitHub** (When patterns not found locally):
|
|
45
|
-
|
|
46
|
-
| Tool | Purpose |
|
|
47
|
-
|------|---------|
|
|
48
|
-
| `githubSearchCode` | Reference implementations |
|
|
49
|
-
| `githubGetFileContent` | Canonical patterns |
|
|
50
|
-
| `packageSearch` | Library internals |
|
|
30
|
+
> 🌐 **For external GitHub research, call the `octocode-research` skill!**
|
|
31
|
+
> Includes: `githubSearchCode`, `githubGetFileContent`, `githubSearchRepositories`, `packageSearch`
|
|
51
32
|
|
|
52
33
|
**Task Management**: `TodoWrite`, `Task` (for parallel agents)
|
|
53
34
|
|
|
@@ -91,37 +72,25 @@ Role: **Implementation Agent**. Expert Engineer with surgical precision.
|
|
|
91
72
|
## 4. Research Flows
|
|
92
73
|
|
|
93
74
|
<research_flows>
|
|
94
|
-
**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
|
99
|
-
|
|
100
|
-
|
|
|
101
|
-
| Find
|
|
102
|
-
|
|
|
103
|
-
| External patterns | `githubSearchCode`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| `localSearchCode` | Find Definition | `lspGotoDefinition` |
|
|
112
|
-
| `lspGotoDefinition` | Find Usages | `lspFindReferences` |
|
|
113
|
-
| `lspFindReferences` | Call Graph | `lspCallHierarchy` |
|
|
114
|
-
| `localGetFileContent` | External Lib | `packageSearch` → GitHub |
|
|
75
|
+
> 📚 **For detailed research workflows and tool transitions, see the `octocode-local-search` and `octocode-research` skills!**
|
|
76
|
+
|
|
77
|
+
**Implementation-Specific Research**:
|
|
78
|
+
|
|
79
|
+
| Goal | Approach |
|
|
80
|
+
|------|----------|
|
|
81
|
+
| Map codebase | `octocode-local-search` → `localViewStructure(depth=1)` |
|
|
82
|
+
| Find similar features | `octocode-local-search` → `localSearchCode(filesOnly=true)` |
|
|
83
|
+
| Trace code flow | `octocode-local-search` → LSP tools (definitions, references, call hierarchy) |
|
|
84
|
+
| External patterns | `octocode-research` → `githubSearchCode` for reference implementations |
|
|
85
|
+
| Library internals | `octocode-research` → `packageSearch` → `githubGetFileContent` |
|
|
86
|
+
|
|
87
|
+
**Key Questions Before Implementing**:
|
|
88
|
+
1. **Where?** → Map structure, find target files
|
|
89
|
+
2. **How?** → Find similar implementations, trace patterns
|
|
90
|
+
3. **Impact?** → Find all usages, understand dependencies
|
|
91
|
+
4. **Reference?** → Check external implementations if unclear
|
|
115
92
|
</research_flows>
|
|
116
93
|
|
|
117
|
-
<structural_code_vision>
|
|
118
|
-
**Think Like a Compiler**:
|
|
119
|
-
- **See the Tree**: Entry → Functions → Imports → Dependencies
|
|
120
|
-
- **Trace Dependencies**: `import {X} from 'Y'` → Use `lspGotoDefinition` to GO TO 'Y'
|
|
121
|
-
- **Follow Data**: Input → Transform → Output → Side Effects
|
|
122
|
-
- **Map Impact**: What else depends on what I'm changing?
|
|
123
|
-
</structural_code_vision>
|
|
124
|
-
|
|
125
94
|
---
|
|
126
95
|
|
|
127
96
|
## 5. Execution Flow
|
|
@@ -154,17 +123,11 @@ Role: **Implementation Agent**. Expert Engineer with surgical precision.
|
|
|
154
123
|
|
|
155
124
|
**SPEC + VALIDATE**: Parse spec → Check completeness → Ask if unclear.
|
|
156
125
|
|
|
157
|
-
**CONTEXT**:
|
|
126
|
+
**CONTEXT**: Use `octocode-local-search` skill → Map structure → Find similar features → Understand test patterns.
|
|
158
127
|
|
|
159
128
|
**PLAN**: Create plan → **User Checkpoint**: Wait for approval → Add tasks to TodoWrite.
|
|
160
129
|
|
|
161
|
-
**RESEARCH**:
|
|
162
|
-
```
|
|
163
|
-
localSearchCode(filesOnly=true) → Locate target
|
|
164
|
-
localGetFileContent(matchString=...) → Read context
|
|
165
|
-
lspCallHierarchy(direction="incoming") → Trace flow
|
|
166
|
-
lspFindReferences → Impact analysis
|
|
167
|
-
```
|
|
130
|
+
**RESEARCH**: Use `octocode-local-search` skill for each task (locate → read → trace flow → impact analysis).
|
|
168
131
|
|
|
169
132
|
**IMPLEMENT**: Types First → Core Logic → Integration → Tests. Match existing style.
|
|
170
133
|
|
|
@@ -281,8 +244,50 @@ Before declaring implementation complete:
|
|
|
281
244
|
|
|
282
245
|
---
|
|
283
246
|
|
|
247
|
+
## Multi-Agent Parallelization
|
|
248
|
+
|
|
249
|
+
> **Note**: Only applicable if parallel agents are supported by host environment.
|
|
250
|
+
|
|
251
|
+
**When to Spawn Subagents**:
|
|
252
|
+
- 2+ independent implementation tasks (no shared dependencies)
|
|
253
|
+
- Distinct subsystems (frontend + backend + tests)
|
|
254
|
+
- Separate packages/modules in monorepo
|
|
255
|
+
- Parallel research for different parts of the spec
|
|
256
|
+
|
|
257
|
+
**How to Parallelize**:
|
|
258
|
+
1. Use `TodoWrite` to create tasks and identify parallelizable work
|
|
259
|
+
2. Use `Task` tool to spawn subagents with specific, scoped goals
|
|
260
|
+
3. Each agent implements independently within defined boundaries
|
|
261
|
+
4. Merge changes after all agents complete, resolve conflicts
|
|
262
|
+
|
|
263
|
+
**Example**:
|
|
264
|
+
- Goal: "Implement user authentication with frontend and backend changes"
|
|
265
|
+
- Agent 1: Implement backend auth middleware + API routes (`src/api/auth/`)
|
|
266
|
+
- Agent 2: Implement frontend auth hooks + guards (`src/hooks/`, `src/components/auth/`)
|
|
267
|
+
- Agent 3: Implement tests for both (`tests/auth/`)
|
|
268
|
+
- Merge: Integrate components, verify end-to-end flow
|
|
269
|
+
|
|
270
|
+
**Smart Parallelization Tips**:
|
|
271
|
+
- Use `TodoWrite` with clear task boundaries per agent
|
|
272
|
+
- Parallelize RESEARCH phase across different spec requirements
|
|
273
|
+
- Parallelize IMPLEMENTATION only for truly independent modules
|
|
274
|
+
- Keep VALIDATION sequential to catch integration issues
|
|
275
|
+
- Define file ownership: each agent has exclusive directories
|
|
276
|
+
|
|
277
|
+
**Anti-patterns**:
|
|
278
|
+
- Don't parallelize when tasks share state or types being modified
|
|
279
|
+
- Don't spawn agents for single-file changes
|
|
280
|
+
- Don't parallelize when implementation order matters (e.g., types → logic → integration)
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
284
|
## References
|
|
285
285
|
|
|
286
|
+
**Related Skills**:
|
|
287
|
+
- **`octocode-local-search`**: Local workspace search & LSP code intelligence
|
|
288
|
+
- **`octocode-research`**: External GitHub research & package discovery
|
|
289
|
+
|
|
290
|
+
**Implementation Docs**:
|
|
286
291
|
- **Execution Phases**: `references/execution-phases.md` (Detailed steps, subagent patterns, multi-agent parallelization)
|
|
287
292
|
- **Tools**: `references/tool-reference.md` (Parameters & Tips)
|
|
288
293
|
- **Workflows**: `references/workflow-patterns.md` (Research Recipes)
|
|
@@ -24,6 +24,9 @@ Role: **Local Search Agent**. Expert Code Explorer.
|
|
|
24
24
|
## 2. Scope & Tooling
|
|
25
25
|
|
|
26
26
|
<tools>
|
|
27
|
+
> 🌐 **For external GitHub research (repos, packages, PRs), call the `octocode-research` skill if installed!**
|
|
28
|
+
> This skill focuses on **local codebase exploration**. Use `octocode-research` for GitHub tools (`githubSearchCode`, `githubViewRepoStructure`, `githubGetFileContent`, `githubSearchRepositories`, `githubSearchPullRequests`, `packageSearch`).
|
|
29
|
+
|
|
27
30
|
**Octocode Local** (ALWAYS prefer over shell commands):
|
|
28
31
|
|
|
29
32
|
| Tool | Purpose | Replaces |
|
|
@@ -33,13 +36,13 @@ Role: **Local Search Agent**. Expert Code Explorer.
|
|
|
33
36
|
| `localFindFiles` | Find files by metadata (name/time/size) | `find` |
|
|
34
37
|
| `localGetFileContent` | Read file content with targeting & context | `cat`, `head` |
|
|
35
38
|
|
|
36
|
-
**Octocode LSP** (Semantic Code Intelligence):
|
|
39
|
+
**Octocode LSP** (Semantic Code Intelligence - ALL require `lineHint` from `localSearchCode`):
|
|
37
40
|
|
|
38
41
|
| Tool | Purpose |
|
|
39
42
|
|------|---------|
|
|
40
|
-
| `lspGotoDefinition` |
|
|
41
|
-
| `lspFindReferences` | Find
|
|
42
|
-
| `lspCallHierarchy` | Trace
|
|
43
|
+
| `lspGotoDefinition` | LOCATE: Jump to symbol definition (lineHint required) |
|
|
44
|
+
| `lspFindReferences` | ANALYZE: Find ALL usages - calls, assignments, type refs (lineHint required) |
|
|
45
|
+
| `lspCallHierarchy` | ANALYZE: Trace CALL relationships only - incoming/outgoing (lineHint required) |
|
|
43
46
|
|
|
44
47
|
**Task Management**:
|
|
45
48
|
| Tool | Purpose |
|
|
@@ -47,7 +50,7 @@ Role: **Local Search Agent**. Expert Code Explorer.
|
|
|
47
50
|
| `TodoWrite` | Track research progress and subtasks |
|
|
48
51
|
| `Task` | Spawn parallel agents for independent research domains |
|
|
49
52
|
|
|
50
|
-
**FileSystem**: `Read`, `Write
|
|
53
|
+
**FileSystem**: `Read`, `Write`
|
|
51
54
|
</tools>
|
|
52
55
|
|
|
53
56
|
<why_local_tools>
|
|
@@ -110,13 +113,22 @@ Check `.octocode/context/context.md` for user context. Use it to ground research
|
|
|
110
113
|
- Answer is general knowledge (no code-specific evidence needed)
|
|
111
114
|
- User already provided the answer/context
|
|
112
115
|
- Trivial lookups better served by direct file read
|
|
116
|
+
|
|
117
|
+
**Switch to `octocode-research` when**:
|
|
118
|
+
- Need to explore external GitHub repositories
|
|
119
|
+
- Investigating dependency/package source code (beyond node_modules)
|
|
120
|
+
- Looking for implementation patterns in other projects
|
|
121
|
+
- Tracing PR history or understanding why changes were made
|
|
122
|
+
- Finding package metadata or repository locations
|
|
113
123
|
</mindset>
|
|
114
124
|
|
|
115
125
|
<octocode_results>
|
|
116
126
|
- Tool results include: `mainResearchGoal`, `researchGoal`, `reasoning` - USE THESE to understand context
|
|
117
127
|
- Results have `hints` arrays for next steps - **ALWAYS follow them**
|
|
128
|
+
- `localSearchCode` returns `lineHint` (1-indexed) - **REQUIRED for ALL LSP tools**
|
|
129
|
+
- `lspFindReferences` = ALL usages (calls, type refs, assignments)
|
|
130
|
+
- `lspCallHierarchy` = CALL relationships only (functions, use incoming/outgoing)
|
|
118
131
|
- Empty results = wrong query → try semantic variants
|
|
119
|
-
- Use `location.charOffset/charLength` for precise pagination
|
|
120
132
|
</octocode_results>
|
|
121
133
|
|
|
122
134
|
---
|
|
@@ -124,19 +136,26 @@ Check `.octocode/context/context.md` for user context. Use it to ground research
|
|
|
124
136
|
## 4. Research Flows
|
|
125
137
|
|
|
126
138
|
<research_flows>
|
|
127
|
-
**
|
|
139
|
+
**Golden Rule**: Text narrows → Symbols identify → Graphs explain. Never jump to LSP without lexical filtering first.
|
|
140
|
+
|
|
141
|
+
> 🌐 **Need external context?** Use the `octocode-research` skill for GitHub repos, dependency source code, package internals, or PR history!
|
|
142
|
+
|
|
143
|
+
**The LSP Flow** (CRITICAL):
|
|
144
|
+
```
|
|
145
|
+
localSearchCode (get lineHint) → lspGotoDefinition → lspFindReferences/lspCallHierarchy → localGetFileContent (LAST)
|
|
146
|
+
```
|
|
128
147
|
|
|
129
148
|
**Starting Points**:
|
|
130
149
|
| Need | Tool | Example |
|
|
131
150
|
|------|------|---------|
|
|
132
151
|
| Unknown structure | `localViewStructure` | Map layout (depth=1) |
|
|
133
|
-
| Pattern/Symbol | `localSearchCode` | `filesOnly=true` for discovery |
|
|
152
|
+
| Pattern/Symbol | `localSearchCode` | `filesOnly=true` for discovery, provides `lineHint` |
|
|
134
153
|
| Files by metadata | `localFindFiles` | Recent changes, large files |
|
|
135
|
-
| Specific content | `localGetFileContent` | `matchString` for targeting |
|
|
154
|
+
| Specific content | `localGetFileContent` | `matchString` for targeting (use LAST) |
|
|
136
155
|
| Dependency internals | `localSearchCode` | `noIgnore=true` for node_modules |
|
|
137
|
-
| Symbol definition | `lspGotoDefinition` |
|
|
138
|
-
| All usages | `lspFindReferences` |
|
|
139
|
-
| Call flow | `lspCallHierarchy` |
|
|
156
|
+
| Symbol definition | `lspGotoDefinition` | Requires `lineHint` from localSearchCode |
|
|
157
|
+
| All usages | `lspFindReferences` | Requires `lineHint` - ALL refs (calls, types, assigns) |
|
|
158
|
+
| Call flow | `lspCallHierarchy` | Requires `lineHint` - CALL relationships only |
|
|
140
159
|
|
|
141
160
|
**Transition Matrix**:
|
|
142
161
|
| From Tool | Need... | Go To Tool |
|
|
@@ -144,33 +163,36 @@ Check `.octocode/context/context.md` for user context. Use it to ground research
|
|
|
144
163
|
| `localViewStructure` | Find Pattern | `localSearchCode` |
|
|
145
164
|
| `localViewStructure` | Drill Deeper | `localViewStructure` (depth=2) |
|
|
146
165
|
| `localViewStructure` | File Content | `localGetFileContent` |
|
|
147
|
-
| `localSearchCode` |
|
|
148
|
-
| `localSearchCode` |
|
|
166
|
+
| `localSearchCode` | Locate Definition | `lspGotoDefinition` (use lineHint from result) |
|
|
167
|
+
| `localSearchCode` | All Usages | `lspFindReferences` (use lineHint) |
|
|
168
|
+
| `localSearchCode` | Call Flow | `lspCallHierarchy` (use lineHint) |
|
|
149
169
|
| `localSearchCode` | More Patterns | `localSearchCode` (refine) |
|
|
150
170
|
| `localSearchCode` | Empty Results | `localFindFiles` or `localViewStructure` |
|
|
151
171
|
| `localFindFiles` | Search Content | `localSearchCode` on returned paths |
|
|
152
172
|
| `localFindFiles` | Read File | `localGetFileContent` |
|
|
173
|
+
| `lspGotoDefinition` | All Usages | `lspFindReferences` |
|
|
174
|
+
| `lspGotoDefinition` | Call Graph | `lspCallHierarchy` (functions only) |
|
|
175
|
+
| `lspGotoDefinition` | Read Definition | `localGetFileContent` (LAST) |
|
|
176
|
+
| `lspFindReferences` | Call Flow | `lspCallHierarchy` (for functions) |
|
|
177
|
+
| `lspFindReferences` | Read Usage | `localGetFileContent` (LAST) |
|
|
178
|
+
| `lspCallHierarchy` | Deeper Trace | `lspCallHierarchy` on caller/callee |
|
|
179
|
+
| `lspCallHierarchy` | Read Caller | `localGetFileContent` (LAST) |
|
|
153
180
|
| `localGetFileContent` | More Context | `localGetFileContent` (widen `charLength`) |
|
|
154
|
-
| `localGetFileContent` |
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
| `lspGotoDefinition` | Read Definition | `localGetFileContent` |
|
|
159
|
-
| `lspFindReferences` | Call Graph | `lspCallHierarchy` |
|
|
160
|
-
| `lspFindReferences` | Read Usage | `localGetFileContent` |
|
|
161
|
-
| `lspCallHierarchy` | Deeper Trace | `lspCallHierarchy` (depth=2) |
|
|
162
|
-
| `lspCallHierarchy` | Read Caller | `localGetFileContent` |
|
|
181
|
+
| `localGetFileContent` | New Pattern | `localSearchCode` (restart) |
|
|
182
|
+
| **Any Local Tool** | External Repo | **`octocode-research` skill** (GitHub) |
|
|
183
|
+
| **Any Local Tool** | Package Source | **`octocode-research` skill** (packageSearch) |
|
|
184
|
+
| **Any Local Tool** | PR History | **`octocode-research` skill** (githubSearchPullRequests) |
|
|
163
185
|
</research_flows>
|
|
164
186
|
|
|
165
187
|
<structural_code_vision>
|
|
166
188
|
**Think Like a Parser (AST Mode)**:
|
|
167
189
|
- **See the Tree**: Visualize AST. Root (Entry) → Nodes (Funcs/Classes) → Edges (Imports/Calls)
|
|
168
|
-
- **
|
|
169
|
-
- **
|
|
170
|
-
- **
|
|
171
|
-
- **
|
|
190
|
+
- **Probe First**: `localSearchCode` gets lineHint → REQUIRED before ANY LSP tool
|
|
191
|
+
- **Trace Dependencies**: `import {X} from 'Y'` → `lspGotoDefinition(lineHint)` to GO TO 'Y'
|
|
192
|
+
- **Find Impact**: `lspFindReferences(lineHint)` → ALL usages (calls, types, assignments)
|
|
193
|
+
- **Understand Call Flow**: `lspCallHierarchy(lineHint)` → CALL relationships only (functions)
|
|
194
|
+
- **Read Content LAST**: `localGetFileContent` only after LSP analysis complete
|
|
172
195
|
- **Follow the Flow**: Entry → Propagation → Termination
|
|
173
|
-
- **Ignore Noise**: Focus on semantic nodes driving logic (public functions, handlers, services)
|
|
174
196
|
</structural_code_vision>
|
|
175
197
|
|
|
176
198
|
<context_awareness>
|
|
@@ -254,9 +276,9 @@ Iterate with Thought → Action → Observation:
|
|
|
254
276
|
**Pitfall**: Reading full files → prefer `matchString` + small context
|
|
255
277
|
|
|
256
278
|
### Pattern 3: Trace-from-Match (Follow the Trail)
|
|
257
|
-
**Use when**: Found definition, need impact graph
|
|
258
|
-
**Flow**:
|
|
259
|
-
**Pitfall**: Unlimited fan-out → cap depth
|
|
279
|
+
**Use when**: Found definition, need impact graph or call flow
|
|
280
|
+
**Flow**: `localSearchCode(symbol)` → `lspGotoDefinition(lineHint)` → `lspCallHierarchy(incoming/outgoing)` or `lspFindReferences` → chain
|
|
281
|
+
**Pitfall**: Skipping localSearchCode (need lineHint for LSP) | Unlimited fan-out → cap depth
|
|
260
282
|
|
|
261
283
|
### Pattern 4: Metadata Sweep (Recent/Large/Suspicious)
|
|
262
284
|
**Use when**: Chasing regressions, reviewing recent areas
|
|
@@ -296,26 +318,35 @@ Iterate with Thought → Action → Observation:
|
|
|
296
318
|
<multi_agent>
|
|
297
319
|
> **Note**: Only applicable if parallel agents are supported by host environment.
|
|
298
320
|
|
|
299
|
-
**When to Spawn
|
|
321
|
+
**When to Spawn Subagents**:
|
|
300
322
|
- 2+ independent hypotheses (no shared dependencies)
|
|
301
323
|
- Distinct subsystems (auth vs. payments vs. notifications)
|
|
302
324
|
- Separate packages in monorepo
|
|
325
|
+
- Multiple unrelated search domains
|
|
303
326
|
|
|
304
327
|
**How to Parallelize**:
|
|
305
|
-
1.
|
|
306
|
-
2. Use `Task` tool with specific hypothesis/domain
|
|
307
|
-
3. Each agent researches independently
|
|
328
|
+
1. Use `TodoWrite` to create tasks and identify parallelizable research
|
|
329
|
+
2. Use `Task` tool to spawn subagents with specific hypothesis/domain
|
|
330
|
+
3. Each agent researches independently using local tools
|
|
308
331
|
4. Merge findings after all agents complete
|
|
309
332
|
|
|
310
333
|
**Example**:
|
|
311
334
|
- Goal: "How does the app handle authentication and data fetching?"
|
|
312
|
-
- Agent 1: Research auth flow (`src/auth/`, hooks, guards)
|
|
313
|
-
- Agent 2: Research data flow (`src/api/`, fetchers, cache)
|
|
335
|
+
- Agent 1: Research auth flow (`src/auth/`, hooks, guards) using `localSearchCode` → `lspCallHierarchy`
|
|
336
|
+
- Agent 2: Research data flow (`src/api/`, fetchers, cache) using `localSearchCode` → `lspFindReferences`
|
|
314
337
|
- Merge: Combine into unified flow documentation
|
|
315
338
|
|
|
339
|
+
**Smart Parallelization Tips**:
|
|
340
|
+
- Use `TodoWrite` to track research tasks per agent
|
|
341
|
+
- Parallelize broad discovery phases (Pattern 1: Explore-First)
|
|
342
|
+
- Each agent should use the full LSP flow independently: `localSearchCode` → LSP tools → `localGetFileContent`
|
|
343
|
+
- Define clear boundaries: each agent owns specific directories/domains
|
|
344
|
+
- Merge results by cross-referencing findings
|
|
345
|
+
|
|
316
346
|
**Anti-patterns**:
|
|
317
347
|
- Don't parallelize when hypotheses depend on each other's results
|
|
318
348
|
- Don't spawn agents for simple single-directory research
|
|
349
|
+
- Don't parallelize sequential trace flows (where output of one is input to another)
|
|
319
350
|
</multi_agent>
|
|
320
351
|
|
|
321
352
|
---
|
|
@@ -392,8 +423,8 @@ If you catch yourself thinking these, **STOP**:
|
|
|
392
423
|
|
|
393
424
|
- "I assume it works like..." → **Find evidence**
|
|
394
425
|
- "It's probably in `src/utils`..." → **Search first**
|
|
395
|
-
- "
|
|
396
|
-
- "I'll
|
|
426
|
+
- "I'll call lspGotoDefinition directly..." → **localSearchCode FIRST for lineHint**
|
|
427
|
+
- "I'll read the file to understand..." → **LSP tools first, read content LAST**
|
|
397
428
|
- "I'll just use grep..." → **Use localSearchCode instead**
|
|
398
429
|
|
|
399
430
|
---
|
|
@@ -403,10 +434,10 @@ If you catch yourself thinking these, **STOP**:
|
|
|
403
434
|
Before outputting an answer:
|
|
404
435
|
|
|
405
436
|
- [ ] Answer user's goal directly
|
|
437
|
+
- [ ] Used `localSearchCode` before any LSP tool (for `lineHint`)
|
|
438
|
+
- [ ] Used `localGetFileContent` LAST (after LSP analysis)
|
|
406
439
|
- [ ] Use hints to choose next step or refine queries
|
|
407
|
-
- [ ] Keep outputs bounded (discovery, extraction, pagination)
|
|
408
440
|
- [ ] Use `matchString` or `charLength` for reading; avoid full dumps
|
|
409
|
-
- [ ] Confirm paths exist via `localViewStructure` when uncertain
|
|
410
441
|
- [ ] Include `mainResearchGoal`, `researchGoal`, `reasoning` consistently
|
|
411
442
|
- [ ] Stop and clarify if progress stalls (≥5 loops)
|
|
412
443
|
|