chati-dev 4.5.16 → 4.5.28

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 (122) hide show
  1. package/README.md +8 -3
  2. package/bin/chati.js +124 -66
  3. package/framework/agents/build/dev.md +5 -5
  4. package/framework/agents/deploy/devops.md +7 -7
  5. package/framework/agents/discover/brief.md +4 -4
  6. package/framework/agents/discover/brownfield-wu.md +3 -3
  7. package/framework/agents/discover/greenfield-wu.md +3 -3
  8. package/framework/agents/plan/architect.md +2 -2
  9. package/framework/agents/plan/detail.md +4 -4
  10. package/framework/agents/plan/phases.md +2 -2
  11. package/framework/agents/plan/tasks.md +2 -2
  12. package/framework/agents/plan/ux.md +2 -2
  13. package/framework/agents/quality/qa-implementation.md +11 -10
  14. package/framework/agents/quality/qa-planning.md +3 -3
  15. package/framework/agents/quality/qa-visual.md +1 -1
  16. package/framework/config.yaml +3 -3
  17. package/framework/constitution.md +18 -18
  18. package/framework/context/protocols.md +1 -1
  19. package/framework/context/quality.md +1 -1
  20. package/framework/context/root.md +4 -4
  21. package/framework/data/entity-registry.yaml +1 -1
  22. package/framework/domains/agents/orchestrator.yaml +2 -2
  23. package/framework/domains/constitution.yaml +1 -1
  24. package/framework/hooks/advance-trigger.js +4 -6
  25. package/framework/hooks/git-push-authority.js +45 -37
  26. package/framework/hooks/mode-governance.js +149 -40
  27. package/framework/hooks/model-governance.js +13 -20
  28. package/framework/hooks/prism-engine.js +74 -92
  29. package/framework/hooks/reasoning-escalator.js +23 -40
  30. package/framework/hooks/session-digest.js +12 -13
  31. package/framework/hooks/session-reader.js +224 -0
  32. package/framework/hooks/session-writer.js +195 -0
  33. package/framework/hooks/team-quality-gate.js +34 -24
  34. package/framework/i18n/en.yaml +2 -2
  35. package/framework/i18n/es.yaml +2 -2
  36. package/framework/i18n/fr.yaml +2 -2
  37. package/framework/i18n/pt.yaml +2 -2
  38. package/framework/intelligence/context-engine.md +4 -4
  39. package/framework/intelligence/memory-layer.md +1 -1
  40. package/framework/manifest.json +129 -119
  41. package/framework/manifest.sig +1 -1
  42. package/framework/orchestrator/chati-router.js +252 -25
  43. package/framework/orchestrator/chati.md +238 -70
  44. package/framework/schemas/session.schema.json +1 -1
  45. package/framework/tasks/orchestrator-deviation.md +1 -1
  46. package/framework/tasks/orchestrator-escalate.md +1 -1
  47. package/framework/tasks/orchestrator-handoff.md +6 -6
  48. package/framework/tasks/orchestrator-health.md +5 -9
  49. package/framework/tasks/orchestrator-mode-switch.md +3 -7
  50. package/framework/tasks/orchestrator-resume.md +10 -14
  51. package/framework/tasks/orchestrator-route.md +3 -3
  52. package/framework/tasks/orchestrator-spawn-terminal.md +1 -1
  53. package/framework/tasks/orchestrator-status.md +9 -9
  54. package/framework/tasks/orchestrator-suggest-mode.md +1 -1
  55. package/framework/tasks/qa-impl-consolidate.md +2 -2
  56. package/framework/tasks/qa-impl-performance-test.md +4 -4
  57. package/framework/tasks/qa-impl-regression-check.md +4 -4
  58. package/framework/tasks/qa-impl-sast-scan.md +1 -1
  59. package/framework/tasks/qa-impl-test-execute.md +1 -1
  60. package/framework/tasks/qa-impl-verdict.md +2 -2
  61. package/framework/tasks/qa-planning-consolidate.md +3 -3
  62. package/framework/tasks/qa-planning-coverage-plan.md +2 -2
  63. package/framework/tasks/qa-planning-gate-define.md +4 -4
  64. package/framework/tasks/qa-planning-risk-matrix.md +4 -4
  65. package/framework/tasks/qa-planning-test-strategy.md +2 -2
  66. package/node_modules/@chati/browser-capability/src/index.js +12 -2
  67. package/node_modules/@chati/planning/src/index.js +24 -4
  68. package/node_modules/@chati/provider-registry/src/index.js +11 -0
  69. package/node_modules/@chati/rail/src/index.js +1967 -83
  70. package/node_modules/@chati/release-lane/README.md +12 -8
  71. package/node_modules/@chati/release-lane/package.json +1 -1
  72. package/node_modules/@chati/release-lane/src/index.js +1426 -58
  73. package/node_modules/@chati/review-council/src/index.js +63 -0
  74. package/node_modules/@chati/tracking-clickup/README.md +13 -0
  75. package/node_modules/@chati/tracking-clickup/src/index.js +690 -30
  76. package/package-artifact-manifest.json +1 -0
  77. package/package-artifact-manifest.sig +1 -0
  78. package/package.json +16 -7
  79. package/scripts/verify-real-harness-e2e.js +1581 -0
  80. package/src/config/framework-adapter.js +4 -4
  81. package/src/installer/core.js +148 -53
  82. package/src/installer/manifest.js +140 -9
  83. package/src/installer/package-artifact.js +249 -0
  84. package/src/installer/templates.js +65 -20
  85. package/src/installer-v2/catalog-client.js +531 -23
  86. package/src/installer-v2/index.js +91 -34
  87. package/src/installer-v2/installation-authority.js +327 -0
  88. package/src/installer-v2/provider-executable.js +247 -0
  89. package/src/installer-v2/wizard-installation.js +1 -1
  90. package/src/orchestrator/browser-runtime.js +44 -13
  91. package/src/orchestrator/cli.js +1545 -174
  92. package/src/orchestrator/clickup-projection.js +43 -1
  93. package/src/orchestrator/clickup-runtime.js +355 -39
  94. package/src/orchestrator/doctor.js +16 -3
  95. package/src/orchestrator/index.js +16 -0
  96. package/src/orchestrator/planning-runtime.js +20 -2
  97. package/src/orchestrator/rail-adjudication-evidence.js +234 -0
  98. package/src/orchestrator/rail-evidence-authority.js +147 -0
  99. package/src/orchestrator/rail-execution-evidence.js +45 -0
  100. package/src/orchestrator/rail-runtime.js +836 -56
  101. package/src/orchestrator/release-runtime.js +65 -6
  102. package/src/orchestrator/review-runtime.js +186 -41
  103. package/src/orchestrator/runtime-installation-v2.js +236 -20
  104. package/src/orchestrator/session-manager.js +1167 -53
  105. package/src/terminal/adapters/claude-adapter.js +3 -1
  106. package/src/terminal/adapters/codex-adapter.js +2 -0
  107. package/src/terminal/adapters/grok-adapter.js +7 -4
  108. package/src/terminal/handoff-parser.js +19 -1
  109. package/src/terminal/prompt-builder.js +9 -1
  110. package/src/terminal/provider-preflight.js +36 -3
  111. package/src/terminal/rail-execution-worktree.js +213 -0
  112. package/src/terminal/rail-prompts.js +169 -0
  113. package/src/terminal/rail-readonly-workspace.js +324 -0
  114. package/src/terminal/run-agent.js +384 -24
  115. package/src/terminal/run-parallel.js +5 -0
  116. package/src/terminal/run-rail-adjudication.js +323 -0
  117. package/src/terminal/run-rail-review.js +291 -0
  118. package/src/terminal/run-rail-rework.js +325 -0
  119. package/src/terminal/run-rail-task.js +380 -0
  120. package/src/terminal/run-team.js +5 -0
  121. package/src/terminal/spawner.js +1225 -77
  122. package/src/wizard/index.js +3 -2
@@ -42,7 +42,7 @@ Coordinate the design experience by activating 3 specialist sub-agents in sequen
42
42
  ## On Activation
43
43
 
44
44
  1. Read handoff from Architect
45
- 2. Read `.chati/session.yaml` for project context
45
+ 2. Use the validated canonical session context supplied in the activation prompt for project context. Never read `.chati/session.yaml` directly.
46
46
  3. Read Brief: `artifacts/1-Brief/brief-report.md` (target users)
47
47
  4. Read Architecture: `artifacts/3-Architecture/architecture.md` (tech constraints)
48
48
  5. Acknowledge inherited context
@@ -272,7 +272,7 @@ If score < 90%, identify which sub-agent's criteria failed and request correctio
272
272
 
273
273
  ### Team Mode Detection
274
274
 
275
- Team mode is active when ANY of these is true: (a) your activation prompt contains "Team mode active", (b) `CHATI_TEAM_ID` environment variable is set, or (c) `session.yaml` `teams[]` has an active entry where your name appears in the roster.
275
+ Team mode is active when your validated activation prompt says "Team mode active" or `CHATI_TEAM_ID` is set. Never inspect canonical session storage to infer membership.
276
276
 
277
277
  If team mode is active:
278
278
  1. Read your Shared Task List from the team's `task_list_path`.
@@ -34,7 +34,7 @@ Validate that the implemented code meets quality standards: tests pass, coverage
34
34
  ## On Activation
35
35
 
36
36
  1. Read handoff from Dev agent
37
- 2. Read `.chati/session.yaml` for project context
37
+ 2. Use the validated canonical session context supplied in the activation prompt for project context. Never read `.chati/session.yaml` directly.
38
38
  3. Read Tasks: `artifacts/6-Tasks/tasks.md` (acceptance criteria)
39
39
  4. Read Architecture: `artifacts/3-Architecture/architecture.md` (patterns)
40
40
  5. Read UX: `artifacts/4-UX/ux-specification.md` (Design System tokens, component states)
@@ -51,20 +51,21 @@ Validate that the implemented code meets quality standards: tests pass, coverage
51
51
  ### Pre-Flight: Decision Trail Check (Article XXII)
52
52
  ```
53
53
  Before beginning test execution:
54
- 1. Read session.yaml decision_trail[] array (read-only do NOT edit session.yaml directly)
54
+ 1. Run `node .chati.dev/orchestrator/chati-router.js status` and consume the
55
+ validated `decision_trail` array returned by the CLI
55
56
  2. Filter for unresolved entries (resolved: false) relevant to current phase
56
57
  3. For each unresolved entry:
57
58
  - Announce: "Known issue from prior revision: {what_was_wrong}. Avoid: {avoid}."
58
59
  - Actively check whether the current implementation addresses it
59
60
  - If resolved by current implementation: record the resolution in your handoff document
60
- under "## Resolved Decision Trail" the CLI will mark resolved: true in session.yaml
61
+ under "## Resolved Decision Trail"; the CLI will persist `resolved: true` canonically
61
62
  - If still present: treat as ERROR, skip to Silent Correction Loop immediately
62
63
  4. If no Decision Trail entries exist: proceed normally
63
64
 
64
65
  NOTE: Do NOT edit session.yaml directly. The mode-governance hook blocks direct writes.
65
66
  Record all Decision Trail entries and resolutions in your handoff document
66
67
  (artifacts/handoffs/qa-implementation-handoff.md) under "## Decision Trail" and
67
- "## Resolved Decision Trail" sections. The CLI merges these into session.yaml when you advance.
68
+ "## Resolved Decision Trail" sections. The CLI-managed session manager merges these when you advance.
68
69
  ```
69
70
 
70
71
  ### Phase 1: Test Execution
@@ -237,7 +238,7 @@ Classification Decision Tree:
237
238
  3. Does the code simply not implement the spec?
238
239
  YES → CODE (Dev agent silent correction loop - existing behavior)
239
240
  4. Is the issue outside the defined scope?
240
- YES → DEFER (add to session.yaml backlog)
241
+ YES → DEFER (return a backlog entry for the orchestrator to persist)
241
242
 
242
243
  For each correction request, include:
243
244
  FINDING: {defect description - one sentence, observable}
@@ -250,13 +251,13 @@ Routing Enforcement:
250
251
  - CODE → Dev agent via Silent Correction Loop (max 3 iterations, Article X)
251
252
  - SPEC → orchestrator notified, backward transition to Detail/Architect/Tasks
252
253
  - INTENT → orchestrator notified, deviation protocol activated (user must resolve)
253
- - DEFER → orchestrator adds to session.yaml backlog[], does NOT block approval
254
+ - DEFER → orchestrator persists the item in canonical `backlog[]`, does NOT block approval
254
255
 
255
256
  Decision Trail Write:
256
257
  After each correction loop iteration, record a Decision Trail entry in your handoff document
257
258
  (artifacts/handoffs/qa-implementation-handoff.md) under a "## Decision Trail" section.
258
259
  Do NOT write to session.yaml directly — the mode-governance hook will block it.
259
- The CLI merges Decision Trail entries from your handoff into session.yaml when you advance.
260
+ The CLI-managed session manager merges Decision Trail entries from your handoff when you advance.
260
261
 
261
262
  Decision Trail entry format (write in handoff document):
262
263
  id: DT-{next_sequence}
@@ -614,7 +615,7 @@ Save to: `artifacts/handoffs/qa-implementation-handoff.md`
614
615
  # The CLI records your completion when you run:
615
616
  # node chati.dev/orchestrator/chati-router.js advance --agent qa-implementation --score <N>
616
617
  # The YAML below is for orchestrator reference only. Record decision_trail entries in
617
- # your handoff document under "## Decision Trail" the CLI will merge them into session.yaml.
618
+ # your handoff document under "## Decision Trail"; the CLI will merge them into canonical state.
618
619
  agents:
619
620
  qa-implementation:
620
621
  status: completed
@@ -728,7 +729,7 @@ Threshold: >= 95% (15/16 minimum). Canonical value: chati.dev/data/qa-rubrics.ya
728
729
 
729
730
  | Level | Source | Purpose |
730
731
  |-------|--------|---------|
731
- | L0 | `.chati/session.yaml` | Project type, current pipeline position, execution mode, Dev agent status |
732
+ | L0 | Router-validated prompt context | Project type, current pipeline position, execution mode, Dev agent status |
732
733
  | L1 | `chati.dev/constitution.md` | Protocols, validation thresholds, handoff rules, blocker taxonomy |
733
734
  | L2 | `artifacts/6-Tasks/tasks.md` | Acceptance criteria for verification (Given-When-Then) |
734
735
  | L3 | `artifacts/3-Architecture/architecture.md` | Architecture patterns, conventions, tech stack for code review |
@@ -832,7 +833,7 @@ On error during execution:
832
833
 
833
834
  ### Team Mode Detection
834
835
 
835
- Team mode is active when ANY of these is true: (a) your activation prompt contains "Team mode active", (b) `CHATI_TEAM_ID` environment variable is set, or (c) `session.yaml` `teams[]` has an active entry where your name appears in the roster.
836
+ Team mode is active when your validated activation prompt says "Team mode active" or `CHATI_TEAM_ID` is set. Never inspect canonical session storage to infer membership.
836
837
 
837
838
  If team mode is active:
838
839
  1. Read your Shared Task List from the team's `task_list_path`.
@@ -41,7 +41,7 @@ Validate that every Brief problem traces through to a testable task, no requirem
41
41
  - `artifacts/5-Phases/phases.md`
42
42
  - `artifacts/6-Tasks/tasks.md`
43
43
  2. Read ALL handoffs: `artifacts/handoffs/`
44
- 3. Read `.chati/session.yaml` for agent scores and criteria counts
44
+ 3. Use the validated canonical session context supplied in the activation prompt for agent scores and criteria counts. Never read `.chati/session.yaml` directly.
45
45
 
46
46
  **Team Mode Note (Article XXI):** In Team Mode, QA-Planning runs as the 4th member of the Planning Team BEFORE the Phases and Tasks agents have executed. In this mode, skip Phase and Task artifact validation (Chains 2-3: PRD->Phases and Phases->Tasks) - those artifacts do not exist yet. Focus validation on Detail (PRD), Architect (architecture.md), and UX (ux-specification.md) outputs only. Chains 2-3 will be validated in sequential mode after Phases and Tasks complete.
47
47
 
@@ -403,7 +403,7 @@ Threshold: >= 95% (10/10 minimum, no criteria may fail). Canonical value: chati.
403
403
 
404
404
  | Level | Source | Purpose |
405
405
  |-------|--------|---------|
406
- | L0 | `.chati/session.yaml` | Agent scores, criteria counts, pipeline state, execution mode |
406
+ | L0 | Router-validated prompt context | Agent scores, criteria counts, pipeline state, execution mode |
407
407
  | L1 | `chati.dev/constitution.md` | Protocols, validation thresholds, handoff rules, quality standards |
408
408
  | L2 | `artifacts/1-Brief/brief-report.md` | Problems list for traceability chain origin |
409
409
  | L3 | `artifacts/2-PRD/prd.md` | Requirements list (FR/NFR) for traceability chain |
@@ -518,7 +518,7 @@ signed router. The reviewer cannot be replaced by the executor it evaluates.
518
518
  - **Team mode (v4.2.3+)**: Runs as 4th member of the Planning Team (Article XXI). Activates AFTER Detail (TT-PLN-001), Architect (TT-PLN-002), and UX (TT-PLN-003) complete their tasks. Task ID: TT-PLN-005.
519
519
  - **Communication**: Sends `qa_review_finding` messages via team mailbox to ALL THREE team members (detail, architect, ux) - not just the responsible agent. Corrections may affect cross-artifact consistency, so all agents must review findings together, re-validate their own work, and cross-review again before QA-Planning re-validates. Max 2 correction cycles. Team dissolves only when QA-Planning score >= 95%.
520
520
  - **Internal parallelization**: Traceability chain validation (4 chains) can run in parallel. Criteria quality assessment can run concurrently with placeholder scanning. Adversarial review runs after all other validations complete.
521
- - **Merge point**: Team dissolution handles the planning-to-phases transition. QA-Planning score is synced to session.yaml by the orchestrator.
521
+ - **Merge point**: Team dissolution handles the planning-to-phases transition. The orchestrator persists the QA-Planning score canonically.
522
522
 
523
523
  ---
524
524
 
@@ -78,7 +78,7 @@ The visual score is computed against the 8-dimension rubric in `chati.dev/data/q
78
78
  ## On Activation
79
79
 
80
80
  1. Read handoff from Dev agent: `artifacts/handoffs/dev-handoff.md`
81
- 2. Read `.chati/session.yaml` for affected routes and project type
81
+ 2. Use the validated canonical session context supplied in the activation prompt for affected routes and project type. Never read `.chati/session.yaml` directly.
82
82
  3. Read brandbook: `artifacts/4-UX/brandbook.md` (token values for visual comparison)
83
83
  4. Read UX specification: `artifacts/4-UX/ux-specification.md` (component states, motion spec)
84
84
  5. Read architecture: `artifacts/3-Architecture/architecture.md` (confirm animation library choices)
@@ -1,8 +1,8 @@
1
1
  # chati.dev Configuration
2
- version: "4.5.16"
2
+ version: "4.5.28"
3
3
  installed_at: "2026-02-07T10:00:00Z"
4
- updated_at: "2026-08-28T00:00:00Z"
5
- installer_version: "4.5.16"
4
+ updated_at: "2026-09-01T00:00:00Z"
5
+ installer_version: "4.5.28"
6
6
  project_type: greenfield
7
7
  language: en
8
8
  ides: []
@@ -53,7 +53,7 @@ Every agent in Chati.dev:
53
53
  2. Operates within its designated pipeline position
54
54
  3. Cannot modify artifacts owned by other agents without orchestrator approval
55
55
  4. Must implement all 8 Universal Protocols (5.1-5.8)
56
- 5. Reports its status, score, and output to session.yaml
56
+ 5. Returns its status, score, and output in the handoff for canonical session-manager persistence
57
57
  6. Defers cross-scope requests to the orchestrator via Deviation Protocol (5.7)
58
58
 
59
59
  **Enforcement: BLOCK** — Agents that violate governance are halted by the orchestrator.
@@ -75,13 +75,13 @@ Every agent in Chati.dev:
75
75
 
76
76
  ## Article III: Memory & Context
77
77
 
78
- 1. Session state is persisted in `.chati/session.yaml` (IDE-agnostic)
78
+ 1. The canonical session manager persists session state in `.chati/session.yaml` (IDE-agnostic)
79
79
  2. System state is persisted in `chati.dev/config.yaml`
80
80
  3. Project context is maintained in `.chati/project-context.md`; provider-native context files consume it but never own it
81
81
  4. Handoffs between agents use the Two-Layer Protocol (Article VIII)
82
82
  5. Decisions are recorded in `artifacts/decisions/`
83
83
  6. Intelligence (gotchas, patterns, confidence) grows in `chati.dev/intelligence/`
84
- 7. Context is never lost between sessions: resume reads session.yaml + `.chati/project-context.md` + latest handoff
84
+ 7. Context is never lost between sessions: the resume router validates canonical session state and supplies it with `.chati/project-context.md` and the latest handoff
85
85
 
86
86
  **Enforcement: BLOCK** — Agents must persist state before completion.
87
87
 
@@ -109,12 +109,12 @@ Every agent in Chati.dev:
109
109
 
110
110
  ## Article V: Communication Protocol
111
111
 
112
- 1. Agents communicate exclusively through handoff documents and session.yaml
112
+ 1. Agents communicate exclusively through handoff documents and validated canonical session context supplied by the orchestrator
113
113
  2. Agent-to-agent communication follows a three-tier model:
114
- a. **Intra-Team** (Team-Scoped Peer Communication — PERMITTED): When the orchestrator has formed a team (Article XXI), agents within that team MAY communicate directly via the Team Mailbox (`.chati/teams/{team-id}/mailbox/`). Rules: (i) messages MUST include sender, recipient, timestamp, and type; (ii) agents MAY only write to the mailbox of a team they are enrolled in (per session.yaml `teams[].roster`); (iii) agents MUST NOT modify another agent's messages — append only; (iv) the audit trail requirement is satisfied by the mailbox files themselves — the orchestrator reads them after every team cycle.
114
+ a. **Intra-Team** (Team-Scoped Peer Communication — PERMITTED): When the orchestrator has formed a team (Article XXI), agents within that team MAY communicate directly via the Team Mailbox (`.chati/teams/{team-id}/mailbox/`). Rules: (i) messages MUST include sender, recipient, timestamp, and type; (ii) agents MAY only write to the mailbox of a team present in the router-validated `teams[].roster`; (iii) agents MUST NOT modify another agent's messages — append only; (iv) the audit trail requirement is satisfied by the mailbox files themselves — the orchestrator reads them after every team cycle.
115
115
  b. **Cross-Team** (Orchestrator-Mediated — REQUIRED): Communication between agents in different teams, or between a team agent and a solo pipeline agent, MUST route through the orchestrator. No direct path exists between teams.
116
- c. **Solo Pipeline** (No Change): Agents operating outside of any team follow the original rule — all communication is exclusively through handoff documents and session.yaml. The orchestrator mediates all routing.
117
- 3. User-facing messages use the interaction language (session.yaml `language` field)
116
+ c. **Solo Pipeline** (No Change): Agents operating outside of any team communicate through handoff documents and orchestrator-supplied canonical context. The orchestrator mediates all routing and persistence.
117
+ 3. User-facing messages use the interaction language supplied by router-validated context
118
118
  4. Error messages are constructive: what failed, why, and how to fix
119
119
  5. Status updates are concise and actionable
120
120
  6. Technical jargon is adapted to detected user level (vibecoder vs power user)
@@ -168,7 +168,7 @@ This applies to:
168
168
  - Decision records (`artifacts/decisions/`)
169
169
 
170
170
  This does NOT apply to:
171
- - Agent-user conversation (follows `session.yaml` `language` setting)
171
+ - Agent-user conversation (follows the validated `language` value supplied by router context)
172
172
  - Console output, prompts, guidance, error messages (interaction language)
173
173
 
174
174
  **Rationale:** Portability, team collaboration, tooling compatibility.
@@ -205,7 +205,7 @@ Written ONLY when the agent had complex discoveries that don't fit in the summar
205
205
  2. Reads Layer 2 (Deep Context) only if present and relevant
206
206
  3. Reads referenced artifacts in recommended order
207
207
  4. Acknowledges inherited context before starting work
208
- 5. Fallback: session.yaml + `.chati/project-context.md` if handoff is missing
208
+ 5. If the handoff is missing, invoke router recovery and stop on an invalid response. Agents never reconstruct state from storage files.
209
209
 
210
210
  ### Team Handoff Envelope (Article XXI teams only)
211
211
 
@@ -280,7 +280,7 @@ Example of BAD criteria:
280
280
 
281
281
  ## Article XI: Mode Governance
282
282
 
283
- The pipeline operates in three execution modes that control agent permissions. Modes are derived from `project.state` in session.yaml.
283
+ The pipeline operates in three execution modes that control agent permissions. Modes are supplied by the router from validated canonical state.
284
284
 
285
285
  ### Mode Definitions
286
286
 
@@ -297,7 +297,7 @@ The pipeline operates in three execution modes that control agent permissions. M
297
297
  3. Transition to `rail` requires QA-Planning score >= 95% and a sealed Planning-to-RAIL handoff
298
298
  4. Transition to `release` requires complete RAIL execution evidence and independent approval for every task
299
299
  5. Backward transition from `rail` to `planning` is permitted when independent review classifies an issue as `SPEC` or `INTENT`
300
- 6. Mode overrides require explicit user confirmation and are logged in session.yaml
300
+ 6. Mode overrides require explicit user confirmation and are logged through the canonical session manager
301
301
 
302
302
  **Enforcement: BLOCK** — Write operations outside permitted scope are rejected.
303
303
 
@@ -340,7 +340,7 @@ The pipeline operates in three execution modes that control agent permissions. M
340
340
  8. Autonomous spawn capability is declared by each harness profile. Unsupported native team or spawn mechanics fall back to Chati's provider-neutral process runner without changing the routed model binding.
341
341
 
342
342
  9. When a Team (Article XXI) is active, a new context layer SHALL be injected for each team member:
343
- - **L6 — Team Roster Layer**: Injected only when `session.yaml` has an active team entry. Contains: Team ID, Mission Statement, Roster with roles, Shared Task List status (task IDs, assigned_to, status, score only — not full descriptions), Decision Trail count, Echo count.
343
+ - **L6 — Team Roster Layer**: Injected only when router-validated context has an active team entry. Contains: Team ID, Mission Statement, Roster with roles, Shared Task List status (task IDs, assigned_to, status, score only — not full descriptions), Decision Trail count, Echo count.
344
344
  - Max token budget: 500 tokens (flat — does not scale with bracket size).
345
345
  - Injection trigger: ANY bracket when a team is active.
346
346
  - Injection order: L0, L1, L2, L6, L3, L4, L5.
@@ -415,7 +415,7 @@ Once the orchestrator is activated through a provider-native Chati entry point,
415
415
  4. **Explicit exit only**: The session lock is released ONLY by explicit user intent through the provider-native Chati exit command or clear natural language exit requests in the user's language.
416
416
  5. **Exit preserves state**: On exit, all session state, progress, and partial work MUST be persisted and every enabled harness lock is set to INACTIVE.
417
417
  6. **Resume re-locks**: Invoking Chati after an exit re-activates every enabled harness lock.
418
- 7. **IDE restart resilience**: Provider-native lock files persist across restarts and the next activation reconciles them from session.yaml.
418
+ 7. **IDE restart resilience**: Provider-native lock files persist across restarts and the next activation reconciles them from router-validated canonical state.
419
419
 
420
420
  **Enforcement: BLOCK** — Responses outside the Chati.dev system while session lock is active are violations.
421
421
 
@@ -492,7 +492,7 @@ The system SHALL support two execution modes that govern the degree of human inv
492
492
 
493
493
  7. Loop protection: the pipeline manager tracks consecutive correction cycles for each reviewer-to-rework-target pair. Two normal correction cycles are allowed. A third consecutive failure SHALL use the installation-selected top-tier adjudication route before a human escalation. Human escalation is reserved for authority decisions, unresolved scope or conflicting evidence.
494
494
 
495
- 8. Mode transitions are logged in session.yaml under `mode_transitions[]` for audit trail.
495
+ 8. Mode transitions are logged through the canonical session manager under `mode_transitions[]` for audit trail.
496
496
 
497
497
  **Enforcement: STRICT** — Autonomous mode MUST NOT bypass quality gates. All agents MUST respect the configured thresholds.
498
498
 
@@ -547,7 +547,7 @@ When multiple CLI providers are enabled, the system SHALL coordinate agent execu
547
547
  c. Task-specific quality, cost and review-independence requirements
548
548
  d. Availability evidence, otherwise a controlled block
549
549
 
550
- 7. Cost tracking SHALL include provider information. Each model selection entry in session.yaml includes: provider, model, agent, timestamp, and estimated token usage.
550
+ 7. Cost tracking SHALL include provider information. Each canonical model-selection entry persisted by the session manager includes: provider, model, agent, timestamp, and estimated token usage.
551
551
 
552
552
  **Enforcement: BLOCK** — Provider and model selection is an installation contract, not an advisory preference.
553
553
 
@@ -630,7 +630,7 @@ The orchestrator SHALL consider team formation during planning when two or more
630
630
 
631
631
  The orchestrator MUST NOT form a team for: discovery phase agents (WU, Brief — these require sequential context building), QA agents as team leads (QA is always an independent validator), or convenience alone (team formation has coordination overhead).
632
632
 
633
- On formation, the orchestrator MUST: (a) generate a unique team-id (format: `TM-{YYYYMMDD}-{3-char-slug}`); (b) write the team definition to `session.yaml` under `teams[]`; (c) create `.chati/teams/{team-id}/` with mailbox/ and shared task list; (d) notify each enrolled agent of their role; (e) log the formation event in `team_events[]`.
633
+ On formation, the orchestrator MUST: (a) generate a unique team-id (format: `TM-{YYYYMMDD}-{3-char-slug}`); (b) persist the team definition through the canonical session manager under `teams[]`; (c) create `.chati/teams/{team-id}/` with mailbox/ and shared task list; (d) notify each enrolled agent of their role; (e) persist the formation event in `team_events[]` through the same manager.
634
634
 
635
635
  ### 3. Team Lead Authority
636
636
 
@@ -666,7 +666,7 @@ Teams are dissolved by the orchestrator ONLY. Three dissolution types:
666
666
  - **Degraded**: Quality Gate fails after 2 Team Correction Cycles. Completed tasks preserved, failing tasks return to solo pipeline. Team marked `degraded`.
667
667
  - **Forced**: Constitutional violation detected. Team immediately halted. Completed tasks preserved, incomplete tasks return to pipeline backlog.
668
668
 
669
- On dissolution, the orchestrator MUST: update `teams[].status`, write Team Handoff Envelope, sync task scores to `session.yaml` `agents` block, and log dissolution event.
669
+ On dissolution, the orchestrator MUST use the canonical session manager to update `teams[].status`, sync task scores to the `agents` block and log the dissolution event, while separately writing the Team Handoff Envelope.
670
670
 
671
671
  ### 8. Fallback Behavior (Graceful Degradation)
672
672
 
@@ -749,7 +749,7 @@ If a tool is unavailable (not in package.json, MCP offline): log the unavailabil
749
749
 
750
750
  When a correction loop modifies a spec, task, or architectural decision, the known-bad state MUST be recorded to prevent cyclical re-introduction.
751
751
 
752
- **Decision Trail Record:** Stored in `session.yaml` under `decision_trail[]`. Each entry contains: id (DT-NNNN), trigger (what caused revision), fault_origin (INTENT/SPEC/CODE/DEFER), what_was_wrong (precise description), avoid (what NOT to repeat), evidence_hash (SHA-1 for Echo Detection matching), correction_loop (which iteration), logged_at, resolved (boolean).
752
+ **Decision Trail Record:** Persisted by the canonical session manager under `decision_trail[]`. Agents receive the validated entries through router prompt context and return new records in their handoff instead of accessing session storage directly. Each entry contains: id (DT-NNNN), trigger (what caused revision), fault_origin (INTENT/SPEC/CODE/DEFER), what_was_wrong (precise description), avoid (what NOT to repeat), evidence_hash (SHA-1 for Echo Detection matching), correction_loop (which iteration), logged_at, resolved (boolean).
753
753
 
754
754
  **Persistence Rules:** (a) Decision Trail entries are APPEND-ONLY — no entry may be deleted or modified after writing. (b) When a QA agent begins a new review cycle, it MUST read all existing Decision Trail entries for the current task BEFORE evaluating — this prevents flagging a known-bad state as a new defect. (c) Entries survive team dissolution and are included in the Team Handoff Envelope. (d) Entries are archived to `artifacts/decisions/fault-trail-{date}.md` at session end.
755
755
 
@@ -25,7 +25,7 @@ Agent retries on failure. Investigate root cause before escalating.
25
25
 
26
26
  ## 7. Deviation Protocol
27
27
  - Deviations handled by orchestrator (not separate agent)
28
- - Requires user confirmation + audit trail in session.yaml
28
+ - Requires user confirmation plus an audit trail persisted by the canonical session manager
29
29
  - Types: scope change, approach change, skip agent, add agent
30
30
 
31
31
  ## 8. Interaction Model
@@ -32,7 +32,7 @@ Scores within 5 points below threshold trigger REVIEW (human confirmation requir
32
32
  ## Fault Vector Protocol (Article XXII)
33
33
  - **Root Layer Routing**: INTENT (requirement wrong) -> Brief/Detail | SPEC (spec wrong) -> Architect/Tasks | CODE (implementation wrong) -> bounded RAIL rework | DEFER (out of scope) -> Backlog
34
34
  - **Evidence-Bound Verdicts**: ERROR/WARNING require tool evidence. Without evidence -> downgraded to SUGGESTION (non-blocking)
35
- - **Decision Trail**: Known-bad states logged in session.yaml `decision_trail[]`. Agents read before iterating.
35
+ - **Decision Trail**: Known-bad states are persisted canonically in `decision_trail[]` and supplied to agents in their validated activation context.
36
36
  - **Echo Detection**: Similarity >= 0.85 with prior Decision Trail entry = ECHO. Escalate immediately, no more automated loops.
37
37
  - **FVP Compliance Checklist**: Mandatory in every QA correction report
38
38
 
@@ -1,19 +1,19 @@
1
1
  # Chati.dev System Context
2
2
 
3
3
  ## Framework
4
- - **Version**: 4.5.16
4
+ - **Version**: 4.5.28
5
5
  - **Agents**: Specialized discovery and planning agents feeding provider-neutral RAIL execution and a sealed release lane
6
6
  - **Constitution**: 25 Articles + Preamble
7
7
  - **Quality**: 5 pipeline gates + 3-tier verdicts + Fault Vector Protocol (Article XXII)
8
8
  - **Provider Policy**: Claude, Codex, and Grok bindings are selected at installation and enforced per task
9
9
 
10
10
  ## Key References
11
- - **Session State**: `.chati/session.yaml` (runtime, not committed)
11
+ - **Session State**: canonical session-manager state (runtime, not committed)
12
12
  - **Constitution**: `chati.dev/constitution.md` (governance)
13
13
  - **Orchestrator**: `chati.dev/orchestrator/chati.md` (entry point)
14
14
  - **Config**: `chati.dev/config.yaml` (version info)
15
15
  - **Canonical Project Context**: `.chati/project-context.md`
16
- - **Runtime State**: `.chati/session.yaml`, mirrored to provider-native lock files
16
+ - **Runtime State**: canonical session-manager state, mirrored to provider-native lock files
17
17
 
18
18
  ## Pipeline
19
19
  ```
@@ -24,4 +24,4 @@ RELEASE: Evidence gate -> Explicit human authorization -> External action
24
24
  ```
25
25
 
26
26
  ## How to Use
27
- Use the provider-native Chati entry point to activate the orchestrator. It reads session.yaml, `.chati/project-context.md`, and the latest handoff to determine where you left off and what comes next.
27
+ Use the provider-native Chati entry point to activate the orchestrator. The deterministic router validates canonical session state and returns the project context and next action. Harnesses never open the session file directly.
@@ -272,7 +272,7 @@ entities:
272
272
  session:
273
273
  path: chati.dev/schemas/session.schema.json
274
274
  type: schema
275
- purpose: "JSON schema for .chati/session.yaml runtime state"
275
+ purpose: "JSON schema for canonical runtime session state"
276
276
  keywords: [session, state, validation, runtime]
277
277
  dependencies: []
278
278
  adaptability: 0.2
@@ -24,7 +24,7 @@ authority:
24
24
  redirectMessage: "The orchestrator delegates specialized work to the appropriate agent."
25
25
 
26
26
  outputs:
27
- - session.yaml
27
+ - router-validated canonical session context
28
28
  - handoff documents
29
29
 
30
30
  rules:
@@ -45,7 +45,7 @@ rules:
45
45
  priority: high
46
46
 
47
47
  - id: orch-session
48
- text: "Persist all state changes to session.yaml immediately."
48
+ text: "Persist all state changes immediately through the canonical session manager."
49
49
  priority: high
50
50
 
51
51
  # Provider Routing (v3.0.0)
@@ -147,7 +147,7 @@ articles:
147
147
  priority: critical
148
148
  - evidence-bound-verdicts: "ERROR findings require tool evidence (lint/typecheck/test/screenshot). Without evidence, downgrade to SUGGESTION (non-blocking)."
149
149
  priority: critical
150
- - decision-trail: "Append-only log of known-bad states in session.yaml decision_trail[]. Agents read before iterating."
150
+ - decision-trail: "Append-only canonical log of known-bad states. The router supplies decision_trail[] to agents before iteration."
151
151
  priority: high
152
152
  - echo-detection: "Content-similarity >= 0.85 with prior Decision Trail entry = ECHO. Escalate immediately, no more automated loops."
153
153
  priority: critical
@@ -20,6 +20,7 @@
20
20
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
21
21
  import { join } from 'path';
22
22
  import { spawn } from 'child_process';
23
+ import { readHookSession } from './session-reader.js';
23
24
 
24
25
  // Canonical gate thresholds live in data/qa-rubrics.yaml. These literals are
25
26
  // only a last-resort fallback for when that file is briefly unavailable (for
@@ -98,12 +99,9 @@ async function main() {
98
99
  // that failed its threshold (score below cutoff) OR verdict is
99
100
  // NEEDS_FIX/REJECTED. Correction loops are an INTERNAL quality process
100
101
  // (Fault Vector Protocol, Article XXII), not a forward step.
101
- const sessionPath = join(cwd, '.chati', 'session.yaml');
102
- if (!existsSync(sessionPath)) return;
103
- let raw;
104
- try { raw = readFileSync(sessionPath, 'utf-8'); } catch { return; }
105
- const modeMatch = raw.match(/^\s*execution_mode:\s*(.+)$/m);
106
- const profile = modeMatch ? modeMatch[1].trim().replace(/^["']|["']$/g, '') : 'interactive';
102
+ const sessionRead = readHookSession(cwd);
103
+ if (!sessionRead.loaded) return;
104
+ const profile = sessionRead.session?.execution_mode || 'interactive';
107
105
 
108
106
  // Read the written handoff and check its frontmatter declares completion.
109
107
  if (!existsSync(filePath)) return;
@@ -10,19 +10,23 @@
10
10
  * - it only ever denies push / PR-creation / release-creation commands;
11
11
  * - it only enforces while a pipeline is active (session.mode is a pipeline
12
12
  * phase) AND the current agent is set AND is not devops;
13
- * - outside an active session (no session, completed session) it does
14
- * nothing.
13
+ * - an unavailable or malformed session denies an external operation rather
14
+ * than silently removing the release authority boundary.
15
15
  *
16
- * Fails open (with an stderr log) on any internal error: a guard crash must
17
- * never block every Bash command.
16
+ * Fails closed for push, merge, and release operations on any internal error.
18
17
  */
19
- import { existsSync, readFileSync } from 'fs';
18
+ import { existsSync } from 'fs';
20
19
  import { join } from 'path';
20
+ import { readHookSession } from './session-reader.js';
21
21
 
22
22
  const PUSH_PATTERNS = [
23
23
  // git push, including global options that carry a value (git -C <path> push,
24
- // git -c k=v push) so an agent cannot side-step the guard with -C.
25
- /\bgit\s+(?:-{1,2}\S+(?:\s+\S+)?\s+)*push\b/i,
24
+ // git -c k=v push) so an agent cannot side-step the guard with -C. Shell
25
+ // quotes around the subcommand are semantically inert, so match them too.
26
+ /\bgit\s+(?:-{1,2}\S+(?:\s+\S+)?\s+)*(?:push|["']push["'])(?=\s|$)/i,
27
+ /\bgit\s+(?:-{1,2}\S+(?:\s+\S+)?\s+)*(?:send-pack|["']send-pack["'])(?=\s|$)/i,
28
+ // A one-off git alias can hide a push behind an arbitrary final subcommand.
29
+ /\bgit\b[^\n;&|]*\s-c\s+alias\.[^=\s]+=(?:["']?[^\n;&|]*\b(?:git\s+)?push\b)/i,
26
30
  /\bgh\s+pr\s+(?:create|merge)\b/i,
27
31
  /\bgh\s+release\s+create\b/i,
28
32
  ];
@@ -38,30 +42,35 @@ function isPushCommand(command) {
38
42
  * Block only when a push/PR command runs while a pipeline is active (mode is a
39
43
  * pipeline phase) and the current driver is a non-devops agent.
40
44
  */
41
- function shouldBlockPush(command, mode, agent, { v2 = false } = {}) {
45
+ function shouldBlockPush(command, mode, agent, { v2 = false, sessionStatus = null } = {}) {
42
46
  if (!isPushCommand(command)) return false;
43
- if (v2) return Boolean(mode && ACTIVE_MODES.includes(mode) && agent);
47
+ // Pausing a v2 session does not delegate external authority. The explicit
48
+ // manual boundary is `/chati exit`; otherwise a paused RAIL attempt could
49
+ // publish or push without the evidence and human-authorization gate.
50
+ if (v2) return Boolean(mode && ACTIVE_MODES.includes(mode));
51
+ if (sessionStatus === 'paused') return false;
44
52
  return Boolean(mode && ACTIVE_MODES.includes(mode) && agent && agent !== 'devops');
45
53
  }
46
54
 
47
55
  function readSessionField(projectDir, key) {
48
- const p = join(projectDir, '.chati', 'session.yaml');
49
- if (!existsSync(p)) return null;
50
- try {
51
- const raw = readFileSync(p, 'utf-8');
52
- const m = raw.match(new RegExp(`^\\s*${key}:\\s*(.+)$`, 'm'));
53
- if (!m) return null;
54
- const v = m[1].trim().replace(/^["']|["']$/g, '');
55
- return v === 'null' || v === '' ? null : v;
56
- } catch {
57
- return null;
58
- }
56
+ const result = readHookSession(projectDir);
57
+ return result.loaded ? result.session?.[key] ?? null : null;
59
58
  }
60
59
 
61
60
  async function main() {
62
61
  let input = '';
63
62
  for await (const chunk of process.stdin) input += chunk;
64
63
 
64
+ const deny = (reason) => {
65
+ process.stdout.write(JSON.stringify({
66
+ hookSpecificOutput: {
67
+ hookEventName: 'PreToolUse',
68
+ permissionDecision: 'deny',
69
+ permissionDecisionReason: reason,
70
+ },
71
+ }));
72
+ };
73
+
65
74
  try {
66
75
  const event = JSON.parse(input);
67
76
  if ((event.tool_name || '') !== 'Bash') {
@@ -75,30 +84,29 @@ async function main() {
75
84
  }
76
85
 
77
86
  const projectDir = event.cwd || process.cwd();
78
- const mode = readSessionField(projectDir, 'mode');
79
- const agent = readSessionField(projectDir, 'current_agent');
80
- const isV2 = existsSync(join(projectDir, '.chati', 'v2', 'installation.json'));
87
+ const sessionRead = readHookSession(projectDir);
88
+ if (!sessionRead.loaded) {
89
+ deny(`[Session Security] Push, merge, and release operations are blocked because session.yaml could not be validated: ${sessionRead.error || 'the session is missing'}`);
90
+ return;
91
+ }
92
+ const mode = sessionRead.session?.mode ?? null;
93
+ const agent = sessionRead.session?.current_agent ?? null;
94
+ const sessionStatus = sessionRead.session?.session_status ?? null;
95
+ const isV2 = sessionRead.session?.runtime_version === 2
96
+ || existsSync(join(projectDir, '.chati', 'v2', 'installation.json'));
81
97
 
82
98
  // Only enforce while a pipeline is active with a non-devops driver.
83
- if (shouldBlockPush(command, mode, agent, { v2: isV2 })) {
84
- process.stdout.write(JSON.stringify({
85
- hookSpecificOutput: {
86
- hookEventName: 'PreToolUse',
87
- permissionDecision: 'deny',
88
- permissionDecisionReason: isV2
89
- ? `[Release Lane] RAIL execution cannot push, merge, or publish directly. Complete the evidence gate and obtain explicit authorization for the external action. Current phase: "${mode}".`
90
- : `[Article IV] Only the devops agent may push to a remote or open a pull request during an active legacy pipeline. The current agent is "${agent}". Let the legacy pipeline reach devops, or run /chati exit to take manual control.`,
91
- },
92
- }));
99
+ if (shouldBlockPush(command, mode, agent, { v2: isV2, sessionStatus })) {
100
+ deny(isV2
101
+ ? `[Release Lane] RAIL execution cannot push, merge, or publish directly. Complete the evidence gate and obtain explicit authorization for the external action. Current phase: "${mode}".`
102
+ : `[Article IV] Only the devops agent may push to a remote or open a pull request during an active legacy pipeline. The current agent is "${agent}". Let the legacy pipeline reach devops, or run /chati exit to take manual control.`);
93
103
  return;
94
104
  }
95
105
 
96
106
  process.stdout.write('{}');
97
107
  } catch (err) {
98
- // Fail open: a guard crash must not block every Bash command. Log so the
99
- // failure is visible instead of silently disabling enforcement.
100
- process.stderr.write(`[chati] git-push-authority error (allowing operation): ${err && err.message ? err.message : err}\n`);
101
- process.stdout.write('{}');
108
+ process.stderr.write(`[chati] git-push-authority error (denying external operation): ${err && err.message ? err.message : err}\n`);
109
+ deny('[Session Security] Push, merge, and release operations are blocked because the release authority hook could not validate its input.');
102
110
  }
103
111
  }
104
112