sqlew 2.1.3 → 3.0.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/CHANGELOG.md +891 -535
- package/README.md +302 -613
- package/assets/kanban-style.png +0 -0
- package/assets/schema.sql +531 -402
- package/dist/database.d.ts +9 -0
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +33 -34
- package/dist/database.js.map +1 -1
- package/dist/index.js +1024 -21
- package/dist/index.js.map +1 -1
- package/dist/migrations/add-task-tables.d.ts +47 -0
- package/dist/migrations/add-task-tables.d.ts.map +1 -0
- package/dist/migrations/add-task-tables.js +285 -0
- package/dist/migrations/add-task-tables.js.map +1 -0
- package/dist/migrations/index.d.ts +96 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +239 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/migrate-decisions-to-tasks.d.ts +61 -0
- package/dist/migrations/migrate-decisions-to-tasks.d.ts.map +1 -0
- package/dist/migrations/migrate-decisions-to-tasks.js +442 -0
- package/dist/migrations/migrate-decisions-to-tasks.js.map +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +14 -3
- package/dist/schema.js.map +1 -1
- package/dist/tools/constraints.d.ts +4 -0
- package/dist/tools/constraints.d.ts.map +1 -1
- package/dist/tools/constraints.js +6 -27
- package/dist/tools/constraints.js.map +1 -1
- package/dist/tools/context.d.ts +17 -1
- package/dist/tools/context.d.ts.map +1 -1
- package/dist/tools/context.js +195 -190
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/files.d.ts.map +1 -1
- package/dist/tools/files.js +113 -166
- package/dist/tools/files.js.map +1 -1
- package/dist/tools/messaging.d.ts +2 -9
- package/dist/tools/messaging.d.ts.map +1 -1
- package/dist/tools/messaging.js +67 -126
- package/dist/tools/messaging.js.map +1 -1
- package/dist/tools/tasks.d.ts +90 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +732 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/utils.d.ts +8 -1
- package/dist/tools/utils.d.ts.map +1 -1
- package/dist/tools/utils.js +50 -21
- package/dist/tools/utils.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/batch.d.ts +69 -0
- package/dist/utils/batch.d.ts.map +1 -0
- package/dist/utils/batch.js +148 -0
- package/dist/utils/batch.js.map +1 -0
- package/dist/utils/query-builder.d.ts +68 -0
- package/dist/utils/query-builder.d.ts.map +1 -0
- package/dist/utils/query-builder.js +116 -0
- package/dist/utils/query-builder.js.map +1 -0
- package/dist/utils/task-stale-detection.d.ts +28 -0
- package/dist/utils/task-stale-detection.d.ts.map +1 -0
- package/dist/utils/task-stale-detection.js +92 -0
- package/dist/utils/task-stale-detection.js.map +1 -0
- package/dist/utils/validators.d.ts +57 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +117 -0
- package/dist/utils/validators.js.map +1 -0
- package/docs/AI_AGENT_GUIDE.md +1471 -0
- package/{ARCHITECTURE.md → docs/ARCHITECTURE.md} +636 -636
- package/docs/BEST_PRACTICES.md +481 -0
- package/docs/DECISION_TO_TASK_MIGRATION_GUIDE.md +457 -0
- package/docs/MIGRATION_CHAIN.md +280 -0
- package/{MIGRATION_v2.md → docs/MIGRATION_v2.md} +538 -538
- package/docs/SHARED_CONCEPTS.md +339 -0
- package/docs/TASK_ACTIONS.md +854 -0
- package/docs/TASK_LINKING.md +729 -0
- package/docs/TASK_MIGRATION.md +701 -0
- package/docs/TASK_OVERVIEW.md +363 -0
- package/docs/TASK_SYSTEM.md +1244 -0
- package/docs/TOOL_REFERENCE.md +471 -0
- package/docs/TOOL_SELECTION.md +279 -0
- package/docs/WORKFLOWS.md +602 -0
- package/docs/refactoring-summary-2025-10-17.md +365 -0
- package/docs/requirement-2025-10-17.md +508 -0
- package/package.json +64 -63
package/dist/index.js
CHANGED
|
@@ -8,12 +8,13 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
8
8
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
9
9
|
import { initializeDatabase, closeDatabase, setConfigValue, getAllConfig } from './database.js';
|
|
10
10
|
import { CONFIG_KEYS } from './constants.js';
|
|
11
|
-
import { setDecision, getContext, getDecision, searchByTags, getVersions, searchByLayer, quickSetDecision, searchAdvanced, setDecisionBatch, hasUpdates, setFromTemplate, createTemplate, listTemplates } from './tools/context.js';
|
|
11
|
+
import { setDecision, getContext, getDecision, searchByTags, getVersions, searchByLayer, quickSetDecision, searchAdvanced, setDecisionBatch, hasUpdates, setFromTemplate, createTemplate, listTemplates, hardDeleteDecision } from './tools/context.js';
|
|
12
12
|
import { sendMessage, getMessages, markRead, sendMessageBatch } from './tools/messaging.js';
|
|
13
13
|
import { recordFileChange, getFileChanges, checkFileLock, recordFileChangeBatch } from './tools/files.js';
|
|
14
14
|
import { addConstraint, getConstraints, deactivateConstraint } from './tools/constraints.js';
|
|
15
|
-
import { getLayerSummary, clearOldData, getStats, getActivityLog } from './tools/utils.js';
|
|
15
|
+
import { getLayerSummary, clearOldData, getStats, getActivityLog, flushWAL } from './tools/utils.js';
|
|
16
16
|
import { getConfig, updateConfig } from './tools/config.js';
|
|
17
|
+
import { createTask, updateTask, getTask, listTasks, moveTask, linkTask, archiveTask, batchCreateTasks, taskHelp } from './tools/tasks.js';
|
|
17
18
|
// Parse command-line arguments
|
|
18
19
|
const args = process.argv.slice(2);
|
|
19
20
|
const parsedArgs = {};
|
|
@@ -80,8 +81,8 @@ catch (error) {
|
|
|
80
81
|
}
|
|
81
82
|
// Create MCP server
|
|
82
83
|
const server = new Server({
|
|
83
|
-
name: 'mcp-
|
|
84
|
-
version: '
|
|
84
|
+
name: 'mcp-sqlew',
|
|
85
|
+
version: '3.0.0',
|
|
85
86
|
}, {
|
|
86
87
|
capabilities: {
|
|
87
88
|
tools: {},
|
|
@@ -93,14 +94,19 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
93
94
|
tools: [
|
|
94
95
|
{
|
|
95
96
|
name: 'decision',
|
|
96
|
-
description:
|
|
97
|
+
description: `**REQUIRED PARAMETER**: action (must be specified in ALL calls)
|
|
98
|
+
|
|
99
|
+
Context Management - Store decisions with metadata (tags, layers, versions, scopes)
|
|
100
|
+
|
|
101
|
+
Use action: "help" for detailed documentation.
|
|
102
|
+
Use action: "example" for comprehensive usage examples.`,
|
|
97
103
|
inputSchema: {
|
|
98
104
|
type: 'object',
|
|
99
105
|
properties: {
|
|
100
106
|
action: {
|
|
101
107
|
type: 'string',
|
|
102
108
|
description: 'Action',
|
|
103
|
-
enum: ['set', 'get', 'list', 'search_tags', 'search_layer', 'versions', 'quick_set', 'search_advanced', 'set_batch', 'has_updates', 'set_from_template', 'create_template', 'list_templates', 'help']
|
|
109
|
+
enum: ['set', 'get', 'list', 'search_tags', 'search_layer', 'versions', 'quick_set', 'search_advanced', 'set_batch', 'has_updates', 'set_from_template', 'create_template', 'list_templates', 'hard_delete', 'help', 'example']
|
|
104
110
|
},
|
|
105
111
|
key: { type: 'string' },
|
|
106
112
|
value: { type: ['string', 'number'] },
|
|
@@ -141,11 +147,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
141
147
|
},
|
|
142
148
|
{
|
|
143
149
|
name: 'message',
|
|
144
|
-
description:
|
|
150
|
+
description: `**REQUIRED PARAMETER**: action (must be specified in ALL calls)
|
|
151
|
+
|
|
152
|
+
Agent Messaging - Send messages between agents with priority levels and read tracking
|
|
153
|
+
|
|
154
|
+
Use action: "help" for detailed documentation.
|
|
155
|
+
Use action: "example" for comprehensive usage examples.`,
|
|
145
156
|
inputSchema: {
|
|
146
157
|
type: 'object',
|
|
147
158
|
properties: {
|
|
148
|
-
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['send', 'get', 'mark_read', 'send_batch', 'help'] },
|
|
159
|
+
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['send', 'get', 'mark_read', 'send_batch', 'help', 'example'] },
|
|
149
160
|
agent_name: { type: 'string' },
|
|
150
161
|
from_agent: { type: 'string' },
|
|
151
162
|
to_agent: { type: ['string', 'null'] },
|
|
@@ -167,11 +178,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
167
178
|
},
|
|
168
179
|
{
|
|
169
180
|
name: 'file',
|
|
170
|
-
description:
|
|
181
|
+
description: `**REQUIRED PARAMETER**: action (must be specified in ALL calls)
|
|
182
|
+
|
|
183
|
+
File Change Tracking - Track file changes with layer classification and lock detection
|
|
184
|
+
|
|
185
|
+
Use action: "help" for detailed documentation.
|
|
186
|
+
Use action: "example" for comprehensive usage examples.`,
|
|
171
187
|
inputSchema: {
|
|
172
188
|
type: 'object',
|
|
173
189
|
properties: {
|
|
174
|
-
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['record', 'get', 'check_lock', 'record_batch', 'help'] },
|
|
190
|
+
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['record', 'get', 'check_lock', 'record_batch', 'help', 'example'] },
|
|
175
191
|
file_path: { type: 'string' },
|
|
176
192
|
agent_name: { type: 'string' },
|
|
177
193
|
change_type: { type: 'string', enum: ['created', 'modified', 'deleted'] },
|
|
@@ -189,11 +205,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
189
205
|
},
|
|
190
206
|
{
|
|
191
207
|
name: 'constraint',
|
|
192
|
-
description:
|
|
208
|
+
description: `**REQUIRED PARAMETER**: action (must be specified in ALL calls)
|
|
209
|
+
|
|
210
|
+
Constraint Management - Manage architectural rules and requirements
|
|
211
|
+
|
|
212
|
+
Use action: "help" for detailed documentation.
|
|
213
|
+
Use action: "example" for comprehensive usage examples.`,
|
|
193
214
|
inputSchema: {
|
|
194
215
|
type: 'object',
|
|
195
216
|
properties: {
|
|
196
|
-
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['add', 'get', 'deactivate', 'help'] },
|
|
217
|
+
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['add', 'get', 'deactivate', 'help', 'example'] },
|
|
197
218
|
constraint_id: { type: 'number' },
|
|
198
219
|
category: { type: 'string', enum: ['performance', 'architecture', 'security'] },
|
|
199
220
|
constraint_text: { type: 'string' },
|
|
@@ -209,11 +230,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
209
230
|
},
|
|
210
231
|
{
|
|
211
232
|
name: 'stats',
|
|
212
|
-
description:
|
|
233
|
+
description: `**REQUIRED PARAMETER**: action (must be specified in ALL calls)
|
|
234
|
+
|
|
235
|
+
Statistics & Utilities - View stats, activity logs, manage data cleanup, and WAL checkpoints
|
|
236
|
+
|
|
237
|
+
Use action: "help" for detailed documentation.
|
|
238
|
+
Use action: "example" for comprehensive usage examples.`,
|
|
213
239
|
inputSchema: {
|
|
214
240
|
type: 'object',
|
|
215
241
|
properties: {
|
|
216
|
-
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['layer_summary', 'db_stats', 'clear', 'activity_log', 'help'] },
|
|
242
|
+
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['layer_summary', 'db_stats', 'clear', 'activity_log', 'flush', 'help', 'example'] },
|
|
217
243
|
messages_older_than_hours: { type: 'number' },
|
|
218
244
|
file_changes_older_than_days: { type: 'number' },
|
|
219
245
|
since: { type: 'string', description: 'Time filter (e.g., "5m", "1h", "2d" or ISO timestamp)' },
|
|
@@ -226,11 +252,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
226
252
|
},
|
|
227
253
|
{
|
|
228
254
|
name: 'config',
|
|
229
|
-
description:
|
|
255
|
+
description: `**REQUIRED PARAMETER**: action (must be specified in ALL calls)
|
|
256
|
+
|
|
257
|
+
Configuration - Manage auto-deletion settings with weekend-aware retention
|
|
258
|
+
|
|
259
|
+
Use action: "help" for detailed documentation.
|
|
260
|
+
Use action: "example" for comprehensive usage examples.`,
|
|
230
261
|
inputSchema: {
|
|
231
262
|
type: 'object',
|
|
232
263
|
properties: {
|
|
233
|
-
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['get', 'update', 'help'] },
|
|
264
|
+
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['get', 'update', 'help', 'example'] },
|
|
234
265
|
ignoreWeekend: { type: 'boolean' },
|
|
235
266
|
messageRetentionHours: { type: 'number', minimum: 1, maximum: 168 },
|
|
236
267
|
fileHistoryRetentionDays: { type: 'number', minimum: 1, maximum: 90 },
|
|
@@ -238,6 +269,42 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
238
269
|
required: ['action'],
|
|
239
270
|
},
|
|
240
271
|
},
|
|
272
|
+
{
|
|
273
|
+
name: 'task',
|
|
274
|
+
description: `**REQUIRED PARAMETER**: action (must be specified in ALL calls)
|
|
275
|
+
|
|
276
|
+
Kanban Task Watcher - AI-optimized task management with auto-stale detection
|
|
277
|
+
|
|
278
|
+
Use action: "help" for detailed documentation.
|
|
279
|
+
Use action: "example" for comprehensive usage examples.`,
|
|
280
|
+
inputSchema: {
|
|
281
|
+
type: 'object',
|
|
282
|
+
properties: {
|
|
283
|
+
action: { type: 'string', description: 'Action (use "help" for usage)', enum: ['create', 'update', 'get', 'list', 'move', 'link', 'archive', 'batch_create', 'help', 'example'] },
|
|
284
|
+
task_id: { type: 'number' },
|
|
285
|
+
title: { type: 'string' },
|
|
286
|
+
description: { type: 'string' },
|
|
287
|
+
acceptance_criteria: { type: 'string' },
|
|
288
|
+
notes: { type: 'string' },
|
|
289
|
+
priority: { type: 'number', minimum: 1, maximum: 4 },
|
|
290
|
+
assigned_agent: { type: 'string' },
|
|
291
|
+
created_by_agent: { type: 'string' },
|
|
292
|
+
layer: { type: 'string', enum: ['presentation', 'business', 'data', 'infrastructure', 'cross-cutting'] },
|
|
293
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
294
|
+
status: { type: 'string', enum: ['todo', 'in_progress', 'waiting_review', 'blocked', 'done', 'archived'] },
|
|
295
|
+
new_status: { type: 'string', enum: ['todo', 'in_progress', 'waiting_review', 'blocked', 'done', 'archived'] },
|
|
296
|
+
link_type: { type: 'string', enum: ['decision', 'constraint', 'file'] },
|
|
297
|
+
target_id: { type: ['string', 'number'] },
|
|
298
|
+
link_relation: { type: 'string' },
|
|
299
|
+
limit: { type: 'number', default: 50 },
|
|
300
|
+
offset: { type: 'number', default: 0 },
|
|
301
|
+
// batch_create parameters
|
|
302
|
+
tasks: { type: 'array', description: 'Array of tasks for batch operation (max: 50)' },
|
|
303
|
+
atomic: { type: 'boolean', description: 'Atomic mode - all succeed or all fail (default: true)' },
|
|
304
|
+
},
|
|
305
|
+
required: ['action'],
|
|
306
|
+
},
|
|
307
|
+
},
|
|
241
308
|
],
|
|
242
309
|
};
|
|
243
310
|
});
|
|
@@ -304,10 +371,59 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
304
371
|
case 'list_templates':
|
|
305
372
|
result = listTemplates(params);
|
|
306
373
|
break;
|
|
374
|
+
case 'hard_delete':
|
|
375
|
+
result = hardDeleteDecision(params);
|
|
376
|
+
break;
|
|
307
377
|
case 'help':
|
|
308
378
|
result = {
|
|
309
379
|
tool: 'decision',
|
|
310
380
|
description: 'Manage decisions with metadata (tags, layers, versions, scopes)',
|
|
381
|
+
purpose: {
|
|
382
|
+
title: '⚠️ CRITICAL: Store WHY and REASON, Not WHAT',
|
|
383
|
+
principle: 'Decisions table is for ARCHITECTURAL CONTEXT and REASONING, NOT implementation logs or task completion status',
|
|
384
|
+
what_to_store: {
|
|
385
|
+
correct: [
|
|
386
|
+
'WHY a design choice was made (e.g., "Chose JWT over sessions because stateless auth scales better for our microservice architecture")',
|
|
387
|
+
'REASONING behind architecture decisions (e.g., "Moved oscillator_type to MonophonicSynthConfig to separate synthesis methods - FM operators use different config")',
|
|
388
|
+
'PROBLEM ANALYSIS and solution rationale (e.g., "Nested transaction bug: setDecision wraps in transaction, batch also wraps → solution: extract internal helper without transaction wrapper")',
|
|
389
|
+
'DESIGN TRADE-OFFS and alternatives considered (e.g., "Query builder limited to simple filters, kept domain-specific logic inline for maintainability")',
|
|
390
|
+
'CONSTRAINTS and requirements reasoning (e.g., "API response must be <100ms because mobile clients timeout at 200ms")',
|
|
391
|
+
'BREAKING CHANGES with migration rationale (e.g., "Removed /v1/users endpoint - clients must use /v2/users with pagination for scalability")'
|
|
392
|
+
],
|
|
393
|
+
incorrect: [
|
|
394
|
+
'❌ Task completion logs (e.g., "Task 5 completed", "Refactoring done", "Tests passing") → Use tasks tool instead',
|
|
395
|
+
'❌ Implementation status (e.g., "Added validators.ts", "Fixed bug in batch_create", "Updated README") → These are WHAT, not WHY',
|
|
396
|
+
'❌ Test results (e.g., "All tests passing", "Integration tests complete", "v3.0.2 testing verified") → Temporary status, not architectural context',
|
|
397
|
+
'❌ Git commit summaries (e.g., "Released v3.0.2", "Created git commit 2bf55a0") → Belongs in git history',
|
|
398
|
+
'❌ Documentation updates (e.g., "README reorganized", "Help actions enhanced") → Implementation logs, not decisions',
|
|
399
|
+
'❌ Build status (e.g., "Build succeeded", "TypeScript compiled with zero errors") → Temporary status'
|
|
400
|
+
]
|
|
401
|
+
},
|
|
402
|
+
analogy: {
|
|
403
|
+
git_history: 'WHAT changed (files, lines, commits)',
|
|
404
|
+
code_comments: 'HOW it works (implementation details, algorithms)',
|
|
405
|
+
sqlew_decisions: 'WHY it was changed (reasoning, trade-offs, context)',
|
|
406
|
+
sqlew_tasks: 'WHAT needs to be done (work items, status, completion)'
|
|
407
|
+
},
|
|
408
|
+
examples: [
|
|
409
|
+
{
|
|
410
|
+
key: 'api/auth/jwt-choice',
|
|
411
|
+
value: 'Chose JWT over session-based auth because: (1) Stateless design scales horizontally, (2) Mobile clients can cache tokens, (3) Microservice architecture requires distributed auth. Trade-off: Revocation requires token blacklist, but acceptable for 15-min token lifetime.',
|
|
412
|
+
explanation: 'Explains WHY JWT was chosen, considers trade-offs, provides architectural context'
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
key: 'database/postgresql-choice',
|
|
416
|
+
value: 'Selected PostgreSQL over MongoDB because: (1) Complex relational queries required for reporting, (2) ACID compliance critical for financial data, (3) Team has strong SQL expertise. Trade-off: Less flexible schema, but data integrity more important than schema flexibility for our use case.',
|
|
417
|
+
explanation: 'Documents database choice with reasoning, alternatives considered, and trade-offs'
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
key: 'security/encryption-at-rest',
|
|
421
|
+
value: 'Implementing AES-256 encryption for all PII in database because: (1) GDPR compliance requires encryption at rest, (2) Recent security audit identified unencrypted sensitive data, (3) Performance impact <5ms per query acceptable. Alternative considered: Database-level encryption rejected due to backup/restore complexity.',
|
|
422
|
+
explanation: 'Explains security decision with compliance reasoning and performance considerations'
|
|
423
|
+
}
|
|
424
|
+
],
|
|
425
|
+
cleanup_rule: 'Delete decisions that start with "COMPLETED:", contain task status, test results, or implementation logs. Keep only architectural reasoning and design rationale.'
|
|
426
|
+
},
|
|
311
427
|
actions: {
|
|
312
428
|
set: 'Set/update a decision. Params: key (required), value (required), agent, layer, version, status, tags, scopes',
|
|
313
429
|
get: 'Get specific decision by key. Params: key (required)',
|
|
@@ -321,7 +437,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
321
437
|
has_updates: 'Check for updates since timestamp (FR-003 Phase A - Lightweight Polling). Params: agent_name (required), since_timestamp (required, ISO 8601 format like "2025-10-14T08:00:00Z"). Returns: {has_updates: boolean, counts: {decisions: N, messages: N, files: N}}. Token cost: ~5-10 tokens per check. Uses COUNT queries on t_decisions, t_agent_messages, t_file_changes with timestamp filtering. Enables efficient polling without full data retrieval.',
|
|
322
438
|
set_from_template: 'Set decision using template (FR-006). Params: template (required, template name), key (required), value (required), agent, layer (override), version, status (override), tags (override), scopes, plus any template-required fields. Applies template defaults (layer, status, tags) while allowing overrides. Validates required fields if specified by template. Returns: {success, key, key_id, version, template_used, applied_defaults, message}. Built-in templates: breaking_change, security_vulnerability, performance_optimization, deprecation, architecture_decision.',
|
|
323
439
|
create_template: 'Create new decision template (FR-006). Params: name (required, unique), defaults (required, object with layer/status/tags/priority), required_fields (optional, array of field names), created_by (optional, agent name). Returns: {success, template_id, template_name, message}. Example defaults: {"layer":"business","status":"active","tags":["breaking"]}. Validates layer/status values.',
|
|
324
|
-
list_templates: 'List all decision templates (FR-006). No params required. Returns: {templates: [{id, name, defaults, required_fields, created_by, created_at}], count}. Shows both built-in and custom templates.'
|
|
440
|
+
list_templates: 'List all decision templates (FR-006). No params required. Returns: {templates: [{id, name, defaults, required_fields, created_by, created_at}], count}. Shows both built-in and custom templates.',
|
|
441
|
+
hard_delete: 'Permanently delete a decision (hard delete). Params: key (required). WARNING: IRREVERSIBLE - removes all records including version history, tags, scopes. Use cases: manual cleanup after decision-to-task migration, remove test/debug decisions, purge sensitive data. Unlike soft delete (status=deprecated), this completely removes from database. Idempotent - safe to call even if already deleted. Returns: {success, key, message}.'
|
|
325
442
|
},
|
|
326
443
|
examples: {
|
|
327
444
|
set: '{ action: "set", key: "auth_method", value: "jwt", tags: ["security"] }',
|
|
@@ -334,7 +451,146 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
334
451
|
has_updates: '{ action: "has_updates", agent_name: "my-agent", since_timestamp: "2025-10-14T08:00:00Z" }',
|
|
335
452
|
set_from_template: '{ action: "set_from_template", template: "breaking_change", key: "oscillator-type-moved", value: "oscillator_type moved to MonophonicSynthConfig" }',
|
|
336
453
|
create_template: '{ action: "create_template", name: "bug_fix", defaults: {"layer":"business","tags":["bug","fix"],"status":"active"}, created_by: "my-agent" }',
|
|
337
|
-
list_templates: '{ action: "list_templates" }'
|
|
454
|
+
list_templates: '{ action: "list_templates" }',
|
|
455
|
+
hard_delete: '{ action: "hard_delete", key: "task_old_authentication_refactor" }'
|
|
456
|
+
},
|
|
457
|
+
documentation: {
|
|
458
|
+
tool_selection: 'docs/TOOL_SELECTION.md - Decision tree, tool comparison, when to use each tool (236 lines, ~12k tokens)',
|
|
459
|
+
tool_reference: 'docs/TOOL_REFERENCE.md - Parameter requirements, batch operations, templates (471 lines, ~24k tokens)',
|
|
460
|
+
workflows: 'docs/WORKFLOWS.md - Multi-step workflow examples, multi-agent coordination (602 lines, ~30k tokens)',
|
|
461
|
+
best_practices: 'docs/BEST_PRACTICES.md - Common errors, best practices, troubleshooting (345 lines, ~17k tokens)',
|
|
462
|
+
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions, enum values (status/layer/priority), atomic mode (339 lines, ~17k tokens)'
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
break;
|
|
466
|
+
case 'example':
|
|
467
|
+
result = {
|
|
468
|
+
tool: 'decision',
|
|
469
|
+
description: 'Comprehensive decision tool examples without needing WebFetch access',
|
|
470
|
+
scenarios: {
|
|
471
|
+
basic_usage: {
|
|
472
|
+
title: 'Basic Decision Management',
|
|
473
|
+
examples: [
|
|
474
|
+
{
|
|
475
|
+
scenario: 'Record API design decision',
|
|
476
|
+
request: '{ action: "set", key: "api_auth_method", value: "JWT with refresh tokens", layer: "business", tags: ["api", "security", "authentication"] }',
|
|
477
|
+
explanation: 'Documents the choice of authentication method for the API'
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
scenario: 'Retrieve a decision',
|
|
481
|
+
request: '{ action: "get", key: "api_auth_method" }',
|
|
482
|
+
response_structure: '{ key, value, layer, status, version, tags, scopes, decided_by, updated_at }'
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
scenario: 'List all active decisions',
|
|
486
|
+
request: '{ action: "list", status: "active", limit: 20 }',
|
|
487
|
+
explanation: 'Returns active decisions with metadata for browsing'
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
},
|
|
491
|
+
advanced_filtering: {
|
|
492
|
+
title: 'Advanced Search and Filtering',
|
|
493
|
+
examples: [
|
|
494
|
+
{
|
|
495
|
+
scenario: 'Find all security-related decisions in business layer',
|
|
496
|
+
request: '{ action: "search_advanced", layers: ["business"], tags_any: ["security", "authentication"], status: ["active"], sort_by: "updated", sort_order: "desc" }',
|
|
497
|
+
explanation: 'Combines layer filtering, tag matching, and sorting'
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
scenario: 'Search within API scope with multiple tags',
|
|
501
|
+
request: '{ action: "search_advanced", scopes: ["api/*"], tags_all: ["breaking", "v2.0"], updated_after: "2025-01-01" }',
|
|
502
|
+
explanation: 'Uses scope wildcards and timestamp filtering for recent breaking changes'
|
|
503
|
+
}
|
|
504
|
+
]
|
|
505
|
+
},
|
|
506
|
+
versioning_workflow: {
|
|
507
|
+
title: 'Version Management',
|
|
508
|
+
steps: [
|
|
509
|
+
{
|
|
510
|
+
step: 1,
|
|
511
|
+
action: 'Create initial decision',
|
|
512
|
+
request: '{ action: "set", key: "database_choice", value: "PostgreSQL", layer: "data", version: "1.0.0", tags: ["database"] }'
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
step: 2,
|
|
516
|
+
action: 'Update decision (creates new version)',
|
|
517
|
+
request: '{ action: "set", key: "database_choice", value: "PostgreSQL with read replicas", layer: "data", version: "1.1.0", tags: ["database", "scaling"] }'
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
step: 3,
|
|
521
|
+
action: 'View version history',
|
|
522
|
+
request: '{ action: "versions", key: "database_choice" }',
|
|
523
|
+
result: 'Returns all versions with timestamps and changes'
|
|
524
|
+
}
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
batch_operations: {
|
|
528
|
+
title: 'Batch Decision Management',
|
|
529
|
+
examples: [
|
|
530
|
+
{
|
|
531
|
+
scenario: 'Record multiple related decisions atomically',
|
|
532
|
+
request: '{ action: "set_batch", decisions: [{"key": "cache_layer", "value": "Redis", "layer": "infrastructure"}, {"key": "cache_ttl", "value": "3600", "layer": "infrastructure"}], atomic: true }',
|
|
533
|
+
explanation: 'All decisions succeed or all fail together (atomic mode)'
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
scenario: 'Best-effort batch insert',
|
|
537
|
+
request: '{ action: "set_batch", decisions: [{...}, {...}, {...}], atomic: false }',
|
|
538
|
+
explanation: 'Each decision processed independently - partial success allowed'
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
},
|
|
542
|
+
templates: {
|
|
543
|
+
title: 'Using Decision Templates',
|
|
544
|
+
examples: [
|
|
545
|
+
{
|
|
546
|
+
scenario: 'Use built-in breaking_change template',
|
|
547
|
+
request: '{ action: "set_from_template", template: "breaking_change", key: "api_remove_legacy_endpoint", value: "Removed /v1/users endpoint - migrate to /v2/users" }',
|
|
548
|
+
explanation: 'Automatically applies layer=business, tags=["breaking"], status=active'
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
scenario: 'Create custom template',
|
|
552
|
+
request: '{ action: "create_template", name: "feature_flag", defaults: {"layer": "presentation", "tags": ["feature-flag"], "status": "draft"}, created_by: "backend-team" }',
|
|
553
|
+
explanation: 'Define reusable templates for common decision patterns'
|
|
554
|
+
}
|
|
555
|
+
]
|
|
556
|
+
},
|
|
557
|
+
quick_set_inference: {
|
|
558
|
+
title: 'Quick Set with Smart Defaults',
|
|
559
|
+
examples: [
|
|
560
|
+
{
|
|
561
|
+
scenario: 'Auto-infer layer from key prefix',
|
|
562
|
+
request: '{ action: "quick_set", key: "api/instruments/oscillator-refactor", value: "Moved oscillator_type to MonophonicSynthConfig" }',
|
|
563
|
+
inferred: 'layer=presentation (from api/*), tags=["instruments", "oscillator-refactor"], scope=api/instruments'
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
scenario: 'Database decision with auto-inference',
|
|
567
|
+
request: '{ action: "quick_set", key: "db/users/add-email-index", value: "Added index on email column" }',
|
|
568
|
+
inferred: 'layer=data (from db/*), tags=["users", "add-email-index"]'
|
|
569
|
+
}
|
|
570
|
+
]
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
best_practices: {
|
|
574
|
+
key_naming: [
|
|
575
|
+
'Use hierarchical keys: "api/users/authentication"',
|
|
576
|
+
'Prefix with layer hint: api/* → presentation, db/* → data, service/* → business',
|
|
577
|
+
'Use descriptive names that explain the decision context'
|
|
578
|
+
],
|
|
579
|
+
tagging: [
|
|
580
|
+
'Tag with relevant categories: security, performance, breaking, etc.',
|
|
581
|
+
'Include version tags for release-specific decisions',
|
|
582
|
+
'Use consistent tag naming conventions across team'
|
|
583
|
+
],
|
|
584
|
+
versioning: [
|
|
585
|
+
'Use semantic versioning: 1.0.0, 1.1.0, 2.0.0',
|
|
586
|
+
'Increment major version for breaking changes',
|
|
587
|
+
'Document rationale in decision value text'
|
|
588
|
+
],
|
|
589
|
+
cleanup: [
|
|
590
|
+
'Mark deprecated decisions with status="deprecated"',
|
|
591
|
+
'Use hard_delete only for sensitive data or migration cleanup',
|
|
592
|
+
'Link related decisions using scopes'
|
|
593
|
+
]
|
|
338
594
|
}
|
|
339
595
|
};
|
|
340
596
|
break;
|
|
@@ -370,6 +626,115 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
370
626
|
get: '{ action: "get", agent_name: "bot1", unread_only: true }',
|
|
371
627
|
mark_read: '{ action: "mark_read", agent_name: "bot1", message_ids: [1, 2, 3] }',
|
|
372
628
|
send_batch: '{ action: "send_batch", messages: [{"from_agent": "bot1", "msg_type": "info", "message": "Task 1 done"}, {"from_agent": "bot1", "msg_type": "info", "message": "Task 2 done"}], atomic: true }'
|
|
629
|
+
},
|
|
630
|
+
documentation: {
|
|
631
|
+
workflows: 'docs/WORKFLOWS.md - Multi-agent coordination, messaging patterns, cross-session handoffs (602 lines, ~30k tokens)',
|
|
632
|
+
tool_reference: 'docs/TOOL_REFERENCE.md - Message tool parameters, batch operations (471 lines, ~24k tokens)',
|
|
633
|
+
shared_concepts: 'docs/SHARED_CONCEPTS.md - Enum values (msg_type/priority), atomic mode (339 lines, ~17k tokens)',
|
|
634
|
+
best_practices: 'docs/BEST_PRACTICES.md - Common errors, messaging best practices (345 lines, ~17k tokens)'
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
break;
|
|
638
|
+
case 'example':
|
|
639
|
+
result = {
|
|
640
|
+
tool: 'message',
|
|
641
|
+
description: 'Comprehensive messaging examples for multi-agent coordination',
|
|
642
|
+
scenarios: {
|
|
643
|
+
basic_messaging: {
|
|
644
|
+
title: 'Basic Agent Communication',
|
|
645
|
+
examples: [
|
|
646
|
+
{
|
|
647
|
+
scenario: 'Send info message between agents',
|
|
648
|
+
request: '{ action: "send", from_agent: "backend-agent", to_agent: "frontend-agent", msg_type: "info", message: "API endpoint /users is ready" }',
|
|
649
|
+
explanation: 'Direct message from one agent to another'
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
scenario: 'Broadcast message to all agents',
|
|
653
|
+
request: '{ action: "send", from_agent: "coordinator", to_agent: null, msg_type: "info", message: "Deployment starting in 5 minutes", priority: "high" }',
|
|
654
|
+
explanation: 'null to_agent broadcasts to all agents'
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
scenario: 'Get unread messages',
|
|
658
|
+
request: '{ action: "get", agent_name: "frontend-agent", unread_only: true }',
|
|
659
|
+
explanation: 'Retrieve only unread messages for an agent'
|
|
660
|
+
}
|
|
661
|
+
]
|
|
662
|
+
},
|
|
663
|
+
priority_messaging: {
|
|
664
|
+
title: 'Priority-Based Communication',
|
|
665
|
+
examples: [
|
|
666
|
+
{
|
|
667
|
+
scenario: 'Critical error notification',
|
|
668
|
+
request: '{ action: "send", from_agent: "monitoring-agent", msg_type: "warning", message: "Database connection lost", priority: "critical" }',
|
|
669
|
+
explanation: 'High-priority messages for urgent issues'
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
scenario: 'Filter by priority',
|
|
673
|
+
request: '{ action: "get", agent_name: "ops-agent", priority_filter: "critical" }',
|
|
674
|
+
explanation: 'Get only critical priority messages'
|
|
675
|
+
}
|
|
676
|
+
]
|
|
677
|
+
},
|
|
678
|
+
workflow_coordination: {
|
|
679
|
+
title: 'Multi-Step Workflow',
|
|
680
|
+
steps: [
|
|
681
|
+
{
|
|
682
|
+
step: 1,
|
|
683
|
+
action: 'Agent A requests work from Agent B',
|
|
684
|
+
request: '{ action: "send", from_agent: "agent-a", to_agent: "agent-b", msg_type: "request", message: "Please process user data batch-123" }'
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
step: 2,
|
|
688
|
+
action: 'Agent B checks messages',
|
|
689
|
+
request: '{ action: "get", agent_name: "agent-b", msg_type_filter: "request", unread_only: true }'
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
step: 3,
|
|
693
|
+
action: 'Agent B marks as read and processes',
|
|
694
|
+
request: '{ action: "mark_read", agent_name: "agent-b", message_ids: [123] }'
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
step: 4,
|
|
698
|
+
action: 'Agent B sends completion notification',
|
|
699
|
+
request: '{ action: "send", from_agent: "agent-b", to_agent: "agent-a", msg_type: "info", message: "Batch-123 processing complete" }'
|
|
700
|
+
}
|
|
701
|
+
]
|
|
702
|
+
},
|
|
703
|
+
batch_messaging: {
|
|
704
|
+
title: 'Batch Message Operations',
|
|
705
|
+
examples: [
|
|
706
|
+
{
|
|
707
|
+
scenario: 'Send multiple status updates atomically',
|
|
708
|
+
request: '{ action: "send_batch", messages: [{"from_agent": "worker-1", "msg_type": "info", "message": "Task 1 done"}, {"from_agent": "worker-1", "msg_type": "info", "message": "Task 2 done"}], atomic: true }',
|
|
709
|
+
explanation: 'All messages sent or none (atomic mode)'
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
scenario: 'Best-effort batch sending',
|
|
713
|
+
request: '{ action: "send_batch", messages: [{...}, {...}], atomic: false }',
|
|
714
|
+
explanation: 'Each message sent independently - partial success allowed'
|
|
715
|
+
}
|
|
716
|
+
]
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
best_practices: {
|
|
720
|
+
message_types: [
|
|
721
|
+
'Use "decision" for recording important choices',
|
|
722
|
+
'Use "warning" for errors or issues requiring attention',
|
|
723
|
+
'Use "request" for work requests between agents',
|
|
724
|
+
'Use "info" for status updates and notifications'
|
|
725
|
+
],
|
|
726
|
+
priority_usage: [
|
|
727
|
+
'critical: System failures, data loss, security breaches',
|
|
728
|
+
'high: Important but not emergency (deployment notifications)',
|
|
729
|
+
'medium: Regular coordination messages (default)',
|
|
730
|
+
'low: Optional information, logging'
|
|
731
|
+
],
|
|
732
|
+
coordination_patterns: [
|
|
733
|
+
'Always mark messages as read after processing',
|
|
734
|
+
'Use broadcast (to_agent=null) for system-wide announcements',
|
|
735
|
+
'Filter by msg_type when checking for specific message categories',
|
|
736
|
+
'Include context in message text or payload for debugging'
|
|
737
|
+
]
|
|
373
738
|
}
|
|
374
739
|
};
|
|
375
740
|
break;
|
|
@@ -405,6 +770,106 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
405
770
|
get: '{ action: "get", agent_name: "refactor-bot", layer: "infrastructure", limit: 10 }',
|
|
406
771
|
check_lock: '{ action: "check_lock", file_path: "src/index.ts", lock_duration: 300 }',
|
|
407
772
|
record_batch: '{ action: "record_batch", file_changes: [{"file_path": "src/types.ts", "agent_name": "bot1", "change_type": "modified", "layer": "data"}, {"file_path": "src/index.ts", "agent_name": "bot1", "change_type": "modified", "layer": "infrastructure"}], atomic: true }'
|
|
773
|
+
},
|
|
774
|
+
documentation: {
|
|
775
|
+
workflows: 'docs/WORKFLOWS.md - File locking patterns, concurrent file access workflows (602 lines, ~30k tokens)',
|
|
776
|
+
tool_reference: 'docs/TOOL_REFERENCE.md - File tool parameters, batch operations (471 lines, ~24k tokens)',
|
|
777
|
+
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions, enum values (change_type), atomic mode (339 lines, ~17k tokens)',
|
|
778
|
+
best_practices: 'docs/BEST_PRACTICES.md - File tracking best practices (345 lines, ~17k tokens)'
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
break;
|
|
782
|
+
case 'example':
|
|
783
|
+
result = {
|
|
784
|
+
tool: 'file',
|
|
785
|
+
description: 'Comprehensive file tracking examples for multi-agent coordination',
|
|
786
|
+
scenarios: {
|
|
787
|
+
basic_tracking: {
|
|
788
|
+
title: 'Basic File Change Tracking',
|
|
789
|
+
examples: [
|
|
790
|
+
{
|
|
791
|
+
scenario: 'Record file modification',
|
|
792
|
+
request: '{ action: "record", file_path: "src/api/users.ts", agent_name: "refactor-agent", change_type: "modified", layer: "business", description: "Added email validation" }',
|
|
793
|
+
explanation: 'Track changes with layer and description'
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
scenario: 'Get recent changes by agent',
|
|
797
|
+
request: '{ action: "get", agent_name: "refactor-agent", limit: 10 }',
|
|
798
|
+
explanation: 'View what an agent has been working on'
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
scenario: 'Track changes to specific file',
|
|
802
|
+
request: '{ action: "get", file_path: "src/api/users.ts" }',
|
|
803
|
+
explanation: 'See all modifications to a particular file'
|
|
804
|
+
}
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
file_locking: {
|
|
808
|
+
title: 'Concurrent Access Prevention',
|
|
809
|
+
workflow: [
|
|
810
|
+
{
|
|
811
|
+
step: 1,
|
|
812
|
+
action: 'Check if file is locked',
|
|
813
|
+
request: '{ action: "check_lock", file_path: "src/database/schema.sql", lock_duration: 300 }',
|
|
814
|
+
result: '{ locked: false } or { locked: true, locked_by: "agent-name", locked_at: "timestamp" }'
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
step: 2,
|
|
818
|
+
action: 'If not locked, record change (creates lock)',
|
|
819
|
+
request: '{ action: "record", file_path: "src/database/schema.sql", agent_name: "migration-agent", change_type: "modified" }'
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
step: 3,
|
|
823
|
+
action: 'Lock expires after 5 minutes (default) or specified duration'
|
|
824
|
+
}
|
|
825
|
+
]
|
|
826
|
+
},
|
|
827
|
+
layer_organization: {
|
|
828
|
+
title: 'Tracking by Architecture Layer',
|
|
829
|
+
examples: [
|
|
830
|
+
{
|
|
831
|
+
scenario: 'Get all presentation layer changes',
|
|
832
|
+
request: '{ action: "get", layer: "presentation", limit: 20 }',
|
|
833
|
+
explanation: 'View frontend/UI changes across agents'
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
scenario: 'Track infrastructure changes',
|
|
837
|
+
request: '{ action: "get", layer: "infrastructure", change_type: "modified" }',
|
|
838
|
+
explanation: 'Monitor config and deployment file changes'
|
|
839
|
+
}
|
|
840
|
+
]
|
|
841
|
+
},
|
|
842
|
+
batch_tracking: {
|
|
843
|
+
title: 'Batch File Operations',
|
|
844
|
+
examples: [
|
|
845
|
+
{
|
|
846
|
+
scenario: 'Record multiple file changes atomically',
|
|
847
|
+
request: '{ action: "record_batch", file_changes: [{"file_path": "src/api.ts", "agent_name": "bot1", "change_type": "modified", "layer": "presentation"}, {"file_path": "src/types.ts", "agent_name": "bot1", "change_type": "modified", "layer": "data"}], atomic: true }',
|
|
848
|
+
explanation: 'All changes recorded or none (transaction)'
|
|
849
|
+
}
|
|
850
|
+
]
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
best_practices: {
|
|
854
|
+
change_tracking: [
|
|
855
|
+
'Always specify layer for better organization',
|
|
856
|
+
'Include description for non-obvious changes',
|
|
857
|
+
'Use check_lock before modifying shared files',
|
|
858
|
+
'Track both creation and deletion of files'
|
|
859
|
+
],
|
|
860
|
+
lock_management: [
|
|
861
|
+
'Default lock duration is 300 seconds (5 minutes)',
|
|
862
|
+
'Locks prevent concurrent modifications',
|
|
863
|
+
'Locks auto-expire - no manual unlock needed',
|
|
864
|
+
'Use appropriate lock_duration for operation complexity'
|
|
865
|
+
],
|
|
866
|
+
layer_assignment: [
|
|
867
|
+
'presentation: UI components, API controllers',
|
|
868
|
+
'business: Services, domain logic',
|
|
869
|
+
'data: Models, repositories, migrations',
|
|
870
|
+
'infrastructure: Config, deployment, CI/CD',
|
|
871
|
+
'cross-cutting: Utilities used across layers'
|
|
872
|
+
]
|
|
408
873
|
}
|
|
409
874
|
};
|
|
410
875
|
break;
|
|
@@ -435,6 +900,148 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
435
900
|
add: '{ action: "add", category: "performance", constraint_text: "API response time <100ms", priority: "high", tags: ["api"] }',
|
|
436
901
|
get: '{ action: "get", category: "performance", active_only: true }',
|
|
437
902
|
deactivate: '{ action: "deactivate", constraint_id: 5 }'
|
|
903
|
+
},
|
|
904
|
+
documentation: {
|
|
905
|
+
tool_selection: 'docs/TOOL_SELECTION.md - Decision tree, constraint vs decision comparison (236 lines, ~12k tokens)',
|
|
906
|
+
workflows: 'docs/WORKFLOWS.md - Constraint validation workflows, requirement tracking (602 lines, ~30k tokens)',
|
|
907
|
+
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions, enum values (category/priority) (339 lines, ~17k tokens)',
|
|
908
|
+
best_practices: 'docs/BEST_PRACTICES.md - When to use constraints, common patterns (345 lines, ~17k tokens)'
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
break;
|
|
912
|
+
case 'example':
|
|
913
|
+
result = {
|
|
914
|
+
tool: 'constraint',
|
|
915
|
+
description: 'Comprehensive constraint examples for various use cases',
|
|
916
|
+
categories: {
|
|
917
|
+
performance: {
|
|
918
|
+
description: 'Performance-related constraints for response times, throughput, resource usage',
|
|
919
|
+
examples: [
|
|
920
|
+
{
|
|
921
|
+
scenario: 'API Response Time',
|
|
922
|
+
example: '{ action: "add", category: "performance", constraint_text: "All API endpoints must respond within 100ms for 95th percentile", priority: "high", layer: "business", tags: ["api", "latency"] }',
|
|
923
|
+
rationale: 'Ensures fast user experience and prevents timeout issues'
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
scenario: 'Database Query Performance',
|
|
927
|
+
example: '{ action: "add", category: "performance", constraint_text: "Database queries must complete within 50ms", priority: "high", layer: "data", tags: ["database", "query"] }',
|
|
928
|
+
rationale: 'Prevents database bottlenecks and ensures scalability'
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
scenario: 'Memory Usage',
|
|
932
|
+
example: '{ action: "add", category: "performance", constraint_text: "Peak memory usage must not exceed 512MB per instance", priority: "critical", layer: "infrastructure", tags: ["memory", "resource"] }',
|
|
933
|
+
rationale: 'Prevents out-of-memory errors in containerized environments'
|
|
934
|
+
}
|
|
935
|
+
]
|
|
936
|
+
},
|
|
937
|
+
architecture: {
|
|
938
|
+
description: 'Architectural constraints for code structure, dependencies, patterns',
|
|
939
|
+
examples: [
|
|
940
|
+
{
|
|
941
|
+
scenario: 'Layer Dependency Rules',
|
|
942
|
+
example: '{ action: "add", category: "architecture", constraint_text: "Presentation layer must not directly access data layer - use business layer only", priority: "critical", layer: "cross-cutting", tags: ["layering", "separation"] }',
|
|
943
|
+
rationale: 'Enforces clean architecture and separation of concerns'
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
scenario: 'Dependency Injection',
|
|
947
|
+
example: '{ action: "add", category: "architecture", constraint_text: "All service classes must use constructor-based dependency injection", priority: "medium", layer: "business", tags: ["di", "testability"] }',
|
|
948
|
+
rationale: 'Improves testability and reduces coupling'
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
scenario: 'API Versioning',
|
|
952
|
+
example: '{ action: "add", category: "architecture", constraint_text: "All public APIs must include version prefix (e.g., /v1/, /v2/)", priority: "high", layer: "presentation", tags: ["api", "versioning"] }',
|
|
953
|
+
rationale: 'Enables backward compatibility and smooth API evolution'
|
|
954
|
+
}
|
|
955
|
+
]
|
|
956
|
+
},
|
|
957
|
+
security: {
|
|
958
|
+
description: 'Security constraints for authentication, authorization, data protection',
|
|
959
|
+
examples: [
|
|
960
|
+
{
|
|
961
|
+
scenario: 'Authentication Required',
|
|
962
|
+
example: '{ action: "add", category: "security", constraint_text: "All non-public endpoints must require JWT authentication", priority: "critical", layer: "presentation", tags: ["auth", "jwt"] }',
|
|
963
|
+
rationale: 'Prevents unauthorized access to protected resources'
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
scenario: 'Data Encryption',
|
|
967
|
+
example: '{ action: "add", category: "security", constraint_text: "All PII (Personally Identifiable Information) must be encrypted at rest using AES-256", priority: "critical", layer: "data", tags: ["encryption", "pii"] }',
|
|
968
|
+
rationale: 'Protects sensitive data and ensures compliance'
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
scenario: 'Input Validation',
|
|
972
|
+
example: '{ action: "add", category: "security", constraint_text: "All user inputs must be validated and sanitized before processing", priority: "critical", layer: "presentation", tags: ["validation", "injection-prevention"] }',
|
|
973
|
+
rationale: 'Prevents injection attacks (SQL, XSS, etc.)'
|
|
974
|
+
}
|
|
975
|
+
]
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
workflows: {
|
|
979
|
+
constraint_validation: {
|
|
980
|
+
description: 'Workflow for validating code against constraints',
|
|
981
|
+
steps: [
|
|
982
|
+
{
|
|
983
|
+
step: 1,
|
|
984
|
+
action: 'Retrieve active constraints for layer',
|
|
985
|
+
example: '{ action: "get", layer: "business", active_only: true }'
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
step: 2,
|
|
989
|
+
action: 'Check code changes against constraints',
|
|
990
|
+
example: 'Review file changes and verify compliance with each constraint'
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
step: 3,
|
|
994
|
+
action: 'Report violations',
|
|
995
|
+
example: 'Use message tool to send warnings for constraint violations'
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
step: 4,
|
|
999
|
+
action: 'Link violations to tasks',
|
|
1000
|
+
example: 'Create tasks to fix violations and link to relevant constraints'
|
|
1001
|
+
}
|
|
1002
|
+
]
|
|
1003
|
+
},
|
|
1004
|
+
requirement_tracking: {
|
|
1005
|
+
description: 'Workflow for tracking requirements as constraints',
|
|
1006
|
+
steps: [
|
|
1007
|
+
{
|
|
1008
|
+
step: 1,
|
|
1009
|
+
action: 'Add requirement as constraint',
|
|
1010
|
+
example: '{ action: "add", category: "performance", constraint_text: "System must handle 1000 concurrent users", priority: "high", tags: ["requirement", "load"] }'
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
step: 2,
|
|
1014
|
+
action: 'Link related decisions',
|
|
1015
|
+
example: 'Use decision tool to record architectural decisions that address the constraint'
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
step: 3,
|
|
1019
|
+
action: 'Create implementation tasks',
|
|
1020
|
+
example: 'Use task tool to break down implementation and link to constraint'
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
step: 4,
|
|
1024
|
+
action: 'Validate compliance',
|
|
1025
|
+
example: 'Test implementation against constraint criteria'
|
|
1026
|
+
}
|
|
1027
|
+
]
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
best_practices: {
|
|
1031
|
+
writing_constraints: [
|
|
1032
|
+
'Be specific and measurable (use numbers, percentages, time limits)',
|
|
1033
|
+
'Include rationale in tags or separate documentation',
|
|
1034
|
+
'Use appropriate priority (critical for must-have, high for important, medium/low for nice-to-have)',
|
|
1035
|
+
'Assign to correct layer (where constraint is enforced)',
|
|
1036
|
+
'Tag comprehensively for easy retrieval'
|
|
1037
|
+
],
|
|
1038
|
+
managing_constraints: [
|
|
1039
|
+
'Review constraints regularly and deactivate outdated ones',
|
|
1040
|
+
'Link constraints to related decisions and tasks',
|
|
1041
|
+
'Use constraints for both technical and business requirements',
|
|
1042
|
+
'Validate code changes against active constraints',
|
|
1043
|
+
'Document constraint violations and remediation plans'
|
|
1044
|
+
]
|
|
438
1045
|
}
|
|
439
1046
|
};
|
|
440
1047
|
break;
|
|
@@ -460,21 +1067,132 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
460
1067
|
limit: params.limit,
|
|
461
1068
|
});
|
|
462
1069
|
break;
|
|
1070
|
+
case 'flush':
|
|
1071
|
+
result = flushWAL();
|
|
1072
|
+
break;
|
|
463
1073
|
case 'help':
|
|
464
1074
|
result = {
|
|
465
1075
|
tool: 'stats',
|
|
466
|
-
description: 'View database statistics, activity logs,
|
|
1076
|
+
description: 'View database statistics, activity logs, manage data cleanup, and WAL checkpoints',
|
|
467
1077
|
actions: {
|
|
468
1078
|
layer_summary: 'Get summary by layer. No params required',
|
|
469
1079
|
db_stats: 'Get database statistics. No params required',
|
|
470
1080
|
clear: 'Clear old data. Params: messages_older_than_hours, file_changes_older_than_days',
|
|
471
|
-
activity_log: 'Get activity log (v3.0.0). Params: since (e.g., "5m", "1h", "2d"), agent_names (array or ["*"]), actions (filter by action types), limit (default: 100)'
|
|
1081
|
+
activity_log: 'Get activity log (v3.0.0). Params: since (e.g., "5m", "1h", "2d"), agent_names (array or ["*"]), actions (filter by action types), limit (default: 100)',
|
|
1082
|
+
flush: 'Force WAL checkpoint to flush pending transactions to main database file. No params required. Uses TRUNCATE mode for complete flush. Useful before git commits to ensure database file is up-to-date.'
|
|
472
1083
|
},
|
|
473
1084
|
examples: {
|
|
474
1085
|
layer_summary: '{ action: "layer_summary" }',
|
|
475
1086
|
db_stats: '{ action: "db_stats" }',
|
|
476
1087
|
clear: '{ action: "clear", messages_older_than_hours: 48, file_changes_older_than_days: 14 }',
|
|
477
|
-
activity_log: '{ action: "activity_log", since: "1h", agent_names: ["bot1", "bot2"], limit: 50 }'
|
|
1088
|
+
activity_log: '{ action: "activity_log", since: "1h", agent_names: ["bot1", "bot2"], limit: 50 }',
|
|
1089
|
+
flush: '{ action: "flush" }'
|
|
1090
|
+
},
|
|
1091
|
+
documentation: {
|
|
1092
|
+
workflows: 'docs/WORKFLOWS.md - Activity monitoring, automatic cleanup workflows (602 lines, ~30k tokens)',
|
|
1093
|
+
best_practices: 'docs/BEST_PRACTICES.md - Database health, cleanup strategies (345 lines, ~17k tokens)',
|
|
1094
|
+
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions for layer_summary (339 lines, ~17k tokens)',
|
|
1095
|
+
architecture: 'docs/ARCHITECTURE.md - Database schema, views, statistics tables'
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
break;
|
|
1099
|
+
case 'example':
|
|
1100
|
+
result = {
|
|
1101
|
+
tool: 'stats',
|
|
1102
|
+
description: 'Database statistics and maintenance examples',
|
|
1103
|
+
scenarios: {
|
|
1104
|
+
layer_analysis: {
|
|
1105
|
+
title: 'Architecture Layer Summary',
|
|
1106
|
+
example: {
|
|
1107
|
+
request: '{ action: "layer_summary" }',
|
|
1108
|
+
response_structure: '{ layer: string, decision_count: number, file_changes: number, active_constraints: number }[]',
|
|
1109
|
+
use_case: 'Understand which layers have most activity and decisions'
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
database_health: {
|
|
1113
|
+
title: 'Database Statistics',
|
|
1114
|
+
example: {
|
|
1115
|
+
request: '{ action: "db_stats" }',
|
|
1116
|
+
response_structure: '{ decisions: N, messages: N, file_changes: N, constraints: N, db_size_mb: N }',
|
|
1117
|
+
use_case: 'Monitor database growth and table sizes'
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
activity_monitoring: {
|
|
1121
|
+
title: 'Activity Log Queries',
|
|
1122
|
+
examples: [
|
|
1123
|
+
{
|
|
1124
|
+
scenario: 'Recent activity (last hour)',
|
|
1125
|
+
request: '{ action: "activity_log", since: "1h", limit: 50 }',
|
|
1126
|
+
explanation: 'View all agent activity in the past hour'
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
scenario: 'Specific agent activity',
|
|
1130
|
+
request: '{ action: "activity_log", since: "24h", agent_names: ["backend-agent", "frontend-agent"] }',
|
|
1131
|
+
explanation: 'Track what specific agents have been doing'
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
scenario: 'Filter by action type',
|
|
1135
|
+
request: '{ action: "activity_log", since: "2d", actions: ["set_decision", "create_task"] }',
|
|
1136
|
+
explanation: 'See only specific types of actions'
|
|
1137
|
+
}
|
|
1138
|
+
]
|
|
1139
|
+
},
|
|
1140
|
+
data_cleanup: {
|
|
1141
|
+
title: 'Maintenance and Cleanup',
|
|
1142
|
+
examples: [
|
|
1143
|
+
{
|
|
1144
|
+
scenario: 'Manual cleanup with specific retention',
|
|
1145
|
+
request: '{ action: "clear", messages_older_than_hours: 48, file_changes_older_than_days: 14 }',
|
|
1146
|
+
explanation: 'Override config and delete old data'
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
scenario: 'Config-based automatic cleanup',
|
|
1150
|
+
request: '{ action: "clear" }',
|
|
1151
|
+
explanation: 'Use configured retention settings (respects weekend-aware mode)'
|
|
1152
|
+
}
|
|
1153
|
+
]
|
|
1154
|
+
},
|
|
1155
|
+
wal_management: {
|
|
1156
|
+
title: 'WAL Checkpoint (Git Workflow)',
|
|
1157
|
+
workflow: [
|
|
1158
|
+
{
|
|
1159
|
+
step: 1,
|
|
1160
|
+
action: 'Make changes to context (decisions, tasks, etc.)',
|
|
1161
|
+
explanation: 'SQLite WAL mode keeps changes in separate file'
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
step: 2,
|
|
1165
|
+
action: 'Before git commit, flush WAL',
|
|
1166
|
+
request: '{ action: "flush" }',
|
|
1167
|
+
explanation: 'Merges WAL changes into main .db file'
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
step: 3,
|
|
1171
|
+
action: 'Commit database file',
|
|
1172
|
+
explanation: 'Database file now contains all changes for version control'
|
|
1173
|
+
}
|
|
1174
|
+
]
|
|
1175
|
+
}
|
|
1176
|
+
},
|
|
1177
|
+
best_practices: {
|
|
1178
|
+
monitoring: [
|
|
1179
|
+
'Check layer_summary regularly to identify hotspots',
|
|
1180
|
+
'Monitor db_stats to prevent database bloat',
|
|
1181
|
+
'Use activity_log for debugging multi-agent issues',
|
|
1182
|
+
'Set appropriate retention periods based on project needs'
|
|
1183
|
+
],
|
|
1184
|
+
cleanup: [
|
|
1185
|
+
'Run periodic cleanup to manage database size',
|
|
1186
|
+
'Use weekend-aware mode for business hour retention',
|
|
1187
|
+
'Consider longer retention for important decisions',
|
|
1188
|
+
'Test cleanup with manual parameters before automating'
|
|
1189
|
+
],
|
|
1190
|
+
wal_checkpoints: [
|
|
1191
|
+
'Always flush before git commits for clean diffs',
|
|
1192
|
+
'WAL mode improves concurrent access performance',
|
|
1193
|
+
'Checkpoint automatically happens on shutdown',
|
|
1194
|
+
'Manual flush ensures immediate persistence'
|
|
1195
|
+
]
|
|
478
1196
|
}
|
|
479
1197
|
};
|
|
480
1198
|
break;
|
|
@@ -500,6 +1218,291 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
500
1218
|
examples: {
|
|
501
1219
|
get: '{ action: "get" }',
|
|
502
1220
|
update: '{ action: "update", ignoreWeekend: true, messageRetentionHours: 48 }'
|
|
1221
|
+
},
|
|
1222
|
+
documentation: {
|
|
1223
|
+
shared_concepts: 'docs/SHARED_CONCEPTS.md - Weekend-aware retention behavior explained (339 lines, ~17k tokens)',
|
|
1224
|
+
best_practices: 'docs/BEST_PRACTICES.md - Retention strategies, cleanup timing (345 lines, ~17k tokens)',
|
|
1225
|
+
architecture: 'docs/ARCHITECTURE.md - Auto-cleanup architecture, configuration system'
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
break;
|
|
1229
|
+
case 'example':
|
|
1230
|
+
result = {
|
|
1231
|
+
tool: 'config',
|
|
1232
|
+
description: 'Configuration management examples',
|
|
1233
|
+
scenarios: {
|
|
1234
|
+
view_config: {
|
|
1235
|
+
title: 'Current Configuration',
|
|
1236
|
+
example: {
|
|
1237
|
+
request: '{ action: "get" }',
|
|
1238
|
+
response: '{ ignoreWeekend: boolean, messageRetentionHours: number, fileHistoryRetentionDays: number }',
|
|
1239
|
+
explanation: 'View current auto-deletion settings'
|
|
1240
|
+
}
|
|
1241
|
+
},
|
|
1242
|
+
standard_retention: {
|
|
1243
|
+
title: 'Standard Time-Based Retention',
|
|
1244
|
+
example: {
|
|
1245
|
+
request: '{ action: "update", ignoreWeekend: false, messageRetentionHours: 24, fileHistoryRetentionDays: 7 }',
|
|
1246
|
+
explanation: 'Messages deleted after 24 hours, file history after 7 days (strict time-based)'
|
|
1247
|
+
}
|
|
1248
|
+
},
|
|
1249
|
+
weekend_aware: {
|
|
1250
|
+
title: 'Weekend-Aware Retention',
|
|
1251
|
+
example: {
|
|
1252
|
+
request: '{ action: "update", ignoreWeekend: true, messageRetentionHours: 24, fileHistoryRetentionDays: 7 }',
|
|
1253
|
+
explanation: 'On Monday, 24h retention = Friday (skips weekend)',
|
|
1254
|
+
scenario: 'Useful for business-hour contexts where weekend messages should persist'
|
|
1255
|
+
}
|
|
1256
|
+
},
|
|
1257
|
+
extended_retention: {
|
|
1258
|
+
title: 'Long-Term Project Retention',
|
|
1259
|
+
example: {
|
|
1260
|
+
request: '{ action: "update", messageRetentionHours: 168, fileHistoryRetentionDays: 90 }',
|
|
1261
|
+
explanation: '1 week message retention, 90 days file history (max allowed)',
|
|
1262
|
+
use_case: 'Long-running projects needing extended context'
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
retention_behavior: {
|
|
1267
|
+
ignoreWeekend_false: {
|
|
1268
|
+
description: 'Standard time-based retention',
|
|
1269
|
+
examples: [
|
|
1270
|
+
'24h on Monday = 24 hours ago (Sunday)',
|
|
1271
|
+
'24h on Friday = 24 hours ago (Thursday)',
|
|
1272
|
+
'Straightforward chronological deletion'
|
|
1273
|
+
]
|
|
1274
|
+
},
|
|
1275
|
+
ignoreWeekend_true: {
|
|
1276
|
+
description: 'Business-hours retention (skips Sat/Sun)',
|
|
1277
|
+
examples: [
|
|
1278
|
+
'24h on Monday = Friday (skips Sat/Sun)',
|
|
1279
|
+
'24h on Tuesday = Monday',
|
|
1280
|
+
'24h on Friday = Thursday',
|
|
1281
|
+
'24h on Saturday/Sunday = Friday',
|
|
1282
|
+
'Preserves weekend messages until Monday cleanup'
|
|
1283
|
+
]
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
best_practices: {
|
|
1287
|
+
choosing_retention: [
|
|
1288
|
+
'Short projects: 24h messages, 7d file history',
|
|
1289
|
+
'Medium projects: 72h messages, 14d file history',
|
|
1290
|
+
'Long projects: 168h (1 week) messages, 30-90d file history',
|
|
1291
|
+
'Use ignoreWeekend=true for business-hour focused work'
|
|
1292
|
+
],
|
|
1293
|
+
limits: [
|
|
1294
|
+
'messageRetentionHours: 1-168 (1 hour to 1 week)',
|
|
1295
|
+
'fileHistoryRetentionDays: 1-90',
|
|
1296
|
+
'Choose based on your projects needs and database size constraints'
|
|
1297
|
+
],
|
|
1298
|
+
cli_override: [
|
|
1299
|
+
'Can override config at server startup via CLI args',
|
|
1300
|
+
'--autodelete-ignore-weekend, --autodelete-message-hours, --autodelete-file-history-days',
|
|
1301
|
+
'Runtime updates via config tool take precedence over CLI'
|
|
1302
|
+
]
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
break;
|
|
1306
|
+
default: throw new Error(`Unknown action: ${params.action}`);
|
|
1307
|
+
}
|
|
1308
|
+
break;
|
|
1309
|
+
case 'task':
|
|
1310
|
+
switch (params.action) {
|
|
1311
|
+
case 'create':
|
|
1312
|
+
result = createTask(params);
|
|
1313
|
+
break;
|
|
1314
|
+
case 'update':
|
|
1315
|
+
result = updateTask(params);
|
|
1316
|
+
break;
|
|
1317
|
+
case 'get':
|
|
1318
|
+
result = getTask(params);
|
|
1319
|
+
break;
|
|
1320
|
+
case 'list':
|
|
1321
|
+
result = listTasks(params);
|
|
1322
|
+
break;
|
|
1323
|
+
case 'move':
|
|
1324
|
+
result = moveTask(params);
|
|
1325
|
+
break;
|
|
1326
|
+
case 'link':
|
|
1327
|
+
result = linkTask(params);
|
|
1328
|
+
break;
|
|
1329
|
+
case 'archive':
|
|
1330
|
+
result = archiveTask(params);
|
|
1331
|
+
break;
|
|
1332
|
+
case 'batch_create':
|
|
1333
|
+
result = batchCreateTasks({ tasks: params.tasks, atomic: params.atomic });
|
|
1334
|
+
break;
|
|
1335
|
+
case 'help':
|
|
1336
|
+
result = taskHelp();
|
|
1337
|
+
break;
|
|
1338
|
+
case 'example':
|
|
1339
|
+
result = {
|
|
1340
|
+
tool: 'task',
|
|
1341
|
+
description: 'Comprehensive task management examples for Kanban-style workflow',
|
|
1342
|
+
scenarios: {
|
|
1343
|
+
basic_task_management: {
|
|
1344
|
+
title: 'Creating and Managing Tasks',
|
|
1345
|
+
examples: [
|
|
1346
|
+
{
|
|
1347
|
+
scenario: 'Create a new task',
|
|
1348
|
+
request: '{ action: "create", title: "Implement user authentication", description: "Add JWT-based auth to API", priority: 3, assigned_agent: "backend-agent", layer: "business", tags: ["authentication", "security"] }',
|
|
1349
|
+
explanation: 'Creates task in todo status with high priority'
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
scenario: 'Get task details',
|
|
1353
|
+
request: '{ action: "get", task_id: 5 }',
|
|
1354
|
+
response: 'Full task details including metadata, links, and timestamps'
|
|
1355
|
+
},
|
|
1356
|
+
{
|
|
1357
|
+
scenario: 'List tasks by status',
|
|
1358
|
+
request: '{ action: "list", status: "in_progress", limit: 20 }',
|
|
1359
|
+
explanation: 'View all in-progress tasks'
|
|
1360
|
+
}
|
|
1361
|
+
]
|
|
1362
|
+
},
|
|
1363
|
+
status_workflow: {
|
|
1364
|
+
title: 'Task Lifecycle (Status Transitions)',
|
|
1365
|
+
workflow: [
|
|
1366
|
+
{
|
|
1367
|
+
step: 1,
|
|
1368
|
+
status: 'todo',
|
|
1369
|
+
action: '{ action: "create", title: "...", status: "todo" }',
|
|
1370
|
+
description: 'Task created and waiting to be started'
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
step: 2,
|
|
1374
|
+
status: 'in_progress',
|
|
1375
|
+
action: '{ action: "move", task_id: 1, new_status: "in_progress" }',
|
|
1376
|
+
description: 'Agent starts working on task'
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
step: 3,
|
|
1380
|
+
status: 'waiting_review',
|
|
1381
|
+
action: '{ action: "move", task_id: 1, new_status: "waiting_review" }',
|
|
1382
|
+
description: 'Work complete, awaiting review/approval'
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
step: 4,
|
|
1386
|
+
status: 'done',
|
|
1387
|
+
action: '{ action: "move", task_id: 1, new_status: "done" }',
|
|
1388
|
+
description: 'Task reviewed and completed'
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
step: 5,
|
|
1392
|
+
status: 'archived',
|
|
1393
|
+
action: '{ action: "archive", task_id: 1 }',
|
|
1394
|
+
description: 'Task archived for historical record'
|
|
1395
|
+
}
|
|
1396
|
+
],
|
|
1397
|
+
blocked_status: {
|
|
1398
|
+
description: 'Use "blocked" when task cannot proceed due to dependencies',
|
|
1399
|
+
example: '{ action: "move", task_id: 1, new_status: "blocked" }'
|
|
1400
|
+
}
|
|
1401
|
+
},
|
|
1402
|
+
auto_stale_detection: {
|
|
1403
|
+
title: 'Automatic Stale Task Management',
|
|
1404
|
+
behavior: [
|
|
1405
|
+
{
|
|
1406
|
+
rule: 'in_progress > 2 hours → waiting_review',
|
|
1407
|
+
explanation: 'Tasks stuck in progress auto-move to waiting_review',
|
|
1408
|
+
rationale: 'Prevents tasks from being forgotten while in progress'
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
rule: 'waiting_review > 24 hours → todo',
|
|
1412
|
+
explanation: 'Unreviewed tasks return to todo queue',
|
|
1413
|
+
rationale: 'Ensures waiting tasks dont accumulate indefinitely'
|
|
1414
|
+
}
|
|
1415
|
+
],
|
|
1416
|
+
configuration: {
|
|
1417
|
+
keys: ['task_stale_hours_in_progress', 'task_stale_hours_waiting_review', 'task_auto_stale_enabled'],
|
|
1418
|
+
note: 'Configure via config table in database'
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
task_linking: {
|
|
1422
|
+
title: 'Linking Tasks to Context',
|
|
1423
|
+
examples: [
|
|
1424
|
+
{
|
|
1425
|
+
scenario: 'Link task to decision',
|
|
1426
|
+
request: '{ action: "link", task_id: 5, link_type: "decision", target_id: "api_auth_method", link_relation: "implements" }',
|
|
1427
|
+
explanation: 'Track which tasks implement specific decisions'
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
scenario: 'Link task to constraint',
|
|
1431
|
+
request: '{ action: "link", task_id: 5, link_type: "constraint", target_id: 3, link_relation: "addresses" }',
|
|
1432
|
+
explanation: 'Show task addresses a performance/architecture/security constraint'
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
scenario: 'Link task to file',
|
|
1436
|
+
request: '{ action: "link", task_id: 5, link_type: "file", target_id: "src/api/auth.ts", link_relation: "modifies" }',
|
|
1437
|
+
explanation: 'Indicate which files the task will modify'
|
|
1438
|
+
}
|
|
1439
|
+
]
|
|
1440
|
+
},
|
|
1441
|
+
batch_operations: {
|
|
1442
|
+
title: 'Batch Task Creation',
|
|
1443
|
+
examples: [
|
|
1444
|
+
{
|
|
1445
|
+
scenario: 'Create multiple related tasks',
|
|
1446
|
+
request: '{ action: "batch_create", tasks: [{"title": "Design API", "priority": 3}, {"title": "Implement API", "priority": 3}, {"title": "Write tests", "priority": 2}], atomic: false }',
|
|
1447
|
+
explanation: 'Create task breakdown - use atomic:false for best-effort'
|
|
1448
|
+
}
|
|
1449
|
+
]
|
|
1450
|
+
},
|
|
1451
|
+
filtering_queries: {
|
|
1452
|
+
title: 'Advanced Task Queries',
|
|
1453
|
+
examples: [
|
|
1454
|
+
{
|
|
1455
|
+
scenario: 'Find high-priority tasks for agent',
|
|
1456
|
+
request: '{ action: "list", assigned_agent: "backend-agent", priority: 3, status: "todo" }',
|
|
1457
|
+
note: 'Priority is numeric: 1=low, 2=medium, 3=high, 4=critical'
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
scenario: 'Get all security-related tasks',
|
|
1461
|
+
request: '{ action: "list", tags: ["security"], limit: 50 }',
|
|
1462
|
+
explanation: 'Filter by tags for topic-based views'
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
scenario: 'View infrastructure layer tasks',
|
|
1466
|
+
request: '{ action: "list", layer: "infrastructure" }',
|
|
1467
|
+
explanation: 'See all DevOps/config related tasks'
|
|
1468
|
+
}
|
|
1469
|
+
]
|
|
1470
|
+
}
|
|
1471
|
+
},
|
|
1472
|
+
valid_transitions: {
|
|
1473
|
+
from_todo: ['in_progress', 'blocked', 'done', 'archived'],
|
|
1474
|
+
from_in_progress: ['waiting_review', 'blocked', 'todo'],
|
|
1475
|
+
from_waiting_review: ['done', 'in_progress', 'todo'],
|
|
1476
|
+
from_blocked: ['todo', 'in_progress'],
|
|
1477
|
+
from_done: ['archived', 'todo'],
|
|
1478
|
+
from_archived: []
|
|
1479
|
+
},
|
|
1480
|
+
best_practices: {
|
|
1481
|
+
task_creation: [
|
|
1482
|
+
'Use descriptive titles (200 char max)',
|
|
1483
|
+
'Set appropriate priority: 1=low, 2=medium (default), 3=high, 4=critical',
|
|
1484
|
+
'Assign to layer where work will be done',
|
|
1485
|
+
'Tag comprehensively for easy filtering',
|
|
1486
|
+
'Include acceptance_criteria for complex tasks'
|
|
1487
|
+
],
|
|
1488
|
+
status_management: [
|
|
1489
|
+
'Move to in_progress when starting work',
|
|
1490
|
+
'Use waiting_review for completed but unverified work',
|
|
1491
|
+
'Set to blocked with notes explaining dependency',
|
|
1492
|
+
'Archive done tasks periodically for cleaner views'
|
|
1493
|
+
],
|
|
1494
|
+
linking: [
|
|
1495
|
+
'Link tasks to decisions they implement',
|
|
1496
|
+
'Link to constraints they address',
|
|
1497
|
+
'Link to files they will modify',
|
|
1498
|
+
'Use descriptive link_relation values'
|
|
1499
|
+
],
|
|
1500
|
+
coordination: [
|
|
1501
|
+
'Use assigned_agent for clear ownership',
|
|
1502
|
+
'Filter by status for Kanban board views',
|
|
1503
|
+
'Monitor auto-stale transitions for stuck work',
|
|
1504
|
+
'Use tags for cross-cutting concerns (security, performance, etc.)'
|
|
1505
|
+
]
|
|
503
1506
|
}
|
|
504
1507
|
};
|
|
505
1508
|
break;
|