mindforge-cc 2.3.5 → 3.0.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/.agent/skills/mindforge-plan-phase/SKILL.md +1 -0
- package/.agent/skills/mindforge-system-architecture/SKILL.md +136 -0
- package/.agent/skills/mindforge-system-architecture/examples.md +120 -0
- package/.agent/skills/mindforge-system-architecture/scaling-checklist.md +76 -0
- package/.agent/skills/mindforge-tdd/SKILL.md +112 -0
- package/.agent/skills/mindforge-tdd/deep-modules.md +21 -0
- package/.agent/skills/mindforge-tdd/interface-design.md +22 -0
- package/.agent/skills/mindforge-tdd/mocking.md +24 -0
- package/.agent/skills/mindforge-tdd/refactoring.md +21 -0
- package/.agent/skills/mindforge-tdd/tests.md +28 -0
- package/.agent/workflows/mindforge-plan-phase.md +30 -1
- package/.agent/workflows/mindforge:architecture.md +40 -0
- package/.agent/workflows/mindforge:executor.md +18 -0
- package/.agent/workflows/mindforge:identity.md +18 -0
- package/.agent/workflows/mindforge:memory.md +18 -0
- package/.agent/workflows/mindforge:planner.md +18 -0
- package/.agent/workflows/mindforge:researcher.md +18 -0
- package/.agent/workflows/mindforge:reviewer.md +18 -0
- package/.agent/workflows/mindforge:tdd.md +41 -0
- package/.agent/workflows/mindforge:tool.md +18 -0
- package/.mindforge/engine/ads-protocol.md +54 -0
- package/.mindforge/engine/compaction-protocol.md +21 -36
- package/.mindforge/engine/context-injector.md +26 -0
- package/.mindforge/engine/knowledge-graph-protocol.md +125 -0
- package/.mindforge/engine/shard-controller.md +53 -0
- package/.mindforge/engine/temporal-protocol.md +40 -0
- package/.mindforge/personas/mf-executor.md +40 -0
- package/.mindforge/personas/mf-memory.md +33 -0
- package/.mindforge/personas/mf-planner.md +45 -0
- package/.mindforge/personas/mf-researcher.md +39 -0
- package/.mindforge/personas/mf-reviewer.md +35 -0
- package/.mindforge/personas/mf-tool.md +33 -0
- package/.planning/AUDIT.jsonl +1 -0
- package/.planning/TEMPORAL-TEST.md +1 -0
- package/.planning/history/36525e1d9da1b674/ARCHITECTURE.md +0 -0
- package/.planning/history/36525e1d9da1b674/HANDOFF.json +8 -0
- package/.planning/history/36525e1d9da1b674/PROJECT.md +33 -0
- package/.planning/history/36525e1d9da1b674/RELEASE-CHECKLIST.md +68 -0
- package/.planning/history/36525e1d9da1b674/REQUIREMENTS.md +0 -0
- package/.planning/history/36525e1d9da1b674/ROADMAP.md +12 -0
- package/.planning/history/36525e1d9da1b674/SNAPSHOT-META.json +18 -0
- package/.planning/history/36525e1d9da1b674/STATE.md +31 -0
- package/.planning/history/36525e1d9da1b674/TEMPORAL-TEST.md +1 -0
- package/.planning/history/36525e1d9da1b674/jira-sync.json +5 -0
- package/.planning/history/36525e1d9da1b674/slack-threads.json +3 -0
- package/.planning/history/test-audit-001/ARCHITECTURE.md +0 -0
- package/.planning/history/test-audit-001/HANDOFF.json +8 -0
- package/.planning/history/test-audit-001/PROJECT.md +33 -0
- package/.planning/history/test-audit-001/RELEASE-CHECKLIST.md +68 -0
- package/.planning/history/test-audit-001/REQUIREMENTS.md +0 -0
- package/.planning/history/test-audit-001/ROADMAP.md +12 -0
- package/.planning/history/test-audit-001/SNAPSHOT-META.json +17 -0
- package/.planning/history/test-audit-001/STATE.md +31 -0
- package/.planning/history/test-audit-001/TEMPORAL-TEST.md +1 -0
- package/.planning/history/test-audit-001/jira-sync.json +5 -0
- package/.planning/history/test-audit-001/slack-threads.json +3 -0
- package/CHANGELOG.md +101 -0
- package/README.md +57 -23
- package/bin/autonomous/auto-runner.js +23 -0
- package/bin/dashboard/server.js +2 -0
- package/bin/dashboard/temporal-api.js +82 -0
- package/bin/engine/temporal-cli.js +52 -0
- package/bin/engine/temporal-hub.js +138 -0
- package/bin/hindsight-injector.js +59 -0
- package/bin/memory/auto-shadow.js +274 -0
- package/bin/memory/embedding-engine.js +326 -0
- package/bin/memory/knowledge-capture.js +122 -5
- package/bin/memory/knowledge-graph.js +572 -0
- package/bin/memory/knowledge-store.js +15 -3
- package/bin/mindforge-cli.js +19 -0
- package/bin/models/model-router.js +1 -0
- package/bin/review/ads-engine.js +126 -0
- package/bin/review/ads-synthesizer.js +117 -0
- package/bin/shard-helper.js +134 -0
- package/bin/spawn-agent.js +61 -0
- package/docs/PERSONAS.md +71 -5
- package/docs/adr/ADR-042-ads-protocol.md +30 -0
- package/docs/architecture/README.md +55 -0
- package/docs/architecture/V3-CORE.md +52 -0
- package/docs/commands-reference.md +3 -2
- package/docs/usp-features.md +33 -15
- package/package.json +1 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MindForge v2 — Knowledge Capture Engine
|
|
2
|
+
* MindForge v2.4.0 — Knowledge Capture Engine (RAG 2.0)
|
|
3
3
|
* Automatically extracts and stores knowledge from MindForge lifecycle events.
|
|
4
|
+
* Extended with graph-aware edge creation for the Knowledge Graph.
|
|
4
5
|
*/
|
|
5
6
|
'use strict';
|
|
6
7
|
|
|
7
|
-
const fs
|
|
8
|
-
const path
|
|
9
|
-
const Store
|
|
10
|
-
const Indexer
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const Store = require('./knowledge-store');
|
|
11
|
+
const Indexer = require('./knowledge-indexer');
|
|
12
|
+
const Graph = require('./knowledge-graph');
|
|
13
|
+
const Embedder = require('./embedding-engine');
|
|
11
14
|
|
|
12
15
|
const PLANNING_DIR = path.join(process.cwd(), '.planning');
|
|
13
16
|
const DECISIONS_DIR = path.join(PLANNING_DIR, 'decisions');
|
|
@@ -53,6 +56,8 @@ function deduplicateOrAdd(entry) {
|
|
|
53
56
|
// High similarity — reinforce instead of duplicate
|
|
54
57
|
if (e.confidence >= entry.confidence) {
|
|
55
58
|
Store.reinforce(e.id);
|
|
59
|
+
// Reinforce graph edges too
|
|
60
|
+
reinforceRelatedEdges(e.id);
|
|
56
61
|
return { action: 'reinforced', id: e.id };
|
|
57
62
|
} else {
|
|
58
63
|
// New entry has higher confidence — supersede old
|
|
@@ -62,9 +67,121 @@ function deduplicateOrAdd(entry) {
|
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
const id = Store.add(entry);
|
|
70
|
+
|
|
71
|
+
// RAG 2.0: Auto-create graph edges for the new entry
|
|
72
|
+
autoLinkEntry(id, entry);
|
|
73
|
+
|
|
65
74
|
return { action: 'added', id };
|
|
66
75
|
}
|
|
67
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Auto-link a newly added entry to the knowledge graph.
|
|
79
|
+
* Builds embeddings and creates RELATED_TO edges for high-similarity matches.
|
|
80
|
+
* @param {string} entryId
|
|
81
|
+
* @param {object} entry
|
|
82
|
+
*/
|
|
83
|
+
function autoLinkEntry(entryId, entry) {
|
|
84
|
+
try {
|
|
85
|
+
const allEntries = Store.readAll();
|
|
86
|
+
if (allEntries.length < 2) return; // Need at least 2 entries
|
|
87
|
+
|
|
88
|
+
const { vectors } = Embedder.buildEmbeddings(allEntries);
|
|
89
|
+
const created = Graph.autoCreateEdges(entryId, vectors);
|
|
90
|
+
|
|
91
|
+
if (created.length > 0) {
|
|
92
|
+
// If this is a bug_pattern, also create CAUSED_BY edges to related code_patterns
|
|
93
|
+
if (entry.type === 'bug_pattern') {
|
|
94
|
+
createCausalEdges(entryId, allEntries, vectors);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// If this is an architectural_decision, create INFORMS edges
|
|
98
|
+
if (entry.type === 'architectural_decision') {
|
|
99
|
+
createInformsEdges(entryId, allEntries, vectors);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
// Never crash the capture pipeline for graph errors
|
|
104
|
+
if (process.env.MINDFORGE_DEBUG) {
|
|
105
|
+
console.error('[RAG 2.0] Auto-link error:', err.message);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Create CAUSED_BY edges from bug patterns to related code patterns.
|
|
112
|
+
* @param {string} bugId
|
|
113
|
+
* @param {object[]} allEntries
|
|
114
|
+
* @param {Map} vectors
|
|
115
|
+
*/
|
|
116
|
+
function createCausalEdges(bugId, allEntries, vectors) {
|
|
117
|
+
const codePatterns = allEntries.filter(e => e.type === 'code_pattern' && !e.deprecated);
|
|
118
|
+
const bugVec = vectors.get(bugId);
|
|
119
|
+
if (!bugVec) return;
|
|
120
|
+
|
|
121
|
+
for (const cp of codePatterns) {
|
|
122
|
+
const cpVec = vectors.get(cp.id);
|
|
123
|
+
if (!cpVec) continue;
|
|
124
|
+
|
|
125
|
+
const sim = Embedder.cosineSimilarity(bugVec, cpVec);
|
|
126
|
+
if (sim >= 0.50) {
|
|
127
|
+
try {
|
|
128
|
+
Graph.addEdge({
|
|
129
|
+
sourceId: bugId,
|
|
130
|
+
targetId: cp.id,
|
|
131
|
+
type: Graph.EDGE_TYPES.CAUSED_BY,
|
|
132
|
+
weight: sim,
|
|
133
|
+
reason: `Bug pattern potentially caused by code pattern (sim: ${sim.toFixed(3)})`,
|
|
134
|
+
});
|
|
135
|
+
} catch { /* skip duplicates or self-refs */ }
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Create INFORMS edges from architectural decisions to domain knowledge.
|
|
142
|
+
* @param {string} decisionId
|
|
143
|
+
* @param {object[]} allEntries
|
|
144
|
+
* @param {Map} vectors
|
|
145
|
+
*/
|
|
146
|
+
function createInformsEdges(decisionId, allEntries, vectors) {
|
|
147
|
+
const domainEntries = allEntries.filter(e =>
|
|
148
|
+
(e.type === 'domain_knowledge' || e.type === 'team_preference') && !e.deprecated
|
|
149
|
+
);
|
|
150
|
+
const decVec = vectors.get(decisionId);
|
|
151
|
+
if (!decVec) return;
|
|
152
|
+
|
|
153
|
+
for (const de of domainEntries) {
|
|
154
|
+
const deVec = vectors.get(de.id);
|
|
155
|
+
if (!deVec) continue;
|
|
156
|
+
|
|
157
|
+
const sim = Embedder.cosineSimilarity(decVec, deVec);
|
|
158
|
+
if (sim >= 0.55) {
|
|
159
|
+
try {
|
|
160
|
+
Graph.addEdge({
|
|
161
|
+
sourceId: decisionId,
|
|
162
|
+
targetId: de.id,
|
|
163
|
+
type: Graph.EDGE_TYPES.INFORMS,
|
|
164
|
+
weight: sim,
|
|
165
|
+
reason: `Decision informs domain knowledge (sim: ${sim.toFixed(3)})`,
|
|
166
|
+
});
|
|
167
|
+
} catch { /* skip duplicates or self-refs */ }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Reinforce graph edges connected to a reinforced node.
|
|
174
|
+
* @param {string} nodeId
|
|
175
|
+
*/
|
|
176
|
+
function reinforceRelatedEdges(nodeId) {
|
|
177
|
+
try {
|
|
178
|
+
const edges = Graph.getNodeEdges(nodeId);
|
|
179
|
+
for (const edge of edges.slice(0, 3)) { // Top 3 edges only
|
|
180
|
+
Graph.reinforceEdge(edge.id);
|
|
181
|
+
}
|
|
182
|
+
} catch { /* non-critical */ }
|
|
183
|
+
}
|
|
184
|
+
|
|
68
185
|
// ── Event-specific capture functions ─────────────────────────────────────────
|
|
69
186
|
|
|
70
187
|
/**
|