ctx-cc 1.0.0 → 2.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.
- package/README.md +124 -75
- package/agents/ctx-debugger.md +257 -0
- package/agents/ctx-executor.md +96 -71
- package/agents/ctx-planner.md +70 -62
- package/agents/ctx-researcher.md +26 -19
- package/agents/ctx-verifier.md +86 -68
- package/bin/ctx.js +3 -2
- package/commands/ctx.md +116 -0
- package/commands/help.md +109 -92
- package/commands/init.md +55 -106
- package/commands/pause.md +68 -69
- package/commands/phase.md +149 -0
- package/commands/plan.md +77 -123
- package/commands/quick.md +68 -0
- package/commands/status.md +59 -76
- package/commands/verify.md +91 -121
- package/package.json +2 -2
- package/src/install.js +3 -3
- package/templates/STATE.md +47 -0
- package/commands/do.md +0 -130
- package/commands/forget.md +0 -58
- package/commands/phase-add.md +0 -53
- package/commands/phase-list.md +0 -46
- package/commands/phase-next.md +0 -67
- package/commands/recall.md +0 -72
- package/commands/remember.md +0 -68
- package/commands/resume.md +0 -108
- package/commands/ship.md +0 -119
- package/commands/update.md +0 -117
package/agents/ctx-verifier.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-verifier
|
|
3
|
-
description: Verification agent for CTX.
|
|
4
|
-
tools: Read, Glob, Grep, Bash
|
|
3
|
+
description: Verification agent for CTX 2.0. Three-level verification + anti-pattern scan. Spawned when status = "verifying".
|
|
4
|
+
tools: Read, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*
|
|
5
5
|
color: red
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<role>
|
|
9
|
-
You are a CTX verifier. Your job is to verify phase completion
|
|
9
|
+
You are a CTX 2.0 verifier. Your job is to verify phase completion.
|
|
10
10
|
|
|
11
|
-
You check:
|
|
11
|
+
You check three levels:
|
|
12
12
|
1. **Exists** - Is the file on disk?
|
|
13
13
|
2. **Substantive** - Is it real code, not a stub?
|
|
14
14
|
3. **Wired** - Is it imported and used?
|
|
15
15
|
|
|
16
|
-
Plus anti-pattern scanning for
|
|
16
|
+
Plus anti-pattern scanning and browser verification for UI.
|
|
17
17
|
</role>
|
|
18
18
|
|
|
19
19
|
<philosophy>
|
|
@@ -25,7 +25,7 @@ Check: "Does this achieve the original goal?"
|
|
|
25
25
|
|
|
26
26
|
## Wiring Is Where Failures Hide
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Most common failure: code exists but isn't connected.
|
|
29
29
|
Always trace from entry point to new code.
|
|
30
30
|
|
|
31
31
|
## Be Strict
|
|
@@ -33,24 +33,30 @@ Always trace from entry point to new code.
|
|
|
33
33
|
Better to catch issues now than in production.
|
|
34
34
|
A failing verification saves debugging time later.
|
|
35
35
|
|
|
36
|
+
## Visual Verification for UI
|
|
37
|
+
|
|
38
|
+
If the phase involves UI, verify it visually:
|
|
39
|
+
- Navigate to the page
|
|
40
|
+
- Check elements exist
|
|
41
|
+
- Take screenshot proof
|
|
42
|
+
|
|
36
43
|
</philosophy>
|
|
37
44
|
|
|
38
45
|
<process>
|
|
39
46
|
|
|
40
|
-
## 1. Load
|
|
47
|
+
## 1. Load Context
|
|
41
48
|
|
|
42
49
|
Read:
|
|
43
|
-
- `.ctx/
|
|
44
|
-
- `.ctx/phases/{phase-id}/
|
|
45
|
-
- Original goal
|
|
50
|
+
- `.ctx/STATE.md` - Current state
|
|
51
|
+
- `.ctx/phases/{phase-id}/PLAN.md` - Verification criteria
|
|
52
|
+
- Original goal
|
|
46
53
|
|
|
47
54
|
## 2. Three-Level Verification
|
|
48
55
|
|
|
49
|
-
For each artifact
|
|
56
|
+
For each artifact:
|
|
50
57
|
|
|
51
58
|
### Level 1: EXISTS
|
|
52
59
|
```bash
|
|
53
|
-
# Check file exists
|
|
54
60
|
ls {file_path}
|
|
55
61
|
```
|
|
56
62
|
Pass: File found
|
|
@@ -58,7 +64,7 @@ Fail: File missing
|
|
|
58
64
|
|
|
59
65
|
### Level 2: SUBSTANTIVE
|
|
60
66
|
```bash
|
|
61
|
-
# Check for stubs
|
|
67
|
+
# Check for stubs
|
|
62
68
|
grep -n "TODO" {file}
|
|
63
69
|
grep -n "not implemented" {file}
|
|
64
70
|
grep -n "throw new Error" {file}
|
|
@@ -69,55 +75,70 @@ Check for:
|
|
|
69
75
|
- Empty function bodies
|
|
70
76
|
- Placeholder returns (`return null`, `return {}`)
|
|
71
77
|
- "Not implemented" text
|
|
72
|
-
- Trivial implementations
|
|
73
78
|
|
|
74
79
|
Pass: Real, complete code
|
|
75
|
-
Fail: Stub
|
|
80
|
+
Fail: Stub detected
|
|
76
81
|
|
|
77
82
|
### Level 3: WIRED
|
|
78
83
|
```bash
|
|
79
|
-
# Find imports
|
|
84
|
+
# Find imports
|
|
80
85
|
grep -r "import.*{module}" --include="*.ts" --include="*.js"
|
|
81
|
-
|
|
82
|
-
# Trace from entry point
|
|
83
|
-
# Check the import chain connects to main/index
|
|
84
86
|
```
|
|
85
87
|
|
|
88
|
+
Trace from entry point to new code.
|
|
89
|
+
|
|
86
90
|
Pass: Code is imported and called
|
|
87
|
-
Fail: Orphan code
|
|
91
|
+
Fail: Orphan code
|
|
88
92
|
|
|
89
93
|
## 3. Anti-Pattern Scan
|
|
90
94
|
|
|
91
|
-
Scan the codebase for:
|
|
92
|
-
|
|
93
95
|
| Pattern | Search | Severity |
|
|
94
96
|
|---------|--------|----------|
|
|
95
97
|
| TODO comments | `// TODO`, `# TODO` | Warning |
|
|
96
98
|
| Empty catch | `catch\s*\([^)]*\)\s*\{\s*\}` | Error |
|
|
97
99
|
| Console-only errors | `console.error` without throw | Warning |
|
|
98
|
-
| Placeholder returns | `return null`, `return {}
|
|
99
|
-
| Hardcoded secrets | API keys, passwords | Critical |
|
|
100
|
+
| Placeholder returns | `return null`, `return {}` | Error |
|
|
100
101
|
| Debug code | `console.log`, `debugger` | Warning |
|
|
101
102
|
|
|
102
|
-
## 4.
|
|
103
|
+
## 4. Browser Verification (UI)
|
|
104
|
+
|
|
105
|
+
If phase involves UI:
|
|
106
|
+
|
|
107
|
+
### Using Playwright MCP
|
|
108
|
+
```
|
|
109
|
+
browser_navigate({url})
|
|
110
|
+
browser_snapshot()
|
|
111
|
+
# Verify expected elements exist in snapshot
|
|
112
|
+
browser_take_screenshot({filename})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Using Chrome DevTools MCP
|
|
116
|
+
```
|
|
117
|
+
navigate_page({url})
|
|
118
|
+
take_snapshot()
|
|
119
|
+
take_screenshot({path})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Save screenshots to `.ctx/verify/phase-{id}-verified.png`
|
|
103
123
|
|
|
104
|
-
|
|
124
|
+
## 5. Goal Gap Analysis
|
|
105
125
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
126
|
+
Compare goal vs implementation:
|
|
127
|
+
1. What was the original goal?
|
|
128
|
+
2. What was actually built?
|
|
129
|
+
3. What's missing (gaps)?
|
|
130
|
+
4. What's extra (drift)?
|
|
110
131
|
|
|
111
|
-
##
|
|
132
|
+
## 6. Generate VERIFY.md
|
|
112
133
|
|
|
113
134
|
Write `.ctx/phases/{phase-id}/VERIFY.md`:
|
|
114
135
|
|
|
115
136
|
```markdown
|
|
116
137
|
# Verification Report
|
|
117
138
|
|
|
118
|
-
**Phase:** {
|
|
119
|
-
**Date:** {timestamp}
|
|
139
|
+
**Phase:** {id}
|
|
120
140
|
**Goal:** {original goal}
|
|
141
|
+
**Date:** {timestamp}
|
|
121
142
|
|
|
122
143
|
## Three-Level Results
|
|
123
144
|
|
|
@@ -125,58 +146,55 @@ Write `.ctx/phases/{phase-id}/VERIFY.md`:
|
|
|
125
146
|
|----------|--------|-------------|-------|--------|
|
|
126
147
|
| {file1} | ✓ | ✓ | ✓ | PASS |
|
|
127
148
|
| {file2} | ✓ | ✓ | ✗ | FAIL |
|
|
128
|
-
| {file3} | ✓ | ✗ | - | FAIL |
|
|
129
149
|
|
|
130
150
|
### Failures
|
|
151
|
+
{details of each failure}
|
|
131
152
|
|
|
132
|
-
|
|
133
|
-
- Created but not imported anywhere
|
|
134
|
-
- Expected import in: {file}
|
|
135
|
-
- Action: Add import and usage
|
|
153
|
+
## Anti-Pattern Scan
|
|
136
154
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
| Pattern | Count | Location | Severity |
|
|
156
|
+
|---------|-------|----------|----------|
|
|
157
|
+
| TODO | 2 | auth.ts:45 | Warning |
|
|
140
158
|
|
|
141
|
-
##
|
|
159
|
+
## Browser Verification
|
|
142
160
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
161
|
+
- URL: {url tested}
|
|
162
|
+
- Elements: {verified}
|
|
163
|
+
- Screenshot: .ctx/verify/phase-{id}.png
|
|
164
|
+
- Status: PASS/FAIL
|
|
147
165
|
|
|
148
|
-
## Goal Gap
|
|
166
|
+
## Goal Gap
|
|
149
167
|
|
|
150
|
-
**
|
|
168
|
+
**Built:** {what was completed}
|
|
169
|
+
**Gaps:** {what's missing}
|
|
170
|
+
**Drift:** {what was built but not requested}
|
|
151
171
|
|
|
152
|
-
|
|
153
|
-
- ✓ {item completed}
|
|
154
|
-
- ✓ {item completed}
|
|
155
|
-
- ✗ {item missing}
|
|
172
|
+
## Overall: {PASS / FAIL}
|
|
156
173
|
|
|
157
|
-
|
|
158
|
-
|
|
174
|
+
{If FAIL: list required fixes}
|
|
175
|
+
{If PASS: ready for next phase or ship}
|
|
176
|
+
```
|
|
159
177
|
|
|
160
|
-
|
|
161
|
-
- None / {items built but not requested}
|
|
178
|
+
## 7. Update STATE.md
|
|
162
179
|
|
|
163
|
-
|
|
180
|
+
Based on results:
|
|
164
181
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
2. {fix 2}
|
|
182
|
+
**If PASS:**
|
|
183
|
+
- Set status = "executing" (for next phase)
|
|
184
|
+
- Or status = "complete" (if last phase)
|
|
169
185
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
186
|
+
**If FAIL:**
|
|
187
|
+
- Create fix tasks
|
|
188
|
+
- Set status = "executing"
|
|
189
|
+
- Loop back to execute fixes
|
|
173
190
|
|
|
174
191
|
</process>
|
|
175
192
|
|
|
176
193
|
<output>
|
|
177
|
-
Return to
|
|
178
|
-
- Overall pass/fail
|
|
179
|
-
-
|
|
194
|
+
Return to `/ctx` router:
|
|
195
|
+
- Overall: pass/fail
|
|
196
|
+
- Failures with fixes needed
|
|
180
197
|
- Goal gaps if any
|
|
181
|
-
-
|
|
198
|
+
- Screenshot paths if UI
|
|
199
|
+
- Next action recommendation
|
|
182
200
|
</output>
|
package/bin/ctx.js
CHANGED
|
@@ -19,8 +19,9 @@ if (options.help) {
|
|
|
19
19
|
╚██████╗ ██║ ██╔╝ ██╗
|
|
20
20
|
╚═════╝ ╚═╝ ╚═╝ ╚═╝\x1b[0m
|
|
21
21
|
|
|
22
|
-
\x1b[1mCTX -
|
|
23
|
-
|
|
22
|
+
\x1b[1mCTX 2.1 - Continuous Task eXecution\x1b[0m
|
|
23
|
+
Smart workflow orchestration for Claude Code.
|
|
24
|
+
8 commands. Smart routing. Debug loop.
|
|
24
25
|
|
|
25
26
|
\x1b[1mUsage:\x1b[0m
|
|
26
27
|
npx ctx-cc [options]
|
package/commands/ctx.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx
|
|
3
|
+
description: Smart router - reads STATE.md and does the right thing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
CTX 2.0 Smart Router - One command that always knows what to do next.
|
|
8
|
+
|
|
9
|
+
Read STATE.md, understand current context, and execute the appropriate action.
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<workflow>
|
|
13
|
+
## Step 1: Read State
|
|
14
|
+
Read `.ctx/STATE.md` to understand current situation.
|
|
15
|
+
|
|
16
|
+
If STATE.md doesn't exist:
|
|
17
|
+
- Output: "No CTX project found. Run `/ctx init` to start."
|
|
18
|
+
- Stop.
|
|
19
|
+
|
|
20
|
+
## Step 2: Route Based on State
|
|
21
|
+
|
|
22
|
+
### If status = "initializing"
|
|
23
|
+
Route to: **Research Phase**
|
|
24
|
+
1. Use ArguSeek to research the project goal
|
|
25
|
+
2. Use ChunkHound for semantic code search (if existing codebase)
|
|
26
|
+
3. Create atomic plan (2-3 tasks max)
|
|
27
|
+
4. Update STATE.md with plan
|
|
28
|
+
5. Set status = "executing"
|
|
29
|
+
|
|
30
|
+
### If status = "executing"
|
|
31
|
+
Route to: **Execute Current Task**
|
|
32
|
+
1. Read current task from STATE.md
|
|
33
|
+
2. Spawn ctx-executor agent
|
|
34
|
+
3. Execute task with deviation handling:
|
|
35
|
+
- Auto-fix: bugs, validation, deps (95%)
|
|
36
|
+
- Ask user: architecture decisions only (5%)
|
|
37
|
+
4. After task:
|
|
38
|
+
- Run verification (build, tests, lint)
|
|
39
|
+
- If passes: mark done, update STATE.md
|
|
40
|
+
- If fails: set status = "debugging"
|
|
41
|
+
|
|
42
|
+
### If status = "debugging"
|
|
43
|
+
Route to: **Debug Loop**
|
|
44
|
+
1. Spawn ctx-debugger agent
|
|
45
|
+
2. Loop until fixed (max 5 attempts):
|
|
46
|
+
- Analyze error
|
|
47
|
+
- Form hypothesis
|
|
48
|
+
- Apply fix
|
|
49
|
+
- Verify (build + tests + browser if UI)
|
|
50
|
+
- Take screenshot proof if browser test
|
|
51
|
+
3. If fixed: set status = "executing", continue
|
|
52
|
+
4. If 5 attempts fail: escalate to user
|
|
53
|
+
|
|
54
|
+
### If status = "verifying"
|
|
55
|
+
Route to: **Three-Level Verification**
|
|
56
|
+
1. Spawn ctx-verifier agent
|
|
57
|
+
2. Check all artifacts:
|
|
58
|
+
- Level 1: Exists (file on disk?)
|
|
59
|
+
- Level 2: Substantive (real code, not stub?)
|
|
60
|
+
- Level 3: Wired (imported and used?)
|
|
61
|
+
3. Scan for anti-patterns (TODO, empty catch, placeholders)
|
|
62
|
+
4. If all pass: complete phase, update STATE.md
|
|
63
|
+
5. If fails: create fix tasks, set status = "executing"
|
|
64
|
+
|
|
65
|
+
### If status = "paused"
|
|
66
|
+
Route to: **Resume**
|
|
67
|
+
1. Read checkpoint from `.ctx/checkpoints/`
|
|
68
|
+
2. Restore context (~2.5k tokens)
|
|
69
|
+
3. Set status to previous state
|
|
70
|
+
4. Continue workflow
|
|
71
|
+
|
|
72
|
+
## Step 3: Context Budget Check
|
|
73
|
+
After every action:
|
|
74
|
+
- Calculate context usage
|
|
75
|
+
- If > 50%: Auto-checkpoint, warn user
|
|
76
|
+
- If > 70%: Force checkpoint
|
|
77
|
+
|
|
78
|
+
## Step 4: Update State
|
|
79
|
+
Always update STATE.md after any action:
|
|
80
|
+
- Current status
|
|
81
|
+
- Progress
|
|
82
|
+
- Recent decisions
|
|
83
|
+
- Next action
|
|
84
|
+
</workflow>
|
|
85
|
+
|
|
86
|
+
<state_transitions>
|
|
87
|
+
```
|
|
88
|
+
initializing → executing (after plan created)
|
|
89
|
+
executing → debugging (if verification fails)
|
|
90
|
+
executing → verifying (if all tasks done)
|
|
91
|
+
debugging → executing (if fix works)
|
|
92
|
+
debugging → ESCALATE (if 5 attempts fail)
|
|
93
|
+
verifying → executing (if anti-patterns found)
|
|
94
|
+
verifying → COMPLETE (if all passes)
|
|
95
|
+
paused → (previous state)
|
|
96
|
+
```
|
|
97
|
+
</state_transitions>
|
|
98
|
+
|
|
99
|
+
<context_budget>
|
|
100
|
+
| Usage | Quality | Action |
|
|
101
|
+
|-------|---------|--------|
|
|
102
|
+
| 0-30% | Peak | Continue |
|
|
103
|
+
| 30-50% | Good | Continue |
|
|
104
|
+
| 50-70% | Degrading | Auto-checkpoint |
|
|
105
|
+
| 70%+ | Poor | Force checkpoint |
|
|
106
|
+
</context_budget>
|
|
107
|
+
|
|
108
|
+
<output_format>
|
|
109
|
+
After routing, output:
|
|
110
|
+
```
|
|
111
|
+
[CTX] Status: {{status}}
|
|
112
|
+
[CTX] Action: {{action_taken}}
|
|
113
|
+
[CTX] Next: {{next_action}}
|
|
114
|
+
[CTX] Context: {{percent}}% ({{quality}})
|
|
115
|
+
```
|
|
116
|
+
</output_format>
|
package/commands/help.md
CHANGED
|
@@ -4,143 +4,160 @@ description: Show CTX commands and usage guide
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<objective>
|
|
7
|
-
Display the
|
|
7
|
+
Display the CTX 2.1 command reference.
|
|
8
8
|
|
|
9
|
-
Output ONLY the reference content below. Do NOT add project-specific analysis
|
|
9
|
+
Output ONLY the reference content below. Do NOT add project-specific analysis.
|
|
10
10
|
</objective>
|
|
11
11
|
|
|
12
12
|
<reference>
|
|
13
|
-
# CTX Command Reference
|
|
13
|
+
# CTX 2.1 Command Reference
|
|
14
14
|
|
|
15
|
-
**CTX** (
|
|
16
|
-
|
|
15
|
+
**CTX** (Continuous Task eXecution) - Smart workflow orchestration for Claude Code.
|
|
16
|
+
8 commands. Smart routing. Debug loop until 100% fixed.
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
1. /ctx
|
|
22
|
-
2. /ctx
|
|
23
|
-
3. /ctx
|
|
24
|
-
4.
|
|
25
|
-
5. /ctx:ship Final audit
|
|
21
|
+
1. /ctx init Initialize project
|
|
22
|
+
2. /ctx Smart router does the right thing
|
|
23
|
+
3. /ctx status Check progress (read-only)
|
|
24
|
+
4. /ctx pause Checkpoint when needed
|
|
26
25
|
```
|
|
27
26
|
|
|
28
|
-
##
|
|
27
|
+
## The 8 Commands
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|--------|-----|-----|
|
|
32
|
-
| Commands | 27 | 12 |
|
|
33
|
-
| Context management | Manual | Automatic |
|
|
34
|
-
| Research | Separate step | Auto-integrated |
|
|
35
|
-
| Verification | Manual trigger | Built-in |
|
|
36
|
-
| Memory | Files only | Hierarchical + JIT |
|
|
37
|
-
| Resume cost | ~50k+ tokens | ~2-3k tokens |
|
|
29
|
+
### Smart (Auto-routing)
|
|
38
30
|
|
|
39
|
-
|
|
31
|
+
| Command | Purpose |
|
|
32
|
+
|---------|---------|
|
|
33
|
+
| `/ctx` | **Smart router** - reads STATE.md, does the right thing |
|
|
34
|
+
| `/ctx init` | Initialize project with STATE.md |
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
Initialize project. Detects tech stack, maps codebase, creates PROJECT.md.
|
|
36
|
+
### Inspect (Read-only)
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
| Command | Purpose |
|
|
39
|
+
|---------|---------|
|
|
40
|
+
| `/ctx status` | See current state without triggering action |
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
Execute current phase, or run a quick task if argument provided.
|
|
49
|
-
- `/ctx:do` - Execute current phase
|
|
50
|
-
- `/ctx:do "fix the login bug"` - Quick task (bypasses workflow)
|
|
42
|
+
### Control (Override smart router)
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
| Command | Purpose |
|
|
45
|
+
|---------|---------|
|
|
46
|
+
| `/ctx plan [goal]` | Force research + planning |
|
|
47
|
+
| `/ctx verify` | Force three-level verification |
|
|
48
|
+
| `/ctx quick "task"` | Quick task bypass (skip workflow) |
|
|
57
49
|
|
|
58
|
-
|
|
50
|
+
### Session
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
| Command | Purpose |
|
|
53
|
+
|---------|---------|
|
|
54
|
+
| `/ctx pause` | Checkpoint for session resume |
|
|
62
55
|
|
|
63
|
-
|
|
56
|
+
### Phase Management
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
| Command | Purpose |
|
|
59
|
+
|---------|---------|
|
|
60
|
+
| `/ctx phase list` | Show all phases with status |
|
|
61
|
+
| `/ctx phase add "goal"` | Add new phase to roadmap |
|
|
62
|
+
| `/ctx phase next` | Complete current, move to next |
|
|
63
|
+
| `/ctx phase skip` | Skip current phase |
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Smart Router States
|
|
68
|
+
|
|
69
|
+
When you run `/ctx`, it reads STATE.md and auto-routes:
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
| State | What happens |
|
|
72
|
+
|-------|--------------|
|
|
73
|
+
| initializing | Research + Plan (ArguSeek + ChunkHound) |
|
|
74
|
+
| executing | Execute current task |
|
|
75
|
+
| debugging | **Debug loop until 100% fixed** |
|
|
76
|
+
| verifying | Three-level verification |
|
|
77
|
+
| paused | Resume from checkpoint |
|
|
73
78
|
|
|
74
|
-
##
|
|
79
|
+
## Debug Loop
|
|
75
80
|
|
|
76
|
-
|
|
77
|
-
Force-remember something important.
|
|
81
|
+
When something breaks, CTX enters debug mode:
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
```
|
|
84
|
+
Loop (max 5 attempts):
|
|
85
|
+
1. Analyze error
|
|
86
|
+
2. Form hypothesis
|
|
87
|
+
3. Apply fix
|
|
88
|
+
4. Verify (build + tests + browser)
|
|
89
|
+
5. If fixed → done
|
|
90
|
+
If not → new hypothesis, try again
|
|
91
|
+
```
|
|
81
92
|
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
**Browser verification for UI:**
|
|
94
|
+
- Playwright or Chrome DevTools
|
|
95
|
+
- Screenshots saved to `.ctx/debug/`
|
|
84
96
|
|
|
85
|
-
##
|
|
97
|
+
## Three-Level Verification
|
|
86
98
|
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
| Level | Question | Check |
|
|
100
|
+
|-------|----------|-------|
|
|
101
|
+
| Exists | File on disk? | Glob |
|
|
102
|
+
| Substantive | Real code, not stub? | No TODOs, no placeholders |
|
|
103
|
+
| Wired | Imported and used? | Trace imports |
|
|
89
104
|
|
|
90
|
-
|
|
91
|
-
Resume from last checkpoint. Restores full context in ~2-3k tokens.
|
|
105
|
+
## Key Design Principles
|
|
92
106
|
|
|
93
|
-
|
|
94
|
-
|
|
107
|
+
### Atomic Planning (2-3 Tasks Max)
|
|
108
|
+
Prevents context degradation. Big work = multiple phases.
|
|
95
109
|
|
|
96
|
-
|
|
110
|
+
### 95% Auto-Deviation Handling
|
|
111
|
+
| Trigger | Action |
|
|
112
|
+
|---------|--------|
|
|
113
|
+
| Bug in existing code | Auto-fix |
|
|
114
|
+
| Missing validation | Auto-add |
|
|
115
|
+
| Blocking issue | Auto-fix |
|
|
116
|
+
| Architecture decision | Ask user |
|
|
117
|
+
|
|
118
|
+
### Context Budget
|
|
119
|
+
| Usage | Quality | Action |
|
|
120
|
+
|-------|---------|--------|
|
|
121
|
+
| 0-30% | Peak | Continue |
|
|
122
|
+
| 30-50% | Good | Continue |
|
|
123
|
+
| 50%+ | Degrading | Auto-checkpoint |
|
|
124
|
+
|
|
125
|
+
## 5 Specialized Agents
|
|
97
126
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
127
|
+
| Agent | When spawned |
|
|
128
|
+
|-------|--------------|
|
|
129
|
+
| ctx-researcher | During planning (ArguSeek + ChunkHound) |
|
|
130
|
+
| ctx-planner | After research |
|
|
131
|
+
| ctx-executor | During execution |
|
|
132
|
+
| ctx-debugger | When debugging |
|
|
133
|
+
| ctx-verifier | During verification |
|
|
104
134
|
|
|
105
|
-
|
|
106
|
-
Auto-runs during `/ctx:plan`:
|
|
107
|
-
- Semantic search for goal-relevant code
|
|
108
|
-
- Pattern detection
|
|
109
|
-
- Entry point mapping
|
|
135
|
+
## Integrations
|
|
110
136
|
|
|
111
|
-
|
|
137
|
+
- **ArguSeek**: Web research during planning
|
|
138
|
+
- **ChunkHound**: Semantic code search (`uv tool install chunkhound`)
|
|
139
|
+
- **Playwright/DevTools**: Browser verification for UI
|
|
112
140
|
|
|
113
141
|
## Directory Structure
|
|
114
142
|
|
|
115
143
|
```
|
|
116
144
|
.ctx/
|
|
117
|
-
├──
|
|
118
|
-
├──
|
|
119
|
-
├──
|
|
120
|
-
├──
|
|
121
|
-
│
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
├── memory/ # Hierarchical memory
|
|
126
|
-
├── checkpoints/ # Auto-checkpoints
|
|
127
|
-
└── todos/ # Task management
|
|
145
|
+
├── STATE.md # Living digest - ALWAYS read first
|
|
146
|
+
├── phases/{id}/ # Phase data
|
|
147
|
+
│ ├── RESEARCH.md # ArguSeek + ChunkHound results
|
|
148
|
+
│ ├── PLAN.md # 2-3 tasks (atomic)
|
|
149
|
+
│ └── VERIFY.md # Verification report
|
|
150
|
+
├── checkpoints/ # Auto-checkpoints
|
|
151
|
+
├── debug/ # Debug screenshots
|
|
152
|
+
└── verify/ # Verification screenshots
|
|
128
153
|
```
|
|
129
154
|
|
|
130
|
-
## Context Budget
|
|
131
|
-
|
|
132
|
-
| Usage | Quality | Action |
|
|
133
|
-
|-------|---------|--------|
|
|
134
|
-
| 0-30% | Peak | Continue |
|
|
135
|
-
| 30-50% | Good | Continue |
|
|
136
|
-
| 50%+ | Degrading | Auto-checkpoint |
|
|
137
|
-
|
|
138
155
|
## Updating CTX
|
|
139
156
|
|
|
140
|
-
```
|
|
141
|
-
|
|
157
|
+
```bash
|
|
158
|
+
npx ctx-cc --force
|
|
142
159
|
```
|
|
143
160
|
|
|
144
161
|
---
|
|
145
|
-
*CTX -
|
|
162
|
+
*CTX 2.1 - 8 commands, smart routing, debug loop, 100% verified*
|
|
146
163
|
</reference>
|