ctx-cc 3.5.0 → 4.1.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 (74) hide show
  1. package/README.md +375 -676
  2. package/agents/ctx-arch-mapper.md +5 -3
  3. package/agents/ctx-auditor.md +5 -3
  4. package/agents/ctx-codex-reviewer.md +214 -0
  5. package/agents/ctx-concerns-mapper.md +5 -3
  6. package/agents/ctx-criteria-suggester.md +6 -4
  7. package/agents/ctx-debugger.md +5 -3
  8. package/agents/ctx-designer.md +488 -114
  9. package/agents/ctx-discusser.md +5 -3
  10. package/agents/ctx-executor.md +5 -3
  11. package/agents/ctx-handoff.md +6 -4
  12. package/agents/ctx-learner.md +5 -3
  13. package/agents/ctx-mapper.md +4 -3
  14. package/agents/ctx-ml-analyst.md +600 -0
  15. package/agents/ctx-ml-engineer.md +933 -0
  16. package/agents/ctx-ml-reviewer.md +485 -0
  17. package/agents/ctx-ml-scientist.md +626 -0
  18. package/agents/ctx-parallelizer.md +4 -3
  19. package/agents/ctx-planner.md +5 -3
  20. package/agents/ctx-predictor.md +4 -3
  21. package/agents/ctx-qa.md +5 -3
  22. package/agents/ctx-quality-mapper.md +5 -3
  23. package/agents/ctx-researcher.md +5 -3
  24. package/agents/ctx-reviewer.md +6 -4
  25. package/agents/ctx-team-coordinator.md +5 -3
  26. package/agents/ctx-tech-mapper.md +5 -3
  27. package/agents/ctx-verifier.md +5 -3
  28. package/bin/ctx.js +199 -27
  29. package/commands/brand.md +309 -0
  30. package/commands/ctx.md +10 -10
  31. package/commands/design.md +304 -0
  32. package/commands/experiment.md +251 -0
  33. package/commands/help.md +57 -7
  34. package/commands/init.md +25 -0
  35. package/commands/metrics.md +1 -1
  36. package/commands/milestone.md +1 -1
  37. package/commands/ml-status.md +197 -0
  38. package/commands/monitor.md +1 -1
  39. package/commands/train.md +266 -0
  40. package/commands/visual-qa.md +559 -0
  41. package/commands/voice.md +1 -1
  42. package/hooks/post-tool-use.js +39 -0
  43. package/hooks/pre-tool-use.js +94 -0
  44. package/hooks/subagent-stop.js +32 -0
  45. package/package.json +9 -3
  46. package/plugin.json +46 -0
  47. package/skills/ctx-design-system/SKILL.md +572 -0
  48. package/skills/ctx-ml-experiment/SKILL.md +334 -0
  49. package/skills/ctx-ml-pipeline/SKILL.md +437 -0
  50. package/skills/ctx-orchestrator/SKILL.md +91 -0
  51. package/skills/ctx-review-gate/SKILL.md +147 -0
  52. package/skills/ctx-state/SKILL.md +100 -0
  53. package/skills/ctx-visual-qa/SKILL.md +587 -0
  54. package/src/agents.js +109 -0
  55. package/src/auto.js +287 -0
  56. package/src/capabilities.js +226 -0
  57. package/src/commits.js +94 -0
  58. package/src/config.js +112 -0
  59. package/src/context.js +241 -0
  60. package/src/handoff.js +156 -0
  61. package/src/hooks.js +218 -0
  62. package/src/install.js +125 -50
  63. package/src/lifecycle.js +194 -0
  64. package/src/metrics.js +198 -0
  65. package/src/pipeline.js +269 -0
  66. package/src/review-gate.js +338 -0
  67. package/src/runner.js +120 -0
  68. package/src/skills.js +143 -0
  69. package/src/state.js +267 -0
  70. package/src/worktree.js +244 -0
  71. package/templates/PRD.json +1 -1
  72. package/templates/config.json +4 -237
  73. package/workflows/ctx-router.md +0 -485
  74. package/workflows/map-codebase.md +0 -329
package/README.md CHANGED
@@ -1,843 +1,542 @@
1
1
  <div align="center">
2
2
 
3
- # CTX
4
-
5
- ### Continuous Task eXecution
3
+ ```
4
+ ██████╗████████╗██╗ ██╗
5
+ ██╔════╝╚══██╔══╝╚██╗██╔╝
6
+ ██║ ██║ ╚███╔╝
7
+ ██║ ██║ ██╔██╗
8
+ ╚██████╗ ██║ ██╔╝ ██╗
9
+ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
10
+ ```
6
11
 
7
- **Intelligent workflow orchestration for Claude Code.**
12
+ **Intelligent workflow orchestration for Claude Code**
8
13
 
9
14
  [![npm version](https://img.shields.io/npm/v/ctx-cc.svg?style=flat-square)](https://www.npmjs.com/package/ctx-cc)
10
- [![npm downloads](https://img.shields.io/npm/dm/ctx-cc.svg?style=flat-square)](https://www.npmjs.com/package/ctx-cc)
11
15
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
12
- [![GitHub stars](https://img.shields.io/github/stars/jufjuf/CTX?style=flat-square)](https://github.com/jufjuf/CTX/stargazers)
13
-
14
- <img src="./assets/terminal.png" alt="CTX Terminal" width="700">
15
-
16
- **Conversational-first. Just describe what you want — no commands to memorize.**
17
-
18
- AI that learns your preferences. Predictive planning. Self-healing deployments. 21 specialized agents.
19
-
20
- [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)
21
-
22
- </div>
23
-
24
- ---
25
-
26
- ## Installation
16
+ [![Tests](https://img.shields.io/badge/tests-264%20passing-brightgreen.svg?style=flat-square)](#testing)
17
+ [![Zero deps](https://img.shields.io/badge/dependencies-0-brightgreen.svg?style=flat-square)](#)
27
18
 
28
19
  ```bash
29
20
  npx ctx-cc
30
21
  ```
31
22
 
32
- That's it. CTX installs itself to your Claude Code environment.
33
-
34
- ```bash
35
- # Options
36
- npx ctx-cc --global # Install to ~/.claude (default)
37
- npx ctx-cc --project # Install to .claude in current directory
38
- npx ctx-cc --force # Overwrite existing installation
39
- ```
40
-
41
- ---
42
-
43
- ## Quick Start
44
-
45
- **Just talk to CTX.** No commands to memorize:
46
-
47
- ```
48
- "I want to build a todo app" → CTX sets up your project
49
- "Fix the login bug" → CTX starts debugging
50
- "Is my app accessible?" → CTX runs accessibility QA
51
- "What should I do next?" → CTX shows status + recommendation
52
- ```
53
-
54
- Or use commands directly:
55
- ```
56
- 1. /ctx init Gather requirements + credentials + design context
57
- 2. /ctx map Build repository map (existing codebases)
58
- 3. /ctx Autonomous execution with minimal interruption
59
- ```
60
-
61
- **The Flow:**
62
- ```
63
- Tell CTX what you want → CTX figures out the rest → Delivered!
64
- ```
23
+ </div>
65
24
 
66
25
  ---
67
26
 
68
- ## New in 3.3
69
-
70
- ### Conversational-First Routing
71
- **No commands to memorize.** CTX understands natural language from your first prompt:
72
-
73
- | You Say | CTX Does |
74
- |---------|----------|
75
- | "I want to build a todo app" | Sets up project, researches best practices, creates plan |
76
- | "Fix the login bug" | Analyzes codebase, starts debugging |
77
- | "Is my app accessible?" | Runs WCAG 2.1 AA accessibility audit |
78
- | "Test everything" | Crawls every page, clicks every button |
79
- | "What's next?" | Shows status and recommended action |
80
- | "Ship it" | Runs verification, then deploys |
81
-
82
- **New user?** CTX welcomes you and guides setup:
83
- ```
84
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85
- Welcome to CTX!
86
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
87
-
88
- I understood: "build a todo app with React"
89
-
90
- You want to build something new. Let's set it up!
91
-
92
- I'll now:
93
- 1. Create your project structure
94
- 2. Research best practices for React todo apps
95
- 3. Create a plan with clear milestones
96
- ```
97
-
98
- Commands still work as shortcuts for power users.
99
-
100
- ### Full System QA
101
- Crawl every page, click every button, find all issues:
27
+ ## What is CTX?
102
28
 
103
- ```bash
104
- /ctx qa # Full system QA (WCAG 2.1 AA)
105
- /ctx qa --a11y-only # Accessibility audit only
106
- /ctx qa --visual-only # Visual regression (3 viewports)
107
- /ctx qa --resume # Resume interrupted session
108
- ```
29
+ CTX transforms Claude Code from a single AI assistant into a full development agency. One installer wires 25 specialized agents, 7 auto-discovered skills, and 3 deterministic enforcement hooks directly into Claude Code's native extension points — no runtime daemon, no wrapper, no proxy.
109
30
 
110
- Features:
111
- - **WCAG 2.1 AA compliance** - Touch targets, alt text, labels, contrast, keyboard
112
- - **Multi-viewport testing** - Mobile (375px), Tablet (768px), Desktop (1280px)
113
- - **Performance monitoring** - Slow requests, large assets
114
- - **Trace capture** - Screenshots and logs for every failed interaction
115
- - **Fix tasks** - Issues organized by section, ready for execution
116
-
117
- ### Learning System
118
- CTX learns from your codebase and preferences:
119
-
120
- ```
121
- [LEARNER] Applying 3 learned preferences
31
+ **Three verticals out of the box:**
122
32
 
123
- 1. Using Zod for validation
124
- → Based on pattern P001 (95% confidence, 12 observations)
33
+ | Vertical | Coverage |
34
+ |----------|----------|
35
+ | Software Development | Phase-based lifecycle, autonomous execution, persistent debug, review gates |
36
+ | Agency-Grade Design | Figma MCP-first workflow, W3C DTCG tokens, pixel-perfect QA, WCAG 2.2 AA |
37
+ | Machine Learning | Experiment tracking, model registry, conformal prediction, drift detection |
125
38
 
126
- 2. Functional components only
127
- → Based on decision D005 (explicit preference)
128
-
129
- 3. Avoiding moment.js, using date-fns
130
- → Based on failure F001 (bundle size)
131
- ```
132
-
133
- Memory stored in `.ctx/memory/`:
134
- - `patterns.json` - Code patterns you prefer
135
- - `decisions.json` - Past architectural decisions
136
- - `failures.json` - What didn't work
137
- - `preferences.json` - Communication style
138
- - `conventions.json` - Naming and structure
139
-
140
- Commands:
141
- ```bash
142
- /ctx learn # Show what CTX has learned
143
- /ctx learn patterns # Show code patterns
144
- /ctx learn decisions # Show architectural decisions
145
- /ctx learn forget [id] # Remove a learned pattern
146
- ```
39
+ **Key value propositions:**
147
40
 
148
- ### Predictive Planning
149
- AI suggests what to build next based on patterns:
150
-
151
- ```
152
- [PREDICT] Feature Suggestions for MyApp
153
-
154
- Based on your e-commerce app at MVP stage:
155
-
156
- 1. Cart Abandonment Recovery
157
- ├─ ROI: 9/10
158
- ├─ Effort: Medium (2-3 days)
159
- └─ Impact: +15-25% recovered revenue
160
-
161
- 2. Product Reviews & Ratings
162
- ├─ ROI: 9/10
163
- ├─ Effort: Low (1-2 days)
164
- └─ Impact: +18% conversion rate
165
-
166
- 3. Discount Codes System
167
- ├─ ROI: 7/10
168
- └─ Effort: Low (1 day)
169
-
170
- [1] Create story [A] Create all [R] Research more
171
- ```
172
-
173
- Commands:
174
- ```bash
175
- /ctx predict # Full prediction analysis
176
- /ctx predict --quick # Quick wins only (< 1 day)
177
- /ctx predict --create [id] # Create story from suggestion
178
- ```
179
-
180
- ### Self-Healing Deployments
181
- Monitor production errors and auto-fix:
182
-
183
- ```bash
184
- /ctx monitor connect sentry # Connect Sentry
185
- /ctx monitor errors # List recent errors
186
- /ctx monitor auto-fix [id] # Auto-fix with PR
187
- /ctx monitor --watch # Continuous monitoring
188
- ```
189
-
190
- Auto-fix workflow:
191
- ```
192
- 1. Sentry reports: "TypeError in checkout.ts:45"
193
- 2. CTX analyzes error pattern
194
- 3. If safe pattern (null check, import, etc.):
195
- → Auto-generates fix
196
- → Runs tests
197
- → Creates PR
198
- → Notifies team
199
- 4. If complex pattern:
200
- → Creates fix story
201
- → Assigns priority
202
- → Provides context
203
- ```
204
-
205
- Supports: Sentry, LogRocket, Bugsnag, Datadog
206
-
207
- ### Voice Control
208
- Speak your requirements instead of typing:
209
-
210
- ```bash
211
- /ctx voice # Start voice input
212
- /ctx voice --continuous # Always listening
213
- /ctx voice --dictate # Long-form input
214
- ```
215
-
216
- ```
217
- [VOICE] 🎤 Listening...
218
-
219
- User: "Create a story for user authentication
220
- with email login and forgot password"
221
-
222
- [VOICE] Story created:
223
-
224
- Title: User Authentication
225
- Criteria:
226
- ✓ User can login with email/password
227
- ✓ Forgot password sends reset email
228
- ✓ Session persists across browser
229
-
230
- Add to PRD? [Y/n/edit]
231
- ```
232
-
233
- Supports: macOS Speech, Whisper (local), Google Speech, Azure
41
+ - **Phase-based lifecycle** — `init → plan → execute → verify → complete` with state tracked in `.ctx/STATE.json`
42
+ - **Autonomous execution with review gates** three-stage review: spec compliance, code quality, and optional cross-model adversarial review via OpenAI Codex
43
+ - **Figma MCP-first design workflow** — tokens sync from Figma, visual QA measures pixels numerically
44
+ - **ML experiment-driven development** — hypothesis tracking, XGBoost+MAPIE patterns, KS drift, Digital Twin workflows
45
+ - **Zero dependencies** installs into Claude Code's native extension points; nothing runs outside Claude
234
46
 
235
47
  ---
236
48
 
237
- ## From 3.2
238
-
239
- ### Milestone Workflow
240
- Full release management with audit, archive, and git tagging:
241
- ```bash
242
- /ctx milestone # Show current milestone status
243
- /ctx milestone list # List all milestones
244
- /ctx milestone audit # Verify milestone complete
245
- /ctx milestone complete # Archive and create git tag
246
- /ctx milestone new v2.0 # Start next version
247
- /ctx milestone gaps # Generate fix phases for failures
248
- ```
249
-
250
- Features:
251
- - Archive phases to `.ctx/archive/v{version}/`
252
- - Auto-create git tags on complete
253
- - Gap analysis for incomplete milestones
254
- - Integration with Linear/Jira/GitHub
255
-
256
- ### Team Collaboration
257
- Multiple developers working with CTX on same repo:
258
- ```
259
- [TEAM] Current Activity
260
-
261
- Active:
262
- alice: T001 - User authentication (10m)
263
- bob: T003 - API endpoints (waiting for T001)
264
-
265
- Available:
266
- charlie: idle
267
- ```
268
-
269
- Features:
270
- - **File locking** - Prevent conflicts during execution
271
- - **Lock expiry** - Auto-release after 1 hour
272
- - **Conflict detection** - Fail fast on overlaps
273
- - **Team notifications** - Slack/Discord on phase complete
274
- - **Branch strategy** - Auto-create feature branches
49
+ ## Quick Start
275
50
 
276
- ### Audit Trail (SOC2/HIPAA Compliance)
277
- Complete traceability for enterprise:
278
51
  ```bash
279
- /ctx audit # Show today's summary
280
- /ctx audit week # Weekly summary
281
- /ctx audit export # Generate compliance report
282
- ```
283
-
284
- Every action logged:
285
- ```json
286
- {
287
- "timestamp": "2024-01-20T09:30:00Z",
288
- "action": "execute",
289
- "story": "S001",
290
- "agent": "ctx-executor",
291
- "model": "claude-sonnet-4",
292
- "tokens": {"input": 5000, "output": 2000},
293
- "filesModified": ["src/auth/login.ts"],
294
- "decisions": ["Use JWT for auth"],
295
- "commit": "abc1234"
296
- }
52
+ npx ctx-cc # Install globally (~/.claude)
53
+ npx ctx-cc --project # Install for current project only (.claude/)
54
+ npx ctx-cc --force # Overwrite existing installation
297
55
  ```
298
56
 
299
- Compliance features:
300
- - Access logging (who read what)
301
- - Decision tracking (with rationale)
302
- - Change log (all modifications)
303
- - Retention policies (90d daily, 1y weekly)
304
- - SOC2, HIPAA, GDPR modes
305
-
306
- ### Metrics Dashboard
307
- Understand AI productivity impact:
308
- ```bash
309
- /ctx metrics # Overview dashboard
310
- /ctx metrics cost # Cost analysis
311
- /ctx metrics export # Export HTML dashboard
312
- ```
57
+ Then inside Claude Code:
313
58
 
314
59
  ```
315
- ╔══════════════════════════════════════════════════════════╗
316
- ║ CTX METRICS - Week 3 ║
317
- ╠══════════════════════════════════════════════════════════╣
318
- ║ Stories/Week: 8 (+2) Total Cost: $4.87 ║
319
- ║ Time/Story: 1h 45m Per Story: $0.61 ║
320
- ║ Debug Loops: 12 Success Rate: 92% ║
321
- ║ ║
322
- ║ ROI: 30x (24 hours saved, $145 net savings) ║
323
- ╚══════════════════════════════════════════════════════════╝
60
+ /ctx Smart router — reads state, does the right thing
61
+ /ctx:help Full command reference
62
+ /ctx:init Initialize project (PRD + STATE + config)
324
63
  ```
325
64
 
326
- Metrics tracked:
327
- - Stories completed per day/week
328
- - Average time per story
329
- - Token usage by phase/model
330
- - Cost analysis with ROI
331
- - Debug loop frequency
332
- - Verification success rate
333
- - Human intervention rate
334
-
335
65
  ---
336
66
 
337
- ## From 3.1
67
+ ## Architecture
338
68
 
339
- ### Intelligent Task Parallelization
340
- Tasks without dependencies run simultaneously:
341
- ```
342
- Wave 1: [T001, T003] → Parallel (no deps)
343
- Wave 2: [T002] → After T001
344
- Wave 3: [T004] → After T002
69
+ CTX uses a **thin installer / fat Claude Code** architecture. The CLI's only job is to copy files into the right directories. All orchestration happens inside Claude Code via the Agent tool.
345
70
 
346
- Result: 40% faster execution
347
71
  ```
348
-
349
- ### Pre-Commit Review (ctx-reviewer)
350
- Catches errors BEFORE they're committed:
351
- - Type errors (TypeScript, Python, Go)
352
- - Unresolved imports
353
- - Circular dependencies
354
- - Security vulnerabilities
355
- - Empty catch blocks, console.logs
356
-
72
+ ~/.claude/
73
+ ├── agents/ 25 subagents (invoked via Agent tool)
74
+ ├── skills/ 7 skills (auto-discovered by Claude from descriptions)
75
+ ├── commands/ 26 slash commands (/ctx:*)
76
+ ├── hooks/ 3 hook scripts (deterministic enforcement)
77
+ └── settings.json hooks registered
357
78
  ```
358
- [CTX] Pre-Commit Review
359
- ✅ Types: Pass
360
- ✅ Imports: Pass
361
- ⚠️ Medium: 2 console.log statements
362
- ❌ Critical: SQL injection risk at line 45
363
79
 
364
- Status: BLOCKED - Fix critical issue
365
- ```
80
+ **Key decisions:**
366
81
 
367
- ### Acceptance Criteria Auto-Generation
368
- AI suggests comprehensive criteria:
369
- ```
370
- Story: "Add user authentication"
82
+ - The CLI is installer-only. It does not run, proxy, or wrap Claude Code.
83
+ - Agents are Markdown files with native frontmatter (`model`, `maxTurns`, `description`). Claude reads these directly.
84
+ - Skills are auto-invoked by Claude Code when task descriptions match the skill's `WHEN:` triggers — no commands needed.
85
+ - Hooks are separate `.js` scripts registered in `settings.json`. They run deterministically on every tool call.
86
+ - `plugin.json` enables marketplace distribution.
371
87
 
372
- Suggested Criteria:
373
- ✓ User can register with email/password
374
- ✓ Invalid credentials show error
375
- ✓ Passwords hashed with bcrypt
376
- ✓ Session expires after 24h
377
- ✓ Brute force protection enabled
88
+ ---
378
89
 
379
- [A] Accept all [B] See more [C] Edit
380
- ```
90
+ ## Agents (25)
381
91
 
382
- ### Smart Context Handoff
383
- Seamless transitions at context limits:
92
+ ### Software Development (21)
384
93
 
385
- | Threshold | Action |
386
- |-----------|--------|
387
- | 40% | Prepare handoff notes |
388
- | 50% | Write HANDOFF.md, warn |
389
- | 60% | Spawn fresh agent |
94
+ #### Planning
390
95
 
391
- Zero information loss. Work continues automatically.
96
+ | Agent | Model | maxTurns | Purpose |
97
+ |-------|-------|----------|---------|
98
+ | ctx-planner | opus | 25 | Atomic plans (2–3 tasks), maps tasks to acceptance criteria |
99
+ | ctx-researcher | opus | 25 | ArguSeek web research + semantic code search before planning |
100
+ | ctx-criteria-suggester | sonnet | 25 | Auto-generates acceptance criteria before implementation |
101
+ | ctx-parallelizer | haiku | 15 | Identifies tasks that can run concurrently, saves total time |
102
+ | ctx-predictor | haiku | 15 | Analyzes patterns and suggests next features |
392
103
 
393
- ### Issue Tracker Integration
394
- Sync with Linear, Jira, or GitHub Issues:
395
- ```bash
396
- /ctx integrate linear # Setup Linear
397
- /ctx integrate jira # Setup Jira
398
- /ctx integrate github # Setup GitHub Issues
399
- /ctx integrate --sync # Force sync all stories
400
- ```
104
+ #### Execution
401
105
 
402
- Features:
403
- - Bidirectional story sync
404
- - Status mapping (CTX tracker)
405
- - Auto-close on verify pass
406
- - Comment on verify fail
106
+ | Agent | Model | maxTurns | Purpose |
107
+ |-------|-------|----------|---------|
108
+ | ctx-executor | sonnet | 50 | Implements tasks with git-native commits per completed task |
109
+ | ctx-debugger | sonnet | 75 | Persistent debug loop: observe → hypothesize → test → verify |
407
110
 
408
- ---
409
-
410
- ## From 3.0
111
+ #### Review
411
112
 
412
- ### Repository Mapping (like Aider)
413
- ```bash
414
- /ctx map # Build token-optimized codebase map
415
- /ctx map --expand # Include call graph (8k tokens)
416
- /ctx map --refresh # Force full rebuild
417
- ```
113
+ | Agent | Model | maxTurns | Purpose |
114
+ |-------|-------|----------|---------|
115
+ | ctx-reviewer | sonnet | 25 | Pre-commit review: type errors, imports, security, empty catches |
116
+ | ctx-auditor | haiku | 15 | Background audit trail and compliance traceability |
117
+ | ctx-verifier | haiku | 15 | Three-level verification: exists, substantive, wired |
418
118
 
419
- Creates `REPO-MAP.md` with symbols, dependencies, and navigation hints.
119
+ #### Mapping
420
120
 
421
- ### Discussion Phase (like GSD)
422
- ```bash
423
- /ctx discuss S001 # Capture decisions BEFORE planning
424
- /ctx discuss --review # Review locked decisions
425
- ```
121
+ | Agent | Model | maxTurns | Purpose |
122
+ |-------|-------|----------|---------|
123
+ | ctx-mapper | haiku | 15 | Token-optimized repository map (REPO-MAP.md) |
124
+ | ctx-arch-mapper | haiku | 15 | Architecture patterns, data flow, module structure |
125
+ | ctx-tech-mapper | haiku | 15 | Languages, frameworks, dependencies |
126
+ | ctx-quality-mapper | haiku | 15 | Test coverage, lint status, type safety |
127
+ | ctx-concerns-mapper | haiku | 15 | Security vulnerabilities, tech debt, performance risks |
426
128
 
427
- Prevents mid-implementation questions by locking decisions in `CONTEXT.md`.
129
+ #### Knowledge & Coordination
428
130
 
429
- ### Model Profiles (Cost Optimization)
430
- ```bash
431
- /ctx profile # Show current profile
432
- /ctx profile quality # Best models (Opus everywhere)
433
- /ctx profile balanced # Smart mix (default)
434
- /ctx profile budget # Fast models (60% savings)
435
- ```
131
+ | Agent | Model | maxTurns | Purpose |
132
+ |-------|-------|----------|---------|
133
+ | ctx-discusser | sonnet | 25 | Captures implementation decisions before planning begins |
134
+ | ctx-learner | haiku | 15 | Observes patterns and decisions, builds project memory |
135
+ | ctx-handoff | haiku | 15 | Creates HANDOFF.md at context thresholds, zero info loss |
136
+ | ctx-team-coordinator | haiku | 15 | File locks, parallel work coordination, prevents conflicts |
436
137
 
437
- | Profile | Research | Execute | Verify | Cost |
438
- |---------|----------|---------|--------|------|
439
- | quality | Opus | Opus | Sonnet | 3x |
440
- | balanced | Opus | Sonnet | Haiku | 1x |
441
- | budget | Sonnet | Sonnet | Haiku | 0.4x |
138
+ #### Design & QA
442
139
 
443
- ### Git-Native Workflow
444
- Every completed task auto-commits:
445
- ```
446
- [CTX] Implement user login endpoint
140
+ | Agent | Model | maxTurns | Purpose |
141
+ |-------|-------|----------|---------|
142
+ | ctx-designer | sonnet | 50 | Brand establishment, component design, Figma MCP integration |
143
+ | ctx-qa | sonnet | 50 | Full system QA: crawls every page, clicks every button |
447
144
 
448
- Story: S001 - User Authentication
449
- Criteria: User can log in with credentials
450
- Files: src/auth/login.ts, src/routes/auth.ts
145
+ ### Machine Learning (4)
451
146
 
452
- Co-Authored-By: Claude <noreply@anthropic.com>
453
- ```
147
+ | Agent | Model | maxTurns | Purpose |
148
+ |-------|-------|----------|---------|
149
+ | ctx-ml-scientist | opus | 75 | Designs experiments, selects models, autonomous hypothesis loop |
150
+ | ctx-ml-engineer | sonnet | 50 | MLOps pipelines, inference envelope, model registry |
151
+ | ctx-ml-analyst | sonnet | 50 | EDA, dataset quality scoring, feature analysis |
152
+ | ctx-ml-reviewer | sonnet | 25 | ML code review: correctness, leakage, statistical validity |
454
153
 
455
- Configure in `.ctx/config.json`:
456
- ```json
457
- {
458
- "git": {
459
- "autoCommit": true,
460
- "commitPerTask": true
461
- }
462
- }
463
- ```
154
+ ---
464
155
 
465
- ### Persistent Debug Mode
466
- Scientific debugging with persistent state across sessions:
156
+ ## Skills (7)
467
157
 
468
- ```bash
469
- /ctx debug "login fails" # Start debugging
470
- /ctx debug --resume # Resume after context reset
471
- /ctx debug --list # See all sessions
472
- ```
158
+ Skills are auto-discovered. Claude Code reads each skill's `WHEN:` description and invokes it automatically when the task matches — no slash command needed.
473
159
 
474
- **How it works:**
475
- ```
476
- 1. OBSERVE → Capture exact error, context, state
477
- 2. RESEARCH → Search codebase and web for similar issues
478
- 3. HYPOTHESIZE → Form testable theory with confidence level
479
- 4. TEST → Apply minimal fix
480
- 5. VERIFY → Build + Tests + Lint + Browser
481
- 6. ITERATE → Refine hypothesis, max 10 attempts
482
- ```
160
+ ### Core
483
161
 
484
- **Key features:**
485
- - Sessions survive context resets and days between attempts
486
- - Browser verification with stored credentials
487
- - Screenshots saved for each attempt
488
- - Escalation report if max attempts reached
162
+ | Skill | Auto-invoked when... | Purpose |
163
+ |-------|----------------------|---------|
164
+ | ctx-orchestrator | User asks for pipeline, "ctx next", "ctx auto", or autonomous story execution | Runs the full `init → plan → execute → verify → complete` lifecycle via the Agent tool |
165
+ | ctx-state | Any CTX operation needs to read/write `.ctx/STATE.json` or track phase transitions | Manages persistent state, phase transitions, agent history, and task completion log |
166
+ | ctx-review-gate | Code implemented, story ready to close | Three-stage review: spec compliance → code quality → optional Codex cross-model adversarial review; blocks on failures, soft-skips on Codex infrastructure issues |
489
167
 
490
- State stored in `.ctx/debug/sessions/`:
491
- - `STATE.json` - Machine-readable progress
492
- - `TRACE.md` - Human-readable log
493
- - `hypotheses.json` - All theories tested
494
- - `screenshots/` - Visual evidence
168
+ ### Design
495
169
 
496
- ### Parallel Codebase Analysis
497
- ```bash
498
- /ctx map-codebase # Full analysis with 4 parallel agents
499
- ```
170
+ | Skill | Auto-invoked when... | Purpose |
171
+ |-------|----------------------|---------|
172
+ | ctx-design-system | Design system creation, token management, brand kit updates, token export | Manages W3C DTCG 2025.10 tokens as single source of truth; exports to CSS/SCSS/JS/Tailwind |
173
+ | ctx-visual-qa | Visual QA, design parity, pixel-perfect verification, responsive testing, WCAG 2.2 audit | Numerical measurement-driven QA — every delta is a number, every fix is a specific CSS property |
500
174
 
501
- Spawns 4 agents simultaneously:
502
- | Agent | Output | Analyzes |
503
- |-------|--------|----------|
504
- | TECH | TECH.md | Languages, frameworks, dependencies |
505
- | ARCH | ARCH.md | Patterns, data flow, modules |
506
- | QUALITY | QUALITY.md | Test coverage, lint, type safety |
507
- | CONCERNS | CONCERNS.md | Security, tech debt, performance |
175
+ ### Machine Learning
508
176
 
509
- Results synthesized into `SUMMARY.md`.
177
+ | Skill | Auto-invoked when... | Purpose |
178
+ |-------|----------------------|---------|
179
+ | ctx-ml-experiment | User wants to run ML experiments, track hypotheses, compare models | Hypothesis tracking, model registry, experiment lifecycle |
180
+ | ctx-ml-pipeline | Production ML deployment, inference, drift monitoring | Inference envelope, circuit breaker, KS drift detection, retraining triggers |
510
181
 
511
182
  ---
512
183
 
513
- ## Why CTX?
514
-
515
- | Feature | Aider | GSD | CTX 3.0 |
516
- |---------|-------|-----|---------|
517
- | Repository Map | Yes | No | **Yes** |
518
- | Discussion Phase | No | Yes | **Yes** |
519
- | Model Profiles | Yes | Partial | **Yes** |
520
- | Git-Native Commits | Yes | No | **Yes** |
521
- | Persistent Debug | No | Partial | **Yes** |
522
- | Parallel Analysis | No | Yes | **Yes** |
523
- | PRD-Driven | No | Yes | **Yes** |
524
- | Design System | No | No | **Yes** |
525
- | Browser Verification | No | No | **Yes** |
184
+ ## Commands (26)
526
185
 
527
- **CTX 3.0 combines the best of Aider and GSD.**
186
+ ### Smart
528
187
 
529
- ---
530
-
531
- ## Commands
532
-
533
- ### Smart (Auto-routing)
534
188
  | Command | Purpose |
535
189
  |---------|---------|
536
- | `/ctx` | **Smart router** - reads STATE.md, does the right thing |
537
- | `/ctx init` | Initialize project with STATE.md + PRD.json |
190
+ | `/ctx` | Smart router reads STATE.json, does the right thing |
538
191
 
539
192
  ### Mapping
193
+
540
194
  | Command | Purpose |
541
195
  |---------|---------|
542
- | `/ctx map` | Build repository map (REPO-MAP.md) |
543
- | `/ctx map-codebase` | Deep analysis (4 parallel agents) |
196
+ | `/ctx:map` | Build token-optimized repository map (REPO-MAP.md) |
197
+ | `/ctx:map-codebase` | Deep parallel analysis: TECH + ARCH + QUALITY + CONCERNS → SUMMARY |
544
198
 
545
199
  ### Discussion
200
+
546
201
  | Command | Purpose |
547
202
  |---------|---------|
548
- | `/ctx discuss [story]` | Capture decisions before planning |
203
+ | `/ctx:discuss [story]` | Capture implementation decisions before planning; locks them in CONTEXT.md |
549
204
 
550
205
  ### Configuration
206
+
551
207
  | Command | Purpose |
552
208
  |---------|---------|
553
- | `/ctx profile [name]` | Switch model profile (quality/balanced/budget) |
209
+ | `/ctx:profile [name]` | Switch model profile: `quality`, `balanced` (default), `budget` |
210
+
211
+ ### Inspect
554
212
 
555
- ### Inspect (Read-only)
556
213
  | Command | Purpose |
557
214
  |---------|---------|
558
- | `/ctx status` | See current state without triggering action |
215
+ | `/ctx:status` | Show current state without triggering any action |
216
+
217
+ ### Control
559
218
 
560
- ### Control (Override)
561
219
  | Command | Purpose |
562
220
  |---------|---------|
563
- | `/ctx plan [goal]` | Force research + planning |
564
- | `/ctx verify` | Force three-level verification |
565
- | `/ctx quick "task"` | Quick task bypass |
221
+ | `/ctx:init` | Initialize project: PRD.json + STATE.json + config |
222
+ | `/ctx:plan [goal]` | Force research + planning phase |
223
+ | `/ctx:verify` | Force three-level verification |
224
+ | `/ctx:quick "task"` | Quick task bypass (skips full lifecycle) |
566
225
 
567
226
  ### Debug
227
+
568
228
  | Command | Purpose |
569
229
  |---------|---------|
570
- | `/ctx debug` | Start debugging current issue |
571
- | `/ctx debug "issue"` | Debug specific problem |
572
- | `/ctx debug --resume` | Resume last debug session |
573
- | `/ctx debug --list` | List all debug sessions |
574
- | `/ctx debug --status` | Show current session status |
230
+ | `/ctx:debug` | Start debugging current issue |
231
+ | `/ctx:debug "issue"` | Debug specific problem |
232
+ | `/ctx:debug --resume` | Resume last debug session |
233
+ | `/ctx:debug --list` | List all debug sessions |
234
+ | `/ctx:debug --status` | Show current session status |
235
+
236
+ ### Design
575
237
 
576
- ### QA (Full System Testing)
577
238
  | Command | Purpose |
578
239
  |---------|---------|
579
- | `/ctx qa` | Full system QA - WCAG 2.1 AA, every page, every button |
580
- | `/ctx qa --section "auth"` | QA specific section only |
581
- | `/ctx qa --a11y-only` | Accessibility audit only |
582
- | `/ctx qa --visual-only` | Visual regression (mobile/tablet/desktop) |
583
- | `/ctx qa --resume` | Resume interrupted QA session |
584
- | `/ctx qa --report` | Show last QA report |
240
+ | `/ctx:brand` | Brand establishment: mood board 3 options BRAND_KIT.md |
241
+ | `/ctx:design` | Component design: research 3 options prototype → implement |
242
+
243
+ ### QA
244
+
245
+ | Command | Purpose |
246
+ |---------|---------|
247
+ | `/ctx:qa` | Full system QA — WCAG 2.1 AA, every page, every interaction |
248
+ | `/ctx:qa --a11y-only` | Accessibility audit only |
249
+ | `/ctx:qa --visual-only` | Visual regression across mobile/tablet/desktop |
250
+ | `/ctx:qa --resume` | Resume interrupted QA session |
251
+ | `/ctx:visual-qa` | Measurement-driven design parity check |
252
+
253
+ ### ML
254
+
255
+ | Command | Purpose |
256
+ |---------|---------|
257
+ | `/ctx:experiment` | Start ML experiment loop |
258
+ | `/ctx:train` | Trigger training pipeline |
259
+ | `/ctx:ml-status` | Show experiment registry and model status |
585
260
 
586
261
  ### Session
262
+
587
263
  | Command | Purpose |
588
264
  |---------|---------|
589
- | `/ctx pause` | Checkpoint for session resume |
265
+ | `/ctx:pause` | Checkpoint state for session resume |
266
+
267
+ ### Phase
590
268
 
591
- ### Phase Management
592
269
  | Command | Purpose |
593
270
  |---------|---------|
594
- | `/ctx phase list` | Show all phases |
595
- | `/ctx phase add "goal"` | Add new phase |
596
- | `/ctx phase next` | Complete current, move to next |
271
+ | `/ctx:phase list` | Show all phases and their status |
272
+ | `/ctx:phase add "goal"` | Add a new phase |
273
+ | `/ctx:phase next` | Complete current phase, advance to next |
597
274
 
598
275
  ### Integration
276
+
599
277
  | Command | Purpose |
600
278
  |---------|---------|
601
- | `/ctx integrate` | Show integration status |
602
- | `/ctx integrate linear` | Setup Linear |
603
- | `/ctx integrate jira` | Setup Jira |
604
- | `/ctx integrate github` | Setup GitHub Issues |
605
- | `/ctx integrate --sync` | Sync all stories |
279
+ | `/ctx:integrate` | Show integration status |
280
+ | `/ctx:integrate linear` | Set up Linear sync |
281
+ | `/ctx:integrate jira` | Set up Jira sync |
282
+ | `/ctx:integrate github` | Set up GitHub Issues sync |
283
+ | `/ctx:integrate --sync` | Sync all stories with connected tracker |
606
284
 
607
285
  ### Milestone
286
+
287
+ | Command | Purpose |
288
+ |---------|---------|
289
+ | `/ctx:milestone` | Show current milestone |
290
+ | `/ctx:milestone list` | List all milestones |
291
+ | `/ctx:milestone audit` | Verify milestone completion |
292
+ | `/ctx:milestone complete` | Archive and tag release |
293
+ | `/ctx:milestone new [name]` | Start next version |
294
+ | `/ctx:milestone gaps` | Generate fix phases for gaps |
295
+
296
+ ### Metrics
297
+
608
298
  | Command | Purpose |
609
299
  |---------|---------|
610
- | `/ctx milestone` | Show current milestone |
611
- | `/ctx milestone list` | List all milestones |
612
- | `/ctx milestone audit` | Verify completion |
613
- | `/ctx milestone complete` | Archive and tag |
614
- | `/ctx milestone new [name]` | Start next version |
615
- | `/ctx milestone gaps` | Generate fix phases |
616
-
617
- ### Metrics & Audit
300
+ | `/ctx:metrics` | Productivity dashboard |
301
+ | `/ctx:metrics cost` | Cost analysis by model/profile |
302
+ | `/ctx:metrics export` | Export HTML dashboard |
303
+
304
+ ### Learning
305
+
618
306
  | Command | Purpose |
619
307
  |---------|---------|
620
- | `/ctx metrics` | Show productivity dashboard |
621
- | `/ctx metrics cost` | Cost analysis |
622
- | `/ctx metrics export` | Export HTML dashboard |
623
- | `/ctx audit` | Show audit summary |
624
- | `/ctx audit export` | Generate compliance report |
308
+ | `/ctx:learn` | Show what CTX has learned about your project |
309
+ | `/ctx:learn patterns` | Show detected code patterns |
310
+ | `/ctx:learn decisions` | Show architectural decisions log |
311
+ | `/ctx:predict` | Get AI-suggested next features |
312
+ | `/ctx:predict --quick` | Quick wins only |
313
+
314
+ ### Monitoring
625
315
 
626
- ### Learning & Prediction
627
316
  | Command | Purpose |
628
317
  |---------|---------|
629
- | `/ctx learn` | Show what CTX has learned |
630
- | `/ctx learn patterns` | Show code patterns |
631
- | `/ctx learn decisions` | Show architectural decisions |
632
- | `/ctx learn forget [id]` | Remove a learned pattern |
633
- | `/ctx predict` | Get feature suggestions |
634
- | `/ctx predict --quick` | Quick wins only |
635
- | `/ctx predict --create [id]` | Create story from suggestion |
636
-
637
- ### Monitoring & Voice
318
+ | `/ctx:monitor` | Show monitoring status |
319
+ | `/ctx:monitor connect sentry` | Connect Sentry error tracking |
320
+ | `/ctx:monitor errors` | List recent production errors |
321
+ | `/ctx:monitor auto-fix [id]` | Auto-fix error with PR |
322
+ | `/ctx:monitor --watch` | Continuous monitoring mode |
323
+
324
+ ### Voice
325
+
638
326
  | Command | Purpose |
639
327
  |---------|---------|
640
- | `/ctx monitor` | Show monitoring status |
641
- | `/ctx monitor connect sentry` | Connect Sentry |
642
- | `/ctx monitor errors` | List recent errors |
643
- | `/ctx monitor auto-fix [id]` | Auto-fix with PR |
644
- | `/ctx monitor --watch` | Continuous monitoring |
645
- | `/ctx voice` | Start voice input |
646
- | `/ctx voice --continuous` | Always listening mode |
647
- | `/ctx voice --dictate` | Long-form dictation |
328
+ | `/ctx:voice` | Start voice input |
329
+ | `/ctx:voice --continuous` | Always-listening mode |
330
+ | `/ctx:voice --dictate` | Long-form dictation |
648
331
 
649
332
  ---
650
333
 
651
- ## State Machine
334
+ ## Hooks (3)
652
335
 
653
- ```
654
- initializing → discussing → executing → verifying → COMPLETE
655
- ↑ ↓
656
- └── debugging ──┘
657
- ```
336
+ Hooks are deterministic Node.js scripts registered in `settings.json`. They run synchronously on every tool call, independent of Claude's reasoning.
658
337
 
659
- | State | What happens |
660
- |-------|--------------|
661
- | initializing | Research + Map + Plan |
662
- | discussing | Capture decisions in CONTEXT.md |
663
- | executing | Execute with git-native commits |
664
- | debugging | Persistent debug loop (max 10 attempts) |
665
- | verifying | Three-level verification |
666
- | paused | Resume from checkpoint |
338
+ | Hook | File | Trigger | Behavior |
339
+ |------|------|---------|----------|
340
+ | pre-tool-use | `hooks/pre-tool-use.js` | Before any tool executes | TDD enforcement + capability restrictions. Exit 2 blocks the tool call. |
341
+ | post-tool-use | `hooks/post-tool-use.js` | After any tool executes | Logs file modifications to audit trail in `.ctx/audit.log` |
342
+ | subagent-stop | `hooks/subagent-stop.js` | When a subagent finishes | Records agent completion in `.ctx/STATE.json` |
343
+
344
+ **Configure hook behavior:**
345
+
346
+ ```bash
347
+ npx ctx-cc config set hooks.tddMode strict # Block writes without tests
348
+ npx ctx-cc config set hooks.tddMode warn # Warn but allow
349
+ npx ctx-cc config set hooks.tddMode off # Disabled
350
+ ```
667
351
 
668
352
  ---
669
353
 
670
- ## Context Management
354
+ ## Design Workflow
671
355
 
672
- CTX actively manages context budget:
356
+ CTX implements an agency-grade design process with mandatory approval gates.
673
357
 
674
- | Usage | Quality | Action |
675
- |-------|---------|--------|
676
- | 0-30% | Peak | Continue |
677
- | 30-40% | Good | Continue |
678
- | 40-50% | Good | Prepare handoff notes |
679
- | 50-60% | Degrading | Auto-checkpoint |
680
- | 60-70% | Degrading | Create HANDOFF.md |
681
- | 70%+ | Poor | Force checkpoint |
358
+ **Phase 1 Brand**
359
+ ```
360
+ Research Mood board 3 direction options → User picks → BRAND_KIT.md
361
+ ```
362
+ BRAND_KIT.md becomes the constraint for all subsequent design work. Colors, typography, and spacing flow from tokens only.
682
363
 
683
- Smart handoff creates `HANDOFF.md` with:
684
- - Completed tasks with commit hashes
685
- - Current task progress
686
- - Key decisions made
687
- - Files modified
688
- - Next steps
364
+ **Phase 2 Component Design**
365
+ ```
366
+ Research 3 options (A/B/C) → User approves direction → Prototype → Implement
367
+ ```
368
+ Never a single design. Options are always presented before implementation.
689
369
 
690
- ---
370
+ **Phase 3 — Visual QA**
371
+ Every design change triggers numerical verification:
372
+ - Measure rendered values vs design spec (px, rem, hex)
373
+ - Report deltas as numbers, not subjective descriptions
374
+ - Fixes are specific: `change font-size from 14px to 16px`
375
+
376
+ **Compliance:** WCAG 2.2 AA + EAA 2025. Touch targets, contrast ratios, keyboard navigation, and screen reader labels are all measured.
691
377
 
692
- ## 21 Specialized Agents
693
-
694
- | Agent | Spawned when | Model (balanced) |
695
- |-------|--------------|------------------|
696
- | ctx-mapper | /ctx map | haiku |
697
- | ctx-tech-mapper | /ctx map-codebase | haiku |
698
- | ctx-arch-mapper | /ctx map-codebase | haiku |
699
- | ctx-quality-mapper | /ctx map-codebase | haiku |
700
- | ctx-concerns-mapper | /ctx map-codebase | haiku |
701
- | ctx-discusser | status = discussing | sonnet |
702
- | ctx-researcher | status = initializing | opus |
703
- | ctx-planner | after research | opus |
704
- | ctx-executor | status = executing | sonnet |
705
- | ctx-designer | design stories | sonnet |
706
- | ctx-debugger | status = debugging | sonnet |
707
- | ctx-verifier | status = verifying | haiku |
708
- | ctx-parallelizer | before execution | haiku |
709
- | ctx-reviewer | before commit | sonnet |
710
- | ctx-criteria-suggester | during init/discuss | sonnet |
711
- | ctx-handoff | at context thresholds | haiku |
712
- | ctx-team-coordinator | team mode | sonnet |
713
- | ctx-auditor | always (background) | haiku |
714
- | ctx-learner | observing patterns | haiku |
715
- | ctx-predictor | after milestone/on demand | sonnet |
716
- | ctx-qa | /ctx qa (full system test) | sonnet |
378
+ **Key tools:** Figma MCP (token sync + component metadata), Gemini design analysis, W3C DTCG 2025.10 token format.
717
379
 
718
380
  ---
719
381
 
720
- ## Directory Structure
382
+ ## ML Workflow
383
+
384
+ CTX implements an experiment-driven ML development loop.
721
385
 
386
+ **Phase 1 — Data Analysis**
722
387
  ```
723
- .ctx/
724
- ├── config.json # Model profiles, git settings
725
- ├── STATE.md # Living digest - execution state
726
- ├── PRD.json # Requirements contract
727
- ├── REPO-MAP.md # Token-optimized codebase map
728
- ├── REPO-MAP.json # Structured map data
729
- ├── .env # Test credentials (GITIGNORED)
730
- ├── codebase/ # Deep analysis results
731
- │ ├── TECH.md
732
- │ ├── ARCH.md
733
- │ ├── QUALITY.md
734
- │ ├── CONCERNS.md
735
- │ └── SUMMARY.md
736
- ├── phases/{story_id}/
737
- │ ├── CONTEXT.md # Locked decisions (discussion phase)
738
- │ ├── RESEARCH.md # ArguSeek results
739
- │ ├── PLAN.md # Tasks mapped to criteria
740
- │ └── VERIFY.md # Verification report
741
- ├── debug/
742
- │ ├── sessions/ # Persistent debug state
743
- │ └── screenshots/ # Visual proof
744
- ├── checkpoints/ # Auto-checkpoints
745
- └── memory/ # Decision memory
388
+ Load data → EDA → Quality scoring → Feature correlation → Pandera validation schema
746
389
  ```
747
390
 
391
+ **Phase 2 — Experiment Loop**
392
+ ```
393
+ Hypothesize → Design experiment → Run → Analyze → Register result → Iterate
394
+ ```
395
+ All hypotheses and results are tracked in `.ctx/ml/experiments/`. The model registry stores every trained artifact with metadata.
396
+
397
+ **Phase 3 — Model Evaluation**
398
+ - Conformal prediction intervals (MAPIE)
399
+ - Statistical significance testing
400
+ - Calibration curves and reliability diagrams
401
+
402
+ **Phase 4 — Production Pipeline**
403
+ - Model registry with version pinning
404
+ - Inference envelope with latency SLA
405
+ - Circuit breaker (auto-disable on error spike)
406
+ - KS drift detection with configurable thresholds
407
+ - Retraining triggers on drift
408
+
409
+ **Proven patterns:** XGBoost + MAPIE conformal prediction, T-learner causal inference, KS drift, Pandera schema validation — from Digital Twin production workflows.
410
+
748
411
  ---
749
412
 
750
413
  ## Configuration
751
414
 
752
- `.ctx/config.json`:
753
- ```json
754
- {
755
- "activeProfile": "balanced",
756
- "models": {
757
- "architect": { "id": "claude-opus-4", "costTier": "high" },
758
- "default": { "id": "claude-sonnet-4", "costTier": "medium" },
759
- "fast": { "id": "claude-haiku-4", "costTier": "low" }
760
- },
761
- "profiles": {
762
- "quality": {
763
- "research": "architect",
764
- "discussion": "architect",
765
- "planning": "architect",
766
- "execution": "architect"
767
- },
768
- "balanced": {
769
- "research": "architect",
770
- "discussion": "default",
771
- "planning": "architect",
772
- "execution": "default"
773
- },
774
- "budget": {
775
- "research": "default",
776
- "planning": "default",
777
- "execution": "default"
778
- }
779
- },
780
- "git": {
781
- "autoCommit": true,
782
- "commitPerTask": true
783
- }
784
- }
415
+ ```bash
416
+ npx ctx-cc config list # Show all config values
417
+ npx ctx-cc config get activeProfile # Get a specific value
418
+ npx ctx-cc config set hooks.tddMode strict # Set a value
785
419
  ```
786
420
 
787
- ---
421
+ **Model profiles:**
788
422
 
789
- ## Integrations
423
+ | Profile | Research | Planning | Execution | Verify | Relative Cost |
424
+ |---------|----------|----------|-----------|--------|---------------|
425
+ | quality | opus | opus | opus | sonnet | ~3x |
426
+ | balanced | opus | opus | sonnet | haiku | 1x (default) |
427
+ | budget | sonnet | sonnet | sonnet | haiku | ~0.4x |
790
428
 
791
- ### ArguSeek (Web Research)
792
- Auto-runs during planning for best practices, security, and patterns.
429
+ Switch profiles without reinstalling:
430
+ ```
431
+ /ctx:profile quality
432
+ /ctx:profile balanced
433
+ /ctx:profile budget
434
+ ```
793
435
 
794
- ### ChunkHound (Semantic Code Search)
795
- Auto-runs during planning for semantic search and pattern detection.
796
- ```bash
797
- uv tool install chunkhound
436
+ ---
437
+
438
+ ## Phase Lifecycle
439
+
440
+ ```
441
+ init → plan → execute → verify → complete
442
+ ↑ ↓
443
+ ←── (fix failures)
798
444
  ```
799
445
 
800
- ### Browser Verification (Playwright/Chrome DevTools)
801
- Auto-runs during debugging and verification for visual proof.
446
+ State is persisted in `.ctx/STATE.json` after every transition. The `ctx-state` skill manages reads and writes. The `ctx-orchestrator` skill drives transitions.
802
447
 
803
- ### Figma MCP (Design Context)
804
- Auto-runs during design stories for tokens and component metadata.
448
+ | Phase | What happens |
449
+ |-------|--------------|
450
+ | init | Research + repo map + PRD validation |
451
+ | plan | Acceptance criteria + atomic task plan (2–3 tasks) |
452
+ | execute | Implementation with per-task git commits |
453
+ | verify | Three-level check: exists → substantive → wired |
454
+ | complete | Review gate passed, story archived |
805
455
 
806
- ### Gemini Design MCP (Visual Generation)
807
- Auto-runs during design stories for mockups and UI code.
456
+ If verification fails, state returns to `execute` automatically. The fix-loop runs until all three verification levels pass.
808
457
 
809
458
  ---
810
459
 
811
- ## Key Principles
460
+ ## Plugin Manifest
812
461
 
813
- ### 95% Auto-Deviation Handling
462
+ CTX ships with `plugin.json` for Claude Code marketplace distribution. Future marketplace installs will use:
814
463
 
815
- | Trigger | Action |
816
- |---------|--------|
817
- | Bug in existing code | Auto-fix, document in commit |
818
- | Missing validation | Auto-add, document |
819
- | Blocking issue | Auto-fix, document |
820
- | Architecture decision | **Ask user** |
464
+ ```bash
465
+ /plugin install ctx@my-marketplace
466
+ ```
821
467
 
822
- ### Three-Level Verification
468
+ The manifest declares all agents, skills, commands, and hooks so the marketplace can display capabilities, manage versions, and handle updates without reinstalling.
823
469
 
824
- | Level | Question | Check |
825
- |-------|----------|-------|
826
- | Exists | File on disk? | Glob |
827
- | Substantive | Real code, not stub? | No TODOs, no placeholders |
828
- | Wired | Imported and used? | Trace imports |
470
+ ---
829
471
 
830
- ### Atomic Planning
472
+ ## CLI Reference
831
473
 
832
- Plans limited to 2-3 tasks to prevent context degradation.
474
+ ```bash
475
+ npx ctx-cc [options] Install CTX into Claude Code
476
+ npx ctx-cc list List all 25 agents with model/maxTurns
477
+ npx ctx-cc skills Analyze skill descriptions and triggers
478
+ npx ctx-cc config list Show full configuration
479
+ npx ctx-cc config get <key> Get a config value
480
+ npx ctx-cc config set <k> <v> Set a config value
481
+ npx ctx-cc --help Show help
482
+
483
+ Options:
484
+ --global, -g Install to ~/.claude (default)
485
+ --project, -p Install to .claude in current directory
486
+ --force, -f Overwrite existing installation
487
+ ```
833
488
 
834
489
  ---
835
490
 
836
- ## Updating
491
+ ## Development
837
492
 
838
493
  ```bash
839
- npx ctx-cc --force
494
+ git clone https://github.com/jufjuf/CTX.git
495
+ cd CTX
496
+ npm test # 264 tests, node:test runner
497
+ ```
498
+
499
+ **Project structure:**
500
+
840
501
  ```
502
+ ctx-cc/
503
+ ├── agents/ 25 agent definitions (.md with frontmatter)
504
+ ├── skills/ 7 skill directories (each contains SKILL.md)
505
+ ├── commands/ 26 slash command definitions (.md)
506
+ ├── hooks/ 3 enforcement hook scripts (.js)
507
+ ├── src/ 17 source modules (.js)
508
+ ├── test/ 19 test files (.test.js)
509
+ ├── templates/ config.json, PRD.json, state templates
510
+ ├── bin/ctx.js CLI entry point (installer only)
511
+ ├── plugin.json Marketplace manifest
512
+ └── package.json Zero runtime dependencies
513
+ ```
514
+
515
+ ---
516
+
517
+ ## Testing
518
+
519
+ ```bash
520
+ npm test
521
+ # 264 tests, 0 failures, ~2s
522
+ ```
523
+
524
+ **Coverage:**
525
+
526
+ | Area | What is tested |
527
+ |------|----------------|
528
+ | Agent discovery | Frontmatter parsing, model/maxTurns validation |
529
+ | State machine | Phase transitions, invalid transition rejection |
530
+ | Pipelines | Orchestrator flow, review gate stages |
531
+ | Worktrees | Parallel execution isolation |
532
+ | Hooks | TDD enforcement, audit logging, subagent tracking |
533
+ | Capabilities | Restriction rules, exit codes |
534
+ | Context profiles | Model resolution per profile |
535
+ | Skills format | SKILL.md structure, description format |
536
+ | Design compliance | Token format, BRAND_KIT schema |
537
+ | ML compliance | Experiment schema, pipeline config |
538
+ | CLI commands | list, skills, config get/set |
539
+ | Integration | End-to-end install + verify |
841
540
 
842
541
  ---
843
542
 
@@ -849,8 +548,8 @@ MIT
849
548
 
850
549
  <div align="center">
851
550
 
852
- **[GitHub](https://github.com/jufjuf/CTX)** · **[Issues](https://github.com/jufjuf/CTX/issues)** · **[npm](https://www.npmjs.com/package/ctx-cc)**
551
+ **[GitHub](https://github.com/jufjuf/CTX)** · **[npm](https://www.npmjs.com/package/ctx-cc)** · **[Issues](https://github.com/jufjuf/CTX/issues)**
853
552
 
854
- *CTX 3.3 - Conversational-first. Just describe what you want. 21 agents. Learning system. Self-healing.*
553
+ CTX 4.0 25 agents · 7 skills · 3 hooks · zero dependencies
855
554
 
856
555
  </div>