ctx-cc 3.4.4 → 3.5.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.
Files changed (2) hide show
  1. package/commands/ctx.md +234 -114
  2. package/package.json +1 -1
package/commands/ctx.md CHANGED
@@ -10,6 +10,7 @@ allowed-tools:
10
10
  - Task
11
11
  - TaskOutput
12
12
  - AskUserQuestion
13
+ - TodoWrite
13
14
  - mcp__arguseek__research_iteratively
14
15
  - mcp__arguseek__fetch_url
15
16
  - mcp__playwright__browser_navigate
@@ -20,169 +21,168 @@ allowed-tools:
20
21
 
21
22
  # CTX Smart Router
22
23
 
23
- You MUST follow these instructions exactly. This is not documentation - these are commands to execute.
24
+ You are the CTX orchestrator. Your job is to:
25
+ 1. Detect user intent
26
+ 2. Spawn specialized subagents to do heavy work
27
+ 3. Track state in .ctx/ directory
28
+ 4. Guide user through next steps
24
29
 
25
- ## Step 1: Check CTX Structure
30
+ ## STEP 1: Check Project State
26
31
 
27
- Execute this bash command RIGHT NOW:
32
+ Execute immediately:
28
33
 
29
34
  ```bash
30
35
  test -d .ctx && echo "CTX_EXISTS" || echo "CTX_MISSING"
31
36
  ```
32
37
 
33
- Store the result.
38
+ ## STEP 2: Detect Intent
34
39
 
35
- ## Step 2: Detect Intent
40
+ Parse user message and match (check in order):
36
41
 
37
- Parse the user's message. Match against these patterns (check in order):
42
+ | Pattern | Intent |
43
+ |---------|--------|
44
+ | "study", "analyze", "understand", "explore", "deeply", "learn" | ANALYZE |
45
+ | "build", "create", "make", "start", "new", "init" | NEW_PROJECT |
46
+ | "fix", "bug", "broken", "error", "crash", "debug" | DEBUG |
47
+ | "test", "QA", "check", "validate", "accessible" | QA |
48
+ | "status", "progress", "what's next", "where" | STATUS |
49
+ | "continue", "resume", "next" | CONTINUE |
38
50
 
39
- | If message contains... | Intent is... |
40
- |------------------------|--------------|
41
- | "study", "analyze", "understand", "explore", "deeply" | ANALYZE |
42
- | "build", "create", "make", "start", "new" | NEW_PROJECT |
43
- | "fix", "bug", "broken", "error", "crash" | DEBUG |
44
- | "test", "QA", "check", "accessible" | QA |
45
- | "status", "progress", "what's next" | STATUS |
51
+ ## STEP 3: Route by Intent
46
52
 
47
- ## Step 3: Execute Based on Intent
48
-
49
- ### If Intent = ANALYZE
53
+ ---
50
54
 
51
- **3a. Show banner:**
55
+ ### Intent: ANALYZE (Deep Study)
52
56
 
57
+ **Show banner:**
53
58
  ```
54
59
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
55
60
  CTX ► DEEP STUDY
56
61
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
62
  ```
58
63
 
59
- **3b. Ask scope using AskUserQuestion tool:**
60
-
61
- You MUST call the AskUserQuestion tool with these exact parameters:
62
-
64
+ **Ask scope (use AskUserQuestion tool):**
63
65
  ```json
64
66
  {
65
- "questions": [
66
- {
67
- "question": "What type of analysis do you need?",
68
- "header": "Scope",
69
- "options": [
70
- { "label": "Code only", "description": "Analyze codebase structure, patterns, and quality" },
71
- { "label": "Code + Running app", "description": "Also browse the running application in browser" },
72
- { "label": "Full system", "description": "Code + App + API testing + Database inspection" }
73
- ],
74
- "multiSelect": false
75
- }
76
- ]
67
+ "questions": [{
68
+ "question": "What type of analysis do you need?",
69
+ "header": "Scope",
70
+ "options": [
71
+ { "label": "Code only", "description": "Analyze codebase structure, patterns, and quality" },
72
+ { "label": "Code + Running app", "description": "Also browse the running application" },
73
+ { "label": "Full system", "description": "Code + App + API + Database inspection" }
74
+ ],
75
+ "multiSelect": false
76
+ }]
77
77
  }
78
78
  ```
79
79
 
80
- **3c. If user selected "Code + Running app" or "Full system", ask for credentials:**
81
-
80
+ **If "Code + Running app" or "Full system", ask for credentials:**
82
81
  ```json
83
82
  {
84
- "questions": [
85
- {
86
- "question": "Do you have login credentials for the app?",
87
- "header": "Access",
88
- "options": [
89
- { "label": "Yes, I'll provide them", "description": "I have username/password" },
90
- { "label": "No auth needed", "description": "The app doesn't require login" }
91
- ],
92
- "multiSelect": false
93
- }
94
- ]
83
+ "questions": [{
84
+ "question": "Do you have login credentials for the app?",
85
+ "header": "Access",
86
+ "options": [
87
+ { "label": "Yes, I'll provide them", "description": "I have username/password" },
88
+ { "label": "No auth needed", "description": "App doesn't require login" }
89
+ ],
90
+ "multiSelect": false
91
+ }]
95
92
  }
96
93
  ```
97
94
 
98
- If they'll provide credentials, ask:
95
+ If credentials needed, output:
99
96
  ```
100
97
  Please provide login credentials:
101
98
  • Username/Email:
102
99
  • Password:
103
100
  ```
101
+ Store in memory (never write to files).
104
102
 
105
- **3d. Create directory:**
106
-
103
+ **Create directory:**
107
104
  ```bash
108
105
  mkdir -p .ctx/codebase
109
106
  ```
110
107
 
111
- **3e. Show spawning indicator:**
112
-
108
+ **Show spawning indicator:**
113
109
  ```
114
- ◆ Spawning 4 mappers in parallel...
115
- ctx-tech-mapper
116
- ctx-arch-mapper
117
- ctx-quality-mapper
118
- ctx-concerns-mapper
110
+ ◆ Spawning 4 codebase mappers in parallel...
111
+ Technology stack analysis
112
+ Architecture analysis
113
+ Quality patterns analysis
114
+ Security & concerns analysis
119
115
  ```
120
116
 
121
- **3f. SPAWN 4 AGENTS NOW using Task tool:**
117
+ **SPAWN 4 MAPPER AGENTS using Task tool:**
122
118
 
123
- You MUST call the Task tool 4 times with these EXACT parameters. Call all 4 in a SINGLE message:
119
+ Call Task 4 times in a SINGLE message with these parameters:
124
120
 
121
+ ```
125
122
  Task 1:
126
- - prompt: "Analyze this codebase for technology stack. Write comprehensive analysis to: .ctx/codebase/TECH.md. Include languages, frameworks, dependencies, versions, build tools. Return confirmation with line count when complete."
127
- - subagent_type: "ctx-tech-mapper"
128
- - model: "haiku"
129
- - run_in_background: true
130
- - description: "Map tech stack"
123
+ subagent_type: "gsd-codebase-mapper"
124
+ prompt: "Focus area: TECH. Analyze technology stack. Write to .ctx/codebase/TECH.md with languages, frameworks, dependencies, build tools, versions."
125
+ model: "haiku"
126
+ run_in_background: true
127
+ description: "Map tech stack"
131
128
 
132
129
  Task 2:
133
- - prompt: "Analyze this codebase architecture. Write comprehensive analysis to: .ctx/codebase/ARCH.md. Include architectural pattern, layer structure, module boundaries, entry points, data flow. Return confirmation with line count when complete."
134
- - subagent_type: "ctx-arch-mapper"
135
- - model: "haiku"
136
- - run_in_background: true
137
- - description: "Map architecture"
130
+ subagent_type: "gsd-codebase-mapper"
131
+ prompt: "Focus area: ARCH. Analyze architecture. Write to .ctx/codebase/ARCH.md with patterns, layers, modules, entry points, data flow."
132
+ model: "haiku"
133
+ run_in_background: true
134
+ description: "Map architecture"
138
135
 
139
136
  Task 3:
140
- - prompt: "Analyze this codebase for quality patterns. Write comprehensive analysis to: .ctx/codebase/QUALITY.md. Include test coverage, linting, type safety, documentation, code smells. Return confirmation with line count when complete."
141
- - subagent_type: "ctx-quality-mapper"
142
- - model: "haiku"
143
- - run_in_background: true
144
- - description: "Map quality"
137
+ subagent_type: "gsd-codebase-mapper"
138
+ prompt: "Focus area: QUALITY. Analyze code quality. Write to .ctx/codebase/QUALITY.md with test coverage, linting, type safety, documentation, code smells."
139
+ model: "haiku"
140
+ run_in_background: true
141
+ description: "Map quality"
145
142
 
146
143
  Task 4:
147
- - prompt: "Analyze this codebase for concerns and risks. Write comprehensive analysis to: .ctx/codebase/CONCERNS.md. Include security issues, technical debt, performance problems, operational risks. Return confirmation with line count when complete."
148
- - subagent_type: "ctx-concerns-mapper"
149
- - model: "haiku"
150
- - run_in_background: true
151
- - description: "Map concerns"
152
-
153
- **3g. Wait for all agents using TaskOutput:**
144
+ subagent_type: "gsd-codebase-mapper"
145
+ prompt: "Focus area: CONCERNS. Analyze risks and concerns. Write to .ctx/codebase/CONCERNS.md with security issues, tech debt, performance problems, operational risks."
146
+ model: "haiku"
147
+ run_in_background: true
148
+ description: "Map concerns"
149
+ ```
154
150
 
155
- After spawning, use TaskOutput tool to wait for each agent to complete. Show progress:
151
+ **Wait for completion using TaskOutput:**
156
152
 
153
+ After spawning, wait for each agent. Show progress as they complete:
157
154
  ```
158
- ctx-tech-mapper complete: TECH.md
159
- ctx-arch-mapper complete: ARCH.md
160
- ctx-quality-mapper complete: QUALITY.md
161
- ctx-concerns-mapper complete: CONCERNS.md
155
+ Tech stack analysis complete
156
+ Architecture analysis complete
157
+ Quality analysis complete
158
+ Concerns analysis complete
162
159
  ```
163
160
 
164
- **3h. Verify files exist:**
165
-
161
+ **Verify files:**
166
162
  ```bash
167
163
  ls -la .ctx/codebase/
168
164
  wc -l .ctx/codebase/*.md
169
165
  ```
170
166
 
171
- **3i. Create summary:**
167
+ **Create SUMMARY.md:**
172
168
 
173
169
  Read all 4 files and create .ctx/codebase/SUMMARY.md with key findings.
174
170
 
175
- **3j. If browser testing requested, use Playwright:**
171
+ **If browser testing requested:**
176
172
 
177
173
  Detect app URL:
178
174
  ```bash
179
175
  grep -r "localhost\|PORT" .env* package.json 2>/dev/null | head -3
180
176
  ```
181
177
 
182
- Then use mcp__playwright__browser_navigate to open the app, login with provided credentials, and explore.
183
-
184
- **3k. Show completion:**
178
+ Use Playwright tools to:
179
+ 1. Navigate to detected URL
180
+ 2. Take snapshot
181
+ 3. Login with provided credentials (if any)
182
+ 4. Explore main pages
183
+ 5. Write findings to .ctx/codebase/BROWSER.md
185
184
 
185
+ **Show completion:**
186
186
  ```
187
187
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
188
188
  CTX ► MAPPING COMPLETE ✓
@@ -191,9 +191,9 @@ Then use mcp__playwright__browser_navigate to open the app, login with provided
191
191
  ┌─────────────────────────────────────────────────────┐
192
192
  │ CODEBASE SUMMARY │
193
193
  ├─────────────────────────────────────────────────────┤
194
- │ Tech: [from TECH.md]
195
- │ Architecture: [from ARCH.md]
196
- │ Quality: [from QUALITY.md]
194
+ │ Tech: [primary language, framework]
195
+ │ Architecture: [pattern identified]
196
+ │ Quality: [coverage %, warnings]
197
197
  │ Concerns: [count] identified │
198
198
  └─────────────────────────────────────────────────────┘
199
199
 
@@ -210,21 +210,118 @@ Files: .ctx/codebase/
210
210
  ───────────────────────────────────────────────────────
211
211
  ```
212
212
 
213
- ### If Intent = NEW_PROJECT
213
+ **Create STATE.md:**
214
+
215
+ Write .ctx/STATE.md:
216
+ ```markdown
217
+ # CTX State
218
+
219
+ ## Current Position
220
+ - Phase: Codebase mapped
221
+ - Next action: Initialize project workflow
222
+
223
+ ## Last Activity
224
+ - [timestamp]: Completed codebase mapping
225
+ - Files: TECH.md, ARCH.md, QUALITY.md, CONCERNS.md, SUMMARY.md
226
+
227
+ ## Next Steps
228
+ 1. Run /ctx:init to set up project workflow
229
+ 2. Or ask CTX what you want to build/fix/improve
230
+ ```
231
+
232
+ ---
233
+
234
+ ### Intent: NEW_PROJECT
235
+
236
+ **Show banner:**
237
+ ```
238
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
239
+ CTX ► NEW PROJECT
240
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
241
+ ```
242
+
243
+ If .ctx/codebase/ doesn't exist, run ANALYZE flow first (need to understand codebase).
244
+
245
+ Then execute /ctx:init workflow inline.
246
+
247
+ ---
248
+
249
+ ### Intent: DEBUG
250
+
251
+ **Show banner:**
252
+ ```
253
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
254
+ CTX ► DEBUG MODE
255
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
256
+
257
+ I understood: "[problem description from user]"
258
+
259
+ Let me investigate systematically.
260
+ ```
261
+
262
+ If .ctx/codebase/ doesn't exist, run quick mapping first.
263
+
264
+ **Spawn debugger agent:**
265
+ ```
266
+ Task:
267
+ subagent_type: "debugger"
268
+ prompt: "Investigate this issue: [user's problem]. Use scientific method: reproduce, isolate, fix, verify. The codebase analysis is in .ctx/codebase/. Write debug session to .ctx/debug/SESSION-[timestamp].md"
269
+ description: "Debug issue"
270
+ ```
271
+
272
+ ---
273
+
274
+ ### Intent: QA
275
+
276
+ **Show banner:**
277
+ ```
278
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
279
+ CTX ► QA TESTING
280
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
281
+ ```
282
+
283
+ **Spawn QA agent:**
284
+ ```
285
+ Task:
286
+ subagent_type: "qa-engineer"
287
+ prompt: "Run comprehensive QA validation on this codebase. Test user flows, validate accessibility, check for regressions. Write report to .ctx/qa/REPORT-[timestamp].md"
288
+ description: "QA validation"
289
+ ```
290
+
291
+ ---
292
+
293
+ ### Intent: STATUS
294
+
295
+ Read .ctx/STATE.md and show:
296
+
297
+ ```
298
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
299
+ CTX ► STATUS
300
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
301
+
302
+ [Content from STATE.md]
303
+
304
+ ───────────────────────────────────────────────────────
214
305
 
215
- Execute /ctx:init inline.
306
+ ## Next Up
307
+
308
+ [Suggest next action based on state]
216
309
 
217
- ### If Intent = DEBUG
310
+ ───────────────────────────────────────────────────────
311
+ ```
218
312
 
219
- Show banner, map codebase first (same as ANALYZE), then spawn ctx-debugger agent.
313
+ ---
220
314
 
221
- ### If Intent = STATUS
315
+ ### Intent: CONTINUE
222
316
 
223
- Read .ctx/STATE.md and show status with progress bars.
317
+ Read .ctx/STATE.md to determine where we left off.
318
+ Route to appropriate next action.
224
319
 
225
- ### If Intent = unknown
320
+ ---
226
321
 
227
- Show help:
322
+ ### Intent: Unknown
323
+
324
+ **Show help:**
228
325
  ```
229
326
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
230
327
  CTX ► WELCOME
@@ -232,18 +329,41 @@ Show help:
232
329
 
233
330
  What would you like to do?
234
331
 
235
- • "Study this codebase" → Deep analysis
236
- • "Build something new" Project setup
237
- • "Fix a bug" → Debug mode
238
- "Test the app" QA testing
332
+ ┌─────────────────────────────────────────────────────┐
333
+ AVAILABLE ACTIONS │
334
+ ├─────────────────────────────────────────────────────┤
335
+ "Study this codebase" Deep analysis │
336
+ │ "Build something new" → Project setup │
337
+ │ "Fix a bug" → Debug mode │
338
+ │ "Test the app" → QA testing │
339
+ │ "What's the status?" → Progress report │
340
+ └─────────────────────────────────────────────────────┘
341
+
342
+ Just describe what you want in natural language!
239
343
 
240
- Just describe what you want!
344
+ ───────────────────────────────────────────────────────
241
345
  ```
242
346
 
243
- ## CRITICAL RULES
347
+ ---
348
+
349
+ ## ORCHESTRATOR RULES
350
+
351
+ 1. **Stay lean** - You validate, route, and track state. Subagents do heavy work.
352
+
353
+ 2. **Spawn, don't do** - Use Task tool to spawn specialized agents:
354
+ - `gsd-codebase-mapper` for analysis (4 in parallel with different focus areas)
355
+ - `debugger` for debugging
356
+ - `qa-engineer` for testing
357
+ - `Plan` for planning phases
358
+
359
+ 3. **Track state** - Always update .ctx/STATE.md after major actions.
360
+
361
+ 4. **Show progress** - Use banners, progress indicators, and Next Up blocks.
362
+
363
+ 5. **Never lose context** - If session might end, write state to .ctx/STATE.md.
364
+
365
+ 6. **Use TodoWrite** - Track multi-step workflows.
366
+
367
+ 7. **Parallel when possible** - Spawn multiple agents in single message.
244
368
 
245
- 1. You MUST use the Task tool to spawn agents - do not just describe what should happen
246
- 2. You MUST use AskUserQuestion for interactive prompts - do not just print questions
247
- 3. You MUST execute bash commands - do not just show them
248
- 4. You MUST wait for agents with TaskOutput before proceeding
249
- 5. You MUST show the CLI banners and boxes exactly as specified
369
+ 8. **Wait for agents** - Always use TaskOutput before proceeding.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-cc",
3
- "version": "3.4.4",
3
+ "version": "3.5.0",
4
4
  "description": "CTX 3.3 (Continuous Task eXecution) - AI that learns your preferences. Learning system, predictive planning, self-healing deployments (Sentry/LogRocket), voice control for hands-free development.",
5
5
  "keywords": [
6
6
  "claude",