mindforge-cc 1.0.4 → 2.0.0-alpha.4
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/CLAUDE.md +53 -0
- package/.agent/mindforge/auto.md +22 -0
- package/.agent/mindforge/browse.md +26 -0
- package/.agent/mindforge/costs.md +11 -0
- package/.agent/mindforge/cross-review.md +17 -0
- package/.agent/mindforge/execute-phase.md +5 -3
- package/.agent/mindforge/qa.md +16 -0
- package/.agent/mindforge/remember.md +14 -0
- package/.agent/mindforge/research.md +11 -0
- package/.agent/mindforge/steer.md +13 -0
- package/.agent/workflows/publish-release.md +36 -0
- package/.claude/CLAUDE.md +53 -0
- package/.claude/commands/mindforge/auto.md +22 -0
- package/.claude/commands/mindforge/browse.md +26 -0
- package/.claude/commands/mindforge/costs.md +11 -0
- package/.claude/commands/mindforge/cross-review.md +17 -0
- package/.claude/commands/mindforge/execute-phase.md +5 -3
- package/.claude/commands/mindforge/qa.md +16 -0
- package/.claude/commands/mindforge/remember.md +14 -0
- package/.claude/commands/mindforge/research.md +11 -0
- package/.claude/commands/mindforge/steer.md +13 -0
- package/.mindforge/MINDFORGE-V2-SCHEMA.json +47 -0
- package/.mindforge/browser/daemon-protocol.md +24 -0
- package/.mindforge/browser/qa-engine.md +16 -0
- package/.mindforge/browser/session-manager.md +18 -0
- package/.mindforge/browser/visual-verify-spec.md +31 -0
- package/.mindforge/engine/autonomous/auto-executor.md +266 -0
- package/.mindforge/engine/autonomous/headless-adapter.md +66 -0
- package/.mindforge/engine/autonomous/node-repair.md +190 -0
- package/.mindforge/engine/autonomous/progress-reporter.md +58 -0
- package/.mindforge/engine/autonomous/steering-manager.md +64 -0
- package/.mindforge/engine/autonomous/stuck-detector.md +89 -0
- package/.mindforge/memory/MEMORY-SCHEMA.md +155 -0
- package/.mindforge/memory/decision-library.jsonl +0 -0
- package/.mindforge/memory/engine/capture-protocol.md +36 -0
- package/.mindforge/memory/engine/global-sync-spec.md +42 -0
- package/.mindforge/memory/engine/retrieval-spec.md +44 -0
- package/.mindforge/memory/knowledge-base.jsonl +7 -0
- package/.mindforge/memory/pattern-library.jsonl +1 -0
- package/.mindforge/memory/team-preferences.jsonl +4 -0
- package/.mindforge/models/model-registry.md +48 -0
- package/.mindforge/models/model-router.md +30 -0
- package/.mindforge/personas/research-agent.md +24 -0
- package/.planning/browser-daemon.log +32 -0
- package/.planning/decisions/ADR-021-autonomy-boundary.md +17 -0
- package/.planning/decisions/ADR-022-node-repair-hierarchy.md +19 -0
- package/.planning/decisions/ADR-023-gate-3-timing.md +15 -0
- package/CHANGELOG.md +73 -0
- package/MINDFORGE.md +26 -3
- package/README.md +59 -18
- package/bin/autonomous/auto-runner.js +95 -0
- package/bin/autonomous/headless.js +36 -0
- package/bin/autonomous/progress-stream.js +49 -0
- package/bin/autonomous/repair-operator.js +213 -0
- package/bin/autonomous/steer.js +71 -0
- package/bin/autonomous/stuck-monitor.js +77 -0
- package/bin/browser/browser-daemon.js +139 -0
- package/bin/browser/daemon-manager.js +91 -0
- package/bin/browser/qa-engine.js +47 -0
- package/bin/browser/qa-report-writer.js +32 -0
- package/bin/browser/regression-writer.js +27 -0
- package/bin/browser/screenshot-store.js +49 -0
- package/bin/browser/session-manager.js +93 -0
- package/bin/browser/visual-verify-executor.js +89 -0
- package/bin/install.js +7 -6
- package/bin/installer-core.js +64 -26
- package/bin/memory/cli.js +99 -0
- package/bin/memory/global-sync.js +107 -0
- package/bin/memory/knowledge-capture.js +278 -0
- package/bin/memory/knowledge-indexer.js +172 -0
- package/bin/memory/knowledge-store.js +319 -0
- package/bin/memory/session-memory-loader.js +137 -0
- package/bin/migrations/0.1.0-to-0.5.0.js +2 -3
- package/bin/migrations/0.5.0-to-0.6.0.js +1 -1
- package/bin/migrations/0.6.0-to-1.0.0.js +3 -3
- package/bin/migrations/migrate.js +15 -11
- package/bin/models/anthropic-provider.js +77 -0
- package/bin/models/cost-tracker.js +118 -0
- package/bin/models/gemini-provider.js +79 -0
- package/bin/models/model-client.js +98 -0
- package/bin/models/model-router.js +111 -0
- package/bin/models/openai-provider.js +78 -0
- package/bin/research/research-engine.js +115 -0
- package/bin/review/cross-review-engine.js +81 -0
- package/bin/review/finding-synthesizer.js +116 -0
- package/bin/review/review-report-writer.js +49 -0
- package/bin/updater/self-update.js +13 -13
- package/bin/wizard/setup-wizard.js +2 -1
- package/docs/adr/ADR-024-browser-localhost-only.md +17 -0
- package/docs/adr/ADR-025-visual-verify-failure-treatment.md +19 -0
- package/docs/adr/ADR-026-session-persistence-security.md +20 -0
- package/docs/architecture/README.md +4 -2
- package/docs/publishing-guide.md +78 -0
- package/docs/reference/commands.md +17 -2
- package/docs/reference/sdk-api.md +6 -1
- package/docs/user-guide.md +98 -9
- package/docs/usp-features.md +56 -8
- package/package.json +3 -2
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# MindForge v2 — Stuck Detection Engine
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Identify iterative loops where the agent is making no progress but still
|
|
5
|
+
consuming tokens. This engine monitors the AUDIT.jsonl stream and triggers
|
|
6
|
+
ESCALATE when specific failure patterns (S01-S05) are detected.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Stuck patterns (Signatures)
|
|
11
|
+
|
|
12
|
+
### S01 — The Lint Loop (The "Infinite Fixer")
|
|
13
|
+
**Signature:** Multi-replace calls on the same file 3+ times with identical
|
|
14
|
+
or near-identical (Levenshtein distance < 10) `Instruction` and `TargetContent`.
|
|
15
|
+
**Verdict:** Agent is stuck in a "fix lint -> new lint -> fix lint" cycle
|
|
16
|
+
without resolving the underlying pattern.
|
|
17
|
+
**Action:** ESCALATE. "Stuck in lint loop on [file]."
|
|
18
|
+
|
|
19
|
+
### S02 — The Command Loop (The "Dead Command")
|
|
20
|
+
**Signature:** `run_command` called with identical `CommandLine` 3+ times
|
|
21
|
+
within 5 minutes, where each command returns status `done` but with
|
|
22
|
+
non-zero exit code or "command not found" stderr.
|
|
23
|
+
**Verdict:** Agent expects a command to exist and is retrying it blindly.
|
|
24
|
+
**Action:** ESCALATE. "Stuck retrying missing or failing command: [command]."
|
|
25
|
+
|
|
26
|
+
### S03 — The Dependency Loop (The "Circular Wait")
|
|
27
|
+
**Signature:** Two plans (A and B) both mark the other as a dependency in
|
|
28
|
+
the PLAN-N-MM.md files, causing the wave engine to never start either.
|
|
29
|
+
**Verdict:** Broken wave DAG.
|
|
30
|
+
**Action:** ESCALATE. "Circular dependency detected between [A] and [B]."
|
|
31
|
+
|
|
32
|
+
### S04 — The Verification Loop (The "Proofless Progress")
|
|
33
|
+
**Signature:** Path: EXECUTE → VERIFY (fails) → EXECUTE → VERIFY (fails)
|
|
34
|
+
where the `ReplacementContent` in EXECUTE is identical to the previous attempt.
|
|
35
|
+
**Verdict:** Agent is trying the same fix multiple times expecting a different result.
|
|
36
|
+
**Action:** RETRY (once with forced error injection) → DECOMPOSE.
|
|
37
|
+
If decomposition also fails this loop signature: ESCALATE.
|
|
38
|
+
|
|
39
|
+
### S05 — The Multi-Agent Collision
|
|
40
|
+
**Signature:** Two subagents in the same wave attempting to `multi_replace`
|
|
41
|
+
the same file simultaneously (Gate 1 violation detected multiple times).
|
|
42
|
+
**Verdict:** Wave planning is too aggressive or files are poorly isolated.
|
|
43
|
+
**Action:** RE-PLAN current wave. Move one of the colliding plans to the next wave.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Stuck detection logic (Monitor)
|
|
48
|
+
|
|
49
|
+
The stuck monitor runs as a sidecar process in `/mindforge:auto`.
|
|
50
|
+
It reads `.planning/AUDIT.jsonl` in real time.
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// bin/autonomous/stuck-monitor.js logic
|
|
54
|
+
const fs = require('fs');
|
|
55
|
+
|
|
56
|
+
function monitorAuditStream(auditPath) {
|
|
57
|
+
let lastPos = 0;
|
|
58
|
+
setInterval(() => {
|
|
59
|
+
const stats = fs.statSync(auditPath);
|
|
60
|
+
if (stats.size > lastPos) {
|
|
61
|
+
const newLines = readLines(auditPath, lastPos, stats.size);
|
|
62
|
+
newLines.forEach(line => {
|
|
63
|
+
const event = JSON.parse(line);
|
|
64
|
+
checkS01(event);
|
|
65
|
+
checkS02(event);
|
|
66
|
+
checkS04(event);
|
|
67
|
+
});
|
|
68
|
+
lastPos = stats.size;
|
|
69
|
+
}
|
|
70
|
+
}, 5000); // Check every 5 seconds
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Recovery protocols
|
|
77
|
+
|
|
78
|
+
When a pattern is matched:
|
|
79
|
+
|
|
80
|
+
1. **Stop the subagent** immediately if still running.
|
|
81
|
+
2. **Identify the pattern** in the progress stream.
|
|
82
|
+
3. **Execute recovery** based on pattern type:
|
|
83
|
+
- S01/S02/S03: ESCALATE (requires human to fix command/context).
|
|
84
|
+
- S04: Invoke NODE_REPAIR with `DECOMPOSE` mandatory.
|
|
85
|
+
- S05: Invoke AUTO_PLAN --adjust-waves to resolve parallelism issues.
|
|
86
|
+
4. **Write to AUDIT**:
|
|
87
|
+
```json
|
|
88
|
+
{ "event": "stuck_pattern_detected", "pattern": "S01", "file": "src/api.js" }
|
|
89
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# MindForge v2 — Knowledge Graph Schema
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The MindForge knowledge graph is built from five JSONL files — all append-only,
|
|
6
|
+
all at `.mindforge/memory/`. Every entry has a consistent base schema plus
|
|
7
|
+
type-specific fields.
|
|
8
|
+
|
|
9
|
+
## Base schema (all entry types)
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"id": "kb-uuid-v4",
|
|
14
|
+
"timestamp": "ISO-8601",
|
|
15
|
+
"type": "architectural_decision|code_pattern|bug_pattern|team_preference|domain_knowledge",
|
|
16
|
+
"topic": "Short title (≤ 80 chars)",
|
|
17
|
+
"content": "Full knowledge content (no limit)",
|
|
18
|
+
"source": "Where this was captured: 'Phase 3 retro', 'Debug session 2026-01', 'Manual entry'",
|
|
19
|
+
"project": "project-name from PROJECT.md",
|
|
20
|
+
"confidence": 0.0,
|
|
21
|
+
"tags": ["tag1", "tag2"],
|
|
22
|
+
"linked_adrs": ["ADR-007"],
|
|
23
|
+
"times_referenced": 0,
|
|
24
|
+
"last_referenced": null,
|
|
25
|
+
"deprecated": false,
|
|
26
|
+
"deprecated_by": null
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Type-specific schemas
|
|
31
|
+
|
|
32
|
+
### `architectural_decision`
|
|
33
|
+
|
|
34
|
+
Extended fields:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"decision": "Use argon2id for password hashing",
|
|
39
|
+
"rationale": "bcrypt is showing its age; argon2id is the modern standard",
|
|
40
|
+
"alternatives": ["bcrypt", "scrypt", "pbkdf2"],
|
|
41
|
+
"phase_number": 3,
|
|
42
|
+
"adr_reference": "ADR-007"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Capture trigger: Phase completion (ADR files extracted), `/mindforge:discuss-phase`
|
|
47
|
+
|
|
48
|
+
### `code_pattern`
|
|
49
|
+
|
|
50
|
+
Extended fields:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"pattern_type": "good|anti-pattern",
|
|
55
|
+
"language": "typescript",
|
|
56
|
+
"example_good": "// Code showing the correct pattern",
|
|
57
|
+
"example_bad": "// Code showing the incorrect pattern (for anti-patterns)",
|
|
58
|
+
"applies_to": ["auth", "database", "api"]
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Capture trigger: Smart compaction Block D, debug session root cause
|
|
63
|
+
|
|
64
|
+
### `bug_pattern`
|
|
65
|
+
|
|
66
|
+
Extended fields:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"bug_category": "auth|database|api|ui|performance|security",
|
|
71
|
+
"symptom": "Login works in tests but fails in production with cookie errors",
|
|
72
|
+
"root_cause": "httpOnly cookies require HTTPS; dev server was HTTP",
|
|
73
|
+
"fix": "Enable HTTPS in dev or use secure: false in development only",
|
|
74
|
+
"prevention": "Always configure cookie settings per-environment",
|
|
75
|
+
"severity_when_missed": "HIGH",
|
|
76
|
+
"recurrence_count": 1
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Capture trigger: Debug session completion, security findings, retrospective "what went wrong"
|
|
81
|
+
|
|
82
|
+
### `team_preference`
|
|
83
|
+
|
|
84
|
+
Extended fields:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"preference_type": "style|tool|process|convention|architecture",
|
|
89
|
+
"applies_when": "When implementing auth",
|
|
90
|
+
"preference": "Always use argon2id, never bcrypt. See ADR-007.",
|
|
91
|
+
"strength": "strong|moderate|weak",
|
|
92
|
+
"override_allowed": true
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Capture trigger: Retrospective "what should we keep doing", steering instructions,
|
|
97
|
+
MINDFORGE.md changes from retrospective
|
|
98
|
+
|
|
99
|
+
### `domain_knowledge`
|
|
100
|
+
|
|
101
|
+
Extended fields:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"domain": "JWT security",
|
|
106
|
+
"tech_stack": ["node.js", "typescript"],
|
|
107
|
+
"knowledge": "JWT access tokens should be short-lived (15 min). Refresh tokens in httpOnly cookies, not localStorage. Never decode JWT without verifying signature.",
|
|
108
|
+
"source_url": "https://auth0.com/docs/secure/tokens/json-web-tokens",
|
|
109
|
+
"verified_at": "2026-01-15"
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Capture trigger: Research engine output, `/mindforge:remember --add`
|
|
114
|
+
|
|
115
|
+
## Confidence scoring
|
|
116
|
+
|
|
117
|
+
Confidence (0.0–1.0) represents how strongly this knowledge should be applied:
|
|
118
|
+
|
|
119
|
+
| Confidence | Meaning | How set |
|
|
120
|
+
| :--- | :--- | :--- |
|
|
121
|
+
| 0.9–1.0 | Strong team decision — always apply | Manual entry, strong steering, ADR |
|
|
122
|
+
| 0.7–0.9 | Clear pattern — apply unless there's a reason not to | Retrospective, debug session |
|
|
123
|
+
| 0.5–0.7 | Observed pattern — consider but verify | Smart compaction Block D |
|
|
124
|
+
| 0.3–0.5 | Weak signal — informational only | Single observation |
|
|
125
|
+
| < 0.3 | Hypothesis — don't apply proactively | Auto-captured, unverified |
|
|
126
|
+
|
|
127
|
+
## Confidence reinforcement
|
|
128
|
+
|
|
129
|
+
Each time an entry is referenced (retrieved and the advice was followed):
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
confidence = min(1.0, confidence + 0.05)
|
|
133
|
+
times_referenced += 1
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Each time an entry is contradicted (a different decision was made):
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
confidence = max(0.0, confidence - 0.10)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Deprecation
|
|
143
|
+
|
|
144
|
+
When a knowledge entry becomes outdated (e.g., team switches from argon2id to Passkeys):
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"deprecated": true,
|
|
149
|
+
"deprecated_by": "kb-uuid-of-newer-entry",
|
|
150
|
+
"deprecated_reason": "Superseded by WebAuthn/Passkeys approach (ADR-031)"
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Deprecated entries are never deleted — they are excluded from active retrieval
|
|
155
|
+
but available for historical queries.
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# MindForge v2 — Knowledge Capture Protocol
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
The Capture Engine automatically extracts valuable engineering knowledge from session artifacts to ensure that project-specific wisdom is preserved beyond a single handoff.
|
|
6
|
+
|
|
7
|
+
## Capture Triggers
|
|
8
|
+
|
|
9
|
+
MindForge monitors the following lifecycle events for knowledge extraction:
|
|
10
|
+
|
|
11
|
+
1. **Phase Completion**: Extracting architectural decisions from `PROJECT.md` and phase retrospectives.
|
|
12
|
+
2. **Hardened Debugging**: Capturing "root cause -> fix" patterns from completed debug reports.
|
|
13
|
+
3. **Manual Command**: Using `/mindforge:remember --add` to explicitly record team preferences or domain knowledge.
|
|
14
|
+
4. **ADR Generation**: Parsing newly created Architecture Decision Records.
|
|
15
|
+
|
|
16
|
+
## Extraction Logic
|
|
17
|
+
|
|
18
|
+
The extraction process (via `knowledge-capture.js`) involves:
|
|
19
|
+
|
|
20
|
+
- **Structural Parsing**: Identifying standardized headings (e.g., "Decision", "Root Cause", "Pattern").
|
|
21
|
+
- **Deduplication**: Checking for existing entries with similar content to prevent knowledge bloat.
|
|
22
|
+
- **Initial Confidence**: Assigning a default confidence score (usually 0.5) to newly captured entries.
|
|
23
|
+
- **Auto-Tagging**: Inferring tags based on the file path and content context (e.g., `#nodejs`, `#security`).
|
|
24
|
+
|
|
25
|
+
## Inhibitors (What NOT to capture)
|
|
26
|
+
|
|
27
|
+
To prevent the knowledge base from becoming "noisy", the system ignores:
|
|
28
|
+
|
|
29
|
+
- Transient session state (e.g., local file counts).
|
|
30
|
+
- Intermediate debugging steps that didn't lead to a fix.
|
|
31
|
+
- Content marked with `#no-capture` or inside blocks labeled "Confidential".
|
|
32
|
+
|
|
33
|
+
## Retention Policy
|
|
34
|
+
|
|
35
|
+
- **Append-only**: Entries are never physically deleted.
|
|
36
|
+
- **Deprecation**: Outdated entries are marked as `deprecated: true` and replaced by newer entries with the same `source_id`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# MindForge v2 — Global Knowledge Sync Specification
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Allow knowledge to flow between projects via a machine-level global store.
|
|
6
|
+
Team members can promote project-specific insights to their global knowledge base,
|
|
7
|
+
which loads into every future project's session start.
|
|
8
|
+
|
|
9
|
+
## Storage locations
|
|
10
|
+
|
|
11
|
+
- **Project-local:** `.mindforge/memory/knowledge-base.jsonl` (per repo)
|
|
12
|
+
- **Global (machine):** `~/.mindforge/global-knowledge-base.jsonl` (per developer)
|
|
13
|
+
|
|
14
|
+
## Sync rules
|
|
15
|
+
|
|
16
|
+
- Promotion is MANUAL — nothing is auto-promoted to global. Use `/mindforge:remember --promote [ID]`.
|
|
17
|
+
- Loading is AUTOMATIC — global entries load at every session start if relevant.
|
|
18
|
+
- Project entries take precedence over global entries (same ID = local wins).
|
|
19
|
+
- Global entries receive a metadata flag `global: true` but are ranked alongside project entries based on relevance.
|
|
20
|
+
|
|
21
|
+
## What should be promoted to global
|
|
22
|
+
|
|
23
|
+
Good candidates for global promotion:
|
|
24
|
+
|
|
25
|
+
- Language-agnostic security practices ("always validate input before database queries")
|
|
26
|
+
- Technology-specific best practices learned through experience ("argon2id over bcrypt")
|
|
27
|
+
- Universal debugging patterns ("check the timezone mismatch before blaming async code")
|
|
28
|
+
- Cross-project architectural preferences ("Repository pattern over active record")
|
|
29
|
+
|
|
30
|
+
## Global entry metadata
|
|
31
|
+
|
|
32
|
+
When promoted to global, entries gain:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"global": true,
|
|
37
|
+
"promoted_at": "ISO-8601",
|
|
38
|
+
"promoted_from_project": "saas-app",
|
|
39
|
+
"promoted_by": "git-config-user-email",
|
|
40
|
+
"global_applicability": "all|typescript|nodejs|react|[specific]"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# MindForge v2 — Knowledge Retrieval Specification
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
The Retrieval Engine is responsible for identifying and loading the most relevant pieces of long-term memory into the current session context to improve agent performance and consistency.
|
|
6
|
+
|
|
7
|
+
## Components
|
|
8
|
+
|
|
9
|
+
- **Indexer (`knowledge-indexer.js`)**: Handles the scoring and ranking of knowledge entries.
|
|
10
|
+
- **Session Loader (`session-memory-loader.js`)**: Orchestrates the loading of relevant memories at the start of a session.
|
|
11
|
+
|
|
12
|
+
## Scoring Logic (TF-IDF + Heuristics)
|
|
13
|
+
|
|
14
|
+
Relevance is calculated using a multi-factor scoring model:
|
|
15
|
+
|
|
16
|
+
1. **Text Search (TF-IDF)**:
|
|
17
|
+
- Tokenizes the query and knowledge text.
|
|
18
|
+
- Calculates Term Frequency (TF) and Inverse Document Frequency (IDF).
|
|
19
|
+
- Entries must have a positive TF-IDF score to be considered relevant if keywords are present.
|
|
20
|
+
|
|
21
|
+
2. **Confidence & Recency**:
|
|
22
|
+
- **Confidence Score**: Boosts entries with higher confidence levels (reinforced over time).
|
|
23
|
+
- **Recency Decay**: Prefer more recent knowledge entries, especially for bug patterns.
|
|
24
|
+
|
|
25
|
+
3. **Tag Overlap**:
|
|
26
|
+
- Queries can include required tags (e.g., `#typescript`).
|
|
27
|
+
- Entries with matching tags receive a significant boost.
|
|
28
|
+
|
|
29
|
+
4. **Inhibitors**:
|
|
30
|
+
- Deprecated entries are never retrieved.
|
|
31
|
+
- Low-confidence "noise" entries are filtered out.
|
|
32
|
+
|
|
33
|
+
## Context Injection
|
|
34
|
+
|
|
35
|
+
During session start, the loader:
|
|
36
|
+
1. Performs a broad search based on the current project's primary technology stack and recent activities.
|
|
37
|
+
2. Selects the top `N` (default 5-10) most relevant entries.
|
|
38
|
+
3. Injects them into the agent's secondary context (e.g., as a dedicated "Memory context" block).
|
|
39
|
+
|
|
40
|
+
## SDK Interface
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const relevantKnowledge = await memory.query("query string", ["#tag1"], 5);
|
|
44
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{"id":"34a7925f-7361-4836-91eb-916495033861","timestamp":"2026-03-22T17:25:37.659Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9,"tags":["ui","css"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
2
|
+
{"id":"34a7925f-7361-4836-91eb-916495033861","timestamp":"2026-03-22T17:25:37.659Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9500000000000001,"tags":["ui","css"],"linked_adrs":[],"times_referenced":1,"last_referenced":"2026-03-22T17:25:37.665Z","deprecated":false,"deprecated_by":null}
|
|
3
|
+
{"id":"34a7925f-7361-4836-91eb-916495033861","timestamp":"2026-03-22T17:25:37.659Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9500000000000001,"tags":["ui","css"],"linked_adrs":[],"times_referenced":1,"last_referenced":"2026-03-22T17:25:37.665Z","deprecated":true,"deprecated_by":null,"deprecated_reason":"Switching to Vanilla CSS","deprecated_at":"2026-03-22T17:25:37.666Z"}
|
|
4
|
+
{"id":"a2d4b3a6-fdaa-4c9a-b654-286d9ea133e2","timestamp":"2026-03-22T17:25:37.670Z","type":"domain_knowledge","topic":"Auth with JWT","content":"Secure JWT with httpOnly cookies.","source":"manual","project":"[Project Name]","confidence":0.8,"tags":["auth"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
5
|
+
{"id":"6c1f0f31-3903-4b95-bae8-5473ffbec9eb","timestamp":"2026-03-22T17:25:37.671Z","type":"domain_knowledge","topic":"Database SQL","content":"Use indexed columns for fast queries.","source":"manual","project":"[Project Name]","confidence":0.7,"tags":["db"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
6
|
+
{"id":"a9878977-cb7c-4dcf-8161-760ffd5e7de9","timestamp":"2026-03-22T17:25:37.673Z","type":"code_pattern","topic":"React Memo","content":"Use React.memo to prevent re-renders.","source":"manual","project":"[Project Name]","confidence":0.6,"tags":["ui"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
7
|
+
{"id":"739dcb0a-9c4b-40d2-846b-535b7e4cb274","timestamp":"2026-03-22T17:25:51.782Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9,"tags":["ui","css"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"a9878977-cb7c-4dcf-8161-760ffd5e7de9","timestamp":"2026-03-22T17:25:37.673Z","type":"code_pattern","topic":"React Memo","content":"Use React.memo to prevent re-renders.","source":"manual","project":"[Project Name]","confidence":0.6,"tags":["ui"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{"id":"34a7925f-7361-4836-91eb-916495033861","timestamp":"2026-03-22T17:25:37.659Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9,"tags":["ui","css"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
2
|
+
{"id":"34a7925f-7361-4836-91eb-916495033861","timestamp":"2026-03-22T17:25:37.659Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9500000000000001,"tags":["ui","css"],"linked_adrs":[],"times_referenced":1,"last_referenced":"2026-03-22T17:25:37.665Z","deprecated":false,"deprecated_by":null}
|
|
3
|
+
{"id":"34a7925f-7361-4836-91eb-916495033861","timestamp":"2026-03-22T17:25:37.659Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9500000000000001,"tags":["ui","css"],"linked_adrs":[],"times_referenced":1,"last_referenced":"2026-03-22T17:25:37.665Z","deprecated":true,"deprecated_by":null,"deprecated_reason":"Switching to Vanilla CSS","deprecated_at":"2026-03-22T17:25:37.666Z"}
|
|
4
|
+
{"id":"739dcb0a-9c4b-40d2-846b-535b7e4cb274","timestamp":"2026-03-22T17:25:51.782Z","type":"team_preference","topic":"Use Tailwind","content":"Always use Tailwind for CSS.","source":"manual","project":"[Project Name]","confidence":0.9,"tags":["ui","css"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# MindForge v2 — Model Registry
|
|
2
|
+
# Version: v2.0.0-alpha.3
|
|
3
|
+
|
|
4
|
+
MindForge v2 uses a tiered multi-model architecture. Models are selected based on the task persona and difficulty tier.
|
|
5
|
+
|
|
6
|
+
## 1. Primary Reasoning Tier (Tier 1)
|
|
7
|
+
Used for complex architecture, planning, and high-stakes reasoning.
|
|
8
|
+
|
|
9
|
+
- **Anthropic Claude 3.5 Opus** (`claude-3-opus-20240229`)
|
|
10
|
+
- Strengths: Deepest reasoning, highly reliable for planning.
|
|
11
|
+
- Persona mapping: `architect`, `planner`.
|
|
12
|
+
- Setting: `PLANNER_MODEL`.
|
|
13
|
+
|
|
14
|
+
- **OpenAI GPT-4o** (`gpt-4o`)
|
|
15
|
+
- Strengths: Fast reasoning, excellent tool use, adversarial insight.
|
|
16
|
+
- Persona mapping: `reviewer`, `security-reviewer`.
|
|
17
|
+
- Setting: `REVIEWER_MODEL`.
|
|
18
|
+
|
|
19
|
+
## 2. Execution Tier (Tier 2)
|
|
20
|
+
Used for the bulk of code implementation and transformation tasks.
|
|
21
|
+
|
|
22
|
+
- **Anthropic Claude 3.5 Sonnet** (`claude-3-5-sonnet-20240620`)
|
|
23
|
+
- Strengths: Balanced speed/quality, best-in-class coding.
|
|
24
|
+
- Persona mapping: `developer`, `qa-engineer`.
|
|
25
|
+
- Setting: `EXECUTOR_MODEL`.
|
|
26
|
+
|
|
27
|
+
- **Google Gemini 1.5 Pro** (`gemini-1.5-pro`)
|
|
28
|
+
- Strengths: 1M context window, deep codebase research.
|
|
29
|
+
- Persona mapping: `research-agent`.
|
|
30
|
+
- Setting: `RESEARCH_MODEL`.
|
|
31
|
+
|
|
32
|
+
## 3. High-Security/Privacy Tier (Tier 3)
|
|
33
|
+
Used for tasks involving authentication, PII, or financial operations.
|
|
34
|
+
|
|
35
|
+
- **Anthropic Claude 3.5 Opus** (`claude-3-opus-20240229`)
|
|
36
|
+
- Setting: `SECURITY_MODEL`.
|
|
37
|
+
|
|
38
|
+
## 4. Utility/Quick Tier (Tier 4)
|
|
39
|
+
Used for low-ambiguity tasks and micro-transformations.
|
|
40
|
+
|
|
41
|
+
- **Anthropic Claude 3.5 Haiku** (`claude-3-5-haiku-20241022`)
|
|
42
|
+
- Setting: `QUICK_MODEL`.
|
|
43
|
+
|
|
44
|
+
## 5. Fallback Chain
|
|
45
|
+
If a primary model is unavailable (API key missing or 429), follow these defaults:
|
|
46
|
+
1. `gpt-4o` → `claude-3-5-sonnet`
|
|
47
|
+
2. `claude-3-opus` → `gpt-4o`
|
|
48
|
+
3. `gemini-1.5-pro` → `claude-3-5-sonnet` (limited context)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# MindForge v2 — Model Router
|
|
2
|
+
# Version: v2.0.0-alpha.3
|
|
3
|
+
|
|
4
|
+
## Routing Logic
|
|
5
|
+
|
|
6
|
+
The MindForge router resolves which model to use at task dispatch time using this algorithm:
|
|
7
|
+
|
|
8
|
+
1. **Check Persona:** Map the task `<persona>` to a setting key.
|
|
9
|
+
- `developer` → `EXECUTOR_MODEL`
|
|
10
|
+
- `architect` → `PLANNER_MODEL`
|
|
11
|
+
- `security-reviewer` → `SECURITY_MODEL`
|
|
12
|
+
- `qa-engineer` → `QA_MODEL`
|
|
13
|
+
- `research-agent` → `RESEARCH_MODEL`
|
|
14
|
+
- `debug-specialist` → `DEBUG_MODEL`
|
|
15
|
+
- `unknown` → `EXECUTOR_MODEL`
|
|
16
|
+
|
|
17
|
+
2. **Check Tier Override:**
|
|
18
|
+
- If `tier == 3` (Security/Privacy), force `SECURITY_MODEL` regardless of persona.
|
|
19
|
+
|
|
20
|
+
3. **Check Budget Bias:**
|
|
21
|
+
- If `difficulty < 2.0` and `MODEL_PREFER_CHEAP_BELOW_DIFFICULTY` is set:
|
|
22
|
+
- Use `QUICK_MODEL` instead of the resolved model.
|
|
23
|
+
|
|
24
|
+
4. **Resolve Model ID:**
|
|
25
|
+
- Read the setting key from `MINDFORGE.md`.
|
|
26
|
+
- Use baked-in defaults if not present.
|
|
27
|
+
|
|
28
|
+
5. **Verify Availability:**
|
|
29
|
+
- Check if matching `[PROVIDER]_API_KEY` is present in environment.
|
|
30
|
+
- If missing: Apply fallback chain from `model-registry.md`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Research Agent Persona
|
|
2
|
+
|
|
3
|
+
## Identity
|
|
4
|
+
You are a thorough technical research specialist with access to Gemini 2.5 Pro's
|
|
5
|
+
1-million-token context window. You are the agent called when a question requires
|
|
6
|
+
ingesting entire documentation sets, large codebases, or multiple long documents
|
|
7
|
+
simultaneously.
|
|
8
|
+
|
|
9
|
+
## Unique Capabilities
|
|
10
|
+
- **Full documentation ingestion**: Read entire library documentation before making recommendations.
|
|
11
|
+
- **Codebase archaeology**: Ingest the entire codebase to identify undocumented decisions or debt.
|
|
12
|
+
- **Regulatory completeness**: Ingest full regulation texts (GDPR, HIPAA, PCI DSS) for compliance audits.
|
|
13
|
+
|
|
14
|
+
## Output Standard
|
|
15
|
+
Every research output must have:
|
|
16
|
+
1. **Executive summary** (actionable)
|
|
17
|
+
2. **Detailed findings** (with evidence citations)
|
|
18
|
+
3. **Specific recommendations**
|
|
19
|
+
4. **Open questions**
|
|
20
|
+
5. **Sources consulted**
|
|
21
|
+
|
|
22
|
+
## Model Assignment
|
|
23
|
+
Default: `RESEARCH_MODEL` (gemini-2.5-pro)
|
|
24
|
+
Context requirement: > 500K tokens.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
node:internal/modules/cjs/loader:1459
|
|
2
|
+
throw err;
|
|
3
|
+
^
|
|
4
|
+
|
|
5
|
+
Error: Cannot find module 'playwright-core'
|
|
6
|
+
Require stack:
|
|
7
|
+
- /Users/sairamugge/Desktop/MindForge/bin/browser/browser-daemon.js
|
|
8
|
+
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
|
9
|
+
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
|
10
|
+
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
|
11
|
+
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
|
12
|
+
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
|
13
|
+
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
|
14
|
+
at require (node:internal/modules/helpers:152:16)
|
|
15
|
+
at Object.<anonymous> (/Users/sairamugge/Desktop/MindForge/bin/browser/browser-daemon.js:9:20)
|
|
16
|
+
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
|
17
|
+
at Object..js (node:internal/modules/cjs/loader:1943:10) {
|
|
18
|
+
code: 'MODULE_NOT_FOUND',
|
|
19
|
+
requireStack: [
|
|
20
|
+
'/Users/sairamugge/Desktop/MindForge/bin/browser/browser-daemon.js'
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Node.js v24.14.0
|
|
25
|
+
[daemon] Browser daemon listening on port 7338
|
|
26
|
+
[daemon] Browser daemon listening on port 7338
|
|
27
|
+
[daemon] Browser daemon listening on port 7338
|
|
28
|
+
[daemon] Browser daemon listening on port 7338
|
|
29
|
+
[daemon] Browser daemon listening on port 7338
|
|
30
|
+
[daemon] Browser daemon listening on port 7338
|
|
31
|
+
[daemon] Browser daemon listening on port 7338
|
|
32
|
+
[daemon] Browser daemon listening on port 7338
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ADR-021: Autonomy Boundary
|
|
2
|
+
|
|
3
|
+
## Status: Proposed
|
|
4
|
+
## Deciders: MindForge Architecture Team
|
|
5
|
+
## Date: 2026-03-22
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
MindForge v2 introduces an Autonomous Execution Engine. We need to define where the human's role ends and the agent's role begins to prevent loss of control while maximizing efficiency.
|
|
9
|
+
|
|
10
|
+
## Decision
|
|
11
|
+
We define the **Autonomy Boundary** as:
|
|
12
|
+
1. **Human = Mission Control**: Humans define the phase objectives, approve the initial plan, and provide mid-execution steering.
|
|
13
|
+
2. **Agent = Execution Engine**: The agent handles the mechanics of wave execution, parallel task dispatch, automated verification, and self-repair for low-risk failures.
|
|
14
|
+
|
|
15
|
+
## Consequences
|
|
16
|
+
- The agent will not ask for permission for individual tasks in a wave once the phase is started in `:auto` mode.
|
|
17
|
+
- Any decision involving security, payments, or PII (Tier 3) MUST escalate to the human, as it lies outside the autonomy boundary.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ADR-022: Node Repair Hierarchy
|
|
2
|
+
|
|
3
|
+
## Status: Proposed
|
|
4
|
+
## Deciders: MindForge Architecture Team
|
|
5
|
+
## Date: 2026-03-22
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
Tasks in autonomous mode can fail due to various reasons (timeouts, lint errors, logic bugs). Sequential retrying is often insufficient.
|
|
9
|
+
|
|
10
|
+
## Decision
|
|
11
|
+
We implement a tiered **Node Repair Hierarchy**:
|
|
12
|
+
1. **RETRY**: Re-execute the same plan with a fresh context + error injection. (Budget: 1)
|
|
13
|
+
2. **DECOMPOSE**: Split a failing multi-domain or high-token task into smaller sub-tasks.
|
|
14
|
+
3. **PRUNE**: Skip non-critical path tasks and defer them to a `DEFERRED-ITEMS.md`.
|
|
15
|
+
4. **ESCALATE**: Stop execution, save state, and notify the human.
|
|
16
|
+
|
|
17
|
+
## Consequences
|
|
18
|
+
- Increases the survival rate of autonomous sessions without human intervention for trivial errors.
|
|
19
|
+
- Ensures complex failures are handled by human experts.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# ADR-023: Gate 3 Timing
|
|
2
|
+
|
|
3
|
+
## Status: Proposed
|
|
4
|
+
## Deciders: MindForge Architecture Team
|
|
5
|
+
## Date: 2026-03-22
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
Gate 3 (Secret Detection) used to run post-wave. In autonomous mode, the agent makes multiple commits per wave. A secret committed to git history is an immediate security incident even if never pushed.
|
|
9
|
+
|
|
10
|
+
## Decision
|
|
11
|
+
Gate 3 must run **PRE-COMMIT** on the staged diff for every task in autonomous mode. If a secret pattern is detected, the commit is blocked, the changes are unstaged, and the engine ESCALATES immediately.
|
|
12
|
+
|
|
13
|
+
## Consequences
|
|
14
|
+
- Prevents accidental leakage of credentials into the local git history.
|
|
15
|
+
- Adds slight latency to the commit process, which is acceptable for the security gain.
|