mindforge-cc 3.0.0 → 4.3.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.
@@ -0,0 +1,110 @@
1
+ /**
2
+ * MindForge — ModelBroker (Pillar V: Autonomous FinOps Hub)
3
+ * Calculates C2C (Confidence-to-Cost) and routes tasks to optimal models.
4
+ */
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ class ModelBroker {
10
+ constructor(config = {}) {
11
+ this.projectRoot = config.projectRoot || process.cwd();
12
+ this.defaults = {
13
+ EXECUTOR_MODEL: 'claude-3-5-sonnet',
14
+ PLANNER_MODEL: 'claude-3-5-sonnet',
15
+ SECURITY_MODEL: 'claude-3-opus',
16
+ QA_MODEL: 'claude-3-5-sonnet',
17
+ RESEARCH_MODEL: 'claude-3-5-sonnet',
18
+ DEBUG_MODEL: 'claude-3-5-sonnet',
19
+ QUICK_MODEL: 'claude-3-haiku',
20
+ };
21
+ }
22
+
23
+ /**
24
+ * Resolves the optimal model for a given task.
25
+ * @param {Object} context - Task context (persona, difficulty, tier)
26
+ * @returns {Object} - Resolved model details (modelId, costTier, reasoning)
27
+ */
28
+ resolveModel(context) {
29
+ const { persona, difficulty, tier } = context;
30
+ let modelId = this.defaults.EXECUTOR_MODEL;
31
+ let reasoning = 'Default executor model.';
32
+
33
+ // 1. Check Security Tier (T3 requires premium models)
34
+ if (tier === 3) {
35
+ modelId = this.defaults.SECURITY_MODEL;
36
+ reasoning = 'Tier 3 (Principal) action requires high-trust model (Opus).';
37
+ return { modelId, costTier: 'high', reasoning };
38
+ }
39
+
40
+ // 2. Map Persona to Base Model
41
+ const personaMap = {
42
+ 'executor': 'EXECUTOR_MODEL',
43
+ 'planner': 'PLANNER_MODEL',
44
+ 'security-reviewer': 'SECURITY_MODEL',
45
+ 'qa-engineer': 'QA_MODEL',
46
+ 'researcher': 'RESEARCH_MODEL',
47
+ 'debug-specialist': 'DEBUG_MODEL',
48
+ };
49
+
50
+ if (personaMap[persona]) {
51
+ modelId = this.defaults[personaMap[persona]];
52
+ reasoning = `Routed to ${persona} specialist model.`;
53
+ }
54
+
55
+ // 3. Calculate C2C (Confidence-to-Cost)
56
+ // If difficulty is low (< 2.0), route to Quick Model (Haiku) to save costs.
57
+ if (difficulty < 2.0 && difficulty !== undefined) {
58
+ const originalModel = modelId;
59
+ modelId = this.defaults.QUICK_MODEL;
60
+ reasoning = `Low difficulty (${difficulty}) - C2C Optimization: Switched ${originalModel} to Haiku.`;
61
+ return { modelId, costTier: 'low', reasoning };
62
+ }
63
+
64
+ // 4. Handle Complex Tasks (Difficulty > 4.0)
65
+ if (difficulty > 4.0) {
66
+ modelId = this.defaults.SECURITY_MODEL; // Use Opus for high complexity
67
+ reasoning = `High difficulty (${difficulty}) - Complexity routing: Upgraded to Opus.`;
68
+ return { modelId, costTier: 'high', reasoning };
69
+ }
70
+
71
+ return { modelId, costTier: 'medium', reasoning };
72
+ }
73
+
74
+ /**
75
+ * Tracks the "Agentic ROI" for a completed task.
76
+ * @param {Object} report - Task execution report (tokens, duration, status)
77
+ */
78
+ trackROI(report) {
79
+ const roiPath = path.join(this.projectRoot, '.planning', 'ROI.jsonl');
80
+ const entry = {
81
+ timestamp: new Date().toISOString(),
82
+ planId: report.planId,
83
+ task: report.taskName,
84
+ model: report.modelId,
85
+ costTier: report.costTier,
86
+ inputTokens: report.inputTokens,
87
+ outputTokens: report.outputTokens,
88
+ durationMs: report.durationMs,
89
+ status: report.status,
90
+ goalAchieved: report.status === 'completed' ? 1 : 0,
91
+ estimatedCostUSD: this.estimateCost(report.modelId, report.inputTokens, report.outputTokens),
92
+ };
93
+
94
+ fs.appendFileSync(roiPath, JSON.stringify(entry) + '\n');
95
+ }
96
+
97
+ estimateCost(modelId, input, output) {
98
+ // Mock cost estimation logic per 1M tokens
99
+ const rates = {
100
+ 'claude-3-opus': { in: 15, out: 75 },
101
+ 'claude-3-5-sonnet': { in: 3, out: 15 },
102
+ 'claude-3-haiku': { in: 0.25, out: 1.25 },
103
+ };
104
+
105
+ const rate = rates[modelId] || rates['claude-3-5-sonnet'];
106
+ return (input / 1_000_000) * rate.in + (output / 1_000_000) * rate.out;
107
+ }
108
+ }
109
+
110
+ module.exports = ModelBroker;
@@ -0,0 +1,32 @@
1
+ # MindForge Global Intelligence Mesh (Memory)
2
+ v4.2.5 — Cross-Repository Knowledge Sharing
3
+
4
+ ## 1. Overview
5
+ The **Global Intelligence Mesh** elevates MindForge from a repository-local assistant to an organization-wide intelligence asset. It enables multiple projects to share architectural insights, past failure patterns ("Ghost Patterns"), and success-verified designs without manual intervention.
6
+
7
+ ## 2. Architecture
8
+ The mesh consists of two primary components residing in `.mindforge/memory/engine/`:
9
+
10
+ ### A. The Semantic Hub (`semantic-hub.js`)
11
+ - **Role:** Synchronizes local project memory with a global, repository-agnostic store located at `~/.mindforge/memory/global`.
12
+ - **Deduplication:** Uses cryptographic ID-based matching to ensure only unique observations are moved to the global hub.
13
+ - **Privacy:** Sync is opt-in for sensitive data, but architectural patterns and "failure context" are pushed by default to prevent organizational redundancy.
14
+
15
+ ### B. Ghost Pattern Detector (`ghost-pattern-detector.js`)
16
+ - **Role:** A proactive risk mitigation engine that scans incoming proposals against known "Ghost Patterns" (past failures from other projects).
17
+ - **Triggers:** Automatically invoked during the `plan` phase of any mission-critical task (Tier 2-3).
18
+ - **Risk Levels:**
19
+ - **CRITICAL:** High similarity with a past p0 security failure or environment leak.
20
+ - **HIGH:** Similarity with a performance regression or architectural anti-pattern.
21
+
22
+ ## 3. Workflow Hook
23
+ 1. **Capture:** When a task results in a significant learning, `mf-memory` flags it as a `decision` or `pattern`.
24
+ 2. **Push:** The `SemanticHub` periodically syncs these to the global store.
25
+ 3. **Pull/Scan:** When starting a new project or task, the `GhostPatternDetector` queries the global hub to check if the proposed approach has "ghosts" (failed elsewhere).
26
+
27
+ ## 4. Usage in Enterprise
28
+ - **Zero-Redundancy Research:** If one team spends 10k tokens researching a specific library integration, the resulting "Knowledge Item" is immediately available to every other project in the mesh.
29
+ - **Organization-Wide Self-Healing:** Security fixes in one repo become proactive warnings in all others.
30
+
31
+ ---
32
+ *Status: Foundation Implemented & Verified (v4.2.5)*
package/docs/PERSONAS.md CHANGED
@@ -35,6 +35,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
35
35
  | **Spawned by** | `/mindforge:init-project`, `/mindforge:plan-phase`, `/mindforge:agent analyst` |
36
36
  | **Tools** | Read, Write, Bash, Grep |
37
37
  | **Color** | `blue` |
38
+ | **Trust Tier** | `1` |
38
39
  | **Produces** | `.planning/REQUIREMENTS.md`, `.planning/PROJECT.md` |
39
40
 
40
41
  **Capabilities:**
@@ -53,6 +54,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
53
54
  | **Spawned by** | `/mindforge:plan-phase`, `/mindforge:agent architect` |
54
55
  | **Tools** | Read, Write, Bash, Grep, Glob |
55
56
  | **Color** | `purple` |
57
+ | **Trust Tier** | `3` |
56
58
  | **Produces** | `.planning/ARCHITECTURE.md`, `.planning/decisions/ADR-*.md` |
57
59
 
58
60
  **Capabilities:**
@@ -72,6 +74,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
72
74
  | **Spawned by** | `/mindforge:execute-phase`, `/mindforge:agent developer` |
73
75
  | **Tools** | Read, Write, Bash, Grep, Glob, CommandStatus, Context7 |
74
76
  | **Color** | `green` |
77
+ | **Trust Tier** | `2` |
75
78
  | **Produces** | Source code, Unit tests, Implementation Summaries |
76
79
 
77
80
  **Capabilities:**
@@ -90,6 +93,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
90
93
  | **Spawned by** | `/mindforge:verify-phase`, `/mindforge:agent qa-engineer` |
91
94
  | **Tools** | Read, Write, Bash, Grep, Glob, CommandStatus |
92
95
  | **Color** | `yellow` |
96
+ | **Trust Tier** | `2` |
93
97
  | **Produces** | `UAT.md`, `BUGS.md` |
94
98
 
95
99
  **Capabilities:**
@@ -109,6 +113,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
109
113
  | **Spawned by** | `/mindforge:security-scan`, `/mindforge:agent security-reviewer` |
110
114
  | **Tools** | Read, Write, Bash, Grep, Glob, CommandStatus |
111
115
  | **Color** | `red` |
116
+ | **Trust Tier** | `3` |
112
117
  | **Produces** | `SECURITY-REVIEW.md` |
113
118
 
114
119
  **Capabilities:**
@@ -181,6 +186,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
181
186
  | **Spawned by** | `/mindforge:research`, `/mindforge:agent research-agent` |
182
187
  | **Tools** | Read, Write, Bash, Grep, Glob, Browser, Context7 |
183
188
  | **Color** | `cyan` |
189
+ | **Trust Tier** | `1` |
184
190
  | **Produces** | `RESEARCH-NOTES-*.md` |
185
191
 
186
192
  **Capabilities:**
@@ -199,6 +205,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
199
205
  | **Spawned by** | `/mindforge:plan-phase`, `/mindforge:agent decision-architect` |
200
206
  | **Tools** | Read, Write, Bash, Grep, Glob |
201
207
  | **Color** | `purple` |
208
+ | **Trust Tier** | `3` |
202
209
  | **Produces** | `DECISION-*.md` |
203
210
 
204
211
  **Capabilities:**
@@ -218,6 +225,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
218
225
  | **Spawned by** | `/mindforge:release`, `/mindforge:agent release-manager` |
219
226
  | **Tools** | Read, Write, Bash, Grep, Glob, CommandStatus |
220
227
  | **Color** | `blue` |
228
+ | **Trust Tier** | `3` |
221
229
  | **Produces** | `CHANGELOG.md`, Git tags, Release Notes |
222
230
 
223
231
  **Capabilities:**
@@ -236,6 +244,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
236
244
  | **Spawned by** | `/mindforge:ship`, `/mindforge:agent tech-writer` |
237
245
  | **Tools** | Read, Write, Bash, Grep, Glob, Context7 |
238
246
  | **Color** | `cyan` |
247
+ | **Trust Tier** | `1` |
239
248
  | **Produces** | `README.md`, API Reference, Runbooks |
240
249
 
241
250
  **Capabilities:**
@@ -254,6 +263,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
254
263
  | **Spawned by** | `/mindforge:validate-phase`, `/mindforge:agent coverage-specialist` |
255
264
  | **Tools** | Read, Write, Bash, Grep, Glob, CommandStatus |
256
265
  | **Color** | `yellow` |
266
+ | **Trust Tier** | `2` |
257
267
  | **Produces** | `COVERAGE-AUDIT.md` |
258
268
 
259
269
  **Capabilities:**
@@ -272,6 +282,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
272
282
  | **Spawned by** | `/mindforge:research`, `/mindforge:agent advisor-researcher` |
273
283
  | **Tools** | Read, Write, Bash, Grep, Glob, Browser, Context7 |
274
284
  | **Color** | `cyan` |
285
+ | **Trust Tier** | `1` |
275
286
  | **Produces** | Comparison tables, Rationale documents |
276
287
 
277
288
  **Capabilities:**
@@ -290,6 +301,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
290
301
  | **Spawned by** | `/mindforge:init-project`, `/mindforge:agent project-researcher` |
291
302
  | **Tools** | Read, Write, Bash, Grep, Glob, Browser, Context7 |
292
303
  | **Color** | `purple` |
304
+ | **Trust Tier** | `1` |
293
305
  | **Produces** | `SUMMARY.md`, `STACK.md`, `ARCHITECTURE.md` |
294
306
 
295
307
  **Capabilities:**
@@ -308,6 +320,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
308
320
  | **Spawned by** | `/mindforge:research`, `/mindforge:agent research-synthesizer` |
309
321
  | **Tools** | Read, Write, Bash, Grep, Glob |
310
322
  | **Color** | `purple` |
323
+ | **Trust Tier** | `1` |
311
324
  | **Produces** | Integrated `SUMMARY.md` |
312
325
 
313
326
  **Capabilities:**
@@ -326,6 +339,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
326
339
  | **Spawned by** | `/mindforge:plan-phase`, `/mindforge:agent ui-researcher` |
327
340
  | **Tools** | Read, Write, Bash, Grep, Glob, Browser, Context7 |
328
341
  | **Color** | `#E879F9` |
342
+ | **Trust Tier** | `1` |
329
343
  | **Produces** | `UI-SPEC.md` |
330
344
 
331
345
  **Capabilities:**
@@ -344,6 +358,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
344
358
  | **Spawned by** | `/mindforge:plan-phase`, `/mindforge:agent phase-researcher` |
345
359
  | **Tools** | Read, Write, Bash, Grep, Glob, Context7 |
346
360
  | **Color** | `blue` |
361
+ | **Trust Tier** | `1` |
347
362
  | **Produces** | `RESEARCH.md` |
348
363
 
349
364
  **Capabilities:**
@@ -362,6 +377,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
362
377
  | **Spawned by** | `/mindforge:plan-phase`, `/mindforge:agent planner` |
363
378
  | **Tools** | Read, Write, Bash, Grep, Glob |
364
379
  | **Color** | `blue` |
380
+ | **Trust Tier** | `1` |
365
381
  | **Produces** | `PLAN-*.md` (XML task breakdown)|
366
382
 
367
383
  **Capabilities:**
@@ -380,6 +396,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
380
396
  | **Spawned by** | `/mindforge:verify-phase`, `/mindforge:agent integration-checker` |
381
397
  | **Tools** | Read, Write, Bash, Grep, Glob |
382
398
  | **Color** | `blue` |
399
+ | **Trust Tier** | `1` |
383
400
  | **Produces** | `INTEGRATION-REPORT.md` |
384
401
 
385
402
  **Capabilities:**
@@ -398,6 +415,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
398
415
  | **Spawned by** | `/mindforge:validate-phase`, `/mindforge:agent nyquist-auditor` |
399
416
  | **Tools** | Read, Write, Bash, Grep, Glob, CmdStatus, ReadTerminal |
400
417
  | **Color** | `#8B5CF6` |
418
+ | **Trust Tier** | `2` |
401
419
  | **Produces** | `VALIDATION-REPORT.md` |
402
420
 
403
421
  **Capabilities:**
@@ -416,6 +434,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
416
434
  | **Spawned by** | `/mindforge:plan-phase`, `/mindforge:agent plan-checker` |
417
435
  | **Tools** | Read, Write, Bash, Grep, Glob |
418
436
  | **Color** | `yellow` |
437
+ | **Trust Tier** | `1` |
419
438
  | **Produces** | `PLAN-VERDICT.md` |
420
439
 
421
440
  **Capabilities:**
@@ -434,6 +453,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
434
453
  | **Spawned by** | `/mindforge:verify-phase`, `/mindforge:agent ui-auditor` |
435
454
  | **Tools** | Read, Write, Bash, Grep, Glob |
436
455
  | **Color** | `#F472B6` |
456
+ | **Trust Tier** | `1` |
437
457
  | **Produces** | `UI-REVIEW.md` |
438
458
 
439
459
  **Capabilities:**
@@ -452,6 +472,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
452
472
  | **Spawned by** | `/mindforge:plan-phase`, `/mindforge:agent ui-checker` |
453
473
  | **Tools** | Read, Write, Bash, Grep, Glob |
454
474
  | **Color** | `#22D3EE` |
475
+ | **Trust Tier** | `1` |
455
476
  | **Produces** | `UI-SPEC-VERDICT.md` |
456
477
 
457
478
  **Capabilities:**
@@ -470,6 +491,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
470
491
  | **Spawned by** | `/mindforge:verify-phase`, `/mindforge:agent verifier` |
471
492
  | **Tools** | Read, Write, Bash, Grep, Glob |
472
493
  | **Color** | `green` |
494
+ | **Trust Tier** | `1` |
473
495
  | **Produces** | `VERIFICATION.md` |
474
496
 
475
497
  **Capabilities:**
@@ -488,6 +510,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
488
510
  | **Spawned by** | `/mindforge:execute-phase`, `/mindforge:agent executor` |
489
511
  | **Tools** | Read, Write, Bash, Grep, Glob, CmdStatus, ReadTerminal |
490
512
  | **Color** | `yellow` |
513
+ | **Trust Tier** | `3` |
491
514
  | **Produces** | Atomic commits, Execution summaries |
492
515
 
493
516
  **Capabilities:**
@@ -498,6 +521,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
498
521
  ---
499
522
 
500
523
  ### mindforge-debugger (The RCA Scientist)
524
+ **Trust Tier:** `1`
501
525
 
502
526
  **Role:** Specialist in systematic root cause analysis and complex defect resolution.
503
527
 
@@ -516,6 +540,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
516
540
  ---
517
541
 
518
542
  ### mindforge-assumptions-analyzer-extend (The Reality Checker)
543
+ **Trust Tier:** `1`
519
544
 
520
545
  **Role:** Reality checker for identifying hidden codebase constraints and risks.
521
546
 
@@ -542,6 +567,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
542
567
  | **Spawned by** | `/mindforge:map-codebase`, `/mindforge:agent codebase-mapper` |
543
568
  | **Tools** | Read, Write, Bash, Grep, Glob |
544
569
  | **Color** | `cyan` |
570
+ | **Trust Tier** | `1` |
545
571
  | **Produces** | `CONVENTIONS.md`, `STRUCTURE.md` |
546
572
 
547
573
  **Capabilities:**
@@ -560,6 +586,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
560
586
  | **Spawned by** | `/mindforge:map-codebase`, `/mindforge:agent codebase-mapper-extend` |
561
587
  | **Tools** | Read, Write, Bash, Grep, Glob |
562
588
  | **Color** | `cyan` |
589
+ | **Trust Tier** | `1` |
563
590
  | **Produces** | `STACK.md`, `ARCHITECTURE.md`, `CONVENTIONS.md` |
564
591
 
565
592
  **Capabilities:**
@@ -596,6 +623,7 @@ MindForge uses a multi-agent orchestration model where specialized personas are
596
623
  | **Spawned by** | `/mindforge:agent user-profiler` |
597
624
  | **Tools** | Read, Write, Bash, Grep, Glob |
598
625
  | **Color** | `magenta` |
626
+ | **Trust Tier** | `1` |
599
627
  | **Produces** | `USER-PROFILE.md` |
600
628
 
601
629
  **Capabilities:**
@@ -605,36 +633,71 @@ MindForge uses a multi-agent orchestration model where specialized personas are
605
633
 
606
634
  ---
607
635
 
636
+ ## Swarm Clusters (The Agentic Mesh) [v4.2]
637
+
638
+ MindForge V4 introduces the ability to spawn dynamic, task-aware clusters of specialist personas. These swarms work in parallel with shared state to solve complex enterprise challenges.
639
+
640
+ ### Enterprise Swarm Templates
641
+
642
+ | Swarm | Leader | Members | Focus |
643
+ | :--- | :--- | :--- | :--- |
644
+ | **UISwarm** | ui-auditor | developer, accessibility, whimsy-injector | Visual fidelity, interaction, WCAG 2.2 |
645
+ | **BackendSwarm** | architect | developer, security-reviewer, db-optimizer | Architecture, performance, API versioning |
646
+ | **SecuritySwarm** | security-reviewer | architect, developer, threat-detection | OWASP mitigation, secret detection |
647
+ | **AIEngineeringSwarm** | ai-engineer | prompt-engineer, developer, model-qa | Hallucination mitigation, grounding |
648
+ | **IncidentResponse** | sre-engineer | developer, incident-commander, debugger | RCA, hotfix, post-mortem |
649
+ | **ComplianceSwarm** | compliance-auditor | legal-compliance, architect, security | GDPR/SOC2 alignment, PII masking |
650
+ | **IdentityTrustSwarm** | identity-architect | security-reviewer, architect, blockchain | Zero-Trust, DID-based signing |
651
+ | **DataMeshSwarm** | data-engineer | db-optimizer, analyst, compliance | Lakehouse patterns, ETL integrity |
652
+
653
+ ### Swarm Governance Protocols
654
+
655
+ - **Trust Tiers**: Swarms are enforced by ZTAI (Zero-Trust Agentic Identity) tiers (0-3).
656
+ - **Decision Gates**: High-risk swarms (e.g., Compliance) use **Human-in-the-Loop (HITL)** gates.
657
+ - **Resource Budgets**: Performance-aware routing based on confidence-to-cost (C2C) ratios.
658
+ - **Mesh Synthesis**: The Swarm Leader synthesizes all specialist outputs into a single, cohesive `SWARM-SUMMARY`.
659
+
660
+ ---
661
+
608
662
  ### MF-Series: Fundamental Framework Identities
609
663
 
610
664
  The MF-Series represents the "Core Essence" of the MindForge agentic framework. These personas provide a standardized, high-value foundation for delegation and multi-agent interaction.
611
665
 
612
666
  #### mf-planner (The Strategist)
667
+ **Trust Tier:** `1`
613
668
  **Role:** High-level goal decomposition and structured planning.
614
669
  - **Triggers:** `plan`, `decompose`, `roadmap`.
615
670
  - **Produces:** Structured JSON/Markdown execution plans.
616
671
 
617
672
  #### mf-executor (The Pilot)
673
+ **Trust Tier:** `3`
618
674
  **Role:** Precise implementation and high-fidelity plan execution.
619
675
  - **Triggers:** `execute`, `implement`, `fix`.
620
676
  - **Produces:** Implementation details and completion status.
621
677
 
622
678
  #### mf-researcher (The Detective)
679
+ **Trust Tier:** `1`
623
680
  **Role:** Knowledge gathering and objective approach comparison.
681
+
624
682
  - **Triggers:** `research`, `explore`, `benchmark`.
625
683
  - **Produces:** Tradeoff analysis and strategy recommendations.
626
684
 
627
685
  #### mf-reviewer (The Auditor)
686
+ **Trust Tier:** `1`
628
687
  **Role:** Quality assurance and output validation.
688
+
629
689
  - **Triggers:** `review`, `audit`, `validate`.
630
690
  - **Produces:** Feedback, issues, and approval status.
631
691
 
632
692
  #### mf-memory (The Clerk)
693
+ **Trust Tier:** `1`
633
694
  **Role:** Persistence management and knowledge graph maintenance.
695
+
634
696
  - **Triggers:** `remember`, `store`, `learning`.
635
697
  - **Produces:** Memory updates and linked patterns.
636
698
 
637
699
  #### mf-tool (The Operator)
700
+ **Trust Tier:** `2`
638
701
  **Role:** Safe external system interaction and tool execution.
639
702
  - **Triggers:** `tool`, `git`, `api`, `shell`.
640
703
  - **Produces:** Action results and safety logs.
@@ -0,0 +1,35 @@
1
+ # MindForge Nexus: Observability Dashboard
2
+
3
+ ## Vision
4
+ The Nexus Dashboard provides real-time visibility into the "thought chains" of the agentic mesh. It transforms the linear `AUDIT.jsonl` into a hierarchical, interactive visualization of reasoning and execution waves.
5
+
6
+ ## Core Views
7
+
8
+ ### 1. Mesh Trace View (Gantt/Waterfall)
9
+ - **Trace Visualization:** Displays hierarchical spans (Waves -> Clusters -> Tasks).
10
+ - **Critical Path Highlighting:** Identifies bottlenecks in parallel wave execution.
11
+ - **Span Metadata:** Hovering over a span reveals the agent persona, trust tier, and execution time.
12
+
13
+ ### 2. Reasoning Heatmap (ART)
14
+ - **Density Maps:** Visualizes where the agents are performing the most "Thinking" (debate cycles).
15
+ - **ADS Breakdown:** Highlights Adversarial Decision Synthesis debates between specialists (e.g., Security vs Dev).
16
+ - **Thought Stream:** Real-time feed of `reasoning_trace` events.
17
+
18
+ ### 3. ZTAI Trust Heatmap
19
+ - **Security Posture:** Real-time visibility into which tasks are running in which Trust Tier (0-3).
20
+ - **Policy Violations:** Instant alerts when an agent attempts to bypass a HITL decision gate.
21
+
22
+ ## Technical Stack
23
+ - **Engine:** Next.js (React) + D3.js for complex tree visualizations.
24
+ - **Data Source:** Tail-following parser for `.planning/AUDIT.jsonl`.
25
+ - **State Management:** Zustand for real-time trace aggregation.
26
+
27
+ ## API Hooks
28
+ ```javascript
29
+ // Example Dashboard Feed Hook
30
+ const useNexusFeed = () => {
31
+ // Listen for new AUDIT.jsonl entries
32
+ // Reconstruct span hierarchy on the fly
33
+ // Return nodes and edges for D3 renderer
34
+ };
35
+ ```
@@ -0,0 +1,77 @@
1
+ # Architecture: V4 Swarm Mesh Paradigm
2
+
3
+ ## 1. Overview
4
+
5
+ MindForge V4 introduces the **Swarm Mesh**, a decentralized multi-agent orchestration model. Unlike the sequential subagent model of previous versions, the Mesh enables **Dynamic Task-Aware Clusters** that execute in parallel with shared state and unified governance.
6
+
7
+ ---
8
+
9
+ ## 2. Core Components
10
+
11
+ ### I. SwarmController
12
+ The central engine logic that handles:
13
+ - **Complexity Analysis**: Deciding if a task requires a single agent or a specialist cluster.
14
+
15
+ - **Cluster Spawning**: Selecting the optimal swarm template based on tech stack and task category.
16
+
17
+ - **Identity Governance**: Validating **ZTAI (Zero-Trust Agentic Identity)** trust tiers and verifying cryptographic signatures for specialized results.
18
+
19
+ ### II. PersonaFactory (Micro-Personas)
20
+ Dynamically creates specialized "Micro-Personas" on-the-fly by:
21
+ - Patching base personas (e.g., `developer`) with **Context7** library insights.
22
+ - Injecting task-specific imperative rules and role specializations.
23
+
24
+ ### III. Mesh Parallelism (WaveExecutor)
25
+ The `WaveExecutor` has been refactored to support:
26
+ - **Parallel Swarm Spawning**: Multiple specialists (e.g., UI Auditor + Accessibility Specialist) working on the same branch simultaneously.
27
+
28
+ - **Shared State (`SWARM-STATE.json`)**: Real-time coordination and conflict avoidance between swarm members.
29
+
30
+ - **Consolidation Protocol**: The Swarm Leader synthesizes all findings into a unified `SWARM-SUMMARY.md`.
31
+
32
+ ### IV. MindForge Nexus: ART (Agentic Reasoning Tracing)
33
+ The definitive observability layer for the mesh:
34
+ - **Reasoning Spans**: Hierarchical tracking of every "thought" and decision point.
35
+ - **Trace Propagation**: Context-aware trace IDs that link waves, tasks, and clusters.
36
+ - **Audit Integration**: Direct link to `.planning/AUDIT.jsonl` via `trace_id` and `span_id`.
37
+
38
+ ### V. Global Intelligence Mesh (The Hub)
39
+ The foundation for cross-repository organizational memory:
40
+ - **Semantic Hub**: Syncs local knowledge pieces with the global organizational store (`~/.mindforge/`).
41
+ - **Ghost Pattern Detection**: Proactive risk matching that prevents repeating known organizational failures at the planning stage.
42
+ - **Repository Graph**: Every repo in the mesh contributes to a shared understanding of architectural success and failure.
43
+
44
+ ### VI. Autonomous FinOps Hub (Economics)
45
+ MindForge integrates an **Autonomous FinOps Hub** that treats compute as a first-class resource. The `ModelBroker` utilizes a **Confidence-to-Cost (C2C)** engine to dynamically route tasks based on complexity and trust tier, ensuring maximum ROI without compromising safety.
46
+
47
+ ### VII. Proactive Equilibrium (Reliability)
48
+ The system achieves **Proactive Equilibrium** through a `WaveFeedbackLoop`. If execution divergence exceeds 20%, the system triggers **Temporal Hindsight**—an automated RCA process that rewrites the phase plan to stay within project guardrails.
49
+
50
+ ---
51
+
52
+ ## 3. Swarm Governance (v4.2)
53
+
54
+ Every swarm cluster operates under strict enterprise governance rules:
55
+
56
+ - **Decision Gates**: Use of "Human-in-the-Loop" (HITL) for high-risk Tier 3 actions.
57
+
58
+ - **Resource Budgets**: FinOps-aware routing to optimal models based on the cluster's defined confidence-to-cost (C2C) ratio.
59
+
60
+ - **Audit Trails**: Non-repudiable logs signed by each agent's unique **Decentralized Identifier (DID)**.
61
+
62
+ - **Identity Hardening (Beast Mode)**: High-tier agents (T3) use asymmetric keys anchored in a simulated **Secure Enclave (HSM)**.
63
+ - **Integrity Proofs**: All audit blocks are finalized with **Merkle-root payloads** signed by the archiver to prevent tampering.
64
+
65
+ ---
66
+
67
+ ## 4. Swarm Lifecycle
68
+
69
+ 1. **Detection**: `SwarmController` detects target files and estimates task difficulty.
70
+ 2. **Cluster Assembly**: `PersonaFactory` assembles the micro-persona specialist group.
71
+ 3. **Execution**: Parallel execution waves with shared JSON state synchronization.
72
+ 4. **Consolidation**: Leader-led summary and plan update.
73
+ 5. **Verification**: Adversarial audit by the `mf-reviewer` or assigned swarm auditor.
74
+
75
+ ---
76
+
77
+ *This document defines the architectural standard for MindForge V4 Swarm Orchestration.*
@@ -1,4 +1,4 @@
1
- # Feature: Real-time Dashboard (v2)
1
+ # Feature: Real-time Dashboard (v4.1.0)
2
2
 
3
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
4
 
@@ -33,6 +33,11 @@ Default access: `http://localhost:7339` (Strictly bound to `127.0.0.1` for secur
33
33
  - **Persona Context**: See which agent personas are currently active.
34
34
  - **Steerage Feed**: View steering instructions as they are applied.
35
35
 
36
+ ### 5. MindForge Nexus (v4.1+)
37
+ - **ART Trace Explorer**: Drill down into hierarchical reasoning spans and thought chains.
38
+ - **Mesh Topology**: Visual graph of the active agentic mesh and specialist clusters.
39
+ - **Reasoning Heatmaps**: Identifying areas of adversarial disagreement and drift in real-time.
40
+
36
41
  ## 🛡 Hardened Security
37
42
  - **Localhost Binding**: The server refuses connections from external IPs.
38
43
  - **CORS Lock-down**: Only allows requests from the local control plane.
@@ -1,23 +1,32 @@
1
- # MindForge Governance Guide
1
+ # MindForge Governance Guide (v4.2.5)
2
2
 
3
3
  ## Goal
4
- Explain how change classification, approvals, compliance gates, and milestone
5
- governance work in Day 4.
4
+ Explain how change classification, approvals, compliance gates, and trust-based identity enforcement work in the MindForge ecosystem.
6
5
 
7
- ## Governance flow
8
- 1. Classify the change before plan execution
9
- 2. Apply Tier 3 signals first
10
- 3. Request approval when required
11
- 4. Enforce compliance gates before completion or release
12
- 5. Log decisions and approvals to AUDIT
6
+ ## Trust Tier Architecture (ZTAI)
7
+ MindForge enforces a 4-tier trust model to govern agentic actions and code modifications.
13
8
 
14
- ## Key guarantees
15
- - Tier 3 can be triggered by code content, not just file paths
16
- - GDPR/PII gate runs independently of skill loading
17
- - emergency override requires explicit `--emergency` and listed approver identity
18
- - approval expiry is session-detected and config-driven
9
+ | Tier | Name | Role | Verification Requirement |
10
+ | :--- | :--- | :--- | :--- |
11
+ | **0** | Informational | Research/Query agents. | No signing required. |
12
+ | **1** | Verified | Standard implementation agents. | DID-signed audit entries. |
13
+ | **2** | Specialized | Security, UI, and Data specialists. | Multi-agent peer review + DID signing. |
14
+ | **3** | Principal | Architects and Core Engine agents. | **Secure Enclave (HSM) Signing** + Principal Approval. |
19
15
 
20
- ## Team operation
21
- - multi-developer sessions coordinate via shared `HANDOFF.json`
22
- - stale active developers expire after 4 hours
23
- - shared state merges happen through git conflict resolution, not silent overwrite
16
+ ## Governance Flow
17
+ 1. **Classify**: Automated classification of intent before planning.
18
+ 2. **Tier Mapping**: Assigning a Trust Tier based on persona and scope.
19
+ 3. **Cryptographic Signing**:
20
+ - T1/T2: Standard Ed25519 signing via ZTAIManager.
21
+ - T3: Hardware-enclave (simulated) signing for critical engine/security paths.
22
+ 4. **Compliance Gates**: Enforce non-bypassable gates (Secrets, SQLi, PII) before release.
23
+ 5. **Non-Repudiation**: Finalize audit blocks with Merkle-root manifests for integrity verification.
24
+
25
+ ## Key Guarantees
26
+ - **Identity Integrity**: Agents cannot spoof identities; every block in `AUDIT.jsonl` is cryptographically tied to a DID.
27
+ - **Ghost Pattern Mitigation**: Planning is gated by the Global Intelligence Mesh to prevent repeating organizational anti-patterns.
28
+ - **Emergency Override**: Requires explicit `--emergency` flag and authorized DID signing.
29
+
30
+ ## Team Operation
31
+ - **Handoff Continuity**: Multi-developer sessions coordinate via `HANDOFF.json`.
32
+ - **Global Mesh Sync**: Project memory is automatically bubbled up to the organizational `~/.mindforge` store for cross-repo awareness.
@@ -14,6 +14,9 @@ Each line is a JSON object with a required `event` type and a `session_id`.
14
14
  - `agent` (string)
15
15
  - `phase` (number or null)
16
16
  - `session_id` (string)
17
+ - `trace_id` (string, v4.1+) - UUID linking multiple related spans.
18
+ - `span_id` (string, v4.1+) - ID for the current execution unit.
19
+ - `parent_span_id` (string, v4.1+) - Link to the calling span.
17
20
 
18
21
  ## Common event types
19
22
  ### `project_initialised`
@@ -46,6 +49,9 @@ Fields: `plugin_name`, `version`, `permissions`
46
49
  ### `plugin_uninstalled`
47
50
  Fields: `plugin_name`
48
51
 
52
+ ### `reasoning_trace` (v4.1+)
53
+ Fields: `trace_id`, `span_id`, `persona`, `thought_chain`, `decision_point`, `adversarial_critique` (optional)
54
+
49
55
  ## Rotation
50
56
  Rotate when file exceeds 10,000 lines. Archive into `.planning/audit-archive/`.
51
57
 
@@ -29,14 +29,25 @@
29
29
  - Crediting researchers in the security advisory (with their permission)
30
30
  - Maintaining confidentiality until a fix is released
31
31
 
32
+ ## ZTAI Identity Model (v4.2)
33
+
34
+ MindForge enforces **Zero-Trust Agentic Identity (ZTAI)** for all actions. Every agent is assigned a cryptographically unique asymmetric key pair (Ed25519) in the format `did:mf:<key-fingerprint>`.
35
+
36
+ - **Asymmetric Signing**: All high-tier (T1-T3) agent actions are cryptographically signed.
37
+ - **Secure Enclave (HSM)**: Tier 3 principal agents utilize simulated hardware-secured enclave signing.
38
+ - **Audit Non-Repudiation**: The `AUDIT.jsonl` log is finalized with **Merkle-root integrity manifests** to prevent tampering.
39
+ - **See also:** [ZTAI Overview](file:///Users/sairamugge/Desktop/MindForge/docs/security/ZTAI-OVERVIEW.md)
40
+
32
41
  ## Known security model limitations
33
42
 
34
43
  See `docs/security/threat-model.md` for the full threat model.
35
44
 
36
45
  Key acknowledged limitations:
37
- 1. Plugin permission model is advisory (not OS-enforced) — see TA7 in threat model
38
- 2. The SSE event stream is localhost-only but any local process can connect — see TA6
39
- 3. Approver identity uses `git config user.email` which is user-controlled see TA5
40
- 4. Agent instruction injection via SKILL.md requires review beyond pattern matching — see TA1
46
+ 1. Plugin permission model is advisory (not OS-enforced) — see TA7 in threat model.
47
+ 2. The SSE event stream is localhost-only but any local process can connect — see TA6.
48
+ 3. Cryptographic identity is local-first; remote anchor validation is a planned v4.5 feature.
49
+ 4. Agent instruction injection via SKILL.md requires review beyond pattern matching — see TA1.
50
+
51
+ *Note: The previous limitation on approver identity (TA5) has been mitigated by the ZTAI DID-based signing model in v4.2.*
41
52
 
42
53
  These are known trade-offs, not bugs. They are documented in ADR-020.