$curl -o .claude/agents/neural-memory.md https://raw.githubusercontent.com/Rune-kit/rune/HEAD/agents/neural-memory.mdCross-session cognitive persistence via Neural Memory MCP. Captures decisions, patterns, errors, insights with semantic links. Bridges file-based state (session-bridge) with semantic graph.
| 1 | # neural-memory |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Bridges Rune's file-based persistence (session-bridge, journal) with Neural Memory MCP's semantic graph. While session-bridge saves decisions to `.rune/` files and journal tracks ADRs locally, neural-memory captures **cross-project learnable patterns** — decisions, error root causes, architectural insights, and workflow preferences — into a persistent cognitive layer that compounds across every project and session. |
| 6 | |
| 7 | Without this skill, each project is an island. With it, a caching pattern discovered in Project A auto-surfaces when Project B faces a similar problem. |
| 8 | |
| 9 | ## Triggers |
| 10 | |
| 11 | **Auto-trigger:** |
| 12 | - Session start → Run **Recall Mode** (load relevant context before any work) |
| 13 | - After `cook` completes a feature → Run **Capture Mode** (save learnings) |
| 14 | - After `debug` finds root cause → Run **Capture Mode** (save error pattern) |
| 15 | - After `review` finds issues → Run **Capture Mode** (save code quality insight) |
| 16 | - After `rescue` completes a phase → Run **Capture Mode** (save refactoring pattern) |
| 17 | - After `journal` writes an ADR → Run **Capture Mode** (extract to nmem) |
| 18 | - Session end / before compaction → Run **Flush Mode** (capture remaining context) |
| 19 | |
| 20 | **Manual trigger:** |
| 21 | - `/rune recall <topic>` — search neural memory for a topic |
| 22 | - `/rune remember <text>` — save a specific memory |
| 23 | - `/rune brain-health` — check neural memory health + maintenance |
| 24 | - `/rune hypothesize <question>` — start hypothesis tracking |
| 25 | |
| 26 | ## Calls (outbound) |
| 27 | |
| 28 | - `session-bridge` (L3): after Capture Mode — sync key decisions back to `.rune/` files |
| 29 | |
| 30 | ## Called By (inbound) |
| 31 | |
| 32 | - `cook` (L1): Phase 0 (resume) + Phase 8 (complete) — recall context at start, capture learnings at end |
| 33 | - `rescue` (L1): phase start + phase end — recall past refactoring patterns, capture new ones |
| 34 | - `debug` (L2): after root cause found — capture error pattern for future recognition |
| 35 | - `fix` (L2): after fix verified — capture fix pattern (cause → solution) |
| 36 | - `review` (L2): after review complete — capture code quality insight |
| 37 | - `plan` (L2): before architecture decisions — recall past decisions on similar problems |
| 38 | - `sentinel` (L2): after security finding — capture vulnerability pattern |
| 39 | - `incident` (L2): after resolution — capture incident root cause + fix |
| 40 | - `retro` (L2): during retrospective — capture retro insights and patterns |
| 41 | - `session-bridge` (L3): Step 6 (cross-project extraction) — extract generalizable patterns |
| 42 | - `journal` (L3): after ADR written — extract decision + rejected alternatives |
| 43 | - `context-engine` (L3): before compaction — trigger Flush Mode to preserve context |
| 44 | |
| 45 | ## Modes |
| 46 | |
| 47 | ### Mode 1: Recall (Session Start / Before Decisions) |
| 48 | |
| 49 | Load relevant context from neural memory before starting work. |
| 50 | |
| 51 | **Step 1 — Identify Recall Topics** |
| 52 | Read `.rune/progress.md` and current task context to determine 3-5 diverse recall topics. |
| 53 | Always prefix queries with the project name to avoid cross-project noise. |
| 54 | |
| 55 | ``` |
| 56 | GOOD: "Rune compiler cross-reference resolution" |
| 57 | GOOD: "MyTrend PocketBase auth session handling" |
| 58 | BAD: "cross-reference" (too generic, returns all projects) |
| 59 | BAD: "auth" (returns noise from every project) |
| 60 | ``` |
| 61 | |
| 62 | **Step 2 — Execute Recall** |
| 63 | Call `nmem_recall` for each topic. Use diverse angles: |
| 64 | - Technology-specific: `"<project> React state management"` |
| 65 | - Problem-specific: `"<project> caching strategy decision"` |
| 66 | - Pattern-specific: `"<project> error handling approach"` |
| 67 | |
| 68 | **Step 3 — Synthesize Context** |
| 69 | Summarize recalled memories into actionable context: |
| 70 | - Decisions that apply to current task |
| 71 | - Patterns that worked (or failed) before |
| 72 | - Constraints or preferences from past sessions |
| 73 | - Open hypotheses still being tracked |
| 74 | |
| 75 | **Step 4 — Surface Gaps** |
| 76 | If recall returns thin results for the current domain, note the gap. |
| 77 | Call `nmem_gaps(action="detect")` if working in a domain with sparse memories. |
| 78 | |
| 79 | --- |
| 80 | |
| 81 | ### Mode 2: Capture (After Task Completion) |
| 82 | |
| 83 | Extract learnable patterns from completed work and save to neural me |