sqlew 3.2.2 → 3.2.3
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 +35 -0
- package/README.md +46 -1
- package/dist/index.js +23 -1005
- package/dist/index.js.map +1 -1
- package/dist/tools/config.d.ts +10 -0
- package/dist/tools/config.d.ts.map +1 -1
- package/dist/tools/config.js +105 -0
- package/dist/tools/config.js.map +1 -1
- package/dist/tools/constraints.d.ts +10 -0
- package/dist/tools/constraints.d.ts.map +1 -1
- package/dist/tools/constraints.js +167 -0
- package/dist/tools/constraints.js.map +1 -1
- package/dist/tools/context.d.ts +8 -0
- package/dist/tools/context.d.ts.map +1 -1
- package/dist/tools/context.js +332 -103
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/files.d.ts +8 -0
- package/dist/tools/files.d.ts.map +1 -1
- package/dist/tools/files.js +125 -0
- package/dist/tools/files.js.map +1 -1
- package/dist/tools/messaging.d.ts +8 -0
- package/dist/tools/messaging.d.ts.map +1 -1
- package/dist/tools/messaging.js +134 -0
- package/dist/tools/messaging.js.map +1 -1
- package/dist/tools/tasks.d.ts +9 -0
- package/dist/tools/tasks.d.ts.map +1 -1
- package/dist/tools/tasks.js +354 -0
- package/dist/tools/tasks.js.map +1 -1
- package/dist/tools/utils.d.ts +10 -0
- package/dist/tools/utils.d.ts.map +1 -1
- package/dist/tools/utils.js +135 -0
- package/dist/tools/utils.js.map +1 -1
- package/docs/HELP_PREVIEW_COMPARISON.md +259 -0
- package/docs/TOOL_REFERENCE.md +158 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8,13 +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, hardDeleteDecision, addDecisionContextAction, listDecisionContextsAction } from './tools/context.js';
|
|
12
|
-
import { sendMessage, getMessages, markRead, sendMessageBatch } from './tools/messaging.js';
|
|
13
|
-
import { recordFileChange, getFileChanges, checkFileLock, recordFileChangeBatch } from './tools/files.js';
|
|
14
|
-
import { addConstraint, getConstraints, deactivateConstraint } from './tools/constraints.js';
|
|
15
|
-
import { getLayerSummary, clearOldData, getStats, getActivityLog, flushWAL } from './tools/utils.js';
|
|
16
|
-
import { getConfig, updateConfig } from './tools/config.js';
|
|
17
|
-
import { createTask, updateTask, getTask, listTasks, moveTask, linkTask, archiveTask, batchCreateTasks, addDependency, removeDependency, getDependencies, taskHelp } from './tools/tasks.js';
|
|
11
|
+
import { setDecision, getContext, getDecision, searchByTags, getVersions, searchByLayer, quickSetDecision, searchAdvanced, setDecisionBatch, hasUpdates, setFromTemplate, createTemplate, listTemplates, hardDeleteDecision, addDecisionContextAction, listDecisionContextsAction, decisionHelp, decisionExample } from './tools/context.js';
|
|
12
|
+
import { sendMessage, getMessages, markRead, sendMessageBatch, messageHelp, messageExample } from './tools/messaging.js';
|
|
13
|
+
import { recordFileChange, getFileChanges, checkFileLock, recordFileChangeBatch, fileHelp, fileExample } from './tools/files.js';
|
|
14
|
+
import { addConstraint, getConstraints, deactivateConstraint, constraintHelp, constraintExample } from './tools/constraints.js';
|
|
15
|
+
import { getLayerSummary, clearOldData, getStats, getActivityLog, flushWAL, statsHelp, statsExample } from './tools/utils.js';
|
|
16
|
+
import { getConfig, updateConfig, configHelp, configExample } from './tools/config.js';
|
|
17
|
+
import { createTask, updateTask, getTask, listTasks, moveTask, linkTask, archiveTask, batchCreateTasks, addDependency, removeDependency, getDependencies, taskHelp, taskExample, watcherStatus } from './tools/tasks.js';
|
|
18
18
|
import { FileWatcher } from './watcher/index.js';
|
|
19
19
|
// Parse command-line arguments
|
|
20
20
|
const args = process.argv.slice(2);
|
|
@@ -389,227 +389,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
389
389
|
result = listDecisionContextsAction(params);
|
|
390
390
|
break;
|
|
391
391
|
case 'help':
|
|
392
|
-
result =
|
|
393
|
-
tool: 'decision',
|
|
394
|
-
description: 'Manage decisions with metadata (tags, layers, versions, scopes)',
|
|
395
|
-
note: '💡 TIP: Use action: "example" to see comprehensive usage scenarios and real-world examples for all decision actions.',
|
|
396
|
-
purpose: {
|
|
397
|
-
title: '⚠️ CRITICAL: Store WHY and REASON, Not WHAT',
|
|
398
|
-
principle: 'Decisions table is for ARCHITECTURAL CONTEXT and REASONING, NOT implementation logs or task completion status',
|
|
399
|
-
what_to_store: {
|
|
400
|
-
correct: [
|
|
401
|
-
'WHY a design choice was made (e.g., "Chose JWT over sessions because stateless auth scales better for our microservice architecture")',
|
|
402
|
-
'REASONING behind architecture decisions (e.g., "Moved oscillator_type to MonophonicSynthConfig to separate synthesis methods - FM operators use different config")',
|
|
403
|
-
'PROBLEM ANALYSIS and solution rationale (e.g., "Nested transaction bug: setDecision wraps in transaction, batch also wraps → solution: extract internal helper without transaction wrapper")',
|
|
404
|
-
'DESIGN TRADE-OFFS and alternatives considered (e.g., "Query builder limited to simple filters, kept domain-specific logic inline for maintainability")',
|
|
405
|
-
'CONSTRAINTS and requirements reasoning (e.g., "API response must be <100ms because mobile clients timeout at 200ms")',
|
|
406
|
-
'BREAKING CHANGES with migration rationale (e.g., "Removed /v1/users endpoint - clients must use /v2/users with pagination for scalability")'
|
|
407
|
-
],
|
|
408
|
-
incorrect: [
|
|
409
|
-
'❌ Task completion logs (e.g., "Task 5 completed", "Refactoring done", "Tests passing") → Use tasks tool instead',
|
|
410
|
-
'❌ Implementation status (e.g., "Added validators.ts", "Fixed bug in batch_create", "Updated README") → These are WHAT, not WHY',
|
|
411
|
-
'❌ Test results (e.g., "All tests passing", "Integration tests complete", "v3.0.2 testing verified") → Temporary status, not architectural context',
|
|
412
|
-
'❌ Git commit summaries (e.g., "Released v3.0.2", "Created git commit 2bf55a0") → Belongs in git history',
|
|
413
|
-
'❌ Documentation updates (e.g., "README reorganized", "Help actions enhanced") → Implementation logs, not decisions',
|
|
414
|
-
'❌ Build status (e.g., "Build succeeded", "TypeScript compiled with zero errors") → Temporary status'
|
|
415
|
-
]
|
|
416
|
-
},
|
|
417
|
-
analogy: {
|
|
418
|
-
git_history: 'WHAT changed (files, lines, commits)',
|
|
419
|
-
code_comments: 'HOW it works (implementation details, algorithms)',
|
|
420
|
-
sqlew_decisions: 'WHY it was changed (reasoning, trade-offs, context)',
|
|
421
|
-
sqlew_tasks: 'WHAT needs to be done (work items, status, completion)'
|
|
422
|
-
},
|
|
423
|
-
examples: [
|
|
424
|
-
{
|
|
425
|
-
key: 'api/auth/jwt-choice',
|
|
426
|
-
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.',
|
|
427
|
-
explanation: 'Explains WHY JWT was chosen, considers trade-offs, provides architectural context'
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
key: 'database/postgresql-choice',
|
|
431
|
-
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.',
|
|
432
|
-
explanation: 'Documents database choice with reasoning, alternatives considered, and trade-offs'
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
key: 'security/encryption-at-rest',
|
|
436
|
-
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.',
|
|
437
|
-
explanation: 'Explains security decision with compliance reasoning and performance considerations'
|
|
438
|
-
}
|
|
439
|
-
],
|
|
440
|
-
cleanup_rule: 'Delete decisions that start with "COMPLETED:", contain task status, test results, or implementation logs. Keep only architectural reasoning and design rationale.'
|
|
441
|
-
},
|
|
442
|
-
actions: {
|
|
443
|
-
set: 'Set/update a decision. Params: key (required), value (required), agent, layer, version, status, tags, scopes',
|
|
444
|
-
get: 'Get specific decision by key. Params: key (required), include_context (optional, boolean, default: false). When include_context=true, returns decision with attached context (rationale, alternatives, tradeoffs). Backward compatible - omitting flag returns standard decision format.',
|
|
445
|
-
list: 'List/filter decisions. Params: status, layer, tags, scope, tag_match',
|
|
446
|
-
search_tags: 'Search decisions by tags. Params: tags (required), match_mode, status, layer',
|
|
447
|
-
search_layer: 'Search decisions by layer. Params: layer (required), status, include_tags',
|
|
448
|
-
versions: 'Get version history for a decision. Params: key (required)',
|
|
449
|
-
quick_set: 'Quick set with smart defaults (FR-002). Params: key (required), value (required), agent, layer, version, status, tags, scopes. Auto-infers layer from key prefix (api/*→presentation, db/*→data, service/*→business, config/*→infrastructure), tags from key hierarchy, scope from parent path. Defaults: status=active, version=1.0.0. All inferred fields can be overridden.',
|
|
450
|
-
search_advanced: 'Advanced query with complex filtering (FR-004). Params: layers (OR), tags_all (AND), tags_any (OR), exclude_tags, scopes (wildcards), updated_after/before (ISO or relative like "7d"), decided_by, statuses, search_text, sort_by (updated/key/version), sort_order (asc/desc), limit (default:20, max:1000), offset (default:0). Returns decisions with total_count for pagination. All filters use parameterized queries (SQL injection protection).',
|
|
451
|
-
set_batch: 'Batch set decisions (FR-005). Params: decisions (required, array of SetDecisionParams, max: 50), atomic (optional, boolean, default: true). Returns: {success, inserted, failed, results}. ATOMIC MODE BEHAVIOR (atomic: true): All decisions succeed or all fail as a single transaction. If ANY decision fails, entire batch is rolled back and error is thrown. Use for critical operations requiring consistency. NON-ATOMIC MODE (atomic: false): Each decision is processed independently. If some fail, others still succeed. Returns partial results with per-item success/error status. Use for best-effort batch operations or when individual failures are acceptable. RECOMMENDATION FOR AI AGENTS: Use atomic:false by default to avoid transaction failures from validation errors or malformed data. Only use atomic:true when all-or-nothing guarantee is required. 52% token reduction vs individual calls.',
|
|
452
|
-
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.',
|
|
453
|
-
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.',
|
|
454
|
-
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.',
|
|
455
|
-
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.',
|
|
456
|
-
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}.',
|
|
457
|
-
add_decision_context: 'Add rich context to a decision (v3.2.2). Params: key (required), rationale (required), alternatives_considered (optional, JSON array), tradeoffs (optional, JSON object with pros/cons), decided_by (optional), related_task_id (optional), related_constraint_id (optional). Use to document WHY decisions were made, what alternatives were considered, and trade-offs. Multiple contexts can be attached to the same decision over time. Returns: {success, context_id, decision_key, message}.',
|
|
458
|
-
list_decision_contexts: 'List decision contexts with filters (v3.2.2). Params: decision_key (optional), related_task_id (optional), related_constraint_id (optional), decided_by (optional), limit (default: 50), offset (default: 0). Returns: {success, contexts: [{id, decision_key, rationale, alternatives_considered, tradeoffs, decided_by, decision_date, related_task_id, related_constraint_id}], count}. JSON fields (alternatives, tradeoffs) are automatically parsed.'
|
|
459
|
-
},
|
|
460
|
-
examples: {
|
|
461
|
-
set: '{ action: "set", key: "auth_method", value: "jwt", tags: ["security"] }',
|
|
462
|
-
get: '{ action: "get", key: "auth_method" }',
|
|
463
|
-
list: '{ action: "list", status: "active", layer: "infrastructure" }',
|
|
464
|
-
search_tags: '{ action: "search_tags", tags: ["security", "api"] }',
|
|
465
|
-
quick_set: '{ action: "quick_set", key: "api/instruments/oscillator-refactor", value: "Moved oscillator_type to MonophonicSynthConfig" }',
|
|
466
|
-
search_advanced: '{ action: "search_advanced", layers: ["business", "data"], tags_all: ["breaking", "v0.3.3"], tags_any: ["api", "synthesis"], exclude_tags: ["deprecated"], scopes: ["api/instruments/*"], updated_after: "2025-10-01", statuses: ["active", "draft"], search_text: "oscillator", sort_by: "updated", sort_order: "desc", limit: 20, offset: 0 }',
|
|
467
|
-
set_batch: '{ action: "set_batch", decisions: [{"key": "feat-1", "value": "...", "layer": "business"}, {"key": "feat-2", "value": "...", "layer": "data"}], atomic: true }',
|
|
468
|
-
has_updates: '{ action: "has_updates", agent_name: "my-agent", since_timestamp: "2025-10-14T08:00:00Z" }',
|
|
469
|
-
set_from_template: '{ action: "set_from_template", template: "breaking_change", key: "oscillator-type-moved", value: "oscillator_type moved to MonophonicSynthConfig" }',
|
|
470
|
-
create_template: '{ action: "create_template", name: "bug_fix", defaults: {"layer":"business","tags":["bug","fix"],"status":"active"}, created_by: "my-agent" }',
|
|
471
|
-
list_templates: '{ action: "list_templates" }',
|
|
472
|
-
hard_delete: '{ action: "hard_delete", key: "task_old_authentication_refactor" }'
|
|
473
|
-
},
|
|
474
|
-
documentation: {
|
|
475
|
-
tool_selection: 'docs/TOOL_SELECTION.md - Decision tree, tool comparison, when to use each tool (236 lines, ~12k tokens)',
|
|
476
|
-
tool_reference: 'docs/TOOL_REFERENCE.md - Parameter requirements, batch operations, templates (471 lines, ~24k tokens)',
|
|
477
|
-
workflows: 'docs/WORKFLOWS.md - Multi-step workflow examples, multi-agent coordination (602 lines, ~30k tokens)',
|
|
478
|
-
best_practices: 'docs/BEST_PRACTICES.md - Common errors, best practices, troubleshooting (345 lines, ~17k tokens)',
|
|
479
|
-
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions, enum values (status/layer/priority), atomic mode (339 lines, ~17k tokens)'
|
|
480
|
-
}
|
|
481
|
-
};
|
|
392
|
+
result = decisionHelp();
|
|
482
393
|
break;
|
|
483
394
|
case 'example':
|
|
484
|
-
result =
|
|
485
|
-
tool: 'decision',
|
|
486
|
-
description: 'Comprehensive decision tool examples without needing WebFetch access',
|
|
487
|
-
scenarios: {
|
|
488
|
-
basic_usage: {
|
|
489
|
-
title: 'Basic Decision Management',
|
|
490
|
-
examples: [
|
|
491
|
-
{
|
|
492
|
-
scenario: 'Record API design decision',
|
|
493
|
-
request: '{ action: "set", key: "api_auth_method", value: "JWT with refresh tokens", layer: "business", tags: ["api", "security", "authentication"] }',
|
|
494
|
-
explanation: 'Documents the choice of authentication method for the API'
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
scenario: 'Retrieve a decision',
|
|
498
|
-
request: '{ action: "get", key: "api_auth_method" }',
|
|
499
|
-
response_structure: '{ key, value, layer, status, version, tags, scopes, decided_by, updated_at }'
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
scenario: 'List all active decisions',
|
|
503
|
-
request: '{ action: "list", status: "active", limit: 20 }',
|
|
504
|
-
explanation: 'Returns active decisions with metadata for browsing'
|
|
505
|
-
}
|
|
506
|
-
]
|
|
507
|
-
},
|
|
508
|
-
advanced_filtering: {
|
|
509
|
-
title: 'Advanced Search and Filtering',
|
|
510
|
-
examples: [
|
|
511
|
-
{
|
|
512
|
-
scenario: 'Find all security-related decisions in business layer',
|
|
513
|
-
request: '{ action: "search_advanced", layers: ["business"], tags_any: ["security", "authentication"], status: ["active"], sort_by: "updated", sort_order: "desc" }',
|
|
514
|
-
explanation: 'Combines layer filtering, tag matching, and sorting'
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
scenario: 'Search within API scope with multiple tags',
|
|
518
|
-
request: '{ action: "search_advanced", scopes: ["api/*"], tags_all: ["breaking", "v2.0"], updated_after: "2025-01-01" }',
|
|
519
|
-
explanation: 'Uses scope wildcards and timestamp filtering for recent breaking changes'
|
|
520
|
-
}
|
|
521
|
-
]
|
|
522
|
-
},
|
|
523
|
-
versioning_workflow: {
|
|
524
|
-
title: 'Version Management',
|
|
525
|
-
steps: [
|
|
526
|
-
{
|
|
527
|
-
step: 1,
|
|
528
|
-
action: 'Create initial decision',
|
|
529
|
-
request: '{ action: "set", key: "database_choice", value: "PostgreSQL", layer: "data", version: "1.0.0", tags: ["database"] }'
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
step: 2,
|
|
533
|
-
action: 'Update decision (creates new version)',
|
|
534
|
-
request: '{ action: "set", key: "database_choice", value: "PostgreSQL with read replicas", layer: "data", version: "1.1.0", tags: ["database", "scaling"] }'
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
step: 3,
|
|
538
|
-
action: 'View version history',
|
|
539
|
-
request: '{ action: "versions", key: "database_choice" }',
|
|
540
|
-
result: 'Returns all versions with timestamps and changes'
|
|
541
|
-
}
|
|
542
|
-
]
|
|
543
|
-
},
|
|
544
|
-
batch_operations: {
|
|
545
|
-
title: 'Batch Decision Management',
|
|
546
|
-
examples: [
|
|
547
|
-
{
|
|
548
|
-
scenario: 'Record multiple related decisions atomically',
|
|
549
|
-
request: '{ action: "set_batch", decisions: [{"key": "cache_layer", "value": "Redis", "layer": "infrastructure"}, {"key": "cache_ttl", "value": "3600", "layer": "infrastructure"}], atomic: true }',
|
|
550
|
-
explanation: 'All decisions succeed or all fail together (atomic mode)'
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
scenario: 'Best-effort batch insert',
|
|
554
|
-
request: '{ action: "set_batch", decisions: [{...}, {...}, {...}], atomic: false }',
|
|
555
|
-
explanation: 'Each decision processed independently - partial success allowed'
|
|
556
|
-
}
|
|
557
|
-
]
|
|
558
|
-
},
|
|
559
|
-
templates: {
|
|
560
|
-
title: 'Using Decision Templates',
|
|
561
|
-
examples: [
|
|
562
|
-
{
|
|
563
|
-
scenario: 'Use built-in breaking_change template',
|
|
564
|
-
request: '{ action: "set_from_template", template: "breaking_change", key: "api_remove_legacy_endpoint", value: "Removed /v1/users endpoint - migrate to /v2/users" }',
|
|
565
|
-
explanation: 'Automatically applies layer=business, tags=["breaking"], status=active'
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
scenario: 'Create custom template',
|
|
569
|
-
request: '{ action: "create_template", name: "feature_flag", defaults: {"layer": "presentation", "tags": ["feature-flag"], "status": "draft"}, created_by: "backend-team" }',
|
|
570
|
-
explanation: 'Define reusable templates for common decision patterns'
|
|
571
|
-
}
|
|
572
|
-
]
|
|
573
|
-
},
|
|
574
|
-
quick_set_inference: {
|
|
575
|
-
title: 'Quick Set with Smart Defaults',
|
|
576
|
-
examples: [
|
|
577
|
-
{
|
|
578
|
-
scenario: 'Auto-infer layer from key prefix',
|
|
579
|
-
request: '{ action: "quick_set", key: "api/instruments/oscillator-refactor", value: "Moved oscillator_type to MonophonicSynthConfig" }',
|
|
580
|
-
inferred: 'layer=presentation (from api/*), tags=["instruments", "oscillator-refactor"], scope=api/instruments'
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
scenario: 'Database decision with auto-inference',
|
|
584
|
-
request: '{ action: "quick_set", key: "db/users/add-email-index", value: "Added index on email column" }',
|
|
585
|
-
inferred: 'layer=data (from db/*), tags=["users", "add-email-index"]'
|
|
586
|
-
}
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
},
|
|
590
|
-
best_practices: {
|
|
591
|
-
key_naming: [
|
|
592
|
-
'Use hierarchical keys: "api/users/authentication"',
|
|
593
|
-
'Prefix with layer hint: api/* → presentation, db/* → data, service/* → business',
|
|
594
|
-
'Use descriptive names that explain the decision context'
|
|
595
|
-
],
|
|
596
|
-
tagging: [
|
|
597
|
-
'Tag with relevant categories: security, performance, breaking, etc.',
|
|
598
|
-
'Include version tags for release-specific decisions',
|
|
599
|
-
'Use consistent tag naming conventions across team'
|
|
600
|
-
],
|
|
601
|
-
versioning: [
|
|
602
|
-
'Use semantic versioning: 1.0.0, 1.1.0, 2.0.0',
|
|
603
|
-
'Increment major version for breaking changes',
|
|
604
|
-
'Document rationale in decision value text'
|
|
605
|
-
],
|
|
606
|
-
cleanup: [
|
|
607
|
-
'Mark deprecated decisions with status="deprecated"',
|
|
608
|
-
'Use hard_delete only for sensitive data or migration cleanup',
|
|
609
|
-
'Link related decisions using scopes'
|
|
610
|
-
]
|
|
611
|
-
}
|
|
612
|
-
};
|
|
395
|
+
result = decisionExample();
|
|
613
396
|
break;
|
|
614
397
|
default: throw new Error(`Unknown action: ${params.action}`);
|
|
615
398
|
}
|
|
@@ -629,132 +412,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
629
412
|
result = sendMessageBatch({ messages: params.messages, atomic: params.atomic });
|
|
630
413
|
break;
|
|
631
414
|
case 'help':
|
|
632
|
-
result =
|
|
633
|
-
tool: 'message',
|
|
634
|
-
description: 'Send and retrieve messages between agents with priority levels',
|
|
635
|
-
note: '💡 TIP: Use action: "example" to see comprehensive usage scenarios and real-world examples for all message actions.',
|
|
636
|
-
actions: {
|
|
637
|
-
send: 'Send message. Params: from_agent (required), msg_type (required), message (required), to_agent, priority, payload',
|
|
638
|
-
get: 'Get messages for agent. Params: agent_name (required), unread_only, priority_filter, msg_type_filter, limit',
|
|
639
|
-
mark_read: 'Mark messages as read. Params: agent_name (required), message_ids (required)',
|
|
640
|
-
send_batch: 'Batch send messages (FR-005). Params: messages (required, array of SendMessageParams, max: 50), atomic (optional, boolean, default: true). Returns: {success, inserted, failed, results}. ATOMIC MODE (atomic: true): All messages succeed or all fail as a single transaction. If ANY message fails, entire batch is rolled back and error is thrown. NON-ATOMIC MODE (atomic: false): Each message is processed independently. If some fail, others still succeed. Returns partial results with per-item success/error status. RECOMMENDATION FOR AI AGENTS: Use atomic:false by default for best-effort delivery. Use atomic:true only when all-or-nothing guarantee is required. 52% token reduction vs individual calls.'
|
|
641
|
-
},
|
|
642
|
-
examples: {
|
|
643
|
-
send: '{ action: "send", from_agent: "bot1", msg_type: "info", message: "Task complete", priority: "high" }',
|
|
644
|
-
get: '{ action: "get", agent_name: "bot1", unread_only: true }',
|
|
645
|
-
mark_read: '{ action: "mark_read", agent_name: "bot1", message_ids: [1, 2, 3] }',
|
|
646
|
-
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 }'
|
|
647
|
-
},
|
|
648
|
-
documentation: {
|
|
649
|
-
workflows: 'docs/WORKFLOWS.md - Multi-agent coordination, messaging patterns, cross-session handoffs (602 lines, ~30k tokens)',
|
|
650
|
-
tool_reference: 'docs/TOOL_REFERENCE.md - Message tool parameters, batch operations (471 lines, ~24k tokens)',
|
|
651
|
-
shared_concepts: 'docs/SHARED_CONCEPTS.md - Enum values (msg_type/priority), atomic mode (339 lines, ~17k tokens)',
|
|
652
|
-
best_practices: 'docs/BEST_PRACTICES.md - Common errors, messaging best practices (345 lines, ~17k tokens)'
|
|
653
|
-
}
|
|
654
|
-
};
|
|
415
|
+
result = messageHelp();
|
|
655
416
|
break;
|
|
656
417
|
case 'example':
|
|
657
|
-
result =
|
|
658
|
-
tool: 'message',
|
|
659
|
-
description: 'Comprehensive messaging examples for multi-agent coordination',
|
|
660
|
-
scenarios: {
|
|
661
|
-
basic_messaging: {
|
|
662
|
-
title: 'Basic Agent Communication',
|
|
663
|
-
examples: [
|
|
664
|
-
{
|
|
665
|
-
scenario: 'Send info message between agents',
|
|
666
|
-
request: '{ action: "send", from_agent: "backend-agent", to_agent: "frontend-agent", msg_type: "info", message: "API endpoint /users is ready" }',
|
|
667
|
-
explanation: 'Direct message from one agent to another'
|
|
668
|
-
},
|
|
669
|
-
{
|
|
670
|
-
scenario: 'Broadcast message to all agents',
|
|
671
|
-
request: '{ action: "send", from_agent: "coordinator", to_agent: null, msg_type: "info", message: "Deployment starting in 5 minutes", priority: "high" }',
|
|
672
|
-
explanation: 'null to_agent broadcasts to all agents'
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
scenario: 'Get unread messages',
|
|
676
|
-
request: '{ action: "get", agent_name: "frontend-agent", unread_only: true }',
|
|
677
|
-
explanation: 'Retrieve only unread messages for an agent'
|
|
678
|
-
}
|
|
679
|
-
]
|
|
680
|
-
},
|
|
681
|
-
priority_messaging: {
|
|
682
|
-
title: 'Priority-Based Communication',
|
|
683
|
-
examples: [
|
|
684
|
-
{
|
|
685
|
-
scenario: 'Critical error notification',
|
|
686
|
-
request: '{ action: "send", from_agent: "monitoring-agent", msg_type: "warning", message: "Database connection lost", priority: "critical" }',
|
|
687
|
-
explanation: 'High-priority messages for urgent issues'
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
scenario: 'Filter by priority',
|
|
691
|
-
request: '{ action: "get", agent_name: "ops-agent", priority_filter: "critical" }',
|
|
692
|
-
explanation: 'Get only critical priority messages'
|
|
693
|
-
}
|
|
694
|
-
]
|
|
695
|
-
},
|
|
696
|
-
workflow_coordination: {
|
|
697
|
-
title: 'Multi-Step Workflow',
|
|
698
|
-
steps: [
|
|
699
|
-
{
|
|
700
|
-
step: 1,
|
|
701
|
-
action: 'Agent A requests work from Agent B',
|
|
702
|
-
request: '{ action: "send", from_agent: "agent-a", to_agent: "agent-b", msg_type: "request", message: "Please process user data batch-123" }'
|
|
703
|
-
},
|
|
704
|
-
{
|
|
705
|
-
step: 2,
|
|
706
|
-
action: 'Agent B checks messages',
|
|
707
|
-
request: '{ action: "get", agent_name: "agent-b", msg_type_filter: "request", unread_only: true }'
|
|
708
|
-
},
|
|
709
|
-
{
|
|
710
|
-
step: 3,
|
|
711
|
-
action: 'Agent B marks as read and processes',
|
|
712
|
-
request: '{ action: "mark_read", agent_name: "agent-b", message_ids: [123] }'
|
|
713
|
-
},
|
|
714
|
-
{
|
|
715
|
-
step: 4,
|
|
716
|
-
action: 'Agent B sends completion notification',
|
|
717
|
-
request: '{ action: "send", from_agent: "agent-b", to_agent: "agent-a", msg_type: "info", message: "Batch-123 processing complete" }'
|
|
718
|
-
}
|
|
719
|
-
]
|
|
720
|
-
},
|
|
721
|
-
batch_messaging: {
|
|
722
|
-
title: 'Batch Message Operations',
|
|
723
|
-
examples: [
|
|
724
|
-
{
|
|
725
|
-
scenario: 'Send multiple status updates atomically',
|
|
726
|
-
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 }',
|
|
727
|
-
explanation: 'All messages sent or none (atomic mode)'
|
|
728
|
-
},
|
|
729
|
-
{
|
|
730
|
-
scenario: 'Best-effort batch sending',
|
|
731
|
-
request: '{ action: "send_batch", messages: [{...}, {...}], atomic: false }',
|
|
732
|
-
explanation: 'Each message sent independently - partial success allowed'
|
|
733
|
-
}
|
|
734
|
-
]
|
|
735
|
-
}
|
|
736
|
-
},
|
|
737
|
-
best_practices: {
|
|
738
|
-
message_types: [
|
|
739
|
-
'Use "decision" for recording important choices',
|
|
740
|
-
'Use "warning" for errors or issues requiring attention',
|
|
741
|
-
'Use "request" for work requests between agents',
|
|
742
|
-
'Use "info" for status updates and notifications'
|
|
743
|
-
],
|
|
744
|
-
priority_usage: [
|
|
745
|
-
'critical: System failures, data loss, security breaches',
|
|
746
|
-
'high: Important but not emergency (deployment notifications)',
|
|
747
|
-
'medium: Regular coordination messages (default)',
|
|
748
|
-
'low: Optional information, logging'
|
|
749
|
-
],
|
|
750
|
-
coordination_patterns: [
|
|
751
|
-
'Always mark messages as read after processing',
|
|
752
|
-
'Use broadcast (to_agent=null) for system-wide announcements',
|
|
753
|
-
'Filter by msg_type when checking for specific message categories',
|
|
754
|
-
'Include context in message text or payload for debugging'
|
|
755
|
-
]
|
|
756
|
-
}
|
|
757
|
-
};
|
|
418
|
+
result = messageExample();
|
|
758
419
|
break;
|
|
759
420
|
default: throw new Error(`Unknown action: ${params.action}`);
|
|
760
421
|
}
|
|
@@ -774,123 +435,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
774
435
|
result = recordFileChangeBatch({ file_changes: params.file_changes, atomic: params.atomic });
|
|
775
436
|
break;
|
|
776
437
|
case 'help':
|
|
777
|
-
result =
|
|
778
|
-
tool: 'file',
|
|
779
|
-
description: 'Track file changes across agents with layer classification',
|
|
780
|
-
note: '💡 TIP: Use action: "example" to see comprehensive usage scenarios and real-world examples for all file tracking actions.',
|
|
781
|
-
actions: {
|
|
782
|
-
record: 'Record file change. Params: file_path (required), agent_name (required), change_type (required), layer, description',
|
|
783
|
-
get: 'Get file changes. Params: file_path, agent_name, layer, change_type, since, limit',
|
|
784
|
-
check_lock: 'Check if file locked. Params: file_path (required), lock_duration',
|
|
785
|
-
record_batch: 'Batch record file changes (FR-005). Params: file_changes (required, array of RecordFileChangeParams, max: 50), atomic (optional, boolean, default: true). Returns: {success, inserted, failed, results}. ATOMIC MODE (atomic: true): All file changes succeed or all fail as a single transaction. If ANY record fails, entire batch is rolled back and error is thrown. NON-ATOMIC MODE (atomic: false): Each file change is processed independently. If some fail, others still succeed. Returns partial results with per-item success/error status. RECOMMENDATION FOR AI AGENTS: Use atomic:false by default for best-effort recording. Use atomic:true only when all-or-nothing guarantee is required. 52% token reduction vs individual calls.'
|
|
786
|
-
},
|
|
787
|
-
examples: {
|
|
788
|
-
record: '{ action: "record", file_path: "src/index.ts", agent_name: "refactor-bot", change_type: "modified", layer: "infrastructure" }',
|
|
789
|
-
get: '{ action: "get", agent_name: "refactor-bot", layer: "infrastructure", limit: 10 }',
|
|
790
|
-
check_lock: '{ action: "check_lock", file_path: "src/index.ts", lock_duration: 300 }',
|
|
791
|
-
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 }'
|
|
792
|
-
},
|
|
793
|
-
documentation: {
|
|
794
|
-
workflows: 'docs/WORKFLOWS.md - File locking patterns, concurrent file access workflows (602 lines, ~30k tokens)',
|
|
795
|
-
tool_reference: 'docs/TOOL_REFERENCE.md - File tool parameters, batch operations (471 lines, ~24k tokens)',
|
|
796
|
-
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions, enum values (change_type), atomic mode (339 lines, ~17k tokens)',
|
|
797
|
-
best_practices: 'docs/BEST_PRACTICES.md - File tracking best practices (345 lines, ~17k tokens)'
|
|
798
|
-
}
|
|
799
|
-
};
|
|
438
|
+
result = fileHelp();
|
|
800
439
|
break;
|
|
801
440
|
case 'example':
|
|
802
|
-
result =
|
|
803
|
-
tool: 'file',
|
|
804
|
-
description: 'Comprehensive file tracking examples for multi-agent coordination',
|
|
805
|
-
scenarios: {
|
|
806
|
-
basic_tracking: {
|
|
807
|
-
title: 'Basic File Change Tracking',
|
|
808
|
-
examples: [
|
|
809
|
-
{
|
|
810
|
-
scenario: 'Record file modification',
|
|
811
|
-
request: '{ action: "record", file_path: "src/api/users.ts", agent_name: "refactor-agent", change_type: "modified", layer: "business", description: "Added email validation" }',
|
|
812
|
-
explanation: 'Track changes with layer and description'
|
|
813
|
-
},
|
|
814
|
-
{
|
|
815
|
-
scenario: 'Get recent changes by agent',
|
|
816
|
-
request: '{ action: "get", agent_name: "refactor-agent", limit: 10 }',
|
|
817
|
-
explanation: 'View what an agent has been working on'
|
|
818
|
-
},
|
|
819
|
-
{
|
|
820
|
-
scenario: 'Track changes to specific file',
|
|
821
|
-
request: '{ action: "get", file_path: "src/api/users.ts" }',
|
|
822
|
-
explanation: 'See all modifications to a particular file'
|
|
823
|
-
}
|
|
824
|
-
]
|
|
825
|
-
},
|
|
826
|
-
file_locking: {
|
|
827
|
-
title: 'Concurrent Access Prevention',
|
|
828
|
-
workflow: [
|
|
829
|
-
{
|
|
830
|
-
step: 1,
|
|
831
|
-
action: 'Check if file is locked',
|
|
832
|
-
request: '{ action: "check_lock", file_path: "src/database/schema.sql", lock_duration: 300 }',
|
|
833
|
-
result: '{ locked: false } or { locked: true, locked_by: "agent-name", locked_at: "timestamp" }'
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
step: 2,
|
|
837
|
-
action: 'If not locked, record change (creates lock)',
|
|
838
|
-
request: '{ action: "record", file_path: "src/database/schema.sql", agent_name: "migration-agent", change_type: "modified" }'
|
|
839
|
-
},
|
|
840
|
-
{
|
|
841
|
-
step: 3,
|
|
842
|
-
action: 'Lock expires after 5 minutes (default) or specified duration'
|
|
843
|
-
}
|
|
844
|
-
]
|
|
845
|
-
},
|
|
846
|
-
layer_organization: {
|
|
847
|
-
title: 'Tracking by Architecture Layer',
|
|
848
|
-
examples: [
|
|
849
|
-
{
|
|
850
|
-
scenario: 'Get all presentation layer changes',
|
|
851
|
-
request: '{ action: "get", layer: "presentation", limit: 20 }',
|
|
852
|
-
explanation: 'View frontend/UI changes across agents'
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
scenario: 'Track infrastructure changes',
|
|
856
|
-
request: '{ action: "get", layer: "infrastructure", change_type: "modified" }',
|
|
857
|
-
explanation: 'Monitor config and deployment file changes'
|
|
858
|
-
}
|
|
859
|
-
]
|
|
860
|
-
},
|
|
861
|
-
batch_tracking: {
|
|
862
|
-
title: 'Batch File Operations',
|
|
863
|
-
examples: [
|
|
864
|
-
{
|
|
865
|
-
scenario: 'Record multiple file changes atomically',
|
|
866
|
-
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 }',
|
|
867
|
-
explanation: 'All changes recorded or none (transaction)'
|
|
868
|
-
}
|
|
869
|
-
]
|
|
870
|
-
}
|
|
871
|
-
},
|
|
872
|
-
best_practices: {
|
|
873
|
-
change_tracking: [
|
|
874
|
-
'Always specify layer for better organization',
|
|
875
|
-
'Include description for non-obvious changes',
|
|
876
|
-
'Use check_lock before modifying shared files',
|
|
877
|
-
'Track both creation and deletion of files'
|
|
878
|
-
],
|
|
879
|
-
lock_management: [
|
|
880
|
-
'Default lock duration is 300 seconds (5 minutes)',
|
|
881
|
-
'Locks prevent concurrent modifications',
|
|
882
|
-
'Locks auto-expire - no manual unlock needed',
|
|
883
|
-
'Use appropriate lock_duration for operation complexity'
|
|
884
|
-
],
|
|
885
|
-
layer_assignment: [
|
|
886
|
-
'presentation: UI components, API controllers',
|
|
887
|
-
'business: Services, domain logic',
|
|
888
|
-
'data: Models, repositories, migrations',
|
|
889
|
-
'infrastructure: Config, deployment, CI/CD',
|
|
890
|
-
'cross-cutting: Utilities used across layers'
|
|
891
|
-
]
|
|
892
|
-
}
|
|
893
|
-
};
|
|
441
|
+
result = fileExample();
|
|
894
442
|
break;
|
|
895
443
|
default: throw new Error(`Unknown action: ${params.action}`);
|
|
896
444
|
}
|
|
@@ -907,163 +455,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
907
455
|
result = deactivateConstraint(params);
|
|
908
456
|
break;
|
|
909
457
|
case 'help':
|
|
910
|
-
result =
|
|
911
|
-
tool: 'constraint',
|
|
912
|
-
description: 'Manage project constraints (performance, architecture, security)',
|
|
913
|
-
note: '💡 TIP: Use action: "example" to see comprehensive usage scenarios and real-world examples for all constraint actions.',
|
|
914
|
-
actions: {
|
|
915
|
-
add: 'Add constraint. Params: category (required), constraint_text (required), priority, layer, tags, created_by',
|
|
916
|
-
get: 'Get constraints. Params: category, layer, priority, tags, active_only, limit',
|
|
917
|
-
deactivate: 'Deactivate constraint. Params: constraint_id (required)'
|
|
918
|
-
},
|
|
919
|
-
examples: {
|
|
920
|
-
add: '{ action: "add", category: "performance", constraint_text: "API response time <100ms", priority: "high", tags: ["api"] }',
|
|
921
|
-
get: '{ action: "get", category: "performance", active_only: true }',
|
|
922
|
-
deactivate: '{ action: "deactivate", constraint_id: 5 }'
|
|
923
|
-
},
|
|
924
|
-
documentation: {
|
|
925
|
-
tool_selection: 'docs/TOOL_SELECTION.md - Decision tree, constraint vs decision comparison (236 lines, ~12k tokens)',
|
|
926
|
-
workflows: 'docs/WORKFLOWS.md - Constraint validation workflows, requirement tracking (602 lines, ~30k tokens)',
|
|
927
|
-
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions, enum values (category/priority) (339 lines, ~17k tokens)',
|
|
928
|
-
best_practices: 'docs/BEST_PRACTICES.md - When to use constraints, common patterns (345 lines, ~17k tokens)'
|
|
929
|
-
}
|
|
930
|
-
};
|
|
458
|
+
result = constraintHelp();
|
|
931
459
|
break;
|
|
932
460
|
case 'example':
|
|
933
|
-
result =
|
|
934
|
-
tool: 'constraint',
|
|
935
|
-
description: 'Comprehensive constraint examples for various use cases',
|
|
936
|
-
categories: {
|
|
937
|
-
performance: {
|
|
938
|
-
description: 'Performance-related constraints for response times, throughput, resource usage',
|
|
939
|
-
examples: [
|
|
940
|
-
{
|
|
941
|
-
scenario: 'API Response Time',
|
|
942
|
-
example: '{ action: "add", category: "performance", constraint_text: "All API endpoints must respond within 100ms for 95th percentile", priority: "high", layer: "business", tags: ["api", "latency"] }',
|
|
943
|
-
rationale: 'Ensures fast user experience and prevents timeout issues'
|
|
944
|
-
},
|
|
945
|
-
{
|
|
946
|
-
scenario: 'Database Query Performance',
|
|
947
|
-
example: '{ action: "add", category: "performance", constraint_text: "Database queries must complete within 50ms", priority: "high", layer: "data", tags: ["database", "query"] }',
|
|
948
|
-
rationale: 'Prevents database bottlenecks and ensures scalability'
|
|
949
|
-
},
|
|
950
|
-
{
|
|
951
|
-
scenario: 'Memory Usage',
|
|
952
|
-
example: '{ action: "add", category: "performance", constraint_text: "Peak memory usage must not exceed 512MB per instance", priority: "critical", layer: "infrastructure", tags: ["memory", "resource"] }',
|
|
953
|
-
rationale: 'Prevents out-of-memory errors in containerized environments'
|
|
954
|
-
}
|
|
955
|
-
]
|
|
956
|
-
},
|
|
957
|
-
architecture: {
|
|
958
|
-
description: 'Architectural constraints for code structure, dependencies, patterns',
|
|
959
|
-
examples: [
|
|
960
|
-
{
|
|
961
|
-
scenario: 'Layer Dependency Rules',
|
|
962
|
-
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"] }',
|
|
963
|
-
rationale: 'Enforces clean architecture and separation of concerns'
|
|
964
|
-
},
|
|
965
|
-
{
|
|
966
|
-
scenario: 'Dependency Injection',
|
|
967
|
-
example: '{ action: "add", category: "architecture", constraint_text: "All service classes must use constructor-based dependency injection", priority: "medium", layer: "business", tags: ["di", "testability"] }',
|
|
968
|
-
rationale: 'Improves testability and reduces coupling'
|
|
969
|
-
},
|
|
970
|
-
{
|
|
971
|
-
scenario: 'API Versioning',
|
|
972
|
-
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"] }',
|
|
973
|
-
rationale: 'Enables backward compatibility and smooth API evolution'
|
|
974
|
-
}
|
|
975
|
-
]
|
|
976
|
-
},
|
|
977
|
-
security: {
|
|
978
|
-
description: 'Security constraints for authentication, authorization, data protection',
|
|
979
|
-
examples: [
|
|
980
|
-
{
|
|
981
|
-
scenario: 'Authentication Required',
|
|
982
|
-
example: '{ action: "add", category: "security", constraint_text: "All non-public endpoints must require JWT authentication", priority: "critical", layer: "presentation", tags: ["auth", "jwt"] }',
|
|
983
|
-
rationale: 'Prevents unauthorized access to protected resources'
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
scenario: 'Data Encryption',
|
|
987
|
-
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"] }',
|
|
988
|
-
rationale: 'Protects sensitive data and ensures compliance'
|
|
989
|
-
},
|
|
990
|
-
{
|
|
991
|
-
scenario: 'Input Validation',
|
|
992
|
-
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"] }',
|
|
993
|
-
rationale: 'Prevents injection attacks (SQL, XSS, etc.)'
|
|
994
|
-
}
|
|
995
|
-
]
|
|
996
|
-
}
|
|
997
|
-
},
|
|
998
|
-
workflows: {
|
|
999
|
-
constraint_validation: {
|
|
1000
|
-
description: 'Workflow for validating code against constraints',
|
|
1001
|
-
steps: [
|
|
1002
|
-
{
|
|
1003
|
-
step: 1,
|
|
1004
|
-
action: 'Retrieve active constraints for layer',
|
|
1005
|
-
example: '{ action: "get", layer: "business", active_only: true }'
|
|
1006
|
-
},
|
|
1007
|
-
{
|
|
1008
|
-
step: 2,
|
|
1009
|
-
action: 'Check code changes against constraints',
|
|
1010
|
-
example: 'Review file changes and verify compliance with each constraint'
|
|
1011
|
-
},
|
|
1012
|
-
{
|
|
1013
|
-
step: 3,
|
|
1014
|
-
action: 'Report violations',
|
|
1015
|
-
example: 'Use message tool to send warnings for constraint violations'
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
step: 4,
|
|
1019
|
-
action: 'Link violations to tasks',
|
|
1020
|
-
example: 'Create tasks to fix violations and link to relevant constraints'
|
|
1021
|
-
}
|
|
1022
|
-
]
|
|
1023
|
-
},
|
|
1024
|
-
requirement_tracking: {
|
|
1025
|
-
description: 'Workflow for tracking requirements as constraints',
|
|
1026
|
-
steps: [
|
|
1027
|
-
{
|
|
1028
|
-
step: 1,
|
|
1029
|
-
action: 'Add requirement as constraint',
|
|
1030
|
-
example: '{ action: "add", category: "performance", constraint_text: "System must handle 1000 concurrent users", priority: "high", tags: ["requirement", "load"] }'
|
|
1031
|
-
},
|
|
1032
|
-
{
|
|
1033
|
-
step: 2,
|
|
1034
|
-
action: 'Link related decisions',
|
|
1035
|
-
example: 'Use decision tool to record architectural decisions that address the constraint'
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
step: 3,
|
|
1039
|
-
action: 'Create implementation tasks',
|
|
1040
|
-
example: 'Use task tool to break down implementation and link to constraint'
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1043
|
-
step: 4,
|
|
1044
|
-
action: 'Validate compliance',
|
|
1045
|
-
example: 'Test implementation against constraint criteria'
|
|
1046
|
-
}
|
|
1047
|
-
]
|
|
1048
|
-
}
|
|
1049
|
-
},
|
|
1050
|
-
best_practices: {
|
|
1051
|
-
writing_constraints: [
|
|
1052
|
-
'Be specific and measurable (use numbers, percentages, time limits)',
|
|
1053
|
-
'Include rationale in tags or separate documentation',
|
|
1054
|
-
'Use appropriate priority (critical for must-have, high for important, medium/low for nice-to-have)',
|
|
1055
|
-
'Assign to correct layer (where constraint is enforced)',
|
|
1056
|
-
'Tag comprehensively for easy retrieval'
|
|
1057
|
-
],
|
|
1058
|
-
managing_constraints: [
|
|
1059
|
-
'Review constraints regularly and deactivate outdated ones',
|
|
1060
|
-
'Link constraints to related decisions and tasks',
|
|
1061
|
-
'Use constraints for both technical and business requirements',
|
|
1062
|
-
'Validate code changes against active constraints',
|
|
1063
|
-
'Document constraint violations and remediation plans'
|
|
1064
|
-
]
|
|
1065
|
-
}
|
|
1066
|
-
};
|
|
461
|
+
result = constraintExample();
|
|
1067
462
|
break;
|
|
1068
463
|
default: throw new Error(`Unknown action: ${params.action}`);
|
|
1069
464
|
}
|
|
@@ -1091,131 +486,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1091
486
|
result = flushWAL();
|
|
1092
487
|
break;
|
|
1093
488
|
case 'help':
|
|
1094
|
-
result =
|
|
1095
|
-
tool: 'stats',
|
|
1096
|
-
description: 'View database statistics, activity logs, manage data cleanup, and WAL checkpoints',
|
|
1097
|
-
note: '💡 TIP: Use action: "example" to see comprehensive usage scenarios and real-world examples for all stats actions.',
|
|
1098
|
-
actions: {
|
|
1099
|
-
layer_summary: 'Get summary by layer. No params required',
|
|
1100
|
-
db_stats: 'Get database statistics. No params required',
|
|
1101
|
-
clear: 'Clear old data. Params: messages_older_than_hours, file_changes_older_than_days',
|
|
1102
|
-
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)',
|
|
1103
|
-
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.'
|
|
1104
|
-
},
|
|
1105
|
-
examples: {
|
|
1106
|
-
layer_summary: '{ action: "layer_summary" }',
|
|
1107
|
-
db_stats: '{ action: "db_stats" }',
|
|
1108
|
-
clear: '{ action: "clear", messages_older_than_hours: 48, file_changes_older_than_days: 14 }',
|
|
1109
|
-
activity_log: '{ action: "activity_log", since: "1h", agent_names: ["bot1", "bot2"], limit: 50 }',
|
|
1110
|
-
flush: '{ action: "flush" }'
|
|
1111
|
-
},
|
|
1112
|
-
documentation: {
|
|
1113
|
-
workflows: 'docs/WORKFLOWS.md - Activity monitoring, automatic cleanup workflows (602 lines, ~30k tokens)',
|
|
1114
|
-
best_practices: 'docs/BEST_PRACTICES.md - Database health, cleanup strategies (345 lines, ~17k tokens)',
|
|
1115
|
-
shared_concepts: 'docs/SHARED_CONCEPTS.md - Layer definitions for layer_summary (339 lines, ~17k tokens)',
|
|
1116
|
-
architecture: 'docs/ARCHITECTURE.md - Database schema, views, statistics tables'
|
|
1117
|
-
}
|
|
1118
|
-
};
|
|
489
|
+
result = statsHelp();
|
|
1119
490
|
break;
|
|
1120
491
|
case 'example':
|
|
1121
|
-
result =
|
|
1122
|
-
tool: 'stats',
|
|
1123
|
-
description: 'Database statistics and maintenance examples',
|
|
1124
|
-
scenarios: {
|
|
1125
|
-
layer_analysis: {
|
|
1126
|
-
title: 'Architecture Layer Summary',
|
|
1127
|
-
example: {
|
|
1128
|
-
request: '{ action: "layer_summary" }',
|
|
1129
|
-
response_structure: '{ layer: string, decision_count: number, file_changes: number, active_constraints: number }[]',
|
|
1130
|
-
use_case: 'Understand which layers have most activity and decisions'
|
|
1131
|
-
}
|
|
1132
|
-
},
|
|
1133
|
-
database_health: {
|
|
1134
|
-
title: 'Database Statistics',
|
|
1135
|
-
example: {
|
|
1136
|
-
request: '{ action: "db_stats" }',
|
|
1137
|
-
response_structure: '{ decisions: N, messages: N, file_changes: N, constraints: N, db_size_mb: N }',
|
|
1138
|
-
use_case: 'Monitor database growth and table sizes'
|
|
1139
|
-
}
|
|
1140
|
-
},
|
|
1141
|
-
activity_monitoring: {
|
|
1142
|
-
title: 'Activity Log Queries',
|
|
1143
|
-
examples: [
|
|
1144
|
-
{
|
|
1145
|
-
scenario: 'Recent activity (last hour)',
|
|
1146
|
-
request: '{ action: "activity_log", since: "1h", limit: 50 }',
|
|
1147
|
-
explanation: 'View all agent activity in the past hour'
|
|
1148
|
-
},
|
|
1149
|
-
{
|
|
1150
|
-
scenario: 'Specific agent activity',
|
|
1151
|
-
request: '{ action: "activity_log", since: "24h", agent_names: ["backend-agent", "frontend-agent"] }',
|
|
1152
|
-
explanation: 'Track what specific agents have been doing'
|
|
1153
|
-
},
|
|
1154
|
-
{
|
|
1155
|
-
scenario: 'Filter by action type',
|
|
1156
|
-
request: '{ action: "activity_log", since: "2d", actions: ["set_decision", "create_task"] }',
|
|
1157
|
-
explanation: 'See only specific types of actions'
|
|
1158
|
-
}
|
|
1159
|
-
]
|
|
1160
|
-
},
|
|
1161
|
-
data_cleanup: {
|
|
1162
|
-
title: 'Maintenance and Cleanup',
|
|
1163
|
-
examples: [
|
|
1164
|
-
{
|
|
1165
|
-
scenario: 'Manual cleanup with specific retention',
|
|
1166
|
-
request: '{ action: "clear", messages_older_than_hours: 48, file_changes_older_than_days: 14 }',
|
|
1167
|
-
explanation: 'Override config and delete old data'
|
|
1168
|
-
},
|
|
1169
|
-
{
|
|
1170
|
-
scenario: 'Config-based automatic cleanup',
|
|
1171
|
-
request: '{ action: "clear" }',
|
|
1172
|
-
explanation: 'Use configured retention settings (respects weekend-aware mode)'
|
|
1173
|
-
}
|
|
1174
|
-
]
|
|
1175
|
-
},
|
|
1176
|
-
wal_management: {
|
|
1177
|
-
title: 'WAL Checkpoint (Git Workflow)',
|
|
1178
|
-
workflow: [
|
|
1179
|
-
{
|
|
1180
|
-
step: 1,
|
|
1181
|
-
action: 'Make changes to context (decisions, tasks, etc.)',
|
|
1182
|
-
explanation: 'SQLite WAL mode keeps changes in separate file'
|
|
1183
|
-
},
|
|
1184
|
-
{
|
|
1185
|
-
step: 2,
|
|
1186
|
-
action: 'Before git commit, flush WAL',
|
|
1187
|
-
request: '{ action: "flush" }',
|
|
1188
|
-
explanation: 'Merges WAL changes into main .db file'
|
|
1189
|
-
},
|
|
1190
|
-
{
|
|
1191
|
-
step: 3,
|
|
1192
|
-
action: 'Commit database file',
|
|
1193
|
-
explanation: 'Database file now contains all changes for version control'
|
|
1194
|
-
}
|
|
1195
|
-
]
|
|
1196
|
-
}
|
|
1197
|
-
},
|
|
1198
|
-
best_practices: {
|
|
1199
|
-
monitoring: [
|
|
1200
|
-
'Check layer_summary regularly to identify hotspots',
|
|
1201
|
-
'Monitor db_stats to prevent database bloat',
|
|
1202
|
-
'Use activity_log for debugging multi-agent issues',
|
|
1203
|
-
'Set appropriate retention periods based on project needs'
|
|
1204
|
-
],
|
|
1205
|
-
cleanup: [
|
|
1206
|
-
'Run periodic cleanup to manage database size',
|
|
1207
|
-
'Use weekend-aware mode for business hour retention',
|
|
1208
|
-
'Consider longer retention for important decisions',
|
|
1209
|
-
'Test cleanup with manual parameters before automating'
|
|
1210
|
-
],
|
|
1211
|
-
wal_checkpoints: [
|
|
1212
|
-
'Always flush before git commits for clean diffs',
|
|
1213
|
-
'WAL mode improves concurrent access performance',
|
|
1214
|
-
'Checkpoint automatically happens on shutdown',
|
|
1215
|
-
'Manual flush ensures immediate persistence'
|
|
1216
|
-
]
|
|
1217
|
-
}
|
|
1218
|
-
};
|
|
492
|
+
result = statsExample();
|
|
1219
493
|
break;
|
|
1220
494
|
default: throw new Error(`Unknown action: ${params.action}`);
|
|
1221
495
|
}
|
|
@@ -1229,101 +503,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1229
503
|
result = updateConfig(params);
|
|
1230
504
|
break;
|
|
1231
505
|
case 'help':
|
|
1232
|
-
result =
|
|
1233
|
-
tool: 'config',
|
|
1234
|
-
description: 'Manage auto-deletion configuration (weekend-aware retention)',
|
|
1235
|
-
note: '💡 TIP: Use action: "example" to see comprehensive usage scenarios and real-world examples for all config actions.',
|
|
1236
|
-
actions: {
|
|
1237
|
-
get: 'Get current config. No params required',
|
|
1238
|
-
update: 'Update config. Params: ignoreWeekend, messageRetentionHours (1-168), fileHistoryRetentionDays (1-90)'
|
|
1239
|
-
},
|
|
1240
|
-
examples: {
|
|
1241
|
-
get: '{ action: "get" }',
|
|
1242
|
-
update: '{ action: "update", ignoreWeekend: true, messageRetentionHours: 48 }'
|
|
1243
|
-
},
|
|
1244
|
-
documentation: {
|
|
1245
|
-
shared_concepts: 'docs/SHARED_CONCEPTS.md - Weekend-aware retention behavior explained (339 lines, ~17k tokens)',
|
|
1246
|
-
best_practices: 'docs/BEST_PRACTICES.md - Retention strategies, cleanup timing (345 lines, ~17k tokens)',
|
|
1247
|
-
architecture: 'docs/ARCHITECTURE.md - Auto-cleanup architecture, configuration system'
|
|
1248
|
-
}
|
|
1249
|
-
};
|
|
506
|
+
result = configHelp();
|
|
1250
507
|
break;
|
|
1251
508
|
case 'example':
|
|
1252
|
-
result =
|
|
1253
|
-
tool: 'config',
|
|
1254
|
-
description: 'Configuration management examples',
|
|
1255
|
-
scenarios: {
|
|
1256
|
-
view_config: {
|
|
1257
|
-
title: 'Current Configuration',
|
|
1258
|
-
example: {
|
|
1259
|
-
request: '{ action: "get" }',
|
|
1260
|
-
response: '{ ignoreWeekend: boolean, messageRetentionHours: number, fileHistoryRetentionDays: number }',
|
|
1261
|
-
explanation: 'View current auto-deletion settings'
|
|
1262
|
-
}
|
|
1263
|
-
},
|
|
1264
|
-
standard_retention: {
|
|
1265
|
-
title: 'Standard Time-Based Retention',
|
|
1266
|
-
example: {
|
|
1267
|
-
request: '{ action: "update", ignoreWeekend: false, messageRetentionHours: 24, fileHistoryRetentionDays: 7 }',
|
|
1268
|
-
explanation: 'Messages deleted after 24 hours, file history after 7 days (strict time-based)'
|
|
1269
|
-
}
|
|
1270
|
-
},
|
|
1271
|
-
weekend_aware: {
|
|
1272
|
-
title: 'Weekend-Aware Retention',
|
|
1273
|
-
example: {
|
|
1274
|
-
request: '{ action: "update", ignoreWeekend: true, messageRetentionHours: 24, fileHistoryRetentionDays: 7 }',
|
|
1275
|
-
explanation: 'On Monday, 24h retention = Friday (skips weekend)',
|
|
1276
|
-
scenario: 'Useful for business-hour contexts where weekend messages should persist'
|
|
1277
|
-
}
|
|
1278
|
-
},
|
|
1279
|
-
extended_retention: {
|
|
1280
|
-
title: 'Long-Term Project Retention',
|
|
1281
|
-
example: {
|
|
1282
|
-
request: '{ action: "update", messageRetentionHours: 168, fileHistoryRetentionDays: 90 }',
|
|
1283
|
-
explanation: '1 week message retention, 90 days file history (max allowed)',
|
|
1284
|
-
use_case: 'Long-running projects needing extended context'
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
},
|
|
1288
|
-
retention_behavior: {
|
|
1289
|
-
ignoreWeekend_false: {
|
|
1290
|
-
description: 'Standard time-based retention',
|
|
1291
|
-
examples: [
|
|
1292
|
-
'24h on Monday = 24 hours ago (Sunday)',
|
|
1293
|
-
'24h on Friday = 24 hours ago (Thursday)',
|
|
1294
|
-
'Straightforward chronological deletion'
|
|
1295
|
-
]
|
|
1296
|
-
},
|
|
1297
|
-
ignoreWeekend_true: {
|
|
1298
|
-
description: 'Business-hours retention (skips Sat/Sun)',
|
|
1299
|
-
examples: [
|
|
1300
|
-
'24h on Monday = Friday (skips Sat/Sun)',
|
|
1301
|
-
'24h on Tuesday = Monday',
|
|
1302
|
-
'24h on Friday = Thursday',
|
|
1303
|
-
'24h on Saturday/Sunday = Friday',
|
|
1304
|
-
'Preserves weekend messages until Monday cleanup'
|
|
1305
|
-
]
|
|
1306
|
-
}
|
|
1307
|
-
},
|
|
1308
|
-
best_practices: {
|
|
1309
|
-
choosing_retention: [
|
|
1310
|
-
'Short projects: 24h messages, 7d file history',
|
|
1311
|
-
'Medium projects: 72h messages, 14d file history',
|
|
1312
|
-
'Long projects: 168h (1 week) messages, 30-90d file history',
|
|
1313
|
-
'Use ignoreWeekend=true for business-hour focused work'
|
|
1314
|
-
],
|
|
1315
|
-
limits: [
|
|
1316
|
-
'messageRetentionHours: 1-168 (1 hour to 1 week)',
|
|
1317
|
-
'fileHistoryRetentionDays: 1-90',
|
|
1318
|
-
'Choose based on your projects needs and database size constraints'
|
|
1319
|
-
],
|
|
1320
|
-
cli_override: [
|
|
1321
|
-
'Can override config at server startup via CLI args',
|
|
1322
|
-
'--autodelete-ignore-weekend, --autodelete-message-hours, --autodelete-file-history-days',
|
|
1323
|
-
'Runtime updates via config tool take precedence over CLI'
|
|
1324
|
-
]
|
|
1325
|
-
}
|
|
1326
|
-
};
|
|
509
|
+
result = configExample();
|
|
1327
510
|
break;
|
|
1328
511
|
default: throw new Error(`Unknown action: ${params.action}`);
|
|
1329
512
|
}
|
|
@@ -1363,179 +546,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1363
546
|
case 'get_dependencies':
|
|
1364
547
|
result = getDependencies(params);
|
|
1365
548
|
break;
|
|
549
|
+
case 'watcher':
|
|
550
|
+
result = watcherStatus(params);
|
|
551
|
+
break;
|
|
1366
552
|
case 'help':
|
|
1367
553
|
result = taskHelp();
|
|
1368
554
|
break;
|
|
1369
555
|
case 'example':
|
|
1370
|
-
result =
|
|
1371
|
-
tool: 'task',
|
|
1372
|
-
description: 'Comprehensive task management examples for Kanban-style workflow',
|
|
1373
|
-
scenarios: {
|
|
1374
|
-
basic_task_management: {
|
|
1375
|
-
title: 'Creating and Managing Tasks',
|
|
1376
|
-
examples: [
|
|
1377
|
-
{
|
|
1378
|
-
scenario: 'Create a new task',
|
|
1379
|
-
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"] }',
|
|
1380
|
-
explanation: 'Creates task in todo status with high priority'
|
|
1381
|
-
},
|
|
1382
|
-
{
|
|
1383
|
-
scenario: 'Get task details',
|
|
1384
|
-
request: '{ action: "get", task_id: 5 }',
|
|
1385
|
-
response: 'Full task details including metadata, links, and timestamps'
|
|
1386
|
-
},
|
|
1387
|
-
{
|
|
1388
|
-
scenario: 'List tasks by status',
|
|
1389
|
-
request: '{ action: "list", status: "in_progress", limit: 20 }',
|
|
1390
|
-
explanation: 'View all in-progress tasks'
|
|
1391
|
-
}
|
|
1392
|
-
]
|
|
1393
|
-
},
|
|
1394
|
-
status_workflow: {
|
|
1395
|
-
title: 'Task Lifecycle (Status Transitions)',
|
|
1396
|
-
workflow: [
|
|
1397
|
-
{
|
|
1398
|
-
step: 1,
|
|
1399
|
-
status: 'todo',
|
|
1400
|
-
action: '{ action: "create", title: "...", status: "todo" }',
|
|
1401
|
-
description: 'Task created and waiting to be started'
|
|
1402
|
-
},
|
|
1403
|
-
{
|
|
1404
|
-
step: 2,
|
|
1405
|
-
status: 'in_progress',
|
|
1406
|
-
action: '{ action: "move", task_id: 1, new_status: "in_progress" }',
|
|
1407
|
-
description: 'Agent starts working on task'
|
|
1408
|
-
},
|
|
1409
|
-
{
|
|
1410
|
-
step: 3,
|
|
1411
|
-
status: 'waiting_review',
|
|
1412
|
-
action: '{ action: "move", task_id: 1, new_status: "waiting_review" }',
|
|
1413
|
-
description: 'Work complete, awaiting review/approval'
|
|
1414
|
-
},
|
|
1415
|
-
{
|
|
1416
|
-
step: 4,
|
|
1417
|
-
status: 'done',
|
|
1418
|
-
action: '{ action: "move", task_id: 1, new_status: "done" }',
|
|
1419
|
-
description: 'Task reviewed and completed'
|
|
1420
|
-
},
|
|
1421
|
-
{
|
|
1422
|
-
step: 5,
|
|
1423
|
-
status: 'archived',
|
|
1424
|
-
action: '{ action: "archive", task_id: 1 }',
|
|
1425
|
-
description: 'Task archived for historical record'
|
|
1426
|
-
}
|
|
1427
|
-
],
|
|
1428
|
-
blocked_status: {
|
|
1429
|
-
description: 'Use "blocked" when task cannot proceed due to dependencies',
|
|
1430
|
-
example: '{ action: "move", task_id: 1, new_status: "blocked" }'
|
|
1431
|
-
}
|
|
1432
|
-
},
|
|
1433
|
-
auto_stale_detection: {
|
|
1434
|
-
title: 'Automatic Stale Task Management',
|
|
1435
|
-
behavior: [
|
|
1436
|
-
{
|
|
1437
|
-
rule: 'in_progress > 2 hours → waiting_review',
|
|
1438
|
-
explanation: 'Tasks stuck in progress auto-move to waiting_review',
|
|
1439
|
-
rationale: 'Prevents tasks from being forgotten while in progress'
|
|
1440
|
-
},
|
|
1441
|
-
{
|
|
1442
|
-
rule: 'waiting_review > 24 hours → todo',
|
|
1443
|
-
explanation: 'Unreviewed tasks return to todo queue',
|
|
1444
|
-
rationale: 'Ensures waiting tasks dont accumulate indefinitely'
|
|
1445
|
-
}
|
|
1446
|
-
],
|
|
1447
|
-
configuration: {
|
|
1448
|
-
keys: ['task_stale_hours_in_progress', 'task_stale_hours_waiting_review', 'task_auto_stale_enabled'],
|
|
1449
|
-
note: 'Configure via config table in database'
|
|
1450
|
-
}
|
|
1451
|
-
},
|
|
1452
|
-
task_linking: {
|
|
1453
|
-
title: 'Linking Tasks to Context',
|
|
1454
|
-
examples: [
|
|
1455
|
-
{
|
|
1456
|
-
scenario: 'Link task to decision',
|
|
1457
|
-
request: '{ action: "link", task_id: 5, link_type: "decision", target_id: "api_auth_method", link_relation: "implements" }',
|
|
1458
|
-
explanation: 'Track which tasks implement specific decisions'
|
|
1459
|
-
},
|
|
1460
|
-
{
|
|
1461
|
-
scenario: 'Link task to constraint',
|
|
1462
|
-
request: '{ action: "link", task_id: 5, link_type: "constraint", target_id: 3, link_relation: "addresses" }',
|
|
1463
|
-
explanation: 'Show task addresses a performance/architecture/security constraint'
|
|
1464
|
-
},
|
|
1465
|
-
{
|
|
1466
|
-
scenario: 'Link task to file',
|
|
1467
|
-
request: '{ action: "link", task_id: 5, link_type: "file", target_id: "src/api/auth.ts", link_relation: "modifies" }',
|
|
1468
|
-
explanation: 'Indicate which files the task will modify'
|
|
1469
|
-
}
|
|
1470
|
-
]
|
|
1471
|
-
},
|
|
1472
|
-
batch_operations: {
|
|
1473
|
-
title: 'Batch Task Creation',
|
|
1474
|
-
examples: [
|
|
1475
|
-
{
|
|
1476
|
-
scenario: 'Create multiple related tasks',
|
|
1477
|
-
request: '{ action: "batch_create", tasks: [{"title": "Design API", "priority": 3}, {"title": "Implement API", "priority": 3}, {"title": "Write tests", "priority": 2}], atomic: false }',
|
|
1478
|
-
explanation: 'Create task breakdown - use atomic:false for best-effort'
|
|
1479
|
-
}
|
|
1480
|
-
]
|
|
1481
|
-
},
|
|
1482
|
-
filtering_queries: {
|
|
1483
|
-
title: 'Advanced Task Queries',
|
|
1484
|
-
examples: [
|
|
1485
|
-
{
|
|
1486
|
-
scenario: 'Find high-priority tasks for agent',
|
|
1487
|
-
request: '{ action: "list", assigned_agent: "backend-agent", priority: 3, status: "todo" }',
|
|
1488
|
-
note: 'Priority is numeric: 1=low, 2=medium, 3=high, 4=critical'
|
|
1489
|
-
},
|
|
1490
|
-
{
|
|
1491
|
-
scenario: 'Get all security-related tasks',
|
|
1492
|
-
request: '{ action: "list", tags: ["security"], limit: 50 }',
|
|
1493
|
-
explanation: 'Filter by tags for topic-based views'
|
|
1494
|
-
},
|
|
1495
|
-
{
|
|
1496
|
-
scenario: 'View infrastructure layer tasks',
|
|
1497
|
-
request: '{ action: "list", layer: "infrastructure" }',
|
|
1498
|
-
explanation: 'See all DevOps/config related tasks'
|
|
1499
|
-
}
|
|
1500
|
-
]
|
|
1501
|
-
}
|
|
1502
|
-
},
|
|
1503
|
-
valid_transitions: {
|
|
1504
|
-
from_todo: ['in_progress', 'blocked', 'done', 'archived'],
|
|
1505
|
-
from_in_progress: ['waiting_review', 'blocked', 'todo'],
|
|
1506
|
-
from_waiting_review: ['done', 'in_progress', 'todo'],
|
|
1507
|
-
from_blocked: ['todo', 'in_progress'],
|
|
1508
|
-
from_done: ['archived', 'todo'],
|
|
1509
|
-
from_archived: []
|
|
1510
|
-
},
|
|
1511
|
-
best_practices: {
|
|
1512
|
-
task_creation: [
|
|
1513
|
-
'Use descriptive titles (200 char max)',
|
|
1514
|
-
'Set appropriate priority: 1=low, 2=medium (default), 3=high, 4=critical',
|
|
1515
|
-
'Assign to layer where work will be done',
|
|
1516
|
-
'Tag comprehensively for easy filtering',
|
|
1517
|
-
'Include acceptance_criteria for complex tasks'
|
|
1518
|
-
],
|
|
1519
|
-
status_management: [
|
|
1520
|
-
'Move to in_progress when starting work',
|
|
1521
|
-
'Use waiting_review for completed but unverified work',
|
|
1522
|
-
'Set to blocked with notes explaining dependency',
|
|
1523
|
-
'Archive done tasks periodically for cleaner views'
|
|
1524
|
-
],
|
|
1525
|
-
linking: [
|
|
1526
|
-
'Link tasks to decisions they implement',
|
|
1527
|
-
'Link to constraints they address',
|
|
1528
|
-
'Link to files they will modify',
|
|
1529
|
-
'Use descriptive link_relation values'
|
|
1530
|
-
],
|
|
1531
|
-
coordination: [
|
|
1532
|
-
'Use assigned_agent for clear ownership',
|
|
1533
|
-
'Filter by status for Kanban board views',
|
|
1534
|
-
'Monitor auto-stale transitions for stuck work',
|
|
1535
|
-
'Use tags for cross-cutting concerns (security, performance, etc.)'
|
|
1536
|
-
]
|
|
1537
|
-
}
|
|
1538
|
-
};
|
|
556
|
+
result = taskExample();
|
|
1539
557
|
break;
|
|
1540
558
|
default: throw new Error(`Unknown action: ${params.action}`);
|
|
1541
559
|
}
|