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
@@ -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: "[CLARITY 3/8] brief ✅ → detail 🔄 (score: 92%)"
38
+ * Example: "[PLANNING 3/8] brief ✅ → detail 🔄 (score: 92%)"
39
39
  * @param {object} pipelineState
40
40
  * @returns {string}
41
41
  */
@@ -75,10 +75,10 @@ export function formatDetailedReport(pipelineState) {
75
75
  lines.push(`Stage: ${stage}`);
76
76
  lines.push('');
77
77
 
78
- // CLARITY agents
79
- lines.push('CLARITY:');
80
- const clarityAgents = getStageAgents('CLARITY');
81
- clarityAgents.forEach(agent => {
78
+ // PLANNING agents
79
+ lines.push('PLANNING:');
80
+ const planningAgents = getStageAgents('PLANNING');
81
+ planningAgents.forEach(agent => {
82
82
  const status = agentStatus[agent] || 'pending';
83
83
  const icon = getStatusIcon(status);
84
84
  const isActive = agent === pipelineState.current_agent;
@@ -146,7 +146,7 @@ export function calculateCompletion(pipelineState) {
146
146
  */
147
147
  function getStageAgents(stage) {
148
148
  const stages = {
149
- CLARITY: [
149
+ PLANNING: [
150
150
  'greenfield-wu',
151
151
  'brownfield-wu',
152
152
  'brief',
@@ -170,7 +170,7 @@ function getStageAgents(stage) {
170
170
  */
171
171
  function getAllAgents() {
172
172
  return [
173
- ...getStageAgents('CLARITY'),
173
+ ...getStageAgents('PLANNING'),
174
174
  ...getStageAgents('BUILD'),
175
175
  ...getStageAgents('DEPLOY'),
176
176
  ];
@@ -249,7 +249,7 @@ function countTotalAgents(_pipelineState) {
249
249
  /**
250
250
  * Get progress summary by stage.
251
251
  * @param {object} pipelineState
252
- * @returns {{ clarity: number, build: number, deploy: number }}
252
+ * @returns {{ planning: number, build: number, deploy: number }}
253
253
  */
254
254
  export function getStageProgress(pipelineState) {
255
255
  const agentStatus = pipelineState.agent_status || {};
@@ -261,7 +261,7 @@ export function getStageProgress(pipelineState) {
261
261
  };
262
262
 
263
263
  return {
264
- clarity: getProgress('CLARITY'),
264
+ planning: getProgress('PLANNING'),
265
265
  build: getProgress('BUILD'),
266
266
  deploy: getProgress('DEPLOY'),
267
267
  };
@@ -2,11 +2,13 @@
2
2
  * MCP Registry and Configuration
3
3
  * Defines available MCPs and their agent dependencies
4
4
  */
5
+
6
+ export const DEFAULT_MCPS = ['context7', 'browser'];
7
+
5
8
  export const MCP_CONFIGS = {
6
9
  browser: {
7
10
  name: 'Browser (Playwright)',
8
11
  description: 'Web automation and testing',
9
- defaultSelected: true,
10
12
  requiresEnv: [],
11
13
  claudeConfig: {
12
14
  command: 'npx',
@@ -16,104 +18,33 @@ export const MCP_CONFIGS = {
16
18
  context7: {
17
19
  name: 'Context7',
18
20
  description: 'Library documentation search',
19
- defaultSelected: true,
20
21
  requiresEnv: [],
21
22
  claudeConfig: {
22
23
  command: 'npx',
23
24
  args: ['-y', '@context7/mcp'],
24
25
  },
25
26
  },
26
- exa: {
27
- name: 'Exa',
28
- description: 'Advanced web search',
29
- defaultSelected: true,
30
- requiresEnv: ['EXA_API_KEY'],
31
- claudeConfig: {
32
- command: 'npx',
33
- args: ['-y', '@exa/mcp'],
34
- env: { EXA_API_KEY: '${EXA_API_KEY}' },
35
- },
36
- },
37
- 'desktop-commander': {
38
- name: 'Desktop Commander',
39
- description: 'File system access',
40
- defaultSelected: false,
41
- requiresEnv: [],
42
- claudeConfig: {
43
- command: 'npx',
44
- args: ['-y', '@anthropic/desktop-commander-mcp'],
45
- },
46
- },
47
- 'sequential-thinking': {
48
- name: 'Sequential Thinking',
49
- description: 'Step-by-step reasoning',
50
- defaultSelected: false,
51
- requiresEnv: [],
52
- claudeConfig: {
53
- command: 'npx',
54
- args: ['-y', '@anthropic/sequential-thinking-mcp'],
55
- },
56
- },
57
- github: {
58
- name: 'GitHub',
59
- description: 'GitHub API integration',
60
- defaultSelected: false,
61
- requiresEnv: ['GITHUB_TOKEN'],
62
- claudeConfig: {
63
- command: 'npx',
64
- args: ['-y', '@anthropic/github-mcp'],
65
- env: { GITHUB_TOKEN: '${GITHUB_TOKEN}' },
66
- },
67
- },
68
27
  };
69
28
 
70
29
  /**
71
30
  * Agent-MCP dependency matrix
72
31
  */
73
32
  export const AGENT_MCP_DEPS = {
74
- orchestrator: { required: [], optional: ['git'] },
75
- 'greenfield-wu': { required: [], optional: [] },
76
- 'brownfield-wu': { required: ['git'], optional: ['browser'] },
77
- brief: { required: [], optional: [] },
78
- detail: { required: [], optional: ['exa'] },
79
- architect: { required: ['context7'], optional: ['exa', 'git'] },
80
- ux: { required: [], optional: ['browser'] },
81
- phases: { required: [], optional: [] },
82
- tasks: { required: [], optional: [] },
83
- 'qa-planning': { required: [], optional: [] },
84
- dev: { required: ['context7', 'git'], optional: ['browser', 'coderabbit'] },
85
- 'qa-implementation':{ required: ['git'], optional: ['browser', 'coderabbit'] },
86
- devops: { required: ['git', 'github'], optional: [] },
33
+ orchestrator: { required: [], optional: [] },
34
+ 'greenfield-wu': { required: [], optional: [] },
35
+ 'brownfield-wu': { required: [], optional: ['browser'] },
36
+ brief: { required: [], optional: [] },
37
+ detail: { required: [], optional: [] },
38
+ architect: { required: ['context7'], optional: [] },
39
+ ux: { required: [], optional: ['browser'] },
40
+ phases: { required: [], optional: [] },
41
+ tasks: { required: [], optional: [] },
42
+ 'qa-planning': { required: [], optional: [] },
43
+ dev: { required: ['context7'], optional: ['browser'] },
44
+ 'qa-implementation': { required: [], optional: ['browser'] },
45
+ devops: { required: [], optional: [] },
87
46
  };
88
47
 
89
- /**
90
- * Get list of MCPs for selection prompt
91
- */
92
- export function getMCPChoices() {
93
- return Object.entries(MCP_CONFIGS).map(([key, config]) => ({
94
- value: key,
95
- label: config.name,
96
- hint: config.description,
97
- initialValue: config.defaultSelected,
98
- }));
99
- }
100
-
101
- /**
102
- * Check MCP warnings for selected project type and MCPs
103
- */
104
- export function getMCPWarnings(projectType, selectedMCPs) {
105
- const warnings = [];
106
-
107
- if (projectType === 'brownfield' && !selectedMCPs.includes('git')) {
108
- warnings.push({
109
- level: 'critical',
110
- message: "You selected Brownfield but did not enable 'git' MCP. The brownfield-wu agent requires git for codebase analysis.",
111
- });
112
- }
113
-
114
- return warnings;
115
- }
116
-
117
48
  /**
118
49
  * Generate MCP config for Claude Code (.claude/mcp.json)
119
50
  */
@@ -23,7 +23,7 @@ const LAYER_TIMEOUT_MS = 100;
23
23
  * @param {object} input
24
24
  * @param {string} input.domainsDir - Path to chati.dev/domains/
25
25
  * @param {number} input.remainingPercent - Context window remaining (0-100)
26
- * @param {string} [input.mode] - Current mode (clarity, build, deploy)
26
+ * @param {string} [input.mode] - Current mode (planning, build, deploy)
27
27
  * @param {string} [input.agent] - Active agent name
28
28
  * @param {string} [input.workflow] - Active workflow name
29
29
  * @param {string} [input.pipelinePosition] - Current pipeline step
@@ -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 || 'clarity',
46
+ mode: input.mode || 'planning',
47
47
  bracket: bracket.bracket,
48
48
  agent: input.agent || null,
49
49
  workflow: input.workflow || null,
@@ -2,7 +2,7 @@
2
2
  * L1 Global Layer — ALWAYS active.
3
3
  *
4
4
  * Loads global rules: coding standards, bracket-specific behavioral rules,
5
- * mode governance constraints (clarity/build/deploy).
5
+ * mode governance constraints (planning/build/deploy).
6
6
  */
7
7
 
8
8
  import { loadGlobalDomain, extractRules } from '../domain-loader.js';
@@ -11,14 +11,14 @@ import { loadGlobalDomain, extractRules } from '../domain-loader.js';
11
11
  * Process L1: load global rules + mode governance.
12
12
  * @param {object} ctx - Pipeline context
13
13
  * @param {string} ctx.domainsDir - Path to chati.dev/domains/
14
- * @param {string} ctx.mode - Current mode (clarity, build, deploy)
14
+ * @param {string} ctx.mode - Current mode (planning, build, deploy)
15
15
  * @param {string} ctx.bracket - Current bracket (FRESH, MODERATE, etc.)
16
16
  * @returns {{ layer: string, rules: Array, mode: string, modeRules: object }}
17
17
  */
18
18
  export function processL1(ctx) {
19
19
  const domain = loadGlobalDomain(ctx.domainsDir);
20
20
  const rules = extractRules(domain);
21
- const mode = ctx.mode || 'clarity';
21
+ const mode = ctx.mode || 'planning';
22
22
 
23
23
  const modeRules = domain?.modes?.[mode] || {};
24
24
  const bracketRules = domain?.brackets?.[ctx.bracket] || {};
@@ -21,7 +21,7 @@ function formatScore(score, status) {
21
21
  */
22
22
  function formatState(state) {
23
23
  const stateMap = {
24
- clarity: brand('CLARITY'),
24
+ planning: brand('PLANNING'),
25
25
  build: yellow('BUILD'),
26
26
  validate: bold('VALIDATE'),
27
27
  deploy: green('DEPLOY'),
@@ -73,12 +73,12 @@ export function buildProjectInfo(data) {
73
73
  }
74
74
 
75
75
  /**
76
- * Build CLARITY section with agent scores
76
+ * Build PLANNING section with agent scores
77
77
  */
78
- export function buildClaritySection(data) {
78
+ export function buildPlanningSection(data) {
79
79
  const scores = data.agentScores || {};
80
80
 
81
- const clarityAgents = [
81
+ const planningAgents = [
82
82
  ['WU', scores['greenfield-wu'] || scores['brownfield-wu'] || { status: 'pending', score: 0 }],
83
83
  ['Brief', scores['brief'] || { status: 'pending', score: 0 }],
84
84
  ['Detail', scores['detail'] || { status: 'pending', score: 0 }],
@@ -89,16 +89,16 @@ export function buildClaritySection(data) {
89
89
  ['QA-P', scores['qa-planning'] || { status: 'pending', score: 0 }],
90
90
  ];
91
91
 
92
- const row1 = clarityAgents.slice(0, 4)
92
+ const row1 = planningAgents.slice(0, 4)
93
93
  .map(([name, info]) => `${dim(name.padEnd(8))} ${formatScore(info.score, info.status)}`)
94
94
  .join(' ');
95
95
 
96
- const row2 = clarityAgents.slice(4)
96
+ const row2 = planningAgents.slice(4)
97
97
  .map(([name, info]) => `${dim(name.padEnd(8))} ${formatScore(info.score, info.status)}`)
98
98
  .join(' ');
99
99
 
100
100
  return [
101
- brand('│') + ` ${brand('── CLARITY')} ${'─'.repeat(46)}` + brand('│'),
101
+ brand('│') + ` ${brand('── PLANNING')} ${'─'.repeat(46)}` + brand('│'),
102
102
  brand('│') + ` │ ${row1}` + ' '.repeat(5) + brand('│'),
103
103
  brand('│') + ` │ ${row2}` + ' '.repeat(5) + brand('│'),
104
104
  brand('│') + ` ${'─'.repeat(57)}` + brand('│'),
@@ -2,7 +2,7 @@ import { readDashboardData } from './data-reader.js';
2
2
  import {
3
3
  buildHeader,
4
4
  buildProjectInfo,
5
- buildClaritySection,
5
+ buildPlanningSection,
6
6
  buildBuildSection,
7
7
  buildValidateSection,
8
8
  buildIntelligenceSection,
@@ -25,7 +25,7 @@ export async function renderDashboard(targetDir) {
25
25
  ...buildHeader(data),
26
26
  ...buildProjectInfo(data),
27
27
  '',
28
- ...buildClaritySection(data),
28
+ ...buildPlanningSection(data),
29
29
  '',
30
30
  ...buildBuildSection(data),
31
31
  '',
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @fileoverview G1 — Planning Complete Gate
3
3
  *
4
- * Pre-BUILD gate that validates the CLARITY phase is fully completed.
4
+ * Pre-BUILD gate that validates the PLANNING 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 CLARITY artifacts.
34
+ * Collect evidence by checking filesystem for PLANNING 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 clarity completed',
102
+ 'Session shows planning 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 clarityAgents = ['brief', 'detail', 'architect', 'ux', 'phases', 'tasks', 'qa-planning'];
134
- const completed = clarityAgents.filter(a =>
133
+ const planningAgents = ['brief', 'detail', 'architect', 'ux', 'phases', 'tasks', 'qa-planning'];
134
+ const completed = planningAgents.filter(a =>
135
135
  evidence.sessionState.completedAgents.includes(a)
136
136
  );
137
137
 
138
- if (completed.length === clarityAgents.length) {
139
- criteriaResults.push('Session shows clarity completed');
138
+ if (completed.length === planningAgents.length) {
139
+ criteriaResults.push('Session shows planning completed');
140
140
  } else {
141
- const missing = clarityAgents.filter(a => !completed.includes(a));
142
- warnings.push(`Incomplete clarity agents: ${missing.join(', ')}`);
141
+ const missing = planningAgents.filter(a => !completed.includes(a));
142
+ warnings.push(`Incomplete planning agents: ${missing.join(', ')}`);
143
143
  }
144
144
  }
145
145
 
@@ -6,9 +6,9 @@
6
6
  * benchmarks are met, and security scans are clean.
7
7
  *
8
8
  * Verdicts:
9
- * PASS — All criteria met, score >= 90%
10
- * CONCERNS — Score 85-90%, minor issues noted
11
- * FAIL — Score < 85% or critical issues
9
+ * PASS — All criteria met, score >= 95%
10
+ * CONCERNS — Score 90-95%, minor issues noted
11
+ * FAIL — Score < 90% or critical issues
12
12
  * WAIVED — Human explicitly overrode
13
13
  */
14
14
 
@@ -127,11 +127,11 @@ export class QAImplementationGate extends GateBase {
127
127
  return QA_IMPL_VERDICTS.FAIL;
128
128
  }
129
129
 
130
- if (score >= 90 && evidence.allTestCriteriaMet) {
130
+ if (score >= 95 && evidence.allTestCriteriaMet) {
131
131
  return QA_IMPL_VERDICTS.PASS;
132
132
  }
133
133
 
134
- if (score >= 85) {
134
+ if (score >= 90) {
135
135
  return QA_IMPL_VERDICTS.CONCERNS;
136
136
  }
137
137
 
@@ -151,7 +151,7 @@ export class QAImplementationGate extends GateBase {
151
151
  'No critical bugs open',
152
152
  'Performance benchmarks met',
153
153
  'Security scan clean',
154
- 'QA-Implementation score >= 90',
154
+ 'QA-Implementation score >= 95',
155
155
  ];
156
156
 
157
157
  const criteriaResults = [];
@@ -192,10 +192,10 @@ export class QAImplementationGate extends GateBase {
192
192
  }
193
193
 
194
194
  // Check score
195
- if (evidence.qaImplHandoff && evidence.qaImplHandoff.score >= 90) {
196
- criteriaResults.push('QA-Implementation score >= 90');
195
+ if (evidence.qaImplHandoff && evidence.qaImplHandoff.score >= 95) {
196
+ criteriaResults.push('QA-Implementation score >= 95');
197
197
  } else if (evidence.qaImplHandoff) {
198
- warnings.push(`QA-Impl score: ${evidence.qaImplHandoff.score} (need >= 90)`);
198
+ warnings.push(`QA-Impl score: ${evidence.qaImplHandoff.score} (need >= 95)`);
199
199
  }
200
200
 
201
201
  const score = allCriteria.length > 0
@@ -1,9 +1,10 @@
1
- import { mkdirSync, writeFileSync, copyFileSync, existsSync } from 'fs';
1
+ import { mkdirSync, writeFileSync, copyFileSync, existsSync, readFileSync } from 'fs';
2
2
  import { join, dirname } from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { IDE_CONFIGS } from '../config/ide-configs.js';
5
5
  import { generateClaudeMCPConfig } from '../config/mcp-configs.js';
6
6
  import { generateSessionYaml, generateConfigYaml, generateClaudeMd, generateClaudeLocalMd } from './templates.js';
7
+ import { verifyManifest } from './manifest.js';
7
8
 
8
9
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
10
 
@@ -19,6 +20,20 @@ const FRAMEWORK_SOURCE = existsSync(BUNDLED_SOURCE) ? BUNDLED_SOURCE : MONOREPO_
19
20
  export async function installFramework(config) {
20
21
  const { targetDir, projectType, language, selectedIDEs, selectedMCPs, projectName, version } = config;
21
22
 
23
+ // 0. Verify framework signature (supply chain protection)
24
+ const manifestPath = join(FRAMEWORK_SOURCE, 'manifest.json');
25
+ const sigPath = join(FRAMEWORK_SOURCE, 'manifest.sig');
26
+
27
+ if (existsSync(manifestPath) && existsSync(sigPath)) {
28
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
29
+ const signature = readFileSync(sigPath, 'utf-8').trim();
30
+ const result = verifyManifest(manifest, signature);
31
+
32
+ if (!result.valid && result.reason === 'signature-mismatch') {
33
+ throw new Error('Framework signature verification failed. Package may have been tampered with.');
34
+ }
35
+ }
36
+
22
37
  // 1. Create .chati/ session directory
23
38
  createDir(join(targetDir, '.chati'));
24
39
  writeFileSync(
@@ -34,7 +49,7 @@ export async function installFramework(config) {
34
49
  // Copy framework structure
35
50
  const frameworkDirs = [
36
51
  'orchestrator',
37
- 'agents/clarity', 'agents/quality', 'agents/build', 'agents/deploy',
52
+ 'agents/planning', 'agents/quality', 'agents/build', 'agents/deploy',
38
53
  'templates', 'workflows', 'quality-gates',
39
54
  'schemas', 'frameworks', 'intelligence', 'patterns',
40
55
  'hooks', 'domains', 'domains/agents', 'domains/workflows',
@@ -120,15 +135,15 @@ function copyFrameworkFiles(destDir) {
120
135
  const filesToCopy = [
121
136
  'constitution.md',
122
137
  'orchestrator/chati.md',
123
- // CLARITY agents
124
- 'agents/clarity/greenfield-wu.md',
125
- 'agents/clarity/brownfield-wu.md',
126
- 'agents/clarity/brief.md',
127
- 'agents/clarity/detail.md',
128
- 'agents/clarity/architect.md',
129
- 'agents/clarity/ux.md',
130
- 'agents/clarity/phases.md',
131
- 'agents/clarity/tasks.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',
132
147
  // Quality agents
133
148
  'agents/quality/qa-planning.md',
134
149
  'agents/quality/qa-implementation.md',
@@ -297,7 +312,7 @@ Read it to understand routing, session management, and agent activation.
297
312
  Governance rules are in \`chati.dev/constitution.md\` (10 Articles).
298
313
 
299
314
  ## Agents
300
- - CLARITY: chati.dev/agents/clarity/ (8 agents)
315
+ - PLANNING: chati.dev/agents/planning/ (8 agents)
301
316
  - Quality: chati.dev/agents/quality/ (2 agents)
302
317
  - BUILD: chati.dev/agents/build/ (1 agent)
303
318
  - DEPLOY: chati.dev/agents/deploy/ (1 agent)
@@ -1,10 +1,25 @@
1
1
  import { readFileSync, writeFileSync, existsSync, statSync, mkdirSync } from 'fs';
2
- import { join } from 'path';
2
+ import { join, dirname } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { verify as cryptoVerify, createPublicKey } from 'crypto';
3
5
  import { hashFile } from './file-hasher.js';
4
6
 
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
5
8
  const MANIFEST_FILENAME = 'manifest.json';
6
9
  const MANIFEST_DIR = '.chati';
7
10
 
11
+ /**
12
+ * Load the Ed25519 public key for signature verification.
13
+ * Returns null if key file doesn't exist (dev environment).
14
+ */
15
+ let SIGNING_PUBLIC_KEY = null;
16
+ try {
17
+ const pemPath = join(__dirname, 'signing-public-key.pem');
18
+ SIGNING_PUBLIC_KEY = createPublicKey(readFileSync(pemPath));
19
+ } catch {
20
+ // Public key not available (dev environment without key generation)
21
+ }
22
+
8
23
  /**
9
24
  * Generate a manifest for a set of files under a root directory.
10
25
  *
@@ -115,3 +130,20 @@ export function compareManifests(oldManifest, newManifest) {
115
130
 
116
131
  return { added, removed, modified, unchanged };
117
132
  }
133
+
134
+ /**
135
+ * Verify a manifest signature using the embedded Ed25519 public key.
136
+ *
137
+ * @param {object} manifest - The manifest object to verify
138
+ * @param {string} signatureBase64 - Base64-encoded Ed25519 signature
139
+ * @returns {{ valid: boolean, reason: string }}
140
+ */
141
+ export function verifyManifest(manifest, signatureBase64) {
142
+ if (!SIGNING_PUBLIC_KEY) return { valid: false, reason: 'no-public-key' };
143
+
144
+ const manifestJson = JSON.stringify(manifest, Object.keys(manifest).sort(), 2);
145
+ const signature = Buffer.from(signatureBase64, 'base64');
146
+
147
+ const valid = cryptoVerify(null, Buffer.from(manifestJson), SIGNING_PUBLIC_KEY, signature);
148
+ return { valid, reason: valid ? 'ok' : 'signature-mismatch' };
149
+ }
@@ -0,0 +1,3 @@
1
+ -----BEGIN PUBLIC KEY-----
2
+ MCowBQYDK2VwAyEA8thWGs1GHKpeJyUTejpBwp8TZ7iZiN3vDxGDoQf8dMs=
3
+ -----END PUBLIC KEY-----
@@ -10,7 +10,7 @@ export function generateSessionYaml(config) {
10
10
  project: {
11
11
  name: projectName,
12
12
  type: projectType,
13
- state: 'clarity',
13
+ state: 'planning',
14
14
  },
15
15
  execution_mode: 'interactive',
16
16
  current_agent: '',
@@ -1,5 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'fs';
2
2
  import { join } from 'path';
3
+ import { hashFile } from './file-hasher.js';
4
+ import { loadManifest } from './manifest.js';
3
5
 
4
6
  /**
5
7
  * Validate chati.dev installation
@@ -17,6 +19,7 @@ export async function validateInstallation(targetDir) {
17
19
  registry: { pass: false, details: [] },
18
20
  memories: { pass: false, details: [] },
19
21
  context: { pass: false, details: [] },
22
+ integrity: { pass: false, details: [] },
20
23
  total: 0,
21
24
  passed: 0,
22
25
  };
@@ -24,14 +27,14 @@ export async function validateInstallation(targetDir) {
24
27
  // Check all 13 agents (orchestrator + 12 specialized)
25
28
  const agentFiles = [
26
29
  'orchestrator/chati.md',
27
- 'agents/clarity/greenfield-wu.md',
28
- 'agents/clarity/brownfield-wu.md',
29
- 'agents/clarity/brief.md',
30
- 'agents/clarity/detail.md',
31
- 'agents/clarity/architect.md',
32
- 'agents/clarity/ux.md',
33
- 'agents/clarity/phases.md',
34
- 'agents/clarity/tasks.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',
35
38
  'agents/quality/qa-planning.md',
36
39
  'agents/quality/qa-implementation.md',
37
40
  'agents/build/dev.md',
@@ -166,5 +169,35 @@ export async function validateInstallation(targetDir) {
166
169
  results.total += 1;
167
170
  if (results.context.pass) results.passed += 1;
168
171
 
172
+ // Check integrity: verify installed files match manifest hashes
173
+ const manifest = loadManifest(targetDir);
174
+ if (manifest && manifest.files) {
175
+ let matched = 0;
176
+ let mismatched = 0;
177
+ const mismatches = [];
178
+
179
+ for (const [relPath, entry] of Object.entries(manifest.files)) {
180
+ const absPath = join(targetDir, 'chati.dev', relPath);
181
+ if (existsSync(absPath)) {
182
+ const currentHash = hashFile(absPath);
183
+ if (currentHash === entry.hash) {
184
+ matched++;
185
+ } else {
186
+ mismatched++;
187
+ mismatches.push(relPath);
188
+ }
189
+ }
190
+ }
191
+
192
+ results.integrity.pass = mismatched === 0;
193
+ results.integrity.details.push({ matched, mismatched, mismatches });
194
+ } else {
195
+ // No manifest = skip integrity (first install or dev environment)
196
+ results.integrity.pass = true;
197
+ results.integrity.details.push({ skipped: true, reason: 'no-manifest' });
198
+ }
199
+ results.total += 1;
200
+ if (results.integrity.pass) results.passed += 1;
201
+
169
202
  return results;
170
203
  }
@@ -140,10 +140,10 @@ export function runHealthCheck(targetDir) {
140
140
  // 4. Agent check
141
141
  const agentPaths = [
142
142
  'orchestrator/chati.md',
143
- 'agents/clarity/greenfield-wu.md', 'agents/clarity/brownfield-wu.md',
144
- 'agents/clarity/brief.md', 'agents/clarity/detail.md',
145
- 'agents/clarity/architect.md', 'agents/clarity/ux.md',
146
- 'agents/clarity/phases.md', 'agents/clarity/tasks.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',
147
147
  'agents/quality/qa-planning.md', 'agents/quality/qa-implementation.md',
148
148
  'agents/build/dev.md', 'agents/deploy/devops.md',
149
149
  ];
@@ -215,6 +215,26 @@ export function searchAgentMemories(projectDir, query) {
215
215
  return results;
216
216
  }
217
217
 
218
+ /**
219
+ * Get top memory entries for an agent, sorted by confidence.
220
+ * Used by orchestrator/agents for programmatic memory access.
221
+ * @param {string} projectDir - Project directory
222
+ * @param {string} agentName - Agent name
223
+ * @param {number} [limit=5] - Max entries to return
224
+ * @returns {object[]} Top entries sorted by confidence (high → medium → low)
225
+ */
226
+ export function getTopMemories(projectDir, agentName, limit = 5) {
227
+ const memory = readAgentMemory(projectDir, agentName);
228
+ if (!memory.loaded) return [];
229
+
230
+ const confidenceOrder = { high: 3, medium: 2, low: 1 };
231
+ const sorted = [...memory.entries].sort((a, b) => {
232
+ return (confidenceOrder[b.confidence] || 2) - (confidenceOrder[a.confidence] || 2);
233
+ });
234
+
235
+ return sorted.slice(0, limit);
236
+ }
237
+
218
238
  /**
219
239
  * Get memory stats per agent.
220
240
  * @param {string} projectDir - Project directory
@@ -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 || 'clarity',
22
+ mode: sessionState.mode || 'planning',
23
23
  pipeline: sessionState.pipeline || {},
24
24
  agents: {},
25
25
  summary: {},