code-graph-context 2.5.3 → 2.6.0
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/core/embeddings/natural-language-to-cypher.service.js +1 -1
- package/dist/mcp/constants.js +70 -557
- package/dist/mcp/tools/detect-dead-code.tool.js +0 -16
- package/dist/mcp/tools/detect-duplicate-code.tool.js +0 -27
- package/dist/mcp/tools/impact-analysis.tool.js +0 -13
- package/dist/mcp/tools/index.js +4 -15
- package/dist/mcp/tools/list-projects.tool.js +0 -2
- package/dist/mcp/tools/list-watchers.tool.js +0 -2
- package/dist/mcp/tools/natural-language-to-cypher.tool.js +0 -6
- package/dist/mcp/tools/search-codebase.tool.js +0 -19
- package/dist/mcp/tools/swarm-claim-task.tool.js +220 -93
- package/dist/mcp/tools/swarm-cleanup.tool.js +76 -32
- package/dist/mcp/tools/swarm-complete-task.tool.js +79 -88
- package/dist/mcp/tools/swarm-get-tasks.tool.js +0 -9
- package/dist/mcp/tools/swarm-orchestrate.tool.js +55 -92
- package/dist/mcp/tools/swarm-post-task.tool.js +32 -11
- package/dist/mcp/tools/traverse-from-node.tool.js +0 -15
- package/package.json +1 -1
package/dist/mcp/constants.js
CHANGED
|
@@ -48,118 +48,44 @@ export const TOOL_METADATA = {
|
|
|
48
48
|
},
|
|
49
49
|
[TOOL_NAMES.searchCodebase]: {
|
|
50
50
|
title: 'Search Codebase',
|
|
51
|
-
description: `
|
|
51
|
+
description: `Semantic search for code, functions, classes, implementations. Returns normalized JSON with source code.
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
Use list_projects to see available projects and get the project name/ID to search.
|
|
55
|
-
|
|
56
|
-
Returns normalized JSON with source code snippets. Uses JSON:API pattern to deduplicate nodes.
|
|
57
|
-
|
|
58
|
-
**Default Usage (Recommended)**:
|
|
59
|
-
Start with default parameters for richest context in a single call. Most queries complete successfully.
|
|
53
|
+
Use list_projects first to get project name/ID.
|
|
60
54
|
|
|
61
55
|
Parameters:
|
|
62
56
|
- query: Natural language description of what you're looking for
|
|
57
|
+
- maxDepth (default: 3): Relationship hops to traverse
|
|
58
|
+
- includeCode (default: true): Set false for structure only
|
|
59
|
+
- snippetLength (default: 700): Code snippet length
|
|
60
|
+
- maxNodesPerChain (default: 5): Chains per depth level
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
Use these parameters ONLY if you encounter token limit errors (>25,000 tokens):
|
|
66
|
-
|
|
67
|
-
- maxDepth (default: 3): Reduce to 1-2 for shallow exploration
|
|
68
|
-
- maxNodesPerChain (default: 5): Limit chains shown per depth level
|
|
69
|
-
- includeCode (default: true): Set false to get structure only, fetch code separately
|
|
70
|
-
- snippetLength (default: 700): Reduce to 400-600 for smaller code snippets
|
|
71
|
-
- skip (default: 0): For pagination (skip N results)
|
|
72
|
-
|
|
73
|
-
**Progressive Strategy**:
|
|
74
|
-
1. Try with defaults first
|
|
75
|
-
2. If token error: Use maxDepth=1, includeCode=false for structure
|
|
76
|
-
3. Then traverse deeper or Read specific files for full code
|
|
77
|
-
|
|
78
|
-
**Compact Mode** (for exploration without full source code):
|
|
79
|
-
- includeCode: false → Returns just names, types, and file paths
|
|
80
|
-
- snippetLength: 200 → Smaller code previews
|
|
81
|
-
- maxNodesPerChain: 2 → Fewer relationship chains per depth`,
|
|
62
|
+
If output too large: reduce maxDepth, set includeCode=false, or reduce snippetLength.`,
|
|
82
63
|
},
|
|
83
64
|
[TOOL_NAMES.naturalLanguageToCypher]: {
|
|
84
65
|
title: 'Natural Language to Cypher',
|
|
85
|
-
description: `Convert natural language
|
|
66
|
+
description: `Convert natural language to Cypher for complex queries search_codebase can't handle.
|
|
86
67
|
|
|
87
|
-
|
|
88
|
-
Use list_projects to see available projects and get the project name.
|
|
68
|
+
Use list_projects first to get project name.
|
|
89
69
|
|
|
90
|
-
**
|
|
91
|
-
- For complex queries that search_codebase can't handle
|
|
92
|
-
- When you need custom filtering or aggregation
|
|
93
|
-
- To explore specific relationship patterns
|
|
70
|
+
**Node types:** SourceFile, Class, Function, Method, Interface, Property, Parameter, Import, Export, Enum, TypeAlias
|
|
94
71
|
|
|
95
|
-
**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
**
|
|
100
|
-
- "Find all classes with more than 5 methods"
|
|
101
|
-
- "List functions that have more than 3 parameters"
|
|
102
|
-
- "Find files that import from a path containing 'utils'"
|
|
103
|
-
- "Show interfaces with 'Response' in their name"
|
|
104
|
-
- "Find all exported functions"
|
|
105
|
-
|
|
106
|
-
**Tips:**
|
|
107
|
-
- Import nodes store file paths, not module names (use 'path containing X')
|
|
108
|
-
- Node types: SourceFile, Class, Function, Method, Interface, Property, Parameter, Constructor, Import, Export, Decorator, Enum, Variable, TypeAlias
|
|
109
|
-
- Relationships: CONTAINS, IMPORTS, EXTENDS, IMPLEMENTS, HAS_MEMBER, HAS_PARAMETER, TYPED_AS, CALLS, DECORATED_WITH
|
|
110
|
-
- For NestJS, use semanticType property instead of decorators (e.g., semanticType = 'NestController')
|
|
111
|
-
|
|
112
|
-
**Relationships (Core):**
|
|
113
|
-
- CONTAINS: File/class contains members
|
|
114
|
-
- HAS_MEMBER: Class/interface has methods/properties
|
|
115
|
-
- HAS_PARAMETER: Method/function has parameters
|
|
116
|
-
- IMPORTS: SourceFile imports another
|
|
117
|
-
- EXPORTS: SourceFile exports items
|
|
118
|
-
- EXTENDS: Class/interface extends another
|
|
119
|
-
- IMPLEMENTS: Class implements interface(s)
|
|
120
|
-
- CALLS: Method/function calls another
|
|
121
|
-
- TYPED_AS: Parameter/property has type annotation
|
|
122
|
-
- DECORATED_WITH: Node has decorators
|
|
123
|
-
|
|
124
|
-
**Relationships (NestJS/Framework):**
|
|
125
|
-
- INJECTS: Service/controller injects dependency
|
|
126
|
-
- EXPOSES: Controller exposes HTTP endpoints
|
|
127
|
-
- MODULE_IMPORTS, MODULE_PROVIDES, MODULE_EXPORTS: NestJS module system
|
|
128
|
-
- GUARDED_BY, TRANSFORMED_BY, INTERCEPTED_BY: Security/middleware
|
|
129
|
-
|
|
130
|
-
**Query Phrasing:**
|
|
131
|
-
Phrase queries using properties known to exist (filePath, name) rather than abstract concepts:
|
|
132
|
-
- Use "in account folder" or "filePath contains /account/" instead of "in account module"
|
|
133
|
-
- Use "classes extending DbService" not "services that extend DbService" (Service is a decorator, not a type)
|
|
134
|
-
- Use "with name containing 'Controller'" instead of "controllers"
|
|
135
|
-
The tool performs better with concrete, schema-aligned language.`,
|
|
72
|
+
**Key relationships:** CONTAINS, HAS_MEMBER, HAS_PARAMETER, IMPORTS, EXTENDS, IMPLEMENTS, CALLS, TYPED_AS
|
|
73
|
+
|
|
74
|
+
**NestJS:** Use semanticType property (e.g., semanticType='NestController'), not decorators. Relationships: INJECTS, EXPOSES, MODULE_IMPORTS/PROVIDES/EXPORTS
|
|
75
|
+
|
|
76
|
+
**Tips:** Use concrete properties (filePath, name) not abstract concepts. Import nodes store file paths, not module names.`,
|
|
136
77
|
},
|
|
137
78
|
[TOOL_NAMES.traverseFromNode]: {
|
|
138
79
|
title: 'Traverse from Node',
|
|
139
|
-
description: `
|
|
80
|
+
description: `Explore connections from a node ID (from search_codebase results).
|
|
140
81
|
|
|
141
82
|
Parameters:
|
|
142
|
-
- nodeId (required):
|
|
143
|
-
- maxDepth (default: 3):
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
-
|
|
148
|
-
- maxNodesPerChain (default: 5): Limit chains shown per depth level (applied independently at each depth)
|
|
149
|
-
- summaryOnly: Set to true for just file paths and statistics without detailed traversal
|
|
150
|
-
|
|
151
|
-
Best practices:
|
|
152
|
-
- Use list_projects first to see available projects
|
|
153
|
-
- Start with search_codebase to find initial nodes
|
|
154
|
-
- Default includes source code snippets for immediate context
|
|
155
|
-
- Set includeCode: false for high-level architecture view only
|
|
156
|
-
- Use summaryOnly: true for a quick overview of many connections
|
|
157
|
-
|
|
158
|
-
**Compact Mode** (for exploration without full source code):
|
|
159
|
-
- summaryOnly: true → Returns only file paths and statistics
|
|
160
|
-
- includeCode: false → Structure without source code
|
|
161
|
-
- snippetLength: 200 → Smaller code previews
|
|
162
|
-
- maxTotalNodes: 20 → Limit total unique nodes returned`,
|
|
83
|
+
- nodeId (required): Starting node ID
|
|
84
|
+
- maxDepth (default: 3): Relationship hops (1-10)
|
|
85
|
+
- includeCode (default: true): Set false for structure only
|
|
86
|
+
- summaryOnly: true for file paths and stats only
|
|
87
|
+
- maxNodesPerChain (default: 5): Chains per depth level
|
|
88
|
+
- maxTotalNodes: Cap unique nodes returned`,
|
|
163
89
|
},
|
|
164
90
|
[TOOL_NAMES.parseTypescriptProject]: {
|
|
165
91
|
title: 'Parse TypeScript Project',
|
|
@@ -236,517 +162,104 @@ Use the name or path in other tools instead of the cryptic projectId.`,
|
|
|
236
162
|
},
|
|
237
163
|
[TOOL_NAMES.startWatchProject]: {
|
|
238
164
|
title: 'Start Watch Project',
|
|
239
|
-
description: `
|
|
165
|
+
description: `Watch project for .ts file changes and auto-update graph.
|
|
240
166
|
|
|
241
|
-
|
|
242
|
-
- projectPath (required): Absolute path to the project root
|
|
243
|
-
- tsconfigPath (required): Path to tsconfig.json
|
|
244
|
-
- projectId (optional): Custom project ID (auto-generated if omitted)
|
|
245
|
-
- debounceMs (optional): Delay before processing changes (default: 1000ms)
|
|
167
|
+
Parameters: projectPath (required), tsconfigPath (required), debounceMs (default: 1000ms).
|
|
246
168
|
|
|
247
|
-
|
|
248
|
-
- Watches for .ts file changes (add/change/delete)
|
|
249
|
-
- Automatically triggers incremental graph updates
|
|
250
|
-
- Sends MCP notifications for progress updates
|
|
251
|
-
- Excludes node_modules, dist, build, .git, *.d.ts, *.js
|
|
252
|
-
|
|
253
|
-
**Usage:**
|
|
254
|
-
start_watch_project({ projectPath: "/path/to/project", tsconfigPath: "/path/to/project/tsconfig.json" })
|
|
255
|
-
|
|
256
|
-
Use list_watchers to see active watchers, stop_watch_project to stop.`,
|
|
169
|
+
Auto-excludes node_modules, dist, build, .git. Use list_watchers to see active, stop_watch_project to stop.`,
|
|
257
170
|
},
|
|
258
171
|
[TOOL_NAMES.stopWatchProject]: {
|
|
259
172
|
title: 'Stop Watch Project',
|
|
260
|
-
description: `Stop watching a project
|
|
261
|
-
|
|
262
|
-
**Parameters:**
|
|
263
|
-
- projectId (required): Project ID to stop watching
|
|
264
|
-
|
|
265
|
-
**Usage:**
|
|
266
|
-
stop_watch_project({ projectId: "proj_abc123..." })
|
|
267
|
-
|
|
268
|
-
Use list_watchers to see active watchers.`,
|
|
173
|
+
description: `Stop watching a project. Requires projectId.`,
|
|
269
174
|
},
|
|
270
175
|
[TOOL_NAMES.listWatchers]: {
|
|
271
176
|
title: 'List Watchers',
|
|
272
|
-
description: `List
|
|
273
|
-
|
|
274
|
-
Returns information about each watcher:
|
|
275
|
-
- projectId: The project being watched
|
|
276
|
-
- projectPath: File system path
|
|
277
|
-
- status: active, paused, or error
|
|
278
|
-
- debounceMs: Configured debounce delay
|
|
279
|
-
- pendingChanges: Number of queued file changes
|
|
280
|
-
- lastUpdateTime: When the graph was last updated
|
|
281
|
-
- errorMessage: Error details if status is "error"
|
|
282
|
-
|
|
283
|
-
Use stop_watch_project to stop a watcher.`,
|
|
177
|
+
description: `List active file watchers with status, pending changes, last update time.`,
|
|
284
178
|
},
|
|
285
179
|
[TOOL_NAMES.detectDeadCode]: {
|
|
286
180
|
title: 'Detect Dead Code',
|
|
287
|
-
description: `
|
|
181
|
+
description: `Find unused exports, uncalled methods, orphan interfaces. Use list_projects first.
|
|
288
182
|
|
|
289
|
-
|
|
290
|
-
Use list_projects to see available projects and get the project name.
|
|
183
|
+
Returns risk level, dead code items with confidence (HIGH/MEDIUM/LOW), grouped by type and category.
|
|
291
184
|
|
|
292
|
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
- Excluded entry points for audit (controllers, modules, etc.)
|
|
185
|
+
Key parameters:
|
|
186
|
+
- projectId (required)
|
|
187
|
+
- filterCategory: library-export, ui-component, internal-unused, all (default: all)
|
|
188
|
+
- minConfidence: LOW/MEDIUM/HIGH (default: LOW)
|
|
189
|
+
- summaryOnly: true for stats only
|
|
190
|
+
- excludePatterns, excludeSemanticTypes: Additional exclusions
|
|
299
191
|
|
|
300
|
-
|
|
301
|
-
- projectId: Project name, path, or ID (required)
|
|
302
|
-
- excludePatterns: Additional file patterns to exclude (e.g., ["*.config.ts", "*.seed.ts"])
|
|
303
|
-
- excludeSemanticTypes: Additional semantic types to exclude (e.g., ["EntityClass", "DTOClass"])
|
|
304
|
-
- excludeLibraryExports: Exclude all items from packages/* directories (default: false)
|
|
305
|
-
- excludeCoreTypes: Exclude specific AST types (e.g., ["InterfaceDeclaration", "EnumDeclaration"])
|
|
306
|
-
- includeEntryPoints: Include excluded entry points in audit section (default: true)
|
|
307
|
-
- minConfidence: Minimum confidence to include (LOW/MEDIUM/HIGH, default: LOW)
|
|
308
|
-
- filterCategory: Filter by category (library-export, ui-component, internal-unused, all) (default: all)
|
|
309
|
-
- summaryOnly: Return only statistics without full dead code list (default: false)
|
|
310
|
-
- limit: Maximum items per page (default: 100, max: 500)
|
|
311
|
-
- offset: Number of items to skip for pagination (default: 0)
|
|
312
|
-
|
|
313
|
-
**Categories:**
|
|
314
|
-
- library-export: Exports from packages/* directories (may be used by external consumers)
|
|
315
|
-
- ui-component: Exports from components/ui/* (component library, intentionally broad API)
|
|
316
|
-
- internal-unused: Regular internal code that appears unused
|
|
317
|
-
|
|
318
|
-
**Auto-excluded entry points:**
|
|
319
|
-
- Semantic types: NestController, NestModule, NestGuard, NestPipe, NestInterceptor, NestFilter, NestProvider, NestService, HttpEndpoint
|
|
320
|
-
- File patterns: main.ts, *.module.ts, *.controller.ts, index.ts
|
|
321
|
-
|
|
322
|
-
**Confidence levels:**
|
|
323
|
-
- HIGH: Exported but never imported or referenced
|
|
324
|
-
- MEDIUM: Private with no internal calls
|
|
325
|
-
- LOW: Could be used dynamically
|
|
326
|
-
|
|
327
|
-
Use filterCategory=internal-unused for actionable dead code cleanup.`,
|
|
192
|
+
Auto-excludes NestJS entry points (controllers, modules, guards, etc.). Use filterCategory=internal-unused for actionable cleanup.`,
|
|
328
193
|
},
|
|
329
194
|
[TOOL_NAMES.detectDuplicateCode]: {
|
|
330
195
|
title: 'Detect Duplicate Code',
|
|
331
|
-
description: `Find
|
|
332
|
-
|
|
333
|
-
**Before analyzing:**
|
|
334
|
-
Use list_projects to see available projects and get the project name.
|
|
335
|
-
|
|
336
|
-
Returns:
|
|
337
|
-
- Duplicate groups with similarity scores
|
|
338
|
-
- Confidence levels (HIGH/MEDIUM/LOW)
|
|
339
|
-
- Grouped by detection type (structural, semantic)
|
|
340
|
-
- Recommendations for each duplicate group
|
|
341
|
-
- Affected files list
|
|
196
|
+
description: `Find duplicates using structural (AST hash) and semantic (embedding) analysis. Use list_projects first.
|
|
342
197
|
|
|
343
198
|
Parameters:
|
|
344
|
-
- projectId
|
|
345
|
-
- type:
|
|
346
|
-
- minSimilarity:
|
|
347
|
-
-
|
|
348
|
-
-
|
|
349
|
-
-
|
|
350
|
-
- summaryOnly: Return only statistics without full duplicates list (default: false)
|
|
351
|
-
- offset: Number of groups to skip for pagination (default: 0)
|
|
352
|
-
|
|
353
|
-
**Detection Types:**
|
|
354
|
-
- structural: Finds exact duplicates by normalized code hash (ignores formatting, variable names, literals)
|
|
355
|
-
- semantic: Finds similar code using embedding similarity (catches different implementations of same logic)
|
|
356
|
-
- all: Runs both detection types
|
|
357
|
-
|
|
358
|
-
**Similarity Thresholds:**
|
|
359
|
-
- 0.90+: Very high similarity, almost certainly duplicates
|
|
360
|
-
- 0.85-0.90: High similarity, likely duplicates with minor variations
|
|
361
|
-
- 0.80-0.85: Moderate similarity, worth reviewing
|
|
362
|
-
|
|
363
|
-
Use this to identify refactoring opportunities and reduce code duplication.`,
|
|
199
|
+
- projectId (required)
|
|
200
|
+
- type: structural, semantic, or all (default: all)
|
|
201
|
+
- minSimilarity: 0.5-1.0 (default: 0.80). 0.90+ = almost certain duplicates
|
|
202
|
+
- scope: methods, functions, classes, or all (default: all)
|
|
203
|
+
- summaryOnly: true for stats only
|
|
204
|
+
- includeCode: Include source snippets (default: false)`,
|
|
364
205
|
},
|
|
365
206
|
[TOOL_NAMES.swarmPheromone]: {
|
|
366
207
|
title: 'Swarm Pheromone',
|
|
367
|
-
description: `
|
|
368
|
-
|
|
369
|
-
**What is Stigmergy?**
|
|
370
|
-
Agents coordinate indirectly by leaving markers (pheromones) on code nodes. Other agents sense these markers and adapt their behavior. No direct messaging needed.
|
|
371
|
-
|
|
372
|
-
**Pheromone Types:**
|
|
373
|
-
- exploring: "I'm looking at this" (2 min half-life)
|
|
374
|
-
- modifying: "I'm actively working on this" (10 min half-life)
|
|
375
|
-
- claiming: "This is my territory" (1 hour half-life)
|
|
376
|
-
- completed: "I finished work here" (24 hour half-life)
|
|
377
|
-
- warning: "Danger - don't touch" (never decays)
|
|
378
|
-
- blocked: "I'm stuck on this" (5 min half-life)
|
|
379
|
-
- proposal: "Proposed artifact awaiting approval" (1 hour half-life)
|
|
380
|
-
- needs_review: "Someone should check this" (30 min half-life)
|
|
208
|
+
description: `Mark a code node with a pheromone for coordination. Types: exploring (2min), modifying (10min), claiming (1hr), completed (24hr), warning (permanent), blocked (5min), proposal (1hr), needs_review (30min).
|
|
381
209
|
|
|
382
|
-
|
|
383
|
-
- nodeId: The code node ID to mark
|
|
384
|
-
- type: Type of pheromone (see above)
|
|
385
|
-
- agentId: Your unique agent identifier
|
|
386
|
-
- swarmId: Swarm ID from orchestrator (for bulk cleanup)
|
|
387
|
-
- intensity: 0.0-1.0, how strong the signal (default: 1.0)
|
|
388
|
-
- data: Optional metadata (summary, reason, etc.)
|
|
389
|
-
- remove: Set true to remove the pheromone
|
|
390
|
-
|
|
391
|
-
**Workflow states** (exploring, claiming, modifying, completed, blocked) are mutually exclusive per agent+node. Setting one automatically removes others.
|
|
392
|
-
|
|
393
|
-
**Usage Pattern:**
|
|
394
|
-
1. Before starting work: swarm_sense to check what's claimed
|
|
395
|
-
2. Claim your target: swarm_pheromone({ nodeId, type: "claiming", agentId, swarmId })
|
|
396
|
-
3. Refresh periodically if working long
|
|
397
|
-
4. Mark complete: swarm_pheromone({ nodeId, type: "completed", agentId, swarmId, data: { summary: "..." } })
|
|
398
|
-
|
|
399
|
-
**Decay:**
|
|
400
|
-
Pheromones automatically fade over time. If an agent dies, its markers decay and work becomes available again.`,
|
|
210
|
+
Workflow states (exploring/claiming/modifying/completed/blocked) are mutually exclusive per agent+node. Use remove:true to delete. Pheromones decay automatically.`,
|
|
401
211
|
},
|
|
402
212
|
[TOOL_NAMES.swarmSense]: {
|
|
403
213
|
title: 'Swarm Sense',
|
|
404
|
-
description: `Query pheromones
|
|
405
|
-
|
|
406
|
-
**What This Does:**
|
|
407
|
-
Returns active pheromones with their current intensity (after decay). Use this to:
|
|
408
|
-
- See what nodes are being worked on
|
|
409
|
-
- Avoid conflicts with other agents
|
|
410
|
-
- Find unclaimed work
|
|
411
|
-
- Check if your dependencies are being modified
|
|
214
|
+
description: `Query active pheromones to see what other agents are doing. Filter by swarmId, types, nodeIds, agentIds. Use excludeAgentId to see only others' activity.
|
|
412
215
|
|
|
413
|
-
|
|
414
|
-
- swarmId: Filter by swarm ID (see only this swarm's pheromones)
|
|
415
|
-
- types: Filter by pheromone types (e.g., ["modifying", "claiming"])
|
|
416
|
-
- nodeIds: Check specific nodes
|
|
417
|
-
- agentIds: Filter by specific agents
|
|
418
|
-
- excludeAgentId: Exclude your own pheromones (see what OTHERS are doing)
|
|
419
|
-
- minIntensity: Minimum intensity after decay (default: 0.3)
|
|
420
|
-
- limit: Max results (default: 50)
|
|
421
|
-
- includeStats: Get summary statistics by type
|
|
422
|
-
- cleanup: Remove fully decayed pheromones (intensity < 0.01)
|
|
423
|
-
|
|
424
|
-
**Usage Pattern:**
|
|
425
|
-
\`\`\`
|
|
426
|
-
// Before starting work, check what's taken
|
|
427
|
-
swarm_sense({
|
|
428
|
-
types: ["modifying", "claiming"],
|
|
429
|
-
minIntensity: 0.3
|
|
430
|
-
})
|
|
431
|
-
|
|
432
|
-
// Check a specific node before modifying
|
|
433
|
-
swarm_sense({
|
|
434
|
-
nodeIds: ["proj_xxx:Service:UserService"],
|
|
435
|
-
types: ["modifying", "warning"]
|
|
436
|
-
})
|
|
437
|
-
|
|
438
|
-
// See what other agents are doing (exclude self)
|
|
439
|
-
swarm_sense({
|
|
440
|
-
excludeAgentId: "my-agent-id",
|
|
441
|
-
types: ["exploring", "modifying"]
|
|
442
|
-
})
|
|
443
|
-
\`\`\`
|
|
444
|
-
|
|
445
|
-
**Decay:**
|
|
446
|
-
Intensity decreases over time (exponential decay). A pheromone with intensity 0.25 is almost gone. Below minIntensity threshold, it's not returned.`,
|
|
216
|
+
Returns pheromones with current intensity after decay. minIntensity default: 0.3. Add includeStats:true for summary counts.`,
|
|
447
217
|
},
|
|
448
218
|
[TOOL_NAMES.swarmCleanup]: {
|
|
449
219
|
title: 'Swarm Cleanup',
|
|
450
|
-
description: `Bulk delete pheromones
|
|
451
|
-
|
|
452
|
-
**When to use:**
|
|
453
|
-
Call this when a swarm finishes to clean up all its pheromones. Prevents pollution for future swarms.
|
|
454
|
-
|
|
455
|
-
**Parameters:**
|
|
456
|
-
- projectId: Required - the project
|
|
457
|
-
- swarmId: Delete all pheromones from this swarm
|
|
458
|
-
- agentId: Delete all pheromones from this specific agent
|
|
459
|
-
- all: Set true to delete ALL pheromones in project (use with caution)
|
|
460
|
-
- keepTypes: Pheromone types to preserve (default: ["warning"])
|
|
461
|
-
- dryRun: Preview what would be deleted without deleting
|
|
462
|
-
|
|
463
|
-
**Must specify one of:** swarmId, agentId, or all=true
|
|
464
|
-
|
|
465
|
-
**Examples:**
|
|
466
|
-
\`\`\`
|
|
467
|
-
// Clean up after a swarm completes
|
|
468
|
-
swarm_cleanup({ projectId: "backend", swarmId: "swarm_abc123" })
|
|
469
|
-
|
|
470
|
-
// Preview what would be deleted
|
|
471
|
-
swarm_cleanup({ projectId: "backend", swarmId: "swarm_abc123", dryRun: true })
|
|
472
|
-
|
|
473
|
-
// Clean up a specific agent's pheromones
|
|
474
|
-
swarm_cleanup({ projectId: "backend", agentId: "swarm_abc123_auth" })
|
|
475
|
-
|
|
476
|
-
// Nuclear option: delete all (except warnings)
|
|
477
|
-
swarm_cleanup({ projectId: "backend", all: true })
|
|
478
|
-
\`\`\`
|
|
479
|
-
|
|
480
|
-
**Note:** \`warning\` pheromones are preserved by default. Pass \`keepTypes: []\` to delete everything.`,
|
|
220
|
+
description: `Bulk delete pheromones. Specify swarmId, agentId, or all:true. Warning pheromones preserved by default (override with keepTypes:[]). Use dryRun:true to preview.`,
|
|
481
221
|
},
|
|
482
222
|
[TOOL_NAMES.swarmPostTask]: {
|
|
483
223
|
title: 'Swarm Post Task',
|
|
484
|
-
description: `Post a task to the swarm
|
|
485
|
-
|
|
486
|
-
**What is the Blackboard?**
|
|
487
|
-
The blackboard is a shared task queue where agents post work, claim tasks, and coordinate. Unlike pheromones (indirect coordination), tasks are explicit work items with dependencies.
|
|
224
|
+
description: `Post a task to the swarm queue. Required: projectId, swarmId, title, description, type, createdBy.
|
|
488
225
|
|
|
489
|
-
|
|
490
|
-
- projectId: Project to post the task in
|
|
491
|
-
- swarmId: Group related tasks together
|
|
492
|
-
- title: Short task title (max 200 chars)
|
|
493
|
-
- description: Detailed description of what needs to be done
|
|
494
|
-
- type: Task category (implement, refactor, fix, test, review, document, investigate, plan)
|
|
495
|
-
- priority: Urgency level (critical, high, normal, low, backlog)
|
|
496
|
-
- targetNodeIds: Code nodes this task affects (from search_codebase)
|
|
497
|
-
- targetFilePaths: File paths this task affects
|
|
498
|
-
- dependencies: Task IDs that must complete before this task can start
|
|
499
|
-
- createdBy: Your agent ID
|
|
500
|
-
- metadata: Additional context (acceptance criteria, notes, etc.)
|
|
501
|
-
|
|
502
|
-
**Task Lifecycle:**
|
|
503
|
-
available → claimed → in_progress → needs_review → completed
|
|
504
|
-
↘ blocked (if dependencies incomplete)
|
|
505
|
-
↘ failed (if something goes wrong)
|
|
506
|
-
|
|
507
|
-
**Dependency Management:**
|
|
508
|
-
Tasks with incomplete dependencies are automatically marked as "blocked" and become "available" when all dependencies complete.
|
|
226
|
+
Types: implement, refactor, fix, test, review, document, investigate, plan. Priority: critical, high, normal, low, backlog.
|
|
509
227
|
|
|
510
|
-
|
|
511
|
-
\`\`\`
|
|
512
|
-
swarm_post_task({
|
|
513
|
-
projectId: "backend",
|
|
514
|
-
swarmId: "feature_auth",
|
|
515
|
-
title: "Implement JWT validation",
|
|
516
|
-
description: "Add JWT token validation to the auth middleware...",
|
|
517
|
-
type: "implement",
|
|
518
|
-
priority: "high",
|
|
519
|
-
targetNodeIds: ["proj_xxx:Class:AuthMiddleware"],
|
|
520
|
-
dependencies: ["task_abc123"], // Must complete first
|
|
521
|
-
createdBy: "planner_agent"
|
|
522
|
-
})
|
|
523
|
-
\`\`\``,
|
|
228
|
+
Use dependencies array for task ordering. Tasks with incomplete deps auto-block until ready.`,
|
|
524
229
|
},
|
|
525
230
|
[TOOL_NAMES.swarmClaimTask]: {
|
|
526
231
|
title: 'Swarm Claim Task',
|
|
527
|
-
description: `Claim a task from the
|
|
528
|
-
|
|
529
|
-
**Actions:**
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
- types: Only consider certain task types (e.g., ["fix", "implement"])
|
|
537
|
-
- minPriority: Only consider tasks at or above this priority
|
|
538
|
-
|
|
539
|
-
**Claim Flow:**
|
|
540
|
-
1. swarm_claim_task({ action: "claim" }) - Reserve the task
|
|
541
|
-
2. swarm_claim_task({ action: "start", taskId: "..." }) - Begin work
|
|
542
|
-
3. [Do the work]
|
|
543
|
-
4. swarm_complete_task({ action: "complete" }) - Finish
|
|
544
|
-
|
|
545
|
-
**Example - Claim specific task:**
|
|
546
|
-
\`\`\`
|
|
547
|
-
swarm_claim_task({
|
|
548
|
-
projectId: "backend",
|
|
549
|
-
swarmId: "feature_auth",
|
|
550
|
-
agentId: "worker_1",
|
|
551
|
-
taskId: "task_abc123",
|
|
552
|
-
action: "claim"
|
|
553
|
-
})
|
|
554
|
-
\`\`\`
|
|
555
|
-
|
|
556
|
-
**Example - Auto-select highest priority:**
|
|
557
|
-
\`\`\`
|
|
558
|
-
swarm_claim_task({
|
|
559
|
-
projectId: "backend",
|
|
560
|
-
swarmId: "feature_auth",
|
|
561
|
-
agentId: "worker_1",
|
|
562
|
-
types: ["implement", "fix"],
|
|
563
|
-
minPriority: "normal"
|
|
564
|
-
})
|
|
565
|
-
\`\`\`
|
|
566
|
-
|
|
567
|
-
**Releasing Tasks:**
|
|
568
|
-
If you can't complete a task, release it so others can pick it up:
|
|
569
|
-
\`\`\`
|
|
570
|
-
swarm_claim_task({
|
|
571
|
-
projectId: "backend",
|
|
572
|
-
taskId: "task_abc123",
|
|
573
|
-
agentId: "worker_1",
|
|
574
|
-
action: "release",
|
|
575
|
-
releaseReason: "Blocked by external API issue"
|
|
576
|
-
})
|
|
577
|
-
\`\`\``,
|
|
232
|
+
description: `Claim a task from the swarm task queue.
|
|
233
|
+
|
|
234
|
+
**Actions:** claim_and_start (default, recommended), claim, start, release, abandon, force_start
|
|
235
|
+
|
|
236
|
+
**Flow:** claim_and_start → do work → swarm_complete_task
|
|
237
|
+
|
|
238
|
+
Without taskId, claims highest-priority available task. Use types/minPriority to filter.
|
|
239
|
+
|
|
240
|
+
Recovery: Use abandon to release stuck tasks, force_start to recover from failed start.`,
|
|
578
241
|
},
|
|
579
242
|
[TOOL_NAMES.swarmCompleteTask]: {
|
|
580
243
|
title: 'Swarm Complete Task',
|
|
581
244
|
description: `Mark a task as completed, failed, or request review.
|
|
582
245
|
|
|
583
|
-
**Actions:**
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
- reject: Reviewer rejects (returns to in_progress or marks failed)
|
|
589
|
-
- retry: Make a failed task available again
|
|
590
|
-
|
|
591
|
-
**Completing with Artifacts:**
|
|
592
|
-
\`\`\`
|
|
593
|
-
swarm_complete_task({
|
|
594
|
-
projectId: "backend",
|
|
595
|
-
taskId: "task_abc123",
|
|
596
|
-
agentId: "worker_1",
|
|
597
|
-
action: "complete",
|
|
598
|
-
summary: "Implemented JWT validation with RS256 signing",
|
|
599
|
-
artifacts: {
|
|
600
|
-
files: ["src/auth/jwt.service.ts"],
|
|
601
|
-
commits: ["abc123"],
|
|
602
|
-
pullRequests: ["#42"]
|
|
603
|
-
},
|
|
604
|
-
filesChanged: ["src/auth/jwt.service.ts", "src/auth/auth.module.ts"],
|
|
605
|
-
linesAdded: 150,
|
|
606
|
-
linesRemoved: 20
|
|
607
|
-
})
|
|
608
|
-
\`\`\`
|
|
609
|
-
|
|
610
|
-
**Request Review (for important changes):**
|
|
611
|
-
\`\`\`
|
|
612
|
-
swarm_complete_task({
|
|
613
|
-
projectId: "backend",
|
|
614
|
-
taskId: "task_abc123",
|
|
615
|
-
agentId: "worker_1",
|
|
616
|
-
action: "request_review",
|
|
617
|
-
summary: "Implemented auth - needs security review",
|
|
618
|
-
reviewNotes: "Please verify token expiration logic"
|
|
619
|
-
})
|
|
620
|
-
\`\`\`
|
|
621
|
-
|
|
622
|
-
**Approve/Reject (for reviewers):**
|
|
623
|
-
\`\`\`
|
|
624
|
-
swarm_complete_task({
|
|
625
|
-
projectId: "backend",
|
|
626
|
-
taskId: "task_abc123",
|
|
627
|
-
agentId: "reviewer_1",
|
|
628
|
-
action: "approve",
|
|
629
|
-
reviewerId: "reviewer_1",
|
|
630
|
-
notes: "LGTM"
|
|
631
|
-
})
|
|
632
|
-
\`\`\`
|
|
633
|
-
|
|
634
|
-
**Failing a Task:**
|
|
635
|
-
\`\`\`
|
|
636
|
-
swarm_complete_task({
|
|
637
|
-
projectId: "backend",
|
|
638
|
-
taskId: "task_abc123",
|
|
639
|
-
agentId: "worker_1",
|
|
640
|
-
action: "fail",
|
|
641
|
-
reason: "External API is down",
|
|
642
|
-
errorDetails: "ConnectionTimeout after 30s",
|
|
643
|
-
retryable: true
|
|
644
|
-
})
|
|
645
|
-
\`\`\``,
|
|
246
|
+
**Actions:** complete, fail, request_review, approve, reject, retry
|
|
247
|
+
|
|
248
|
+
Required: summary (for complete/request_review), reason (for fail), reviewerId (for approve/reject).
|
|
249
|
+
|
|
250
|
+
Complete unblocks dependent tasks. Failed tasks can be retried if retryable=true.`,
|
|
646
251
|
},
|
|
647
252
|
[TOOL_NAMES.swarmGetTasks]: {
|
|
648
253
|
title: 'Swarm Get Tasks',
|
|
649
|
-
description: `Query tasks
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
\`\`\`
|
|
653
|
-
// Get all available tasks in a swarm
|
|
654
|
-
swarm_get_tasks({
|
|
655
|
-
projectId: "backend",
|
|
656
|
-
swarmId: "feature_auth",
|
|
657
|
-
statuses: ["available"]
|
|
658
|
-
})
|
|
659
|
-
|
|
660
|
-
// Get a specific task with full details
|
|
661
|
-
swarm_get_tasks({
|
|
662
|
-
projectId: "backend",
|
|
663
|
-
taskId: "task_abc123"
|
|
664
|
-
})
|
|
665
|
-
|
|
666
|
-
// Get your claimed/in-progress tasks
|
|
667
|
-
swarm_get_tasks({
|
|
668
|
-
projectId: "backend",
|
|
669
|
-
claimedBy: "worker_1",
|
|
670
|
-
statuses: ["claimed", "in_progress"]
|
|
671
|
-
})
|
|
672
|
-
\`\`\`
|
|
673
|
-
|
|
674
|
-
**Filters:**
|
|
675
|
-
- swarmId: Filter by swarm
|
|
676
|
-
- statuses: Task statuses (available, claimed, in_progress, blocked, needs_review, completed, failed, cancelled)
|
|
677
|
-
- types: Task types (implement, refactor, fix, test, review, document, investigate, plan)
|
|
678
|
-
- claimedBy: Agent who has the task
|
|
679
|
-
- createdBy: Agent who created the task
|
|
680
|
-
- minPriority: Minimum priority level
|
|
681
|
-
|
|
682
|
-
**Sorting:**
|
|
683
|
-
- priority: Highest priority first (default)
|
|
684
|
-
- created: Newest first
|
|
685
|
-
- updated: Most recently updated first
|
|
686
|
-
|
|
687
|
-
**Additional Data:**
|
|
688
|
-
- includeStats: true - Get aggregate statistics (counts by status, type, agent)
|
|
689
|
-
- includeDependencyGraph: true - Get task dependency graph for visualization
|
|
690
|
-
|
|
691
|
-
**Example with stats:**
|
|
692
|
-
\`\`\`
|
|
693
|
-
swarm_get_tasks({
|
|
694
|
-
projectId: "backend",
|
|
695
|
-
swarmId: "feature_auth",
|
|
696
|
-
includeStats: true
|
|
697
|
-
})
|
|
698
|
-
// Returns: { tasks: [...], stats: { byStatus: {available: 5, in_progress: 2}, ... } }
|
|
699
|
-
\`\`\``,
|
|
254
|
+
description: `Query tasks with filters. Use taskId for single task, or filter by swarmId, statuses, types, claimedBy, createdBy, minPriority.
|
|
255
|
+
|
|
256
|
+
Sort by: priority (default), created, updated. Add includeStats:true for aggregate counts.`,
|
|
700
257
|
},
|
|
701
258
|
[TOOL_NAMES.swarmOrchestrate]: {
|
|
702
259
|
title: 'Swarm Orchestrate',
|
|
703
|
-
description: `
|
|
704
|
-
|
|
705
|
-
**What This Does:**
|
|
706
|
-
Spawns and coordinates multiple LLM worker agents to execute complex codebase changes. Uses the code graph to understand dependencies and the swarm system for coordination.
|
|
707
|
-
|
|
708
|
-
**Example Tasks:**
|
|
709
|
-
- "Rename getUserById to fetchUser across the codebase"
|
|
710
|
-
- "Add JSDoc comments to all exported functions in src/core/"
|
|
711
|
-
- "Convert all class components to functional React components"
|
|
712
|
-
- "Add deprecation warnings to all v1 API endpoints"
|
|
713
|
-
|
|
714
|
-
**How It Works:**
|
|
715
|
-
1. **Analyze** - Uses search_codebase to find affected nodes and impact_analysis for dependencies
|
|
716
|
-
2. **Plan** - Decomposes task into atomic, dependency-ordered SwarmTasks
|
|
717
|
-
3. **Spawn** - Starts N worker agents that claim tasks and leave pheromones
|
|
718
|
-
4. **Monitor** - Tracks progress, detects blocked agents, enables self-healing
|
|
719
|
-
5. **Complete** - Aggregates results and cleans up pheromones
|
|
260
|
+
description: `Coordinate multiple agents for complex multi-file tasks. Analyzes codebase, decomposes into atomic tasks, spawns workers, monitors progress.
|
|
720
261
|
|
|
721
|
-
|
|
722
|
-
- projectId: Project to operate on
|
|
723
|
-
- task: Natural language description of the task
|
|
724
|
-
- maxAgents: Maximum concurrent worker agents (default: 3)
|
|
725
|
-
- dryRun: If true, only plan without executing (default: false)
|
|
726
|
-
- autoApprove: Skip approval step for each task (default: false)
|
|
727
|
-
- priority: Overall priority level (critical, high, normal, low, backlog)
|
|
728
|
-
|
|
729
|
-
**Self-Healing:**
|
|
730
|
-
- Pheromone decay automatically frees stuck work
|
|
731
|
-
- Failed tasks become available for retry
|
|
732
|
-
- Blocked agents release tasks for others
|
|
733
|
-
|
|
734
|
-
**Example:**
|
|
735
|
-
\`\`\`
|
|
736
|
-
swarm_orchestrate({
|
|
737
|
-
projectId: "backend",
|
|
738
|
-
task: "Add JSDoc comments to all exported functions in src/services/",
|
|
739
|
-
maxAgents: 3,
|
|
740
|
-
dryRun: false
|
|
741
|
-
})
|
|
742
|
-
\`\`\`
|
|
743
|
-
|
|
744
|
-
**Returns:**
|
|
745
|
-
- swarmId: Unique identifier for this swarm run
|
|
746
|
-
- status: planning | executing | completed | failed
|
|
747
|
-
- plan: Task breakdown with dependency graph
|
|
748
|
-
- progress: Real-time completion stats
|
|
749
|
-
- results: Summary of changes made`,
|
|
262
|
+
Use dryRun:true to preview plan. maxAgents controls parallelism (default: 3). Failed tasks auto-retry via pheromone decay.`,
|
|
750
263
|
},
|
|
751
264
|
};
|
|
752
265
|
// Default Values
|