ctx-cc 3.3.0 → 3.3.2

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/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  **AI that learns your preferences. Predictive planning. Self-healing deployments. Voice control.**
17
17
 
18
- [Installation](#installation) · [Quick Start](#quick-start) · [New in 3.3](#new-in-33) · [Commands](#commands) · [Why CTX](#why-ctx)
18
+ [Installation](#installation) · [Quick Start](#quick-start) · [New in 3.3](#new-in-33) · [Commands](#commands) · [Why CTX](#why-ctx) · [**Getting Started Guide**](./GETTING_STARTED.md)
19
19
 
20
20
  </div>
21
21
 
@@ -403,12 +403,31 @@ Configure in `.ctx/config.json`:
403
403
  }
404
404
  ```
405
405
 
406
- ### Persistent Debug State
407
- Debug sessions survive context resets:
406
+ ### Persistent Debug Mode
407
+ Scientific debugging with persistent state across sessions:
408
+
408
409
  ```bash
409
- /ctx debug --resume # Continue previous session
410
+ /ctx debug "login fails" # Start debugging
411
+ /ctx debug --resume # Resume after context reset
412
+ /ctx debug --list # See all sessions
413
+ ```
414
+
415
+ **How it works:**
416
+ ```
417
+ 1. OBSERVE → Capture exact error, context, state
418
+ 2. RESEARCH → Search codebase and web for similar issues
419
+ 3. HYPOTHESIZE → Form testable theory with confidence level
420
+ 4. TEST → Apply minimal fix
421
+ 5. VERIFY → Build + Tests + Lint + Browser
422
+ 6. ITERATE → Refine hypothesis, max 10 attempts
410
423
  ```
411
424
 
425
+ **Key features:**
426
+ - Sessions survive context resets and days between attempts
427
+ - Browser verification with stored credentials
428
+ - Screenshots saved for each attempt
429
+ - Escalation report if max attempts reached
430
+
412
431
  State stored in `.ctx/debug/sessions/`:
413
432
  - `STATE.json` - Machine-readable progress
414
433
  - `TRACE.md` - Human-readable log
@@ -486,6 +505,15 @@ Results synthesized into `SUMMARY.md`.
486
505
  | `/ctx verify` | Force three-level verification |
487
506
  | `/ctx quick "task"` | Quick task bypass |
488
507
 
508
+ ### Debug
509
+ | Command | Purpose |
510
+ |---------|---------|
511
+ | `/ctx debug` | Start debugging current issue |
512
+ | `/ctx debug "issue"` | Debug specific problem |
513
+ | `/ctx debug --resume` | Resume last debug session |
514
+ | `/ctx debug --list` | List all debug sessions |
515
+ | `/ctx debug --status` | Show current session status |
516
+
489
517
  ### Session
490
518
  | Command | Purpose |
491
519
  |---------|---------|
package/bin/ctx.js CHANGED
@@ -19,9 +19,9 @@ if (options.help) {
19
19
  ╚██████╗ ██║ ██╔╝ ██╗
20
20
  ╚═════╝ ╚═╝ ╚═╝ ╚═╝\x1b[0m
21
21
 
22
- \x1b[1mCTX 2.2 - Continuous Task eXecution\x1b[0m
23
- PRD-driven workflow orchestration for Claude Code.
24
- 8 commands. Story-verified. Debug loop.
22
+ \x1b[1mCTX 3.3 - Continuous Task eXecution\x1b[0m
23
+ Intelligent workflow orchestration for Claude Code.
24
+ 20 agents. Learning system. Predictive planning. Self-healing.
25
25
 
26
26
  \x1b[1mUsage:\x1b[0m
27
27
  npx ctx-cc [options]
@@ -0,0 +1,461 @@
1
+ ---
2
+ name: ctx:debug
3
+ description: Systematic debugging with persistent state across sessions. Scientific method. Max 10 attempts. Browser verification.
4
+ ---
5
+
6
+ <objective>
7
+ Enter debug mode to systematically fix an issue using scientific method.
8
+
9
+ Debug sessions are **persistent** - they survive context resets, session restarts, and days between attempts. No context is ever lost.
10
+ </objective>
11
+
12
+ <usage>
13
+ ```bash
14
+ /ctx:debug # Start debug on current issue (from STATE.md)
15
+ /ctx:debug "description" # Start debug with specific issue
16
+ /ctx:debug --resume # Resume most recent debug session
17
+ /ctx:debug --resume {id} # Resume specific session
18
+ /ctx:debug --list # List all debug sessions
19
+ /ctx:debug --status # Show current debug session status
20
+ /ctx:debug --abort # Abort current session (mark failed)
21
+ ```
22
+ </usage>
23
+
24
+ <process>
25
+
26
+ ## Step 1: Parse Command
27
+
28
+ Check arguments:
29
+ - No args → Check STATE.md for debug_issue, or ask user
30
+ - `"description"` → Start fresh session with description
31
+ - `--resume` → Resume active session
32
+ - `--resume {id}` → Resume specific session
33
+ - `--list` → Show sessions and exit
34
+ - `--status` → Show current session and exit
35
+ - `--abort` → Mark session failed and exit
36
+
37
+ ## Step 2: Handle List/Status/Abort (if requested)
38
+
39
+ ### --list
40
+ ```bash
41
+ echo "## Debug Sessions"
42
+ echo ""
43
+ for session in .ctx/debug/sessions/*/; do
44
+ id=$(basename "$session")
45
+ state=$(cat "$session/STATE.json" | jq -r '.status')
46
+ issue=$(cat "$session/STATE.json" | jq -r '.issue.description' | head -c 50)
47
+ attempts=$(cat "$session/STATE.json" | jq -r '.currentAttempt')
48
+ echo "- $id [$state] $attempts attempts"
49
+ echo " $issue..."
50
+ done
51
+ ```
52
+
53
+ Output example:
54
+ ```
55
+ ## Debug Sessions
56
+
57
+ - debug-20240120-143022 [resolved] 2 attempts
58
+ Login form shows blank error...
59
+
60
+ - debug-20240119-091500 [escalated] 10 attempts
61
+ API returns 500 on checkout...
62
+
63
+ - debug-20240118-160045 [in_progress] 3 attempts ← ACTIVE
64
+ File upload fails silently...
65
+ ```
66
+
67
+ ### --status
68
+ Read `.ctx/debug/active-session.json` and show:
69
+ - Session ID
70
+ - Issue description
71
+ - Current attempt number
72
+ - Last hypothesis
73
+ - Last result
74
+ - Time spent
75
+
76
+ ### --abort
77
+ ```json
78
+ // Update STATE.json
79
+ {
80
+ "status": "aborted",
81
+ "abortedAt": "{timestamp}",
82
+ "reason": "User requested abort"
83
+ }
84
+ ```
85
+ Clear active-session.json and return to main router.
86
+
87
+ ## Step 3: Initialize or Resume Session
88
+
89
+ ### Resume Existing
90
+ ```javascript
91
+ // Check for active session
92
+ const active = JSON.parse(fs.readFileSync('.ctx/debug/active-session.json'));
93
+ if (active.sessionId) {
94
+ const state = JSON.parse(fs.readFileSync(`.ctx/debug/sessions/${active.sessionId}/STATE.json`));
95
+ // Continue from state.currentAttempt
96
+ }
97
+ ```
98
+
99
+ ### Start Fresh
100
+ ```javascript
101
+ const sessionId = `debug-${date}-${time}`;
102
+ const sessionDir = `.ctx/debug/sessions/${sessionId}`;
103
+
104
+ // Create session directory
105
+ fs.mkdirSync(sessionDir, { recursive: true });
106
+ fs.mkdirSync(`${sessionDir}/screenshots`, { recursive: true });
107
+
108
+ // Initialize STATE.json
109
+ const state = {
110
+ sessionId,
111
+ created: new Date().toISOString(),
112
+ updated: new Date().toISOString(),
113
+ status: "in_progress",
114
+ issue: {
115
+ description: userDescription,
116
+ type: null, // Will classify
117
+ severity: null,
118
+ errorMessage: null,
119
+ stackTrace: null,
120
+ stepsToReproduce: []
121
+ },
122
+ attempts: [],
123
+ currentAttempt: 0,
124
+ maxAttempts: 10 // From config.json
125
+ };
126
+
127
+ // Set as active
128
+ fs.writeFileSync('.ctx/debug/active-session.json', JSON.stringify({ sessionId }));
129
+ ```
130
+
131
+ ## Step 4: Gather Issue Context
132
+
133
+ ### Automatic Detection
134
+ 1. Check build output for errors
135
+ 2. Check test output for failures
136
+ 3. Check STATE.md for debug_issue
137
+ 4. Check git diff for recent changes
138
+
139
+ ### Classify Issue Type
140
+ ```
141
+ build → Compilation/bundling errors
142
+ test → Test failures
143
+ runtime → Crashes, exceptions
144
+ ui → Visual/interaction bugs
145
+ api → Backend/network errors
146
+ perf → Performance issues
147
+ ```
148
+
149
+ ### Document in STATE.json
150
+ ```json
151
+ {
152
+ "issue": {
153
+ "description": "Login form submits but shows blank error",
154
+ "type": "ui",
155
+ "severity": "high",
156
+ "errorMessage": "TypeError: Cannot read property 'message' of undefined",
157
+ "stackTrace": "at handleSubmit (login.tsx:45)...",
158
+ "stepsToReproduce": [
159
+ "Go to /login",
160
+ "Enter invalid credentials",
161
+ "Click submit",
162
+ "Observe blank error message"
163
+ ],
164
+ "affectedFiles": ["src/auth/login.tsx"],
165
+ "relatedCommits": ["abc1234"]
166
+ }
167
+ }
168
+ ```
169
+
170
+ ## Step 5: Spawn ctx-debugger Agent
171
+
172
+ ```
173
+ Task tool:
174
+ subagent_type: ctx-debugger
175
+ prompt: |
176
+ Resume debug session: {sessionId}
177
+
178
+ Issue: {issue.description}
179
+ Type: {issue.type}
180
+ Error: {issue.errorMessage}
181
+
182
+ Previous attempts: {attempts.length}
183
+ Last result: {lastAttempt.result}
184
+ Last learning: {lastAttempt.learnings}
185
+
186
+ Continue debugging. Max {remainingAttempts} more attempts.
187
+
188
+ Credentials available in .ctx/.env for browser testing.
189
+ ```
190
+
191
+ ## Step 6: Monitor Progress
192
+
193
+ The debugger agent will:
194
+
195
+ 1. **Form Hypothesis** based on:
196
+ - Error analysis
197
+ - Previous attempts (if any)
198
+ - Codebase patterns
199
+ - Web research
200
+
201
+ 2. **Apply Minimal Fix**
202
+ - Single focused change
203
+ - No collateral modifications
204
+
205
+ 3. **Verify All Layers**
206
+ - Build passes
207
+ - Tests pass
208
+ - Lint passes
209
+ - Browser works (if UI)
210
+
211
+ 4. **Record Result**
212
+ - Update STATE.json
213
+ - Append to TRACE.md
214
+ - Save screenshots
215
+
216
+ 5. **Loop or Exit**
217
+ - If fixed → Mark resolved
218
+ - If max attempts → Escalate
219
+ - Otherwise → Next hypothesis
220
+
221
+ ## Step 7: Handle Outcomes
222
+
223
+ ### Success (resolved)
224
+ ```
225
+ [DEBUG] ✅ Issue resolved!
226
+
227
+ Session: debug-20240120-143022
228
+ Issue: Login form shows blank error
229
+ Attempts: 2
230
+ Duration: 15 minutes
231
+
232
+ Root Cause:
233
+ Error state was logged but not set in React state
234
+
235
+ Fix Applied:
236
+ src/auth/login.tsx:45 - Added setError() call
237
+
238
+ Files Changed:
239
+ - src/auth/login.tsx
240
+
241
+ Commit: abc1234
242
+
243
+ Full trace: .ctx/debug/sessions/debug-20240120-143022/TRACE.md
244
+ ```
245
+
246
+ Update STATE.md:
247
+ - Set status = "executing"
248
+ - Clear debug_issue
249
+ - Log resolution
250
+
251
+ ### Escalation (max attempts)
252
+ ```
253
+ [DEBUG] ⚠️ Max attempts reached (10)
254
+
255
+ Session: debug-20240119-091500
256
+ Issue: API returns 500 on checkout
257
+ Duration: 2 hours
258
+
259
+ What We Tried:
260
+ 1. [FAIL] Null check on request body
261
+ 2. [FAIL] Validate payment data format
262
+ 3. [PARTIAL] Fix database connection pool
263
+ ...
264
+
265
+ What We Know:
266
+ - Error occurs only with specific product combinations
267
+ - Database connection is stable
268
+ - Payment API returns valid response
269
+
270
+ Possible Root Causes:
271
+ 1. [60%] Race condition in inventory check
272
+ 2. [30%] Stale cache invalidation
273
+
274
+ Recommended:
275
+ - Add logging to checkInventory()
276
+ - Review concurrent order tests
277
+
278
+ Full report: .ctx/debug/sessions/debug-20240119-091500/ESCALATION.md
279
+ ```
280
+
281
+ Ask user:
282
+ - Provide more context?
283
+ - Try different approach?
284
+ - Manual investigation?
285
+
286
+ </process>
287
+
288
+ <debug_philosophy>
289
+
290
+ ## Scientific Method
291
+
292
+ ```
293
+ OBSERVE → Exact error, context, state
294
+ RESEARCH → Similar issues, web search
295
+ HYPOTHESIZE → Testable theory with confidence
296
+ PREDICT → Expected outcome if correct
297
+ TEST → Apply minimal fix
298
+ ANALYZE → Did prediction match?
299
+ ITERATE → Refine and repeat
300
+ ```
301
+
302
+ ## Hypothesis Confidence Levels
303
+
304
+ | Confidence | Meaning | Action |
305
+ |------------|---------|--------|
306
+ | 90%+ | Strong evidence, likely root cause | Test first |
307
+ | 70-90% | Good evidence, probable cause | Test early |
308
+ | 50-70% | Some evidence, possible cause | Test if higher fails |
309
+ | <50% | Weak evidence, unlikely | Last resort |
310
+
311
+ ## Fix Principles
312
+
313
+ 1. **Minimal** - Change only what's necessary
314
+ 2. **Focused** - One hypothesis per attempt
315
+ 3. **Reversible** - Easy to undo if wrong
316
+ 4. **Documented** - Clear diff and rationale
317
+
318
+ ## Verification Layers
319
+
320
+ | Layer | What | How |
321
+ |-------|------|-----|
322
+ | 1 | Build | `npm run build` or equivalent |
323
+ | 2 | Tests | Run affected test files |
324
+ | 3 | Lint | `npm run lint` |
325
+ | 4 | Browser | Playwright/Chrome DevTools |
326
+
327
+ All layers must pass for "resolved" status.
328
+
329
+ </debug_philosophy>
330
+
331
+ <persistence>
332
+
333
+ ## Why Persistence Matters
334
+
335
+ Regular debugging:
336
+ ```
337
+ Session 1: Try 3 fixes, context resets
338
+ Session 2: Forget what was tried, repeat same fixes
339
+ Session 3: Still stuck, no progress
340
+ ```
341
+
342
+ CTX debugging:
343
+ ```
344
+ Session 1: Try 3 fixes, save state
345
+ Session 2: Load state, know what failed, try fix 4
346
+ Session 3: Load state, try fix 5, success!
347
+ ```
348
+
349
+ ## State Files
350
+
351
+ ```
352
+ .ctx/debug/
353
+ ├── active-session.json # Current session pointer
354
+ └── sessions/
355
+ └── debug-20240120-143022/
356
+ ├── STATE.json # Machine-readable state
357
+ ├── TRACE.md # Human-readable log
358
+ ├── hypotheses.json # All hypotheses
359
+ └── screenshots/ # Visual evidence
360
+ ```
361
+
362
+ ## Resume After Days
363
+
364
+ ```bash
365
+ # Monday - start debugging
366
+ /ctx:debug "checkout fails"
367
+ # Try 3 fixes, no luck, go home
368
+
369
+ # Wednesday - resume
370
+ /ctx:debug --resume
371
+ # CTX knows: 3 attempts failed, here's what we learned
372
+ # Continues from attempt 4
373
+ ```
374
+
375
+ </persistence>
376
+
377
+ <browser_verification>
378
+
379
+ ## Autonomous Browser Testing
380
+
381
+ CTX uses stored credentials from `.ctx/.env`:
382
+
383
+ ```bash
384
+ APP_URL=http://localhost:3000
385
+ TEST_USER_EMAIL=test@example.com
386
+ TEST_USER_PASSWORD=testpass123
387
+ ```
388
+
389
+ ### Verification Flow
390
+
391
+ ```javascript
392
+ // 1. Navigate to app
393
+ browser_navigate({ url: process.env.APP_URL });
394
+
395
+ // 2. Login if needed
396
+ browser_snapshot();
397
+ if (page.includes('login')) {
398
+ browser_type({ ref: 'email-input', text: process.env.TEST_USER_EMAIL });
399
+ browser_type({ ref: 'password-input', text: process.env.TEST_USER_PASSWORD });
400
+ browser_click({ ref: 'submit-button' });
401
+ }
402
+
403
+ // 3. Navigate to affected page
404
+ browser_navigate({ url: `${process.env.APP_URL}/affected-page` });
405
+
406
+ // 4. Reproduce issue
407
+ browser_snapshot();
408
+ // ... interaction steps
409
+
410
+ // 5. Verify fix
411
+ browser_snapshot();
412
+ browser_take_screenshot({ filename: `attempt-${n}.png` });
413
+ ```
414
+
415
+ ### Screenshot Evidence
416
+
417
+ Every attempt saves screenshots:
418
+ ```
419
+ screenshots/
420
+ ├── issue-initial.png # Before any fixes
421
+ ├── attempt-1.png # After fix 1
422
+ ├── attempt-2.png # After fix 2
423
+ ├── attempt-3-success.png # Fixed!
424
+ ```
425
+
426
+ </browser_verification>
427
+
428
+ <config>
429
+
430
+ ## Debug Settings
431
+
432
+ In `.ctx/config.json`:
433
+
434
+ ```json
435
+ {
436
+ "debug": {
437
+ "maxAttempts": 10,
438
+ "persistSessions": true,
439
+ "screenshotOnFailure": true,
440
+ "autoResume": true
441
+ }
442
+ }
443
+ ```
444
+
445
+ | Setting | Default | Description |
446
+ |---------|---------|-------------|
447
+ | maxAttempts | 10 | Max tries before escalation |
448
+ | persistSessions | true | Save state across sessions |
449
+ | screenshotOnFailure | true | Capture on each failed attempt |
450
+ | autoResume | true | Auto-resume if active session exists |
451
+
452
+ </config>
453
+
454
+ <output>
455
+ After spawning ctx-debugger, report:
456
+ - Session status (in_progress / resolved / escalated)
457
+ - Attempts made
458
+ - If resolved: root cause, fix, commit
459
+ - If escalated: report path, recommendations
460
+ - Next action for main router
461
+ </output>
package/commands/help.md CHANGED
@@ -4,134 +4,237 @@ description: Show CTX commands and usage guide
4
4
  ---
5
5
 
6
6
  <objective>
7
- Display the CTX 2.3 command reference.
7
+ Display the CTX 3.3 command reference.
8
8
 
9
9
  Output ONLY the reference content below. Do NOT add project-specific analysis.
10
10
  </objective>
11
11
 
12
12
  <reference>
13
- # CTX 2.3 Command Reference
13
+ # CTX 3.3 Command Reference
14
14
 
15
- **CTX** (Continuous Task eXecution) - Smart workflow orchestration for Claude Code.
16
- 8 commands. PRD-driven. Design-first. Smart routing. Debug loop until 100% fixed.
15
+ **CTX** (Continuous Task eXecution) - Intelligent workflow orchestration for Claude Code.
16
+ 20 agents. Learning system. Predictive planning. Self-healing. Voice control.
17
17
 
18
18
  ## Quick Start
19
19
 
20
20
  ```
21
21
  1. /ctx init Initialize project + generate PRD.json
22
- 2. /ctx Smart router does the right thing
23
- 3. /ctx status Check progress (read-only)
24
- 4. /ctx pause Checkpoint when needed
22
+ 2. /ctx map Build repository map
23
+ 3. /ctx Smart router does the right thing
24
+ 4. /ctx status Check progress (read-only)
25
25
  ```
26
26
 
27
- ## What's New in 2.3
27
+ ## What's New in 3.3
28
28
 
29
- - **Design System Integration** - Full brand + UI design workflow
30
- - **ctx-designer Agent** - WCAG 2.2 AA, W3C tokens, Figma MCP, Gemini
31
- - **Story Types** - feature, brand, design, fix, refactor
32
- - **3 Options Pattern** - Always present A/B/C for design decisions
33
- - **Visual Approval Gates** - Mood board → Direction → Prototype → Final
34
- - **BRAND_KIT.md** - Visual foundation with W3C design tokens
35
- - **EAA 2025 Ready** - European Accessibility Act compliance
29
+ - **Learning System** - CTX learns your patterns, decisions, preferences
30
+ - **Predictive Planning** - AI suggests what to build next with ROI scoring
31
+ - **Self-Healing** - Monitor production errors, auto-create fixes
32
+ - **Voice Control** - Speak commands and dictate stories
36
33
 
37
- ## What's in 2.2
34
+ ## What's in 3.2
38
35
 
39
- - **Front-Loaded Approach** - Gather ALL info upfront, execute autonomously
40
- - **PRD.json** - Requirements contract with user stories
41
- - **Secure Credentials** - `.ctx/.env` for test credentials (gitignored)
42
- - **Acceptance Criteria** - Each story has verifiable criteria
43
- - **`passes` Flag** - Auto-tracks story completion
44
- - **Story-Driven Workflow** - Plan → Execute → Verify → Next Story
36
+ - **Milestone Workflow** - Full release management with git tagging
37
+ - **Team Collaboration** - File locking, conflict detection, notifications
38
+ - **Audit Trail** - SOC2/HIPAA/GDPR compliance logging
39
+ - **Metrics Dashboard** - Stories/day, cost analysis, ROI tracking
45
40
 
46
- ## Front-Loaded Philosophy
41
+ ## What's in 3.1
47
42
 
48
- ```
49
- /ctx init gathers:
50
- ├── Requirements PRD.json stories
51
- ├── Context problem, target user, success criteria
52
- ├── Credentials .ctx/.env (gitignored)
53
- └── Constitution → rules for autonomous decisions
54
-
55
- Then /ctx runs autonomously:
56
- ├── Only interrupts for architecture decisions
57
- ├── Uses stored credentials for browser testing
58
- └── Loops until all stories pass
59
- ```
43
+ - **Task Parallelization** - Run independent tasks simultaneously
44
+ - **Pre-Commit Review** - Catch errors before commit
45
+ - **Criteria Auto-Gen** - AI-suggested acceptance criteria
46
+ - **Smart Handoff** - Seamless context transitions
47
+ - **Issue Tracker Sync** - Linear, Jira, GitHub Issues
60
48
 
61
- ## The 8 Commands
49
+ ## What's in 3.0
62
50
 
63
- ### Smart (Auto-routing)
51
+ - **Repository Mapping** - Token-optimized codebase map
52
+ - **Discussion Phase** - Capture decisions before planning
53
+ - **Model Profiles** - quality/balanced/budget routing
54
+ - **Git-Native** - Auto-commit per task
55
+ - **Persistent Debug** - Sessions survive context resets
56
+ - **Parallel Codebase Analysis** - 4 mapper agents
57
+
58
+ ---
59
+
60
+ ## Commands
64
61
 
62
+ ### Smart (Auto-routing)
65
63
  | Command | Purpose |
66
64
  |---------|---------|
67
65
  | `/ctx` | **Smart router** - reads STATE.md, does the right thing |
68
- | `/ctx init` | Initialize project with STATE.md |
66
+ | `/ctx init` | Initialize project with STATE.md + PRD.json |
69
67
 
70
- ### Inspect (Read-only)
68
+ ### Mapping
69
+ | Command | Purpose |
70
+ |---------|---------|
71
+ | `/ctx map` | Build repository map (REPO-MAP.md) |
72
+ | `/ctx map-codebase` | Deep analysis (4 parallel agents) |
71
73
 
74
+ ### Discussion
72
75
  | Command | Purpose |
73
76
  |---------|---------|
74
- | `/ctx status` | See current state without triggering action |
77
+ | `/ctx discuss [story]` | Capture decisions before planning |
75
78
 
76
- ### Control (Override smart router)
79
+ ### Configuration
80
+ | Command | Purpose |
81
+ |---------|---------|
82
+ | `/ctx profile [name]` | Switch model profile (quality/balanced/budget) |
77
83
 
84
+ ### Inspect (Read-only)
85
+ | Command | Purpose |
86
+ |---------|---------|
87
+ | `/ctx status` | See current state without triggering action |
88
+
89
+ ### Control (Override)
78
90
  | Command | Purpose |
79
91
  |---------|---------|
80
92
  | `/ctx plan [goal]` | Force research + planning |
81
93
  | `/ctx verify` | Force three-level verification |
82
- | `/ctx quick "task"` | Quick task bypass (skip workflow) |
94
+ | `/ctx quick "task"` | Quick task bypass |
83
95
 
84
- ### Session
96
+ ### Debug
97
+ | Command | Purpose |
98
+ |---------|---------|
99
+ | `/ctx debug` | Start debugging current issue |
100
+ | `/ctx debug "issue"` | Debug specific problem |
101
+ | `/ctx debug --resume` | Resume last debug session |
102
+ | `/ctx debug --list` | List all debug sessions |
103
+ | `/ctx debug --status` | Show current session status |
104
+ | `/ctx debug --abort` | Abort current session |
85
105
 
106
+ ### Session
86
107
  | Command | Purpose |
87
108
  |---------|---------|
88
109
  | `/ctx pause` | Checkpoint for session resume |
89
110
 
90
111
  ### Phase Management
91
-
92
112
  | Command | Purpose |
93
113
  |---------|---------|
94
- | `/ctx phase list` | Show all phases with status |
95
- | `/ctx phase add "goal"` | Add new phase to roadmap |
114
+ | `/ctx phase list` | Show all phases |
115
+ | `/ctx phase add "goal"` | Add new phase |
96
116
  | `/ctx phase next` | Complete current, move to next |
97
- | `/ctx phase skip` | Skip current phase |
117
+
118
+ ### Integration
119
+ | Command | Purpose |
120
+ |---------|---------|
121
+ | `/ctx integrate` | Show integration status |
122
+ | `/ctx integrate linear` | Setup Linear |
123
+ | `/ctx integrate jira` | Setup Jira |
124
+ | `/ctx integrate github` | Setup GitHub Issues |
125
+
126
+ ### Milestone
127
+ | Command | Purpose |
128
+ |---------|---------|
129
+ | `/ctx milestone` | Show current milestone |
130
+ | `/ctx milestone list` | List all milestones |
131
+ | `/ctx milestone audit` | Verify completion |
132
+ | `/ctx milestone complete` | Archive and tag |
133
+ | `/ctx milestone new [name]` | Start next version |
134
+
135
+ ### Metrics & Audit
136
+ | Command | Purpose |
137
+ |---------|---------|
138
+ | `/ctx metrics` | Show productivity dashboard |
139
+ | `/ctx metrics cost` | Cost analysis |
140
+ | `/ctx metrics export` | Export HTML dashboard |
141
+ | `/ctx audit` | Show audit summary |
142
+ | `/ctx audit export` | Generate compliance report |
143
+
144
+ ### Learning & Prediction
145
+ | Command | Purpose |
146
+ |---------|---------|
147
+ | `/ctx learn` | Show what CTX has learned |
148
+ | `/ctx learn patterns` | Show code patterns |
149
+ | `/ctx learn decisions` | Show architectural decisions |
150
+ | `/ctx learn forget [id]` | Remove a learned pattern |
151
+ | `/ctx predict` | Get feature suggestions |
152
+ | `/ctx predict --quick` | Quick wins only |
153
+ | `/ctx predict --create [id]` | Create story from suggestion |
154
+
155
+ ### Monitoring & Voice
156
+ | Command | Purpose |
157
+ |---------|---------|
158
+ | `/ctx monitor` | Show monitoring status |
159
+ | `/ctx monitor connect sentry` | Connect Sentry |
160
+ | `/ctx monitor errors` | List recent errors |
161
+ | `/ctx monitor auto-fix [id]` | Auto-fix with PR |
162
+ | `/ctx monitor --watch` | Continuous monitoring |
163
+ | `/ctx voice` | Start voice input |
164
+ | `/ctx voice --continuous` | Always listening mode |
165
+ | `/ctx voice --dictate` | Long-form dictation |
98
166
 
99
167
  ---
100
168
 
101
169
  ## Smart Router States
102
170
 
103
- When you run `/ctx`, it reads STATE.md and PRD.json, auto-routes:
104
-
105
171
  | State | What happens |
106
172
  |-------|--------------|
107
- | initializing | Research + Plan for current story |
108
- | executing | Execute tasks for current story |
109
- | debugging | **Debug loop until 100% fixed** |
110
- | verifying | Verify acceptance criteria mark story as passed |
173
+ | initializing | Research + Map + Plan |
174
+ | discussing | Capture decisions in CONTEXT.md |
175
+ | executing | Execute with git-native commits |
176
+ | debugging | Persistent debug loop (max 10 attempts) |
177
+ | verifying | Three-level verification |
111
178
  | paused | Resume from checkpoint |
112
179
 
113
- **Story Flow:**
180
+ ## Model Profiles
181
+
182
+ | Profile | Research | Execute | Verify | Cost |
183
+ |---------|----------|---------|--------|------|
184
+ | quality | Opus | Opus | Sonnet | 3x |
185
+ | balanced | Opus | Sonnet | Haiku | 1x |
186
+ | budget | Sonnet | Sonnet | Haiku | 0.4x |
187
+
188
+ ## 20 Specialized Agents
189
+
190
+ | Agent | Purpose |
191
+ |-------|---------|
192
+ | ctx-mapper | Repository mapping |
193
+ | ctx-tech-mapper | Technology analysis |
194
+ | ctx-arch-mapper | Architecture analysis |
195
+ | ctx-quality-mapper | Quality analysis |
196
+ | ctx-concerns-mapper | Security/debt analysis |
197
+ | ctx-discusser | Decision capture |
198
+ | ctx-researcher | Web research |
199
+ | ctx-planner | Task planning |
200
+ | ctx-executor | Code execution |
201
+ | ctx-designer | Design/brand work |
202
+ | ctx-debugger | Persistent debugging |
203
+ | ctx-verifier | Three-level verification |
204
+ | ctx-parallelizer | Task parallelization |
205
+ | ctx-reviewer | Pre-commit review |
206
+ | ctx-criteria-suggester | Criteria generation |
207
+ | ctx-handoff | Context transitions |
208
+ | ctx-team-coordinator | Team collaboration |
209
+ | ctx-auditor | Compliance logging |
210
+ | ctx-learner | Pattern learning |
211
+ | ctx-predictor | Feature prediction |
212
+
213
+ ## Key Features
214
+
215
+ ### Learning System
114
216
  ```
115
- S001 → plan → execute → verify ✓ → S002 → plan → execute → verify ✓ → ...
217
+ .ctx/memory/
218
+ ├── patterns.json # Code patterns you prefer
219
+ ├── decisions.json # Past architectural decisions
220
+ ├── failures.json # What didn't work
221
+ └── preferences.json # Communication style
116
222
  ```
117
223
 
118
- ## Debug Loop
119
-
120
- When something breaks, CTX enters debug mode:
224
+ ### Predictive Planning
225
+ - Pattern matching (e-commerce, SaaS, social)
226
+ - ROI scoring for suggestions
227
+ - Auto story generation
121
228
 
122
- ```
123
- Loop (max 5 attempts):
124
- 1. Analyze error
125
- 2. Form hypothesis
126
- 3. Apply fix
127
- 4. Verify (build + tests + browser)
128
- 5. If fixed → done
129
- If not → new hypothesis, try again
130
- ```
229
+ ### Self-Healing
230
+ - Sentry, LogRocket, Bugsnag, Datadog
231
+ - Auto-fix safe patterns
232
+ - PR creation with tests
131
233
 
132
- **Browser verification for UI:**
133
- - Playwright or Chrome DevTools
134
- - Screenshots saved to `.ctx/debug/`
234
+ ### Voice Control
235
+ - Command recognition
236
+ - Story dictation
237
+ - Continuous listening mode
135
238
 
136
239
  ## Three-Level Verification
137
240
 
@@ -141,148 +244,34 @@ Loop (max 5 attempts):
141
244
  | Substantive | Real code, not stub? | No TODOs, no placeholders |
142
245
  | Wired | Imported and used? | Trace imports |
143
246
 
144
- ## Design Workflow
247
+ ## Context Budget
145
248
 
146
- CTX handles visual work with dedicated agents and approval gates.
147
-
148
- ### Story Types
149
- | Type | Agent | Purpose |
150
- |------|-------|---------|
151
- | feature | ctx-executor | Standard implementation |
152
- | brand | ctx-designer | BRAND_KIT.md + tokens |
153
- | design | ctx-designer | UI components/pages |
154
- | fix | ctx-debugger | Bug fixes |
155
- | refactor | ctx-executor | Code improvements |
156
-
157
- ### Design Approval Gates
158
- ```
159
- Mood Board → Direction (A/B/C) → Prototype → Final
160
- ```
161
- Each gate requires user approval before proceeding.
162
-
163
- ### 3 Options Pattern
164
- All design decisions present:
165
- - **Option A**: Conservative (safe, proven)
166
- - **Option B**: Balanced (recommended)
167
- - **Option C**: Bold (distinctive)
168
-
169
- ### WCAG 2.2 AA Compliance
170
- | Criterion | Requirement |
171
- |-----------|-------------|
172
- | 2.4.11 | Focus not obscured |
173
- | 2.5.7 | Drag alternatives |
174
- | 2.5.8 | 24x24px targets |
175
- | 3.3.8 | Accessible auth |
176
-
177
- ### W3C Design Tokens
178
- ```
179
- tokens/
180
- ├── primitive.tokens.json # Raw values
181
- ├── semantic.tokens.json # Purpose aliases
182
- └── component.tokens.json # Component-specific
183
- ```
184
-
185
- ## Key Design Principles
186
-
187
- ### Atomic Planning (2-3 Tasks Max)
188
- Prevents context degradation. Big work = multiple phases.
189
-
190
- ### 95% Auto-Deviation Handling
191
- | Trigger | Action |
192
- |---------|--------|
193
- | Bug in existing code | Auto-fix |
194
- | Missing validation | Auto-add |
195
- | Blocking issue | Auto-fix |
196
- | Architecture decision | Ask user |
197
-
198
- ### Context Budget
199
249
  | Usage | Quality | Action |
200
250
  |-------|---------|--------|
201
251
  | 0-30% | Peak | Continue |
202
- | 30-50% | Good | Continue |
203
- | 50%+ | Degrading | Auto-checkpoint |
204
-
205
- ## 6 Specialized Agents
206
-
207
- | Agent | When spawned |
208
- |-------|--------------|
209
- | ctx-researcher | During planning (ArguSeek + ChunkHound) |
210
- | ctx-planner | After research |
211
- | ctx-executor | During execution (feature stories) |
212
- | ctx-designer | During execution (brand/design stories) |
213
- | ctx-debugger | When debugging |
214
- | ctx-verifier | During verification |
215
-
216
- ## Integrations
217
-
218
- - **ArguSeek**: Web research during planning
219
- - **ChunkHound**: Semantic code search (`uv tool install chunkhound`)
220
- - **Playwright/DevTools**: Browser verification for UI
221
- - **Figma MCP**: Design context extraction and screenshots
222
- - **Gemini Design**: Image generation and UI code generation
252
+ | 30-40% | Good | Continue |
253
+ | 40-50% | Good | Prepare handoff |
254
+ | 50-60% | Degrading | Auto-checkpoint |
255
+ | 60-70% | Degrading | Create HANDOFF.md |
256
+ | 70%+ | Poor | Force checkpoint |
223
257
 
224
258
  ## Directory Structure
225
259
 
226
260
  ```
227
261
  .ctx/
228
- ├── STATE.md # Living digest - execution state
229
- ├── PRD.json # Requirements contract - stories + criteria
230
- ├── .env # Test credentials (GITIGNORED)
231
- ├── .gitignore # Protects secrets
232
- ├── phases/{story_id}/ # Per-story data
233
- ├── RESEARCH.md # ArguSeek + ChunkHound results
234
- ├── PLAN.md # Tasks mapped to acceptance criteria
235
- ├── VERIFY.md # Verification report
236
- ├── MOOD_BOARD.md # Design references (design stories)
237
- │ └── DESIGN_BRIEF.md # Design decisions (design stories)
262
+ ├── config.json # Model profiles, git settings
263
+ ├── STATE.md # Execution state
264
+ ├── PRD.json # Requirements contract
265
+ ├── REPO-MAP.md # Codebase map
266
+ ├── codebase/ # Deep analysis
267
+ ├── phases/ # Per-story data
268
+ ├── memory/ # Learned patterns
269
+ ├── audit/ # Compliance logs
270
+ ├── metrics/ # Productivity data
271
+ ├── debug/ # Debug sessions
238
272
  ├── checkpoints/ # Auto-checkpoints
239
- ├── debug/ # Debug screenshots
240
- └── verify/ # Verification screenshots
241
-
242
- project/
243
- ├── BRAND_KIT.md # Visual foundation (brand stories)
244
- └── tokens/ # W3C design tokens
245
- ├── primitive.tokens.json
246
- ├── semantic.tokens.json
247
- └── component.tokens.json
248
- ```
249
-
250
- ## PRD.json Structure
251
-
252
- ```json
253
- {
254
- "brand": {
255
- "hasBrandKit": false,
256
- "personality": ["professional", "modern"],
257
- "euMarket": true
258
- },
259
- "design": {
260
- "wcagLevel": "AA",
261
- "eaaCompliance": true,
262
- "tokenFormat": "w3c"
263
- },
264
- "stories": [
265
- {
266
- "id": "S001",
267
- "type": "brand",
268
- "title": "Establish brand kit",
269
- "acceptanceCriteria": ["BRAND_KIT.md exists", "tokens/ populated"],
270
- "passes": false
271
- },
272
- {
273
- "id": "S002",
274
- "type": "design",
275
- "title": "Login page",
276
- "acceptanceCriteria": ["WCAG 2.2 AA compliant", "All states implemented"],
277
- "passes": false
278
- }
279
- ],
280
- "metadata": {
281
- "currentStory": "S001",
282
- "passedStories": 0,
283
- "totalStories": 5
284
- }
285
- }
273
+ ├── milestones/ # Milestone archives
274
+ └── locks/ # Team file locks
286
275
  ```
287
276
 
288
277
  ## Updating CTX
@@ -292,5 +281,5 @@ npx ctx-cc --force
292
281
  ```
293
282
 
294
283
  ---
295
- *CTX 2.3 - PRD-driven, design-first, story-verified, debug loop until 100% fixed*
284
+ *CTX 3.3 - Learning. Prediction. Self-healing. Voice control.*
296
285
  </reference>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-cc",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
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",
package/src/install.js CHANGED
@@ -28,9 +28,9 @@ function printBanner() {
28
28
  ╚██████╗ ██║ ██╔╝ ██╗
29
29
  ╚═════╝ ╚═╝ ╚═╝ ╚═╝
30
30
  `));
31
- console.log(` ${bold('CTX 2.2')} ${dim(`v${VERSION}`)}`);
32
- console.log(' PRD-driven workflow orchestration for Claude Code.');
33
- console.log(' 8 commands. Story-verified. Debug loop.\n');
31
+ console.log(` ${bold('CTX 3.3')} ${dim(`v${VERSION}`)}`);
32
+ console.log(' Intelligent workflow orchestration for Claude Code.');
33
+ console.log(' 20 agents. Learning system. Predictive planning. Self-healing.\n');
34
34
  }
35
35
 
36
36
  function copyDir(src, dest) {