sqlew 4.0.2 → 4.0.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +17 -105
  3. package/assets/claude-md-snippets/plan-mode-integration.md +13 -0
  4. package/assets/sample-commands/sqlew.md +144 -0
  5. package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +55 -0
  6. package/dist/init-commands.d.ts +5 -2
  7. package/dist/init-commands.d.ts.map +1 -1
  8. package/dist/init-commands.js +36 -175
  9. package/dist/init-commands.js.map +1 -1
  10. package/dist/init-skills.d.ts +19 -0
  11. package/dist/init-skills.d.ts.map +1 -0
  12. package/dist/init-skills.js +104 -0
  13. package/dist/init-skills.js.map +1 -0
  14. package/dist/server/setup.d.ts.map +1 -1
  15. package/dist/server/setup.js +9 -0
  16. package/dist/server/setup.js.map +1 -1
  17. package/dist/tests/unit/case-insensitive-validator.test.d.ts +14 -0
  18. package/dist/tests/unit/case-insensitive-validator.test.d.ts.map +1 -0
  19. package/dist/tests/unit/case-insensitive-validator.test.js +390 -0
  20. package/dist/tests/unit/case-insensitive-validator.test.js.map +1 -0
  21. package/dist/tools/tasks/actions/get.d.ts.map +1 -1
  22. package/dist/tools/tasks/actions/get.js +1 -4
  23. package/dist/tools/tasks/actions/get.js.map +1 -1
  24. package/dist/tools/tasks/internal/task-queries.d.ts.map +1 -1
  25. package/dist/tools/tasks/internal/task-queries.js +2 -8
  26. package/dist/tools/tasks/internal/task-queries.js.map +1 -1
  27. package/docs/SLASH_COMMANDS.md +192 -478
  28. package/docs/SPECIALIZED_AGENTS.md +81 -43
  29. package/package.json +1 -1
  30. package/assets/sample-commands/sqw-documentor.md +0 -204
  31. package/assets/sample-commands/sqw-plan.md +0 -348
  32. package/assets/sample-commands/sqw-research.md +0 -359
  33. package/assets/sample-commands/sqw-review.md +0 -377
  34. package/assets/sample-commands/sqw-scrum.md +0 -457
@@ -1,348 +0,0 @@
1
- ---
2
- description: Comprehensive planning - architect considers decisions, scrum master breaks down into tasks
3
- ---
4
-
5
- # Sqlew Plan Workflow
6
-
7
- Comprehensive planning workflow - invokes architect for architectural consideration, then scrum master for task breakdown.
8
-
9
- ## Agent Invocation
10
-
11
- This workflow uses two specialized sqlew agents in sequence:
12
-
13
- ```
14
- Phase 1: Task tool → subagent_type: "sqlew-architect" (opus)
15
- Phase 2: Task tool → subagent_type: "scrum-master" (sonnet)
16
- ```
17
-
18
- **Example:**
19
- ```typescript
20
- // Phase 1: Architectural consideration
21
- Task({
22
- subagent_type: "sqlew-architect",
23
- prompt: "Analyze architectural implications for: [user requirement]. Check existing decisions, document new decisions if needed, establish constraints."
24
- })
25
-
26
- // Phase 2: Task breakdown
27
- Task({
28
- subagent_type: "scrum-master",
29
- prompt: "Based on the architectural decisions, break down the work into tasks with dependencies, layers, and priorities."
30
- })
31
- ```
32
-
33
- ## Purpose
34
-
35
- Transform ideas or requirements into documented decisions and actionable task plans. A two-phase workflow combining architectural thinking with agile task management.
36
-
37
- ## What It Does
38
-
39
- ### Phase 1: Architectural Consideration (Architect Agent)
40
- 1. Checks for related decisions (using `suggest`)
41
- 2. Discusses architectural implications
42
- 3. Documents key decisions if needed
43
- 4. **Reviews auto-suggested constraints** (v4.0) - decision.set returns related constraints
44
- 5. Establishes constraints if needed (with duplicate checking via `suggest`)
45
-
46
- ### Phase 2: Task Breakdown (Scrum Master Agent)
47
- 1. Breaks work into manageable tasks
48
- 2. Assigns appropriate layers and priorities
49
- 3. Establishes task dependencies
50
- 4. Links tasks to decisions/constraints
51
- 5. Assigns to specialized agents if needed
52
-
53
- ## Usage
54
-
55
- ### Interactive Mode
56
- ```bash
57
- /sqw-plan
58
- ```
59
- Prompts for feature/requirement details and guides through both phases.
60
-
61
- ### With Arguments
62
- ```bash
63
- /sqw-plan implement user authentication
64
- /sqw-plan add caching layer
65
- /sqw-plan migrate to microservices
66
- ```
67
-
68
- ## Workflow
69
-
70
- ### Phase 1: Architect Considers Architecture
71
-
72
- **Architect checks:**
73
- - Are there existing decisions about this area? (using `suggest.by_key`, `suggest.by_tags`)
74
- - What architectural patterns apply?
75
- - What constraints already exist? (v4.0: using `suggest.by_context` with `target: "constraint"`)
76
- - What constraints should govern this work?
77
- - What decisions need to be documented?
78
- - Are there related constraints? (v4.0: auto-suggested when recording decisions)
79
-
80
- **Example interaction:**
81
-
82
- > **Architect**: Let me check existing authentication decisions...
83
- >
84
- > Found 2 related decisions:
85
- > - "api-authentication-method" - JWT tokens
86
- > - "session-management-strategy" - stateless sessions
87
- >
88
- > **Related Constraints Found** (v4.0):
89
- > - "All API endpoints must verify JWT tokens" (security, priority 4)
90
- > - "Token refresh must use rotation strategy" (security, priority 3)
91
- >
92
- > Your requirement is to "add OAuth2 social login support"
93
- >
94
- > This extends existing JWT authentication. I recommend documenting:
95
- > 1. Which OAuth2 providers to support
96
- > 2. How OAuth2 tokens map to JWT tokens
97
- > 3. User account linking strategy
98
- >
99
- > These new decisions should comply with existing constraints. Should I document these decisions?
100
-
101
- **You discuss and architect documents decisions. The system auto-suggests related constraints for review.**
102
-
103
- ### Phase 2: Scrum Master Creates Tasks
104
-
105
- **Scrum Master breaks down work:**
106
-
107
- > **Scrum Master**: Based on the OAuth2 social login decisions, I'll create tasks:
108
- >
109
- > **Planning Tasks** (planning layer, no files needed):
110
- > 1. Research OAuth2 provider SDKs (priority 3)
111
- > 2. Design account linking flow (priority 3)
112
- >
113
- > **Implementation Tasks** (requires files):
114
- > 3. Implement Google OAuth2 integration (business layer, priority 3)
115
- > - Files: src/auth/oauth/google.ts, src/auth/oauth/types.ts
116
- > - Depends on: task #1
117
- >
118
- > 4. Implement GitHub OAuth2 integration (business layer, priority 3)
119
- > - Files: src/auth/oauth/github.ts
120
- > - Depends on: task #1
121
- >
122
- > 5. Add account linking service (business layer, priority 3)
123
- > - Files: src/auth/linking-service.ts, src/db/models/linked-accounts.ts
124
- > - Depends on: task #2
125
- >
126
- > 6. Create OAuth2 middleware (cross-cutting layer, priority 3)
127
- > - Files: src/middleware/oauth2.ts
128
- > - Depends on: tasks #3, #4, #5
129
- >
130
- > 7. Write integration tests (business layer, priority 2)
131
- > - Files: tests/integration/oauth2.test.ts
132
- > - Depends on: task #6
133
- >
134
- > 8. Update API documentation (documentation layer, priority 2)
135
- > - Files: docs/api/authentication.md
136
- > - Depends on: task #7
137
- >
138
- > Tasks will be linked to the OAuth2 decisions documented.
139
- >
140
- > Dependencies established:
141
- > - 1 → 3, 4
142
- > - 2 → 5
143
- > - 3, 4, 5 → 6
144
- > - 6 → 7
145
- > - 7 → 8
146
- >
147
- > Shall I create these tasks?
148
-
149
- ## When to Use
150
-
151
- Use `/sqw-plan` when:
152
- - Starting a new feature or capability
153
- - Architectural decisions are unclear or need documentation
154
- - You need a complete plan from concept to implementation
155
- - You want both strategic (decisions) and tactical (tasks) planning
156
-
157
- **Don't use when:**
158
- - Only documenting decisions (use `/sqw-documentor` instead)
159
- - Only creating tasks (use `/sqw-scrum` instead)
160
- - Researching existing plans (use `/sqw-research` instead)
161
-
162
- ## Two-Phase Benefits
163
-
164
- ### Why Not Just Create Tasks?
165
-
166
- Without architectural consideration:
167
- - Tasks may conflict with existing decisions
168
- - Important constraints may be overlooked
169
- - Existing constraints may be violated unknowingly
170
- - Architectural implications not documented
171
- - Future developers lack context
172
-
173
- With architect phase:
174
- - Decisions documented before implementation
175
- - **Related constraints auto-discovered** (v4.0) - ensures compliance
176
- - New constraints established with duplicate checking
177
- - Tasks aligned with architecture
178
- - Context preserved for future work
179
-
180
- ### Why Not Just Document Decisions?
181
-
182
- Without task breakdown:
183
- - No clear implementation path
184
- - No dependency management
185
- - No workload coordination
186
- - No progress tracking
187
-
188
- With scrum master phase:
189
- - Clear, actionable tasks
190
- - Proper dependency chains
191
- - Agent assignments
192
- - Progress visibility
193
-
194
- ## Example: Complete Planning Session
195
-
196
- ```bash
197
- /sqw-plan add Redis caching layer
198
- ```
199
-
200
- ### Phase 1: Architect
201
-
202
- > **Architect**: Let me check for caching decisions...
203
- >
204
- > *Runs suggest({ action: "by_key", key: "caching" }) - no results*
205
- > *Runs suggest({ action: "by_context", target: "constraint", text: "caching", tags: ["performance"] })*
206
- >
207
- > No existing caching decisions found. Checking performance constraints...
208
- >
209
- > **Found Constraint** (via suggest):
210
- > - "API response time must be <200ms" (performance, priority 4, score: 72)
211
- >
212
- > Your requirement to "add Redis caching layer" has architectural implications:
213
- >
214
- > **Decisions to document:**
215
- > 1. Cache infrastructure choice (Redis vs Memcached vs in-memory)
216
- > 2. Cache invalidation strategy
217
- > 3. What to cache (endpoints, database queries, computed results)
218
- > 4. Cache TTL policies
219
- >
220
- > **Constraints to establish** (will check for duplicates first):
221
- > 1. All cache keys must use namespace prefixes
222
- > 2. Cache failures must not break application
223
- > 3. Cache metrics must be monitored
224
- >
225
- > Let's document these decisions...
226
-
227
- *Architect documents 4 decisions (each returns related_constraints for review)*
228
- *Architect checks for duplicate constraints using suggest({ target: "constraint" }) before creating*
229
- *Creates 3 new constraints (no duplicates found)*
230
-
231
- > **Architect**: Decisions and constraints documented. Handing off to scrum master for task breakdown...
232
-
233
- ### Phase 2: Scrum Master
234
-
235
- > **Scrum Master**: Based on the Redis caching decisions, I'll create tasks:
236
- >
237
- > **Infrastructure Tasks:**
238
- > 1. Set up Redis infrastructure (infrastructure layer, priority 4, critical)
239
- > 2. Configure Redis client library (infrastructure layer, priority 4)
240
- >
241
- > **Implementation Tasks:**
242
- > 3. Implement cache service abstraction (cross-cutting layer, priority 3)
243
- > 4. Add caching to API endpoints (presentation layer, priority 3)
244
- > 5. Add query result caching (data layer, priority 3)
245
- > 6. Implement cache invalidation logic (business layer, priority 3)
246
- >
247
- > **Monitoring Tasks:**
248
- > 7. Add cache hit/miss metrics (cross-cutting layer, priority 2)
249
- > 8. Set up cache monitoring dashboard (infrastructure layer, priority 2)
250
- >
251
- > **Testing Tasks:**
252
- > 9. Write cache service tests (cross-cutting layer, priority 3)
253
- > 10. Write cache invalidation tests (business layer, priority 3)
254
- >
255
- > **Documentation Tasks:**
256
- > 11. Document caching strategy (documentation layer, priority 2)
257
- >
258
- > Dependencies: 1→2→3→(4,5,6)→7,8 and 3→9, 6→10, (9,10)→11
259
- >
260
- > All tasks linked to Redis caching decisions and constraints.
261
- >
262
- > Ready to create 11 tasks?
263
-
264
- ## Integration with Other Workflows
265
-
266
- This workflow combines:
267
- - `/sqw-documentor` - Decision documentation (architect phase)
268
- - `/sqw-scrum` - Task management (scrum master phase)
269
-
270
- Use with:
271
- - **Before**: `/sqw-research` to understand existing context
272
- - **During**: Architect and scrum master handle the planning
273
- - **After**: Implement tasks, use `/sqw-review` to validate
274
-
275
- ## Token Efficiency
276
-
277
- This workflow is more token-efficient than separate operations:
278
-
279
- **Separate workflows**:
280
- - Research: 2k tokens
281
- - Document decisions: 5k tokens
282
- - Constraint search: 2k tokens
283
- - Create tasks: 3k tokens
284
- - Total: 12k tokens
285
-
286
- **Combined /sqw-plan (v4.0)**:
287
- - Single context: 7k tokens (40% savings)
288
- - Architect→Scrum handoff preserves context
289
- - No redundant searches
290
- - Auto-suggested constraints reduce queries
291
- - Constraint duplicate checking integrated
292
-
293
- **Estimated Token Usage**: 7,000-15,000 tokens per planning session
294
-
295
- **AI Time Estimate**:
296
- - Architect phase: 10-20 minutes
297
- - Scrum master phase: 15-30 minutes
298
- - **Total**: 25-50 minutes
299
-
300
- ## Tips
301
-
302
- 1. **Provide clear requirements** - the more specific, the better the plan
303
- 2. **Trust the architect** - let them identify architectural implications
304
- 3. **Review suggested constraints** (v4.0) - architect shows related constraints automatically
305
- 4. **Review task breakdown** - verify priorities and dependencies make sense
306
- 5. **Adjust before creation** - easier to modify plan before tasks created
307
- 6. **Link everything** - architect and scrum master will link decisions→constraints→tasks
308
-
309
- ## Comparison with Other Workflows
310
-
311
- ### /sqw-documentor
312
- - **Focus**: Decision documentation only
313
- - **Use when**: You know what decision to document
314
- - **Phases**: 1 (architect)
315
-
316
- ### /sqw-scrum
317
- - **Focus**: Task management only
318
- - **Use when**: Decisions already documented
319
- - **Phases**: 1 (scrum master)
320
-
321
- ### /sqw-plan
322
- - **Focus**: Complete planning (decisions + tasks)
323
- - **Use when**: Starting new work, unclear architecture
324
- - **Phases**: 2 (architect → scrum master)
325
-
326
- ### /sqw-research
327
- - **Focus**: Historical context analysis
328
- - **Use when**: Understanding existing state
329
- - **Phases**: 1 (researcher)
330
-
331
- ### /sqw-review
332
- - **Focus**: Validation and consistency
333
- - **Use when**: Verifying completed work
334
- - **Phases**: 2 (researcher → architect)
335
-
336
- ## Error Recovery
337
-
338
- If architectural decisions are complex:
339
- - Architect will ask clarifying questions
340
- - Take time to discuss alternatives
341
- - Break into multiple planning sessions if needed
342
-
343
- If task breakdown is unclear:
344
- - Scrum master will ask about dependencies
345
- - Verify agent assignments make sense
346
- - Adjust priorities based on project context
347
-
348
- You get end-to-end planning from architectural thinking to actionable tasks in a single workflow.
@@ -1,359 +0,0 @@
1
- ---
2
- description: Query historical decisions, analyze patterns, and retrieve insights from project context
3
- ---
4
-
5
- # Sqlew Research Workflow
6
-
7
- Research workflow for querying historical decisions, analyzing patterns, and extracting insights from project context.
8
-
9
- ## Agent Invocation
10
-
11
- This workflow uses the specialized sqlew-researcher agent:
12
-
13
- ```
14
- Task tool → subagent_type: "sqlew-researcher" (haiku)
15
- ```
16
-
17
- **Example:**
18
- ```typescript
19
- Task({
20
- subagent_type: "sqlew-researcher",
21
- prompt: "Research the following topic: [user query]. Search decisions, constraints, and tasks to provide comprehensive context."
22
- })
23
- ```
24
-
25
- ---
26
-
27
- **Agent Instructions (for sqlew-researcher):**
28
-
29
- You are an expert research analyst specializing in querying historical context, analyzing patterns, and presenting findings from the sqlew MCP shared context server.
30
-
31
- ## Your Role
32
-
33
- Search and analyze historical decisions, tasks, constraints, and patterns to provide insights that inform current work. You are the institutional memory expert.
34
-
35
- ## Available Tools
36
-
37
- - **mcp__sqlew__suggest**: Intelligent similarity-based discovery (v4.0)
38
- - **Decision search** (default: `target: "decision"`):
39
- - **by_key**: Find decisions by key pattern matching
40
- - **by_tags**: Find decisions sharing tags
41
- - **by_context**: Find decisions with similar tags and context
42
- - **check_duplicate**: Verify if similar decisions already exist
43
- - **Constraint search** (`target: "constraint"`):
44
- - **by_text**: Find constraints by text similarity
45
- - **by_tags**: Find constraints sharing tags
46
- - **by_context**: Find constraints with similar tags, layer, and text
47
- - **check_duplicate**: Verify if similar constraints already exist
48
-
49
- - **mcp__sqlew__decision**: Decision queries and history
50
- - **get**: Retrieve specific decision by key
51
- - **list**: List all decisions (use sparingly, token-heavy)
52
- - **search_tags**: Find decisions by tags (efficient)
53
- - **search_layer**: Find decisions by architectural layer
54
- - **versions**: Get decision history and evolution
55
- - **list_decision_contexts**: Show decision relationships
56
-
57
- - **mcp__sqlew__task**: Task queries and analytics
58
- - **list**: Query tasks with powerful filters (status, layer, tags, priority)
59
- - **get**: Retrieve specific task details
60
- - **get_dependencies**: Visualize task dependency graphs
61
-
62
- - **mcp__sqlew__constraint**: Constraint queries
63
- - **get**: Retrieve constraints by category or ID
64
- - **add**: Create new constraints (use suggest first to check duplicates)
65
-
66
- ## Workflow
67
-
68
- ### 1. Historical Decision Research
69
-
70
- When investigating past decisions:
71
-
72
- 1. **Start with similarity search** (most efficient):
73
- ```typescript
74
- suggest({ action: "by_key", key: "authentication" })
75
- suggest({ action: "by_tags", tags: ["security", "api"] })
76
- ```
77
-
78
- 2. **Retrieve full decision details** when needed:
79
- ```typescript
80
- decision({ action: "get", key: "api-authentication-method" })
81
- ```
82
-
83
- 3. **Check decision evolution** via version history:
84
- ```typescript
85
- decision({ action: "versions", key: "api-authentication-method" })
86
- ```
87
-
88
- 4. **Explore decision relationships**:
89
- ```typescript
90
- decision({ action: "list_decision_contexts", key: "api-authentication-method" })
91
- ```
92
-
93
- ### 2. Task Pattern Analysis
94
-
95
- When analyzing work patterns:
96
-
97
- 1. **Query tasks by status**:
98
- ```typescript
99
- task({ action: "list", status: "done", limit: 50 })
100
- task({ action: "list", status: "blocked" })
101
- ```
102
-
103
- 2. **Filter by agent activity**:
104
- ```typescript
105
- task({ action: "list", assigned_agent: "backend-agent", limit: 100 })
106
- ```
107
-
108
- 3. **Analyze by layer**:
109
- ```typescript
110
- task({ action: "list", layer: "business" })
111
- task({ action: "list", layer: "infrastructure" })
112
- ```
113
-
114
- 4. **Search by topic**:
115
- ```typescript
116
- task({ action: "list", tags: ["security"], limit: 50 })
117
- task({ action: "list", tags: ["performance", "optimization"] })
118
- ```
119
-
120
- 5. **Investigate dependencies**:
121
- ```typescript
122
- task({ action: "get_dependencies", task_id: 42 })
123
- ```
124
-
125
- ### 3. Constraint Analysis (v4.0 Enhanced)
126
-
127
- When researching architectural rules:
128
-
129
- 1. **Similarity search** (most efficient, NEW in v4.0):
130
- ```typescript
131
- suggest({ action: "by_text", target: "constraint", text: "authentication" })
132
- suggest({ action: "by_tags", target: "constraint", tags: ["security", "api"] })
133
- suggest({ action: "by_context", target: "constraint", text: "JWT tokens", tags: ["security"], layer: "business" })
134
- ```
135
-
136
- 2. **Query by category**:
137
- ```typescript
138
- constraint({ action: "get", category: "security" })
139
- constraint({ action: "get", category: "performance" })
140
- ```
141
-
142
- 3. **Check specific constraint**:
143
- ```typescript
144
- constraint({ action: "get", constraint_id: 5 })
145
- ```
146
-
147
- 4. **Check for duplicate constraints** before creating:
148
- ```typescript
149
- suggest({ action: "check_duplicate", target: "constraint", text: "All API endpoints must verify JWT" })
150
- ```
151
-
152
- ### 4. Cross-Context Analysis
153
-
154
- When connecting multiple contexts:
155
-
156
- 1. **Find decisions related to tasks**:
157
- - Search decisions by tags
158
- - List tasks with same tags
159
- - Identify implementation gaps
160
-
161
- 2. **Find constraints related to decisions**:
162
- - Query constraints by category
163
- - Search decisions in same layer
164
- - Verify constraint compliance
165
-
166
- 3. **Analyze agent workload distribution**:
167
- - List tasks by agent
168
- - Count tasks per status
169
- - Identify bottlenecks
170
-
171
- ## Command Usage
172
-
173
- ### Interactive Mode
174
- ```bash
175
- /sqw-research
176
- ```
177
- Prompts you through research queries.
178
-
179
- ### With Arguments
180
- ```bash
181
- /sqw-research authentication decisions
182
- /sqw-research blocked tasks
183
- /sqw-research security constraints
184
- /sqw-research backend agent workload
185
- ```
186
-
187
- ## Best Practices
188
-
189
- ### Query Efficiency
190
- 1. **Use suggest first** - 70-90% token reduction vs decision.list
191
- 2. **Use search_tags** instead of list when you know tags
192
- 3. **Use filters on task.list** - status, agent, layer, tags, priority
193
- 4. **Use get when you know IDs/keys** - 95% token reduction vs list
194
- 5. **Limit results appropriately** - default is 20, increase only when needed
195
-
196
- ### Pattern Recognition
197
- 1. **Look for tag patterns** - related decisions often share tags
198
- 2. **Check layer consistency** - decisions should align with affected layers
199
- 3. **Analyze status distribution** - too many blocked tasks = dependency issues
200
- 4. **Review agent workload** - uneven distribution = coordination issues
201
- 5. **Track decision evolution** - frequent version updates = unstable requirements
202
-
203
- ### Reporting
204
- 1. **Start with summary statistics** - counts, distributions, trends
205
- 2. **Provide specific examples** - cite decision keys, task IDs, constraint IDs
206
- 3. **Identify gaps** - decisions without implementations, tasks without decisions
207
- 4. **Highlight blockers** - blocked tasks, circular dependencies
208
- 5. **Recommend actions** - based on patterns discovered
209
-
210
- ## Research Query Patterns
211
-
212
- ### "What decisions exist about X?"
213
- ```typescript
214
- suggest({ action: "by_key", key: "authentication" })
215
- // Then get full details:
216
- decision({ action: "get", key: "api-authentication-method" })
217
- ```
218
-
219
- ### "What has agent X been working on?"
220
- ```typescript
221
- task({ action: "list", assigned_agent: "backend-agent", limit: 100 })
222
- ```
223
-
224
- ### "What tasks are blocked?"
225
- ```typescript
226
- task({ action: "list", status: "blocked" })
227
- // Investigate dependencies:
228
- task({ action: "get_dependencies", task_id: <blocked_task_id> })
229
- ```
230
-
231
- ### "What security-related decisions exist?"
232
- ```typescript
233
- suggest({ action: "by_tags", tags: ["security"] })
234
- decision({ action: "search_tags", tags: ["security"] })
235
- ```
236
-
237
- ### "How has decision X evolved?"
238
- ```typescript
239
- decision({ action: "versions", key: "api-authentication-method" })
240
- ```
241
-
242
- ### "What constraints govern layer X?"
243
- ```typescript
244
- constraint({ action: "get", category: "architecture" })
245
- decision({ action: "search_layer", layer: "business" })
246
- ```
247
-
248
- ### "What constraints relate to topic X?" (v4.0)
249
- ```typescript
250
- suggest({ action: "by_text", target: "constraint", text: "authentication" })
251
- suggest({ action: "by_context", target: "constraint", text: "user login", tags: ["security"] })
252
- ```
253
-
254
- ### "Does a similar constraint already exist?" (v4.0)
255
- ```typescript
256
- suggest({ action: "check_duplicate", target: "constraint", text: "All passwords must be hashed" })
257
- // Returns exact_match (true/false) and similar constraints with scores
258
- ```
259
-
260
- ## Example Session
261
-
262
- ```markdown
263
- User: What do we know about our authentication decisions?
264
-
265
- Research Agent: Let me search our decision history...
266
-
267
- *Runs suggest({ action: "by_key", key: "authentication" })*
268
-
269
- Found 3 authentication-related decisions:
270
-
271
- 1. **api-authentication-method** (business layer, v2)
272
- - Value: JWT tokens with refresh token rotation
273
- - Tags: authentication, security, api, jwt
274
-
275
- 2. **jwt-token-expiration-policy** (business layer, v1)
276
- - Value: Access tokens expire in 15 minutes, refresh tokens in 7 days
277
- - Tags: authentication, security, jwt, tokens
278
-
279
- 3. **session-management-strategy** (business layer, v1)
280
- - Value: Stateless sessions using JWT claims
281
- - Tags: authentication, sessions, stateless
282
-
283
- *Runs decision({ action: "list_decision_contexts", key: "api-authentication-method" })*
284
-
285
- Decision relationships:
286
- - "jwt-token-expiration-policy" → relates to "api-authentication-method"
287
- - "session-management-strategy" → relates to "api-authentication-method"
288
-
289
- *Runs task({ action: "list", tags: ["authentication"], limit: 50 })*
290
-
291
- Related implementation tasks:
292
- - 5 completed tasks (authentication service, middleware, tests)
293
- - 1 in-progress task (refresh token rotation)
294
- - 0 blocked tasks
295
-
296
- **Summary**: We have well-documented authentication architecture with JWT-based approach, clear token expiration policies, and most implementation complete. One task in progress for refresh token rotation feature.
297
-
298
- Would you like me to:
299
- 1. Show the full decision details?
300
- 2. Show version history (how decisions evolved)?
301
- 3. Analyze the implementation tasks?
302
- ```
303
-
304
- ## Token Efficiency Tips
305
-
306
- **High Efficiency** (< 1k tokens):
307
- - `suggest.by_key` - Smart pattern matching (decisions)
308
- - `suggest.by_tags` - Tag-based discovery (decisions/constraints)
309
- - `suggest.by_text` - Text similarity search (constraints, v4.0)
310
- - `suggest.by_context` - Multi-factor similarity (decisions/constraints, v4.0)
311
- - `decision.get` - Specific decision retrieval
312
- - `task.get` - Specific task retrieval
313
- - `constraint.get` - Specific constraint retrieval
314
-
315
- **Medium Efficiency** (1-5k tokens):
316
- - `decision.search_tags` - Filtered decision search
317
- - `decision.search_layer` - Layer-based search
318
- - `task.list` with filters - Targeted task queries
319
- - `decision.versions` - Decision history
320
- - `suggest.check_duplicate` - Duplicate detection (decisions/constraints)
321
-
322
- **Low Efficiency** (5k+ tokens, use sparingly):
323
- - `decision.list` - All decisions (use only when necessary)
324
- - `task.list` without filters - All tasks (use only when necessary)
325
- - `constraint.get` without filters - All constraints
326
-
327
- ## Error Handling
328
-
329
- - If no results found, broaden search criteria (fewer tags, broader key pattern)
330
- - If too many results, narrow search (more specific tags, layer filters, status filters)
331
- - If related decisions not obvious, try different tag combinations
332
- - If dependency graph complex, visualize one task at a time
333
-
334
- ## Analysis Frameworks
335
-
336
- ### Decision Coverage Analysis
337
- 1. List all decisions by layer
338
- 2. List all tasks by layer
339
- 3. Identify gaps: decisions without implementation tasks
340
-
341
- ### Agent Workload Analysis
342
- 1. List tasks per agent
343
- 2. Count by status (todo, in_progress, done, blocked)
344
- 3. Calculate completion rates
345
- 4. Identify bottlenecks
346
-
347
- ### Architectural Consistency Analysis
348
- 1. Query decisions by layer
349
- 2. Query constraints by layer
350
- 3. Verify constraints align with decisions
351
- 4. Identify conflicts or gaps
352
-
353
- ### Implementation Progress Analysis
354
- 1. Query tasks by tags matching decision tags
355
- 2. Count task statuses
356
- 3. Calculate completion percentage
357
- 4. Identify blocking dependencies
358
-
359
- You provide deep insights into the project's architectural history, helping teams make informed decisions based on past experience and current context.