mindforge-cc 1.0.5 → 2.0.0-alpha.6

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 (119) hide show
  1. package/.agent/CLAUDE.md +83 -0
  2. package/.agent/mindforge/auto.md +22 -0
  3. package/.agent/mindforge/browse.md +26 -0
  4. package/.agent/mindforge/costs.md +11 -0
  5. package/.agent/mindforge/cross-review.md +17 -0
  6. package/.agent/mindforge/dashboard.md +98 -0
  7. package/.agent/mindforge/execute-phase.md +5 -3
  8. package/.agent/mindforge/init-project.md +12 -0
  9. package/.agent/mindforge/qa.md +16 -0
  10. package/.agent/mindforge/remember.md +14 -0
  11. package/.agent/mindforge/research.md +11 -0
  12. package/.agent/mindforge/steer.md +13 -0
  13. package/.agent/workflows/publish-release.md +36 -0
  14. package/.claude/CLAUDE.md +83 -0
  15. package/.claude/commands/mindforge/auto.md +22 -0
  16. package/.claude/commands/mindforge/browse.md +26 -0
  17. package/.claude/commands/mindforge/costs.md +11 -0
  18. package/.claude/commands/mindforge/cross-review.md +17 -0
  19. package/.claude/commands/mindforge/dashboard.md +98 -0
  20. package/.claude/commands/mindforge/execute-phase.md +5 -3
  21. package/.claude/commands/mindforge/qa.md +16 -0
  22. package/.claude/commands/mindforge/remember.md +14 -0
  23. package/.claude/commands/mindforge/research.md +11 -0
  24. package/.claude/commands/mindforge/steer.md +13 -0
  25. package/.mindforge/MINDFORGE-V2-SCHEMA.json +47 -0
  26. package/.mindforge/browser/daemon-protocol.md +24 -0
  27. package/.mindforge/browser/qa-engine.md +16 -0
  28. package/.mindforge/browser/session-manager.md +18 -0
  29. package/.mindforge/browser/visual-verify-spec.md +31 -0
  30. package/.mindforge/dashboard/api-reference.md +122 -0
  31. package/.mindforge/dashboard/dashboard-spec.md +96 -0
  32. package/.mindforge/engine/autonomous/auto-executor.md +266 -0
  33. package/.mindforge/engine/autonomous/headless-adapter.md +66 -0
  34. package/.mindforge/engine/autonomous/node-repair.md +190 -0
  35. package/.mindforge/engine/autonomous/progress-reporter.md +58 -0
  36. package/.mindforge/engine/autonomous/steering-manager.md +64 -0
  37. package/.mindforge/engine/autonomous/stuck-detector.md +89 -0
  38. package/.mindforge/memory/MEMORY-SCHEMA.md +155 -0
  39. package/.mindforge/memory/decision-library.jsonl +0 -0
  40. package/.mindforge/memory/engine/capture-protocol.md +36 -0
  41. package/.mindforge/memory/engine/global-sync-spec.md +42 -0
  42. package/.mindforge/memory/engine/retrieval-spec.md +44 -0
  43. package/.mindforge/memory/knowledge-base.jsonl +7 -0
  44. package/.mindforge/memory/pattern-library.jsonl +1 -0
  45. package/.mindforge/memory/team-preferences.jsonl +4 -0
  46. package/.mindforge/models/model-registry.md +48 -0
  47. package/.mindforge/models/model-router.md +30 -0
  48. package/.mindforge/personas/research-agent.md +24 -0
  49. package/.planning/approvals/v2-architecture-approval.json +15 -0
  50. package/.planning/browser-daemon.log +32 -0
  51. package/.planning/decisions/ADR-021-autonomy-boundary.md +17 -0
  52. package/.planning/decisions/ADR-022-node-repair-hierarchy.md +19 -0
  53. package/.planning/decisions/ADR-023-gate-3-timing.md +15 -0
  54. package/CHANGELOG.md +81 -0
  55. package/MINDFORGE.md +26 -3
  56. package/README.md +70 -18
  57. package/bin/autonomous/auto-runner.js +95 -0
  58. package/bin/autonomous/headless.js +36 -0
  59. package/bin/autonomous/progress-stream.js +49 -0
  60. package/bin/autonomous/repair-operator.js +213 -0
  61. package/bin/autonomous/steer.js +71 -0
  62. package/bin/autonomous/stuck-monitor.js +77 -0
  63. package/bin/browser/browser-daemon.js +139 -0
  64. package/bin/browser/daemon-manager.js +91 -0
  65. package/bin/browser/qa-engine.js +47 -0
  66. package/bin/browser/qa-report-writer.js +32 -0
  67. package/bin/browser/regression-writer.js +27 -0
  68. package/bin/browser/screenshot-store.js +49 -0
  69. package/bin/browser/session-manager.js +93 -0
  70. package/bin/browser/visual-verify-executor.js +89 -0
  71. package/bin/change-classifier.js +86 -0
  72. package/bin/dashboard/api-router.js +198 -0
  73. package/bin/dashboard/approval-handler.js +134 -0
  74. package/bin/dashboard/frontend/index.html +511 -0
  75. package/bin/dashboard/metrics-aggregator.js +296 -0
  76. package/bin/dashboard/server.js +135 -0
  77. package/bin/dashboard/sse-bridge.js +178 -0
  78. package/bin/dashboard/team-tracker.js +0 -0
  79. package/bin/governance/approve.js +60 -0
  80. package/bin/install.js +4 -4
  81. package/bin/installer-core.js +91 -35
  82. package/bin/memory/cli.js +99 -0
  83. package/bin/memory/global-sync.js +107 -0
  84. package/bin/memory/knowledge-capture.js +278 -0
  85. package/bin/memory/knowledge-indexer.js +172 -0
  86. package/bin/memory/knowledge-store.js +319 -0
  87. package/bin/memory/session-memory-loader.js +137 -0
  88. package/bin/migrations/0.1.0-to-0.5.0.js +2 -3
  89. package/bin/migrations/0.5.0-to-0.6.0.js +1 -1
  90. package/bin/migrations/0.6.0-to-1.0.0.js +3 -3
  91. package/bin/migrations/migrate.js +15 -11
  92. package/bin/mindforge-cli.js +87 -0
  93. package/bin/models/anthropic-provider.js +77 -0
  94. package/bin/models/cost-tracker.js +118 -0
  95. package/bin/models/gemini-provider.js +79 -0
  96. package/bin/models/model-client.js +98 -0
  97. package/bin/models/model-router.js +111 -0
  98. package/bin/models/openai-provider.js +78 -0
  99. package/bin/research/research-engine.js +115 -0
  100. package/bin/review/cross-review-engine.js +81 -0
  101. package/bin/review/finding-synthesizer.js +116 -0
  102. package/bin/review/review-report-writer.js +49 -0
  103. package/bin/updater/self-update.js +13 -13
  104. package/bin/wizard/setup-wizard.js +5 -1
  105. package/docs/adr/ADR-024-browser-localhost-only.md +17 -0
  106. package/docs/adr/ADR-025-visual-verify-failure-treatment.md +19 -0
  107. package/docs/adr/ADR-026-session-persistence-security.md +20 -0
  108. package/docs/architecture/README.md +6 -2
  109. package/docs/ci-cd.md +92 -0
  110. package/docs/commands-reference.md +1 -0
  111. package/docs/feature-dashboard.md +52 -0
  112. package/docs/publishing-guide.md +43 -0
  113. package/docs/reference/commands.md +17 -2
  114. package/docs/reference/sdk-api.md +6 -1
  115. package/docs/testing-current-version.md +130 -0
  116. package/docs/user-guide.md +115 -9
  117. package/docs/usp-features.md +70 -8
  118. package/docs/workflow-atlas.md +57 -0
  119. package/package.json +7 -3
@@ -0,0 +1,81 @@
1
+ /**
2
+ * MindForge v2 — Cross-Review Engine
3
+ */
4
+ 'use strict';
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const ModelClient = require('../models/model-client');
9
+ const { synthesizeFindings, extractVerdict } = require('./finding-synthesizer');
10
+ const { write: writeReport } = require('./review-report-writer');
11
+
12
+ const PRIMARY_PROMPT = `You are a senior codebase architect performing a code review.
13
+ Focus on: architectural alignment, logic correctness, maintainability, and complexity.
14
+ Format every finding as: **[SEVERITY]** \`file:line\` — description
15
+ Severities: LOW, MEDIUM, HIGH, CRITICAL.
16
+ Finish with "### Verdict: APPROVE" or "### Verdict: REQUEST_CHANGES".`;
17
+
18
+ const ADVERSARIAL_PROMPT = `You are a paranoid security auditor reviewing code written by a competitor.
19
+ Your goal is to find bugs, security holes, and edge cases they missed.
20
+ Be critical. Trust nothing.
21
+ Format every finding as: **[SEVERITY]** \`file:line\` — description
22
+ Severities: LOW, MEDIUM, HIGH, CRITICAL.
23
+ Finish with "### Verdict: APPROVE" or "### Verdict: REQUEST_CHANGES".`;
24
+
25
+ async function runCrossReview(params) {
26
+ const {
27
+ phaseNum,
28
+ diff,
29
+ context = '',
30
+ models = ['claude-3-5-sonnet-20240620', 'gpt-4o'],
31
+ sessionId = 'unknown'
32
+ } = params;
33
+
34
+ process.stdout.write(`⚡ Starting cross-model review for Phase ${phaseNum}...\n`);
35
+
36
+ const reviews = [];
37
+
38
+ // Round 1: Primary
39
+ process.stdout.write(` Round 1 (${models[0]}): `);
40
+ const r1 = await ModelClient.complete({
41
+ model: models[0],
42
+ systemPrompt: PRIMARY_PROMPT,
43
+ userMessage: `Context:\n${context}\n\nDiff:\n${diff}`,
44
+ taskName: `review-primary-phase-${phaseNum}`,
45
+ sessionId,
46
+ phaseNum
47
+ });
48
+ reviews.push({ model: models[0], content: r1.content, role: 'primary', cost_usd: r1.cost_usd });
49
+ process.stdout.write(`done ($${r1.cost_usd.toFixed(4)})\n`);
50
+
51
+ // Round 2: Adversarial
52
+ process.stdout.write(` Round 2 (${models[1]}): `);
53
+ const r2 = await ModelClient.complete({
54
+ model: models[1],
55
+ systemPrompt: ADVERSARIAL_PROMPT,
56
+ userMessage: `Context:\n${context}\n\nDiff:\n${diff}`,
57
+ taskName: `review-adversarial-phase-${phaseNum}`,
58
+ sessionId,
59
+ phaseNum
60
+ });
61
+ reviews.push({ model: models[1], content: r2.content, role: 'adversarial', cost_usd: r2.cost_usd });
62
+ process.stdout.write(`done ($${r2.cost_usd.toFixed(4)})\n`);
63
+
64
+ // Synthesis
65
+ const synthesis = synthesizeFindings(reviews);
66
+
67
+ const result = {
68
+ phase: phaseNum,
69
+ reviews,
70
+ synthesis,
71
+ total_cost_usd: reviews.reduce((sum, r) => sum + r.cost_usd, 0),
72
+ timestamp: new Date().toISOString()
73
+ };
74
+
75
+ const reportPath = writeReport(phaseNum, result);
76
+ process.stdout.write(`✅ Cross-review complete. Saved to ${reportPath}\n`);
77
+
78
+ return result;
79
+ }
80
+
81
+ module.exports = { runCrossReview, parseFindings: synthesizeFindings.parseFindings, extractVerdict };
@@ -0,0 +1,116 @@
1
+ /**
2
+ * MindForge v2 — Finding Synthesizer
3
+ * Identifies consensus, model-specific issues, and contradictions.
4
+ */
5
+ 'use strict';
6
+
7
+ const SEVERITY_ORDER = ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'];
8
+
9
+ function synthesizeFindings(reviews) {
10
+ const allFindings = [];
11
+ const modelSpecific = {};
12
+
13
+ for (const review of reviews) {
14
+ const findings = parseFindings(review.content);
15
+ modelSpecific[review.model] = findings;
16
+ for (const f of findings) {
17
+ allFindings.push({ ...f, model: review.model });
18
+ }
19
+ }
20
+
21
+ // Detect consensus
22
+ const consensus = [];
23
+ const processed = new Set();
24
+
25
+ for (let i = 0; i < allFindings.length; i++) {
26
+ if (processed.has(i)) continue;
27
+ const f1 = allFindings[i];
28
+ const group = [f1];
29
+ processed.add(i);
30
+
31
+ for (let j = i + 1; j < allFindings.length; j++) {
32
+ if (processed.has(j)) continue;
33
+ const f2 = allFindings[j];
34
+
35
+ if (isSameFinding(f1, f2)) {
36
+ group.push(f2);
37
+ processed.add(j);
38
+ }
39
+ }
40
+
41
+ if (group.length >= 2) {
42
+ consensus.push({
43
+ location: f1.location,
44
+ description: f1.description,
45
+ severity: getHighestSeverity(group.map(f => f.severity)),
46
+ models: group.map(f => f.model),
47
+ });
48
+ }
49
+ }
50
+
51
+ // Detect contradictions (large severity gap on same finding)
52
+ const contradictions = [];
53
+ // (In a real implementation, we'd more deeply analyze conflicting logic)
54
+
55
+ return {
56
+ consensus,
57
+ model_specific: modelSpecific,
58
+ contradictions,
59
+ total_findings: allFindings.length,
60
+ critical_count: allFindings.filter(f => f.severity === 'CRITICAL').length,
61
+ overall_verdict: getOverallVerdict(reviews.map(r => extractVerdict(r.content)))
62
+ };
63
+ }
64
+
65
+ function parseFindings(text) {
66
+ const findings = [];
67
+ // Simple regex-based parser for the [SEVERITY] location - description format
68
+ const regex = /\*\*\[(LOW|MEDIUM|HIGH|CRITICAL)\]\*\* `([^`]+)` — ([^\n]+)/g;
69
+ let match;
70
+ while ((match = regex.exec(text)) !== null) {
71
+ findings.push({
72
+ severity: match[1],
73
+ location: match[2],
74
+ description: match[3].trim()
75
+ });
76
+ }
77
+ return findings;
78
+ }
79
+
80
+ function isSameFinding(f1, f2) {
81
+ const loc1 = normalizeLocation(f1.location);
82
+ const loc2 = normalizeLocation(f2.location);
83
+ return loc1 === loc2;
84
+ }
85
+
86
+ function normalizeLocation(loc) {
87
+ if (!loc) return '';
88
+ // Fuzzy match on line numbers using 20-line band
89
+ return loc.toLowerCase().replace(/:(\d+)$/, (_, n) => {
90
+ const band = Math.round(parseInt(n, 10) / 20) * 20;
91
+ return `:${band}`;
92
+ });
93
+ }
94
+
95
+ function getHighestSeverity(severities) {
96
+ let highest = 0;
97
+ for (const s of severities) {
98
+ const idx = SEVERITY_ORDER.indexOf(s);
99
+ if (idx > highest) highest = idx;
100
+ }
101
+ return SEVERITY_ORDER[highest];
102
+ }
103
+
104
+ function extractVerdict(text) {
105
+ if (text.includes('### Verdict: APPROVE')) return 'APPROVE';
106
+ if (text.includes('### Verdict: REQUEST_CHANGES')) return 'REQUEST_CHANGES';
107
+ return 'COMMENT';
108
+ }
109
+
110
+ function getOverallVerdict(verdicts) {
111
+ if (verdicts.includes('REQUEST_CHANGES')) return 'REQUEST_CHANGES';
112
+ if (verdicts.every(v => v === 'APPROVE')) return 'APPROVE';
113
+ return 'COMMENT';
114
+ }
115
+
116
+ module.exports = { synthesizeFindings, parseFindings, extractVerdict };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * MindForge v2 — Review Report Writer
3
+ */
4
+ 'use strict';
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ function write(phaseNum, result) {
10
+ const dir = path.join(process.cwd(), '.planning', 'phases', String(phaseNum));
11
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
12
+
13
+ const reportPath = path.join(dir, `CROSS-REVIEW-${phaseNum}.md`);
14
+
15
+ let content = [
16
+ `# Cross-Model Code Review — Phase ${phaseNum}`,
17
+ `**Verdict:** ${result.synthesis.overall_verdict === 'APPROVE' ? '✅ APPROVE' : '❌ REQUEST_CHANGES'}`,
18
+ `**Total Cost:** $${result.total_cost_usd.toFixed(4)}`,
19
+ `**Models:** ${result.reviews.map(r => r.model).join(', ')}`,
20
+ `**Date:** ${new Date(result.timestamp).toLocaleString()}`,
21
+ '',
22
+ '## Consensus Findings (High Confidence)',
23
+ result.synthesis.consensus.length > 0
24
+ ? result.synthesis.consensus.map(f => `- **[${f.severity}]** \`${f.location}\` — ${f.description} (Models: ${f.models.join(', ')})`).join('\n')
25
+ : '_No consensus issues found._',
26
+ '',
27
+ '## Model-Specific Findings',
28
+ ].join('\n');
29
+
30
+ for (const model in result.synthesis.model_specific) {
31
+ const findings = result.synthesis.model_specific[model];
32
+ content += `\n### ${model}\n`;
33
+ if (findings.length === 0) {
34
+ content += '_No specific issues found._\n';
35
+ } else {
36
+ content += findings.map(f => `- **[${f.severity}]** \`${f.location}\` — ${f.description}`).join('\n') + '\n';
37
+ }
38
+ }
39
+
40
+ content += '\n## Full Model Outputs\n';
41
+ for (const review of result.reviews) {
42
+ content += `\n### ${review.model} (${review.role})\n\n${review.content}\n\n---\n`;
43
+ }
44
+
45
+ fs.writeFileSync(reportPath, content);
46
+ return reportPath;
47
+ }
48
+
49
+ module.exports = { write };
@@ -76,13 +76,13 @@ async function checkAndUpdate(options = {}) {
76
76
 
77
77
  console.log(`\n${bold('⚡ MindForge Update Check')}\n`);
78
78
  console.log(` Current : v${CURRENT_VERSION}`);
79
- process.stdout.write(` Latest : checking npm registry... `);
79
+ process.stdout.write(' Latest : checking npm registry... ');
80
80
 
81
81
  const latestVersion = await fetchLatestVersion();
82
82
  if (!latestVersion) {
83
83
  console.log(`${warn('unavailable')}`);
84
84
  console.log(`\n ${warn('⚠️')} Cannot reach npm registry. Check your internet connection.`);
85
- console.log(` Manual check: npm info mindforge-cc version\n`);
85
+ console.log(' Manual check: npm info mindforge-cc version\n');
86
86
  return { status: 'check-failed' };
87
87
  }
88
88
 
@@ -99,30 +99,30 @@ async function checkAndUpdate(options = {}) {
99
99
  // Major version safety gate
100
100
  if (type === 'major' && !force) {
101
101
  console.log(`\n ${warn('⚠️ MAJOR UPDATE')} — may contain breaking changes.`);
102
- console.log(` Review the changelog before applying.`);
103
- console.log(` To apply anyway: /mindforge:update --apply --force\n`);
102
+ console.log(' Review the changelog before applying.');
103
+ console.log(' To apply anyway: /mindforge:update --apply --force\n');
104
104
  }
105
105
 
106
106
  // Fetch and display changelog
107
107
  if (!skipChangelog) {
108
- process.stdout.write(`\n Fetching changelog... `);
108
+ process.stdout.write('\n Fetching changelog... ');
109
109
  const changelog = await fetchChangelog(CURRENT_VERSION, latestVersion);
110
110
  if (changelog) {
111
- console.log(`done\n`);
111
+ console.log('done\n');
112
112
  console.log('─'.repeat(62));
113
113
  console.log(changelog.slice(0, 3000)); // Max 3000 chars to avoid flooding terminal
114
- if (changelog.length > 3000) console.log(`\n [changelog truncated — see CHANGELOG.md for full details]`);
114
+ if (changelog.length > 3000) console.log('\n [changelog truncated — see CHANGELOG.md for full details]');
115
115
  console.log('─'.repeat(62));
116
116
  } else {
117
- console.log(`unavailable\n`);
117
+ console.log('unavailable\n');
118
118
  }
119
119
  }
120
120
 
121
121
  if (!apply) {
122
122
  if (isCI) {
123
- console.log(`\n CI mode: check-only (no apply without --apply)`);
123
+ console.log('\n CI mode: check-only (no apply without --apply)');
124
124
  }
125
- console.log(`\n To apply: /mindforge:update --apply`);
125
+ console.log('\n To apply: /mindforge:update --apply');
126
126
  console.log(` Or directly: npx mindforge-cc@${latestVersion} --update\n`);
127
127
  return { status: 'update-available', current: CURRENT_VERSION, latest: latestVersion, type };
128
128
  }
@@ -136,7 +136,7 @@ async function checkAndUpdate(options = {}) {
136
136
  // Detect original install scope to preserve it
137
137
  const { scope, runtime } = detectInstallScope();
138
138
  console.log(` Install scope : ${runtime} / ${scope}`);
139
- console.log(`\n Applying update...`);
139
+ console.log('\n Applying update...');
140
140
 
141
141
  try {
142
142
  execSync(
@@ -158,11 +158,11 @@ async function checkAndUpdate(options = {}) {
158
158
  }
159
159
  } catch (migErr) {
160
160
  console.warn(` ${warn('⚠️')} Schema migration had an issue: ${migErr.message}`);
161
- console.warn(` Run /mindforge:migrate manually if state files look wrong.`);
161
+ console.warn(' Run /mindforge:migrate manually if state files look wrong.');
162
162
  }
163
163
 
164
164
  console.log(`\n ${ok('✅')} MindForge updated to v${latestVersion}\n`);
165
- console.log(` Run /mindforge:health to verify the update.\n`);
165
+ console.log(' Run /mindforge:health to verify the update.\n');
166
166
  return { status: 'updated', from: CURRENT_VERSION, to: latestVersion };
167
167
  }
168
168
 
@@ -246,4 +246,8 @@ async function main() {
246
246
  }
247
247
  }
248
248
 
249
- main();
249
+ module.exports = { main };
250
+
251
+ if (require.main === module) {
252
+ main();
253
+ }
@@ -0,0 +1,17 @@
1
+ # ADR-024: Browser Daemon Localhost Binding
2
+
3
+ ## Status
4
+ Accepted
5
+
6
+ ## Context
7
+ The MindForge v2 Browser Runtime exposes an HTTP API for controlling a Chromium instance. This API allows for powerful actions like navigation, interaction, and data extraction, which could be exploited if exposed to the network.
8
+
9
+ ## Decision
10
+ We will strictly bind the Browser Daemon to `127.0.0.1` (localhost) only.
11
+
12
+ 1. The HTTP server will only listen on `127.0.0.1`.
13
+ 2. The server will perform a secondary check on `req.socket.remoteAddress` to reject any requests not originating from `127.0.0.1`, `::1`, or `::ffff:127.0.0.1`.
14
+
15
+ ## Consequences
16
+ - The daemon cannot be controlled remotely by default, significantly reducing the attack surface.
17
+ - Developers needing remote control must use an explicit SSH tunnel or reverse proxy with authentication.
@@ -0,0 +1,19 @@
1
+ # ADR-025: <verify-visual> Failure Treatment
2
+
3
+ ## Status
4
+ Accepted
5
+
6
+ ## Context
7
+ Visual verification is a critical part of the UI development lifecycle in MindForge v2. Failures in visual verification often indicate broken layouts or missing components that standard unit/integration tests might miss.
8
+
9
+ ## Decision
10
+ Failures within a `<verify-visual>` block in a PLAN file will be treated as fatal errors, equivalent to a `<verify>` (shell command) failure.
11
+
12
+ 1. The wave executor will stop immediately if a visual verification fails.
13
+ 2. The user will be notified of the specific failure (e.g., "Element not visible").
14
+ 3. Subsequent waves or phase-level verification will not proceed until the failure is resolved.
15
+
16
+ ## Consequences
17
+ - High confidence in UI integrity.
18
+ - Prevents "broken" UI states from being committed to the codebase.
19
+ - May slightly increase development time if visual selectors are brittle.
@@ -0,0 +1,20 @@
1
+ # ADR-026: Browser Session Persistence and Security
2
+
3
+ ## Status
4
+ Accepted
5
+
6
+ ## Context
7
+ MindForge v2 persists browser sessions (cookies, localStorage) to allow for seamless multi-phase development without re-authentication.
8
+
9
+ ## Decision
10
+ 1. Session files will be stored in `.mindforge/browser/sessions/`.
11
+ 2. All files in this directory will be explicitly ignored by Git to prevent leaking sensitive credentials (auth tokens).
12
+ 3. Session files are JSON-formatted and map directly to Playwright's state format.
13
+
14
+ ## Implementation
15
+ - Update `.gitignore` to include `.mindforge/browser/sessions/`.
16
+ - `session-manager.js` will handle the logic for atomic file writes and reads.
17
+
18
+ ## Consequences
19
+ - Security: Credentials are kept local to the developer's machine.
20
+ - Dev Experience: Sessions persist across restarts of the tool or the daemon.
@@ -8,13 +8,16 @@ Markdown protocols and JSON schemas, with a small Node.js CLI runtime.
8
8
  1. **Command layer** — Markdown commands in `.claude/commands/mindforge/`
9
9
  2. **Engine layer** — Execution protocols under `.mindforge/engine/`
10
10
  3. **Governance layer** — Approvals, audit, compliance gates in `.mindforge/governance/`
11
- 4. **Intelligence layer** — Health, difficulty, anti-patterns in `.mindforge/intelligence/`
12
- 5. **Distribution layer** — Installer, registry, CI, SDK, plugins
11
+ 4. **Intelligence Layer** — Health, difficulty, anti-patterns in `.mindforge/intelligence/`
12
+ 5. **Knowledge Layer** — Long-term memory, capture, and sync in `.mindforge/memory/`
13
+ 6. **Distribution Layer** — Installer, registry, CI, SDK, plugins
14
+ 7. **Observability Layer (v2)** — Real-time dashboard, SSE bridge, metrics aggregator
13
15
 
14
16
  ## Key data artifacts
15
17
  - `.planning/PROJECT.md` — project brief
16
18
  - `.planning/STATE.md` — current execution state
17
19
  - `.planning/HANDOFF.json` — machine-readable session handoff
20
+ - `.mindforge/memory/knowledge-base.jsonl` — local project memory
18
21
  - `.planning/AUDIT.jsonl` — append-only audit log
19
22
 
20
23
  ## Runtime flow (high level)
@@ -22,6 +25,7 @@ Markdown protocols and JSON schemas, with a small Node.js CLI runtime.
22
25
  2. `/mindforge:execute-phase` runs plans in waves
23
26
  3. `/mindforge:verify-phase` runs automated + human gates
24
27
  4. `/mindforge:ship` generates release artifacts and PR metadata
28
+ 5. `/mindforge:dashboard` provides real-time observability and governance
25
29
 
26
30
  ## Installation targets
27
31
  - Claude Code: `~/.claude/` or `.claude/`
package/docs/ci-cd.md ADDED
@@ -0,0 +1,92 @@
1
+ # 🚀 MindForge 5-Layer Plane Architecture (CI/CD)
2
+
3
+ MindForge v2.0.0 uses a sophisticated Control + Execution Plane architecture for its GitHub Actions, ensuring enterprise-grade governance and autonomous execution capabilities.
4
+
5
+ ## 🏗️ The 5 Planes
6
+
7
+ | Plane | Purpose | Trigger |
8
+ | --- | --- | --- |
9
+ | **Control Plane** | Change classification & Routing | `push`, `pull_request` |
10
+ | **Execution Plane** | Headless agent runtime | `workflow_call` |
11
+ | **AI Intelligence** | Multi-model code validation | PRs (reusable) |
12
+ | **Release Plane** | Packaging & Deployment | Tags (`v*`) |
13
+ | **Observability** | Run metrics & Analytics | Post-run |
14
+
15
+ ---
16
+
17
+ ## 🔄 PR Workflow Lifecycle
18
+
19
+ When you open or update a Pull Request, MindForge triggers the following "Beast" sequence:
20
+
21
+ 1. **🔍 Classify**: Analyzes diffs to assign a **Governance Tier (1, 2, or 3)**.
22
+ 2. **⚖️ Govern**:
23
+ - **Tier 3 Enforcement**: Blocks the PR if sensitive changes are detected without an approval file.
24
+ - **Security Scan**: Automatically validates `MINDFORGE.md` and project configurations.
25
+ 3. **⚡ Execute**:
26
+ - Runs **Headless Agent** to verify autonomous logic.
27
+ - Executes full **Test Suite** and **Linter**.
28
+ 4. **🤖 Review**:
29
+ - Triggers **AI Intelligence Layer** (Claude + GPT-4o).
30
+ - Posts architectural/security findings as a **PR Comment**.
31
+ 5. **📊 Observe**: Generates a performance and audit trace report.
32
+
33
+ ---
34
+
35
+ ## 🔍 Control Plane & Tiers
36
+
37
+ Every change is automatically classified into a governance tier:
38
+
39
+ - **Tier 1 (Trivial)**: Auto-approves and executes basic verification.
40
+ - **Tier 2 (Logic)**: Executes full test suites and AI review.
41
+ - **Tier 3 (Sensitive)**: Blocks the pipeline unless a manual approval is found in `.planning/approvals/`.
42
+
43
+ ---
44
+
45
+ ## 🛠️ MindForge CLI (`bin/mindforge-cli.js`)
46
+
47
+ All planes interact with MindForge via a centralized CLI router:
48
+
49
+ - `health`: Validates project integrity.
50
+ - `security-scan`: Scans for secrets and PII.
51
+ - `headless`: Executes agents in non-interactive mode.
52
+ - `pr-review`: Standard code review.
53
+ - `cross-review`: Multi-model architecture validation.
54
+
55
+ ---
56
+
57
+ ## 🛡️ Governance Enforcement
58
+
59
+ If a PR touches sensitive components (Auth, Payments, Security):
60
+ 1. The **Control Plane** identifies it as **Tier 3**.
61
+ 2. The **Governance Gate** fails unless a valid `.planning/approvals/*.json` file exists.
62
+ 3. Once approved, the **Execution Plane** resumes the workflow.
63
+
64
+
65
+
66
+ ---
67
+
68
+ ## 📦 Automated Releases
69
+
70
+ Releases are triggered by pushing a semver tag:
71
+
72
+ ```bash
73
+ git tag v2.0.0
74
+ git push origin v2.0.0
75
+ ```
76
+
77
+ This will automatically:
78
+
79
+ - Run the full test suite.
80
+ - Generate a CHANGELOG.
81
+ - Publish to npm.
82
+ - Create a GitHub Release with build artifacts.
83
+
84
+ ---
85
+
86
+ ## 📊 Observability
87
+
88
+ MindForge tracks every CI execution:
89
+
90
+ - **Success Rate**: Phase completion status.
91
+ - **Token Usage**: AI cost monitoring.
92
+ - **Audit Trace**: Full execution history in `AUDIT.jsonl`.
@@ -8,4 +8,5 @@
8
8
  | `/mindforge:execute-phase [N]` | Execute plans with wave-based parallelism |
9
9
  | `/mindforge:verify-phase [N]` | Human acceptance testing + automated checks |
10
10
  | `/mindforge:ship [N]` | Generate changelog, run quality gates, create PR |
11
+ | `/mindforge:dashboard` | Manage the real-time web observability dashboard |
11
12
 
@@ -0,0 +1,52 @@
1
+ # Feature: Real-time Dashboard (v2)
2
+
3
+ The MindForge Real-time Dashboard provides a high-fidelity, web-based control center for your agentic workflows. It leverages **Server-Sent Events (SSE)** to push live updates from your codebase directly to your browser with zero performance overhead.
4
+
5
+ ## 🚀 Getting Started
6
+
7
+ To launch the dashboard:
8
+ ```bash
9
+ /mindforge:dashboard --start --open
10
+ ```
11
+
12
+ Default access: `http://localhost:7339` (Strictly bound to `127.0.0.1` for security).
13
+
14
+ ## 🛠 Key Features
15
+
16
+ ### 1. Live Audit Stream
17
+ - Real-time rolling feed of all `AUDIT.jsonl` events.
18
+ - Color-coded status indicators (Success, Failure, Security Warning).
19
+ - Detailed JSON inspection for every action.
20
+
21
+ ### 2. Performance Metrics
22
+ - **Token Costs**: Cumulative and session-based cost tracking across all providers.
23
+ - **Quality Score**: Real-time graphing of verify-pass-rates.
24
+ - **Compaction Health**: Monitoring of context management efficiency.
25
+
26
+ ### 3. Web-based Governance
27
+ - **Tier 2/3 Approvals**: Review pending architectural or security changes.
28
+ - **Tier 3 Confirmation**: Mandatory plan ID typing for high-risk approvals is enforced in the UI.
29
+ - **Decision History**: Interactive timeline of past approvals and rejections.
30
+
31
+ ### 4. Team & Agent Activity
32
+ - **Wave Progress**: Track multiple agents executing parallel waves.
33
+ - **Persona Context**: See which agent personas are currently active.
34
+ - **Steerage Feed**: View steering instructions as they are applied.
35
+
36
+ ## 🛡 Hardened Security
37
+ - **Localhost Binding**: The server refuses connections from external IPs.
38
+ - **CORS Lock-down**: Only allows requests from the local control plane.
39
+ - **Integrity First**: Audit logs are written by the backend *before* changes are committed, ensuring a bulletproof trail.
40
+
41
+ ## 📟 Command Reference
42
+
43
+ | Flag | Action |
44
+ | :--- | :--- |
45
+ | `--start` | Launch the dashboard server process. |
46
+ | `--stop` | Gracefully shut down the server. |
47
+ | `--status` | Check if the dashboard is running and get PID. |
48
+ | `--open` | Open the UI in your default browser. |
49
+ | `--port [N]` | Change the default port (7339). |
50
+
51
+ ---
52
+ *For technical implementation details, see `.mindforge/dashboard/dashboard-spec.md`.*
@@ -0,0 +1,43 @@
1
+ # MindForge Publishing Guide
2
+
3
+ This guide outlines the standard procedure for publishing a new version of `mindforge-cc` and its associated SDK to npm. Following this process ensures stability, correct versioning, and structural integrity.
4
+
5
+ ## Prerequisites
6
+
7
+ 1. **NPM Permissions**: You must have publish access to the `mindforge-cc` and `@mindforge/sdk` packages.
8
+ 2. **Clean State**: Ensure all changes are committed and your working directory is clean.
9
+ 3. **Authentication**: Run `npm whoami` to verify you are logged into the correct account.
10
+
11
+ ## Step-by-Step Workflow
12
+
13
+ ### 1. Pre-Flight Verification & Adversarial Review
14
+ Before any release, ensure the following is completed:
15
+
16
+ - **Structural Integrity**: Run `npm test` to verify layout and command mirroring.
17
+ - **Security Check**: Run `/mindforge:security-scan` to ensure no keys or CVEs are present.
18
+ - **Mult-Model Review**: Run `/mindforge:cross-review` to have multiple models (Claude, GPT, Gemini) audit the new features for edge cases.
19
+
20
+ ### 2. Versioning Strategy
21
+ MindForge follows SemVer. Update `package.json` and `CHANGELOG.md` first.
22
+
23
+ ### 3. Automated Release Workflow
24
+ MindForge provides a built-in workflow to handle the heavy lifting:
25
+
26
+ 1. Run the slash command: `/publish-release`
27
+ 2. Follow the interactive prompts to execute tests and dry runs.
28
+
29
+ ### 4. Manual Publishing (Fallback)
30
+ If the workflow is unavailable:
31
+
32
+ ```bash
33
+ npm publish --tag alpha --access public
34
+ ```
35
+
36
+ ### 5. Git Tagging & Origin Sync
37
+ ```bash
38
+ git tag v[version]
39
+ git push origin --tags
40
+ ```
41
+
42
+ ---
43
+ *Last Updated: 2026-03-22*