ctx-cc 3.4.0 → 3.4.1
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/commands/ctx.md +33 -622
- package/commands/map-codebase.md +55 -156
- package/package.json +3 -2
- package/src/install.js +8 -0
- package/workflows/ctx-router.md +241 -0
- package/workflows/map-codebase.md +329 -0
package/commands/ctx.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx
|
|
3
|
-
description: Smart router - understands natural language, detects intent, and routes to the right workflow.
|
|
3
|
+
description: Smart router - understands natural language, detects intent, and routes to the right workflow.
|
|
4
4
|
allowed-tools:
|
|
5
5
|
- Read
|
|
6
6
|
- Write
|
|
@@ -8,6 +8,7 @@ allowed-tools:
|
|
|
8
8
|
- Glob
|
|
9
9
|
- Grep
|
|
10
10
|
- Task
|
|
11
|
+
- TaskOutput
|
|
11
12
|
- AskUserQuestion
|
|
12
13
|
- mcp__arguseek__research_iteratively
|
|
13
14
|
- mcp__arguseek__fetch_url
|
|
@@ -19,613 +20,42 @@ CTX Smart Router - Conversational-first workflow orchestration.
|
|
|
19
20
|
**Users don't need to know commands.** They describe what they want, CTX routes automatically.
|
|
20
21
|
|
|
21
22
|
```
|
|
22
|
-
User: "I want to build a todo app"
|
|
23
|
-
User: "Fix the login bug"
|
|
24
|
-
User: "
|
|
25
|
-
User: "What should I do next?"
|
|
23
|
+
User: "I want to build a todo app" -> Routes to init
|
|
24
|
+
User: "Fix the login bug" -> Routes to debug
|
|
25
|
+
User: "Study the codebase" -> Routes to map-codebase
|
|
26
|
+
User: "What should I do next?" -> Shows status + routes
|
|
26
27
|
```
|
|
27
28
|
</objective>
|
|
28
29
|
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
**MANDATORY FIRST STEP — Execute before anything else:**
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
test -d .ctx && echo "exists" || echo "missing"
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Store result for routing decisions below.
|
|
40
|
-
|
|
41
|
-
## Step 1: Intent Detection
|
|
42
|
-
|
|
43
|
-
Parse the user's message to detect intent. This runs BEFORE checking state.
|
|
30
|
+
<execution_context>
|
|
31
|
+
@~/.claude/ctx/workflows/ctx-router.md
|
|
32
|
+
</execution_context>
|
|
44
33
|
|
|
45
|
-
|
|
34
|
+
<process>
|
|
35
|
+
1. Check if .ctx/ exists (bash: test -d .ctx)
|
|
36
|
+
2. Detect intent from user message
|
|
37
|
+
3. Route based on intent + ctx state:
|
|
38
|
+
- No .ctx/ + "build/create" -> /ctx:init
|
|
39
|
+
- No .ctx/ + "study/analyze" -> spawn 4 mapper agents in parallel
|
|
40
|
+
- No .ctx/ + "debug/fix" -> map codebase first, then debug
|
|
41
|
+
- Has .ctx/ + any intent -> load state, route accordingly
|
|
42
|
+
4. Spawn appropriate agents with Task()
|
|
43
|
+
5. Update STATE.md
|
|
44
|
+
6. Show "Next Up" with clear next action
|
|
45
|
+
</process>
|
|
46
46
|
|
|
47
|
+
<intent_patterns>
|
|
47
48
|
| Pattern | Intent | Route |
|
|
48
49
|
|---------|--------|-------|
|
|
49
|
-
| "build", "create", "make", "start new"
|
|
50
|
-
| "fix", "bug", "broken", "
|
|
51
|
-
| "test", "QA", "check", "accessible"
|
|
52
|
-
| "
|
|
53
|
-
| "
|
|
54
|
-
| "
|
|
55
|
-
| "
|
|
56
|
-
| "
|
|
57
|
-
|
|
58
|
-
| "help", "how", "what can", "commands", "guide" | `help` | Help guide |
|
|
59
|
-
| "continue", "next", "go", "do it" | `continue` | Read STATE.md |
|
|
60
|
-
|
|
61
|
-
State detected intent for routing.
|
|
62
|
-
|
|
63
|
-
## Step 2: Route Based on CTX Existence + Intent
|
|
64
|
-
|
|
65
|
-
**If NO .ctx/ folder (new user):**
|
|
66
|
-
|
|
67
|
-
Route by intent:
|
|
68
|
-
|
|
69
|
-
### Route A: New Project Intent
|
|
70
|
-
|
|
71
|
-
If intent = `new-project`:
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
75
|
-
Welcome to CTX!
|
|
76
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
77
|
-
|
|
78
|
-
I understood: "{{user_request}}"
|
|
79
|
-
|
|
80
|
-
You want to build something new. Let's set it up!
|
|
81
|
-
|
|
82
|
-
Starting project initialization...
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Then execute /ctx:init inline (don't tell user to run it separately).
|
|
86
|
-
|
|
87
|
-
### Route B: Debug/Fix Intent (no .ctx/)
|
|
88
|
-
|
|
89
|
-
If intent = `debug`:
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
93
|
-
Welcome to CTX!
|
|
94
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
95
|
-
|
|
96
|
-
I understood: "{{problem_description}}"
|
|
97
|
-
|
|
98
|
-
You need to fix something. Let me understand the codebase first.
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
**Step 1: Map codebase (parallel agents)**
|
|
102
|
-
|
|
103
|
-
Spawn 4 mapper agents in parallel:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
mkdir -p .ctx/codebase
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
Task(prompt="Analyze codebase technology stack. Write findings to .ctx/codebase/TECH.md", subagent_type="ctx-tech-mapper", model="haiku", description="Map tech stack")
|
|
111
|
-
Task(prompt="Analyze codebase architecture. Write findings to .ctx/codebase/ARCH.md", subagent_type="ctx-arch-mapper", model="haiku", description="Map architecture")
|
|
112
|
-
Task(prompt="Analyze code quality patterns. Write findings to .ctx/codebase/QUALITY.md", subagent_type="ctx-quality-mapper", model="haiku", description="Map quality")
|
|
113
|
-
Task(prompt="Identify concerns and tech debt. Write findings to .ctx/codebase/CONCERNS.md", subagent_type="ctx-concerns-mapper", model="haiku", description="Map concerns")
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
**Step 2: Initialize minimal state**
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
cat > .ctx/STATE.md << 'EOF'
|
|
120
|
-
# CTX State
|
|
121
|
-
|
|
122
|
-
## Status
|
|
123
|
-
debugging
|
|
124
|
-
|
|
125
|
-
## Current Focus
|
|
126
|
-
{{problem_description}}
|
|
127
|
-
|
|
128
|
-
## Context Budget
|
|
129
|
-
5%
|
|
130
|
-
EOF
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**Step 3: Route to debug**
|
|
134
|
-
|
|
135
|
-
Go to **Debug Flow** below.
|
|
136
|
-
|
|
137
|
-
### Route C: QA Intent (no .ctx/)
|
|
138
|
-
|
|
139
|
-
If intent = `qa`:
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
143
|
-
Welcome to CTX!
|
|
144
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
145
|
-
|
|
146
|
-
I understood: "{{qa_request}}"
|
|
147
|
-
|
|
148
|
-
You want to test the system. I'll analyze the project first.
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Map codebase (same as Route B Step 1), then go to **QA Flow** below.
|
|
152
|
-
|
|
153
|
-
### Route D: Production-Ready Intent (no .ctx/)
|
|
154
|
-
|
|
155
|
-
If intent = `production-ready`:
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
159
|
-
Welcome to CTX!
|
|
160
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
161
|
-
|
|
162
|
-
I understood: "{{request}}"
|
|
163
|
-
|
|
164
|
-
I'll audit everything and make it production ready.
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Go to **Production-Ready Pipeline** below.
|
|
168
|
-
|
|
169
|
-
### Route E: Analyze Intent (no .ctx/)
|
|
170
|
-
|
|
171
|
-
If intent = `analyze`:
|
|
172
|
-
|
|
173
|
-
```
|
|
174
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
175
|
-
Welcome to CTX!
|
|
176
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
177
|
-
|
|
178
|
-
I understood: "{{request}}"
|
|
179
|
-
|
|
180
|
-
Let me study this codebase.
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Go to **Map Codebase Flow** below.
|
|
184
|
-
|
|
185
|
-
### Route F: Help or Unknown Intent (no .ctx/)
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
189
|
-
Welcome to CTX!
|
|
190
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
191
|
-
|
|
192
|
-
What would you like to do?
|
|
193
|
-
|
|
194
|
-
"Build something new" → I'll set up your project
|
|
195
|
-
"Fix a bug" → I'll debug the issue
|
|
196
|
-
"Test the app" → I'll run full QA
|
|
197
|
-
"Study the codebase" → I'll analyze the architecture
|
|
198
|
-
|
|
199
|
-
Just describe what you want!
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
**If .ctx/ folder EXISTS:**
|
|
205
|
-
|
|
206
|
-
### Step 2.1: Load State
|
|
207
|
-
|
|
208
|
-
Read current state:
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
cat .ctx/STATE.md
|
|
212
|
-
cat .ctx/config.json 2>/dev/null || echo "{}"
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
Extract:
|
|
216
|
-
- `status`: Current workflow status
|
|
217
|
-
- `currentStory`: Active story ID
|
|
218
|
-
- `profile`: Model profile (quality/balanced/budget)
|
|
219
|
-
|
|
220
|
-
### Step 2.2: Route by Intent + State
|
|
221
|
-
|
|
222
|
-
| Intent | State | Action |
|
|
223
|
-
|--------|-------|--------|
|
|
224
|
-
| `new-project` | any | Warn project exists, offer to add story |
|
|
225
|
-
| `debug` | any | Go to Debug Flow |
|
|
226
|
-
| `qa` | any | Go to QA Flow |
|
|
227
|
-
| `production-ready` | any | Go to Production-Ready Pipeline |
|
|
228
|
-
| `analyze` | any | Go to Map Codebase Flow |
|
|
229
|
-
| `improve` | any | Analyze → suggest improvements |
|
|
230
|
-
| `status` | any | Show status report |
|
|
231
|
-
| `continue` | initializing | Research phase |
|
|
232
|
-
| `continue` | discussing | Discussion phase |
|
|
233
|
-
| `continue` | executing | Execute current task |
|
|
234
|
-
| `continue` | debugging | Resume debug |
|
|
235
|
-
| `continue` | verifying | Run verification |
|
|
236
|
-
| `continue` | paused | Resume from checkpoint |
|
|
237
|
-
|
|
238
|
-
</process>
|
|
239
|
-
|
|
240
|
-
<flows>
|
|
241
|
-
|
|
242
|
-
## Debug Flow
|
|
243
|
-
|
|
244
|
-
**Step 1: Research the problem with ArguSeek**
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
mcp__arguseek__research_iteratively({
|
|
248
|
-
query: "{{problem_description}} {{tech_stack}} common causes solutions"
|
|
249
|
-
})
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Store findings in memory.
|
|
253
|
-
|
|
254
|
-
**Step 2: Spawn debugger agent**
|
|
255
|
-
|
|
256
|
-
```
|
|
257
|
-
Task(prompt="
|
|
258
|
-
<problem>
|
|
259
|
-
{{problem_description}}
|
|
260
|
-
</problem>
|
|
261
|
-
|
|
262
|
-
<codebase_context>
|
|
263
|
-
{{.ctx/codebase/TECH.md content}}
|
|
264
|
-
{{.ctx/codebase/ARCH.md content}}
|
|
265
|
-
</codebase_context>
|
|
266
|
-
|
|
267
|
-
<research_findings>
|
|
268
|
-
{{ArguSeek results}}
|
|
269
|
-
</research_findings>
|
|
270
|
-
|
|
271
|
-
<instructions>
|
|
272
|
-
1. Analyze the error
|
|
273
|
-
2. Form hypothesis
|
|
274
|
-
3. Apply minimal fix
|
|
275
|
-
4. Verify (build + tests)
|
|
276
|
-
5. If fixed: update STATE.md status to 'executing', commit fix
|
|
277
|
-
6. If not fixed: log attempt, try next hypothesis (max 10 attempts)
|
|
278
|
-
</instructions>
|
|
279
|
-
|
|
280
|
-
Write debug progress to .ctx/DEBUG.md
|
|
281
|
-
", subagent_type="ctx-debugger", model="sonnet", description="Debug {{problem}}")
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
**Step 3: Update state and report**
|
|
285
|
-
|
|
286
|
-
Read debugger output. Update STATE.md:
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
# Update status based on outcome
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
**Step 4: Show next steps**
|
|
293
|
-
|
|
294
|
-
```
|
|
295
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
296
|
-
[CTX] Debug Complete
|
|
297
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
298
|
-
|
|
299
|
-
Status: {{fixed | still investigating}}
|
|
300
|
-
Attempts: {{count}}
|
|
301
|
-
Commit: {{hash if fixed}}
|
|
302
|
-
|
|
303
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
304
|
-
To continue with CTX, run: /ctx
|
|
305
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
---
|
|
309
|
-
|
|
310
|
-
## QA Flow
|
|
311
|
-
|
|
312
|
-
**Step 1: Research QA best practices**
|
|
313
|
-
|
|
314
|
-
```
|
|
315
|
-
mcp__arguseek__research_iteratively({
|
|
316
|
-
query: "{{tech_stack}} E2E testing WCAG 2.1 AA accessibility best practices 2025"
|
|
317
|
-
})
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
**Step 2: Spawn QA agent**
|
|
321
|
-
|
|
322
|
-
```
|
|
323
|
-
Task(prompt="
|
|
324
|
-
<codebase_context>
|
|
325
|
-
{{.ctx/codebase/TECH.md content}}
|
|
326
|
-
</codebase_context>
|
|
327
|
-
|
|
328
|
-
<qa_focus>
|
|
329
|
-
{{qa_request or 'full system QA'}}
|
|
330
|
-
</qa_focus>
|
|
331
|
-
|
|
332
|
-
<research>
|
|
333
|
-
{{ArguSeek results}}
|
|
334
|
-
</research>
|
|
335
|
-
|
|
336
|
-
<instructions>
|
|
337
|
-
1. Use Playwright for browser testing
|
|
338
|
-
2. Use stable locators (getByRole, getByText, getByLabel)
|
|
339
|
-
3. Test WCAG 2.1 AA: touch targets 44x44, alt text, form labels, contrast
|
|
340
|
-
4. Test at 3 viewports: mobile (375px), tablet (768px), desktop (1280px)
|
|
341
|
-
5. Capture screenshots of issues
|
|
342
|
-
6. Write QA report to .ctx/QA-REPORT.md
|
|
343
|
-
</instructions>
|
|
344
|
-
", subagent_type="ctx-qa", model="sonnet", description="QA testing")
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
**Step 3: Report results**
|
|
348
|
-
|
|
349
|
-
```
|
|
350
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
351
|
-
[CTX] QA Complete
|
|
352
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
353
|
-
|
|
354
|
-
Pages tested: {{count}}
|
|
355
|
-
WCAG 2.1 AA: {{score}}%
|
|
356
|
-
Issues found: {{count}}
|
|
357
|
-
Critical: {{count}}
|
|
358
|
-
High: {{count}}
|
|
359
|
-
Medium: {{count}}
|
|
360
|
-
|
|
361
|
-
Report: .ctx/QA-REPORT.md
|
|
362
|
-
|
|
363
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
364
|
-
To continue with CTX, run: /ctx
|
|
365
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
---
|
|
369
|
-
|
|
370
|
-
## Production-Ready Pipeline
|
|
371
|
-
|
|
372
|
-
Full audit for production readiness:
|
|
373
|
-
|
|
374
|
-
**Step 1: Map codebase (if not already mapped)**
|
|
375
|
-
|
|
376
|
-
```bash
|
|
377
|
-
test -d .ctx/codebase && echo "mapped" || echo "needs_mapping"
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
If needs mapping, spawn 4 mapper agents (see Route B above).
|
|
381
|
-
|
|
382
|
-
**Step 2: Research production requirements**
|
|
383
|
-
|
|
384
|
-
```
|
|
385
|
-
mcp__arguseek__research_iteratively({
|
|
386
|
-
query: "{{tech_stack}} production readiness checklist security performance 2025"
|
|
387
|
-
})
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
**Step 3: Run full QA**
|
|
391
|
-
|
|
392
|
-
Spawn ctx-qa agent (see QA Flow above).
|
|
393
|
-
|
|
394
|
-
**Step 4: Security audit**
|
|
395
|
-
|
|
396
|
-
```
|
|
397
|
-
Task(prompt="
|
|
398
|
-
<codebase>
|
|
399
|
-
{{.ctx/codebase/TECH.md}}
|
|
400
|
-
{{.ctx/codebase/CONCERNS.md}}
|
|
401
|
-
</codebase>
|
|
402
|
-
|
|
403
|
-
<instructions>
|
|
404
|
-
Audit for:
|
|
405
|
-
- SQL injection
|
|
406
|
-
- XSS vulnerabilities
|
|
407
|
-
- Exposed secrets
|
|
408
|
-
- Auth/authz gaps
|
|
409
|
-
- Input validation
|
|
410
|
-
|
|
411
|
-
Write report to .ctx/SECURITY-AUDIT.md
|
|
412
|
-
</instructions>
|
|
413
|
-
", subagent_type="ctx-auditor", model="sonnet", description="Security audit")
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
**Step 5: Performance check**
|
|
417
|
-
|
|
418
|
-
```
|
|
419
|
-
Task(prompt="
|
|
420
|
-
<codebase>
|
|
421
|
-
{{.ctx/codebase/TECH.md}}
|
|
422
|
-
{{.ctx/codebase/ARCH.md}}
|
|
423
|
-
</codebase>
|
|
424
|
-
|
|
425
|
-
<instructions>
|
|
426
|
-
Check for:
|
|
427
|
-
- Slow API calls (>500ms)
|
|
428
|
-
- Large assets (>500KB)
|
|
429
|
-
- Missing caching
|
|
430
|
-
- N+1 queries
|
|
431
|
-
- Memory leaks
|
|
432
|
-
|
|
433
|
-
Write report to .ctx/PERF-AUDIT.md
|
|
434
|
-
</instructions>
|
|
435
|
-
", subagent_type="ctx-reviewer", model="sonnet", description="Performance check")
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
**Step 6: Create fix tasks**
|
|
439
|
-
|
|
440
|
-
Read all reports, create prioritized fix list in .ctx/FIX-TASKS.md
|
|
441
|
-
|
|
442
|
-
**Step 7: Execute fixes**
|
|
443
|
-
|
|
444
|
-
For each critical/high fix:
|
|
445
|
-
|
|
446
|
-
```
|
|
447
|
-
Task(prompt="
|
|
448
|
-
<fix>
|
|
449
|
-
{{fix_description}}
|
|
450
|
-
</fix>
|
|
451
|
-
|
|
452
|
-
<context>
|
|
453
|
-
{{relevant_code}}
|
|
454
|
-
</context>
|
|
455
|
-
|
|
456
|
-
<instructions>
|
|
457
|
-
1. Apply minimal fix
|
|
458
|
-
2. Verify (build + tests)
|
|
459
|
-
3. Commit with descriptive message
|
|
460
|
-
</instructions>
|
|
461
|
-
", subagent_type="ctx-executor", model="sonnet", description="Fix: {{fix_name}}")
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
**Step 8: Final verification**
|
|
465
|
-
|
|
466
|
-
Spawn ctx-verifier for three-level check.
|
|
467
|
-
|
|
468
|
-
**Step 9: Report**
|
|
469
|
-
|
|
470
|
-
```
|
|
471
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
472
|
-
PRODUCTION READINESS AUDIT
|
|
473
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
474
|
-
|
|
475
|
-
Codebase Analysis: ✓ Complete
|
|
476
|
-
Full QA: ✓ Complete (WCAG {{score}}%)
|
|
477
|
-
Security Audit: {{status}}
|
|
478
|
-
Performance: {{status}}
|
|
479
|
-
|
|
480
|
-
Issues Fixed: {{count}}
|
|
481
|
-
Remaining: {{count}}
|
|
482
|
-
|
|
483
|
-
Production Ready: {{YES | NO - reasons}}
|
|
484
|
-
|
|
485
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
486
|
-
To continue with CTX, run: /ctx
|
|
487
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
---
|
|
491
|
-
|
|
492
|
-
## Map Codebase Flow
|
|
493
|
-
|
|
494
|
-
**Step 1: Create structure**
|
|
495
|
-
|
|
496
|
-
```bash
|
|
497
|
-
mkdir -p .ctx/codebase
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
**Step 2: Spawn 4 mapper agents in parallel**
|
|
501
|
-
|
|
502
|
-
```
|
|
503
|
-
Task(prompt="
|
|
504
|
-
Analyze the technology stack of this codebase.
|
|
505
|
-
|
|
506
|
-
Look for:
|
|
507
|
-
- package.json, Cargo.toml, go.mod, requirements.txt, etc.
|
|
508
|
-
- Framework detection (React, Next.js, FastAPI, etc.)
|
|
509
|
-
- Key dependencies and versions
|
|
510
|
-
- Build tools and scripts
|
|
511
|
-
|
|
512
|
-
Write comprehensive analysis to: .ctx/codebase/TECH.md
|
|
513
|
-
", subagent_type="ctx-tech-mapper", model="haiku", description="Map tech stack")
|
|
514
|
-
|
|
515
|
-
Task(prompt="
|
|
516
|
-
Analyze the architecture of this codebase.
|
|
517
|
-
|
|
518
|
-
Look for:
|
|
519
|
-
- Directory structure
|
|
520
|
-
- Entry points
|
|
521
|
-
- Component boundaries
|
|
522
|
-
- Data flow patterns
|
|
523
|
-
- API structure
|
|
524
|
-
|
|
525
|
-
Write comprehensive analysis to: .ctx/codebase/ARCH.md
|
|
526
|
-
", subagent_type="ctx-arch-mapper", model="haiku", description="Map architecture")
|
|
527
|
-
|
|
528
|
-
Task(prompt="
|
|
529
|
-
Analyze code quality patterns.
|
|
530
|
-
|
|
531
|
-
Look for:
|
|
532
|
-
- Testing patterns and coverage
|
|
533
|
-
- Error handling patterns
|
|
534
|
-
- Logging patterns
|
|
535
|
-
- Code style consistency
|
|
536
|
-
- Documentation quality
|
|
537
|
-
|
|
538
|
-
Write comprehensive analysis to: .ctx/codebase/QUALITY.md
|
|
539
|
-
", subagent_type="ctx-quality-mapper", model="haiku", description="Map quality")
|
|
540
|
-
|
|
541
|
-
Task(prompt="
|
|
542
|
-
Identify concerns and technical debt.
|
|
543
|
-
|
|
544
|
-
Look for:
|
|
545
|
-
- TODO/FIXME comments
|
|
546
|
-
- Deprecated dependencies
|
|
547
|
-
- Security concerns
|
|
548
|
-
- Performance bottlenecks
|
|
549
|
-
- Accessibility gaps
|
|
550
|
-
|
|
551
|
-
Write comprehensive analysis to: .ctx/codebase/CONCERNS.md
|
|
552
|
-
", subagent_type="ctx-concerns-mapper", model="haiku", description="Map concerns")
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
**Step 3: Synthesize**
|
|
556
|
-
|
|
557
|
-
After all agents complete, create summary:
|
|
558
|
-
|
|
559
|
-
```bash
|
|
560
|
-
cat > .ctx/codebase/SUMMARY.md << 'EOF'
|
|
561
|
-
# Codebase Summary
|
|
562
|
-
|
|
563
|
-
## Tech Stack
|
|
564
|
-
{{from TECH.md}}
|
|
565
|
-
|
|
566
|
-
## Architecture
|
|
567
|
-
{{from ARCH.md}}
|
|
568
|
-
|
|
569
|
-
## Quality
|
|
570
|
-
{{from QUALITY.md}}
|
|
571
|
-
|
|
572
|
-
## Concerns
|
|
573
|
-
{{from CONCERNS.md}}
|
|
574
|
-
EOF
|
|
575
|
-
```
|
|
576
|
-
|
|
577
|
-
**Step 4: Report**
|
|
578
|
-
|
|
579
|
-
```
|
|
580
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
581
|
-
[CTX] Codebase Mapped
|
|
582
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
583
|
-
|
|
584
|
-
Tech: {{stack}}
|
|
585
|
-
Architecture: {{pattern}}
|
|
586
|
-
Quality: {{assessment}}
|
|
587
|
-
Concerns: {{count}} identified
|
|
588
|
-
|
|
589
|
-
Files: .ctx/codebase/
|
|
590
|
-
|
|
591
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
592
|
-
To continue with CTX, run: /ctx
|
|
593
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
594
|
-
```
|
|
595
|
-
|
|
596
|
-
---
|
|
597
|
-
|
|
598
|
-
## Status Report
|
|
599
|
-
|
|
600
|
-
Read and display current state:
|
|
601
|
-
|
|
602
|
-
```bash
|
|
603
|
-
cat .ctx/STATE.md
|
|
604
|
-
ls -la .ctx/phases/ 2>/dev/null | wc -l
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
```
|
|
608
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
609
|
-
[CTX] Status
|
|
610
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
611
|
-
|
|
612
|
-
Project: {{name}}
|
|
613
|
-
Status: {{status}}
|
|
614
|
-
Profile: {{profile}}
|
|
615
|
-
|
|
616
|
-
Progress: [{{progress_bar}}] {{completed}}/{{total}} stories
|
|
617
|
-
|
|
618
|
-
Current: {{current_story}}
|
|
619
|
-
Next: {{next_action}}
|
|
620
|
-
|
|
621
|
-
Context: {{percent}}%
|
|
622
|
-
|
|
623
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
624
|
-
To continue with CTX, run: /ctx
|
|
625
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
</flows>
|
|
50
|
+
| "build", "create", "make", "start new" | new-project | /ctx:init |
|
|
51
|
+
| "fix", "bug", "broken", "error", "crash" | debug | Debug flow |
|
|
52
|
+
| "test", "QA", "check", "accessible" | qa | QA flow |
|
|
53
|
+
| "study", "analyze", "understand", "explore" | analyze | Map codebase |
|
|
54
|
+
| "improve", "optimize", "refactor" | improve | Analyze + suggest |
|
|
55
|
+
| "status", "progress", "what's next" | status | Show status |
|
|
56
|
+
| "help", "how", "commands" | help | Show help |
|
|
57
|
+
| "continue", "next", "go" | continue | Read STATE.md |
|
|
58
|
+
</intent_patterns>
|
|
629
59
|
|
|
630
60
|
<model_routing>
|
|
631
61
|
Based on config.json profile, use these models for Task() calls:
|
|
@@ -633,35 +63,16 @@ Based on config.json profile, use these models for Task() calls:
|
|
|
633
63
|
| Agent | quality | balanced | budget |
|
|
634
64
|
|-------|---------|----------|--------|
|
|
635
65
|
| Mappers | sonnet | haiku | haiku |
|
|
636
|
-
| Researcher | opus | sonnet | sonnet |
|
|
637
|
-
| Discusser | opus | sonnet | sonnet |
|
|
638
|
-
| Planner | opus | sonnet | sonnet |
|
|
639
|
-
| Executor | opus | sonnet | sonnet |
|
|
640
66
|
| Debugger | opus | sonnet | sonnet |
|
|
641
67
|
| QA | sonnet | sonnet | haiku |
|
|
642
|
-
|
|
|
68
|
+
| Executor | opus | sonnet | sonnet |
|
|
643
69
|
</model_routing>
|
|
644
70
|
|
|
645
|
-
<state_transitions>
|
|
646
|
-
```
|
|
647
|
-
initializing → discussing (after research)
|
|
648
|
-
discussing → executing (after decisions locked)
|
|
649
|
-
executing → debugging (if verification fails)
|
|
650
|
-
executing → verifying (if all tasks done)
|
|
651
|
-
debugging → executing (if fix works)
|
|
652
|
-
debugging → ESCALATE (if max attempts fail)
|
|
653
|
-
verifying → debugging (if any check fails)
|
|
654
|
-
verifying → COMPLETE (if ALL pass 100%)
|
|
655
|
-
paused → (previous state)
|
|
656
|
-
```
|
|
657
|
-
</state_transitions>
|
|
658
|
-
|
|
659
71
|
<success_criteria>
|
|
660
72
|
- [ ] Intent detected from user message
|
|
661
73
|
- [ ] Correct flow routed
|
|
662
74
|
- [ ] ArguSeek called for research (when applicable)
|
|
663
75
|
- [ ] Task() agents spawned with full context
|
|
664
76
|
- [ ] STATE.md updated after each action
|
|
665
|
-
- [ ] Clear "Next Up" shown
|
|
666
|
-
- [ ] User knows to run /ctx to continue
|
|
77
|
+
- [ ] Clear "Next Up" shown
|
|
667
78
|
</success_criteria>
|