chati-dev 4.3.1 → 4.4.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.
Files changed (147) hide show
  1. package/README.md +18 -13
  2. package/bin/chati.js +12 -4
  3. package/framework/agents/build/dev.md +5 -1
  4. package/framework/agents/discover/greenfield-wu.md +16 -1
  5. package/framework/agents/plan/tasks.md +31 -0
  6. package/framework/agents/plan/ux-brand-architect.md +21 -2
  7. package/framework/agents/plan/ux-component-engineer.md +10 -0
  8. package/framework/agents/quality/qa-implementation.md +1 -1
  9. package/framework/agents/quality/qa-planning.md +1 -1
  10. package/framework/agents/quality/qa-visual.md +24 -21
  11. package/framework/config.yaml +5 -4
  12. package/framework/constitution.md +58 -11
  13. package/framework/context/governance.md +12 -10
  14. package/framework/context/root.md +2 -2
  15. package/framework/data/entity-registry.yaml +12 -4
  16. package/framework/data/qa-rubrics.yaml +335 -0
  17. package/framework/domains/constitution.yaml +3 -3
  18. package/framework/executors/json-validate.js +80 -0
  19. package/framework/executors/npm-script.js +72 -0
  20. package/framework/executors/path-check.js +67 -0
  21. package/framework/executors/registry.yaml +36 -0
  22. package/framework/hooks/advance-trigger.js +47 -3
  23. package/framework/hooks/constitution-guard.js +9 -4
  24. package/framework/hooks/git-push-authority.js +113 -0
  25. package/framework/hooks/license-guard.js +59 -9
  26. package/framework/hooks/model-governance.js +40 -17
  27. package/framework/hooks/prism-engine.js +78 -11
  28. package/framework/hooks/session-digest.js +12 -3
  29. package/framework/hooks/settings.json +7 -3
  30. package/framework/hooks/style-guard.js +52 -3
  31. package/framework/hooks/team-quality-gate.js +43 -5
  32. package/framework/i18n/en.yaml +3 -3
  33. package/framework/i18n/es.yaml +3 -3
  34. package/framework/i18n/fr.yaml +3 -3
  35. package/framework/i18n/pt.yaml +3 -3
  36. package/framework/intelligence/confidence.yaml +85 -6
  37. package/framework/intelligence/context-engine.md +9 -5
  38. package/framework/intelligence/decision-engine.md +1 -1
  39. package/framework/orchestrator/chati-router.js +1 -1
  40. package/framework/orchestrator/chati-update.md +19 -3
  41. package/framework/orchestrator/chati.md +19 -1
  42. package/framework/quality-gates/planning-gate.md +2 -0
  43. package/framework/scaffold/motion-premium/scaffold.yaml +2 -1
  44. package/framework/scaffold/motion-premium-3d/components/webgl/WebGLContext.tsx.template +1 -1
  45. package/framework/scaffold/saas-dashboard/README.md +58 -0
  46. package/framework/scaffold/saas-dashboard/app/dashboard/page.tsx.template +546 -0
  47. package/framework/scaffold/saas-dashboard/app/globals.css.template +746 -0
  48. package/framework/scaffold/saas-dashboard/app/layout.tsx.template +192 -0
  49. package/framework/scaffold/saas-dashboard/app/shell.css.template +1070 -0
  50. package/framework/scaffold/saas-dashboard/components/data/Chart.tsx.template +725 -0
  51. package/framework/scaffold/saas-dashboard/components/data/DataTable.tsx.template +623 -0
  52. package/framework/scaffold/saas-dashboard/components/data/DataTable.types.ts.template +104 -0
  53. package/framework/scaffold/saas-dashboard/components/data/DataTablePagination.tsx.template +234 -0
  54. package/framework/scaffold/saas-dashboard/components/data/SkeletonBlock.tsx.template +111 -0
  55. package/framework/scaffold/saas-dashboard/components/data/StatCard.tsx.template +393 -0
  56. package/framework/scaffold/saas-dashboard/components/data/StatCardGrid.tsx.template +121 -0
  57. package/framework/scaffold/saas-dashboard/components/feedback/EmptyState.tsx.template +281 -0
  58. package/framework/scaffold/saas-dashboard/components/interaction/CommandPalette.tsx.template +767 -0
  59. package/framework/scaffold/saas-dashboard/components/interaction/Field.tsx.template +351 -0
  60. package/framework/scaffold/saas-dashboard/components/interaction/Form.tsx.template +424 -0
  61. package/framework/scaffold/saas-dashboard/components/primitives/Badge.tsx.template +193 -0
  62. package/framework/scaffold/saas-dashboard/components/primitives/Button.tsx.template +261 -0
  63. package/framework/scaffold/saas-dashboard/components/primitives/Card.tsx.template +287 -0
  64. package/framework/scaffold/saas-dashboard/components/primitives/Input.tsx.template +310 -0
  65. package/framework/scaffold/saas-dashboard/components/primitives/Spinner.tsx.template +135 -0
  66. package/framework/scaffold/saas-dashboard/components/primitives/index.ts.template +60 -0
  67. package/framework/scaffold/saas-dashboard/components/shell/AppShell.tsx.template +174 -0
  68. package/framework/scaffold/saas-dashboard/components/shell/Breadcrumb.tsx.template +186 -0
  69. package/framework/scaffold/saas-dashboard/components/shell/Container.tsx.template +86 -0
  70. package/framework/scaffold/saas-dashboard/components/shell/NavItem.tsx.template +147 -0
  71. package/framework/scaffold/saas-dashboard/components/shell/Sidebar.tsx.template +378 -0
  72. package/framework/scaffold/saas-dashboard/components/shell/SidebarContext.tsx.template +169 -0
  73. package/framework/scaffold/saas-dashboard/components/shell/ThemeToggle.tsx.template +128 -0
  74. package/framework/scaffold/saas-dashboard/components/shell/Topbar.tsx.template +301 -0
  75. package/framework/scaffold/saas-dashboard/lib/brand.ts.template +324 -0
  76. package/framework/scaffold/saas-dashboard/scaffold.yaml +225 -0
  77. package/framework/schemas/session.schema.json +5 -0
  78. package/framework/schemas/task.schema.json +9 -0
  79. package/framework/scripts/visual-qa.js +87 -1
  80. package/framework/tasks/orchestrator-health.md +4 -4
  81. package/framework/tasks/qa-impl-verdict.md +11 -5
  82. package/framework/templates/qa-gate-tmpl.yaml +24 -11
  83. package/package.json +3 -3
  84. package/src/config/context-file-generator.js +0 -6
  85. package/src/dashboard/renderer.js +0 -36
  86. package/src/executors/runner.js +204 -0
  87. package/src/installer/core.js +2 -1
  88. package/src/installer/templates.js +5 -6
  89. package/src/intelligence/registry-manager.js +1 -1
  90. package/src/license/client.js +9 -3
  91. package/src/license/commands.js +12 -2
  92. package/src/license/machine-id.js +42 -1
  93. package/src/memory/gotchas.js +58 -40
  94. package/src/memory/magic-docs.js +1 -1
  95. package/src/memory/session-digest.js +9 -4
  96. package/src/orchestrator/cli.js +174 -14
  97. package/src/orchestrator/doctor.js +98 -16
  98. package/src/orchestrator/pipeline-manager.js +44 -22
  99. package/src/orchestrator/session-manager.js +56 -8
  100. package/src/telemetry/sender.js +7 -19
  101. package/src/terminal/run-team.js +3 -3
  102. package/src/upgrade/tracked-files-detector.js +34 -16
  103. package/src/utils/feature-flags.js +1 -1
  104. package/src/utils/flatten-entities.js +4 -40
  105. package/src/utils/schema-validator.js +0 -14
  106. package/src/wizard/i18n.js +3 -3
  107. package/src/api/index.js +0 -120
  108. package/src/autonomy/autonomous-gate.js +0 -294
  109. package/src/autonomy/build-loop.js +0 -281
  110. package/src/autonomy/build-state.js +0 -286
  111. package/src/autonomy/cause-analyzer.js +0 -177
  112. package/src/autonomy/escalation.js +0 -214
  113. package/src/autonomy/index.js +0 -51
  114. package/src/autonomy/mode-manager.js +0 -225
  115. package/src/autonomy/mode-suggester.js +0 -283
  116. package/src/autonomy/progress-reporter.js +0 -275
  117. package/src/autonomy/safety-net.js +0 -370
  118. package/src/config/agent-customizer.js +0 -231
  119. package/src/decision/analyzer.js +0 -291
  120. package/src/decision/engine.js +0 -250
  121. package/src/decision/index.js +0 -38
  122. package/src/decision/registry-healer.js +0 -468
  123. package/src/decision/registry-updater.js +0 -339
  124. package/src/extensions/loader.js +0 -145
  125. package/src/extensions/registry.js +0 -134
  126. package/src/gates/circuit-breaker.js +0 -151
  127. package/src/gates/g1-planning-complete.js +0 -154
  128. package/src/gates/g2-qa-planning.js +0 -156
  129. package/src/gates/g3-implementation.js +0 -215
  130. package/src/gates/g4-qa-implementation.js +0 -240
  131. package/src/gates/g5-deploy-ready.js +0 -181
  132. package/src/gates/gate-base.js +0 -185
  133. package/src/gates/index.js +0 -46
  134. package/src/health/auto-fix.js +0 -216
  135. package/src/health/engine.js +0 -246
  136. package/src/merger/semantic-merger.js +0 -292
  137. package/src/preview/detector.js +0 -238
  138. package/src/preview/index.js +0 -20
  139. package/src/preview/launcher.js +0 -235
  140. package/src/preview/log-buffer.js +0 -103
  141. package/src/quality/metrics-collector.js +0 -281
  142. package/src/quality/test-runner.js +0 -366
  143. package/src/tasks/executor.js +0 -195
  144. package/src/tasks/index.js +0 -4
  145. package/src/tasks/loader.js +0 -210
  146. package/src/tasks/router.js +0 -182
  147. package/src/utils/event-bus.js +0 -126
@@ -41,15 +41,15 @@
41
41
  "hooks": [
42
42
  {
43
43
  "type": "command",
44
- "command": "node chati.dev/hooks/advance-trigger.js"
44
+ "command": "node chati.dev/hooks/brief-validator.js"
45
45
  },
46
46
  {
47
47
  "type": "command",
48
- "command": "node chati.dev/hooks/reference-trigger.js"
48
+ "command": "node chati.dev/hooks/advance-trigger.js"
49
49
  },
50
50
  {
51
51
  "type": "command",
52
- "command": "node chati.dev/hooks/brief-validator.js"
52
+ "command": "node chati.dev/hooks/reference-trigger.js"
53
53
  },
54
54
  {
55
55
  "type": "command",
@@ -104,6 +104,10 @@
104
104
  "type": "command",
105
105
  "command": "node chati.dev/hooks/constitution-guard.js"
106
106
  },
107
+ {
108
+ "type": "command",
109
+ "command": "node chati.dev/hooks/git-push-authority.js"
110
+ },
107
111
  {
108
112
  "type": "command",
109
113
  "command": "node chati.dev/hooks/undercover-guard.js"
@@ -21,6 +21,35 @@ const EM_DASH_PATTERN = /[\u2013\u2014]/;
21
21
  /** Emoji unicode ranges (comprehensive) */
22
22
  const EMOJI_PATTERN = /[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{231A}-\u{231B}\u{23E9}-\u{23F3}\u{23F8}-\u{23FA}\u{25AA}-\u{25AB}\u{25B6}\u{25C0}\u{25FB}-\u{25FE}\u{2614}-\u{2615}\u{2648}-\u{2653}\u{267F}\u{2693}\u{26A1}\u{26AA}-\u{26AB}\u{26BD}-\u{26BE}\u{26C4}-\u{26C5}\u{26CE}\u{26D4}\u{26EA}\u{26F2}-\u{26F3}\u{26F5}\u{26FA}\u{26FD}\u{2702}\u{2705}\u{2708}-\u{270D}\u{270F}]/u;
23
23
 
24
+ /**
25
+ * AI-slop phrasing (Article V: no AI-detectable writing patterns). Advisory,
26
+ * not a block: warn so the agent rewrites in specific, concrete language with a
27
+ * real voice. Tuned to the clear tells (formulaic openers, marketing filler,
28
+ * empty intensifiers) to keep false positives low.
29
+ */
30
+ const SLOP_PHRASES = [
31
+ /\bdelve into\b/i,
32
+ /\bdive into\b/i,
33
+ /\bit'?s important to note\b/i,
34
+ /\bit is important to note\b/i,
35
+ /\bin today'?s (world|fast[- ]paced|digital|landscape)\b/i,
36
+ /\bin the realm of\b/i,
37
+ /\ba testament to\b/i,
38
+ /\bunlock (the|your) (power|potential)\b/i,
39
+ /\bharness the power\b/i,
40
+ /\belevate your\b/i,
41
+ /\bseamless(ly)?\b/i,
42
+ /\bgame[- ]?changer\b/i,
43
+ /\bcutting[- ]edge\b/i,
44
+ /\bto the next level\b/i,
45
+ /\blook no further\b/i,
46
+ /\bembark on (a|your) journey\b/i,
47
+ /\bsupercharge\b/i,
48
+ /\brevolutioniz(e|ing)\b/i,
49
+ /\bbest[- ]in[- ]class\b/i,
50
+ /\bunparalleled\b/i,
51
+ ];
52
+
24
53
  /**
25
54
  * Paths exempt from style enforcement.
26
55
  * Framework files, configs, and context files may legitimately contain special chars.
@@ -54,20 +83,32 @@ function isExemptPath(filePath, projectDir) {
54
83
  * @returns {{ violations: string[], hasDash: boolean, hasEmoji: boolean }}
55
84
  */
56
85
  function checkStyle(content) {
57
- if (!content || typeof content !== 'string') return { violations: [], hasDash: false, hasEmoji: false };
86
+ if (!content || typeof content !== 'string') return { violations: [], hasDash: false, hasEmoji: false, slopPhrases: [] };
58
87
 
59
88
  const violations = [];
60
89
  const hasDash = EM_DASH_PATTERN.test(content);
61
90
  const hasEmoji = EMOJI_PATTERN.test(content);
62
91
 
92
+ const slopPhrases = [];
93
+ for (const re of SLOP_PHRASES) {
94
+ const m = content.match(re);
95
+ if (m) {
96
+ const hit = m[0].toLowerCase();
97
+ if (!slopPhrases.includes(hit)) slopPhrases.push(hit);
98
+ }
99
+ }
100
+
63
101
  if (hasDash) {
64
102
  violations.push('Em-dash or en-dash detected. Use commas, semicolons, colons, or periods instead (Article V).');
65
103
  }
66
104
  if (hasEmoji) {
67
105
  violations.push('Emoji detected. Use icons from approved libraries instead (Directive 1).');
68
106
  }
107
+ if (slopPhrases.length) {
108
+ violations.push(`AI-slop phrasing detected: ${slopPhrases.slice(0, 5).join(', ')}. Rewrite in specific, concrete language (Article V).`);
109
+ }
69
110
 
70
- return { violations, hasDash, hasEmoji };
111
+ return { violations, hasDash, hasEmoji, slopPhrases };
71
112
  }
72
113
 
73
114
  /**
@@ -129,6 +170,14 @@ async function main() {
129
170
  return;
130
171
  }
131
172
 
173
+ if (result.slopPhrases && result.slopPhrases.length) {
174
+ // AI-slop phrasing is advisory — warn but allow so the agent rewrites.
175
+ process.stdout.write(JSON.stringify(allowOutput(
176
+ `[Style Guard] AI-slop phrasing detected (${result.slopPhrases.slice(0, 5).join(', ')}). Rewrite in specific, concrete language with a real voice. Avoid formulaic marketing filler (Article V).`
177
+ )));
178
+ return;
179
+ }
180
+
132
181
  process.stdout.write(JSON.stringify(allowOutput()));
133
182
  } catch (err) {
134
183
  process.stderr.write(`[chati] style-guard: ${err.message}\n`);
@@ -157,7 +206,7 @@ function allowOutput(reason) {
157
206
  return out;
158
207
  }
159
208
 
160
- export { checkStyle, checkBashStyle, isExemptPath, EM_DASH_PATTERN, EMOJI_PATTERN };
209
+ export { checkStyle, checkBashStyle, isExemptPath, EM_DASH_PATTERN, EMOJI_PATTERN, SLOP_PHRASES };
161
210
 
162
211
  // Only run main when executed directly (not imported by tests).
163
212
  // realpathSync resolves symlinks on both sides — important on macOS where
@@ -83,9 +83,13 @@ async function main() {
83
83
  const event = JSON.parse(input);
84
84
  const projectDir = event.cwd || process.cwd();
85
85
 
86
- // Quick exit: no team active allow everything
87
- const teamId = process.env.CHATI_TEAM_ID;
88
- if (!teamId) {
86
+ // The env var is the fast path, but it does not always propagate to a
87
+ // parallel hook process. Fall back to the session file: if the env var is
88
+ // absent AND no team is active in session.yaml, this is genuinely solo mode
89
+ // and we allow. If a team IS active, we enforce isolation even without the
90
+ // env var, otherwise cross-member overwrites slip through unblocked.
91
+ const teamActive = !!process.env.CHATI_TEAM_ID || hasActiveTeamInSession(projectDir);
92
+ if (!teamActive) {
89
93
  process.stdout.write(JSON.stringify(allowOutput()));
90
94
  return;
91
95
  }
@@ -130,9 +134,25 @@ async function main() {
130
134
  // Path not owned by anyone specific → allow
131
135
  process.stdout.write(JSON.stringify(allowOutput()));
132
136
  } catch (err) {
133
- // Fail-open: hook errors should not block execution
134
137
  process.stderr.write(`[chati] team-quality-gate: ${err.message}\n`);
135
- process.stdout.write(JSON.stringify(allowOutput()));
138
+ // Fail CLOSED while a team is active. A crash in the write-scope guard must
139
+ // not silently permit cross-member overwrites during parallel team
140
+ // execution. Outside team mode this gate guards nothing, so a crash there
141
+ // allows. Re-derive team state defensively from env + session.
142
+ let teamActive = !!process.env.CHATI_TEAM_ID;
143
+ if (!teamActive) {
144
+ try {
145
+ const parsed = JSON.parse(input);
146
+ teamActive = hasActiveTeamInSession(parsed.cwd || process.cwd());
147
+ } catch { /* input unparseable: fall back to the env-only signal */ }
148
+ }
149
+ if (teamActive) {
150
+ process.stdout.write(JSON.stringify(denyOutput(
151
+ `[Team Quality Gate] internal error while enforcing team write isolation (${err.message}). Write blocked as a precaution to prevent cross-member overwrites. Retry once resolved.`
152
+ )));
153
+ } else {
154
+ process.stdout.write(JSON.stringify(allowOutput()));
155
+ }
136
156
  }
137
157
  }
138
158
 
@@ -163,6 +183,24 @@ function detectAgentFromSession(projectDir) {
163
183
  return match ? match[1].trim().replace(/^["']|["']$/g, '') : null;
164
184
  }
165
185
 
186
+ /**
187
+ * Detect whether a team is active from session.yaml alone, for the case where
188
+ * CHATI_TEAM_ID did not propagate to this hook process. An active team is an
189
+ * entry in teams[] whose status is forming, active or
190
+ * completing. preview.status uses a different vocabulary (inactive/running/
191
+ * approved/adjusting), so matching these specific values is team-specific.
192
+ */
193
+ function hasActiveTeamInSession(projectDir) {
194
+ const sessionPath = join(projectDir, '.chati', 'session.yaml');
195
+ if (!existsSync(sessionPath)) return false;
196
+ try {
197
+ const raw = readFileSync(sessionPath, 'utf-8');
198
+ return /team_id:\s*\S/.test(raw) && /^\s*status:\s*(active|forming|completing)\b/m.test(raw);
199
+ } catch {
200
+ return false;
201
+ }
202
+ }
203
+
166
204
  // Only run main when executed directly (not imported by tests).
167
205
  // realpathSync resolves symlinks on both sides — important on macOS where
168
206
  // /tmp is a symlink to /private/tmp. Without realpath the comparison fails
@@ -31,7 +31,7 @@ installer:
31
31
  agents_count: "Agent definitions across DISCOVER, PLAN, BUILD, DEPLOY phases"
32
32
  workflows_count: "7 workflow blueprints"
33
33
  templates_count: "10 templates (PRD, Brownfield PRD, Architecture, Task, QA Gate, Quick Brief, Brandbook, Design Tokens, Component Spec, Icon System)"
34
- constitution: "Constitution (23 Articles + Preamble)"
34
+ constitution: "Constitution (25 Articles + Preamble)"
35
35
  session_mgmt: "Session management system"
36
36
  quality_gates: "Quality gates (3-tier verdicts)"
37
37
  proceed: "Proceed with installation?"
@@ -39,7 +39,7 @@ installer:
39
39
  created_chati: "Created .chati/ session directory"
40
40
  created_framework: "Created chati.dev/ system directory (agents, templates, workflows)"
41
41
  created_commands: "Created .claude/commands/ (thin router)"
42
- installed_constitution: "Installed Constitution (Articles I-XXIII)"
42
+ installed_constitution: "Installed Constitution (Articles I-XXV)"
43
43
  created_session: "Created session.yaml schema"
44
44
  created_claude_md: "Created CLAUDE.md"
45
45
  configured_mcps: "Configured MCPs:"
@@ -47,7 +47,7 @@ installer:
47
47
  agents_valid: "All agents implement 8 protocols"
48
48
  handoff_ok: "Handoff protocol: OK"
49
49
  validation_ok: "Self-validation criteria: OK"
50
- constitution_ok: "Constitution: 23 articles verified"
50
+ constitution_ok: "Constitution: 25 articles verified"
51
51
  created_memories: "Created .chati/memories/ (Memory Layer)"
52
52
  installed_intelligence: "Installed Intelligence Layer (Context Engine, Memory, Registry)"
53
53
  intelligence_valid: "Intelligence: 6 spec files verified"
@@ -31,7 +31,7 @@ installer:
31
31
  agents_count: "Definiciones de agentes en las fases DISCOVER, PLAN, BUILD, DEPLOY"
32
32
  workflows_count: "7 blueprints de workflow"
33
33
  templates_count: "10 templates (PRD, PRD Brownfield, Arquitectura, Task, QA Gate, Quick Brief, Brandbook, Design Tokens, Component Spec, Icon System)"
34
- constitution: "Constitucion (22 Articulos + Preambulo)"
34
+ constitution: "Constitucion (25 Articulos + Preambulo)"
35
35
  session_mgmt: "Sistema de gestion de sesion"
36
36
  quality_gates: "Quality gates (veredictos en 3 niveles)"
37
37
  proceed: "Proceder con la instalacion?"
@@ -39,7 +39,7 @@ installer:
39
39
  created_chati: "Creado directorio de sesion .chati/"
40
40
  created_framework: "Creado directorio del sistema chati.dev/ (agentes, templates, workflows)"
41
41
  created_commands: "Creado .claude/commands/ (enrutador)"
42
- installed_constitution: "Instalada Constitucion (Artículos I-XXIII)"
42
+ installed_constitution: "Instalada Constitucion (Artículos I-XXV)"
43
43
  created_session: "Creado schema session.yaml"
44
44
  created_claude_md: "Creado CLAUDE.md"
45
45
  configured_mcps: "MCPs configurados:"
@@ -47,7 +47,7 @@ installer:
47
47
  agents_valid: "Todos los agentes implementan 8 protocolos"
48
48
  handoff_ok: "Protocolo de handoff: OK"
49
49
  validation_ok: "Criterios de auto-validacion: OK"
50
- constitution_ok: "Constitucion: 22 articulos verificados"
50
+ constitution_ok: "Constitucion: 25 articulos verificados"
51
51
  created_memories: "Creado .chati/memories/ (Memory Layer)"
52
52
  installed_intelligence: "Instalada Intelligence Layer (Context Engine, Memory, Registry)"
53
53
  intelligence_valid: "Intelligence: 6 archivos de spec verificados"
@@ -31,7 +31,7 @@ installer:
31
31
  agents_count: "Definitions d'agents dans les phases DISCOVER, PLAN, BUILD, DEPLOY"
32
32
  workflows_count: "7 blueprints de workflow"
33
33
  templates_count: "10 templates (PRD, PRD Brownfield, Architecture, Task, QA Gate, Quick Brief, Brandbook, Design Tokens, Component Spec, Icon System)"
34
- constitution: "Constitution (23 Articles + Preambule)"
34
+ constitution: "Constitution (25 Articles + Preambule)"
35
35
  session_mgmt: "Systeme de gestion de session"
36
36
  quality_gates: "Quality gates (verdicts en 3 niveaux)"
37
37
  proceed: "Proceder a l'installation?"
@@ -39,7 +39,7 @@ installer:
39
39
  created_chati: "Cree le repertoire de session .chati/"
40
40
  created_framework: "Cree le repertoire du systeme chati.dev/ (agents, templates, workflows)"
41
41
  created_commands: "Cree .claude/commands/ (routeur)"
42
- installed_constitution: "Installee la Constitution (Articles I-XXIII)"
42
+ installed_constitution: "Installee la Constitution (Articles I-XXV)"
43
43
  created_session: "Cree le schema session.yaml"
44
44
  created_claude_md: "Cree CLAUDE.md"
45
45
  configured_mcps: "MCPs configures:"
@@ -47,7 +47,7 @@ installer:
47
47
  agents_valid: "Tous les agents implementent 8 protocoles"
48
48
  handoff_ok: "Protocole de passation: OK"
49
49
  validation_ok: "Criteres d'auto-validation: OK"
50
- constitution_ok: "Constitution: 23 articles verifies"
50
+ constitution_ok: "Constitution: 25 articles verifies"
51
51
  created_memories: "Cree .chati/memories/ (Memory Layer)"
52
52
  installed_intelligence: "Installee Intelligence Layer (Context Engine, Memory, Registry)"
53
53
  intelligence_valid: "Intelligence: 6 fichiers de spec verifies"
@@ -31,7 +31,7 @@ installer:
31
31
  agents_count: "Definicoes de agentes nas fases DISCOVER, PLAN, BUILD, DEPLOY"
32
32
  workflows_count: "7 blueprints de workflow"
33
33
  templates_count: "10 templates (PRD, PRD Brownfield, Arquitetura, Task, QA Gate, Quick Brief, Brandbook, Design Tokens, Component Spec, Icon System)"
34
- constitution: "Constituicao (22 Artigos + Preambulo)"
34
+ constitution: "Constituicao (25 Artigos + Preambulo)"
35
35
  session_mgmt: "Sistema de gerenciamento de sessao"
36
36
  quality_gates: "Quality gates (veredictos em 3 niveis)"
37
37
  proceed: "Prosseguir com a instalacao?"
@@ -39,7 +39,7 @@ installer:
39
39
  created_chati: "Criado diretorio de sessao .chati/"
40
40
  created_framework: "Criado diretorio do sistema chati.dev/ (agentes, templates, workflows)"
41
41
  created_commands: "Criado .claude/commands/ (roteador)"
42
- installed_constitution: "Instalada Constituicao (Artigos I-XXIII)"
42
+ installed_constitution: "Instalada Constituicao (Artigos I-XXV)"
43
43
  created_session: "Criado schema session.yaml"
44
44
  created_claude_md: "Criado CLAUDE.md"
45
45
  configured_mcps: "MCPs configurados:"
@@ -47,7 +47,7 @@ installer:
47
47
  agents_valid: "Todos os agentes implementam 8 protocolos"
48
48
  handoff_ok: "Protocolo de handoff: OK"
49
49
  validation_ok: "Criterios de auto-validacao: OK"
50
- constitution_ok: "Constituicao: 22 artigos verificados"
50
+ constitution_ok: "Constituicao: 25 artigos verificados"
51
51
  created_memories: "Criado .chati/memories/ (Memory Layer)"
52
52
  installed_intelligence: "Instalada Intelligence Layer (Context Engine, Memory, Registry)"
53
53
  intelligence_valid: "Intelligence: 6 arquivos de spec verificados"
@@ -1,11 +1,22 @@
1
1
  # Intelligence Layer — Agent Confidence Calibration
2
- # Tracks agent performance across technologies and patterns
3
- # Updated after each execution
4
- # NEVER overwritten during upgrades
2
+ # Tracks agent performance across technologies and patterns.
3
+ # Updated after each execution (the agent appends real results here).
4
+ # NEVER overwritten during upgrades.
5
+ #
6
+ # calibration_status:
7
+ # seed — initial estimate, NOT measured from real runs. Treat as a
8
+ # prior, not evidence. Replaced by measured values after runs.
9
+ # uncalibrated — no data yet. overall is null until the agent has run enough
10
+ # times to calibrate. Do not treat the absence of a number as
11
+ # low confidence; it means unknown.
12
+ # calibrated — overall and breakdowns reflect measured results across runs.
13
+ #
14
+ # Every pipeline agent has an entry so it has a place to accrue calibration.
5
15
 
6
16
  confidence:
7
17
  dev:
8
18
  overall: 0.90
19
+ calibration_status: seed
9
20
  by_technology:
10
21
  react: 0.92
11
22
  nextjs: 0.88
@@ -17,10 +28,11 @@ confidence:
17
28
  crud_operations: 0.95
18
29
  form_handling: 0.92
19
30
  api_design: 0.88
20
- last_calibrated: "2026-02-07"
31
+ last_calibrated: null
21
32
 
22
33
  architect:
23
34
  overall: 0.88
35
+ calibration_status: seed
24
36
  by_technology:
25
37
  react: 0.90
26
38
  nextjs: 0.87
@@ -30,13 +42,80 @@ confidence:
30
42
  monolith: 0.92
31
43
  microservices: 0.80
32
44
  serverless: 0.78
33
- last_calibrated: "2026-02-07"
45
+ last_calibrated: null
34
46
 
35
47
  qa-implementation:
36
48
  overall: 0.92
49
+ calibration_status: seed
37
50
  by_category:
38
51
  test_execution: 0.95
39
52
  security_scan: 0.90
40
53
  code_review: 0.88
41
54
  acceptance_verification: 0.93
42
- last_calibrated: "2026-02-07"
55
+ last_calibrated: null
56
+
57
+ # Uncalibrated: every other pipeline agent. overall stays null until measured.
58
+ greenfield-wu:
59
+ overall: null
60
+ calibration_status: uncalibrated
61
+ last_calibrated: null
62
+ brownfield-wu:
63
+ overall: null
64
+ calibration_status: uncalibrated
65
+ last_calibrated: null
66
+ brief:
67
+ overall: null
68
+ calibration_status: uncalibrated
69
+ last_calibrated: null
70
+ detail:
71
+ overall: null
72
+ calibration_status: uncalibrated
73
+ last_calibrated: null
74
+ architect-system:
75
+ overall: null
76
+ calibration_status: uncalibrated
77
+ last_calibrated: null
78
+ architect-data-engineer:
79
+ overall: null
80
+ calibration_status: uncalibrated
81
+ last_calibrated: null
82
+ ux:
83
+ overall: null
84
+ calibration_status: uncalibrated
85
+ last_calibrated: null
86
+ ux-brand-architect:
87
+ overall: null
88
+ calibration_status: uncalibrated
89
+ last_calibrated: null
90
+ ux-component-engineer:
91
+ overall: null
92
+ calibration_status: uncalibrated
93
+ last_calibrated: null
94
+ ux-researcher:
95
+ overall: null
96
+ calibration_status: uncalibrated
97
+ last_calibrated: null
98
+ phases:
99
+ overall: null
100
+ calibration_status: uncalibrated
101
+ last_calibrated: null
102
+ tasks:
103
+ overall: null
104
+ calibration_status: uncalibrated
105
+ last_calibrated: null
106
+ qa-planning:
107
+ overall: null
108
+ calibration_status: uncalibrated
109
+ last_calibrated: null
110
+ qa-visual:
111
+ overall: null
112
+ calibration_status: uncalibrated
113
+ last_calibrated: null
114
+ visualizer:
115
+ overall: null
116
+ calibration_status: uncalibrated
117
+ last_calibrated: null
118
+ devops:
119
+ overall: null
120
+ calibration_status: uncalibrated
121
+ last_calibrated: null
@@ -33,7 +33,7 @@ The orchestrator injects context through 6 hierarchical layers:
33
33
 
34
34
  | Layer | Name | Source | When Active |
35
35
  |-------|------|--------|-------------|
36
- | **L0** | Constitution | `chati.dev/constitution.md` (Articles I-XXIII) | ALWAYS (non-negotiable) |
36
+ | **L0** | Constitution | `chati.dev/constitution.md` (Articles I-XXV) | ALWAYS (non-negotiable) |
37
37
  | **L1** | Mode + Global | `config.yaml` + mode governance (planning/build/deploy) | ALWAYS |
38
38
  | **L2** | Agent Scope | `chati.dev/agents/{agent}/` — mission, inputs, outputs, criteria | When agent is active |
39
39
  | **L3** | Pipeline State | `.chati/session.yaml` — pipeline position, scores, backlog | When session is active |
@@ -42,7 +42,7 @@ The orchestrator injects context through 6 hierarchical layers:
42
42
 
43
43
  ### Layer Activation by Bracket
44
44
 
45
- | Bracket | Active Layers | Budget Ratio | Claude (200K) | Gemini (1M) | Codex (128K) |
45
+ | Bracket | Active Layers | Budget Ratio | Claude (1M) | Gemini (1M) | Codex (128K) |
46
46
  |---------|--------------|-------------|---------------|-------------|--------------|
47
47
  | FRESH | L0, L1 | 1.5% | 3,000 | 15,000 | 1,920 |
48
48
  | MODERATE | L0, L1, L2, L3 | 2.5% | 5,000 | 25,000 | 3,200 |
@@ -60,7 +60,7 @@ The orchestrator produces a structured XML block injected into agent prompts:
60
60
  ```xml
61
61
  <chati-context bracket="MODERATE">
62
62
  <constitution>
63
- Articles I-XXIII governing agent behavior.
63
+ Articles I-XXV governing agent behavior.
64
64
  Key: Self-validation required. Loop until quality threshold.
65
65
  Guided options (1,2,3). Persistent session state.
66
66
  Two-layer handoff. Language protocol. Deviation protocol.
@@ -116,7 +116,7 @@ estimatedTokens = promptText.length / 4
116
116
  remainingPercent = (1 - estimatedTokens / providerLimit) * 100
117
117
  ```
118
118
 
119
- This replaces the legacy heuristic (`turnCount / maxTurns`) which was inaccurate for sessions with large tool results or long agent outputs. The token-based approach scales correctly across providers (Claude 200K, Gemini 1M, Codex 128K).
119
+ This replaces the legacy heuristic (`turnCount / maxTurns`) which was inaccurate for sessions with large tool results or long agent outputs. The token-based approach scales correctly across providers (Claude 1M, Gemini 1M, Codex 128K).
120
120
 
121
121
  Fallback: If prompt text is unavailable, the turn-count heuristic is used.
122
122
 
@@ -150,11 +150,15 @@ If Smart Continuation is insufficient, the orchestrator spawns a new session:
150
150
 
151
151
  | Condition | Threshold | Rationale |
152
152
  |-----------|-----------|-----------|
153
+ | BUILD phase + DEPLETED/CRITICAL | Immediate (default to Level 2) | During code generation a depleted window produces regressions faster than a reset costs; a clean slate beats in-place compaction |
153
154
  | Multiple compactions | 3+ in single session | Context is churning too fast |
154
155
  | Post-compact quality | Agent score drops >15% | Compaction lost critical context |
155
156
  | Critical bracket persists | CRITICAL for 3+ consecutive interactions | Recovery not working |
157
+ | Echo loop detected | 2+ echo entries in the current phase (session.yaml decision_trail) | The model is looping; a fresh session breaks the cycle |
156
158
  | Agent handoff pending | Current agent done, next agent needs fresh context | Clean start is better |
157
159
 
160
+ **BUILD-phase reset preference:** During the BUILD phase, when the active agent reaches DEPLETED or CRITICAL, the orchestrator defaults to Level 2 (Autonomous Session Spawn, a clean reset) rather than Level 1 (Smart Continuation, in-place compaction). Compaction preserves continuity but not a clean slate, so the model can keep wrapping up work prematurely while code is being written; a reset carrying a full handoff is safer there. Level 1 stays the default for the MODERATE bracket and for the DISCOVER and PLAN phases.
161
+
158
162
  ### IDE-Specific Behavior
159
163
 
160
164
  | IDE | Level 1 | Level 2 |
@@ -185,7 +189,7 @@ Memory injection follows the same progressive reinforcement principle: as contex
185
189
 
186
190
  ---
187
191
 
188
- *Context Engine v4.3.0 — Chati.dev Intelligence Layer (Progressive Reinforcement Model)*
192
+ *Context Engine v4.4.0 — Chati.dev Intelligence Layer (Progressive Reinforcement Model)*
189
193
 
190
194
  ---
191
195
 
@@ -96,7 +96,7 @@ npx chati-dev health
96
96
  Checks:
97
97
  1. All registered entities exist on disk
98
98
  2. Schema files are valid JSON
99
- 3. Constitution has >= 23 articles
99
+ 3. Constitution has >= 25 articles
100
100
  4. Agents contain required protocol references
101
101
  5. Entity count matches actual file count
102
102
  6. Checksums match (if calculated)
@@ -192,7 +192,7 @@ const VALID_ORCHESTRATE_SUBS = new Set([
192
192
  'qa-plan-score', 'qa-impl-score', 'qa-visual-score', 'scan',
193
193
  'spawn-team', 'team-status', 'team-dissolve',
194
194
  'wait-for-capture', 'wave-status', 'assess-coverage',
195
- 'wait-for-license', 'doctor',
195
+ 'wait-for-license', 'doctor', 'run-script-task',
196
196
  ]);
197
197
 
198
198
  /**
@@ -10,7 +10,7 @@ You are the **Chati Update Agent**, a specialized evolution advisor for the chat
10
10
 
11
11
  1. **NEVER copy blindly** - Adapt concepts to chati.dev's identity and patterns
12
12
  2. **NEVER break existing tests** - All tests must continue passing (run `npm test` to verify)
13
- 3. **NEVER violate the constitution** - 23 articles are sacred
13
+ 3. **NEVER violate the constitution** - 25 articles are sacred
14
14
  4. **NEVER skip comparison** - Every finding MUST be validated against current state
15
15
  5. **ALWAYS present options** - Numbered 1, 2, 3 format before any implementation
16
16
  6. **ALWAYS use sub-agents** - Parallelize SCAN and COMPARE for throughput
@@ -102,7 +102,7 @@ Launch **in parallel** with Phase 1 a **Task agent (subagent_type=Explore, thoro
102
102
  Map the COMPLETE current state of chati.dev. Analyze:
103
103
 
104
104
  1. **CONSTITUTION** - Read chati.dev/constitution.md fully. Extract:
105
- - All 23 articles with key rules
105
+ - All 25 articles with key rules
106
106
  - Quality thresholds
107
107
  - Governance patterns
108
108
 
@@ -247,7 +247,7 @@ Use `/ralph-loop` with the following prompt structure:
247
247
 
248
248
  REQUIREMENTS:
249
249
  1. Implement each change following chati.dev patterns and conventions
250
- 2. Respect the constitution (23 articles) - especially originality
250
+ 2. Respect the constitution (25 articles) - especially originality
251
251
  3. Update relevant tests for each change
252
252
  4. Run full test suite after each change - ALL must pass
253
253
  5. Run lint after each change - must be clean
@@ -300,6 +300,22 @@ After ralph-wiggum completes, generate final report:
300
300
 
301
301
  ---
302
302
 
303
+ ## Phase 7: MODEL-HARNESS PARITY (Article XXIV)
304
+
305
+ This step runs whether the update was triggered by a reference comparison or by a model change.
306
+
307
+ 1. **Re-baseline the model.** Record the current model as the audited one so the parity advisory clears:
308
+ - set `session.model_at_last_audit = session.active_model`
309
+ Write this through the session manager (the CLI-managed path), never by editing `.chati/session.yaml` directly.
310
+
311
+ 2. **Model-change audit checklist.** When the model family changed, re-check the parts of the harness whose calibration is model-dependent, and keep the model-agnostic parts:
312
+ - Context bracket token budgets (Article XII, `context-engine.md`): are the FRESH/MODERATE/DEPLETED/CRITICAL boundaries still right for the new window size?
313
+ - Agent confidence calibration (`intelligence/confidence.yaml`): re-calibrate after a few real runs on the new model.
314
+ - Load-bearing agents: is any scaffolding agent now redundant because the new model does that step natively? Is any new capability worth a new agent?
315
+ - Keep unchanged: the Articles, the quality gates and thresholds, the registry. These are model-agnostic.
316
+
317
+ ---
318
+
303
319
  ## Error Handling
304
320
 
305
321
  - **Clone fails**: Ask user for correct URL/path, suggest alternatives
@@ -229,6 +229,24 @@ Quality gate passed: {score}%.
229
229
 
230
230
  ---
231
231
 
232
+ ## Action: Script Task (Execution Kinds)
233
+
234
+ When the `execution_kinds` feature is on and the next task's `execution_kind` is
235
+ not `agent`, route it here instead of spawning an agent. When the feature is off
236
+ or the kind is `agent`, skip this entirely and use the normal agent path. This
237
+ is purely a dispatch optimization: it never changes WHAT a task must achieve,
238
+ only what executes it, and it is invisible when the feature is off.
239
+
240
+ - **script**: run it deterministically with no LLM. Via Bash:
241
+ `node .chati.dev/orchestrator/chati-router.js run-script-task --ref "{execution_ref}" --id "{task_id}" --title "{task_title}"`
242
+ Handle the JSON `status`:
243
+ - `passed` → the task is done. Advance: `node .chati.dev/orchestrator/chati-router.js advance --agent {current_agent} --score 100`
244
+ - `failed` → the deterministic check is negative. Route to dev (Fault Vector Protocol: CODE) to fix, then re-run the script task.
245
+ - `error` → the executor could not run. Surface the summary to the user and check the execution_ref against the executor registry.
246
+ - `ran: false` → the feature is off or the kind is not script; fall back to the agent path silently.
247
+ - **human**: present the decision in the user's language as a Guided Option and wait for their choice. Record it, then advance. Never decide for them.
248
+ - **specialist**: reserved; today, run it through the normal agent path.
249
+
232
250
  ## Action: Autonomous Agent
233
251
 
234
252
  These agents run in separate Claude Code processes.
@@ -790,7 +808,7 @@ interactive (default):
790
808
  → All 8 universal protocols apply.
791
809
 
792
810
  autonomous (Ralph Wiggum mode):
793
- → Requires: most recent QA gate score >= 95% (Article XVIII prerequisite).
811
+ → Requires: most recent QA gate score >= 95% (Article XVII prerequisite).
794
812
  → If quality gate not met, inform user and suggest guided mode instead.
795
813
  → Agent executes without asking unless blocker encountered.
796
814
  → Primarily for Dev agent during BUILD phase.
@@ -34,6 +34,8 @@ QA-Planning
34
34
  | Agent defined weak criteria | -10 |
35
35
 
36
36
  ## Decision
37
+ Thresholds are canonical in `chati.dev/data/qa-rubrics.yaml` (thresholds.qa-planning); the values below must match that file.
38
+
37
39
  - **Score >= 95**: APPROVED -> proceed to BUILD
38
40
  - **Score < 95**: Silent correction loop (max 3 per agent)
39
41
  - **Still < 95 after loops**: ESCALATE to user
@@ -15,11 +15,12 @@ framework:
15
15
  chati_dev: ">=4.3.0"
16
16
 
17
17
  stack:
18
- build_tools: ["nextjs", "react-vite"]
18
+ build_tools: ["nextjs"]
19
19
  tailwind: ">=4.0.0"
20
20
  typescript: ">=5.0.0"
21
21
  node: ">=18.0.0"
22
22
  react: ">=18.0.0"
23
+ next: ">=13.0.0"
23
24
  # Runtime peer deps imported directly by templates. Bumping policy: every two
24
25
  # minor bumps, re-validate templates. GSAP 3.12 is the stable line post-3.11;
25
26
  # framer-motion 11 is the React 19 support line; lenis 1.1 introduced the
@@ -24,7 +24,7 @@ import { detectWebGL, type WebGLAvailability } from '@/lib/webgl/detect';
24
24
 
25
25
  export interface WebGLContextValue {
26
26
  status: 'pending' | 'available' | 'unavailable';
27
- reason: WebGLAvailability extends { reason: infer R } ? R | null : null;
27
+ reason: Extract<WebGLAvailability, { available: false }>['reason'] | null;
28
28
  webglVersion: 1 | 2 | null;
29
29
  }
30
30