ctx-cc 2.2.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.
@@ -1,17 +1,32 @@
1
1
  ---
2
2
  name: ctx-verifier
3
- description: Verification agent for CTX 2.1. Verifies story against PRD acceptance criteria. Updates passes flag on success. Spawned when status = "verifying".
4
- tools: Read, Write, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*
3
+ description: Verification agent for CTX 2.3. Verifies story against PRD acceptance criteria including design stories. Updates passes flag on success. Spawned when status = "verifying".
4
+ tools: Read, Write, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*, mcp__gemini-design__*
5
5
  color: red
6
6
  ---
7
7
 
8
8
  <role>
9
- You are a CTX 2.1 verifier. Your job is to verify story completion against PRD acceptance criteria.
9
+ You are a CTX 2.3 verifier. Your job is to verify story completion against PRD acceptance criteria.
10
10
 
11
- You verify:
12
- 1. **Acceptance Criteria** - Each criterion from PRD.json satisfied?
13
- 2. **Three-Level Check** - Exists → Substantive → Wired
14
- 3. **Anti-Patterns** - No TODO, stubs, or broken code
11
+ You verify based on story type:
12
+
13
+ **Feature Stories:**
14
+ 1. Acceptance Criteria - Each criterion satisfied?
15
+ 2. Three-Level Check - Exists → Substantive → Wired
16
+ 3. Anti-Patterns - No TODO, stubs, or broken code
17
+
18
+ **Brand Stories:**
19
+ 1. BRAND_KIT.md exists and complete
20
+ 2. tokens/ directory with W3C format
21
+ 3. Accessibility ratios documented
22
+ 4. All approval gates recorded
23
+
24
+ **Design Stories:**
25
+ 1. Component implements approved direction
26
+ 2. WCAG 2.2 AA compliance verified
27
+ 3. All states implemented
28
+ 4. DESIGN_BRIEF.md complete
29
+ 5. Visual match to prototype
15
30
 
16
31
  On success: Set `story.passes = true` in PRD.json
17
32
  On failure: List fixes needed, keep `passes = false`
@@ -165,7 +180,122 @@ Read .ctx/.env:
165
180
 
166
181
  Save screenshots to `.ctx/verify/story-{id}-verified.png`
167
182
 
168
- ## 6. Goal Gap Analysis
183
+ ## 6. Design Story Verification
184
+
185
+ **If story.type === "brand":**
186
+
187
+ ### Brand Kit Verification
188
+ ```
189
+ [ ] BRAND_KIT.md exists at project root
190
+ [ ] tokens/primitive.tokens.json exists
191
+ [ ] tokens/semantic.tokens.json exists
192
+ [ ] tokens/component.tokens.json exists
193
+ [ ] brand-assets/ directory with exports
194
+ ```
195
+
196
+ ### Token Format Validation
197
+ ```
198
+ Check W3C Design Tokens format:
199
+ - $schema reference present
200
+ - $type on groups
201
+ - $value on tokens
202
+ - Mode support (light/dark)
203
+ ```
204
+
205
+ ### Accessibility Ratios
206
+ ```
207
+ Verify documented contrast ratios:
208
+ - text-primary on background: >= 4.5:1
209
+ - text-secondary on background: >= 4.5:1
210
+ - interactive on background: >= 3:1
211
+ ```
212
+
213
+ ### Approval Gates
214
+ ```
215
+ Check BRAND_KIT.md for:
216
+ [ ] Mood board approval date
217
+ [ ] Direction selection (A/B/C)
218
+ [ ] Final approval date
219
+ ```
220
+
221
+ ---
222
+
223
+ **If story.type === "design":**
224
+
225
+ ### Component Verification
226
+ ```
227
+ [ ] Component file exists
228
+ [ ] Uses brand tokens (no hardcoded values)
229
+ [ ] All states implemented (default, hover, focus, disabled, etc.)
230
+ [ ] Responsive at all breakpoints
231
+ ```
232
+
233
+ ### WCAG 2.2 AA Compliance
234
+
235
+ Run automated checks:
236
+ ```javascript
237
+ // Target Size (2.5.8)
238
+ mcp__playwright__browser_evaluate({
239
+ function: `
240
+ const issues = [];
241
+ document.querySelectorAll('a, button, input, select, textarea, [role="button"]')
242
+ .forEach(el => {
243
+ const rect = el.getBoundingClientRect();
244
+ if (rect.width < 24 || rect.height < 24) {
245
+ issues.push({
246
+ element: el.tagName,
247
+ size: rect.width + 'x' + rect.height,
248
+ issue: 'Below 24x24px minimum'
249
+ });
250
+ }
251
+ });
252
+ return issues;
253
+ `
254
+ })
255
+
256
+ // Focus Visible (2.4.7)
257
+ mcp__playwright__browser_evaluate({
258
+ function: `
259
+ const focusable = document.querySelectorAll('a, button, input, select, textarea, [tabindex]');
260
+ const issues = [];
261
+ focusable.forEach(el => {
262
+ el.focus();
263
+ const styles = getComputedStyle(el);
264
+ if (!styles.outline && !styles.boxShadow) {
265
+ issues.push({ element: el.tagName, issue: 'No focus indicator' });
266
+ }
267
+ });
268
+ return issues;
269
+ `
270
+ })
271
+ ```
272
+
273
+ ### Visual Match
274
+ ```
275
+ Compare implementation to prototype:
276
+ 1. Navigate to component page
277
+ 2. Take screenshot at each breakpoint
278
+ 3. Compare to .ctx/phases/{story_id}/prototype.png
279
+ 4. Note any visual differences
280
+ ```
281
+
282
+ ### Design Brief Completeness
283
+ ```
284
+ Check .ctx/phases/{story_id}/DESIGN_BRIEF.md:
285
+ [ ] All approval gates recorded
286
+ [ ] Implementation files listed
287
+ [ ] Accessibility compliance documented
288
+ [ ] Verification checklist complete
289
+ ```
290
+
291
+ ### Storybook Verification (if applicable)
292
+ ```
293
+ [ ] Story file exists
294
+ [ ] All variants documented
295
+ [ ] A11y addon passes
296
+ ```
297
+
298
+ ## 7. Goal Gap Analysis
169
299
 
170
300
  Compare goal vs implementation:
171
301
  1. What was the original goal?
@@ -173,7 +303,7 @@ Compare goal vs implementation:
173
303
  3. What's missing (gaps)?
174
304
  4. What's extra (drift)?
175
305
 
176
- ## 7. Generate VERIFY.md
306
+ ## 8. Generate VERIFY.md
177
307
 
178
308
  Write `.ctx/phases/{story_id}/VERIFY.md`:
179
309
 
@@ -181,6 +311,7 @@ Write `.ctx/phases/{story_id}/VERIFY.md`:
181
311
  # Verification Report
182
312
 
183
313
  **Story:** {story_id} - {story_title}
314
+ **Type:** {story_type}
184
315
  **Date:** {timestamp}
185
316
 
186
317
  ## Acceptance Criteria
@@ -210,13 +341,39 @@ Write `.ctx/phases/{story_id}/VERIFY.md`:
210
341
  - Screenshot: .ctx/verify/story-{id}.png
211
342
  - Status: PASS/FAIL
212
343
 
344
+ ## Design Verification (if design/brand story)
345
+
346
+ ### Brand Kit (if type=brand)
347
+ | Artifact | Status |
348
+ |----------|--------|
349
+ | BRAND_KIT.md | ✓/✗ |
350
+ | primitive.tokens.json | ✓/✗ |
351
+ | semantic.tokens.json | ✓/✗ |
352
+ | component.tokens.json | ✓/✗ |
353
+ | Approval gates | ✓/✗ |
354
+
355
+ ### WCAG 2.2 AA (if type=design)
356
+ | Criterion | Status | Notes |
357
+ |-----------|--------|-------|
358
+ | 2.4.7 Focus Visible | ✓/✗ | {notes} |
359
+ | 2.4.11 Focus Not Obscured | ✓/✗ | {notes} |
360
+ | 2.5.7 Dragging | ✓/✗/N/A | {notes} |
361
+ | 2.5.8 Target Size (24px) | ✓/✗ | {notes} |
362
+
363
+ ### Visual Match
364
+ | Breakpoint | Match | Screenshot |
365
+ |------------|-------|------------|
366
+ | Mobile | ✓/✗ | .ctx/verify/{id}-mobile.png |
367
+ | Tablet | ✓/✗ | .ctx/verify/{id}-tablet.png |
368
+ | Desktop | ✓/✗ | .ctx/verify/{id}-desktop.png |
369
+
213
370
  ## Overall: {PASS / FAIL}
214
371
 
215
372
  {If FAIL: list required fixes with criterion mapping}
216
373
  {If PASS: story verified}
217
374
  ```
218
375
 
219
- ## 8. Update PRD.json
376
+ ## 9. Update PRD.json
220
377
 
221
378
  **If ALL criteria PASS:**
222
379
  ```json
@@ -232,7 +389,7 @@ Write `.ctx/phases/{story_id}/VERIFY.md`:
232
389
  - Keep `passes: false`
233
390
  - Add failure details to `stories[story_id].notes`
234
391
 
235
- ## 9. Update STATE.md
392
+ ## 10. Update STATE.md
236
393
 
237
394
  Based on results:
238
395
 
package/commands/help.md CHANGED
@@ -4,16 +4,16 @@ description: Show CTX commands and usage guide
4
4
  ---
5
5
 
6
6
  <objective>
7
- Display the CTX 2.2 command reference.
7
+ Display the CTX 2.3 command reference.
8
8
 
9
9
  Output ONLY the reference content below. Do NOT add project-specific analysis.
10
10
  </objective>
11
11
 
12
12
  <reference>
13
- # CTX 2.2 Command Reference
13
+ # CTX 2.3 Command Reference
14
14
 
15
15
  **CTX** (Continuous Task eXecution) - Smart workflow orchestration for Claude Code.
16
- 8 commands. PRD-driven. Smart routing. Debug loop until 100% fixed.
16
+ 8 commands. PRD-driven. Design-first. Smart routing. Debug loop until 100% fixed.
17
17
 
18
18
  ## Quick Start
19
19
 
@@ -24,7 +24,17 @@ Output ONLY the reference content below. Do NOT add project-specific analysis.
24
24
  4. /ctx pause Checkpoint when needed
25
25
  ```
26
26
 
27
- ## What's New in 2.2
27
+ ## What's New in 2.3
28
+
29
+ - **Design System Integration** - Full brand + UI design workflow
30
+ - **ctx-designer Agent** - WCAG 2.2 AA, W3C tokens, Figma MCP, Gemini
31
+ - **Story Types** - feature, brand, design, fix, refactor
32
+ - **3 Options Pattern** - Always present A/B/C for design decisions
33
+ - **Visual Approval Gates** - Mood board → Direction → Prototype → Final
34
+ - **BRAND_KIT.md** - Visual foundation with W3C design tokens
35
+ - **EAA 2025 Ready** - European Accessibility Act compliance
36
+
37
+ ## What's in 2.2
28
38
 
29
39
  - **Front-Loaded Approach** - Gather ALL info upfront, execute autonomously
30
40
  - **PRD.json** - Requirements contract with user stories
@@ -131,6 +141,47 @@ Loop (max 5 attempts):
131
141
  | Substantive | Real code, not stub? | No TODOs, no placeholders |
132
142
  | Wired | Imported and used? | Trace imports |
133
143
 
144
+ ## Design Workflow
145
+
146
+ CTX handles visual work with dedicated agents and approval gates.
147
+
148
+ ### Story Types
149
+ | Type | Agent | Purpose |
150
+ |------|-------|---------|
151
+ | feature | ctx-executor | Standard implementation |
152
+ | brand | ctx-designer | BRAND_KIT.md + tokens |
153
+ | design | ctx-designer | UI components/pages |
154
+ | fix | ctx-debugger | Bug fixes |
155
+ | refactor | ctx-executor | Code improvements |
156
+
157
+ ### Design Approval Gates
158
+ ```
159
+ Mood Board → Direction (A/B/C) → Prototype → Final
160
+ ```
161
+ Each gate requires user approval before proceeding.
162
+
163
+ ### 3 Options Pattern
164
+ All design decisions present:
165
+ - **Option A**: Conservative (safe, proven)
166
+ - **Option B**: Balanced (recommended)
167
+ - **Option C**: Bold (distinctive)
168
+
169
+ ### WCAG 2.2 AA Compliance
170
+ | Criterion | Requirement |
171
+ |-----------|-------------|
172
+ | 2.4.11 | Focus not obscured |
173
+ | 2.5.7 | Drag alternatives |
174
+ | 2.5.8 | 24x24px targets |
175
+ | 3.3.8 | Accessible auth |
176
+
177
+ ### W3C Design Tokens
178
+ ```
179
+ tokens/
180
+ ├── primitive.tokens.json # Raw values
181
+ ├── semantic.tokens.json # Purpose aliases
182
+ └── component.tokens.json # Component-specific
183
+ ```
184
+
134
185
  ## Key Design Principles
135
186
 
136
187
  ### Atomic Planning (2-3 Tasks Max)
@@ -151,13 +202,14 @@ Prevents context degradation. Big work = multiple phases.
151
202
  | 30-50% | Good | Continue |
152
203
  | 50%+ | Degrading | Auto-checkpoint |
153
204
 
154
- ## 5 Specialized Agents
205
+ ## 6 Specialized Agents
155
206
 
156
207
  | Agent | When spawned |
157
208
  |-------|--------------|
158
209
  | ctx-researcher | During planning (ArguSeek + ChunkHound) |
159
210
  | ctx-planner | After research |
160
- | ctx-executor | During execution |
211
+ | ctx-executor | During execution (feature stories) |
212
+ | ctx-designer | During execution (brand/design stories) |
161
213
  | ctx-debugger | When debugging |
162
214
  | ctx-verifier | During verification |
163
215
 
@@ -166,6 +218,8 @@ Prevents context degradation. Big work = multiple phases.
166
218
  - **ArguSeek**: Web research during planning
167
219
  - **ChunkHound**: Semantic code search (`uv tool install chunkhound`)
168
220
  - **Playwright/DevTools**: Browser verification for UI
221
+ - **Figma MCP**: Design context extraction and screenshots
222
+ - **Gemini Design**: Image generation and UI code generation
169
223
 
170
224
  ## Directory Structure
171
225
 
@@ -178,21 +232,48 @@ Prevents context degradation. Big work = multiple phases.
178
232
  ├── phases/{story_id}/ # Per-story data
179
233
  │ ├── RESEARCH.md # ArguSeek + ChunkHound results
180
234
  │ ├── PLAN.md # Tasks mapped to acceptance criteria
181
- └── VERIFY.md # Verification report
235
+ ├── VERIFY.md # Verification report
236
+ │ ├── MOOD_BOARD.md # Design references (design stories)
237
+ │ └── DESIGN_BRIEF.md # Design decisions (design stories)
182
238
  ├── checkpoints/ # Auto-checkpoints
183
239
  ├── debug/ # Debug screenshots
184
240
  └── verify/ # Verification screenshots
241
+
242
+ project/
243
+ ├── BRAND_KIT.md # Visual foundation (brand stories)
244
+ └── tokens/ # W3C design tokens
245
+ ├── primitive.tokens.json
246
+ ├── semantic.tokens.json
247
+ └── component.tokens.json
185
248
  ```
186
249
 
187
250
  ## PRD.json Structure
188
251
 
189
252
  ```json
190
253
  {
254
+ "brand": {
255
+ "hasBrandKit": false,
256
+ "personality": ["professional", "modern"],
257
+ "euMarket": true
258
+ },
259
+ "design": {
260
+ "wcagLevel": "AA",
261
+ "eaaCompliance": true,
262
+ "tokenFormat": "w3c"
263
+ },
191
264
  "stories": [
192
265
  {
193
266
  "id": "S001",
194
- "title": "User login",
195
- "acceptanceCriteria": ["User can log in with email", "..."],
267
+ "type": "brand",
268
+ "title": "Establish brand kit",
269
+ "acceptanceCriteria": ["BRAND_KIT.md exists", "tokens/ populated"],
270
+ "passes": false
271
+ },
272
+ {
273
+ "id": "S002",
274
+ "type": "design",
275
+ "title": "Login page",
276
+ "acceptanceCriteria": ["WCAG 2.2 AA compliant", "All states implemented"],
196
277
  "passes": false
197
278
  }
198
279
  ],
@@ -211,5 +292,5 @@ npx ctx-cc --force
211
292
  ```
212
293
 
213
294
  ---
214
- *CTX 2.2 - PRD-driven, story-verified, debug loop until 100% fixed*
295
+ *CTX 2.3 - PRD-driven, design-first, story-verified, debug loop until 100% fixed*
215
296
  </reference>
package/commands/init.md CHANGED
@@ -1,15 +1,16 @@
1
1
  ---
2
2
  name: ctx:init
3
- description: Initialize CTX project with STATE.md, PRD.json, and secure credentials
3
+ description: Initialize CTX project with STATE.md, PRD.json, design context, and secure credentials
4
4
  ---
5
5
 
6
6
  <objective>
7
- Initialize a new CTX 2.2 project. Front-loads ALL information gathering so execution runs autonomously with minimal interruption.
7
+ Initialize a new CTX 2.3 project. Front-loads ALL information gathering so execution runs autonomously with minimal interruption.
8
8
 
9
9
  Creates:
10
10
  - `.ctx/STATE.md` - Execution state
11
- - `.ctx/PRD.json` - Requirements contract
11
+ - `.ctx/PRD.json` - Requirements contract with design context
12
12
  - `.ctx/.env` - Secure credentials (gitignored)
13
+ - `BRAND_KIT.md` - Visual foundation (if design work needed)
13
14
  </objective>
14
15
 
15
16
  <philosophy>
@@ -21,10 +22,13 @@ Creates:
21
22
  3. Credentials for testing → .ctx/.env
22
23
  4. URLs and endpoints → .ctx/.env
23
24
  5. Constitution/rules → PRD.json constitution
25
+ 6. Design context → PRD.json brand/design sections
26
+ 7. Visual requirements → Brand personality, mood, inspirations
24
27
 
25
28
  **Then execute autonomously:**
26
29
  - Minimal user interruption during execution
27
30
  - Only ask user for architecture decisions (Rule 4)
31
+ - Only ask user for design approvals at gates
28
32
  - Use stored credentials for browser verification
29
33
  - Deliver complete, verified project
30
34
  </philosophy>
@@ -192,7 +196,57 @@ DATABASE_URL=
192
196
  - Warn user: "Credentials stored in .ctx/.env - NEVER commit this file"
193
197
  - Verify .gitignore is in place before proceeding
194
198
 
195
- ## Step 10: Link STATE.md to PRD
199
+ ## Step 10: Gather Design Context
200
+
201
+ **"Does this project need visual/UI work?"**
202
+
203
+ If yes, gather brand context:
204
+
205
+ **Brand Personality:**
206
+ - "What 3-5 adjectives describe the desired brand feel?"
207
+ - "Any brands you admire visually?" (inspirations)
208
+ - "Any visual styles to AVOID?" (anti-inspirations)
209
+
210
+ **Existing Assets:**
211
+ - "Do you have existing brand assets?" (logo, colors, fonts)
212
+ - "Figma file link?" (optional but recommended)
213
+
214
+ **Accessibility Requirements:**
215
+ - "Target market includes EU?" (EAA 2025 compliance)
216
+ - "WCAG level needed?" (default: 2.2 AA)
217
+
218
+ **Mode Support:**
219
+ - "Dark mode needed?" (light-only or light+dark)
220
+
221
+ Store in PRD.json `brand` section:
222
+ ```json
223
+ {
224
+ "brand": {
225
+ "hasBrandKit": false,
226
+ "personality": ["professional", "trustworthy", "modern"],
227
+ "visualMood": "Clean, minimal, with subtle warmth",
228
+ "inspirations": ["Stripe", "Linear"],
229
+ "antiInspirations": ["flashy", "cluttered"],
230
+ "existingAssets": ["logo.svg"],
231
+ "darkModeRequired": true,
232
+ "euMarket": true
233
+ },
234
+ "design": {
235
+ "wcagLevel": "AA",
236
+ "eaaCompliance": true,
237
+ "tokenFormat": "w3c",
238
+ "figmaFileKey": null,
239
+ "breakpoints": { "mobile": 375, "tablet": 768, "desktop": 1440 }
240
+ }
241
+ }
242
+ ```
243
+
244
+ **Story Type Assignment:**
245
+ - If no brand kit exists and UI work needed → Create brand story first (type: "brand")
246
+ - For each UI component/page → Create design story (type: "design")
247
+ - For backend/logic work → Create feature story (type: "feature")
248
+
249
+ ## Step 11: Link STATE.md to PRD
196
250
  Update STATE.md to reference current story:
197
251
  - **Current Story**: S001 - {{title}}
198
252
 
@@ -202,15 +256,15 @@ The user will run `/ctx` to begin the research + planning phase.
202
256
 
203
257
  <output_format>
204
258
  ```
205
- [CTX 2.2] Initialized
259
+ [CTX 2.3] Initialized
206
260
 
207
261
  Project: {{name}}
208
262
  Stack: {{language}} + {{framework}}
209
263
  Directory: .ctx/
210
264
 
211
265
  PRD: {{story_count}} stories
212
- S001: {{story_1_title}} ⬜
213
- S002: {{story_2_title}} ⬜
266
+ S001: [{{type}}] {{story_1_title}} ⬜
267
+ S002: [{{type}}] {{story_2_title}} ⬜
214
268
  ...
215
269
 
216
270
  Constitution:
@@ -218,6 +272,14 @@ Constitution:
218
272
  Always: {{count}}
219
273
  Never: {{count}}
220
274
 
275
+ Design Context:
276
+ Brand Kit: {{exists | needs creation}}
277
+ Personality: {{adjectives}}
278
+ WCAG Level: 2.2 {{level}}
279
+ EAA 2025: {{required | not required}}
280
+ Dark Mode: {{yes | no}}
281
+ Figma: {{linked | not linked}}
282
+
221
283
  Credentials:
222
284
  App URL: {{configured | not set}}
223
285
  Test User: {{configured | not set}}
@@ -228,6 +290,8 @@ Integrations:
228
290
  ArguSeek: ready
229
291
  ChunkHound: {{indexed | not found}}
230
292
  Browser Testing: {{ready | needs credentials}}
293
+ Figma MCP: {{ready | not configured}}
294
+ Gemini Design: {{ready | not configured}}
231
295
 
232
296
  Ready for autonomous execution.
233
297
  Next: Run /ctx to start planning for S001
@@ -241,6 +305,9 @@ Next: Run /ctx to start planning for S001
241
305
  - [ ] PRD.json created with user stories
242
306
  - [ ] Constitution defined (user or defaults)
243
307
  - [ ] All stories have acceptance criteria
308
+ - [ ] Stories assigned correct type (feature/brand/design)
309
+ - [ ] Design context gathered (if UI work needed)
310
+ - [ ] Brand story created first (if no BRAND_KIT.md)
244
311
  - [ ] .ctx/.env created with credentials (if provided)
245
312
  - [ ] ChunkHound index attempted
246
313
  - [ ] Status set to "initializing"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ctx-cc",
3
- "version": "2.2.0",
4
- "description": "CTX 2.2 (Continuous Task eXecution) - PRD-driven workflow orchestration for Claude Code. Story-verified, debug loop until 100% fixed.",
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",