opencodekit 0.20.7 → 0.20.8
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/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +48 -0
- package/dist/template/.opencode/agent/build.md +3 -2
- package/dist/template/.opencode/agent/explore.md +14 -14
- package/dist/template/.opencode/agent/general.md +1 -1
- package/dist/template/.opencode/agent/plan.md +1 -1
- package/dist/template/.opencode/agent/review.md +1 -1
- package/dist/template/.opencode/agent/vision.md +0 -9
- package/dist/template/.opencode/memory.db +0 -0
- package/dist/template/.opencode/memory.db-shm +0 -0
- package/dist/template/.opencode/memory.db-wal +0 -0
- package/dist/template/.opencode/opencode.json +0 -5
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/pnpm-lock.yaml +791 -9
- package/dist/template/.opencode/skill/api-and-interface-design/SKILL.md +162 -0
- package/dist/template/.opencode/skill/beads/SKILL.md +10 -9
- package/dist/template/.opencode/skill/beads/references/MULTI_AGENT.md +10 -10
- package/dist/template/.opencode/skill/ci-cd-and-automation/SKILL.md +202 -0
- package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +253 -0
- package/dist/template/.opencode/skill/code-simplification/SKILL.md +211 -0
- package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +12 -0
- package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +16 -6
- package/dist/template/.opencode/skill/deprecation-and-migration/SKILL.md +189 -0
- package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +12 -48
- package/dist/template/.opencode/skill/documentation-and-adrs/SKILL.md +220 -0
- package/dist/template/.opencode/skill/incremental-implementation/SKILL.md +191 -0
- package/dist/template/.opencode/skill/performance-optimization/SKILL.md +236 -0
- package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +11 -0
- package/dist/template/.opencode/skill/security-and-hardening/SKILL.md +296 -0
- package/dist/template/.opencode/skill/structured-edit/SKILL.md +10 -0
- package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +66 -1
- package/package.json +1 -1
- package/dist/template/.opencode/skill/beads-bridge/SKILL.md +0 -321
- package/dist/template/.opencode/skill/code-navigation/SKILL.md +0 -130
- package/dist/template/.opencode/skill/mqdh/SKILL.md +0 -171
- package/dist/template/.opencode/skill/obsidian/SKILL.md +0 -192
- package/dist/template/.opencode/skill/obsidian/mcp.json +0 -22
- package/dist/template/.opencode/skill/pencil/SKILL.md +0 -72
- package/dist/template/.opencode/skill/ralph/SKILL.md +0 -296
- package/dist/template/.opencode/skill/tilth-cli/SKILL.md +0 -207
- package/dist/template/.opencode/skill/tool-priority/SKILL.md +0 -299
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tilth-cli
|
|
3
|
-
description: AST-aware code navigation via tilth CLI. Use when subagents need structural code search, smart file reading, or codebase mapping — complements MCP tilth (which only the main agent can access).
|
|
4
|
-
version: 2.0.0
|
|
5
|
-
tags: [code-navigation, search, subagent]
|
|
6
|
-
dependencies: []
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# tilth CLI for Subagents
|
|
10
|
-
|
|
11
|
-
> **Why this exists:** tilth MCP tools (`tilth_tilth_search`, `tilth_tilth_read`, etc.) are only available to the main agent. Subagents cannot access MCP tools but CAN use Bash. This skill teaches subagents to call tilth directly from the command line.
|
|
12
|
-
|
|
13
|
-
## When to Use
|
|
14
|
-
|
|
15
|
-
- When subagents need structural code search (they cannot access tilth MCP tools)
|
|
16
|
-
- When you need `--map` for codebase skeleton (CLI-only feature, not in MCP)
|
|
17
|
-
- For any agent that has Bash access but not tilth MCP
|
|
18
|
-
|
|
19
|
-
## When NOT to Use
|
|
20
|
-
|
|
21
|
-
- Main agent should prefer tilth MCP tools — they have session dedup and hash-anchored editing
|
|
22
|
-
- For trivial lookups where grep/read suffices
|
|
23
|
-
|
|
24
|
-
## Prerequisites
|
|
25
|
-
|
|
26
|
-
tilth must be available. Use `npx -y tilth` if not globally installed:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npx -y tilth <query> [options]
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## How tilth CLI Works
|
|
33
|
-
|
|
34
|
-
tilth has **one command** with **smart auto-detection**. Pass a query and it figures out what to do:
|
|
35
|
-
|
|
36
|
-
| Query Pattern | Detection | Action |
|
|
37
|
-
| ------------- | -------------------------------- | ------------------------------------------------------- |
|
|
38
|
-
| `src/auth.ts` | File path (exists on disk) | **Read file** — smart outline for large, full for small |
|
|
39
|
-
| `handleAuth` | Symbol name (camelCase, etc.) | **Symbol search** — AST definitions + usages |
|
|
40
|
-
| `"*.test.ts"` | Glob pattern (contains `*`, `?`) | **File listing** — matched paths with token estimates |
|
|
41
|
-
| `"TODO fix"` | Text (doesn't match above) | **Text search** — literal content matches |
|
|
42
|
-
|
|
43
|
-
## Core Operations
|
|
44
|
-
|
|
45
|
-
### 1. Read a File
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npx -y tilth src/index.ts # Smart view (outline if large, full if small)
|
|
49
|
-
npx -y tilth src/index.ts --full # Force full content
|
|
50
|
-
npx -y tilth src/index.ts --section 45-89 # Exact line range
|
|
51
|
-
npx -y tilth src/index.ts --section "## Config" # By heading
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Output: numbered lines (`N content`). Large files get a structural outline; use `--section` to drill into specific ranges.
|
|
55
|
-
|
|
56
|
-
### 2. Search for Symbols
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npx -y tilth initCommand --scope src/ # Find definition + all usages
|
|
60
|
-
npx -y tilth handleAuth --scope src/auth/ # Scoped to subdirectory
|
|
61
|
-
npx -y tilth "sym1,sym2" --scope src/ # Multi-symbol search (max 5)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Returns: definitions first (with expanded source), then usages with context lines.
|
|
65
|
-
|
|
66
|
-
### 3. Search for Text / Regex
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
npx -y tilth "TODO" --scope src/ # Literal text search
|
|
70
|
-
npx -y tilth "version" --scope src/ # Finds all occurrences
|
|
71
|
-
npx -y tilth --kind content "config" --scope src/ # Explicit content search
|
|
72
|
-
npx -y tilth --kind regex "/TODO.*fix/" --scope src/ # Regex search
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
tilth auto-detects text vs symbol. Identifiers (camelCase, snake_case) → symbol search. Multi-word or quoted strings → text search. Use `--kind` to force a specific search mode.
|
|
76
|
-
|
|
77
|
-
### 4. Find Callers
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
npx -y tilth --kind callers initCommand --scope src/ # Find all call sites
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Uses SIMD-accelerated pre-filtering + tree-sitter AST parsing. More accurate than text grep for finding actual function calls vs. comments/strings.
|
|
84
|
-
|
|
85
|
-
### 5. List Files (Glob)
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npx -y tilth "*.test.ts" --scope src/ # List test files
|
|
89
|
-
npx -y tilth "*.ts" --scope src/commands/ # List TS files in subdir
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Returns: matched file paths with token size estimates.
|
|
93
|
-
|
|
94
|
-
### 6. Blast-Radius Analysis (Deps)
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
npx -y tilth --deps src/utils/errors.ts # What imports this file + what it imports
|
|
98
|
-
npx -y tilth --deps src/commands/init.ts --scope src/ # Scoped dependency check
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Shows imports (local + external) AND what other files call its exports, with symbol-level detail. Use before renaming/removing exports.
|
|
102
|
-
|
|
103
|
-
### 7. Codebase Map (CLI-Only)
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
npx -y tilth --map --scope src/ # Structural skeleton
|
|
107
|
-
npx -y tilth --map --scope . # Whole project
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Returns: directory tree with exported symbols per file. **CLI-only** — deliberately excluded from MCP (agents overuse it).
|
|
111
|
-
|
|
112
|
-
## Available Flags
|
|
113
|
-
|
|
114
|
-
| Flag | Purpose | Example |
|
|
115
|
-
| ------------------- | ---------------------------------------- | --------------------------- |
|
|
116
|
-
| `--scope <DIR>` | Restrict search to directory | `--scope src/` |
|
|
117
|
-
| `--section <RANGE>` | Line range or heading for file reads | `--section 45-89` |
|
|
118
|
-
| `--full` | Force full file content (skip outline) | `--full` |
|
|
119
|
-
| `--budget <N>` | Max tokens in response | `--budget 2000` |
|
|
120
|
-
| `--json` | Machine-readable JSON output | `--json` |
|
|
121
|
-
| `--map` | Generate codebase structure map | `--map --scope src/` |
|
|
122
|
-
| `--kind <TYPE>` | Force search type: symbol/content/regex/callers | `--kind callers` |
|
|
123
|
-
| `--deps` | Show blast-radius (imports + dependents) | `--deps src/file.ts` |
|
|
124
|
-
| `--expand <N>` | Top N matches to show full source | `--expand 3` |
|
|
125
|
-
|
|
126
|
-
## MCP vs CLI Comparison
|
|
127
|
-
|
|
128
|
-
| Feature | MCP (main agent) | CLI (all agents) |
|
|
129
|
-
| ------------------------------------- | ---------------- | ------------------- |
|
|
130
|
-
| Session dedup (`[shown earlier]`) | Yes | No |
|
|
131
|
-
| Hash-anchored editing (`tilth_edit`) | Yes | No |
|
|
132
|
-
| Blast-radius analysis (`--deps`) | Yes | Yes (v0.5.7+) |
|
|
133
|
-
| Multi-symbol search (`sym1,sym2`) | Yes | Yes (v0.5.7+) |
|
|
134
|
-
| `--kind` flag (content/regex/callers) | Yes | Yes (v0.5.7+) |
|
|
135
|
-
| `--expand` control | Yes | Yes (v0.5.7+) |
|
|
136
|
-
| `--map` codebase skeleton | No | Yes |
|
|
137
|
-
| Subagent access | No (main only) | Yes (any with Bash) |
|
|
138
|
-
| Process overhead | Once (~17ms) | Per call (~17ms) |
|
|
139
|
-
|
|
140
|
-
## Output Format Examples
|
|
141
|
-
|
|
142
|
-
### File read (small file)
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
# src/config.ts (45 lines, ~380 tokens) [full]
|
|
146
|
-
|
|
147
|
-
1 import { z } from 'zod';
|
|
148
|
-
2 export const schema = z.object({
|
|
149
|
-
...
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Symbol search
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
# Search: "initCommand" in src/ — 6 matches (2 definitions, 4 usages)
|
|
156
|
-
|
|
157
|
-
### Definitions (2)
|
|
158
|
-
## commands/init.ts:515-961 [definition]
|
|
159
|
-
→ [515-961] export async function initCommand(...)
|
|
160
|
-
|
|
161
|
-
### Usages — same package (4)
|
|
162
|
-
## index.ts:10 [usage]
|
|
163
|
-
→ [10] import { initCommand } from "./commands/init.js";
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Codebase map
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
# Map: src/ (depth 3)
|
|
170
|
-
index.ts (~1214 tokens)
|
|
171
|
-
commands/
|
|
172
|
-
init.ts: initCommand, detectMode, ...
|
|
173
|
-
upgrade.ts: checkVersion, upgradeCommand, ...
|
|
174
|
-
utils/
|
|
175
|
-
errors.ts: resolveOpencodePath, showError, ...
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## Usage Tips
|
|
179
|
-
|
|
180
|
-
- **Search first, read second** — symbol search finds definitions AND shows expanded source
|
|
181
|
-
- **Use `--section` for large files** — outline tells you line ranges; drill in with `--section 44-89`
|
|
182
|
-
- **Use `--scope`** to narrow searches — avoids scanning irrelevant directories
|
|
183
|
-
- **Use `--budget`** when you need concise output (limits token count)
|
|
184
|
-
- **~17ms per call** — fast enough for interactive use, but avoid unnecessary repeated calls
|
|
185
|
-
- **Use `--kind callers`** for precise call-site analysis instead of text grep
|
|
186
|
-
- **Use `--deps`** before renaming or removing exports to check blast radius
|
|
187
|
-
|
|
188
|
-
## Example Subagent Dispatch
|
|
189
|
-
|
|
190
|
-
```typescript
|
|
191
|
-
task({
|
|
192
|
-
subagent_type: "general",
|
|
193
|
-
prompt: `Use tilth CLI for code navigation (run via: npx -y tilth).
|
|
194
|
-
|
|
195
|
-
Find the definition of \`initCommand\` and understand how it's called:
|
|
196
|
-
npx -y tilth initCommand --scope src/
|
|
197
|
-
npx -y tilth --kind callers initCommand --scope src/
|
|
198
|
-
|
|
199
|
-
Check blast radius before editing:
|
|
200
|
-
npx -y tilth --deps src/commands/init.ts
|
|
201
|
-
|
|
202
|
-
Then read the relevant file section:
|
|
203
|
-
npx -y tilth src/commands/init.ts --section 515-600
|
|
204
|
-
|
|
205
|
-
[rest of task instructions]`,
|
|
206
|
-
});
|
|
207
|
-
```
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tool-priority
|
|
3
|
-
description: Use when choosing between tools or need tool reference - covers LSP, search, swarm, memory, and research tools with correct syntax
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
tags: [workflow, context]
|
|
6
|
-
dependencies: []
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Tool Priority Skill
|
|
10
|
-
|
|
11
|
-
## When to Use
|
|
12
|
-
|
|
13
|
-
- You need to decide which tool to use for a task or recall tool syntax
|
|
14
|
-
- You are about to edit code and want the correct discovery/order of operations
|
|
15
|
-
|
|
16
|
-
## When NOT to Use
|
|
17
|
-
|
|
18
|
-
- You already know the exact tool and syntax required
|
|
19
|
-
- The task is purely conceptual with no tool usage
|
|
20
|
-
|
|
21
|
-
## Priority Order
|
|
22
|
-
|
|
23
|
-
**LSP → Search → Swarm → Memory → File Operations**
|
|
24
|
-
|
|
25
|
-
1. **LSP** - Semantic code intelligence (9 operations via unified tool)
|
|
26
|
-
2. **tilth** (MCP) - AST-aware code search + smart file reading. Replaces grep/glob/read for code navigation when available
|
|
27
|
-
3. **grep** - Fast text search (logs, config, code patterns). Replaces bash rg/grep
|
|
28
|
-
4. **glob** - File discovery by name pattern. Replaces bash find/ls
|
|
29
|
-
5. **skill** - Load skills for specialized knowledge
|
|
30
|
-
6. **task** - Parallel subagent execution
|
|
31
|
-
7. **Swarm tool** - swarm (plan, monitor, delegate, sync operations)
|
|
32
|
-
8. **Memory tools** - memory-search, memory-read, memory-update, memory-admin
|
|
33
|
-
9. **Research tools** - context7, websearch, codesearch, grepsearch
|
|
34
|
-
10. **read/edit/write** - File operations (always read before edit)
|
|
35
|
-
|
|
36
|
-
**Golden Rule**: Always `read` before `edit` to verify content.
|
|
37
|
-
|
|
38
|
-
## Choosing the Right Tool
|
|
39
|
-
|
|
40
|
-
Ask: **"Am I looking for semantic understanding or just text?"**
|
|
41
|
-
|
|
42
|
-
### Code Understanding (Use LSP)
|
|
43
|
-
|
|
44
|
-
The `lsp` tool provides 9 operations via a unified interface:
|
|
45
|
-
|
|
46
|
-
| Need | Operation | Example |
|
|
47
|
-
| -------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
48
|
-
| Type info at cursor | `hover` | `lsp({ operation: "hover", filePath: "src/file.ts", line: 42, character: 10 })` |
|
|
49
|
-
| Jump to definition | `goToDefinition` | `lsp({ operation: "goToDefinition", filePath: "src/file.ts", line: 42, character: 10 })` |
|
|
50
|
-
| Find all usages | `findReferences` | `lsp({ operation: "findReferences", filePath: "src/file.ts", line: 42, character: 10 })` |
|
|
51
|
-
| File structure | `documentSymbol` | `lsp({ operation: "documentSymbol", filePath: "src/file.ts", line: 1, character: 1 })` |
|
|
52
|
-
| Workspace search | `workspaceSymbol` | `lsp({ operation: "workspaceSymbol", filePath: "src/file.ts", line: 1, character: 1, query: "UserService" })` |
|
|
53
|
-
| Find implementations | `goToImplementation` | `lsp({ operation: "goToImplementation", filePath: "src/file.ts", line: 42, character: 10 })` |
|
|
54
|
-
| Call hierarchy | `prepareCallHierarchy` | `lsp({ operation: "prepareCallHierarchy", filePath: "src/file.ts", line: 42, character: 10 })` |
|
|
55
|
-
| Incoming calls | `incomingCalls` | `lsp({ operation: "incomingCalls", filePath: "src/file.ts", line: 42, character: 10 })` |
|
|
56
|
-
| Outgoing calls | `outgoingCalls` | `lsp({ operation: "outgoingCalls", filePath: "src/file.ts", line: 42, character: 10 })` |
|
|
57
|
-
|
|
58
|
-
**Critical**: Run ALL 9 LSP operations before editing. See AGENTS.md for the full checklist.
|
|
59
|
-
|
|
60
|
-
### Text Search (Use grep)
|
|
61
|
-
|
|
62
|
-
| Need | Pattern | Example |
|
|
63
|
-
| ----------------- | ---------------- | ------------------------------------------ |
|
|
64
|
-
| Function calls | `functionName\(` | `grep({ pattern: "fetchUser\(" })` |
|
|
65
|
-
| Import statements | `import.*from` | `grep({ pattern: "import.*from.*react" })` |
|
|
66
|
-
| Error messages | `FATAL\|ERROR` | `grep({ pattern: "ERROR\|FATAL" })` |
|
|
67
|
-
| TODO comments | `TODO\|FIXME` | `grep({ pattern: "TODO\|FIXME" })` |
|
|
68
|
-
| Hook usage | `useState\(` | `grep({ pattern: "useState\(" })` |
|
|
69
|
-
| Debug logs | `console\.log` | `grep({ pattern: "console\.log" })` |
|
|
70
|
-
|
|
71
|
-
### Load Skills (Use skill tool)
|
|
72
|
-
|
|
73
|
-
Load specialized knowledge before starting work:
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
// Essential skills for most work
|
|
77
|
-
skill({ name: "verification-before-completion" });
|
|
78
|
-
skill({ name: "test-driven-development" });
|
|
79
|
-
|
|
80
|
-
// Domain-specific skills
|
|
81
|
-
skill({ name: "beads" }); // Task tracking
|
|
82
|
-
skill({ name: "beads-bridge" }); // Swarm coordination
|
|
83
|
-
skill({ name: "swarm-coordination" }); // Parallel execution
|
|
84
|
-
skill({ name: "frontend-design" }); // UI implementation
|
|
85
|
-
skill({ name: "prd" }); // Requirements documents
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Parallel Execution (Use Task tool)
|
|
89
|
-
|
|
90
|
-
Launch multiple subagents simultaneously:
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
// Workers run in parallel when multiple Task calls in one message
|
|
94
|
-
Task({
|
|
95
|
-
subagent_type: "explore",
|
|
96
|
-
description: "Find patterns",
|
|
97
|
-
prompt: `Find auth patterns in codebase...`,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
Task({
|
|
101
|
-
subagent_type: "scout",
|
|
102
|
-
description: "Research docs",
|
|
103
|
-
prompt: `Research best practices for...`,
|
|
104
|
-
});
|
|
105
|
-
// Results return when both complete
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Subagent types**: `general`, `explore`, `scout`, `review`, `plan`
|
|
109
|
-
|
|
110
|
-
### Swarm Coordination Tools
|
|
111
|
-
|
|
112
|
-
| Tool | Purpose | Key Operations |
|
|
113
|
-
| --------- | -------------------------- | ------------------------------------- |
|
|
114
|
-
| **swarm** | Unified swarm coordination | `plan`, `monitor`, `delegate`, `sync` |
|
|
115
|
-
|
|
116
|
-
**swarm operations:**
|
|
117
|
-
|
|
118
|
-
- `plan`: Task analysis (actions: analyze, classify, check, allocate)
|
|
119
|
-
- `monitor`: Progress tracking (actions: progress_update, render_block, status, clear)
|
|
120
|
-
- `delegate`: Create delegation packets for workers
|
|
121
|
-
- `sync`: Beads ↔ OpenCode sync (actions: push, pull, create_shared, update_shared)
|
|
122
|
-
|
|
123
|
-
### Memory Tools
|
|
124
|
-
|
|
125
|
-
| Tool | Purpose | When to Use |
|
|
126
|
-
| ----------------- | ------------------------- | ----------------------------------- |
|
|
127
|
-
| **memory-search** | Find past learnings | "Have we solved this before?" |
|
|
128
|
-
| **memory-read** | Load specific memory file | "What did we decide about X?" |
|
|
129
|
-
| **memory-update** | Save context | "Document this for future sessions" |
|
|
130
|
-
| **observation** | Record decisions/patterns | "This is worth remembering" |
|
|
131
|
-
|
|
132
|
-
### Research Tools
|
|
133
|
-
|
|
134
|
-
| Tool | Purpose | When to Use |
|
|
135
|
-
| ----------------- | --------------------------------------------------------------- | ----------------------- |
|
|
136
|
-
| **context7** | Library documentation lookup. Replaces manual doc searching | API reference, examples |
|
|
137
|
-
| **websearch** | Web search. Replaces browser for current info | Docs not in Context7 |
|
|
138
|
-
| **codesearch** | Code examples from GitHub. Replaces manual GitHub search | Real-world patterns |
|
|
139
|
-
| **grepsearch** | Cross-repo code patterns. Replaces browsing GitHub for examples | grep.app search |
|
|
140
|
-
| **webfetch** | Fetch specific URL content. Replaces curl/browser | User-provided links |
|
|
141
|
-
| **review (Task)** | Second opinion | Validate approach |
|
|
142
|
-
|
|
143
|
-
**context7 operations:**
|
|
144
|
-
|
|
145
|
-
- `resolve`: Find library ID from name (e.g., "react" → "/reactjs/react.dev")
|
|
146
|
-
- `query`: Get documentation for a library topic
|
|
147
|
-
|
|
148
|
-
### With tilth MCP (When Available)
|
|
149
|
-
|
|
150
|
-
tilth provides AST-aware code intelligence. When installed, prefer tilth tools over built-in equivalents:
|
|
151
|
-
|
|
152
|
-
| Need | Without tilth | With tilth | Why tilth wins |
|
|
153
|
-
| --------------- | -------------------- | ------------------------------- | ------------------------------------------------------- |
|
|
154
|
-
| Find symbol | `grep` + `read` | `tilth_search` (expand: 2) | Returns definitions with inline source — no second read |
|
|
155
|
-
| Read large file | `read` (full) | `tilth_read` | Auto-outlines, shows structure; section drill-down |
|
|
156
|
-
| Find files | `glob` | `tilth_files` | Adds token estimates per file |
|
|
157
|
-
| Find callers | `lsp(incomingCalls)` | `tilth_search(kind: "callers")` | Cross-language, structural matching |
|
|
158
|
-
| Blast radius | Manual tracing | `tilth_deps` | Shows imports + downstream callers automatically |
|
|
159
|
-
|
|
160
|
-
**WHEN to use tilth_deps**: Before renaming, removing, or changing the signature of an export.
|
|
161
|
-
**SKIP**: When adding new code, fixing internal bugs, or just reading.
|
|
162
|
-
|
|
163
|
-
**IMPORTANT**: Expanded tilth_search results include full source code — do NOT re-read files already shown in search output.
|
|
164
|
-
|
|
165
|
-
## Workflow Pattern
|
|
166
|
-
|
|
167
|
-
```typescript
|
|
168
|
-
// Step 1: Load skills
|
|
169
|
-
skill({ name: "verification-before-completion" });
|
|
170
|
-
skill({ name: "beads" });
|
|
171
|
-
|
|
172
|
-
// Step 2: Find it (text search)
|
|
173
|
-
grep({ pattern: "functionName", path: "src/" });
|
|
174
|
-
|
|
175
|
-
// Step 3: Understand it (LSP - ALL 9 operations)
|
|
176
|
-
lsp({ operation: "documentSymbol", filePath: "src/file.ts", line: 1, character: 1 });
|
|
177
|
-
lsp({ operation: "goToDefinition", filePath: "src/file.ts", line: 42, character: 10 });
|
|
178
|
-
lsp({ operation: "findReferences", filePath: "src/file.ts", line: 42, character: 10 });
|
|
179
|
-
lsp({ operation: "hover", filePath: "src/file.ts", line: 42, character: 10 });
|
|
180
|
-
// ... remaining 5 operations
|
|
181
|
-
|
|
182
|
-
// Step 4: Check memory
|
|
183
|
-
memory_search({ query: "auth patterns" });
|
|
184
|
-
|
|
185
|
-
// Step 5: Read before edit
|
|
186
|
-
read({ filePath: "/absolute/path/to/file.ts" });
|
|
187
|
-
|
|
188
|
-
// Step 6: Modify
|
|
189
|
-
edit({ filePath: "/absolute/path/to/file.ts", oldString: "...", newString: "..." });
|
|
190
|
-
|
|
191
|
-
// Step 7: Verify
|
|
192
|
-
bash({ command: "npm run typecheck && npm run lint" });
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## Tool Comparison
|
|
196
|
-
|
|
197
|
-
### grep vs LSP
|
|
198
|
-
|
|
199
|
-
| Scenario | Use | Why |
|
|
200
|
-
| ------------------ | --------------------------- | ------------------------------------------- |
|
|
201
|
-
| "Find all X" | `grep` | Fast text search, includes comments/strings |
|
|
202
|
-
| "Where is X used?" | `lsp` with `findReferences` | Semantic, tracks actual code dependencies |
|
|
203
|
-
| "What type is X?" | `lsp` with `hover` | Type system intelligence |
|
|
204
|
-
| "Find TODOs" | `grep` | Text search across all files |
|
|
205
|
-
|
|
206
|
-
### When to Use What
|
|
207
|
-
|
|
208
|
-
**Start with LSP when:**
|
|
209
|
-
|
|
210
|
-
- Understanding code structure
|
|
211
|
-
- Before any edit (ALL 9 operations)
|
|
212
|
-
- Tracing dependencies
|
|
213
|
-
- Getting type information
|
|
214
|
-
|
|
215
|
-
**Start with grep when:**
|
|
216
|
-
|
|
217
|
-
- Quick exploration ("are there any X?")
|
|
218
|
-
- Finding error patterns, logs, configs
|
|
219
|
-
- Searching across file types (JSON, YAML, etc.)
|
|
220
|
-
|
|
221
|
-
**Use skill when:**
|
|
222
|
-
|
|
223
|
-
- Starting any significant work
|
|
224
|
-
- Need specialized knowledge
|
|
225
|
-
- Following established patterns
|
|
226
|
-
|
|
227
|
-
**Use Task when:**
|
|
228
|
-
|
|
229
|
-
- Multiple independent research questions
|
|
230
|
-
- Parallel implementation tasks
|
|
231
|
-
- 3+ files need simultaneous work
|
|
232
|
-
|
|
233
|
-
## Common Mistakes
|
|
234
|
-
|
|
235
|
-
❌ **Wrong**: Edit without LSP
|
|
236
|
-
|
|
237
|
-
```typescript
|
|
238
|
-
// DON'T: Edit without understanding structure
|
|
239
|
-
edit({ filePath: "src/file.ts", oldString: "...", newString: "..." });
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
✅ **Right**: LSP before edit
|
|
243
|
-
|
|
244
|
-
```typescript
|
|
245
|
-
// DO: Run all 9 LSP operations first
|
|
246
|
-
lsp({ operation: "documentSymbol", filePath: "src/file.ts", line: 1, character: 1 });
|
|
247
|
-
lsp({ operation: "goToDefinition", filePath: "src/file.ts", line: 10, character: 5 });
|
|
248
|
-
// ... 7 more operations
|
|
249
|
-
read({ filePath: "src/file.ts" });
|
|
250
|
-
edit({ filePath: "src/file.ts", oldString: "...", newString: "..." });
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
❌ **Wrong**: Old LSP syntax
|
|
254
|
-
|
|
255
|
-
```typescript
|
|
256
|
-
// DON'T: This syntax doesn't exist
|
|
257
|
-
lsp_lsp_hover((filePath = "src/file.ts"), (line = 42), (character = 10));
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
✅ **Right**: Correct LSP syntax
|
|
261
|
-
|
|
262
|
-
```typescript
|
|
263
|
-
// DO: Use operation parameter
|
|
264
|
-
lsp({ operation: "hover", filePath: "src/file.ts", line: 42, character: 10 });
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
## Quick Reference
|
|
268
|
-
|
|
269
|
-
```
|
|
270
|
-
BEFORE EDITING:
|
|
271
|
-
lsp({ operation: "documentSymbol", ... }) → File structure
|
|
272
|
-
lsp({ operation: "goToDefinition", ... }) → Where defined
|
|
273
|
-
lsp({ operation: "findReferences", ... }) → All usages
|
|
274
|
-
lsp({ operation: "hover", ... }) → Type info
|
|
275
|
-
lsp({ operation: "goToImplementation", ... }) → Implementations
|
|
276
|
-
lsp({ operation: "prepareCallHierarchy", ... }) → Call hierarchy
|
|
277
|
-
lsp({ operation: "incomingCalls", ... }) → What calls this
|
|
278
|
-
lsp({ operation: "outgoingCalls", ... }) → What this calls
|
|
279
|
-
lsp({ operation: "workspaceSymbol", ... }) → Workspace search
|
|
280
|
-
|
|
281
|
-
SEARCHING:
|
|
282
|
-
grep({ pattern: "...", path: "src/" }) → Text search
|
|
283
|
-
glob({ pattern: "**/*.ts" }) → File discovery
|
|
284
|
-
|
|
285
|
-
PARALLEL WORK:
|
|
286
|
-
Task({ subagent_type: "explore", ... }) → Parallel subagent
|
|
287
|
-
swarm({ operation: "sync", action: "push" }) → Sync to todos
|
|
288
|
-
swarm({ operation: "monitor", action: "progress_update" }) → Track progress
|
|
289
|
-
|
|
290
|
-
RESEARCH:
|
|
291
|
-
context7({ operation: "resolve", libraryName: "..." })
|
|
292
|
-
context7({ operation: "query", libraryId: "...", topic: "..." })
|
|
293
|
-
websearch({ query: "..." })
|
|
294
|
-
Task({ subagent_type: "review", description: "Second opinion", prompt: "Review the approach." })
|
|
295
|
-
|
|
296
|
-
MEMORY:
|
|
297
|
-
memory_search({ query: "..." }) → Find past learnings
|
|
298
|
-
observation({ type: "learning", ... }) → Record for future
|
|
299
|
-
```
|