chati-dev 2.0.9 → 2.1.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 (134) hide show
  1. package/README.md +12 -10
  2. package/assets/logo - co/314/201pia.png +0 -0
  3. package/assets/logo - co/314/201pia.svg" +42 -0
  4. package/bin/chati.js +3 -3
  5. package/framework/agents/{planning → discover}/brief.md +24 -2
  6. package/framework/agents/{planning → discover}/brownfield-wu.md +1 -1
  7. package/framework/agents/{planning → discover}/greenfield-wu.md +1 -1
  8. package/framework/agents/{planning → plan}/architect.md +1 -1
  9. package/framework/agents/{planning → plan}/detail.md +1 -1
  10. package/framework/agents/{planning → plan}/phases.md +1 -1
  11. package/framework/agents/{planning → plan}/tasks.md +1 -1
  12. package/framework/agents/{planning → plan}/ux.md +1 -1
  13. package/framework/agents/quality/qa-implementation.md +53 -4
  14. package/framework/agents/quality/qa-planning.md +53 -2
  15. package/framework/config.yaml +3 -3
  16. package/framework/constitution.md +4 -4
  17. package/framework/context/quality.md +1 -1
  18. package/framework/context/root.md +5 -4
  19. package/framework/data/entity-registry.yaml +35 -11
  20. package/framework/domains/agents/brief.yaml +14 -0
  21. package/framework/domains/agents/qa-implementation.yaml +16 -0
  22. package/framework/domains/agents/qa-planning.yaml +16 -0
  23. package/framework/domains/constitution.yaml +6 -2
  24. package/framework/domains/workflows/brownfield-discovery.yaml +5 -4
  25. package/framework/domains/workflows/quick-flow.yaml +23 -0
  26. package/framework/hooks/mode-governance.js +14 -2
  27. package/framework/hooks/model-governance.js +5 -1
  28. package/framework/hooks/prism-engine.js +1 -1
  29. package/framework/hooks/session-digest.js +6 -2
  30. package/framework/hooks/settings.json +11 -0
  31. package/framework/i18n/en.yaml +3 -3
  32. package/framework/i18n/es.yaml +3 -3
  33. package/framework/i18n/fr.yaml +3 -3
  34. package/framework/i18n/pt.yaml +3 -3
  35. package/framework/intelligence/context-engine.md +2 -2
  36. package/framework/intelligence/decision-engine.md +2 -2
  37. package/framework/manifest.json +5 -0
  38. package/framework/manifest.sig +1 -0
  39. package/framework/orchestrator/chati.md +68 -20
  40. package/framework/patterns/elicitation-library.yaml +592 -0
  41. package/framework/patterns/elicitation.md +2 -0
  42. package/framework/quality-gates/planning-gate.md +1 -1
  43. package/framework/schemas/session.schema.json +36 -3
  44. package/framework/tasks/architect-api-design.md +1 -1
  45. package/framework/tasks/architect-consolidate.md +1 -1
  46. package/framework/tasks/architect-db-design.md +1 -1
  47. package/framework/tasks/architect-design.md +1 -1
  48. package/framework/tasks/architect-security-review.md +1 -1
  49. package/framework/tasks/architect-stack-selection.md +1 -1
  50. package/framework/tasks/brief-consolidate.md +1 -1
  51. package/framework/tasks/brief-constraint-identify.md +1 -1
  52. package/framework/tasks/brief-extract-requirements.md +1 -1
  53. package/framework/tasks/brief-stakeholder-map.md +1 -1
  54. package/framework/tasks/brief-validate-completeness.md +1 -1
  55. package/framework/tasks/brownfield-wu-architecture-map.md +1 -1
  56. package/framework/tasks/brownfield-wu-deep-discovery.md +1 -1
  57. package/framework/tasks/brownfield-wu-dependency-scan.md +1 -1
  58. package/framework/tasks/brownfield-wu-migration-plan.md +1 -1
  59. package/framework/tasks/brownfield-wu-report.md +1 -1
  60. package/framework/tasks/brownfield-wu-risk-assess.md +1 -1
  61. package/framework/tasks/detail-acceptance-criteria.md +1 -1
  62. package/framework/tasks/detail-consolidate.md +1 -1
  63. package/framework/tasks/detail-edge-case-analysis.md +1 -1
  64. package/framework/tasks/detail-expand-prd.md +1 -1
  65. package/framework/tasks/detail-nfr-extraction.md +1 -1
  66. package/framework/tasks/greenfield-wu-analyze-empty.md +1 -1
  67. package/framework/tasks/greenfield-wu-report.md +1 -1
  68. package/framework/tasks/greenfield-wu-scaffold-detection.md +1 -1
  69. package/framework/tasks/greenfield-wu-tech-stack-assess.md +1 -1
  70. package/framework/tasks/orchestrator-deviation.md +2 -2
  71. package/framework/tasks/orchestrator-escalate.md +1 -1
  72. package/framework/tasks/orchestrator-handoff.md +3 -3
  73. package/framework/tasks/orchestrator-mode-switch.md +16 -5
  74. package/framework/tasks/orchestrator-preview.md +181 -0
  75. package/framework/tasks/orchestrator-resume.md +2 -2
  76. package/framework/tasks/orchestrator-route.md +5 -4
  77. package/framework/tasks/orchestrator-status.md +4 -4
  78. package/framework/tasks/orchestrator-suggest-mode.md +7 -7
  79. package/framework/tasks/phases-breakdown.md +1 -1
  80. package/framework/tasks/phases-dependency-mapping.md +1 -1
  81. package/framework/tasks/phases-mvp-scoping.md +1 -1
  82. package/framework/tasks/qa-impl-consolidate.md +2 -2
  83. package/framework/tasks/qa-impl-verdict.md +2 -2
  84. package/framework/tasks/qa-planning-consolidate.md +1 -1
  85. package/framework/tasks/qa-planning-coverage-plan.md +2 -2
  86. package/framework/tasks/qa-planning-gate-define.md +1 -1
  87. package/framework/tasks/qa-planning-risk-matrix.md +1 -1
  88. package/framework/tasks/qa-planning-test-strategy.md +1 -1
  89. package/framework/tasks/tasks-acceptance-write.md +1 -1
  90. package/framework/tasks/tasks-consolidate.md +1 -1
  91. package/framework/tasks/tasks-decompose.md +1 -1
  92. package/framework/tasks/tasks-estimate.md +1 -1
  93. package/framework/tasks/ux-a11y-check.md +1 -1
  94. package/framework/tasks/ux-component-map.md +1 -1
  95. package/framework/tasks/ux-consolidate.md +1 -1
  96. package/framework/tasks/ux-user-flow.md +1 -1
  97. package/framework/tasks/ux-wireframe.md +1 -1
  98. package/framework/templates/quick-brief-tmpl.yaml +90 -0
  99. package/framework/workflows/brownfield-discovery.yaml +7 -7
  100. package/framework/workflows/brownfield-fullstack.yaml +24 -10
  101. package/framework/workflows/brownfield-service.yaml +41 -5
  102. package/framework/workflows/brownfield-ui.yaml +41 -5
  103. package/framework/workflows/greenfield-fullstack.yaml +24 -10
  104. package/framework/workflows/quick-flow.yaml +125 -0
  105. package/package.json +1 -1
  106. package/scripts/bundle-framework.js +1 -1
  107. package/scripts/populate-entity-registry.js +1 -1
  108. package/scripts/semantic-lint.js +2 -2
  109. package/scripts/validate-agents.js +2 -1
  110. package/scripts/validate-package.js +1 -1
  111. package/scripts/validate-tasks.js +1 -1
  112. package/src/autonomy/progress-reporter.js +26 -19
  113. package/src/context/engine.js +1 -1
  114. package/src/context/layers/l1-global.js +17 -5
  115. package/src/dashboard/layout.js +2 -1
  116. package/src/gates/g1-planning-complete.js +10 -10
  117. package/src/installer/core.js +14 -12
  118. package/src/installer/templates.js +1 -1
  119. package/src/installer/validator.js +8 -8
  120. package/src/intelligence/registry-manager.js +4 -4
  121. package/src/memory/session-digest.js +1 -1
  122. package/src/orchestrator/agent-selector.js +11 -11
  123. package/src/orchestrator/intent-classifier.js +12 -8
  124. package/src/orchestrator/pipeline-manager.js +100 -3
  125. package/src/orchestrator/pipeline-state.js +1 -1
  126. package/src/orchestrator/session-manager.js +13 -4
  127. package/src/preview/detector.js +238 -0
  128. package/src/preview/index.js +20 -0
  129. package/src/preview/launcher.js +235 -0
  130. package/src/preview/log-buffer.js +103 -0
  131. package/src/tasks/executor.js +1 -1
  132. package/src/tasks/loader.js +1 -1
  133. package/src/terminal/prompt-builder.js +10 -10
  134. package/src/wizard/i18n.js +3 -3
@@ -16,7 +16,7 @@ workflow:
16
16
  phases:
17
17
  - phase: 0
18
18
  name: Discovery
19
- category: PLANNING
19
+ category: DISCOVER
20
20
  sequence:
21
21
  - agent: greenfield-wu
22
22
  action: operational-discovery
@@ -25,7 +25,7 @@ phases:
25
25
 
26
26
  - phase: 1
27
27
  name: Problem Definition
28
- category: PLANNING
28
+ category: DISCOVER
29
29
  sequence:
30
30
  - agent: brief
31
31
  action: problem-extraction
@@ -34,7 +34,7 @@ phases:
34
34
 
35
35
  - phase: 2
36
36
  name: Product Specification
37
- category: PLANNING
37
+ category: PLAN
38
38
  sequence:
39
39
  - agent: detail
40
40
  action: create-prd
@@ -44,7 +44,7 @@ phases:
44
44
 
45
45
  - phase: 3
46
46
  name: Technical Design
47
- category: PLANNING
47
+ category: PLAN
48
48
  sequence:
49
49
  - agent: architect
50
50
  action: design-architecture
@@ -58,7 +58,7 @@ phases:
58
58
 
59
59
  - phase: 4
60
60
  name: Execution Planning
61
- category: PLANNING
61
+ category: PLAN
62
62
  sequence:
63
63
  - agent: phases
64
64
  action: create-roadmap
@@ -72,7 +72,7 @@ phases:
72
72
 
73
73
  - phase: 5
74
74
  name: Planning Quality Gate
75
- category: PLANNING
75
+ category: PLAN
76
76
  sequence:
77
77
  - agent: qa-planning
78
78
  action: validate-traceability
@@ -103,7 +103,11 @@ phases:
103
103
  notes: "Git operations, deployment, documentation"
104
104
 
105
105
  transitions:
106
- planning_to_build:
106
+ discover_to_plan:
107
+ trigger: "brief.status == completed"
108
+ type: automatic
109
+ action: "Update project.state = plan"
110
+ plan_to_build:
107
111
  trigger: "qa-planning.score >= 95"
108
112
  type: automatic
109
113
  action: "Update project.state = build"
@@ -111,15 +115,25 @@ transitions:
111
115
  trigger: "dev.status == completed"
112
116
  type: automatic
113
117
  action: "Update project.state = validate"
114
- validate_to_deploy:
118
+ validate_to_preview:
115
119
  trigger: "qa-implementation.status == approved"
116
120
  type: automatic
121
+ action: "Launch user preview (orchestrator-preview task)"
122
+ notes: "User must approve preview before advancing to deploy"
123
+ preview_to_deploy:
124
+ trigger: "user_preview.decision in [approve_keep, approve_kill]"
125
+ type: manual
117
126
  action: "Update project.state = deploy"
127
+ notes: "User explicitly approves the preview"
118
128
  deploy_to_completed:
119
129
  trigger: "devops.status == completed"
120
130
  type: automatic
121
131
  action: "Update project.state = completed"
122
- backward_to_planning:
132
+ backward_to_plan:
123
133
  trigger: "qa-implementation.issue_type in [spec, architecture]"
124
134
  type: backward
125
- action: "Update project.state = planning, route to responsible agent"
135
+ action: "Update project.state = plan, route to responsible agent"
136
+ backward_to_discover:
137
+ trigger: "qa-implementation.issue_type in [requirements, scope]"
138
+ type: backward
139
+ action: "Update project.state = discover, route to brief or wu agent"
@@ -0,0 +1,125 @@
1
+ # Quick Flow Workflow
2
+ # Fast-track pipeline for simple tasks: bug fixes, small features, config changes
3
+ # Skips full DISCOVER/PLAN phases when complexity is low
4
+
5
+ workflow:
6
+ id: quick-flow
7
+ name: Quick Flow — Fast Track Development
8
+ version: "1.0.0"
9
+ type: any
10
+ project_types: [bug-fix, small-feature, config-change, hotfix, refactor]
11
+ description: >
12
+ Condensed pipeline for tasks that don't need full discovery/planning.
13
+ Used when the orchestrator detects low complexity: clear requirements,
14
+ known codebase, small scope. Skips Detail, Architect, UX, Phases, Tasks,
15
+ and QA-Planning. Goes straight from Brief (quick) to Dev.
16
+
17
+ detection:
18
+ # Orchestrator uses these signals to auto-detect quick-flow eligibility
19
+ triggers:
20
+ - "User explicitly requests quick fix or hotfix"
21
+ - "Single, well-defined requirement (can be stated in one sentence)"
22
+ - "Bug report with reproduction steps"
23
+ - "Configuration or environment change"
24
+ - "Small refactoring with clear scope"
25
+ - "User says 'just do it' or 'quick fix' or similar urgency signals"
26
+ disqualifiers:
27
+ - "New feature requiring architecture decisions"
28
+ - "Multiple interconnected requirements"
29
+ - "Greenfield project (no existing codebase)"
30
+ - "Enterprise or compliance context"
31
+ - "User explicitly requests full pipeline"
32
+ - "Scope involves more than 5 files"
33
+ - "Requires database schema changes"
34
+ - "Requires new API endpoints (>2)"
35
+
36
+ confidence_threshold: 0.8
37
+ user_confirmation: true
38
+
39
+ phases:
40
+ - phase: 0
41
+ name: Quick Brief
42
+ category: DISCOVER
43
+ sequence:
44
+ - agent: brief
45
+ action: quick-extraction
46
+ creates: [chati.dev/artifacts/1-Brief/quick-brief.md]
47
+ notes: >
48
+ Condensed extraction: single-pass, no 5-phase process.
49
+ Capture: what, why, constraints, acceptance criteria.
50
+ Duration: 2-5 min max.
51
+ template: quick-brief-tmpl.yaml
52
+ config:
53
+ max_rounds: 2
54
+ require_approval: true
55
+
56
+ - phase: 1
57
+ name: Implementation
58
+ category: BUILD
59
+ sequence:
60
+ - agent: dev
61
+ action: implement-tasks
62
+ notes: >
63
+ Dev works directly from Quick Brief (no PRD, no architecture doc).
64
+ Scope is tight: fix the bug, add the small feature, make the change.
65
+ Self-critique checklist still applies.
66
+
67
+ - phase: 2
68
+ name: Validation
69
+ category: BUILD
70
+ sequence:
71
+ - agent: qa-implementation
72
+ action: validate-code
73
+ creates: [chati.dev/artifacts/8-Validation/qa-implementation-report.md]
74
+ notes: >
75
+ Full QA-Implementation validation still applies (no shortcuts on quality).
76
+ Adversarial review still mandatory.
77
+ Tests must pass, SAST must be clean.
78
+ config:
79
+ adversarial_review: true
80
+ minimum_findings: 3
81
+
82
+ - phase: 3
83
+ name: Deployment
84
+ category: DEPLOY
85
+ sequence:
86
+ - agent: devops
87
+ action: deploy
88
+ creates: [chati.dev/artifacts/8-Validation/deploy-report.md]
89
+ notes: "Standard deployment process"
90
+
91
+ transitions:
92
+ quick_brief_to_build:
93
+ trigger: "brief.status == completed"
94
+ type: automatic
95
+ action: "Skip full PLAN phase, go directly to BUILD"
96
+ notes: "No Detail, Architect, UX, Phases, Tasks, or QA-Planning"
97
+ build_to_validate:
98
+ trigger: "dev.status == completed"
99
+ type: automatic
100
+ action: "Update project.state = validate"
101
+ validate_to_deploy:
102
+ trigger: "qa-implementation.status == approved"
103
+ type: automatic
104
+ action: "Update project.state = deploy"
105
+ notes: "User preview skipped for quick-flow (scope too small)"
106
+ deploy_to_completed:
107
+ trigger: "devops.status == completed"
108
+ type: automatic
109
+ action: "Update project.state = completed"
110
+
111
+ escalation:
112
+ # If at any point the quick-flow feels insufficient, escalate to full pipeline
113
+ triggers:
114
+ - "Dev discovers the change is more complex than expected"
115
+ - "QA-Implementation finds architectural issues"
116
+ - "Scope creep detected (>5 files, new APIs, schema changes)"
117
+ - "Dev agent requests escalation"
118
+ action: >
119
+ Pause quick-flow, notify user:
120
+ "This task is more complex than initially estimated.
121
+ Recommend switching to full pipeline for proper planning.
122
+ Options:
123
+ 1. Switch to full pipeline (Recommended)
124
+ 2. Continue with quick-flow (document risk)
125
+ 3. Abort and reassess"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chati-dev",
3
- "version": "2.0.9",
3
+ "version": "2.1.0",
4
4
  "description": "AI-Powered Multi-Agent Orchestration System — Structured vibe coding for Full Stack Development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,7 +32,7 @@ mkdirSync(DEST, { recursive: true });
32
32
 
33
33
  const dirs = [
34
34
  'orchestrator',
35
- 'agents/planning', 'agents/quality', 'agents/build', 'agents/deploy',
35
+ 'agents/discover', 'agents/plan', 'agents/quality', 'agents/build', 'agents/deploy',
36
36
  'templates', 'workflows', 'quality-gates',
37
37
  'schemas', 'frameworks', 'intelligence', 'patterns',
38
38
  'hooks', 'domains',
@@ -161,7 +161,7 @@ function scanEntities(frameworkDir, relDir, category) {
161
161
 
162
162
  for (const entry of entries) {
163
163
  if (entry.isDirectory()) {
164
- // Recurse into subdirectories (e.g., agents/planning/, agents/build/)
164
+ // Recurse into subdirectories (e.g., agents/discover/, agents/plan/, agents/build/)
165
165
  const subEntities = scanEntities(frameworkDir, join(relDir, entry.name), category);
166
166
  entities.push(...subEntities);
167
167
  continue;
@@ -87,7 +87,7 @@ function checkDomainAgentAlignment(frameworkDir, results) {
87
87
  }
88
88
 
89
89
  // Other agents: check all category dirs
90
- const agentDirs = ['agents/planning', 'agents/quality', 'agents/build', 'agents/deploy'];
90
+ const agentDirs = ['agents/discover', 'agents/plan', 'agents/quality', 'agents/build', 'agents/deploy'];
91
91
  const found = agentDirs.some(dir =>
92
92
  existsSync(join(frameworkDir, dir, `${agentName}.md`))
93
93
  );
@@ -221,7 +221,7 @@ function checkWorkflowAgentRefs(frameworkDir, results) {
221
221
 
222
222
  // Collect known agent names
223
223
  const knownAgents = new Set(['orchestrator']);
224
- const agentDirs = ['agents/planning', 'agents/quality', 'agents/build', 'agents/deploy'];
224
+ const agentDirs = ['agents/discover', 'agents/plan', 'agents/quality', 'agents/build', 'agents/deploy'];
225
225
  for (const dir of agentDirs) {
226
226
  const fullDir = join(frameworkDir, dir);
227
227
  if (!existsSync(fullDir)) continue;
@@ -19,7 +19,8 @@ import yaml from 'js-yaml';
19
19
  * Expected agents organized by category.
20
20
  */
21
21
  export const EXPECTED_AGENTS = {
22
- planning: ['greenfield-wu', 'brownfield-wu', 'brief', 'detail', 'architect', 'ux', 'phases', 'tasks'],
22
+ discover: ['greenfield-wu', 'brownfield-wu', 'brief'],
23
+ plan: ['detail', 'architect', 'ux', 'phases', 'tasks'],
23
24
  quality: ['qa-planning', 'qa-implementation'],
24
25
  build: ['dev'],
25
26
  deploy: ['devops'],
@@ -21,7 +21,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
21
21
  */
22
22
  const EXPECTED_BUNDLE_DIRS = [
23
23
  'orchestrator',
24
- 'agents/planning', 'agents/quality', 'agents/build', 'agents/deploy',
24
+ 'agents/discover', 'agents/plan', 'agents/quality', 'agents/build', 'agents/deploy',
25
25
  'templates', 'workflows', 'quality-gates',
26
26
  'schemas', 'frameworks', 'intelligence', 'patterns',
27
27
  'hooks', 'domains',
@@ -24,7 +24,7 @@ const REQUIRED_FIELDS = ['id', 'agent'];
24
24
  /**
25
25
  * Valid phase values.
26
26
  */
27
- const VALID_PHASES = ['planning', 'build', 'deploy', 'validate', 'quality'];
27
+ const VALID_PHASES = ['discover', 'plan', 'planning', 'build', 'deploy', 'validate', 'quality'];
28
28
 
29
29
  // ---------------------------------------------------------------------------
30
30
  // Internal Helpers
@@ -35,7 +35,7 @@ export function buildProgressReport(pipelineState, options = {}) {
35
35
 
36
36
  /**
37
37
  * Format progress as a compact one-line status.
38
- * Example: "[PLANNING 3/8] brief ✅ → detail 🔄 (score: 92%)"
38
+ * Example: "[DISCOVER 2/3] brief ✅ → detail 🔄 (score: 92%)" or "[PLAN 3/6] phases 🔄 (score: 92%)"
39
39
  * @param {object} pipelineState
40
40
  * @returns {string}
41
41
  */
@@ -75,10 +75,23 @@ export function formatDetailedReport(pipelineState) {
75
75
  lines.push(`Stage: ${stage}`);
76
76
  lines.push('');
77
77
 
78
- // PLANNING agents
79
- lines.push('PLANNING:');
80
- const planningAgents = getStageAgents('PLANNING');
81
- planningAgents.forEach(agent => {
78
+ // DISCOVER agents
79
+ lines.push('DISCOVER:');
80
+ const discoverAgents = getStageAgents('DISCOVER');
81
+ discoverAgents.forEach(agent => {
82
+ const status = agentStatus[agent] || 'pending';
83
+ const icon = getStatusIcon(status);
84
+ const isActive = agent === pipelineState.current_agent;
85
+ const prefix = isActive ? '→ ' : ' ';
86
+ lines.push(`${prefix}${icon} ${agent}`);
87
+ });
88
+
89
+ lines.push('');
90
+
91
+ // PLAN agents
92
+ lines.push('PLAN:');
93
+ const planAgents = getStageAgents('PLAN');
94
+ planAgents.forEach(agent => {
82
95
  const status = agentStatus[agent] || 'pending';
83
96
  const icon = getStatusIcon(status);
84
97
  const isActive = agent === pipelineState.current_agent;
@@ -146,17 +159,8 @@ export function calculateCompletion(pipelineState) {
146
159
  */
147
160
  function getStageAgents(stage) {
148
161
  const stages = {
149
- PLANNING: [
150
- 'greenfield-wu',
151
- 'brownfield-wu',
152
- 'brief',
153
- 'detail',
154
- 'architect',
155
- 'ux',
156
- 'phases',
157
- 'tasks',
158
- 'qa-planning',
159
- ],
162
+ DISCOVER: ['greenfield-wu', 'brownfield-wu', 'brief'],
163
+ PLAN: ['detail', 'architect', 'ux', 'phases', 'tasks', 'qa-planning'],
160
164
  BUILD: ['dev', 'qa-implementation'],
161
165
  DEPLOY: ['devops'],
162
166
  };
@@ -170,7 +174,8 @@ function getStageAgents(stage) {
170
174
  */
171
175
  function getAllAgents() {
172
176
  return [
173
- ...getStageAgents('PLANNING'),
177
+ ...getStageAgents('DISCOVER'),
178
+ ...getStageAgents('PLAN'),
174
179
  ...getStageAgents('BUILD'),
175
180
  ...getStageAgents('DEPLOY'),
176
181
  ];
@@ -222,6 +227,7 @@ function getStatusIcon(status) {
222
227
  failed: '❌',
223
228
  pending: '⏸',
224
229
  skipped: '⏭',
230
+ preview: '👁',
225
231
  };
226
232
 
227
233
  return icons[status] || '⏸';
@@ -249,7 +255,7 @@ function countTotalAgents(_pipelineState) {
249
255
  /**
250
256
  * Get progress summary by stage.
251
257
  * @param {object} pipelineState
252
- * @returns {{ planning: number, build: number, deploy: number }}
258
+ * @returns {{ discover: number, plan: number, build: number, deploy: number }}
253
259
  */
254
260
  export function getStageProgress(pipelineState) {
255
261
  const agentStatus = pipelineState.agent_status || {};
@@ -261,7 +267,8 @@ export function getStageProgress(pipelineState) {
261
267
  };
262
268
 
263
269
  return {
264
- planning: getProgress('PLANNING'),
270
+ discover: getProgress('DISCOVER'),
271
+ plan: getProgress('PLAN'),
265
272
  build: getProgress('BUILD'),
266
273
  deploy: getProgress('DEPLOY'),
267
274
  };
@@ -43,7 +43,7 @@ export function runPrism(input) {
43
43
  // 2. Build context for layer processors
44
44
  const ctx = {
45
45
  domainsDir: input.domainsDir,
46
- mode: input.mode || 'planning',
46
+ mode: input.mode || 'discover',
47
47
  bracket: bracket.bracket,
48
48
  agent: input.agent || null,
49
49
  workflow: input.workflow || null,
@@ -2,31 +2,43 @@
2
2
  * L1 Global Layer — ALWAYS active.
3
3
  *
4
4
  * Loads global rules: coding standards, bracket-specific behavioral rules,
5
- * mode governance constraints (planning/build/deploy).
5
+ * mode governance constraints (discover/plan → planning, build, deploy).
6
6
  */
7
7
 
8
8
  import { loadGlobalDomain, extractRules } from '../domain-loader.js';
9
9
 
10
+ // Maps session states to governance modes for domain lookup
11
+ const STATE_TO_GOVERNANCE_MODE = {
12
+ discover: 'planning',
13
+ plan: 'planning',
14
+ planning: 'planning',
15
+ build: 'build',
16
+ validate: 'build',
17
+ deploy: 'deploy',
18
+ completed: 'deploy',
19
+ };
20
+
10
21
  /**
11
22
  * Process L1: load global rules + mode governance.
12
23
  * @param {object} ctx - Pipeline context
13
24
  * @param {string} ctx.domainsDir - Path to chati.dev/domains/
14
- * @param {string} ctx.mode - Current mode (planning, build, deploy)
25
+ * @param {string} ctx.mode - Current session state (discover, plan, build, deploy)
15
26
  * @param {string} ctx.bracket - Current bracket (FRESH, MODERATE, etc.)
16
27
  * @returns {{ layer: string, rules: Array, mode: string, modeRules: object }}
17
28
  */
18
29
  export function processL1(ctx) {
19
30
  const domain = loadGlobalDomain(ctx.domainsDir);
20
31
  const rules = extractRules(domain);
21
- const mode = ctx.mode || 'planning';
32
+ const sessionMode = ctx.mode || 'discover';
33
+ const governanceMode = STATE_TO_GOVERNANCE_MODE[sessionMode] || 'planning';
22
34
 
23
- const modeRules = domain?.modes?.[mode] || {};
35
+ const modeRules = domain?.modes?.[governanceMode] || {};
24
36
  const bracketRules = domain?.brackets?.[ctx.bracket] || {};
25
37
 
26
38
  return {
27
39
  layer: 'L1',
28
40
  rules,
29
- mode,
41
+ mode: sessionMode,
30
42
  modeRules: {
31
43
  writeScope: modeRules.writeScope || 'chati.dev/',
32
44
  allowedActions: modeRules.allowedActions || [],
@@ -21,7 +21,8 @@ function formatScore(score, status) {
21
21
  */
22
22
  function formatState(state) {
23
23
  const stateMap = {
24
- planning: brand('PLANNING'),
24
+ discover: brand('DISCOVER'),
25
+ plan: brand('PLAN'),
25
26
  build: yellow('BUILD'),
26
27
  validate: bold('VALIDATE'),
27
28
  deploy: green('DEPLOY'),
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @fileoverview G1 — Planning Complete Gate
2
+ * @fileoverview G1 — Plan Complete Gate
3
3
  *
4
- * Pre-BUILD gate that validates the PLANNING phase is fully completed.
4
+ * Pre-BUILD gate that validates the PLAN phase is fully completed.
5
5
  * Checks that all required artifacts exist and QA-Planning has approved.
6
6
  */
7
7
 
@@ -31,7 +31,7 @@ export class PlanningCompleteGate extends GateBase {
31
31
  }
32
32
 
33
33
  /**
34
- * Collect evidence by checking filesystem for PLANNING artifacts.
34
+ * Collect evidence by checking filesystem for PLAN artifacts.
35
35
  *
36
36
  * @param {string} projectDir
37
37
  * @returns {object} Evidence about artifact presence, session state, and handoff
@@ -99,7 +99,7 @@ export class PlanningCompleteGate extends GateBase {
99
99
  const allCriteria = [
100
100
  ...REQUIRED_ARTIFACTS.map(a => `${a.label} exists`),
101
101
  'QA-Planning handoff with passing score',
102
- 'Session shows planning completed',
102
+ 'Session shows plan completed',
103
103
  ];
104
104
 
105
105
  const criteriaResults = [];
@@ -130,16 +130,16 @@ export class PlanningCompleteGate extends GateBase {
130
130
 
131
131
  // Check session state
132
132
  if (evidence.sessionState) {
133
- const planningAgents = ['brief', 'detail', 'architect', 'ux', 'phases', 'tasks', 'qa-planning'];
134
- const completed = planningAgents.filter(a =>
133
+ const planAgents = ['brief', 'detail', 'architect', 'ux', 'phases', 'tasks', 'qa-planning'];
134
+ const completed = planAgents.filter(a =>
135
135
  evidence.sessionState.completedAgents.includes(a)
136
136
  );
137
137
 
138
- if (completed.length === planningAgents.length) {
139
- criteriaResults.push('Session shows planning completed');
138
+ if (completed.length === planAgents.length) {
139
+ criteriaResults.push('Session shows plan completed');
140
140
  } else {
141
- const missing = planningAgents.filter(a => !completed.includes(a));
142
- warnings.push(`Incomplete planning agents: ${missing.join(', ')}`);
141
+ const missing = planAgents.filter(a => !completed.includes(a));
142
+ warnings.push(`Incomplete plan agents: ${missing.join(', ')}`);
143
143
  }
144
144
  }
145
145
 
@@ -49,7 +49,7 @@ export async function installFramework(config) {
49
49
  // Copy framework structure
50
50
  const frameworkDirs = [
51
51
  'orchestrator',
52
- 'agents/planning', 'agents/quality', 'agents/build', 'agents/deploy',
52
+ 'agents/discover', 'agents/plan', 'agents/quality', 'agents/build', 'agents/deploy',
53
53
  'templates', 'workflows', 'quality-gates',
54
54
  'schemas', 'frameworks', 'intelligence', 'patterns',
55
55
  'hooks', 'domains', 'domains/agents', 'domains/workflows',
@@ -135,15 +135,16 @@ function copyFrameworkFiles(destDir) {
135
135
  const filesToCopy = [
136
136
  'constitution.md',
137
137
  'orchestrator/chati.md',
138
- // PLANNING agents
139
- 'agents/planning/greenfield-wu.md',
140
- 'agents/planning/brownfield-wu.md',
141
- 'agents/planning/brief.md',
142
- 'agents/planning/detail.md',
143
- 'agents/planning/architect.md',
144
- 'agents/planning/ux.md',
145
- 'agents/planning/phases.md',
146
- 'agents/planning/tasks.md',
138
+ // DISCOVER agents
139
+ 'agents/discover/greenfield-wu.md',
140
+ 'agents/discover/brownfield-wu.md',
141
+ 'agents/discover/brief.md',
142
+ // PLAN agents
143
+ 'agents/plan/detail.md',
144
+ 'agents/plan/architect.md',
145
+ 'agents/plan/ux.md',
146
+ 'agents/plan/phases.md',
147
+ 'agents/plan/tasks.md',
147
148
  // Quality agents
148
149
  'agents/quality/qa-planning.md',
149
150
  'agents/quality/qa-implementation.md',
@@ -309,10 +310,11 @@ The orchestrator is at \`chati.dev/orchestrator/chati.md\`.
309
310
  Read it to understand routing, session management, and agent activation.
310
311
 
311
312
  ## Constitution
312
- Governance rules are in \`chati.dev/constitution.md\` (10 Articles).
313
+ Governance rules are in \`chati.dev/constitution.md\` (17 Articles).
313
314
 
314
315
  ## Agents
315
- - PLANNING: chati.dev/agents/planning/ (8 agents)
316
+ - DISCOVER: chati.dev/agents/discover/ (3 agents)
317
+ - PLAN: chati.dev/agents/plan/ (5 agents)
316
318
  - Quality: chati.dev/agents/quality/ (2 agents)
317
319
  - BUILD: chati.dev/agents/build/ (1 agent)
318
320
  - DEPLOY: chati.dev/agents/deploy/ (1 agent)
@@ -10,7 +10,7 @@ export function generateSessionYaml(config) {
10
10
  project: {
11
11
  name: projectName,
12
12
  type: projectType,
13
- state: 'planning',
13
+ state: 'discover',
14
14
  },
15
15
  execution_mode: 'interactive',
16
16
  current_agent: '',
@@ -27,14 +27,14 @@ export async function validateInstallation(targetDir) {
27
27
  // Check all 13 agents (orchestrator + 12 specialized)
28
28
  const agentFiles = [
29
29
  'orchestrator/chati.md',
30
- 'agents/planning/greenfield-wu.md',
31
- 'agents/planning/brownfield-wu.md',
32
- 'agents/planning/brief.md',
33
- 'agents/planning/detail.md',
34
- 'agents/planning/architect.md',
35
- 'agents/planning/ux.md',
36
- 'agents/planning/phases.md',
37
- 'agents/planning/tasks.md',
30
+ 'agents/discover/greenfield-wu.md',
31
+ 'agents/discover/brownfield-wu.md',
32
+ 'agents/discover/brief.md',
33
+ 'agents/plan/detail.md',
34
+ 'agents/plan/architect.md',
35
+ 'agents/plan/ux.md',
36
+ 'agents/plan/phases.md',
37
+ 'agents/plan/tasks.md',
38
38
  'agents/quality/qa-planning.md',
39
39
  'agents/quality/qa-implementation.md',
40
40
  'agents/build/dev.md',
@@ -140,10 +140,10 @@ export function runHealthCheck(targetDir) {
140
140
  // 4. Agent check
141
141
  const agentPaths = [
142
142
  'orchestrator/chati.md',
143
- 'agents/planning/greenfield-wu.md', 'agents/planning/brownfield-wu.md',
144
- 'agents/planning/brief.md', 'agents/planning/detail.md',
145
- 'agents/planning/architect.md', 'agents/planning/ux.md',
146
- 'agents/planning/phases.md', 'agents/planning/tasks.md',
143
+ 'agents/discover/greenfield-wu.md', 'agents/discover/brownfield-wu.md',
144
+ 'agents/discover/brief.md', 'agents/plan/detail.md',
145
+ 'agents/plan/architect.md', 'agents/plan/ux.md',
146
+ 'agents/plan/phases.md', 'agents/plan/tasks.md',
147
147
  'agents/quality/qa-planning.md', 'agents/quality/qa-implementation.md',
148
148
  'agents/build/dev.md', 'agents/deploy/devops.md',
149
149
  ];
@@ -19,7 +19,7 @@ export function buildSessionDigest(projectDir, sessionState) {
19
19
  timestamp,
20
20
  date: dateStr,
21
21
  project: sessionState.project || {},
22
- mode: sessionState.mode || 'planning',
22
+ mode: sessionState.mode || 'discover',
23
23
  pipeline: sessionState.pipeline || {},
24
24
  agents: {},
25
25
  summary: {},