chati-dev 4.0.2 → 4.0.4

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.
@@ -53,17 +53,49 @@ 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}"
57
- 2. Read task details and acceptance criteria
56
+ 1. Announce: "Starting T{X}: {title} — implementing now..."
57
+ 1.5. Pre-Flight Spec Check (BEFORE any code):
58
+ a. Validate Given-When-Then criteria:
59
+ → Are all criteria specific and measurable? (not "works correctly", "looks good")
60
+ → If ANY criterion is vague/untestable → STOP. Escalate G01: "{criterion} is ambiguous."
61
+ → If task has NO criteria → STOP. Escalate G01: "T{X} has no testable acceptance criteria."
62
+ b. Check dependencies:
63
+ → For each T{x}.{y} in Dependencies: is it marked complete in tasks.md?
64
+ → If dependency incomplete → STOP. Escalate: "Cannot start T{X}: T{dep} not yet complete."
65
+ c. Set implementation strategy from task size:
66
+ → XS/S: standard flow — proceed to Step 2
67
+ → M (2-4h): output brief implementation outline (files + approach), then proceed
68
+ → L (4-8h): output full implementation plan, ask "[ready/clarify/skip]", wait for user
69
+ RULE: NEVER write code before Step 1.5 passes. If spec is unclear, fix the spec first.
70
+ OUTPUT: "Spec check passed. T{X} is {size} — {strategy}."
71
+ 2. Read task details, acceptance criteria, and verify architectural alignment:
72
+ Before coding, cross-check against chati.dev/artifacts/3-Architecture/architecture.md:
73
+ - API tasks → endpoint pattern, response format, error handling contract match Section 4?
74
+ - Database tasks → table/column names, relationships match Section 5 (Data Model)?
75
+ - Auth tasks → auth approach matches Section 6 (Authentication)?
76
+ - New modules/components → file structure matches Section 3 (System Components)?
77
+ If conflict detected → STOP. Escalate G05:
78
+ "T{X} conflicts with architecture decision: {specific conflict}.
79
+ Implement per architecture.md or per task spec?"
80
+ RULE: architecture.md is the source of truth. NEVER implement against architectural decisions.
81
+ RULE: Do NOT silently reconcile conflicts — always surface them.
82
+ If no architecture.md present → proceed with best practices, note in handoff.
58
83
  3. Implement code
59
- 4. Run self-critique (Step 5.5)
60
- 5. Run tests
61
- 6. Run post-test critique (Step 6.5)
84
+ -> Output: "Implementation done. Running self-critique (5.5)..."
85
+ 4. Run self-critique (Step 5.5) — 1 fix pass, then proceed
86
+ -> Output: "Self-critique complete. Running tests..."
87
+ 5. Run tests (once)
88
+ -> Output: "Tests: {N}/{total} passed. Running post-test review (6.5)..."
89
+ 6. Run post-test critique (Step 6.5) — 1 fix pass, then score
90
+ -> Output: "Review complete. Calculating score..."
62
91
  7. Self-validate against acceptance criteria
63
92
  8. Present result with score
64
- 9. Wait for user acknowledgment
93
+ 9. Ask: "T{X} complete (score: {Y}%). Continue to next task? [yes/skip/stop]"
65
94
  10. Commit and move to next task
66
95
 
96
+ ANTI-LOOP RULE: Steps 5.5 and 6.5 execute ONCE per task. No cycles allowed.
97
+ PROGRESS RULE: Output a status line at every step transition (steps 3→4, 4→5, 5→6, 6→7).
98
+ This ensures the user always sees forward progress and never mistakes work for a freeze.
67
99
  User can intervene at any point.
68
100
  ```
69
101
 
@@ -71,27 +103,49 @@ User can intervene at any point.
71
103
  ```
72
104
  Activated when session.yaml execution_mode = autonomous
73
105
 
106
+ ANTI-LOOP GUARANTEE: Each step (5.5, 6.5) executes ONCE per attempt.
107
+ No re-running tests after 6.5. No cycling back to 5.5.
108
+ Max 3 attempts per task, then escalate — no exceptions.
109
+ PROGRESS RULE: Output a status line at every step transition within each attempt.
110
+
74
111
  WHILE tasks_pending:
75
112
  task = read_next_task()
113
+ Output: "Starting T{X}: {title} (attempt {N}/3)"
76
114
 
77
115
  FOR attempt IN 1..3:
78
116
  1. Read task details and acceptance criteria
79
- 2. Implement code
80
- 3. Run self-critique (Step 5.5)
81
- 4. Run tests
82
- 5. Run post-test critique (Step 6.5)
117
+ 1.5. Pre-Flight Spec Check:
118
+ If ANY criterion is vague/untestable → mark task blocked (G01), skip to next task
119
+ If task has no Given-When-Then criteria → mark task blocked (G01), skip to next
120
+ If dependency not complete → mark task blocked, skip to next independent task
121
+ → M-size tasks: output implementation outline before coding
122
+ → L-size tasks: output full implementation plan before coding (no user confirmation)
123
+ 2. Verify architectural alignment (cross-check architecture.md before coding):
124
+ → API/DB/Auth/module tasks: verify patterns match architecture.md
125
+ → If conflict → mark task blocked (G05), skip to next task
126
+ → If no architecture.md → proceed with best practices
127
+ 3. Implement code
128
+ -> Output: "T{X} implementation done. Self-critique (5.5)..."
129
+ 3. Run self-critique (Step 5.5) — 1 fix pass, then proceed
130
+ -> Output: "T{X} critique done. Running tests..."
131
+ 4. Run tests (once)
132
+ -> Output: "T{X} tests: {N}/{total} passed. Post-test review (6.5)..."
133
+ 5. Run post-test critique (Step 6.5) — 1 fix pass, then score
134
+ -> Output: "T{X} review done. Scoring..."
83
135
  6. Self-validate against acceptance criteria
84
136
  7. Calculate score
85
137
 
86
138
  IF score >= 95:
87
139
  mark_complete(task)
88
140
  commit_changes()
89
- Show brief status: "T{X} completed (score: {Y}%)"
141
+ Output: "T{X} completed (score: {Y}%)"
90
142
  BREAK
91
143
  ELIF attempt == 3:
92
144
  STOP: "Score insufficient after 3 attempts for T{X}"
93
145
  escalate_to_user()
94
146
  RETURN
147
+ ELSE:
148
+ Output: "T{X} attempt {N} score: {Y}%. Retrying ({N+1}/3)..."
95
149
 
96
150
  IF has_blocker():
97
151
  STOP: "Blocker detected: {blocker_id} - {description}"
@@ -99,6 +153,7 @@ WHILE tasks_pending:
99
153
  RETURN
100
154
  END
101
155
 
156
+ run_dev_preview() // mandatory: start server, show URL, wait for user OK
102
157
  transition_to_qa_implementation()
103
158
  ```
104
159
 
@@ -109,6 +164,7 @@ transition_to_qa_implementation()
109
164
  ### Step 5.5: Post-Code, BEFORE Tests
110
165
  ```
111
166
  After implementing code, before running tests:
167
+ MAX 1 fix pass — identify issues, fix once, then proceed to tests regardless.
112
168
 
113
169
  1. Predicted Bugs (identify at least 3):
114
170
  - {potential bug 1}: {why it could happen}
@@ -118,7 +174,7 @@ After implementing code, before running tests:
118
174
  2. Edge Cases (identify at least 3):
119
175
  - {edge case 1}: {how it should be handled}
120
176
  - {edge case 2}: {how it should be handled}
121
- - {edge case 3}: {how it should be handled}
177
+ - {edge case 3}: {how it could happen}
122
178
 
123
179
  3. Error Handling Review:
124
180
  - All external calls have try/catch?
@@ -131,12 +187,14 @@ After implementing code, before running tests:
131
187
  - No hardcoded secrets?
132
188
  - OWASP Top 10 checked?
133
189
 
134
- If issues found -> FIX before running tests
190
+ If issues found -> FIX (1 pass only) then proceed to tests.
191
+ NEVER loop back to 5.5 after fixing. Move forward.
135
192
  ```
136
193
 
137
194
  ### Step 6.5: Post-Tests, BEFORE Completing
138
195
  ```
139
- After tests pass:
196
+ After tests pass (or after recording test failures in score):
197
+ MAX 1 fix pass — identify issues, fix once, then score and proceed.
140
198
 
141
199
  1. Pattern Adherence:
142
200
  - Code follows Architecture document patterns?
@@ -159,7 +217,9 @@ After tests pass:
159
217
  - No unused imports?
160
218
  - No TODO comments without ticket reference?
161
219
 
162
- If issues found -> FIX before marking complete
220
+ If issues found -> FIX (1 pass only) then calculate score and proceed.
221
+ NEVER re-run tests after 6.5. Score current state and move forward.
222
+ ANTI-LOOP RULE: Steps 5.5 and 6.5 execute ONCE per task. No cycles.
163
223
  ```
164
224
 
165
225
  ---
@@ -257,9 +317,11 @@ Criteria:
257
317
  6. No lint errors
258
318
  7. Self-critique (5.5 + 6.5) completed
259
319
  8. No blockers remaining
320
+ 9. Pre-flight spec check passed: criteria were specific and testable before coding started
321
+ 10. Architectural alignment verified: no G05 conflicts, or G05 explicitly resolved before coding
260
322
 
261
323
  Score = criteria met / total criteria
262
- Threshold: >= 95% per task
324
+ Threshold: >= 95% per task (minimum 9/10)
263
325
  ```
264
326
 
265
327
  ---
@@ -300,14 +362,47 @@ agents:
300
362
  dev:
301
363
  status: in_progress | completed
302
364
  score: {average across all tasks}
303
- criteria_count: {total criteria across all tasks}
365
+ criteria_count: 10
304
366
  completed_at: "{timestamp when all tasks done}"
305
367
  ```
306
368
 
369
+ ### Dev Preview Step (mandatory before handoff)
370
+
371
+ When ALL tasks in current phase are complete, BEFORE generating the handoff:
372
+
373
+ ```
374
+ 1. Detect run command from package.json scripts:
375
+ Priority: "dev" > "start" > "serve" > "preview"
376
+ Fallback: inspect Makefile or README for run instructions
377
+
378
+ 2. Start the dev server:
379
+ Output: "All tasks done! Starting dev server so you can preview..."
380
+ Run: npm run dev (or detected equivalent)
381
+
382
+ 3. Detect the local URL from server output:
383
+ Look for: "localhost:", "Local:", "http://127.0.0.1", "http://0.0.0.0"
384
+ Output: "App running at: {URL}"
385
+
386
+ 4. Ask: "Your app is live at {URL}. Take a look and let me know:
387
+ - Ready to continue to QA-Implementation? [yes]
388
+ - Found something to fix? Describe it and I'll fix it.
389
+ - Want to keep the server running and stop here? [stop]"
390
+
391
+ 5. Wait for user response before proceeding.
392
+ ```
393
+
394
+ RULE: The dev server step is NOT optional. Every project with a UI or API
395
+ must be previewed by the user before QA-Implementation.
396
+ EXCEPTION: If the project has no runnable server (library, CLI tool, etc.),
397
+ output: "This project has no dev server (library/CLI). Skipping preview step."
398
+ and proceed directly to handoff.
399
+
400
+ ---
401
+
307
402
  ### Handoff (Protocol 5.5)
308
403
  Save to: `chati.dev/artifacts/handoffs/dev-handoff.md`
309
404
 
310
- When ALL tasks in current phase are complete:
405
+ When ALL tasks in current phase are complete AND user confirmed preview:
311
406
  - Transition to QA-Implementation
312
407
  - Generate handoff with implementation summary
313
408
 
@@ -316,12 +411,12 @@ When ALL tasks in current phase are complete:
316
411
  ## Guided Options on Completion (Protocol 5.3)
317
412
 
318
413
  ```
319
- All tasks implemented!
414
+ All tasks implemented! App is running at {URL}.
320
415
 
321
416
  Next steps:
322
417
  1. Continue to QA-Implementation (Recommended) — validate code quality
323
- 2. Review implementation summary
324
- 3. Run additional tests manually
418
+ 2. Fix something you noticed in the preview — describe what to change
419
+ 3. Keep the server running and stop here
325
420
  ```
326
421
 
327
422
  ---
@@ -392,6 +487,7 @@ This agent supports TASK-LEVEL parallelization (all modes):
392
487
  | `post-test` | Post-Test Critique (6.5) | Run post-test critique: pattern adherence, hardcoded values, cleanup | After run-tests |
393
488
  | `validate-task` | Validate Acceptance | Validate implementation against Given-When-Then acceptance criteria | After post-test |
394
489
  | `commit-task` | Commit Changes | Create local commit with conventional format for the completed task | After validate-task |
490
+ | `dev-preview` | Dev Server Preview | Detect run command, start dev server, output localhost URL, wait for user confirmation before QA | After all tasks complete |
395
491
 
396
492
  ---
397
493
 
@@ -455,7 +551,7 @@ Beyond per-task self-validation (Protocol 5.1), the Dev agent enforces:
455
551
  | UX specification missing | Proceed without Design System token enforcement. Note in handoff that token compliance could not be verified. |
456
552
  | 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. |
457
553
  | Blocker detected (C01-C15, G01-G08) | Immediately stop current task. Present blocker details to user. Wait for resolution before continuing. |
458
- | Test suite fails to run | Attempt to fix test infrastructure (missing deps, config). If unfixable, document failure and escalate to user. |
554
+ | 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. |
459
555
  | Session state corrupted | Read artifacts directly from filesystem. Reconstruct task completion state from commit history. Log warning. |
460
556
  | Intelligence files missing | Proceed without gotcha/pattern awareness. Note limitation in handoff. |
461
557
 
@@ -484,11 +580,24 @@ Beyond per-task self-validation (Protocol 5.1), the Dev agent enforces:
484
580
  ## Error Handling
485
581
 
486
582
  ```
487
- On error during execution:
488
- Level 1: Fix the issue inline and re-run self-validation
489
- Level 2: Roll back to last working state and retry the task from scratch
490
- Level 3: Mark task as blocked with specific error details, move to next independent task
491
- Level 4: Escalate to orchestrator with blocked task list and implementation summary
583
+ On error during execution (each level executes ONCE — no cycling back):
584
+
585
+ Level 1: Fix the issue inline (1 attempt only). Re-score current state.
586
+ IF resolved -> continue.
587
+ IF still failing -> proceed to Level 2 immediately (do NOT repeat Level 1).
588
+
589
+ Level 2: Roll back to last working state and retry task from scratch (1 attempt only).
590
+ This counts as a Ralph Wiggum attempt (contributes to the 3-attempt cap).
591
+ IF resolved -> continue.
592
+ IF still failing -> proceed to Level 3 immediately (do NOT repeat Level 2).
593
+
594
+ Level 3: Mark task as blocked with specific error details. Move to next independent task.
595
+ Do NOT attempt to fix. Document blocker ID (C01-C15 or G01-G08).
596
+
597
+ Level 4: Escalate to orchestrator with blocked task list and implementation summary.
598
+ Present to user with 3 options: fix manually, skip task, stop session.
599
+
600
+ ANTI-CYCLE RULE: Levels are a one-way escalation path. NEVER go back to a previous level.
492
601
  ```
493
602
 
494
603
  ---
@@ -271,7 +271,7 @@ Criteria (binary pass/fail):
271
271
  17. Zero banned placeholder content — no lorem ipsum, no "John Doe", domain-realistic sample data used (Directive 5F)
272
272
  18. All animations use GPU-only properties (transform/opacity) with reduced-motion alternatives (Directive 5G)
273
273
  19. Motion System defined: library specified by stack, animation tokens in Design System Layer 5, scroll animations + micro-interactions catalogued, reduced-motion alternatives provided (Directive 6)
274
- 20. Component discovery completed for all Molecules and Organisms via 21st.dev: each component shows evidence of discovery (adapted from source OR documented "not found" rationale) (Directive 7)
274
+ 20. Component Discovery Log complete: EVERY Molecule and Organism in the component map has an entry in the Discovery Log with status (ADOPTED/ADAPTED/CUSTOM) and source or rationale. Any component with no log entry = FAIL for this criterion. Zero silent skips. (Directive 7)
275
275
 
276
276
  Score = criteria met / total criteria
277
277
  Threshold: >= 90% (standard agent tier, 18/20 target)
@@ -284,6 +284,7 @@ Threshold: >= 90% (standard agent tier, 18/20 target)
284
284
  ### Artifacts
285
285
  1. Save to: `chati.dev/artifacts/4-UX/ux-specification.md`
286
286
  2. Save to: `chati.dev/artifacts/4-UX/reference-analysis.md` (if reference URLs provided)
287
+ 3. Save to: `chati.dev/artifacts/4-UX/component-discovery-log.md` **(mandatory — criterion #20)**
287
288
 
288
289
  ```markdown
289
290
  # UX Specification — {Project Name}
@@ -367,6 +368,21 @@ Threshold: >= 90% (standard agent tier, 18/20 target)
367
368
  ## 7. Responsive Strategy
368
369
  {Breakpoints, layout behavior per breakpoint}
369
370
 
371
+ ## 8. Component Discovery Log
372
+ <!-- MANDATORY (Directive 7) — every Molecule and Organism must have an entry. -->
373
+ <!-- Missing entry = criterion #20 FAILS. Zero silent skips allowed. -->
374
+
375
+ | Component | Level | Status | Source / Rationale |
376
+ |-----------|-------|--------|--------------------|
377
+ | {name} | Molecule | ADOPTED | 21st.dev: {component-name} — {URL} |
378
+ | {name} | Molecule | ADAPTED | 21st.dev: {component-name} — customized {what changed} |
379
+ | {name} | Organism | CUSTOM | Not found on 21st.dev — {reason why custom was needed} |
380
+
381
+ Status legend:
382
+ - **ADOPTED**: Used as-is with only token/color adaptation
383
+ - **ADAPTED**: Pattern reused, significant structural customization
384
+ - **CUSTOM**: Not found (or <50% match) — designed from scratch with documented rationale
385
+
370
386
  ## Traceability
371
387
  | Brief User Need | UX Decision |
372
388
  |-----------------|-------------|
@@ -1009,8 +1025,49 @@ Search these categories on 21st.dev FIRST (highest reuse potential):
1009
1025
 
1010
1026
  If 21st.dev is unreachable (offline, network issue):
1011
1027
  - Proceed with component design from scratch
1028
+ - Mark ALL components as CUSTOM with rationale: "21st.dev unavailable — {reason}"
1012
1029
  - Note in handoff: "21st.dev lookup skipped — {reason}"
1013
1030
  - Agent MUST NOT block pipeline due to external resource unavailability
1031
+ - Criterion #20 still passes if ALL molecules/organisms have entries (even if all are CUSTOM)
1032
+
1033
+ #### 7E. Discovery Log Format (save to `component-discovery-log.md`)
1034
+
1035
+ ```markdown
1036
+ # Component Discovery Log — {Project Name}
1037
+
1038
+ Generated: {date}
1039
+ Total components: {N} ({M} Molecules, {K} Organisms)
1040
+ Discovery coverage: {X}/{N} (must be 100%)
1041
+
1042
+ ## Molecules
1043
+
1044
+ ### {ComponentName}
1045
+ - Status: ADOPTED | ADAPTED | CUSTOM
1046
+ - Source: {21st.dev URL} | N/A
1047
+ - Patterns observed: {what was reused}
1048
+ - Adaptations: {what was changed to match our tokens}
1049
+ - Rationale (if CUSTOM): {reason no existing component worked}
1050
+
1051
+ ## Organisms
1052
+
1053
+ ### {ComponentName}
1054
+ - Status: ADOPTED | ADAPTED | CUSTOM
1055
+ - Source: {21st.dev URL} | N/A
1056
+ - Patterns observed: {what was reused}
1057
+ - Adaptations: {what was changed to match our tokens}
1058
+ - Rationale (if CUSTOM): {reason no existing component worked}
1059
+
1060
+ ## Summary
1061
+ | Status | Count | % |
1062
+ |--------|-------|---|
1063
+ | ADOPTED | {n} | {%} |
1064
+ | ADAPTED | {n} | {%} |
1065
+ | CUSTOM | {n} | {%} |
1066
+ ```
1067
+
1068
+ **VALIDATION RULE**: Before marking criterion #20 as PASS, count entries in this log.
1069
+ Entry count MUST equal Molecule count + Organism count from the component map.
1070
+ If any component is missing an entry → criterion #20 = FAIL → do NOT proceed to handoff.
1014
1071
 
1015
1072
  **RULE**: The goal is quality, not compliance. Adapting a premium component is better than
1016
1073
  designing a mediocre custom component. The minimum bar is: every Organism must show evidence
@@ -1,8 +1,8 @@
1
1
  # chati.dev Configuration
2
- version: "4.0.2"
2
+ version: "4.0.4"
3
3
  installed_at: "2026-02-07T10:00:00Z"
4
- updated_at: "2026-03-21T00:00:00Z"
5
- installer_version: "4.0.2"
4
+ updated_at: "2026-03-22T00:00:00Z"
5
+ installer_version: "4.0.4"
6
6
  project_type: greenfield
7
7
  language: en
8
8
  ides: [claude-code]
@@ -48,6 +48,19 @@ rules:
48
48
  text: "Iterate on implementation until acceptance criteria are met."
49
49
  priority: normal
50
50
 
51
+ - id: dev-spec-intake
52
+ text: "MUST validate task spec BEFORE writing code: verify all Given-When-Then criteria are specific and testable, check all task dependencies are complete. Escalate G01 immediately for ambiguous criteria, G02 for conflicting criteria — NEVER start coding with unclear spec."
53
+ priority: critical
54
+
55
+ - id: dev-size-strategy
56
+ text: "MUST adapt implementation approach by task size: XS/S = standard flow; M (2-4h) = output implementation outline before coding; L (4-8h) = output implementation plan and ask user confirmation before starting (autonomous mode: output plan and proceed without confirmation)."
57
+ priority: high
58
+
59
+ - id: dev-arch-coherence
60
+ text: "MUST verify implementation aligns with architecture.md before coding any API endpoints, database schemas, auth flows, or new modules. Escalate G05 immediately if conflict detected. NEVER implement against architectural decisions — always surface conflicts to user."
61
+ priority: high
62
+
51
63
  # Provider Preference (v3.0.0)
52
- - dev-provider: "Default provider: claude. Can run on gemini for large codebase tasks (1M context window)."
64
+ - id: dev-provider
65
+ text: "Default provider: claude. Can run on gemini for large codebase tasks (1M context window)."
53
66
  priority: normal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chati-dev",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "AI-Powered Multi-Agent Orchestration System — Structured vibe coding for Full Stack Development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@eslint/js": "^10.0.1",
73
- "eslint": "^10.0.0",
73
+ "eslint": "^10.1.0",
74
74
  "globals": "^17.3.0"
75
75
  }
76
76
  }