mindforge-cc 4.3.0 → 5.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 (150) hide show
  1. package/.agent/CLAUDE.md +14 -12
  2. package/.agent/hooks/mindforge-session-init_extended.js +42 -0
  3. package/.agent/settings.json +4 -0
  4. package/.agent/skills/mindforge-brainstorming/SKILL.md +164 -0
  5. package/.agent/skills/mindforge-brainstorming/scripts/frame-template.html +214 -0
  6. package/.agent/skills/mindforge-brainstorming/scripts/helper.js +88 -0
  7. package/.agent/skills/mindforge-brainstorming/scripts/server.cjs +354 -0
  8. package/.agent/skills/mindforge-brainstorming/scripts/start-server.sh +148 -0
  9. package/.agent/skills/mindforge-brainstorming/scripts/stop-server.sh +56 -0
  10. package/.agent/skills/mindforge-brainstorming/spec-document-reviewer-prompt.md +49 -0
  11. package/.agent/skills/mindforge-brainstorming/visual-companion.md +287 -0
  12. package/.agent/skills/mindforge-debug_extended/CREATION-LOG.md +119 -0
  13. package/.agent/skills/mindforge-debug_extended/SKILL.md +296 -0
  14. package/.agent/skills/mindforge-debug_extended/condition-based-waiting-example.ts +158 -0
  15. package/.agent/skills/mindforge-debug_extended/condition-based-waiting.md +115 -0
  16. package/.agent/skills/mindforge-debug_extended/defense-in-depth.md +122 -0
  17. package/.agent/skills/mindforge-debug_extended/find-polluter.sh +63 -0
  18. package/.agent/skills/mindforge-debug_extended/root-cause-tracing.md +169 -0
  19. package/.agent/skills/mindforge-debug_extended/test-academic.md +14 -0
  20. package/.agent/skills/mindforge-debug_extended/test-pressure-1.md +58 -0
  21. package/.agent/skills/mindforge-debug_extended/test-pressure-2.md +68 -0
  22. package/.agent/skills/mindforge-debug_extended/test-pressure-3.md +69 -0
  23. package/.agent/skills/mindforge-execute-phase_extended/SKILL.md +70 -0
  24. package/.agent/skills/mindforge-neural-orchestrator/SKILL.md +115 -0
  25. package/.agent/skills/mindforge-neural-orchestrator/references/codex-tools.md +100 -0
  26. package/.agent/skills/mindforge-neural-orchestrator/references/gemini-tools.md +33 -0
  27. package/.agent/skills/mindforge-parallel-mesh_extended/SKILL.md +182 -0
  28. package/.agent/skills/mindforge-plan-phase_extended/SKILL.md +152 -0
  29. package/.agent/skills/mindforge-plan-phase_extended/plan-document-reviewer-prompt.md +49 -0
  30. package/.agent/skills/mindforge-review-inbound/SKILL.md +213 -0
  31. package/.agent/skills/mindforge-review-request/SKILL.md +105 -0
  32. package/.agent/skills/mindforge-review-request/code-reviewer.md +146 -0
  33. package/.agent/skills/mindforge-ship_extended/SKILL.md +200 -0
  34. package/.agent/skills/mindforge-skill-creation/SKILL.md +655 -0
  35. package/.agent/skills/mindforge-skill-creation/anthropic-best-practices.md +1150 -0
  36. package/.agent/skills/mindforge-skill-creation/examples/CLAUDE_MD_TESTING.md +189 -0
  37. package/.agent/skills/mindforge-skill-creation/graphviz-conventions.dot +172 -0
  38. package/.agent/skills/mindforge-skill-creation/persuasion-principles.md +187 -0
  39. package/.agent/skills/mindforge-skill-creation/render-graphs.js +168 -0
  40. package/.agent/skills/mindforge-skill-creation/testing-skills-with-subagents.md +384 -0
  41. package/.agent/skills/mindforge-swarm-execution/SKILL.md +277 -0
  42. package/.agent/skills/mindforge-swarm-execution/code-quality-reviewer-prompt.md +26 -0
  43. package/.agent/skills/mindforge-swarm-execution/implementer-prompt.md +113 -0
  44. package/.agent/skills/mindforge-swarm-execution/spec-reviewer-prompt.md +61 -0
  45. package/.agent/skills/mindforge-tdd_extended/SKILL.md +371 -0
  46. package/.agent/skills/mindforge-tdd_extended/testing-anti-patterns.md +299 -0
  47. package/.agent/skills/mindforge-verify-work_extended/SKILL.md +139 -0
  48. package/.agent/skills/mindforge-workspace-isolated/SKILL.md +218 -0
  49. package/.agent/workflows/mindforge-verify-work.md +5 -0
  50. package/.agent/workflows/mindforge:brainstorming.md +16 -0
  51. package/.agent/workflows/mindforge:debug.md +4 -2
  52. package/.agent/workflows/mindforge:execute-phase.md +12 -0
  53. package/.agent/workflows/mindforge:plan-phase.md +11 -0
  54. package/.agent/workflows/mindforge:ship.md +6 -1
  55. package/.agent/workflows/mindforge:tdd.md +7 -2
  56. package/.mindforge/engine/nexus-tracer.js +115 -0
  57. package/CHANGELOG.md +298 -122
  58. package/MINDFORGE.md +17 -9
  59. package/README.md +52 -100
  60. package/RELEASENOTES.md +23 -2
  61. package/bin/autonomous/auto-runner.js +154 -4
  62. package/bin/autonomous/context-refactorer.js +64 -0
  63. package/bin/autonomous/steer.js +19 -1
  64. package/bin/autonomous/stuck-monitor.js +43 -0
  65. package/bin/engine/handover-manager.js +69 -0
  66. package/bin/engine/nexus-tracer.js +67 -2
  67. package/bin/engine/sre-manager.js +63 -0
  68. package/bin/governance/policies/default-policies.jsonl +33 -0
  69. package/bin/governance/policy-engine.js +106 -0
  70. package/bin/governance/rbac-manager.js +109 -0
  71. package/bin/memory/eis-client.js +95 -0
  72. package/bin/memory/federated-sync.js +127 -0
  73. package/bin/memory/knowledge-graph.js +37 -0
  74. package/bin/models/cloud-broker.js +83 -0
  75. package/bin/models/model-broker.js +68 -49
  76. package/bin/skill-validator.js +41 -0
  77. package/docs/INTELLIGENCE-MESH.md +25 -22
  78. package/docs/PERSONAS.md +150 -2
  79. package/docs/architecture/PAR-ZTS-SURVEY.md +43 -0
  80. package/docs/architecture/README.md +31 -64
  81. package/docs/architecture/V5-ENTERPRISE.md +114 -0
  82. package/docs/commands-reference.md +20 -1
  83. package/docs/governance-guide.md +49 -28
  84. package/docs/security/SECURITY.md +9 -7
  85. package/docs/troubleshooting.md +24 -4
  86. package/docs/user-guide.md +61 -17
  87. package/docs/usp-features.md +3 -0
  88. package/package.json +1 -1
  89. /package/docs/{context → Context}/Master-Context.md +0 -0
  90. /package/docs/{references → References}/audit-events.md +0 -0
  91. /package/docs/{references → References}/checkpoints.md +0 -0
  92. /package/docs/{references → References}/commands.md +0 -0
  93. /package/docs/{references → References}/config-reference.md +0 -0
  94. /package/docs/{references → References}/continuation-format.md +0 -0
  95. /package/docs/{references → References}/decimal-phase-calculation.md +0 -0
  96. /package/docs/{references → References}/git-integration.md +0 -0
  97. /package/docs/{references → References}/git-planning-commit.md +0 -0
  98. /package/docs/{references → References}/model-profile-resolution.md +0 -0
  99. /package/docs/{references → References}/model-profiles.md +0 -0
  100. /package/docs/{references → References}/phase-argument-parsing.md +0 -0
  101. /package/docs/{references → References}/planning-config.md +0 -0
  102. /package/docs/{references → References}/questioning.md +0 -0
  103. /package/docs/{references → References}/sdk-api.md +0 -0
  104. /package/docs/{references → References}/skills-api.md +0 -0
  105. /package/docs/{references → References}/tdd.md +0 -0
  106. /package/docs/{references → References}/ui-brand.md +0 -0
  107. /package/docs/{references → References}/user-profiling.md +0 -0
  108. /package/docs/{references → References}/verification-patterns.md +0 -0
  109. /package/docs/{references → References}/workstream-flag.md +0 -0
  110. /package/docs/{templates → Templates}/Agents/CLAUDE-MD.md +0 -0
  111. /package/docs/{templates → Templates}/Agents/COPILOT-INSTRUCTIONS.md +0 -0
  112. /package/docs/{templates → Templates}/Agents/DEBUGGER-PROMPT.md +0 -0
  113. /package/docs/{templates → Templates}/Agents/PLANNER-PROMPT.md +0 -0
  114. /package/docs/{templates/codebase → Templates/Codebase}/architecture.md +0 -0
  115. /package/docs/{templates/codebase → Templates/Codebase}/concerns.md +0 -0
  116. /package/docs/{templates/codebase → Templates/Codebase}/conventions.md +0 -0
  117. /package/docs/{templates/codebase → Templates/Codebase}/integrations.md +0 -0
  118. /package/docs/{templates/codebase → Templates/Codebase}/stack.md +0 -0
  119. /package/docs/{templates/codebase → Templates/Codebase}/structure.md +0 -0
  120. /package/docs/{templates/codebase → Templates/Codebase}/testing.md +0 -0
  121. /package/docs/{templates → Templates}/Execution/CONTINUE-HERE.md +0 -0
  122. /package/docs/{templates → Templates}/Execution/DISCUSSION-LOG.md +0 -0
  123. /package/docs/{templates → Templates}/Execution/PHASE-PROMPT.md +0 -0
  124. /package/docs/{templates → Templates}/Execution/STATE.md +0 -0
  125. /package/docs/{templates → Templates}/Execution/SUMMARY-COMPLEX.md +0 -0
  126. /package/docs/{templates → Templates}/Execution/SUMMARY-MINIMAL.md +0 -0
  127. /package/docs/{templates → Templates}/Execution/SUMMARY-STANDARD.md +0 -0
  128. /package/docs/{templates → Templates}/Execution/SUMMARY.md +0 -0
  129. /package/docs/{templates → Templates}/Profile/DEV-PREFERENCES.md +0 -0
  130. /package/docs/{templates → Templates}/Profile/USER-PROFILE.md +0 -0
  131. /package/docs/{templates → Templates}/Profile/USER-SETUP.md +0 -0
  132. /package/docs/{templates → Templates}/Project/DISCOVERY.md +0 -0
  133. /package/docs/{templates → Templates}/Project/MILESTONE-ARCHIVE.md +0 -0
  134. /package/docs/{templates → Templates}/Project/MILESTONE.md +0 -0
  135. /package/docs/{templates → Templates}/Project/PROJECT.md +0 -0
  136. /package/docs/{templates → Templates}/Project/REQUIREMENTS.md +0 -0
  137. /package/docs/{templates → Templates}/Project/RETROSPECTIVE.md +0 -0
  138. /package/docs/{templates → Templates}/Project/ROADMAP.md +0 -0
  139. /package/docs/{templates → Templates}/Quality/DEBUG.md +0 -0
  140. /package/docs/{templates → Templates}/Quality/UAT.md +0 -0
  141. /package/docs/{templates → Templates}/Quality/UI-SPEC.md +0 -0
  142. /package/docs/{templates → Templates}/Quality/VALIDATION.md +0 -0
  143. /package/docs/{templates → Templates}/Quality/VERIFICATION-REPORT.md +0 -0
  144. /package/docs/{templates/research → Templates/Research}/ARCHITECTURE.md +0 -0
  145. /package/docs/{templates/research → Templates/Research}/FEATURES.md +0 -0
  146. /package/docs/{templates/research → Templates/Research}/PITFALLS.md +0 -0
  147. /package/docs/{templates/research → Templates/Research}/STACK.md +0 -0
  148. /package/docs/{templates/research → Templates/Research}/SUMMARY.md +0 -0
  149. /package/docs/{templates → Templates}/System/CONFIG.json +0 -0
  150. /package/docs/{templates → Templates}/System/CONTEXT.md +0 -0
package/MINDFORGE.md CHANGED
@@ -1,12 +1,12 @@
1
- # MINDFORGE.md — Parameter Registry (v4.1.0-alpha.nexus)
1
+ # MINDFORGE.md — Parameter Registry (v5.1.0-beast)
2
2
 
3
3
  ## 1. IDENTITY & VERSIONING
4
4
 
5
5
  [NAME] = MindForge
6
- [VERSION] = 4.2.0-alpha.ztai
7
- [STABLE] = false
8
- [MODE] = "Zero-Trust Identity"
9
- [REQUIRED_CORE_VERSION] = 4.2.0
6
+ [VERSION] = 5.1.0
7
+ [STABLE] = true
8
+ [MODE] = "Zero-Trust Agentic Hub"
9
+ [REQUIRED_CORE_VERSION] = 5.1.0
10
10
 
11
11
  ## 2. INTELLIGENCE TOGGLES (V4 UPDATES)
12
12
 
@@ -28,7 +28,8 @@
28
28
 
29
29
  ## 3. MODEL TOPOLOGY
30
30
 
31
- # Persona to Model mapping
31
+ ### Persona to Model mapping
32
+
32
33
  [PLANNER] = claude-opus-4-5
33
34
  [EXECUTOR] = claude-sonnet-4-5
34
35
  [REVIEWER] = claude-sonnet-4-5
@@ -42,7 +43,8 @@
42
43
 
43
44
  ## 4. GOVERNANCE & ECONOMICS
44
45
 
45
- # Limits and safety gates
46
+ ### Limits and safety gates
47
+
46
48
  [COST_WARN_USD] = 2.00
47
49
  [COST_HARD_LIMIT_USD] = 25.00
48
50
  [ADS_DEBATE_ROUNDS] = 2
@@ -54,7 +56,8 @@
54
56
 
55
57
  ## 5. RESOURCE GEOMETRY
56
58
 
57
- # Paths and ports
59
+ ### Paths and ports
60
+
58
61
  [BROWSER_PORT] = 7338
59
62
  [DASHBOARD_PORT] = 7339
60
63
  [API_URL] = <http://localhost:3000>
@@ -64,16 +67,21 @@
64
67
 
65
68
  ## 6. PROJECT CONSTRAINTS
66
69
 
67
- # Static rules for the agent
70
+ ### Static rules for the agent
71
+
68
72
  [FORBIDDEN] = """
73
+
69
74
  - No direct DB access from frontend
70
75
  - No synchronous I/O in API handlers
71
76
  - No console.log in production services
72
77
  - No TODO comments in committed code
78
+
73
79
  """
74
80
 
75
81
  [INSTRUCTIONS] = """
82
+
76
83
  - Check packages/shared before creating utilities.
77
84
  - Backend middleware follows Fastify conventions.
78
85
  - Date manipulation using date-fns only.
86
+
79
87
  """
package/README.md CHANGED
@@ -1,17 +1,32 @@
1
- # MindForge — Enterprise Agentic Framework (v4.2.5)
1
+ # MindForge v5.1.0 The Beast AdditionFramework (v5.1.0)
2
2
 
3
- MindForge turns Claude Code and Antigravity into production-grade engineering
4
- partners with governance, observability, and a reactive autonomous intelligence engine.
5
- Release published: v4.1.0-alpha.nexus.
3
+ MindForge turns AI coding agents into production-grade engineering partners with governance, multi-cloud resilience, and a non-bypassable Sovereign Reason Enclave.
4
+ Release published: v5.1.0-PRO.
5
+
6
+ ## Installation & Setup
7
+
8
+ ### 🚀 Quick Start (No Install)
9
+
10
+ Run MindForge immediately for a specific runtime without a permanent installation:
6
11
 
7
- # Install
8
12
  ```bash
9
- npx mindforge-cc@v4-alpha
13
+ npx mindforge-cc@latest --claude --global
10
14
  ```
11
15
 
12
- # Install V4 (Experimental)
16
+ ### 🌍 Global Installation
17
+
18
+ Enable system-wide `/mindforge` commands for your primary AI coding runtime:
19
+
13
20
  ```bash
14
- npm install -g mindforge-cc@v4-alpha
21
+ npm install -g mindforge-cc@latest
22
+ ```
23
+
24
+ ### 📂 Local Project Setup
25
+
26
+ Initialize MindForge in an existing repository with specialized agent identities:
27
+
28
+ ```bash
29
+ npx mindforge-cc@latest --claude --local
15
30
  ```
16
31
 
17
32
  ---
@@ -21,10 +36,14 @@ npm install -g mindforge-cc@v4-alpha
21
36
  AI coding agents degrade over long sessions. Context fills up. Quality drops.
22
37
  Decisions get forgotten. MindForge fixes that with:
23
38
 
24
- - **MindForge Nexus (v4.1)** — High-fidelity **ART** (Agentic Reasoning Tracing) for the agentic mesh
25
- - **Dynamic Swarm Orchestration (v4)** — parallel "Agentic Mesh" with shared state (v4)
26
- - **Zero-Trust Identity (v4.2)** — DID-signed non-repudiable audit logs with HSM/Enclave support (v4.2.5)
27
- - **Global Intelligence Mesh (v4.2)** — Cross-repo knowledge sharing and Ghost Pattern Detection (v4.2.5)
39
+ - **Multi-Cloud Arbitrage (v5.0)** — Dynamic routing and provider hedging with low-latency arbitrage.
40
+ - **Sovereign Reason Enclave (v5.0)** — TEE-simulated reasoning isolation and sanitization for confidential workloads.
41
+ - **Human-Agent Handover (v5.0)** — Nexus State Bundles and mid-wave steering injection.
42
+ - **Autonomous FinOps (v4.3)** — Dynamic **C2C** (Confidence-to-Cost) routing and Agentic ROI tracking.
43
+ - **Proactive Equilibrium (v4.3)** — Real-time **Wave Divergence** monitoring and autonomous state recovery.
44
+ - **MindForge Nexus (v4.1)** — High-fidelity **ART** (Agentic Reasoning Tracing).
45
+ - **Zero-Trust Identity (v4.2)** — DID-signed non-repudiable audit logs with HSM/Enclave support.
46
+ - **Global Intelligence Mesh (v4.2)** — Cross-repo knowledge sharing and Ghost Pattern Detection.
28
47
  - **Context Sharding (v3)** — relevance-dense memory management (40% token savings)
29
48
  - **Adversarial Synthesis (v3)** — zero-drift logic through red/blue model debate
30
49
  - **Temporal Vision (v3)** — full history scrubbing and hindsight state repair
@@ -46,94 +65,22 @@ Decisions get forgotten. MindForge fixes that with:
46
65
  ---
47
66
 
48
67
 
49
- ## Install
68
+ ## 🛠️ Configuration & Runtimes
50
69
 
51
- ### Claude Code (global)
52
-
53
- ```bash
54
- npx mindforge-cc@latest --claude --global
55
- ```
70
+ MindForge adapts to your existing engineering environment via runtime flags:
56
71
 
72
+ | Runtime | Global Command | Local Setup |
73
+ | :--- | :--- | :--- |
74
+ | **Claude Code** | `mindforge-cc --claude --global` | `mindforge-cc --claude --local` |
75
+ | **Antigravity** | `mindforge-cc --antigravity --global` | `mindforge-cc --antigravity --local` |
76
+ | **Cursor** | `mindforge-cc --cursor --global` | `mindforge-cc --cursor --local` |
77
+ | **GitHub Copilot** | `mindforge-cc --copilot --global` | `mindforge-cc --copilot --local` |
78
+ | **Gemini CLI** | `mindforge-cc --gemini --global` | `mindforge-cc --gemini --local` |
57
79
 
58
- ### Claude Code (local)
59
-
60
- ```bash
61
- npx mindforge-cc@latest --claude --local
62
- ```
63
-
64
- ### Quick Start
65
-
66
- ```bash
67
- # Install the latest stable version
68
- npm install -g mindforge-cc
69
-
70
- # Or try the v2.0.0-alpha (latest features)
71
- npm install -g mindforge-cc@alpha
72
-
73
- # Or try the V3 Release (latest features)
74
- npm install -g mindforge-cc@latest
75
- ```
76
-
77
-
78
- ### Antigravity
79
-
80
- ```bash
81
- npx mindforge-cc@latest --antigravity --global
82
- ```
83
-
84
- Local installs use `agents/` by default. Legacy `.agent/` is supported for existing projects.
85
-
86
- Optional: add bin utilities on local install
87
- ```bash
88
- npx mindforge-cc@latest --claude --local --with-utils
89
- ```
90
-
91
- Optional: minimal project scaffolding
92
- ```bash
93
- npx mindforge-cc@latest --claude --local --minimal
94
- ```
95
-
96
-
97
- ### Cursor
98
-
99
- ```bash
100
- npx mindforge-cc@latest --cursor --local
101
- ```
102
-
103
-
104
- ### Gemini CLI
105
-
106
- ```bash
107
- npx mindforge-cc@latest --gemini --global
108
- ```
109
-
110
-
111
- ### GitHub Copilot
112
-
113
- ```bash
114
- npx mindforge-cc@latest --copilot --local
115
- ```
116
-
117
-
118
- ### OpenCode
119
-
120
- ```bash
121
- npx mindforge-cc@latest --opencode --global
122
- ```
123
-
124
-
125
- ### Specific Runtime (Universal)
126
-
127
- ```bash
128
- npx mindforge-cc@latest --runtime <name>
129
- ```
130
-
131
-
132
- ### Multiple runtimes
133
-
134
- ```bash
135
- npx mindforge-cc@latest --runtime claude,cursor --local
136
- ```
80
+ ### Advanced Setup Options
81
+ - **Combined Runtimes**: `mindforge-cc --runtime claude,cursor --local`
82
+ - **With Utilities**: `mindforge-cc --local --with-utils` (Installs specialized bin scripts)
83
+ - **Minimalist**: `mindforge-cc --local --minimal` (Only basic protocols, no persona library)
137
84
 
138
85
  ---
139
86
 
@@ -345,11 +292,16 @@ See `.mindforge/production/token-optimiser.md`.
345
292
 
346
293
  ---
347
294
 
348
- ---
295
+ ## What's new in v4.3 (Enterprise Mesh & Equilibrium)
349
296
 
350
- ---
297
+ MindForge V4.3 matures the framework for enterprise mission-critical environments.
298
+
299
+ - **Autonomous FinOps Hub**: Automated budget enforcement and dynamic model selection based on task complexity (C2C).
300
+ - **Proactive Equilibrium**: Real-time divergence detection (Wave Monitoring) and autonomous repair loops.
301
+ - **Structural Reorganization**: Production-grade `bin/` directory architecture for all core implementation logic.
302
+ - **Enhanced ZTAI**: Asymmetric cryptographic signatures for all and simulated HSM support.
351
303
 
352
- ## What's new in v4.2 (Intelligence Mesh)
304
+ ## What's new in v4.2 (Identity & Memory)
353
305
 
354
306
  MindForge V4.2 focuses on **Identity** and **Memory** within the agentic swarm.
355
307
 
package/RELEASENOTES.md CHANGED
@@ -1,7 +1,28 @@
1
- # MindForge v4.3.0 — Enterprise Mesh & Proactive Equilibrium
1
+ # MindForge v5.1.0 — The Beast Addition
2
+ ## Top Summary
3
+ The v5.1.0 release integrates 14 advanced agentic protocols and high-performance session hooks, sanitizing and hardening them for the MindForge ecosystem.
4
+
5
+ ## Highlights
6
+ - **14 Advanced Protocols**: Ported from the Superpowers framework (Brainstorming, Swarm Execution, Parallel Mesh, etc.).
7
+ - **Native Session Initializer**: replaces legacy bash hooks with high-performance Node.js startup logic.
8
+ - **Workflow Step 0 Participation**: Core commands now mandate protocol activation for maximum tactical rigor.
9
+ - **Full Sanitization**: 100% elimination of external branding across all registries.
10
+
11
+ ---
2
12
 
13
+ # MindForge v5.0.0 — Enterprise Pillars V, VI, VII
3
14
  ## Top Summary
4
- MindForge v4.3.0 introduces the **Enterprise Intelligence Mesh**, finalizing the v4 roadmap with autonomous FinOps and self-healing reliability. This release also implements **ZTAI Beast Mode**, hardens agentic identity with asymmetric cryptographic signing, and introduces simulated Secure Enclaves (HSM) for Tier 3 principal agents.
15
+ The v5.0.0 release completes the MindForge Enterprise architecture with the final three pillars: Multi-Cloud Arbitrage, Sovereign Reason Enclaves (SRE), and Dynamic Human-Agent Handover (DHH).
16
+
17
+ ## Highlights
18
+ - **Pillar V: Multi-Cloud Arbitrage**: Intelligent routing across Vertex AI, Bedrock, and Azure.
19
+ - **Pillar VI: Sovereign Reason Enclaves (SRE)**: Simulated TEE-based reasoning isolation.
20
+ - **Pillar VII: Dynamic Human-Agent Handover (DHH)**: Automated packaging of "Nexus State Bundles" for human review.
21
+ - **Hardening: Beast Mode Phase 2**: Built-in Chaos Mode for provider reliability stress-testing.
22
+
23
+ ---
24
+
25
+ # MindForge v4.3.0 — Enterprise Mesh & Proactive Equilibrium
5
26
 
6
27
  ## Highlights
7
28
 
@@ -11,18 +11,34 @@ const stuckMonitor = require('./stuck-monitor');
11
11
  const steeringManager = require('./steer');
12
12
  const progressStream = require('./progress-stream');
13
13
  const headlessAdapter = require('./headless');
14
+ const ContextRefactorer = require('./context-refactorer');
14
15
  const KnowledgeCapture = require('../memory/knowledge-capture');
15
16
  const TemporalHub = require('../engine/temporal-hub');
16
17
  const crypto = require('crypto');
17
18
 
19
+ // MindForge v5 Core Modules
20
+ const PolicyEngine = require('../governance/policy-engine');
21
+ const RBACManager = require('../governance/rbac-manager');
22
+ const ZTAIManager = require('../governance/ztai-manager');
23
+ const HandoverManager = require('../engine/handover-manager');
24
+
18
25
  class AutoRunner {
19
26
  constructor(options = {}) {
20
27
  this.phase = options.phase;
21
28
  this.isHeadless = options.headless || false;
22
- this.auditPath = path.join(process.cwd(), '.planning/AUDIT.jsonl');
23
- this.statePath = path.join(process.cwd(), '.planning/auto-state.json');
29
+ this.auditPath = path.join(process.cwd(), '.planning', 'AUDIT.jsonl');
30
+ this.statePath = path.join(process.cwd(), '.planning', 'auto-state.json');
24
31
  this.monitor = new stuckMonitor(this.auditPath);
25
32
  this.isPaused = false;
33
+ this.handoverManager = new HandoverManager();
34
+
35
+ // v5 Governance Initialization
36
+ this.policyEngine = new PolicyEngine();
37
+ this.rbacManager = new RBACManager();
38
+
39
+ // v5 PAR Initialization
40
+ this.refactorer = new ContextRefactorer();
41
+ this.c2cThreshold = 0.65;
26
42
  }
27
43
 
28
44
  async run() {
@@ -38,10 +54,33 @@ class AutoRunner {
38
54
  // 2. Main Wave Loop
39
55
  while (await this.hasNextWave()) {
40
56
  if (this.isPaused) break;
57
+
58
+ // Pillar 2 (APO): Pre-execution Policy Check
59
+ const permit = await this.evaluateWavePolicy();
60
+ if (!permit) {
61
+ console.error('🛑 POLICY VIOLATION: Execution aborted by Agentic Policy Orchestrator.');
62
+ this.writeAudit({ event: 'auto_mode_denied', reason: 'Policy violation detected' });
63
+ break;
64
+ }
65
+
66
+ // Pillar 3 (PAR): Confidence-to-Cost Arbitrage
67
+ const isReliable = await this.checkArbitrage();
68
+ if (!isReliable) {
69
+ console.warn('⚠️ PAR ARBITRAGE: Confidence-to-Cost ratio below threshold. Escalating to human.');
70
+ this.writeAudit({ event: 'auto_mode_escalated', reason: 'Low C2C ratio' });
71
+ break;
72
+ }
73
+
74
+ // Pillar 3 (PAR): Context Density Refactoring
75
+ await this.checkContextDensity();
76
+
77
+ // Pillar 7 (DHH): Check for Human Steering
78
+ await this.checkHumanSteering(isReliable);
79
+
41
80
  await this.executeWave();
42
81
  }
43
82
 
44
- this.complete();
83
+ await this.complete();
45
84
  }
46
85
 
47
86
  runPreFlight() {
@@ -65,11 +104,20 @@ class AutoRunner {
65
104
  this.writeAudit({ event: 'auto_mode_paused', timestamp: new Date().toISOString() });
66
105
  }
67
106
 
68
- complete() {
107
+ async complete() {
69
108
  console.log('✅ Phase complete!');
70
109
  const report = progressStream.generateReport(this.auditPath, this.phase);
71
110
  fs.writeFileSync(path.join(process.cwd(), `.planning/phases/${this.phase}/AUTONOMOUS-REPORT.md`), report);
72
111
 
112
+ // v5 Pillar 1: Federated Intelligence Mesh (FIM)
113
+ try {
114
+ const { runSync } = require('../memory/federated-sync');
115
+ console.log('🔄 Finalizing organizational intelligence sync...');
116
+ await runSync();
117
+ } catch (err) {
118
+ console.warn('⚠️ Federated Sync failed at phase end:', err.message);
119
+ }
120
+
73
121
  // Auto-capture knowledge from completed phase (ADRs, findings)
74
122
  try {
75
123
  const captured = KnowledgeCapture.captureFromPhaseCompletion(this.phase);
@@ -125,6 +173,108 @@ class AutoRunner {
125
173
  Object.assign(state, update);
126
174
  fs.writeFileSync(this.statePath, JSON.stringify(state, null, 2));
127
175
  }
176
+
177
+ /**
178
+ * Evaluates the policy for the next wave's intent. (v5 APO - HARDENED)
179
+ */
180
+ async evaluateWavePolicy() {
181
+ // [HARDEN] Dynamically derive intent from ZTAI identity and phase context
182
+ const manager = new ZTAIManager();
183
+ const identity = await manager.getIdentity();
184
+
185
+ const intent = {
186
+ did: identity.did,
187
+ action: 'process_phase_wave',
188
+ resource: `projects/${process.env.MF_PROJECT_ID || 'MF-ALPHA'}/phases/${this.phase}/*`,
189
+ tier: identity.tier || 1,
190
+ metadata: {
191
+ engine: 'Nimbus-S4',
192
+ mode: 'autonomous',
193
+ wave_timestamp: new Date().toISOString()
194
+ }
195
+ };
196
+
197
+ const result = this.policyEngine.evaluate(intent);
198
+
199
+ if (result.verdict === 'DENY') {
200
+ console.warn(`[APO-DENY] Intent rejected: ${result.reason} [ReqID: ${result.requestId}]`);
201
+ return false;
202
+ }
203
+
204
+ console.log(`[APO-PERMIT] Intent approved: ${result.reason} [ReqID: ${result.requestId}]`);
205
+ return true;
206
+ }
207
+
208
+ /**
209
+ * Predictive Agentic Reliability (PAR) - C2C Arbitrage
210
+ */
211
+ async checkArbitrage() {
212
+ // Simulated C2C calculation based on recent wave success rate
213
+ const events = this.getRecentAuditEvents(10);
214
+ const successCount = events.filter(e => e.status === 'success' || e.event === 'task_completed').length;
215
+
216
+ // Confidence = SuccessRate * 0.8 + 0.2
217
+ const confidence = (successCount / Math.max(events.length, 1)) * 0.8 + 0.2;
218
+ const estimatedCost = 0.5; // Placeholder for token cost estimation
219
+
220
+ const c2c = confidence / estimatedCost;
221
+ console.log(`[PAR-C2C] Confidence: ${confidence.toFixed(2)}, Cost: ${estimatedCost.toFixed(2)}, Ratio: ${c2c.toFixed(2)}`);
222
+
223
+ return c2c >= this.c2cThreshold;
224
+ }
225
+
226
+ /**
227
+ * Predictive Agentic Reliability (PAR) - Context Refactoring
228
+ */
229
+ async checkContextDensity() {
230
+ const events = this.getRecentAuditEvents(20);
231
+ const analysis = this.refactorer.analyzeDensity(events);
232
+
233
+ if (analysis.shouldRefactor) {
234
+ console.log(`[PAR-REFACTOR] Context density low (${analysis.density}). Triggering proactive refactor.`);
235
+ const refactorEvent = this.refactorer.generateRefactorPlan(events, this.phase);
236
+ this.writeAudit(refactorEvent);
237
+
238
+ // In a real implementation, this would trigger a system_handoff summarization
239
+ // For now, we log it to the audit stream for the agent to action
240
+ }
241
+ }
242
+
243
+ async checkHumanSteering(isReliable) {
244
+ if (!isReliable) {
245
+ console.log('[DHH-AUTO] Low reliability detected. Packaging Nexus State Bundle for human review...');
246
+ const events = this.getRecentAuditEvents(20);
247
+ const bundlePath = this.handoverManager.createNexusBundle({
248
+ phase: this.phase,
249
+ wave: 'active',
250
+ recentEvents: events,
251
+ reasoningTrace: 'Reasoning isolated in SRE.'
252
+ });
253
+
254
+ this.writeAudit({
255
+ event: 'human_handover_requested',
256
+ bundle: bundlePath,
257
+ timestamp: new Date().toISOString()
258
+ });
259
+ }
260
+
261
+ // Check for mid-wave steering instructions if available
262
+ const steerPath = path.join(process.cwd(), '.planning', 'STEER.json');
263
+ if (fs.existsSync(steerPath)) {
264
+ const instructions = fs.readFileSync(steerPath, 'utf8').trim().split('\n');
265
+ if (instructions.length > 0) {
266
+ console.log(`[DHH-STEER] Processing ${instructions.length} injected human instructions...`);
267
+ // Real implementation would inject these into the agent's task list
268
+ fs.unlinkSync(steerPath); // Clear handled instructions
269
+ }
270
+ }
271
+ }
272
+
273
+ getRecentAuditEvents(count) {
274
+ if (!fs.existsSync(this.auditPath)) return [];
275
+ const lines = fs.readFileSync(this.auditPath, 'utf8').trim().split('\n');
276
+ return lines.slice(-count).map(l => JSON.parse(l));
277
+ }
128
278
  }
129
279
 
130
280
  module.exports = AutoRunner;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * MindForge — Context Refactorer Engine (v5.0.0-PAR)
3
+ * Monitors context density and triggers proactive summarization/refactoring.
4
+ */
5
+ 'use strict';
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+
10
+ class ContextRefactorer {
11
+ constructor(options = {}) {
12
+ this.threshold = options.threshold || 0.3; // Min density before refactor
13
+ this.windowSize = options.windowSize || 20;
14
+ this.history = [];
15
+ }
16
+
17
+ /**
18
+ * Analyze the current context density.
19
+ * Density = (Implementation Events) / (Total Events)
20
+ */
21
+ analyzeDensity(events) {
22
+ this.history = events.slice(-this.windowSize);
23
+
24
+ if (this.history.length < 5) return { density: 1.0, shouldRefactor: false };
25
+
26
+ const implementationEvents = this.history.filter(h =>
27
+ h.tool === 'run_command' ||
28
+ h.tool === 'replace_file_content' ||
29
+ h.tool === 'multi_replace_file_content' ||
30
+ h.event === 'task_completed'
31
+ );
32
+
33
+ const totalEvents = this.history.length;
34
+ const density = implementationEvents.length / totalEvents;
35
+
36
+ return {
37
+ density: parseFloat(density.toFixed(2)),
38
+ shouldRefactor: density < this.threshold
39
+ };
40
+ }
41
+
42
+ /**
43
+ * Generates a "Context Refactor" recommendation.
44
+ */
45
+ generateRefactorPlan(events, phase) {
46
+ const reasoningChain = events
47
+ .filter(e => e.event === 'reasoning_trace')
48
+ .map(e => `- ${e.thought}`)
49
+ .join('\n');
50
+
51
+ return {
52
+ event: 'context_refactor_triggered',
53
+ phase,
54
+ message: 'Context density low. Initiating proactive refactoring.',
55
+ action: 'SUMMARIZE_AND_RESET',
56
+ payload: {
57
+ summary_prompt: `The current reasoning chain has become dense (${this.threshold}). Summarize the progress for Phase ${phase} and reset the active context window.`,
58
+ trace_sample: reasoningChain.slice(-500) // Last few thoughts for context
59
+ }
60
+ };
61
+ }
62
+ }
63
+
64
+ module.exports = ContextRefactorer;
@@ -64,8 +64,26 @@ function injectSteering(planContent, guidanceItems) {
64
64
  });
65
65
  }
66
66
 
67
+ /**
68
+ * Add human steering to the unified queue (v5 Pillar VII).
69
+ */
70
+ function pushHumanSteering(instruction, bundleId = 'none') {
71
+ const STEER_PATH = path.join(process.cwd(), '.planning', 'STEER.json');
72
+ const item = {
73
+ id: `human-${Date.now()}`,
74
+ timestamp: new Date().toISOString(),
75
+ bundle_id: bundleId,
76
+ type: 'HUMAN_OVERRIDE',
77
+ instruction,
78
+ priority: 'CRITICAL'
79
+ };
80
+ fs.appendFileSync(STEER_PATH, JSON.stringify(item) + '\n');
81
+ return item.id;
82
+ }
83
+
67
84
  module.exports = {
68
85
  pushGuidance,
69
86
  popGuidance,
70
- injectSteering
87
+ injectSteering,
88
+ pushHumanSteering
71
89
  };
@@ -26,9 +26,52 @@ class StuckMonitor {
26
26
  // Check S02: Command Loop (Identical failing commands)
27
27
  if (this.detectS02(event)) return { pattern: 'S02', message: 'Stuck in command loop: identical failing commands.' };
28
28
 
29
+ // Check S03: Semantic Mirroring (Reasoning Loop)
30
+ if (this.detectS03(event)) return { pattern: 'S03', message: 'Stuck in reasoning loop: semantic mirroring detected.' };
31
+
32
+ // Check S04: Infinite Decomposition (Planning Paradox)
33
+ if (this.detectS04(event)) return { pattern: 'S04', message: 'Stuck in planning paradox: infinite decomposition detected.' };
34
+
29
35
  return null;
30
36
  }
31
37
 
38
+ detectS03(event) {
39
+ if (event.event !== 'reasoning_trace') return false;
40
+
41
+ // Compare with the last 5 thoughts in history
42
+ const reflections = this.history.filter(h => h.event === 'reasoning_trace');
43
+ if (reflections.length < 3) return false;
44
+
45
+ const currentThought = event.thought;
46
+ const previousThoughts = reflections.slice(-4, -1);
47
+
48
+ const isMirroring = previousThoughts.some(p =>
49
+ this.isContentSimilar(p.thought, currentThought)
50
+ );
51
+
52
+ return isMirroring;
53
+ }
54
+
55
+ detectS04(event) {
56
+ if (event.event !== 'reasoning_trace') return false;
57
+
58
+ const decompositions = this.history.filter(h =>
59
+ h.event === 'reasoning_trace' &&
60
+ (h.thought?.toLowerCase().includes('break down') || h.thought?.toLowerCase().includes('sub-task'))
61
+ );
62
+
63
+ // If more than 4 consecutive decompositions without a command or edit
64
+ const lastActionIndex = this.history.findLastIndex(h =>
65
+ h.tool === 'run_command' || h.tool === 'replace_file_content' || h.tool === 'multi_replace_file_content'
66
+ );
67
+
68
+ const recentDecomps = decompositions.filter(d =>
69
+ this.history.indexOf(d) > lastActionIndex
70
+ );
71
+
72
+ return recentDecomps.length >= 4;
73
+ }
74
+
32
75
  detectS01(event) {
33
76
  if (event.tool !== 'multi_replace_file_content') return false;
34
77