ctx-cc 3.3.7 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/ctx-arch-mapper.md +1 -1
- package/agents/ctx-concerns-mapper.md +1 -1
- package/agents/ctx-quality-mapper.md +1 -1
- package/agents/ctx-tech-mapper.md +1 -1
- package/commands/ctx.md +541 -367
- package/commands/init.md +505 -233
- package/package.json +1 -1
package/commands/ctx.md
CHANGED
|
@@ -1,493 +1,667 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx
|
|
3
|
-
description: Smart router - understands natural language, detects intent, and
|
|
3
|
+
description: Smart router - understands natural language, detects intent, and routes to the right workflow. No commands to memorize.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Bash
|
|
8
|
+
- Glob
|
|
9
|
+
- Grep
|
|
10
|
+
- Task
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
- mcp__arguseek__research_iteratively
|
|
13
|
+
- mcp__arguseek__fetch_url
|
|
4
14
|
---
|
|
5
15
|
|
|
6
16
|
<objective>
|
|
7
17
|
CTX Smart Router - Conversational-first workflow orchestration.
|
|
8
18
|
|
|
9
|
-
**Users don't need to know commands.** They
|
|
19
|
+
**Users don't need to know commands.** They describe what they want, CTX routes automatically.
|
|
10
20
|
|
|
11
21
|
```
|
|
12
22
|
User: "I want to build a todo app" → Routes to init
|
|
13
23
|
User: "Fix the login bug" → Routes to debug
|
|
14
24
|
User: "Is my app accessible?" → Routes to QA
|
|
15
|
-
User: "What should I do next?" → Shows status +
|
|
25
|
+
User: "What should I do next?" → Shows status + routes to next action
|
|
16
26
|
```
|
|
17
27
|
</objective>
|
|
18
28
|
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
## Step 0: Intent Detection (ALWAYS RUNS FIRST)
|
|
22
|
-
|
|
23
|
-
Before checking state, parse the user's natural language request.
|
|
29
|
+
<process>
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
## Step 0: Verify CTX Structure
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|-----------|-----------------|----------|
|
|
29
|
-
| "build", "create", "make", "start new", "I want to..." | `new-project` | /ctx:init |
|
|
30
|
-
| "fix", "bug", "broken", "not working", "error" | `debug` | /ctx:debug |
|
|
31
|
-
| "test", "QA", "check", "accessible", "works?" | `qa` | /ctx:qa |
|
|
32
|
-
| "review", "audit", "security", "ready?" | `review` | /ctx:verify |
|
|
33
|
-
| "production", "prod ready", "production ready" | `production-ready` | Full audit → QA → fixes |
|
|
34
|
-
| "study", "analyze", "understand", "learn", "explore" | `analyze` | /ctx:map-codebase |
|
|
35
|
-
| "improve", "optimize", "better", "enhance" | `improve` | Analyze → suggest → fix |
|
|
36
|
-
| "deploy", "ship", "publish", "release" | `ship` | /ctx:verify → ship |
|
|
37
|
-
| "status", "progress", "where", "what's next" | `status` | /ctx:status |
|
|
38
|
-
| "help", "how", "what can", "commands" | `help` | /ctx:help |
|
|
39
|
-
| "plan", "design", "architect" | `plan` | /ctx:plan |
|
|
40
|
-
| "continue", "next", "go", "do it" | `continue` | (read STATE.md) |
|
|
33
|
+
**MANDATORY FIRST STEP — Execute before anything else:**
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
```bash
|
|
36
|
+
test -d .ctx && echo "exists" || echo "missing"
|
|
37
|
+
```
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
function detectIntent(userMessage) {
|
|
46
|
-
const msg = userMessage.toLowerCase();
|
|
39
|
+
Store result for routing decisions below.
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
if (msg.match(/\b(build|create|make|start|new|want to)\b.*\b(app|project|feature|site|api)\b/)) {
|
|
50
|
-
return 'new-project';
|
|
51
|
-
}
|
|
41
|
+
## Step 1: Intent Detection
|
|
52
42
|
|
|
53
|
-
|
|
54
|
-
if (msg.match(/\b(fix|bug|broken|error|crash|not working|fails?|issue)\b/)) {
|
|
55
|
-
return 'debug';
|
|
56
|
-
}
|
|
43
|
+
Parse the user's message to detect intent. This runs BEFORE checking state.
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
if (msg.match(/\b(test|qa|check|accessible|works|validate|verify all)\b/)) {
|
|
60
|
-
return 'qa';
|
|
61
|
-
}
|
|
45
|
+
**Detection rules (check in order):**
|
|
62
46
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
| Pattern | Intent | Route |
|
|
48
|
+
|---------|--------|-------|
|
|
49
|
+
| "build", "create", "make", "start new", "I want to..." + "app/project/feature" | `new-project` | /ctx:init |
|
|
50
|
+
| "fix", "bug", "broken", "not working", "error", "crash", "fails" | `debug` | Debug flow |
|
|
51
|
+
| "test", "QA", "check", "accessible", "works?", "validate" | `qa` | QA flow |
|
|
52
|
+
| "production", "prod ready", "production ready", "make it ready" | `production-ready` | Full audit pipeline |
|
|
53
|
+
| "study", "analyze", "understand", "learn", "explore", "what is this" | `analyze` | Map codebase |
|
|
54
|
+
| "improve", "optimize", "better", "enhance", "upgrade", "refactor" | `improve` | Analyze + suggest |
|
|
55
|
+
| "review", "audit", "security", "ready", "before deploy" | `review` | Verify flow |
|
|
56
|
+
| "deploy", "ship", "publish", "release", "push", "launch" | `ship` | Ship flow |
|
|
57
|
+
| "status", "progress", "where", "what's next", "current" | `status` | Status report |
|
|
58
|
+
| "help", "how", "what can", "commands", "guide" | `help` | Help guide |
|
|
59
|
+
| "continue", "next", "go", "do it" | `continue` | Read STATE.md |
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
if (msg.match(/\b(study|analyze|understand|learn|explore|what is this)\b/)) {
|
|
70
|
-
return 'analyze';
|
|
71
|
-
}
|
|
61
|
+
State detected intent for routing.
|
|
72
62
|
|
|
73
|
-
|
|
74
|
-
if (msg.match(/\b(improve|optimize|better|enhance|upgrade|refactor)\b/)) {
|
|
75
|
-
return 'improve';
|
|
76
|
-
}
|
|
63
|
+
## Step 2: Route Based on CTX Existence + Intent
|
|
77
64
|
|
|
78
|
-
|
|
79
|
-
if (msg.match(/\b(review|audit|security|ready|before deploy)\b/)) {
|
|
80
|
-
return 'review';
|
|
81
|
-
}
|
|
65
|
+
**If NO .ctx/ folder (new user):**
|
|
82
66
|
|
|
83
|
-
|
|
84
|
-
if (msg.match(/\b(deploy|ship|publish|release|push|launch)\b/)) {
|
|
85
|
-
return 'ship';
|
|
86
|
-
}
|
|
67
|
+
Route by intent:
|
|
87
68
|
|
|
88
|
-
|
|
89
|
-
if (msg.match(/\b(status|progress|where|what.?s next|current)\b/)) {
|
|
90
|
-
return 'status';
|
|
91
|
-
}
|
|
69
|
+
### Route A: New Project Intent
|
|
92
70
|
|
|
93
|
-
|
|
94
|
-
if (msg.match(/\b(help|how|what can|commands|guide)\b/)) {
|
|
95
|
-
return 'help';
|
|
96
|
-
}
|
|
71
|
+
If intent = `new-project`:
|
|
97
72
|
|
|
98
|
-
// Continue signals (or no clear intent)
|
|
99
|
-
return 'continue';
|
|
100
|
-
}
|
|
101
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/)
|
|
102
88
|
|
|
103
|
-
|
|
89
|
+
If intent = `debug`:
|
|
104
90
|
|
|
105
|
-
|
|
91
|
+
```
|
|
92
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
93
|
+
Welcome to CTX!
|
|
94
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
106
95
|
|
|
107
|
-
|
|
96
|
+
I understood: "{{problem_description}}"
|
|
108
97
|
|
|
109
|
-
|
|
98
|
+
You need to fix something. Let me understand the codebase first.
|
|
99
|
+
```
|
|
110
100
|
|
|
111
|
-
|
|
112
|
-
|--------|--------|
|
|
113
|
-
| `new-project` | "Let's set up your project!" → Run /ctx:init flow |
|
|
114
|
-
| `debug` | "Let me understand the codebase first." → Run /ctx:map → /ctx:debug |
|
|
115
|
-
| `qa` | "I'll analyze the project first." → Run /ctx:map → /ctx:qa |
|
|
116
|
-
| `production-ready` | "I'll audit everything and make it production ready." → Full pipeline below |
|
|
117
|
-
| `analyze` | "Let me study this codebase." → Run /ctx:map-codebase |
|
|
118
|
-
| `improve` | "I'll analyze and suggest improvements." → Run /ctx:map → analyze → suggest |
|
|
119
|
-
| `continue` | Guide user: "What would you like to do with this project?" |
|
|
120
|
-
| `help` | Show quick start guide |
|
|
101
|
+
**Step 1: Map codebase (parallel agents)**
|
|
121
102
|
|
|
122
|
-
|
|
103
|
+
Spawn 4 mapper agents in parallel:
|
|
123
104
|
|
|
124
|
-
|
|
105
|
+
```bash
|
|
106
|
+
mkdir -p .ctx/codebase
|
|
107
|
+
```
|
|
125
108
|
|
|
126
109
|
```
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
|
135
131
|
```
|
|
136
132
|
|
|
137
|
-
|
|
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
|
+
|
|
138
141
|
```
|
|
139
142
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
140
|
-
|
|
143
|
+
Welcome to CTX!
|
|
141
144
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
├── Tech: React 18, Node.js, PostgreSQL
|
|
145
|
-
├── Architecture: Clean, well-structured
|
|
146
|
-
├── Quality: 78% test coverage
|
|
147
|
-
└── Concerns: 3 security issues, 5 performance issues
|
|
146
|
+
I understood: "{{qa_request}}"
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
├── WCAG 2.1 AA: 92% compliant
|
|
152
|
-
├── Issues found: 12
|
|
153
|
-
└── Critical: 2
|
|
148
|
+
You want to test the system. I'll analyze the project first.
|
|
149
|
+
```
|
|
154
150
|
|
|
155
|
-
|
|
156
|
-
├── SQL injection risk: 1
|
|
157
|
-
├── XSS vulnerability: 1
|
|
158
|
-
└── Exposed secrets: 1
|
|
151
|
+
Map codebase (same as Route B Step 1), then go to **QA Flow** below.
|
|
159
152
|
|
|
160
|
-
|
|
161
|
-
├── Slow API calls: 3
|
|
162
|
-
├── Large assets: 2
|
|
163
|
-
└── Missing caching: Yes
|
|
153
|
+
### Route D: Production-Ready Intent (no .ctx/)
|
|
164
154
|
|
|
165
|
-
|
|
166
|
-
├── Critical: 3 (security)
|
|
167
|
-
├── High: 5 (performance, a11y)
|
|
168
|
-
└── Medium: 4
|
|
155
|
+
If intent = `production-ready`:
|
|
169
156
|
|
|
170
|
-
Ready to fix? [Y] Fix all [C] Critical only [R] Review first
|
|
171
157
|
```
|
|
158
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
159
|
+
Welcome to CTX!
|
|
160
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
161
|
+
|
|
162
|
+
I understood: "{{request}}"
|
|
172
163
|
|
|
173
|
-
|
|
164
|
+
I'll audit everything and make it production ready.
|
|
174
165
|
```
|
|
175
|
-
[CTX] Welcome! I see this is a new project.
|
|
176
166
|
|
|
177
|
-
|
|
167
|
+
Go to **Production-Ready Pipeline** below.
|
|
168
|
+
|
|
169
|
+
### Route E: Analyze Intent (no .ctx/)
|
|
170
|
+
|
|
171
|
+
If intent = `analyze`:
|
|
178
172
|
|
|
179
|
-
{{guided_next_step}}
|
|
180
173
|
```
|
|
174
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
175
|
+
Welcome to CTX!
|
|
176
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
181
177
|
|
|
182
|
-
|
|
178
|
+
I understood: "{{request}}"
|
|
183
179
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
- Read `.ctx/STATE.md` for current status
|
|
187
|
-
- Check `.ctx/REPO-MAP.md` for codebase understanding
|
|
180
|
+
Let me study this codebase.
|
|
181
|
+
```
|
|
188
182
|
|
|
189
|
-
|
|
183
|
+
Go to **Map Codebase Flow** below.
|
|
190
184
|
|
|
191
|
-
|
|
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
|
|
192
221
|
|
|
193
222
|
| Intent | State | Action |
|
|
194
223
|
|--------|-------|--------|
|
|
195
|
-
| `new-project` | any | Warn
|
|
196
|
-
| `debug` | any |
|
|
197
|
-
| `qa` | any |
|
|
198
|
-
| `production-ready` | any |
|
|
199
|
-
| `analyze` | any |
|
|
200
|
-
| `improve` | any | Analyze → suggest improvements
|
|
201
|
-
| `status` | any | Show
|
|
202
|
-
| `continue` | initializing |
|
|
203
|
-
| `continue` | discussing |
|
|
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 |
|
|
204
233
|
| `continue` | executing | Execute current task |
|
|
205
|
-
| `continue` | debugging | Resume debug
|
|
234
|
+
| `continue` | debugging | Resume debug |
|
|
206
235
|
| `continue` | verifying | Run verification |
|
|
207
236
|
| `continue` | paused | Resume from checkpoint |
|
|
208
237
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
If config.json doesn't exist:
|
|
218
|
-
- Copy from templates/config.json
|
|
219
|
-
- Set balanced as default profile
|
|
220
|
-
|
|
221
|
-
## Step 4: Execute Routed Action
|
|
222
|
-
|
|
223
|
-
Based on routing decision from Step 2:
|
|
224
|
-
|
|
225
|
-
### If status = "initializing"
|
|
226
|
-
Route to: **Research Phase**
|
|
227
|
-
1. Check if REPO-MAP exists, if not run ctx-mapper
|
|
228
|
-
2. Use ArguSeek to research the project goal
|
|
229
|
-
3. Create atomic plan (2-3 tasks max)
|
|
230
|
-
4. Update STATE.md with plan
|
|
231
|
-
5. Set status = "discussing"
|
|
232
|
-
|
|
233
|
-
### If status = "discussing"
|
|
234
|
-
Route to: **Discussion Phase**
|
|
235
|
-
1. Spawn ctx-discusser agent
|
|
236
|
-
2. Ask targeted questions about gray areas
|
|
237
|
-
3. Lock decisions in CONTEXT.md
|
|
238
|
-
4. Set status = "executing"
|
|
239
|
-
|
|
240
|
-
### If status = "executing"
|
|
241
|
-
Route to: **Execute Current Task**
|
|
242
|
-
1. Read current task from STATE.md
|
|
243
|
-
2. Load REPO-MAP for context
|
|
244
|
-
3. Spawn ctx-executor agent (uses git-native workflow)
|
|
245
|
-
4. Execute task with deviation handling:
|
|
246
|
-
- Auto-fix: bugs, validation, deps (95%)
|
|
247
|
-
- Ask user: architecture decisions only (5%)
|
|
248
|
-
5. After task:
|
|
249
|
-
- Run verification (build, tests, lint)
|
|
250
|
-
- Auto-commit if config allows
|
|
251
|
-
- If passes: mark done, update STATE.md
|
|
252
|
-
- If fails: set status = "debugging"
|
|
253
|
-
|
|
254
|
-
### If status = "debugging"
|
|
255
|
-
Route to: **Persistent Debug Loop**
|
|
256
|
-
1. Spawn ctx-debugger agent
|
|
257
|
-
2. Check for existing debug session (resume if exists)
|
|
258
|
-
3. Loop until fixed (max 10 attempts):
|
|
259
|
-
- Analyze error
|
|
260
|
-
- Form hypothesis
|
|
261
|
-
- Apply fix
|
|
262
|
-
- Verify (build + tests + browser if UI)
|
|
263
|
-
- Record in persistent state
|
|
264
|
-
- Take screenshot proof if browser test
|
|
265
|
-
4. If fixed: set status = "executing", continue
|
|
266
|
-
5. If max attempts: escalate with full report
|
|
267
|
-
|
|
268
|
-
### If status = "verifying"
|
|
269
|
-
Route to: **Three-Level Verification**
|
|
270
|
-
1. Spawn ctx-verifier agent
|
|
271
|
-
2. Check all artifacts:
|
|
272
|
-
- Level 1: Exists (file on disk?)
|
|
273
|
-
- Level 2: Substantive (real code, not stub?)
|
|
274
|
-
- Level 3: Wired (imported and used?)
|
|
275
|
-
3. Scan for anti-patterns (TODO, empty catch, placeholders)
|
|
276
|
-
4. Browser verification (if UI)
|
|
277
|
-
5. **DELIVERY GUARANTEE:**
|
|
278
|
-
- If ALL pass: complete phase → COMPLETE
|
|
279
|
-
- If ANY fail: set status = "debugging" → fix → verify again
|
|
280
|
-
- Loop until 100% working or max attempts
|
|
281
|
-
- NEVER mark complete with failures
|
|
282
|
-
|
|
283
|
-
### If status = "paused"
|
|
284
|
-
Route to: **Resume**
|
|
285
|
-
1. Read checkpoint from `.ctx/checkpoints/`
|
|
286
|
-
2. Restore context (~2.5k tokens)
|
|
287
|
-
3. Set status to previous state
|
|
288
|
-
4. Continue workflow
|
|
289
|
-
|
|
290
|
-
## Step 5: Model Selection
|
|
291
|
-
|
|
292
|
-
Based on current action and active profile:
|
|
293
|
-
|
|
294
|
-
| Action | quality | balanced | budget |
|
|
295
|
-
|--------|---------|----------|--------|
|
|
296
|
-
| Research | opus | opus | sonnet |
|
|
297
|
-
| Discussion | opus | sonnet | sonnet |
|
|
298
|
-
| Planning | opus | opus | sonnet |
|
|
299
|
-
| Execution | opus | sonnet | sonnet |
|
|
300
|
-
| Debugging | opus | sonnet | sonnet |
|
|
301
|
-
| Verification | sonnet | haiku | haiku |
|
|
302
|
-
| Mapping | sonnet | haiku | haiku |
|
|
303
|
-
|
|
304
|
-
Use Task tool with `model` parameter from routing table.
|
|
305
|
-
|
|
306
|
-
## Step 6: Context Budget Check
|
|
307
|
-
|
|
308
|
-
After every action:
|
|
309
|
-
- Calculate context usage
|
|
310
|
-
- If > 40%: Prepare handoff notes
|
|
311
|
-
- If > 50%: Auto-checkpoint, warn user
|
|
312
|
-
- If > 60%: Create HANDOFF.md, spawn fresh agent
|
|
313
|
-
- If > 70%: Force checkpoint
|
|
314
|
-
|
|
315
|
-
## Step 7: Git-Native Commit
|
|
316
|
-
|
|
317
|
-
If task completed successfully AND config.git.autoCommit = true:
|
|
318
|
-
1. Stage modified files
|
|
319
|
-
2. Create commit with CTX format
|
|
320
|
-
3. Record commit hash in STATE.md
|
|
321
|
-
|
|
322
|
-
## Step 8: Update State
|
|
323
|
-
|
|
324
|
-
Always update STATE.md after any action:
|
|
325
|
-
- Current status
|
|
326
|
-
- Progress
|
|
327
|
-
- Recent commits
|
|
328
|
-
- Recent decisions
|
|
329
|
-
- Next action
|
|
330
|
-
- Context usage
|
|
331
|
-
</workflow>
|
|
238
|
+
</process>
|
|
239
|
+
|
|
240
|
+
<flows>
|
|
241
|
+
|
|
242
|
+
## Debug Flow
|
|
243
|
+
|
|
244
|
+
**Step 1: Research the problem with ArguSeek**
|
|
332
245
|
|
|
333
|
-
<state_transitions>
|
|
334
246
|
```
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
paused → (previous state)
|
|
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**
|
|
344
255
|
|
|
345
|
-
DELIVERY GUARANTEE LOOP:
|
|
346
|
-
verifying ←→ debugging ←→ executing
|
|
347
|
-
↓
|
|
348
|
-
COMPLETE (only when 100% verified)
|
|
349
256
|
```
|
|
350
|
-
|
|
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**
|
|
351
285
|
|
|
352
|
-
|
|
353
|
-
## New in CTX 3.0
|
|
286
|
+
Read debugger output. Update STATE.md:
|
|
354
287
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
| `/ctx map-codebase` | Deep codebase analysis (4 parallel agents) |
|
|
359
|
-
| `/ctx discuss [story]` | Run discussion phase for story |
|
|
360
|
-
| `/ctx profile [name]` | Switch model profile |
|
|
361
|
-
| `/ctx debug --resume` | Resume previous debug session |
|
|
362
|
-
</new_commands>
|
|
288
|
+
```bash
|
|
289
|
+
# Update status based on outcome
|
|
290
|
+
```
|
|
363
291
|
|
|
364
|
-
|
|
365
|
-
| Usage | Quality | Action |
|
|
366
|
-
|-------|---------|--------|
|
|
367
|
-
| 0-30% | Peak | Continue |
|
|
368
|
-
| 30-40% | Good | Continue |
|
|
369
|
-
| 40-50% | Good | Prepare handoff |
|
|
370
|
-
| 50-60% | Degrading | Auto-checkpoint |
|
|
371
|
-
| 60-70% | Degrading | Create HANDOFF.md |
|
|
372
|
-
| 70%+ | Poor | Force checkpoint |
|
|
373
|
-
</context_budget>
|
|
292
|
+
**Step 4: Show next steps**
|
|
374
293
|
|
|
375
|
-
|
|
294
|
+
```
|
|
295
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
296
|
+
[CTX] Debug Complete
|
|
297
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
376
298
|
|
|
377
|
-
|
|
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**
|
|
378
348
|
|
|
379
349
|
```
|
|
380
350
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
381
|
-
|
|
351
|
+
[CTX] QA Complete
|
|
382
352
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
383
353
|
|
|
384
|
-
|
|
354
|
+
Pages tested: {{count}}
|
|
355
|
+
WCAG 2.1 AA: {{score}}%
|
|
356
|
+
Issues found: {{count}}
|
|
357
|
+
Critical: {{count}}
|
|
358
|
+
High: {{count}}
|
|
359
|
+
Medium: {{count}}
|
|
385
360
|
|
|
386
|
-
|
|
361
|
+
Report: .ctx/QA-REPORT.md
|
|
387
362
|
|
|
388
|
-
|
|
363
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
364
|
+
To continue with CTX, run: /ctx
|
|
365
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
389
366
|
```
|
|
390
367
|
|
|
391
|
-
|
|
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
|
+
```
|
|
392
379
|
|
|
393
|
-
|
|
394
|
-
|--------|----------|
|
|
395
|
-
| new-project | "You want to build something new. Let's set it up!" |
|
|
396
|
-
| debug | "You need to fix something. Let me understand the codebase first." |
|
|
397
|
-
| qa | "You want to test the system. I'll analyze the project first." |
|
|
398
|
-
| status | "This is a new project. Would you like to start building?" |
|
|
399
|
-
| help | (Show quick start guide) |
|
|
380
|
+
If needs mapping, spawn 4 mapper agents (see Route B above).
|
|
400
381
|
|
|
401
|
-
|
|
382
|
+
**Step 2: Research production requirements**
|
|
402
383
|
|
|
403
384
|
```
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
[CTX] Commit: {{commit_hash}} (if auto-committed)
|
|
408
|
-
[CTX] Next: {{next_action}}
|
|
409
|
-
[CTX] Context: {{percent}}% ({{quality}})
|
|
385
|
+
mcp__arguseek__research_iteratively({
|
|
386
|
+
query: "{{tech_stack}} production readiness checklist security performance 2025"
|
|
387
|
+
})
|
|
410
388
|
```
|
|
411
389
|
|
|
412
|
-
|
|
390
|
+
**Step 3: Run full QA**
|
|
413
391
|
|
|
414
|
-
|
|
392
|
+
Spawn ctx-qa agent (see QA Flow above).
|
|
415
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")
|
|
416
414
|
```
|
|
417
|
-
I'm not sure what you'd like to do. Here are your options:
|
|
418
415
|
|
|
419
|
-
|
|
420
|
-
"Fix a bug" → I'll debug the issue
|
|
421
|
-
"Test the app" → I'll run full QA
|
|
422
|
-
"Show status" → I'll show current progress
|
|
416
|
+
**Step 5: Performance check**
|
|
423
417
|
|
|
424
|
-
What would you like to do?
|
|
425
418
|
```
|
|
426
|
-
|
|
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
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
427
474
|
|
|
428
|
-
|
|
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}}
|
|
429
482
|
|
|
430
|
-
|
|
483
|
+
Production Ready: {{YES | NO - reasons}}
|
|
431
484
|
|
|
432
|
-
|
|
485
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
486
|
+
To continue with CTX, run: /ctx
|
|
487
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
433
488
|
```
|
|
434
|
-
User: "I want to build a todo app with React"
|
|
435
489
|
|
|
436
|
-
|
|
437
|
-
Welcome to CTX!
|
|
438
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
490
|
+
---
|
|
439
491
|
|
|
440
|
-
|
|
492
|
+
## Map Codebase Flow
|
|
441
493
|
|
|
442
|
-
|
|
494
|
+
**Step 1: Create structure**
|
|
443
495
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
3. Create a plan with clear milestones
|
|
496
|
+
```bash
|
|
497
|
+
mkdir -p .ctx/codebase
|
|
498
|
+
```
|
|
448
499
|
|
|
449
|
-
|
|
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")
|
|
450
553
|
```
|
|
451
554
|
|
|
452
|
-
|
|
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
|
|
453
575
|
```
|
|
454
|
-
User: "The login is broken"
|
|
455
576
|
|
|
456
|
-
|
|
457
|
-
Welcome to CTX!
|
|
458
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
577
|
+
**Step 4: Report**
|
|
459
578
|
|
|
460
|
-
|
|
579
|
+
```
|
|
580
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
581
|
+
[CTX] Codebase Mapped
|
|
582
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
461
583
|
|
|
462
|
-
|
|
584
|
+
Tech: {{stack}}
|
|
585
|
+
Architecture: {{pattern}}
|
|
586
|
+
Quality: {{assessment}}
|
|
587
|
+
Concerns: {{count}} identified
|
|
463
588
|
|
|
464
|
-
|
|
465
|
-
1. Map your codebase structure
|
|
466
|
-
2. Find the login-related code
|
|
467
|
-
3. Start debugging
|
|
589
|
+
Files: .ctx/codebase/
|
|
468
590
|
|
|
469
|
-
|
|
591
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
592
|
+
To continue with CTX, run: /ctx
|
|
593
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
470
594
|
```
|
|
471
595
|
|
|
472
|
-
|
|
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
|
|
473
605
|
```
|
|
474
|
-
User: "continue"
|
|
475
606
|
|
|
476
|
-
CTX: [CTX] Status: executing
|
|
477
|
-
[CTX] Profile: balanced (1x cost)
|
|
478
|
-
[CTX] Story: S002 - User Authentication
|
|
479
|
-
[CTX] Task: 2/3 - Implement login form validation
|
|
480
|
-
[CTX] Action: Executing task...
|
|
481
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}}
|
|
482
620
|
|
|
483
|
-
|
|
621
|
+
Context: {{percent}}%
|
|
622
|
+
|
|
623
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
624
|
+
To continue with CTX, run: /ctx
|
|
625
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
484
626
|
```
|
|
485
|
-
User: "is the app accessible?"
|
|
486
627
|
|
|
487
|
-
|
|
488
|
-
|
|
628
|
+
</flows>
|
|
629
|
+
|
|
630
|
+
<model_routing>
|
|
631
|
+
Based on config.json profile, use these models for Task() calls:
|
|
632
|
+
|
|
633
|
+
| Agent | quality | balanced | budget |
|
|
634
|
+
|-------|---------|----------|--------|
|
|
635
|
+
| 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
|
+
| Debugger | opus | sonnet | sonnet |
|
|
641
|
+
| QA | sonnet | sonnet | haiku |
|
|
642
|
+
| Verifier | sonnet | haiku | haiku |
|
|
643
|
+
</model_routing>
|
|
489
644
|
|
|
490
|
-
|
|
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)
|
|
491
656
|
```
|
|
657
|
+
</state_transitions>
|
|
492
658
|
|
|
493
|
-
|
|
659
|
+
<success_criteria>
|
|
660
|
+
- [ ] Intent detected from user message
|
|
661
|
+
- [ ] Correct flow routed
|
|
662
|
+
- [ ] ArguSeek called for research (when applicable)
|
|
663
|
+
- [ ] Task() agents spawned with full context
|
|
664
|
+
- [ ] STATE.md updated after each action
|
|
665
|
+
- [ ] Clear "Next Up" shown with /ctx reminder
|
|
666
|
+
- [ ] User knows to run /ctx to continue
|
|
667
|
+
</success_criteria>
|