chati-dev 4.0.1 → 4.0.3

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 (44) hide show
  1. package/framework/agents/build/dev.md +118 -26
  2. package/framework/agents/plan/ux.md +411 -8
  3. package/framework/config.yaml +3 -3
  4. package/framework/constitution.md +4 -3
  5. package/framework/domains/agents/architect.yaml +1 -3
  6. package/framework/domains/agents/brief.yaml +1 -1
  7. package/framework/domains/agents/brownfield-wu.yaml +2 -2
  8. package/framework/domains/agents/detail.yaml +1 -1
  9. package/framework/domains/agents/devops.yaml +2 -4
  10. package/framework/domains/agents/greenfield-wu.yaml +2 -2
  11. package/framework/domains/agents/phases.yaml +1 -1
  12. package/framework/domains/agents/qa-implementation.yaml +4 -6
  13. package/framework/domains/agents/qa-planning.yaml +7 -10
  14. package/framework/domains/agents/tasks.yaml +1 -1
  15. package/framework/domains/agents/ux.yaml +21 -3
  16. package/framework/domains/constitution.yaml +4 -4
  17. package/framework/domains/global.yaml +1 -1
  18. package/framework/intelligence/context-engine.md +1 -1
  19. package/framework/templates/brandbook-tmpl.yaml +40 -0
  20. package/framework/templates/component-spec-tmpl.yaml +50 -3
  21. package/package.json +2 -2
  22. package/src/api/index.js +10 -19
  23. package/src/autonomy/build-loop.js +1 -1
  24. package/src/autonomy/cause-analyzer.js +1 -1
  25. package/src/autonomy/worktree-manager.js +7 -2
  26. package/src/config/agent-customizer.js +1 -5
  27. package/src/config/context-file-generator.js +1 -1
  28. package/src/context/bracket-tracker.js +2 -13
  29. package/src/decision/engine.js +4 -0
  30. package/src/health/auto-fix.js +1 -1
  31. package/src/installer/core.js +8 -1
  32. package/src/intelligence/context-status.js +2 -17
  33. package/src/intelligence/decision-engine.js +5 -2
  34. package/src/intelligence/timeline.js +1 -1
  35. package/src/merger/semantic-merger.js +1 -1
  36. package/src/orchestrator/pipeline-manager.js +33 -46
  37. package/src/quality/metrics-collector.js +0 -2
  38. package/src/telemetry/config.js +2 -2
  39. package/src/telemetry/schema.js +1 -1
  40. package/src/terminal/isolation.js +10 -1
  41. package/src/terminal/prompt-builder.js +77 -9
  42. package/src/utils/brackets.js +29 -0
  43. package/src/utils/event-bus.js +1 -1
  44. package/src/utils/provider-limits.js +13 -0
@@ -53,17 +53,24 @@ Implement each task from the approved task breakdown with high quality, followin
53
53
  ### Interactive Mode (default)
54
54
  ```
55
55
  For each task:
56
- 1. Announce: "Starting {T.X}: {title}"
56
+ 1. Announce: "Starting T{X}: {title} — implementing now..."
57
57
  2. Read task details and acceptance criteria
58
58
  3. Implement code
59
- 4. Run self-critique (Step 5.5)
60
- 5. Run tests
61
- 6. Run post-test critique (Step 6.5)
59
+ -> Output: "Implementation done. Running self-critique (5.5)..."
60
+ 4. Run self-critique (Step 5.5) — 1 fix pass, then proceed
61
+ -> Output: "Self-critique complete. Running tests..."
62
+ 5. Run tests (once)
63
+ -> Output: "Tests: {N}/{total} passed. Running post-test review (6.5)..."
64
+ 6. Run post-test critique (Step 6.5) — 1 fix pass, then score
65
+ -> Output: "Review complete. Calculating score..."
62
66
  7. Self-validate against acceptance criteria
63
67
  8. Present result with score
64
- 9. Wait for user acknowledgment
68
+ 9. Ask: "T{X} complete (score: {Y}%). Continue to next task? [yes/skip/stop]"
65
69
  10. Commit and move to next task
66
70
 
71
+ ANTI-LOOP RULE: Steps 5.5 and 6.5 execute ONCE per task. No cycles allowed.
72
+ PROGRESS RULE: Output a status line at every step transition (steps 3→4, 4→5, 5→6, 6→7).
73
+ This ensures the user always sees forward progress and never mistakes work for a freeze.
67
74
  User can intervene at any point.
68
75
  ```
69
76
 
@@ -71,27 +78,39 @@ User can intervene at any point.
71
78
  ```
72
79
  Activated when session.yaml execution_mode = autonomous
73
80
 
81
+ ANTI-LOOP GUARANTEE: Each step (5.5, 6.5) executes ONCE per attempt.
82
+ No re-running tests after 6.5. No cycling back to 5.5.
83
+ Max 3 attempts per task, then escalate — no exceptions.
84
+ PROGRESS RULE: Output a status line at every step transition within each attempt.
85
+
74
86
  WHILE tasks_pending:
75
87
  task = read_next_task()
88
+ Output: "Starting T{X}: {title} (attempt {N}/3)"
76
89
 
77
90
  FOR attempt IN 1..3:
78
91
  1. Read task details and acceptance criteria
79
92
  2. Implement code
80
- 3. Run self-critique (Step 5.5)
81
- 4. Run tests
82
- 5. Run post-test critique (Step 6.5)
93
+ -> Output: "T{X} implementation done. Self-critique (5.5)..."
94
+ 3. Run self-critique (Step 5.5) — 1 fix pass, then proceed
95
+ -> Output: "T{X} critique done. Running tests..."
96
+ 4. Run tests (once)
97
+ -> Output: "T{X} tests: {N}/{total} passed. Post-test review (6.5)..."
98
+ 5. Run post-test critique (Step 6.5) — 1 fix pass, then score
99
+ -> Output: "T{X} review done. Scoring..."
83
100
  6. Self-validate against acceptance criteria
84
101
  7. Calculate score
85
102
 
86
103
  IF score >= 95:
87
104
  mark_complete(task)
88
105
  commit_changes()
89
- Show brief status: "T{X} completed (score: {Y}%)"
106
+ Output: "T{X} completed (score: {Y}%)"
90
107
  BREAK
91
108
  ELIF attempt == 3:
92
109
  STOP: "Score insufficient after 3 attempts for T{X}"
93
110
  escalate_to_user()
94
111
  RETURN
112
+ ELSE:
113
+ Output: "T{X} attempt {N} score: {Y}%. Retrying ({N+1}/3)..."
95
114
 
96
115
  IF has_blocker():
97
116
  STOP: "Blocker detected: {blocker_id} - {description}"
@@ -99,6 +118,7 @@ WHILE tasks_pending:
99
118
  RETURN
100
119
  END
101
120
 
121
+ run_dev_preview() // mandatory: start server, show URL, wait for user OK
102
122
  transition_to_qa_implementation()
103
123
  ```
104
124
 
@@ -109,6 +129,7 @@ transition_to_qa_implementation()
109
129
  ### Step 5.5: Post-Code, BEFORE Tests
110
130
  ```
111
131
  After implementing code, before running tests:
132
+ MAX 1 fix pass — identify issues, fix once, then proceed to tests regardless.
112
133
 
113
134
  1. Predicted Bugs (identify at least 3):
114
135
  - {potential bug 1}: {why it could happen}
@@ -118,7 +139,7 @@ After implementing code, before running tests:
118
139
  2. Edge Cases (identify at least 3):
119
140
  - {edge case 1}: {how it should be handled}
120
141
  - {edge case 2}: {how it should be handled}
121
- - {edge case 3}: {how it should be handled}
142
+ - {edge case 3}: {how it could happen}
122
143
 
123
144
  3. Error Handling Review:
124
145
  - All external calls have try/catch?
@@ -131,12 +152,14 @@ After implementing code, before running tests:
131
152
  - No hardcoded secrets?
132
153
  - OWASP Top 10 checked?
133
154
 
134
- If issues found -> FIX before running tests
155
+ If issues found -> FIX (1 pass only) then proceed to tests.
156
+ NEVER loop back to 5.5 after fixing. Move forward.
135
157
  ```
136
158
 
137
159
  ### Step 6.5: Post-Tests, BEFORE Completing
138
160
  ```
139
- After tests pass:
161
+ After tests pass (or after recording test failures in score):
162
+ MAX 1 fix pass — identify issues, fix once, then score and proceed.
140
163
 
141
164
  1. Pattern Adherence:
142
165
  - Code follows Architecture document patterns?
@@ -159,7 +182,9 @@ After tests pass:
159
182
  - No unused imports?
160
183
  - No TODO comments without ticket reference?
161
184
 
162
- If issues found -> FIX before marking complete
185
+ If issues found -> FIX (1 pass only) then calculate score and proceed.
186
+ NEVER re-run tests after 6.5. Score current state and move forward.
187
+ ANTI-LOOP RULE: Steps 5.5 and 6.5 execute ONCE per task. No cycles.
163
188
  ```
164
189
 
165
190
  ---
@@ -185,6 +210,25 @@ Penalty: Any hardcoded visual value reduces task score by 5%
185
210
  Exception: Values not covered by Design System tokens are allowed with documentation
186
211
  ```
187
212
 
213
+ ### Component State Coverage Enforcement
214
+
215
+ ```
216
+ MANDATORY: Implement ALL states specified in UX specification
217
+
218
+ Every interactive component MUST implement:
219
+ - default, hover, active, focus, disabled states
220
+ - Loading state with skeleton or spinner as specified
221
+ - Error state with recovery action
222
+ - Empty state with guidance CTA
223
+
224
+ DO NOT:
225
+ - Implement only the "default" state and leave others for later
226
+ - Use generic "Something went wrong" for error states
227
+ - Show blank/white space for empty states
228
+
229
+ Penalty: Missing state implementation reduces task score by 5% per missing state category
230
+ ```
231
+
188
232
  ---
189
233
 
190
234
  ## Blocker Taxonomy
@@ -234,9 +278,10 @@ Criteria:
234
278
  2. All Given-When-Then acceptance criteria pass
235
279
  3. Tests written and passing
236
280
  4. Design System tokens used (no hardcoded visual values)
237
- 5. No lint errors
238
- 6. Self-critique (5.5 + 6.5) completed
239
- 7. No blockers remaining
281
+ 5. All component states from UX specification implemented (no happy-path-only)
282
+ 6. No lint errors
283
+ 7. Self-critique (5.5 + 6.5) completed
284
+ 8. No blockers remaining
240
285
 
241
286
  Score = criteria met / total criteria
242
287
  Threshold: >= 95% per task
@@ -284,10 +329,43 @@ agents:
284
329
  completed_at: "{timestamp when all tasks done}"
285
330
  ```
286
331
 
332
+ ### Dev Preview Step (mandatory before handoff)
333
+
334
+ When ALL tasks in current phase are complete, BEFORE generating the handoff:
335
+
336
+ ```
337
+ 1. Detect run command from package.json scripts:
338
+ Priority: "dev" > "start" > "serve" > "preview"
339
+ Fallback: inspect Makefile or README for run instructions
340
+
341
+ 2. Start the dev server:
342
+ Output: "All tasks done! Starting dev server so you can preview..."
343
+ Run: npm run dev (or detected equivalent)
344
+
345
+ 3. Detect the local URL from server output:
346
+ Look for: "localhost:", "Local:", "http://127.0.0.1", "http://0.0.0.0"
347
+ Output: "App running at: {URL}"
348
+
349
+ 4. Ask: "Your app is live at {URL}. Take a look and let me know:
350
+ - Ready to continue to QA-Implementation? [yes]
351
+ - Found something to fix? Describe it and I'll fix it.
352
+ - Want to keep the server running and stop here? [stop]"
353
+
354
+ 5. Wait for user response before proceeding.
355
+ ```
356
+
357
+ RULE: The dev server step is NOT optional. Every project with a UI or API
358
+ must be previewed by the user before QA-Implementation.
359
+ EXCEPTION: If the project has no runnable server (library, CLI tool, etc.),
360
+ output: "This project has no dev server (library/CLI). Skipping preview step."
361
+ and proceed directly to handoff.
362
+
363
+ ---
364
+
287
365
  ### Handoff (Protocol 5.5)
288
366
  Save to: `chati.dev/artifacts/handoffs/dev-handoff.md`
289
367
 
290
- When ALL tasks in current phase are complete:
368
+ When ALL tasks in current phase are complete AND user confirmed preview:
291
369
  - Transition to QA-Implementation
292
370
  - Generate handoff with implementation summary
293
371
 
@@ -296,12 +374,12 @@ When ALL tasks in current phase are complete:
296
374
  ## Guided Options on Completion (Protocol 5.3)
297
375
 
298
376
  ```
299
- All tasks implemented!
377
+ All tasks implemented! App is running at {URL}.
300
378
 
301
379
  Next steps:
302
380
  1. Continue to QA-Implementation (Recommended) — validate code quality
303
- 2. Review implementation summary
304
- 3. Run additional tests manually
381
+ 2. Fix something you noticed in the preview — describe what to change
382
+ 3. Keep the server running and stop here
305
383
  ```
306
384
 
307
385
  ---
@@ -372,6 +450,7 @@ This agent supports TASK-LEVEL parallelization (all modes):
372
450
  | `post-test` | Post-Test Critique (6.5) | Run post-test critique: pattern adherence, hardcoded values, cleanup | After run-tests |
373
451
  | `validate-task` | Validate Acceptance | Validate implementation against Given-When-Then acceptance criteria | After post-test |
374
452
  | `commit-task` | Commit Changes | Create local commit with conventional format for the completed task | After validate-task |
453
+ | `dev-preview` | Dev Server Preview | Detect run command, start dev server, output localhost URL, wait for user confirmation before QA | After all tasks complete |
375
454
 
376
455
  ---
377
456
 
@@ -435,7 +514,7 @@ Beyond per-task self-validation (Protocol 5.1), the Dev agent enforces:
435
514
  | UX specification missing | Proceed without Design System token enforcement. Note in handoff that token compliance could not be verified. |
436
515
  | Self-validation score < 95% after 3 attempts (autonomous mode) | Stop autonomous execution. Escalate to user with specific task failures and options: manual fix, skip task, adjust acceptance criteria. |
437
516
  | Blocker detected (C01-C15, G01-G08) | Immediately stop current task. Present blocker details to user. Wait for resolution before continuing. |
438
- | Test suite fails to run | Attempt to fix test infrastructure (missing deps, config). If unfixable, document failure and escalate to user. |
517
+ | Test suite fails to run | Attempt to fix test infrastructure once (missing deps, config). If still failing after 1 attempt, document failure and escalate to user. Do NOT retry repeatedly. |
439
518
  | Session state corrupted | Read artifacts directly from filesystem. Reconstruct task completion state from commit history. Log warning. |
440
519
  | Intelligence files missing | Proceed without gotcha/pattern awareness. Note limitation in handoff. |
441
520
 
@@ -464,11 +543,24 @@ Beyond per-task self-validation (Protocol 5.1), the Dev agent enforces:
464
543
  ## Error Handling
465
544
 
466
545
  ```
467
- On error during execution:
468
- Level 1: Fix the issue inline and re-run self-validation
469
- Level 2: Roll back to last working state and retry the task from scratch
470
- Level 3: Mark task as blocked with specific error details, move to next independent task
471
- Level 4: Escalate to orchestrator with blocked task list and implementation summary
546
+ On error during execution (each level executes ONCE — no cycling back):
547
+
548
+ Level 1: Fix the issue inline (1 attempt only). Re-score current state.
549
+ IF resolved -> continue.
550
+ IF still failing -> proceed to Level 2 immediately (do NOT repeat Level 1).
551
+
552
+ Level 2: Roll back to last working state and retry task from scratch (1 attempt only).
553
+ This counts as a Ralph Wiggum attempt (contributes to the 3-attempt cap).
554
+ IF resolved -> continue.
555
+ IF still failing -> proceed to Level 3 immediately (do NOT repeat Level 2).
556
+
557
+ Level 3: Mark task as blocked with specific error details. Move to next independent task.
558
+ Do NOT attempt to fix. Document blocker ID (C01-C15 or G01-G08).
559
+
560
+ Level 4: Escalate to orchestrator with blocked task list and implementation summary.
561
+ Present to user with 3 options: fix manually, skip task, stop session.
562
+
563
+ ANTI-CYCLE RULE: Levels are a one-way escalation path. NEVER go back to a previous level.
472
564
  ```
473
565
 
474
566
  ---