mindforge-cc 5.3.0 → 5.4.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.
- package/CHANGELOG.md +14 -0
- package/RELEASENOTES.md +12 -0
- package/bin/governance/impact-analyzer.js +32 -8
- package/bin/memory/federated-sync.js +113 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.4.0] — Beast Mode Hardening — 2026-03-28
|
|
4
|
+
|
|
5
|
+
🚀 **MindForge v5.4.0 — Enterprise Resilience (Hardened Edition)**
|
|
6
|
+
|
|
7
|
+
This update elevates the v5.3.0 "Hyper-Enterprise" features to maximum robustness ("Beast Mode"), implementing critical safety systems and advanced observability.
|
|
8
|
+
|
|
9
|
+
### 🛡️ Beast Mode Hardening (v5.4.0)
|
|
10
|
+
|
|
11
|
+
- **Circuit Breaker Pattern**: Implemented a stateful `CircuitBreaker` in `federated-sync.js` to prevent network floods. Automatically disables mesh sync for 1 hour after 3 consecutive EIS failures.
|
|
12
|
+
- **Critical-Path Protection**: Automated "Blast Radius" score of 100 in `impact-analyzer.js` for sensitive files (`.env`, `*.pem`, `id_rsa`, `package-lock.json`, etc.).
|
|
13
|
+
- **Recursive Depth Penalty**: Introduced a 1.5x impact multiplier for actions deeper than 5 directory levels, preventing mass-scale silent modifications.
|
|
14
|
+
- **Failure Telemetry**: Added `sync-history.jsonl` and `sync-telemetry.jsonl` for detailed conflict resolution and error auditability.
|
|
15
|
+
- **Resilient Execution**: Raised default scores for `EXECUTE` and `GRANT` actions to increase governance oversight.
|
|
16
|
+
|
|
3
17
|
## [5.3.0] — Dynamic Blast Radius — 2026-03-28
|
|
4
18
|
|
|
5
19
|
🚀 **MindForge v5.3.0 — Pillar II Implementation (APO v2)**
|
package/RELEASENOTES.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# MindForge v5.4.0 — Beast Mode Hardening
|
|
2
|
+
## Top Summary
|
|
3
|
+
The v5.4.0 release elevates the "Hyper-Enterprise" features to maximum robustness ("Beast Mode"), implementing critical safety systems, automated blast-radius protection for sensitive files, and advanced failure telemetry.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
- **Circuit Breaker Pattern**: Stateful resilience in `federated-sync.js` to prevent network floods during outages.
|
|
7
|
+
- **Critical-Path Protection**: Automated "Blast Radius" score of 100 for high-risk files (secrets, locks, audits).
|
|
8
|
+
- **Depth-Aware Governance**: 1.5x impact multiplier for deep directory modifications to prevent mass-scale silent regressions.
|
|
9
|
+
- **Enhanced Observability**: Detailed conflict resolution and sync telemetry logs for enterprise auditing.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# MindForge v5.3.0 — Dynamic Blast Radius
|
|
2
14
|
## Top Summary
|
|
3
15
|
The v5.3.0 release introduces real-time impact analysis and automated risk-based guardrails for agentic actions, preventing architectural regressions and accidental deletions.
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MindForge v5.
|
|
2
|
+
* MindForge v5.4.0 — Impact Analyzer (Hardened Edition)
|
|
3
3
|
* Calculates the 'Blast Radius' score of a proposed intent.
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
7
|
class ImpactAnalyzer {
|
|
8
|
+
static CRITICAL_PATHS = [
|
|
9
|
+
'.env',
|
|
10
|
+
'id_rsa',
|
|
11
|
+
'*.pem',
|
|
12
|
+
'package-lock.json',
|
|
13
|
+
'yarn.lock',
|
|
14
|
+
'AUDIT.jsonl',
|
|
15
|
+
'STATE.md'
|
|
16
|
+
];
|
|
17
|
+
|
|
8
18
|
static SENSITIVE_NAMESPACES = [
|
|
9
19
|
'.mindforge',
|
|
10
20
|
'bin/',
|
|
11
21
|
'config/',
|
|
12
|
-
'.
|
|
22
|
+
'.agent/',
|
|
13
23
|
'security/'
|
|
14
24
|
];
|
|
15
25
|
|
|
@@ -17,30 +27,44 @@ class ImpactAnalyzer {
|
|
|
17
27
|
'READ': 1,
|
|
18
28
|
'WRITE': 5,
|
|
19
29
|
'DELETE': 10,
|
|
20
|
-
'EXECUTE': 8
|
|
21
|
-
'GRANT': 15
|
|
30
|
+
'EXECUTE': 15, // Raised from 8
|
|
31
|
+
'GRANT': 20 // Raised from 15
|
|
22
32
|
};
|
|
23
33
|
|
|
24
34
|
/**
|
|
25
|
-
* Scores an intent based on action type
|
|
35
|
+
* Scores an intent based on action type, target path sensitivity, and recursion depth.
|
|
26
36
|
* Score Range: 0 - 100
|
|
27
37
|
*/
|
|
28
38
|
static analyze(intent) {
|
|
29
39
|
const { action, target, namespace } = intent;
|
|
30
40
|
|
|
41
|
+
// 1. Critical Path Protection (Score 100)
|
|
42
|
+
const isCritical = this.CRITICAL_PATHS.some(cp =>
|
|
43
|
+
(target && (target.endsWith(cp) || target.includes(`/${cp}`)))
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (isCritical && (action === 'WRITE' || action === 'DELETE')) {
|
|
47
|
+
return 100; // Automatic CRITICAL block
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
let score = this.ACTION_SCORES[action] || 5;
|
|
32
51
|
|
|
33
|
-
//
|
|
52
|
+
// 2. Sensitive Namespace Multiplier
|
|
34
53
|
const isSensitive = this.SENSITIVE_NAMESPACES.some(ns =>
|
|
35
54
|
(target && target.includes(ns)) || (namespace && namespace.includes(ns))
|
|
36
55
|
);
|
|
37
56
|
|
|
38
57
|
if (isSensitive) {
|
|
39
|
-
score *= 4;
|
|
58
|
+
score *= 4;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 3. Recursive Depth Penalty (Beast Mode)
|
|
62
|
+
if (target && target.split('/').length > 5) {
|
|
63
|
+
score *= 1.5; // Deeper actions are riskier (mass-scale silent mods)
|
|
40
64
|
}
|
|
41
65
|
|
|
42
66
|
// Cap the score at 100
|
|
43
|
-
return Math.min(score, 100);
|
|
67
|
+
return Math.min(Math.round(score), 100);
|
|
44
68
|
}
|
|
45
69
|
|
|
46
70
|
/**
|
|
@@ -17,6 +17,56 @@ class FederatedSync {
|
|
|
17
17
|
this.client = new EISClient(config);
|
|
18
18
|
this.localStore = Store;
|
|
19
19
|
this.syncHistoryPath = path.join(Store.getPaths().MEMORY_DIR, 'sync-history.jsonl');
|
|
20
|
+
this.circuitBreakerPath = path.join(Store.getPaths().MEMORY_DIR, 'circuit-breaker.json');
|
|
21
|
+
this.MAX_FAILURES = 3;
|
|
22
|
+
this.COOLDOWN_MS = 3600000; // 1 hour
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* [BEAST] Checks if the circuit is open.
|
|
27
|
+
*/
|
|
28
|
+
isCircuitOpen() {
|
|
29
|
+
if (!fs.existsSync(this.circuitBreakerPath)) return false;
|
|
30
|
+
try {
|
|
31
|
+
const state = JSON.parse(fs.readFileSync(this.circuitBreakerPath, 'utf8'));
|
|
32
|
+
if (state.status === 'OPEN' && (Date.now() - state.trippedAt < this.COOLDOWN_MS)) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
// Reset if cooldown passed
|
|
36
|
+
if (state.status === 'OPEN') {
|
|
37
|
+
this.resetCircuit();
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
tripCircuit(reason) {
|
|
46
|
+
console.warn(`[BEAST] ⚠️ Circuit Breaker TRIPPED: ${reason}. Mesh sync disabled for 1hr.`);
|
|
47
|
+
const state = { status: 'OPEN', trippedAt: Date.now(), reason };
|
|
48
|
+
fs.writeFileSync(this.circuitBreakerPath, JSON.stringify(state, null, 2));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
resetCircuit() {
|
|
52
|
+
if (fs.existsSync(this.circuitBreakerPath)) {
|
|
53
|
+
fs.unlinkSync(this.circuitBreakerPath);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
handleSyncFailure(err) {
|
|
58
|
+
const statsPath = path.join(this.localStore.getPaths().MEMORY_DIR, 'sync-stats.json');
|
|
59
|
+
let stats = { failures: 0 };
|
|
60
|
+
if (fs.existsSync(statsPath)) {
|
|
61
|
+
stats = JSON.parse(fs.readFileSync(statsPath, 'utf8'));
|
|
62
|
+
}
|
|
63
|
+
stats.failures = (stats.failures || 0) + 1;
|
|
64
|
+
stats.last_error = err.message;
|
|
65
|
+
fs.writeFileSync(statsPath, JSON.stringify(stats, null, 2));
|
|
66
|
+
|
|
67
|
+
if (stats.failures >= this.MAX_FAILURES) {
|
|
68
|
+
this.tripCircuit(err.message);
|
|
69
|
+
}
|
|
20
70
|
}
|
|
21
71
|
|
|
22
72
|
/**
|
|
@@ -24,37 +74,58 @@ class FederatedSync {
|
|
|
24
74
|
* This pushes local high-confidence entries and pulls new organizational knowledge.
|
|
25
75
|
*/
|
|
26
76
|
async fullSync() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const localEntries = this.localStore.readAll(false).filter(e => e.confidence > 0.8 && !e.deprecated);
|
|
31
|
-
|
|
32
|
-
// 2. Filter out already synced entries
|
|
33
|
-
const unsynced = localEntries.filter(e => !e.global && !this.isRecentlySynced(e.id));
|
|
34
|
-
|
|
35
|
-
// 3. Push to EIS
|
|
36
|
-
if (unsynced.length > 0) {
|
|
37
|
-
const auth = await this.client.getAuthHeader('push', 'kb/global');
|
|
38
|
-
const results = await this.client.push(unsynced, { headers: auth });
|
|
39
|
-
this.logSyncEvent(results);
|
|
77
|
+
if (this.isCircuitOpen()) {
|
|
78
|
+
console.warn('🛑 Federated Intelligence Sync: Circuit is OPEN. Skipping network calls.');
|
|
79
|
+
return { status: 'CIRCUIT_OPEN' };
|
|
40
80
|
}
|
|
81
|
+
|
|
82
|
+
console.log('🔄 Initiating Federated Intelligence Sync (v5.4.0 BEAST)...');
|
|
41
83
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
84
|
+
try {
|
|
85
|
+
// 1. Get promotable entries (Tiers 1-3)
|
|
86
|
+
const localEntries = this.localStore.readAll(false).filter(e => e.confidence > 0.8 && !e.deprecated);
|
|
87
|
+
|
|
88
|
+
// 2. Filter out already synced entries
|
|
89
|
+
const unsynced = localEntries.filter(e => !e.global && !this.isRecentlySynced(e.id));
|
|
90
|
+
|
|
91
|
+
// 3. Push to EIS
|
|
92
|
+
if (unsynced.length > 0) {
|
|
93
|
+
const auth = await this.client.getAuthHeader('push', 'kb/global');
|
|
94
|
+
const results = await this.client.push(unsynced, { headers: auth });
|
|
95
|
+
this.logSyncEvent(results);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 4. [HARDEN] Delta Pull from EIS
|
|
99
|
+
const lastSync = this.getLastSyncTimestamp();
|
|
100
|
+
const authPull = await this.client.getAuthHeader('pull', 'kb/global');
|
|
101
|
+
const remoteEntries = await this.client.pull({
|
|
102
|
+
orgId: this.client.orgId,
|
|
103
|
+
since: lastSync,
|
|
104
|
+
headers: authPull
|
|
105
|
+
});
|
|
50
106
|
|
|
51
|
-
|
|
52
|
-
|
|
107
|
+
if (remoteEntries.length > 0) {
|
|
108
|
+
this.mergeRemoteKnowledge(remoteEntries);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this.updateLastSyncTimestamp();
|
|
112
|
+
this.resetFailures(); // Reset on success
|
|
113
|
+
console.log(`✅ Federated Intelligence Mesh: Sync complete. (Delta since ${lastSync})`);
|
|
114
|
+
return { pushed: unsynced.length, pulled: remoteEntries.length };
|
|
115
|
+
} catch (err) {
|
|
116
|
+
console.error('❌ Federated Intelligence Sync FAILED:', err.message);
|
|
117
|
+
this.handleSyncFailure(err);
|
|
118
|
+
throw err;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
resetFailures() {
|
|
123
|
+
const statsPath = path.join(this.localStore.getPaths().MEMORY_DIR, 'sync-stats.json');
|
|
124
|
+
if (fs.existsSync(statsPath)) {
|
|
125
|
+
const stats = JSON.parse(fs.readFileSync(statsPath, 'utf8'));
|
|
126
|
+
stats.failures = 0;
|
|
127
|
+
fs.writeFileSync(statsPath, JSON.stringify(stats, null, 2));
|
|
53
128
|
}
|
|
54
|
-
|
|
55
|
-
this.updateLastSyncTimestamp();
|
|
56
|
-
console.log(`✅ Federated Intelligence Mesh: Sync complete. (Delta since ${lastSync})`);
|
|
57
|
-
return { pushed: unsynced.length, pulled: remoteEntries.length };
|
|
58
129
|
}
|
|
59
130
|
|
|
60
131
|
getLastSyncTimestamp() {
|
|
@@ -133,6 +204,7 @@ class FederatedSync {
|
|
|
133
204
|
if (similarity > 0.9) {
|
|
134
205
|
if (new Date(remote.timestamp) > new Date(local.timestamp)) {
|
|
135
206
|
this.writeToGlobalKB(remote, globalPath);
|
|
207
|
+
this.logConflictTelemetry(local.id, 'LWW', similarity);
|
|
136
208
|
console.log(` └─ [LWW] Auto-resolved via timestamp.`);
|
|
137
209
|
}
|
|
138
210
|
return;
|
|
@@ -143,6 +215,7 @@ class FederatedSync {
|
|
|
143
215
|
console.log(` └─ [ADS] Triggering Autonomous Knowledge Synthesis...`);
|
|
144
216
|
const merged = await this.triggerADSMerging(local, remote);
|
|
145
217
|
this.writeToGlobalKB(merged, globalPath);
|
|
218
|
+
this.logConflictTelemetry(local.id, 'ADS_MERGE', similarity);
|
|
146
219
|
return;
|
|
147
220
|
}
|
|
148
221
|
|
|
@@ -150,12 +223,25 @@ class FederatedSync {
|
|
|
150
223
|
if (similarity > 0.6) {
|
|
151
224
|
console.log(` └─ [DHH] High disagreement. Triggering Nexus Handover...`);
|
|
152
225
|
this.localStore.markConflict(local.id, remote);
|
|
226
|
+
this.logConflictTelemetry(local.id, 'DHH_HANDOVER', similarity);
|
|
153
227
|
return;
|
|
154
228
|
}
|
|
155
229
|
|
|
156
230
|
// 4. Collision Isolation (< 0.6) - Topic Mismatch
|
|
157
231
|
console.log(` └─ [ISO] Semantic collision (Topic mismatch). Isolating entries.`);
|
|
158
232
|
this.writeToGlobalKB({ ...remote, id: `${remote.id}_collision_${Date.now()}` }, globalPath);
|
|
233
|
+
this.logConflictTelemetry(local.id, 'COLLISION_ISOLATION', similarity);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
logConflictTelemetry(id, resolution, similarity) {
|
|
237
|
+
const telePath = path.join(this.localStore.getPaths().MEMORY_DIR, 'sync-telemetry.jsonl');
|
|
238
|
+
const entry = JSON.stringify({
|
|
239
|
+
id,
|
|
240
|
+
resolution,
|
|
241
|
+
similarity,
|
|
242
|
+
timestamp: new Date().toISOString()
|
|
243
|
+
}) + '\n';
|
|
244
|
+
fs.appendFileSync(telePath, entry);
|
|
159
245
|
}
|
|
160
246
|
|
|
161
247
|
async triggerADSMerging(local, remote) {
|