chati-dev 2.0.5 → 2.0.7

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 (128) hide show
  1. package/README.md +51 -38
  2. package/framework/agents/{clarity → planning}/architect.md +1 -1
  3. package/framework/agents/{clarity → planning}/brief.md +1 -1
  4. package/framework/agents/{clarity → planning}/brownfield-wu.md +1 -1
  5. package/framework/agents/{clarity → planning}/detail.md +1 -1
  6. package/framework/agents/{clarity → planning}/greenfield-wu.md +1 -1
  7. package/framework/agents/{clarity → planning}/phases.md +1 -1
  8. package/framework/agents/{clarity → planning}/tasks.md +1 -1
  9. package/framework/agents/{clarity → planning}/ux.md +1 -1
  10. package/framework/agents/quality/qa-planning.md +5 -5
  11. package/framework/constitution.md +7 -7
  12. package/framework/context/governance.md +4 -4
  13. package/framework/context/quality.md +3 -2
  14. package/framework/context/root.md +1 -1
  15. package/framework/data/entity-registry.yaml +9 -9
  16. package/framework/domains/agents/qa-implementation.yaml +1 -1
  17. package/framework/domains/constitution.yaml +2 -2
  18. package/framework/domains/global.yaml +1 -1
  19. package/framework/hooks/mode-governance.js +5 -5
  20. package/framework/hooks/prism-engine.js +22 -2
  21. package/framework/hooks/read-protection.js +107 -0
  22. package/framework/hooks/session-digest.js +1 -1
  23. package/framework/hooks/settings.json +9 -0
  24. package/framework/i18n/en.yaml +1 -3
  25. package/framework/i18n/es.yaml +1 -3
  26. package/framework/i18n/fr.yaml +1 -3
  27. package/framework/i18n/pt.yaml +1 -3
  28. package/framework/intelligence/context-engine.md +3 -3
  29. package/framework/orchestrator/chati.md +24 -24
  30. package/framework/quality-gates/planning-gate.md +1 -1
  31. package/framework/schemas/context.schema.json +1 -1
  32. package/framework/schemas/session.schema.json +3 -3
  33. package/framework/tasks/architect-api-design.md +1 -1
  34. package/framework/tasks/architect-consolidate.md +1 -1
  35. package/framework/tasks/architect-db-design.md +1 -1
  36. package/framework/tasks/architect-design.md +1 -1
  37. package/framework/tasks/architect-security-review.md +1 -1
  38. package/framework/tasks/architect-stack-selection.md +1 -1
  39. package/framework/tasks/brief-consolidate.md +1 -1
  40. package/framework/tasks/brief-constraint-identify.md +1 -1
  41. package/framework/tasks/brief-extract-requirements.md +1 -1
  42. package/framework/tasks/brief-stakeholder-map.md +1 -1
  43. package/framework/tasks/brief-validate-completeness.md +1 -1
  44. package/framework/tasks/brownfield-wu-architecture-map.md +1 -1
  45. package/framework/tasks/brownfield-wu-deep-discovery.md +1 -1
  46. package/framework/tasks/brownfield-wu-dependency-scan.md +1 -1
  47. package/framework/tasks/brownfield-wu-migration-plan.md +1 -1
  48. package/framework/tasks/brownfield-wu-report.md +1 -1
  49. package/framework/tasks/brownfield-wu-risk-assess.md +1 -1
  50. package/framework/tasks/detail-acceptance-criteria.md +1 -1
  51. package/framework/tasks/detail-consolidate.md +1 -1
  52. package/framework/tasks/detail-edge-case-analysis.md +1 -1
  53. package/framework/tasks/detail-expand-prd.md +1 -1
  54. package/framework/tasks/detail-nfr-extraction.md +1 -1
  55. package/framework/tasks/greenfield-wu-analyze-empty.md +1 -1
  56. package/framework/tasks/greenfield-wu-report.md +1 -1
  57. package/framework/tasks/greenfield-wu-scaffold-detection.md +1 -1
  58. package/framework/tasks/greenfield-wu-tech-stack-assess.md +1 -1
  59. package/framework/tasks/orchestrator-deviation.md +3 -3
  60. package/framework/tasks/orchestrator-escalate.md +2 -2
  61. package/framework/tasks/orchestrator-handoff.md +6 -6
  62. package/framework/tasks/orchestrator-health.md +1 -1
  63. package/framework/tasks/orchestrator-mode-switch.md +20 -20
  64. package/framework/tasks/orchestrator-resume.md +6 -6
  65. package/framework/tasks/orchestrator-route.md +7 -7
  66. package/framework/tasks/orchestrator-status.md +8 -8
  67. package/framework/tasks/orchestrator-suggest-mode.md +13 -13
  68. package/framework/tasks/phases-breakdown.md +1 -1
  69. package/framework/tasks/phases-dependency-mapping.md +1 -1
  70. package/framework/tasks/phases-mvp-scoping.md +1 -1
  71. package/framework/tasks/qa-impl-regression-check.md +2 -2
  72. package/framework/tasks/qa-planning-consolidate.md +3 -3
  73. package/framework/tasks/qa-planning-coverage-plan.md +1 -1
  74. package/framework/tasks/qa-planning-gate-define.md +7 -7
  75. package/framework/tasks/qa-planning-risk-matrix.md +1 -1
  76. package/framework/tasks/qa-planning-test-strategy.md +1 -1
  77. package/framework/tasks/tasks-acceptance-write.md +1 -1
  78. package/framework/tasks/tasks-consolidate.md +1 -1
  79. package/framework/tasks/tasks-decompose.md +1 -1
  80. package/framework/tasks/tasks-estimate.md +1 -1
  81. package/framework/tasks/ux-a11y-check.md +1 -1
  82. package/framework/tasks/ux-component-map.md +1 -1
  83. package/framework/tasks/ux-consolidate.md +1 -1
  84. package/framework/tasks/ux-user-flow.md +1 -1
  85. package/framework/tasks/ux-wireframe.md +1 -1
  86. package/framework/workflows/brownfield-discovery.yaml +7 -7
  87. package/framework/workflows/brownfield-fullstack.yaml +9 -9
  88. package/framework/workflows/brownfield-service.yaml +5 -5
  89. package/framework/workflows/brownfield-ui.yaml +5 -5
  90. package/framework/workflows/greenfield-fullstack.yaml +9 -9
  91. package/package.json +3 -3
  92. package/scripts/bundle-framework.js +1 -1
  93. package/scripts/generate-signing-key.js +33 -0
  94. package/scripts/health-check.js +8 -8
  95. package/scripts/populate-entity-registry.js +1 -1
  96. package/scripts/semantic-lint.js +328 -0
  97. package/scripts/sign-manifest.js +53 -0
  98. package/scripts/validate-agents.js +1 -1
  99. package/scripts/validate-package.js +257 -0
  100. package/scripts/validate-tasks.js +1 -1
  101. package/src/autonomy/autonomous-gate.js +2 -2
  102. package/src/autonomy/progress-reporter.js +9 -9
  103. package/src/config/mcp-configs.js +16 -85
  104. package/src/context/engine.js +2 -2
  105. package/src/context/layers/l1-global.js +3 -3
  106. package/src/dashboard/layout.js +7 -7
  107. package/src/dashboard/renderer.js +2 -2
  108. package/src/gates/g1-planning-complete.js +9 -9
  109. package/src/gates/g4-qa-implementation.js +9 -9
  110. package/src/installer/core.js +27 -12
  111. package/src/installer/manifest.js +33 -1
  112. package/src/installer/signing-public-key.pem +3 -0
  113. package/src/installer/templates.js +1 -1
  114. package/src/installer/validator.js +41 -8
  115. package/src/intelligence/registry-manager.js +4 -4
  116. package/src/memory/agent-memory.js +20 -0
  117. package/src/memory/session-digest.js +1 -1
  118. package/src/orchestrator/agent-selector.js +10 -10
  119. package/src/orchestrator/intent-classifier.js +4 -4
  120. package/src/orchestrator/pipeline-manager.js +4 -4
  121. package/src/orchestrator/pipeline-state.js +1 -1
  122. package/src/orchestrator/session-manager.js +3 -3
  123. package/src/tasks/executor.js +1 -1
  124. package/src/tasks/loader.js +1 -1
  125. package/src/terminal/prompt-builder.js +10 -10
  126. package/src/wizard/i18n.js +1 -3
  127. package/src/wizard/index.js +10 -15
  128. package/src/wizard/questions.js +7 -70
package/README.md CHANGED
@@ -3,15 +3,13 @@
3
3
  <img src="packages/chati-dev/assets/logo.svg" alt="Chati.dev" width="380">
4
4
  <br><br>
5
5
  <strong>AI-Powered Multi-Agent Orchestration System</strong><br>
6
- <em>13 agents. 17 articles. 6 IDEs. 4 languages. 849 tests. Structured vibe coding.</em>
6
+ <em>Structured vibe coding for Full Stack Development.</em>
7
7
  </div>
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/chati-dev"><img src="https://img.shields.io/npm/v/chati-dev?color=blue&label=npm" alt="npm"></a>
11
11
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
12
12
  <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg" alt="Node.js"></a>
13
- <a href="#architecture"><img src="https://img.shields.io/badge/agents-13-purple.svg" alt="Agents"></a>
14
- <a href="#supported-ides"><img src="https://img.shields.io/badge/IDEs-6-orange.svg" alt="IDEs"></a>
15
13
  <a href="#internationalization"><img src="https://img.shields.io/badge/i18n-EN%20%7C%20PT%20%7C%20ES%20%7C%20FR-informational.svg" alt="i18n"></a>
16
14
  <a href=".github/CONTRIBUTING.md"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg" alt="Contributions Welcome"></a>
17
15
  </p>
@@ -35,7 +33,7 @@ AI-assisted development today suffers from three critical issues:
35
33
  Chati.dev introduces **Agent-Driven Development**: a pipeline of 13 specialized agents where each agent owns a specific phase, produces validated artifacts, and hands off context to the next agent. An Intelligence Layer ensures context is never lost, knowledge persists across sessions, and the user never accidentally leaves the system.
36
34
 
37
35
  ```
38
- CLARITY (planning) → Quality Gate → BUILD → Quality Gate → DEPLOY
36
+ PLANNING (planning) → Quality Gate → BUILD → Quality Gate → DEPLOY
39
37
  8 agents QA-Planning Dev QA-Impl DevOps
40
38
  ```
41
39
 
@@ -49,9 +47,10 @@ CLARITY (planning) → Quality Gate → BUILD → Quality Gate → DEPLO
49
47
  | **Memory System RECALL** | 4 cognitive sectors. Persistent knowledge across sessions with attention scoring and natural decay |
50
48
  | **Decision Engine COMPASS** | Entity catalog with Jaccard similarity for REUSE/ADAPT/CREATE decisions. Self-healing registry |
51
49
  | **Session Lock** | Once activated, user stays in system until explicit exit. Zero accidental leakage |
52
- | **Hooks System** | 5 Claude Code hooks — constitution guard, mode governance, model governance, context injection, session digest |
50
+ | **Hooks System** | 6 Claude Code hooks — constitution guard, mode governance, model governance, read protection, context injection, session digest |
51
+ | **Supply Chain Security** | Ed25519 manifest signing. Package integrity verification on install. Semantic linter for cross-reference validation |
53
52
  | **Execution Modes** | Autonomous and human-in-the-loop modes with safety net (5 triggers) and circuit breaker |
54
- | **Multi-Terminal** | Parallel agent execution with write-scope isolation (Detail + Architect + UX simultaneously) |
53
+ | **Multi-Terminal** | Autonomous agents spawn in separate `claude -p` terminals with dedicated models. Parallel groups (Detail + Architect + UX) with write-scope isolation |
55
54
  | **IDE-Agnostic** | Works with 6 IDEs through a thin router pattern |
56
55
 
57
56
  ---
@@ -64,7 +63,7 @@ CLARITY (planning) → Quality Gate → BUILD → Quality Gate → DEPLO
64
63
  npx chati-dev init
65
64
  ```
66
65
 
67
- The wizard guides you through language, project type, IDE selection, and MCP configuration.
66
+ The wizard guides you through language and project type, then auto-configures Claude Code with the required MCPs.
68
67
 
69
68
  ### Activate
70
69
 
@@ -96,7 +95,7 @@ npx chati-dev status --watch # Auto-refresh every 5s
96
95
 
97
96
  | Category | Agents | Purpose |
98
97
  |----------|--------|---------|
99
- | **CLARITY** | Greenfield WU, Brownfield WU, Brief, Detail (PRD), Architect, UX, Phases, Tasks | Planning & Requirements |
98
+ | **PLANNING** | Greenfield WU, Brownfield WU, Brief, Detail (PRD), Architect, UX, Phases, Tasks | Planning & Requirements |
100
99
  | **Quality** | QA-Planning, QA-Implementation | Validation & Gates |
101
100
  | **BUILD** | Dev | Implementation |
102
101
  | **DEPLOY** | DevOps | Shipping |
@@ -108,40 +107,53 @@ User Request
108
107
 
109
108
 
110
109
  ┌─────────────────────────────────────────────────┐
111
- │ ORCHESTRATOR (/chati)
112
- │ Routes to correct agent, manages session
113
- │ Session Lock: user stays in system
110
+ │ ORCHESTRATOR (/chati) — Main Terminal
111
+ │ Routes to correct agent, manages session
112
+ │ Session Lock: user stays in system
114
113
  └─────────────────────────────────────────────────┘
115
114
 
116
-
117
- ┌─────────────────── CLARITY ─────────────────────┐
118
-
119
- │ WU → Brief → Detail(PRD) → Architect → UX
120
- → Phases → Tasks │
121
- │ │
122
- └──────────────────────────────────────────────────┘
115
+ ├── In-conversation ──┐
116
+ │ ▼
117
+ ┌─── PLANNING (interactive) ───┐
118
+ WU → Brief
119
+ └─────────────────────────────┘
123
120
 
124
-
125
- ┌─────────────────── QUALITY ─────────────────────┐
126
- QA-Planning (traceability validation, ≥95%) │
127
- └──────────────────────────────────────────────────┘
121
+ ├── Spawns terminals ──────────────────────────┐
122
+ │ ▼
123
+ ┌─── PLANNING (autonomous) ─── Parallel ───┐
124
+ │ │ Detail (opus) ──┐ │
125
+ │ │ Architect (opus)├── run simultaneously │
126
+ │ │ UX (sonnet) ────┘ │
127
+ │ │ → Phases → Tasks │
128
+ │ └──────────────────────────────────────────┘
128
129
 
129
-
130
- ┌─────────────────── BUILD ───────────────────────┐
131
- Dev (implementation + self-validation) │
132
- └──────────────────────────────────────────────────┘
130
+ ├── Spawns terminal ──┐
131
+ │ ▼
132
+ ┌─── QUALITY ─────────────────────────────┐
133
+ │ │ QA-Planning (opus) — ≥95% threshold │
134
+ │ └──────────────────────────────────────────┘
133
135
 
134
-
135
- ┌─────────────────── QUALITY ─────────────────────┐
136
- QA-Implementation (tests + SAST + code review) │
137
- └──────────────────────────────────────────────────┘
136
+ ├── Spawns terminal(s) ┐
137
+ │ ▼
138
+ ┌─── BUILD ───────────────────────────────┐
139
+ │ │ Dev (opus) — parallel for independent │
140
+ │ └──────────────────────────────────────────┘
138
141
 
139
-
140
- ┌─────────────────── DEPLOY ──────────────────────┐
141
- DevOps (git + deploy + docs) │
142
- └──────────────────────────────────────────────────┘
142
+ ├── Spawns terminal ──┐
143
+ │ ▼
144
+ ┌─── QUALITY ─────────────────────────────┐
145
+ │ │ QA-Implementation (opus) — tests + SAST │
146
+ │ └──────────────────────────────────────────┘
147
+
148
+ └── Spawns terminal ──┐
149
+
150
+ ┌─── DEPLOY ──────────────────────────────┐
151
+ │ DevOps (sonnet) — git + deploy + docs │
152
+ └──────────────────────────────────────────┘
143
153
  ```
144
154
 
155
+ Each spawned terminal runs as a separate `claude -p --model <model>` process with its own context window, write-scope isolation, and structured handoff output.
156
+
145
157
  ### Intelligence Layer
146
158
 
147
159
  The Intelligence Layer operates transparently behind the pipeline:
@@ -177,7 +189,7 @@ The system is governed by a **17-article Constitution** that enforces agent beha
177
189
  | I-IV | Agent governance, quality standards, memory & context, security |
178
190
  | V-VII | Communication protocol, design system, English-only documentation |
179
191
  | VIII-X | Two-layer handoff, agent-driven interaction, dynamic self-validation |
180
- | XI | Mode governance (clarity/build/deploy) with autonomous transitions |
192
+ | XI | Mode governance (planning/build/deploy) with autonomous transitions |
181
193
  | XII-XIV | Context bracket governance, memory governance, framework registry |
182
194
  | XV | Session lock governance — mandatory lock, explicit exit only |
183
195
  | XVI | Model governance — opus/sonnet/haiku per agent, no downgrade rule |
@@ -255,7 +267,7 @@ your-project/
255
267
  ├── chati.dev/
256
268
  │ ├── orchestrator/ # Main orchestrator
257
269
  │ ├── agents/ # 13 agent definitions
258
- │ │ ├── clarity/ # 8 planning agents
270
+ │ │ ├── planning/ # 8 planning agents
259
271
  │ │ ├── quality/ # 2 quality gate agents
260
272
  │ │ ├── build/ # Dev agent
261
273
  │ │ └── deploy/ # DevOps agent
@@ -265,7 +277,7 @@ your-project/
265
277
  │ ├── schemas/ # 5 JSON schemas for validation
266
278
  │ ├── intelligence/ # Context Engine, Memory Layer, Decision Engine
267
279
  │ ├── domains/ # Domain loading configs (per-agent, per-workflow)
268
- │ ├── hooks/ # 5 Claude Code hooks (enforcement)
280
+ │ ├── hooks/ # 6 Claude Code hooks (enforcement)
269
281
  │ ├── context/ # Context source files (deployed to .claude/rules/)
270
282
  │ ├── frameworks/ # Decision heuristics, quality dims
271
283
  │ ├── quality-gates/ # Planning & implementation gates
@@ -287,7 +299,8 @@ your-project/
287
299
  │ ├── 8-Validation/
288
300
  │ └── handoffs/
289
301
  └── packages/
290
- └── chati-dev/ # CLI installer (npx chati-dev)
302
+ └── chati-dev/ # CLI + runtime engine (npx chati-dev)
303
+ └── src/terminal/ # Multi-terminal spawner, monitor, collector
291
304
  ```
292
305
 
293
306
  ---
@@ -8,7 +8,7 @@ You are the **Architect Agent**, responsible for defining HOW the system will be
8
8
 
9
9
  - **Role**: Technical Design & Data Architecture Specialist
10
10
  - **Pipeline Position**: 4th (greenfield, after Detail) or 3rd (brownfield, after Brief)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: HOW will we build it?
13
13
  - **Duration**: 45-90 min
14
14
  - **Ratio**: 50% Human / 50% AI
@@ -8,7 +8,7 @@ You are the **Brief Agent**, responsible for extracting and structuring the core
8
8
 
9
9
  - **Role**: Problem Extraction Specialist
10
10
  - **Pipeline Position**: 2nd agent (after WU)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: WHAT is the problem?
13
13
  - **Duration**: 30-60 min
14
14
  - **Ratio**: 90% Human / 10% AI
@@ -8,7 +8,7 @@ You are the **Brownfield WU Agent**, responsible for comprehensive discovery of
8
8
 
9
9
  - **Role**: Technical + Operational Discovery Agent
10
10
  - **Pipeline Position**: 1st agent (brownfield projects)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: HOW does it work today? (both code and operations)
13
13
  - **Duration**: 1-4h depending on codebase size
14
14
  - **Ratio**: 40% Human / 60% AI
@@ -8,7 +8,7 @@ You are the **Detail Agent**, responsible for transforming the Brief into a form
8
8
 
9
9
  - **Role**: Product Specification & Requirements Analyst
10
10
  - **Pipeline Position**: 3rd (greenfield) or 4th (brownfield, after Architect)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: WHAT will we build?
13
13
  - **Duration**: 45-90 min
14
14
  - **Ratio**: 70% Human / 30% AI
@@ -8,7 +8,7 @@ You are the **Greenfield WU Agent**, responsible for understanding HOW the user
8
8
 
9
9
  - **Role**: Operational Discovery Agent
10
10
  - **Pipeline Position**: 1st agent (greenfield projects)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: HOW does it work today?
13
13
  - **Duration**: 15-30 min
14
14
  - **Ratio**: 70% Human / 30% AI
@@ -8,7 +8,7 @@ You are the **Phases Agent**, responsible for breaking the PRD into development
8
8
 
9
9
  - **Role**: Roadmap & Execution Planning Specialist
10
10
  - **Pipeline Position**: 6th (after UX)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: WHEN will we build it?
13
13
  - **Duration**: 20-40 min
14
14
  - **Ratio**: 60% Human / 40% AI
@@ -8,7 +8,7 @@ You are the **Tasks Agent**, responsible for breaking phases into atomic, execut
8
8
 
9
9
  - **Role**: Work Breakdown & Task Definition Specialist
10
10
  - **Pipeline Position**: 7th (after Phases)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: WHO does WHAT specifically?
13
13
  - **Duration**: 30-60 min
14
14
  - **Ratio**: 50% Human / 50% AI
@@ -8,7 +8,7 @@ You are the **UX Agent**, responsible for defining HOW the product will look and
8
8
 
9
9
  - **Role**: User Experience & Design System Specialist
10
10
  - **Pipeline Position**: 5th (after Architect in both flows)
11
- - **Category**: CLARITY
11
+ - **Category**: PLANNING
12
12
  - **Question Answered**: HOW will it look/feel?
13
13
  - **Duration**: 30-60 min
14
14
  - **Ratio**: 60% Human / 40% AI
@@ -1,6 +1,6 @@
1
1
  # QA-Planning Agent — Traceability Validation
2
2
 
3
- You are the **QA-Planning Agent**, the quality gate between CLARITY (planning) and BUILD (implementation). You validate traceability across all planning artifacts and the rigor of each agent's self-defined criteria. Nothing proceeds to BUILD without your approval.
3
+ You are the **QA-Planning Agent**, the quality gate between PLANNING (planning) and BUILD (implementation). You validate traceability across all planning artifacts and the rigor of each agent's self-defined criteria. Nothing proceeds to BUILD without your approval.
4
4
 
5
5
  ---
6
6
 
@@ -31,7 +31,7 @@ Validate that every Brief problem traces through to a testable task, no requirem
31
31
 
32
32
  ## On Activation
33
33
 
34
- 1. Read ALL CLARITY artifacts:
34
+ 1. Read ALL PLANNING artifacts:
35
35
  - `chati.dev/artifacts/0-WU/` (wu report)
36
36
  - `chati.dev/artifacts/1-Brief/brief-report.md`
37
37
  - `chati.dev/artifacts/2-PRD/prd.md`
@@ -48,7 +48,7 @@ Validate that every Brief problem traces through to a testable task, no requirem
48
48
 
49
49
  ### Step 1: Collect All Artifacts
50
50
  ```
51
- Read every CLARITY artifact and extract:
51
+ Read every PLANNING artifact and extract:
52
52
  - Brief problems list
53
53
  - PRD requirements list (FR-XXX, NFR-XXX)
54
54
  - Architecture components
@@ -109,7 +109,7 @@ Scan ALL artifacts for: [TODO], [TBD], [PLACEHOLDER], [FIXME], {TBD}
109
109
  ### Step 3: Validate Criteria Quality (Checks & Balances)
110
110
 
111
111
  ```
112
- For each agent that completed CLARITY:
112
+ For each agent that completed PLANNING:
113
113
  1. Read their self-validation criteria from handoff
114
114
  2. Assess criteria rigor:
115
115
  - Are criteria BINARY (pass/fail)? Not subjective?
@@ -229,7 +229,7 @@ agents:
229
229
  criteria_count: {total checks performed}
230
230
  completed_at: "{timestamp}"
231
231
  project:
232
- state: build # Transition from clarity to build
232
+ state: build # Transition from planning to build
233
233
  current_agent: dev
234
234
  ```
235
235
 
@@ -6,7 +6,7 @@ Chati.dev is a planning-first AI-assisted orchestration system that coordinates
6
6
 
7
7
  ### 4 Core Principles
8
8
 
9
- 1. **Clarity Before Code**: Never write code without understanding the problem, the users, and the constraints. The CLARITY phase exists because assumptions are the root cause of failed projects.
9
+ 1. **Planning Before Code**: Never write code without understanding the problem, the users, and the constraints. The PLANNING phase exists because assumptions are the root cause of failed projects.
10
10
 
11
11
  2. **Short Iterations**: Deliver value in small, verifiable increments. Every agent validates its own output before passing forward. Every quality gate catches issues early.
12
12
 
@@ -242,17 +242,17 @@ The pipeline operates in three execution modes that control agent permissions. M
242
242
 
243
243
  | Mode | States | Read Scope | Write Scope |
244
244
  |------|--------|------------|-------------|
245
- | **clarity** | clarity | Entire project (codebase + chati.dev/) | `chati.dev/` and `.chati/` only |
245
+ | **planning** | planning | Entire project (codebase + chati.dev/) | `chati.dev/` and `.chati/` only |
246
246
  | **build** | build, validate | Entire project | Entire project |
247
247
  | **deploy** | deploy | Entire project | Entire project + infra/CI operations |
248
248
 
249
249
  ### Enforcement Rules
250
250
 
251
- 1. In `clarity` mode, agents MAY read any file in the project (essential for brownfield-wu)
252
- 2. In `clarity` mode, agents MUST NOT write/edit files outside `chati.dev/` and `.chati/`
251
+ 1. In `planning` mode, agents MAY read any file in the project (essential for brownfield-wu)
252
+ 2. In `planning` mode, agents MUST NOT write/edit files outside `chati.dev/` and `.chati/`
253
253
  3. Transition to `build` requires QA-Planning score >= 95% (Article II)
254
254
  4. Transition to `deploy` requires QA-Implementation APPROVED
255
- 5. Backward transition from `build` to `clarity` is permitted when QA-Implementation classifies an issue as `spec` or `architecture` (not `code`)
255
+ 5. Backward transition from `build` to `planning` is permitted when QA-Implementation classifies an issue as `spec` or `architecture` (not `code`)
256
256
  6. Mode overrides require explicit user confirmation and are logged in session.yaml
257
257
 
258
258
  **Enforcement: BLOCK** — Write operations outside permitted scope are rejected.
@@ -383,8 +383,8 @@ The system SHALL support two execution modes that govern the degree of human inv
383
383
  2. Mode suggestion is computed from project context (risk score). The mode-suggester evaluates: project type, task complexity, risk domains, project history, and recent gotchas. A risk score > 50 suggests human-in-the-loop.
384
384
 
385
385
  3. Quality gate thresholds are conservative by default:
386
- - **qa-planning**: 95% minimum (gates clarity-to-build transition)
387
- - **qa-implementation**: 90% minimum (gates build-to-deploy transition)
386
+ - **qa-planning**: 95% minimum (gates planning-to-build transition)
387
+ - **qa-implementation**: 95% minimum (gates build-to-deploy transition)
388
388
  - **All other agents**: 90% minimum
389
389
  - Scores below threshold trigger escalation regardless of execution mode.
390
390
 
@@ -3,9 +3,9 @@
3
3
  Extracted from `chati.dev/constitution.md` (17 Articles). Read the full constitution for complete rules.
4
4
 
5
5
  ## Mode Governance (Article XI)
6
- - **3 modes**: clarity (read all, write chati.dev/ only), build (full access), deploy (full + infra)
7
- - **Autonomous transitions**: clarity->build (QA-Planning >= 95%), build->validate (dev done), validate->deploy (QA-Impl approved)
8
- - **Backward transitions**: build/validate->clarity when QA finds spec/architecture issues
6
+ - **3 modes**: planning (read all, write chati.dev/ only), build (full access), deploy (full + infra)
7
+ - **Autonomous transitions**: planning->build (QA-Planning >= 95%), build->validate (dev done), validate->deploy (QA-Impl approved)
8
+ - **Backward transitions**: build/validate->planning when QA finds spec/architecture issues
9
9
 
10
10
  ## Context Bracket (Article XII)
11
11
  - 4 brackets: FRESH, MODERATE, DEPLETED, CRITICAL
@@ -32,6 +32,6 @@ Extracted from `chati.dev/constitution.md` (17 Articles). Read the full constitu
32
32
  - Model recorded in session for cost tracking
33
33
 
34
34
  ## Execution Mode (Article XVII)
35
- - Autonomous mode requires gate score >= 90% (qa-planning >= 95%)
35
+ - Autonomous mode requires gate score >= 90% (qa-planning >= 95%, qa-implementation >= 95%)
36
36
  - Safety net with 5 triggers: stuck loop, quality drop, scope creep, error cascade, user override
37
37
  - Circuit breaker: CLOSED -> OPEN (3 failures) -> HALF_OPEN (probe)
@@ -4,16 +4,17 @@
4
4
  | Agent | Minimum Score |
5
5
  |-------|--------------|
6
6
  | qa-planning | 95% |
7
+ | qa-implementation | 95% |
7
8
  | All others | 90% |
8
9
 
9
10
  ## Review Range
10
11
  Scores within 5 points below threshold trigger REVIEW (human confirmation required even in autonomous mode).
11
12
 
12
13
  ## 5 Pipeline Gates
13
- 1. **Planning Complete** — All CLARITY agents finished
14
+ 1. **Planning Complete** — All PLANNING agents finished
14
15
  2. **QA Planning** — QA-Planning agent validates plan coherence (95% threshold)
15
16
  3. **Implementation** — Dev agent completes all tasks
16
- 4. **QA Implementation** — Tests pass, SAST clean, coverage adequate (90% threshold)
17
+ 4. **QA Implementation** — Tests pass, SAST clean, coverage adequate (95% threshold)
17
18
  5. **Deploy Ready** — All gates passed, ready for production
18
19
 
19
20
  ## Quality Dimensions
@@ -15,7 +15,7 @@
15
15
 
16
16
  ## Pipeline
17
17
  ```
18
- CLARITY: WU -> Brief -> Detail -> Architect -> UX -> Phases -> Tasks -> QA-Planning
18
+ PLANNING: WU -> Brief -> Detail -> Architect -> UX -> Phases -> Tasks -> QA-Planning
19
19
  BUILD: Dev -> QA-Implementation
20
20
  DEPLOY: DevOps
21
21
  ```
@@ -19,7 +19,7 @@ entities:
19
19
  adaptability: 0.2
20
20
 
21
21
  greenfield-wu:
22
- path: chati.dev/agents/clarity/greenfield-wu.md
22
+ path: chati.dev/agents/planning/greenfield-wu.md
23
23
  type: agent
24
24
  purpose: "Analyze greenfield project context, constraints, and technology landscape"
25
25
  keywords: [greenfield, analysis, context, technology, constraints]
@@ -27,7 +27,7 @@ entities:
27
27
  adaptability: 0.5
28
28
 
29
29
  brownfield-wu:
30
- path: chati.dev/agents/clarity/brownfield-wu.md
30
+ path: chati.dev/agents/planning/brownfield-wu.md
31
31
  type: agent
32
32
  purpose: "Deep discovery of existing codebase — architecture, patterns, debt, dependencies"
33
33
  keywords: [brownfield, discovery, codebase, architecture, debt]
@@ -35,7 +35,7 @@ entities:
35
35
  adaptability: 0.5
36
36
 
37
37
  brief:
38
- path: chati.dev/agents/clarity/brief.md
38
+ path: chati.dev/agents/planning/brief.md
39
39
  type: agent
40
40
  purpose: "Extract and structure user requirements through 5 elicitation phases"
41
41
  keywords: [requirements, elicitation, brief, functional, non-functional]
@@ -43,7 +43,7 @@ entities:
43
43
  adaptability: 0.4
44
44
 
45
45
  detail:
46
- path: chati.dev/agents/clarity/detail.md
46
+ path: chati.dev/agents/planning/detail.md
47
47
  type: agent
48
48
  purpose: "Transform Brief into formal PRD with complete specifications"
49
49
  keywords: [prd, specification, detail, formal, requirements]
@@ -51,7 +51,7 @@ entities:
51
51
  adaptability: 0.4
52
52
 
53
53
  architect:
54
- path: chati.dev/agents/clarity/architect.md
54
+ path: chati.dev/agents/planning/architect.md
55
55
  type: agent
56
56
  purpose: "Design technical architecture, make technology decisions, define system boundaries"
57
57
  keywords: [architecture, technology, design, patterns, boundaries]
@@ -59,7 +59,7 @@ entities:
59
59
  adaptability: 0.3
60
60
 
61
61
  ux:
62
- path: chati.dev/agents/clarity/ux.md
62
+ path: chati.dev/agents/planning/ux.md
63
63
  type: agent
64
64
  purpose: "Design user experience, interaction flows, and interface structure"
65
65
  keywords: [ux, design, interaction, flows, interface, wireframes]
@@ -67,7 +67,7 @@ entities:
67
67
  adaptability: 0.5
68
68
 
69
69
  phases:
70
- path: chati.dev/agents/clarity/phases.md
70
+ path: chati.dev/agents/planning/phases.md
71
71
  type: agent
72
72
  purpose: "Decompose PRD into development phases with MVP-first strategy"
73
73
  keywords: [phases, decomposition, mvp, planning, milestones]
@@ -75,7 +75,7 @@ entities:
75
75
  adaptability: 0.4
76
76
 
77
77
  tasks:
78
- path: chati.dev/agents/clarity/tasks.md
78
+ path: chati.dev/agents/planning/tasks.md
79
79
  type: agent
80
80
  purpose: "Create executable tasks with acceptance criteria from phase definitions"
81
81
  keywords: [tasks, acceptance-criteria, executable, given-when-then]
@@ -85,7 +85,7 @@ entities:
85
85
  qa-planning:
86
86
  path: chati.dev/agents/quality/qa-planning.md
87
87
  type: agent
88
- purpose: "Validate traceability and consistency across all clarity artifacts"
88
+ purpose: "Validate traceability and consistency across all planning artifacts"
89
89
  keywords: [qa, traceability, consistency, validation, quality-gate]
90
90
  dependencies: [qa-gate-template, planning-gate, session-schema]
91
91
  adaptability: 0.3
@@ -39,5 +39,5 @@ rules:
39
39
  priority: high
40
40
 
41
41
  - id: qai-backward
42
- text: "If spec/architecture issues found, trigger backward transition to clarity mode."
42
+ text: "If spec/architecture issues found, trigger backward transition to planning mode."
43
43
  priority: high
@@ -5,7 +5,7 @@ summary: >
5
5
  Constitution governance: self-validation required (loop until quality >= 95%),
6
6
  guided options (1,2,3 format), persistent session state, two-layer handoff,
7
7
  language protocol (interaction=user lang, artifacts=English),
8
- deviation protocol, mode governance (clarity/build/deploy),
8
+ deviation protocol, mode governance (planning/build/deploy),
9
9
  context brackets, memory governance, registry governance,
10
10
  session lock, model governance.
11
11
 
@@ -53,7 +53,7 @@ rules:
53
53
  priority: high
54
54
 
55
55
  - id: art-xi
56
- text: "Mode governance: clarity (read all, write chati.dev/), build (full), deploy (full + infra)."
56
+ text: "Mode governance: planning (read all, write chati.dev/), build (full), deploy (full + infra)."
57
57
  priority: critical
58
58
 
59
59
  - id: art-xii
@@ -19,7 +19,7 @@ rules:
19
19
  priority: normal
20
20
 
21
21
  modes:
22
- clarity:
22
+ planning:
23
23
  writeScope: "chati.dev/"
24
24
  allowedActions:
25
25
  - read_any_file
@@ -3,7 +3,7 @@
3
3
  * Mode Governance Hook — PreToolUse (Write/Edit)
4
4
  *
5
5
  * BLOCKS write operations outside the scope of the current mode:
6
- * - clarity mode: can only write to chati.dev/ and .chati/
6
+ * - planning mode: can only write to chati.dev/ and .chati/
7
7
  * - build mode: can write anywhere
8
8
  * - deploy mode: can write anywhere + infra
9
9
  *
@@ -14,9 +14,9 @@ import { existsSync, readFileSync } from 'fs';
14
14
  import { join, relative, isAbsolute } from 'path';
15
15
 
16
16
  const MODE_SCOPES = {
17
- clarity: {
17
+ planning: {
18
18
  allowed: ['chati.dev/', '.chati/', 'chati.dev/artifacts/'],
19
- description: 'Clarity mode: write only to chati.dev/ and .chati/',
19
+ description: 'Planning mode: write only to chati.dev/ and .chati/',
20
20
  },
21
21
  build: {
22
22
  allowed: ['*'],
@@ -30,11 +30,11 @@ const MODE_SCOPES = {
30
30
 
31
31
  function getCurrentMode(projectDir) {
32
32
  const sessionPath = join(projectDir, '.chati', 'session.yaml');
33
- if (!existsSync(sessionPath)) return 'clarity'; // Default to most restrictive
33
+ if (!existsSync(sessionPath)) return 'planning'; // Default to most restrictive
34
34
 
35
35
  const raw = readFileSync(sessionPath, 'utf-8');
36
36
  const match = raw.match(/^\s*mode:\s*(.+)$/m);
37
- return match ? match[1].trim().replace(/^["']|["']$/g, '') : 'clarity';
37
+ return match ? match[1].trim().replace(/^["']|["']$/g, '') : 'planning';
38
38
  }
39
39
 
40
40
  function isPathAllowed(filePath, projectDir, mode) {
@@ -27,7 +27,7 @@ function readSessionState(projectDir) {
27
27
  };
28
28
 
29
29
  return {
30
- mode: extract('mode') || 'clarity',
30
+ mode: extract('mode') || 'planning',
31
31
  currentAgent: extract('current_agent') || null,
32
32
  workflow: extract('workflow') || null,
33
33
  pipelinePosition: extract('pipeline_position') || null,
@@ -66,12 +66,26 @@ async function main() {
66
66
  else if (remainingPercent < 40) bracket = 'DEPLETED';
67
67
  else if (remainingPercent < 60) bracket = 'MODERATE';
68
68
 
69
+ // Load agent memory (if active agent has MEMORY.md)
70
+ let memoryBlock = '';
71
+ if (session.currentAgent) {
72
+ const memoryPath = join(projectDir, '.chati', 'memories', session.currentAgent, 'MEMORY.md');
73
+ if (existsSync(memoryPath)) {
74
+ const raw = readFileSync(memoryPath, 'utf-8').trim();
75
+ if (raw) {
76
+ const trimmed = raw.slice(0, 500);
77
+ memoryBlock = ` <agent-memory agent="${session.currentAgent}">\n${trimmed}\n </agent-memory>`;
78
+ }
79
+ }
80
+ }
81
+
69
82
  // Build minimal context block (full PRISM pipeline is used by orchestrator internally)
70
83
  const contextBlock = [
71
84
  `<chati-context bracket="${bracket}">`,
72
85
  ` <mode>${session.mode}</mode>`,
73
86
  session.currentAgent ? ` <agent>${session.currentAgent}</agent>` : '',
74
87
  session.pipelinePosition ? ` <pipeline-position>${session.pipelinePosition}</pipeline-position>` : '',
88
+ memoryBlock,
75
89
  bracket === 'CRITICAL' ? ' <advisory>Context running low. Consider handoff or summary.</advisory>' : '',
76
90
  '</chati-context>',
77
91
  ].filter(Boolean).join('\n');
@@ -86,4 +100,10 @@ async function main() {
86
100
  }
87
101
  }
88
102
 
89
- main();
103
+ export { readSessionState };
104
+
105
+ // Only run main when executed directly (not imported by tests)
106
+ import { fileURLToPath } from 'url';
107
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
108
+ main();
109
+ }