ctx-cc 2.1.0 → 2.3.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/commands/plan.md CHANGED
@@ -1,73 +1,104 @@
1
1
  ---
2
2
  name: ctx:plan
3
- description: Force research + planning phase regardless of current state
4
- args: goal (optional - new goal to plan for)
3
+ description: Force research + planning phase for current PRD story
4
+ args: story_id (optional - specific story to plan, defaults to current)
5
5
  ---
6
6
 
7
7
  <objective>
8
- Force enter planning mode. Runs research (ArguSeek + ChunkHound) and creates atomic plan.
9
- Use when you want to explicitly plan rather than let smart router decide.
8
+ Force enter planning mode for a PRD story. Reads acceptance criteria from PRD.json,
9
+ runs research (ArguSeek + ChunkHound), and creates atomic plan to satisfy the story.
10
10
  </objective>
11
11
 
12
12
  <usage>
13
13
  ```
14
- /ctx plan # Re-plan current phase goal
15
- /ctx plan "add user auth" # Plan for new goal
14
+ /ctx plan # Plan for current story (from PRD.json)
15
+ /ctx plan S003 # Plan for specific story
16
16
  ```
17
17
  </usage>
18
18
 
19
19
  <workflow>
20
20
  ## Step 1: Validate Project
21
- If `.ctx/STATE.md` doesn't exist:
21
+ If `.ctx/STATE.md` or `.ctx/PRD.json` doesn't exist:
22
22
  - Error: "No project found. Run /ctx init first."
23
23
 
24
- ## Step 2: Determine Goal
25
- If goal argument provided:
26
- - Use provided goal
27
- - Create new phase if needed
24
+ ## Step 2: Load Story from PRD
25
+ Read `.ctx/PRD.json`:
28
26
 
29
- If no goal argument:
30
- - Use current phase goal from STATE.md
31
- - If no current phase, ask user for goal
27
+ If story_id argument provided:
28
+ - Find story with matching id
29
+ - Error if not found
30
+
31
+ If no argument:
32
+ - Use `metadata.currentStory` from PRD.json
33
+ - If null, use first story where `passes: false`
34
+
35
+ **Story data provides:**
36
+ - `title` → Phase goal
37
+ - `description` → Context for research
38
+ - `acceptanceCriteria` → Verification checklist
32
39
 
33
40
  ## Step 3: Research Phase
34
- Spawn **ctx-researcher** agent:
41
+ Spawn **ctx-researcher** agent with story context:
35
42
 
36
43
  1. **ArguSeek Research**
37
- - Best practices for goal
44
+ - Best practices for story goal
38
45
  - Security considerations
39
- - Common pitfalls
46
+ - Common pitfalls for acceptance criteria
40
47
  - Performance patterns
41
48
 
42
49
  2. **ChunkHound Analysis** (if available)
43
- - Semantic search for related code
50
+ - Semantic search for story-related code
44
51
  - Pattern detection
45
52
  - Entry point mapping
46
53
 
47
- 3. **Output**: `.ctx/phases/{id}/RESEARCH.md`
54
+ 3. **Output**: `.ctx/phases/{story_id}/RESEARCH.md`
48
55
 
49
56
  ## Step 4: Planning Phase
50
57
  Spawn **ctx-planner** agent:
51
58
 
52
59
  1. Read RESEARCH.md
53
- 2. Define verification criteria
60
+ 2. Map acceptance criteria to verification steps
54
61
  3. Break into **2-3 atomic tasks** (strict limit)
55
- 4. Assign execution order
56
-
57
- Output: `.ctx/phases/{id}/PLAN.md`
62
+ 4. Each task contributes to passing acceptance criteria
63
+ 5. Assign execution order
64
+
65
+ Output: `.ctx/phases/{story_id}/PLAN.md`
66
+
67
+ **Plan Format:**
68
+ ```yaml
69
+ story: S001
70
+ title: "{{story_title}}"
71
+ acceptanceCriteria:
72
+ - criterion: "{{criterion_1}}"
73
+ tasks: [1]
74
+ - criterion: "{{criterion_2}}"
75
+ tasks: [1, 2]
76
+ tasks:
77
+ - id: 1
78
+ title: "{{task_title}}"
79
+ criteria: ["{{criterion_1}}", "{{criterion_2}}"]
80
+ ```
58
81
 
59
82
  ## Step 5: Update State
60
83
  Update STATE.md:
61
84
  - Status: "executing"
62
- - Current phase: {id}
63
- - Phase goal: {goal}
85
+ - Current Story: {story_id} - {title}
86
+ - Phase goal: {story_title}
64
87
  - Total tasks: {count}
65
88
  - Completed: 0
89
+
90
+ Update PRD.json:
91
+ - `metadata.currentStory`: {story_id}
66
92
  </workflow>
67
93
 
68
94
  <output_format>
69
95
  ```
70
- [CTX Plan] Goal: {goal}
96
+ [CTX Plan] Story: {story_id} - {title}
97
+
98
+ Acceptance Criteria:
99
+ ✓ {criterion_1}
100
+ ✓ {criterion_2}
101
+ ✓ {criterion_3}
71
102
 
72
103
  Research:
73
104
  ArguSeek: {n} findings
@@ -75,12 +106,11 @@ Research:
75
106
 
76
107
  Plan Created:
77
108
  Tasks: {count} (atomic)
78
- Files: .ctx/phases/{id}/PLAN.md
109
+ Files: .ctx/phases/{story_id}/PLAN.md
79
110
 
80
111
  Tasks:
81
- 1. {task_1_title}
82
- 2. {task_2_title}
83
- 3. {task_3_title} (if exists)
112
+ 1. {task_1_title} → [criteria 1, 2]
113
+ 2. {task_2_title} → [criteria 2, 3]
84
114
 
85
115
  Ready to execute. Run /ctx to start.
86
116
  ```
@@ -88,6 +118,8 @@ Ready to execute. Run /ctx to start.
88
118
 
89
119
  <guardrails>
90
120
  - Plans are ALWAYS atomic: 2-3 tasks maximum
91
- - If goal requires more, split into multiple phases
121
+ - Each task must map to at least one acceptance criterion
122
+ - If story requires more tasks, ask user to split into smaller stories
92
123
  - Research runs even if ChunkHound unavailable (ArguSeek only)
124
+ - Story acceptance criteria = verification checklist
93
125
  </guardrails>
@@ -1,11 +1,10 @@
1
1
  ---
2
2
  name: ctx:verify
3
- description: Force three-level verification regardless of current state
3
+ description: Force verification of current story against PRD acceptance criteria
4
4
  ---
5
5
 
6
6
  <objective>
7
- Force verification of current phase. Runs three-level check + anti-pattern scan + browser verification.
8
- Use when you want to verify work before smart router would normally trigger it.
7
+ Verify current story against PRD.json acceptance criteria. Runs three-level check + anti-pattern scan + browser verification. On success, marks story as `passes: true` in PRD.json.
9
8
  </objective>
10
9
 
11
10
  <usage>
@@ -17,17 +16,21 @@ Use when you want to verify work before smart router would normally trigger it.
17
16
 
18
17
  <workflow>
19
18
  ## Step 1: Validate Project
20
- If `.ctx/STATE.md` doesn't exist:
19
+ If `.ctx/STATE.md` or `.ctx/PRD.json` doesn't exist:
21
20
  - Error: "No project found. Run /ctx init first."
22
21
 
23
- If no current phase:
24
- - Error: "No phase to verify. Run /ctx plan first."
22
+ If no current story (all `passes: true`):
23
+ - Info: "All stories verified! PRD complete."
25
24
 
26
25
  ## Step 2: Load Context
27
26
  Read:
27
+ - `.ctx/PRD.json` - current story and acceptance criteria
28
28
  - `.ctx/STATE.md` - current state
29
- - `.ctx/phases/{id}/PLAN.md` - verification criteria
30
- - Original phase goal
29
+ - `.ctx/phases/{story_id}/PLAN.md` - task-to-criteria mapping
30
+
31
+ **Key data:**
32
+ - `story.acceptanceCriteria` → What to verify
33
+ - `plan.tasks[].criteria` → How tasks map to criteria
31
34
 
32
35
  ## Step 3: Three-Level Verification
33
36
  Spawn **ctx-verifier** agent:
@@ -75,18 +78,61 @@ If phase involves UI or `--browser` flag:
75
78
  4. Take screenshot proof
76
79
  5. Save to `.ctx/verify/phase-{id}.png`
77
80
 
78
- ## Step 6: Generate Report
79
- Write `.ctx/phases/{id}/VERIFY.md`
81
+ ## Step 6: Verify Acceptance Criteria
82
+ For each criterion in story.acceptanceCriteria:
83
+ - Check if criterion is satisfied
84
+ - Map to three-level results
85
+ - Document evidence
86
+
87
+ ## Step 7: Generate Report
88
+ Write `.ctx/phases/{story_id}/VERIFY.md`:
89
+ ```yaml
90
+ story: S001
91
+ title: "{{story_title}}"
92
+ result: PASS|FAIL
93
+ criteria:
94
+ - criterion: "{{criterion_1}}"
95
+ status: PASS|FAIL
96
+ evidence: "{{what proved it}}"
97
+ - criterion: "{{criterion_2}}"
98
+ status: PASS|FAIL
99
+ evidence: "{{what proved it}}"
100
+ timestamp: "{{ISO8601}}"
101
+ ```
102
+
103
+ ## Step 8: Update PRD.json
104
+ If ALL criteria pass:
105
+ ```json
106
+ {
107
+ "stories[current].passes": true,
108
+ "stories[current].verifiedAt": "{{timestamp}}",
109
+ "metadata.passedStories": "{{increment}}",
110
+ "metadata.currentStory": "{{next_unpassed_story_id or null}}"
111
+ }
112
+ ```
80
113
 
81
- ## Step 7: Update State
114
+ If ANY criterion fails:
115
+ - Keep `passes: false`
116
+ - Add failure notes to `stories[current].notes`
117
+
118
+ ## Step 9: Update STATE.md
82
119
  Based on results:
83
- - **PASS**: Log success, ready for next phase
84
- - **FAIL**: Create fix tasks, set status = "executing"
120
+ - **PASS**:
121
+ - Set status to "initializing" for next story
122
+ - Update current story reference
123
+ - **FAIL**:
124
+ - Create fix tasks
125
+ - Set status = "debugging" or "executing"
85
126
  </workflow>
86
127
 
87
128
  <output_format>
88
129
  ```
89
- [CTX Verify] Phase: {id} - {goal}
130
+ [CTX Verify] Story: {story_id} - {title}
131
+
132
+ Acceptance Criteria:
133
+ ✓ {criterion_1} - PASS
134
+ ✓ {criterion_2} - PASS
135
+ ✗ {criterion_3} - FAIL: {reason}
90
136
 
91
137
  Three-Level Check:
92
138
  ✓ Exists: {pass}/{total}
@@ -101,17 +147,21 @@ Anti-Pattern Scan:
101
147
  Browser Verification:
102
148
  URL: {url}
103
149
  Status: PASS/FAIL
104
- Screenshot: .ctx/verify/phase-{id}.png
150
+ Screenshot: .ctx/verify/story-{id}.png
105
151
 
106
152
  Overall: {PASS / FAIL}
107
153
 
108
154
  {If FAIL:}
109
155
  Fixes Required:
110
- 1. {fix_1}
156
+ 1. {fix_1} → [criterion 3]
111
157
  2. {fix_2}
112
158
 
113
159
  {If PASS:}
114
- Phase verified. Run /ctx to continue.
160
+ Story {story_id} verified!
161
+ PRD Progress: {passed}/{total} stories ({percent}%)
162
+
163
+ Next Story: {next_story_id} - {next_title}
164
+ Run /ctx to start planning.
115
165
  ```
116
166
  </output_format>
117
167
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ctx-cc",
3
- "version": "2.1.0",
4
- "description": "CTX 2.0 (Continuous Task eXecution) - Smart workflow orchestration for Claude Code. 4 commands, debug loop, 100% verified.",
3
+ "version": "2.3.0",
4
+ "description": "CTX 2.3 (Continuous Task eXecution) - PRD-driven, design-first workflow orchestration for Claude Code. WCAG 2.2 AA, W3C tokens, story-verified, debug loop until 100% fixed.",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
package/src/install.js CHANGED
@@ -28,9 +28,9 @@ function printBanner() {
28
28
  ╚██████╗ ██║ ██╔╝ ██╗
29
29
  ╚═════╝ ╚═╝ ╚═╝ ╚═╝
30
30
  `));
31
- console.log(` ${bold('CTX 2.1')} ${dim(`v${VERSION}`)}`);
32
- console.log(' Continuous Task eXecution for Claude Code.');
33
- console.log(' 8 commands. Smart routing. Debug loop.\n');
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');
34
34
  }
35
35
 
36
36
  function copyDir(src, dest) {
@@ -0,0 +1,265 @@
1
+ # Brand Kit - {{project_name}}
2
+
3
+ **Created:** {{timestamp}}
4
+ **Approved:** {{approval_date}}
5
+ **Version:** 1.0
6
+ **Token Format:** W3C Design Tokens (DTCG)
7
+
8
+ ---
9
+
10
+ ## Brand Essence
11
+
12
+ ### Mission
13
+ {{mission_statement}}
14
+
15
+ ### Personality
16
+ {{personality_adjectives}}
17
+
18
+ ### Target Audience
19
+ {{target_audience}}
20
+
21
+ ### Visual Mood
22
+ {{visual_mood_description}}
23
+
24
+ ---
25
+
26
+ ## Token Architecture
27
+
28
+ ### Three-Tier Structure
29
+ ```
30
+ tokens/
31
+ ├── primitive.tokens.json # Raw values (colors, sizes)
32
+ ├── semantic.tokens.json # Purpose-based aliases + modes
33
+ └── component.tokens.json # Component-specific tokens
34
+ ```
35
+
36
+ ### Mode Support
37
+ - Light mode (default)
38
+ - Dark mode
39
+ {{additional_modes}}
40
+
41
+ ---
42
+
43
+ ## Color System
44
+
45
+ ### Primitive Colors
46
+ | Token | Light Mode | Dark Mode |
47
+ |-------|------------|-----------|
48
+ | gray-50 | #FAFAFA | #171717 |
49
+ | gray-100 | #F4F4F5 | #27272A |
50
+ | gray-200 | #E4E4E7 | #3F3F46 |
51
+ | gray-300 | #D4D4D8 | #52525B |
52
+ | gray-400 | #A1A1AA | #71717A |
53
+ | gray-500 | #71717A | #A1A1AA |
54
+ | gray-600 | #52525B | #D4D4D8 |
55
+ | gray-700 | #3F3F46 | #E4E4E7 |
56
+ | gray-800 | #27272A | #F4F4F5 |
57
+ | gray-900 | #18181B | #FAFAFA |
58
+ | {{primary_color_name}} | {{primary_light}} | {{primary_dark}} |
59
+
60
+ ### Semantic Colors
61
+ | Token | References | Usage |
62
+ |-------|------------|-------|
63
+ | background-primary | {gray-50} | Page backgrounds |
64
+ | background-surface | {gray-100} | Cards, modals |
65
+ | text-primary | {gray-900} | Body text |
66
+ | text-secondary | {gray-600} | Captions, hints |
67
+ | interactive | {{{primary_color}}} | CTAs, links |
68
+ | interactive-hover | {{{primary_hover}}} | Hover states |
69
+
70
+ ### State Colors
71
+ | State | Color | Hex |
72
+ |-------|-------|-----|
73
+ | success | green-500 | #22C55E |
74
+ | warning | amber-500 | #F59E0B |
75
+ | error | red-500 | #EF4444 |
76
+ | info | blue-500 | #3B82F6 |
77
+
78
+ ### Accessibility Compliance
79
+ | Combination | Ratio | WCAG 2.2 |
80
+ |-------------|-------|----------|
81
+ | text-primary on background | {{ratio_1}} | AA Pass |
82
+ | text-secondary on background | {{ratio_2}} | AA Pass |
83
+ | interactive on background | {{ratio_3}} | AA Pass |
84
+
85
+ ---
86
+
87
+ ## Typography
88
+
89
+ ### Font Stack
90
+ | Role | Font Family | Fallback |
91
+ |------|-------------|----------|
92
+ | Heading | {{heading_font}} | system-ui, sans-serif |
93
+ | Body | {{body_font}} | system-ui, sans-serif |
94
+ | Mono | {{mono_font}} | ui-monospace, monospace |
95
+
96
+ ### Type Scale (Desktop)
97
+ | Level | Size | Line Height | Weight | Letter Spacing |
98
+ |-------|------|-------------|--------|----------------|
99
+ | display | 48px | 1.1 | 700 | -0.02em |
100
+ | h1 | 36px | 1.2 | 600 | -0.01em |
101
+ | h2 | 28px | 1.3 | 600 | 0 |
102
+ | h3 | 22px | 1.4 | 500 | 0 |
103
+ | body-lg | 18px | 1.6 | 400 | 0 |
104
+ | body | 16px | 1.5 | 400 | 0 |
105
+ | body-sm | 14px | 1.5 | 400 | 0 |
106
+ | caption | 12px | 1.4 | 400 | 0.01em |
107
+
108
+ ### Responsive Scale
109
+ | Level | Mobile | Tablet | Desktop |
110
+ |-------|--------|--------|---------|
111
+ | display | 32px | 40px | 48px |
112
+ | h1 | 28px | 32px | 36px |
113
+ | h2 | 22px | 24px | 28px |
114
+
115
+ ---
116
+
117
+ ## Spacing & Layout
118
+
119
+ ### Base Scale (4px grid)
120
+ | Token | Value | Usage |
121
+ |-------|-------|-------|
122
+ | space-0 | 0px | Reset |
123
+ | space-1 | 4px | Tight inline |
124
+ | space-2 | 8px | Related elements |
125
+ | space-3 | 12px | Form gaps |
126
+ | space-4 | 16px | Default gap |
127
+ | space-6 | 24px | Section padding |
128
+ | space-8 | 32px | Card padding |
129
+ | space-12 | 48px | Section gaps |
130
+ | space-16 | 64px | Page sections |
131
+ | space-24 | 96px | Hero spacing |
132
+
133
+ ### Border Radius
134
+ | Token | Value | Usage |
135
+ |-------|-------|-------|
136
+ | radius-sm | 4px | Small elements |
137
+ | radius-md | 8px | Default |
138
+ | radius-lg | 12px | Cards |
139
+ | radius-full | 9999px | Pills, avatars |
140
+
141
+ ### Breakpoints
142
+ | Token | Value | Target |
143
+ |-------|-------|--------|
144
+ | breakpoint-sm | 640px | Mobile landscape |
145
+ | breakpoint-md | 768px | Tablet |
146
+ | breakpoint-lg | 1024px | Desktop |
147
+ | breakpoint-xl | 1280px | Large desktop |
148
+
149
+ ---
150
+
151
+ ## Motion
152
+
153
+ ### Duration
154
+ | Token | Value | Usage |
155
+ |-------|-------|-------|
156
+ | duration-instant | 0ms | No animation |
157
+ | duration-fast | 100ms | Micro-interactions |
158
+ | duration-normal | 200ms | Standard transitions |
159
+ | duration-slow | 300ms | Emphasis |
160
+ | duration-slower | 500ms | Page transitions |
161
+
162
+ ### Easing
163
+ | Token | Value | Usage |
164
+ |-------|-------|-------|
165
+ | ease-linear | linear | Progress bars |
166
+ | ease-in | cubic-bezier(0.4, 0, 1, 1) | Exit animations |
167
+ | ease-out | cubic-bezier(0, 0, 0.2, 1) | Enter animations |
168
+ | ease-in-out | cubic-bezier(0.4, 0, 0.2, 1) | Standard |
169
+ | ease-bounce | cubic-bezier(0.34, 1.56, 0.64, 1) | Playful |
170
+
171
+ ### Common Animations
172
+ | Token | Duration | Easing | Usage |
173
+ |-------|----------|--------|-------|
174
+ | transition-colors | 150ms | ease-out | Hover states |
175
+ | transition-transform | 200ms | ease-out | Scale/move |
176
+ | transition-opacity | 200ms | ease-in-out | Fade |
177
+ | transition-all | 200ms | ease-in-out | Complex |
178
+
179
+ ---
180
+
181
+ ## Accessibility Requirements
182
+
183
+ ### WCAG 2.2 Level AA (Required)
184
+ - [x] 1.4.3 Contrast (Minimum) - 4.5:1 text
185
+ - [x] 1.4.11 Non-text Contrast - 3:1 UI components
186
+ - [x] 2.4.11 Focus Not Obscured (Minimum)
187
+ - [x] 2.5.7 Dragging Movements - alternatives provided
188
+ - [x] 2.5.8 Target Size (Minimum) - 24x24px minimum
189
+ - [x] 3.3.8 Accessible Authentication (Minimum)
190
+
191
+ ### EAA 2025 Compliance (EU Markets)
192
+ European Accessibility Act enforcement: June 28, 2025
193
+ - All WCAG 2.2 AA criteria
194
+ - EN 301 549 v3.2.1 alignment
195
+
196
+ ---
197
+
198
+ ## Visual Guidelines
199
+
200
+ ### Do's
201
+ - Use semantic tokens, not primitives, in components
202
+ - Maintain 4px grid alignment
203
+ - Test all color combinations for contrast
204
+ - Provide alternatives to dragging interactions
205
+ - Ensure 24x24px minimum touch targets
206
+ - Use focus-visible for keyboard focus states
207
+
208
+ ### Don'ts
209
+ - Don't use color alone to convey information
210
+ - Don't use hardcoded values (use tokens)
211
+ - Don't skip focus states
212
+ - Don't obscure focused elements with overlays
213
+ - Don't require cognitive function tests for auth
214
+ - Don't disable paste in password fields
215
+
216
+ ---
217
+
218
+ ## Asset Locations
219
+
220
+ ```
221
+ project/
222
+ ├── BRAND_KIT.md # This document
223
+ ├── tokens/
224
+ │ ├── primitive.tokens.json # Raw values
225
+ │ ├── semantic.tokens.json # Semantic + modes
226
+ │ └── component.tokens.json # Component tokens
227
+ ├── brand-assets/
228
+ │ ├── tokens.css # CSS custom properties
229
+ │ ├── tokens.scss # SCSS variables
230
+ │ ├── tokens.js # JS constants
231
+ │ ├── tailwind.config.js # Tailwind theme
232
+ │ └── style-dictionary.config.json
233
+ ├── design-references/
234
+ │ └── [screenshots]
235
+ └── logo/
236
+ ├── logo-primary.svg
237
+ ├── logo-light.svg
238
+ └── logo-dark.svg
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Export Commands
244
+
245
+ ```bash
246
+ # Using Style Dictionary
247
+ npx style-dictionary build --config style-dictionary.config.json
248
+
249
+ # Or run /ctx with design token update
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Approval History
255
+
256
+ | Date | Approved By | Notes |
257
+ |------|-------------|-------|
258
+ | {{mood_board_date}} | {{user}} | Mood board approved |
259
+ | {{direction_date}} | {{user}} | Direction selected: Option {{option}} |
260
+ | {{final_date}} | {{user}} | Final brand kit approved |
261
+
262
+ ---
263
+
264
+ **This document is the source of truth for all visual decisions.**
265
+ **All design work MUST reference this kit.**