@rune-kit/rune 2.1.1 → 2.2.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.
@@ -41,7 +41,7 @@ export default {
41
41
  return [
42
42
  '',
43
43
  '---',
44
- '> **Rune Skill Mesh** — 49 skills, 170+ connections',
44
+ '> **Rune Skill Mesh** — 58 skills, 200+ connections',
45
45
  '> Source: https://github.com/rune-kit/rune',
46
46
  '> Full experience with subagents, hooks, adaptive routing → use Rune on Claude Code.',
47
47
  ].join('\n');
@@ -0,0 +1,77 @@
1
+ /**
2
+ * OpenAI Codex Adapter
3
+ *
4
+ * Emits SKILL.md files into .codex/skills/{name}/ directories.
5
+ * Codex uses the same SKILL.md frontmatter format (name, description)
6
+ * with markdown body — very close to Rune's native format.
7
+ *
8
+ * Codex project context: AGENTS.md (equivalent to CLAUDE.md)
9
+ * Codex skills dir: .codex/skills/
10
+ * Codex skill format: .codex/skills/{name}/SKILL.md
11
+ */
12
+
13
+ const TOOL_MAP = {
14
+ Read: 'read the file',
15
+ Write: 'write/create the file',
16
+ Edit: 'edit the file',
17
+ Glob: 'find files by pattern',
18
+ Grep: 'search file contents',
19
+ Bash: 'run a shell command',
20
+ TodoWrite: 'track task progress',
21
+ Skill: 'follow the referenced skill',
22
+ Agent: 'execute the workflow',
23
+ };
24
+
25
+ export default {
26
+ name: 'codex',
27
+ outputDir: '.codex/skills',
28
+ fileExtension: '.md',
29
+ skillPrefix: 'rune-',
30
+ skillSuffix: '',
31
+
32
+ // Codex uses directory-per-skill: .codex/skills/{name}/SKILL.md
33
+ useSkillDirectories: true,
34
+ skillFileName: 'SKILL.md',
35
+
36
+ transformReference(skillName, raw) {
37
+ const isBackticked = raw.startsWith('`') && raw.endsWith('`');
38
+ const ref = `the rune-${skillName} skill`;
39
+ return isBackticked ? `\`${ref}\`` : ref;
40
+ },
41
+
42
+ transformToolName(toolName) {
43
+ return TOOL_MAP[toolName] || toolName;
44
+ },
45
+
46
+ generateHeader(skill) {
47
+ const desc = (skill.description || '').replace(/"/g, '\\"');
48
+ return [
49
+ '---',
50
+ `name: rune-${skill.name}`,
51
+ `description: "${desc}"`,
52
+ '---',
53
+ '',
54
+ '',
55
+ ].join('\n');
56
+ },
57
+
58
+ generateFooter() {
59
+ return [
60
+ '',
61
+ '---',
62
+ '> **Rune Skill Mesh** — 58 skills, 200+ connections',
63
+ '> Source: https://github.com/rune-kit/rune',
64
+ '> Full experience with subagents, hooks, adaptive routing → use Rune on Claude Code.',
65
+ ].join('\n');
66
+ },
67
+
68
+ transformSubagentInstruction(text) {
69
+ return text;
70
+ },
71
+
72
+ postProcess(content) {
73
+ return content
74
+ .replace(/^context: fork\n/gm, '')
75
+ .replace(/^agent: general-purpose\n/gm, '');
76
+ },
77
+ };
@@ -49,7 +49,7 @@ export default {
49
49
  return [
50
50
  '',
51
51
  '---',
52
- '> **Rune Skill Mesh** — 49 skills, 170+ connections',
52
+ '> **Rune Skill Mesh** — 58 skills, 200+ connections',
53
53
  '> Source: https://github.com/rune-kit/rune',
54
54
  '> Full experience with subagents, hooks, adaptive routing → use Rune on Claude Code.',
55
55
  ].join('\n');
@@ -42,7 +42,7 @@ export default {
42
42
  return [
43
43
  '',
44
44
  '---',
45
- '> **Rune Skill Mesh** — 49 skills, 170+ connections',
45
+ '> **Rune Skill Mesh** — 58 skills, 200+ connections',
46
46
  '> Source: https://github.com/rune-kit/rune',
47
47
  '> Full experience with subagents, hooks, adaptive routing → use Rune on Claude Code.',
48
48
  ].join('\n');
@@ -10,6 +10,8 @@ import windsurf from './windsurf.js';
10
10
  import antigravity from './antigravity.js';
11
11
  import generic from './generic.js';
12
12
  import openclaw from './openclaw.js';
13
+ import codex from './codex.js';
14
+ import opencode from './opencode.js';
13
15
 
14
16
  const adapters = {
15
17
  claude,
@@ -18,6 +20,8 @@ const adapters = {
18
20
  antigravity,
19
21
  generic,
20
22
  openclaw,
23
+ codex,
24
+ opencode,
21
25
  };
22
26
 
23
27
  /**
@@ -0,0 +1,86 @@
1
+ /**
2
+ * OpenCode Adapter
3
+ *
4
+ * Emits SKILL.md files into .opencode/skills/{name}/ directories.
5
+ * OpenCode uses the same SKILL.md frontmatter format (name, description)
6
+ * with markdown body — identical to Codex pattern.
7
+ *
8
+ * OpenCode project context: AGENTS.md (+ CLAUDE.md fallback)
9
+ * OpenCode skills dir: .opencode/skills/
10
+ * OpenCode skill format: .opencode/skills/{name}/SKILL.md
11
+ * OpenCode agents dir: .opencode/agents/
12
+ *
13
+ * OpenCode also searches:
14
+ * .claude/skills/{name}/SKILL.md (Claude-compatible)
15
+ * .agents/skills/{name}/SKILL.md (agent-compatible)
16
+ *
17
+ * @see https://opencode.ai/docs/skills/
18
+ * @see https://opencode.ai/docs/agents/
19
+ */
20
+
21
+ const TOOL_MAP = {
22
+ Read: 'read the file',
23
+ Write: 'write/create the file',
24
+ Edit: 'edit the file',
25
+ Glob: 'find files by pattern',
26
+ Grep: 'search file contents',
27
+ Bash: 'run a shell command',
28
+ TodoWrite: 'track task progress',
29
+ Skill: 'invoke the named skill',
30
+ Agent: 'delegate to a subagent',
31
+ };
32
+
33
+ export default {
34
+ name: 'opencode',
35
+ outputDir: '.opencode/skills',
36
+ fileExtension: '.md',
37
+ skillPrefix: 'rune-',
38
+ skillSuffix: '',
39
+
40
+ // OpenCode uses directory-per-skill: .opencode/skills/{name}/SKILL.md
41
+ useSkillDirectories: true,
42
+ skillFileName: 'SKILL.md',
43
+
44
+ transformReference(skillName, raw) {
45
+ const isBackticked = raw.startsWith('`') && raw.endsWith('`');
46
+ const ref = `the rune-${skillName} skill`;
47
+ return isBackticked ? `\`${ref}\`` : ref;
48
+ },
49
+
50
+ transformToolName(toolName) {
51
+ return TOOL_MAP[toolName] || toolName;
52
+ },
53
+
54
+ generateHeader(skill) {
55
+ const desc = (skill.description || '').replace(/"/g, '\\"');
56
+ return [
57
+ '---',
58
+ `name: rune-${skill.name}`,
59
+ `description: "${desc}"`,
60
+ '---',
61
+ '',
62
+ '',
63
+ ].join('\n');
64
+ },
65
+
66
+ generateFooter() {
67
+ return [
68
+ '',
69
+ '---',
70
+ '> **Rune Skill Mesh** — 58 skills, 200+ connections',
71
+ '> Source: https://github.com/rune-kit/rune',
72
+ '> Full experience with subagents, hooks, adaptive routing → use Rune on Claude Code.',
73
+ ].join('\n');
74
+ },
75
+
76
+ transformSubagentInstruction(text) {
77
+ // OpenCode has native subagent support — preserve parallel agent instructions
78
+ return text;
79
+ },
80
+
81
+ postProcess(content) {
82
+ return content
83
+ .replace(/^context: fork\n/gm, '')
84
+ .replace(/^agent: general-purpose\n/gm, '');
85
+ },
86
+ };
@@ -42,7 +42,7 @@ export default {
42
42
  return [
43
43
  '',
44
44
  '---',
45
- '> **Rune Skill Mesh** — 49 skills, 170+ connections',
45
+ '> **Rune Skill Mesh** — 58 skills, 200+ connections',
46
46
  '> Source: https://github.com/rune-kit/rune',
47
47
  '> Full experience with subagents, hooks, adaptive routing → use Rune on Claude Code.',
48
48
  ].join('\n');
@@ -46,6 +46,8 @@ function detectPlatform(projectRoot) {
46
46
  if (existsSync(path.join(projectRoot, '.windsurf'))) return 'windsurf';
47
47
  if (existsSync(path.join(projectRoot, '.agent'))) return 'antigravity';
48
48
  if (existsSync(path.join(projectRoot, '.openclaw'))) return 'openclaw';
49
+ if (existsSync(path.join(projectRoot, '.codex'))) return 'codex';
50
+ if (existsSync(path.join(projectRoot, '.opencode'))) return 'opencode';
49
51
  return null;
50
52
  }
51
53
 
@@ -159,7 +161,7 @@ async function cmdBuild(projectRoot, args) {
159
161
 
160
162
  const adapter = getAdapter(platform);
161
163
  const runeRoot = config?.source || RUNE_ROOT;
162
- const outputRoot = args.output || projectRoot;
164
+ const outputRoot = typeof args.output === 'string' ? args.output : projectRoot;
163
165
  const disabledSkills = config?.skills?.disabled || [];
164
166
  const enabledPacks = config?.extensions?.enabled || null;
165
167
 
@@ -220,6 +222,9 @@ async function cmdDoctor(projectRoot, args) {
220
222
 
221
223
  // ─── Arg Parsing ───
222
224
 
225
+ // Flags that require a string value (not boolean)
226
+ const VALUE_REQUIRED_FLAGS = new Set(['platform', 'output', 'disable', 'extensions']);
227
+
223
228
  function parseArgs(argv) {
224
229
  const args = {};
225
230
  const positional = [];
@@ -232,6 +237,9 @@ function parseArgs(argv) {
232
237
  if (next && !next.startsWith('--')) {
233
238
  args[key] = next;
234
239
  i++;
240
+ } else if (VALUE_REQUIRED_FLAGS.has(key)) {
241
+ log(` ✗ Flag --${key} requires a value. Example: --${key} <value>`);
242
+ process.exit(1);
235
243
  } else {
236
244
  args[key] = true;
237
245
  }
@@ -271,7 +279,7 @@ async function main() {
271
279
  log(' doctor Validate compiled output');
272
280
  log('');
273
281
  log(' Options:');
274
- log(' --platform <name> Override platform (cursor, windsurf, antigravity, openclaw, generic)');
282
+ log(' --platform <name> Override platform (cursor, windsurf, antigravity, codex, openclaw, opencode, generic)');
275
283
  log(' --output <dir> Override output directory');
276
284
  log(' --disable <skills> Comma-separated skills to disable');
277
285
  log('');
@@ -124,15 +124,29 @@ export async function buildAll({ runeRoot, outputRoot, adapter, disabledSkills =
124
124
 
125
125
  const { header, body, footer } = transformSkill(parsed, adapter);
126
126
  const output = [header, body, footer].filter(Boolean).join('\n');
127
- const fileName = outputFileName(parsed.name, adapter);
128
- const outputPath = path.join(outputDir, fileName);
127
+
128
+ let outputPath;
129
+ let displayName;
130
+
131
+ if (adapter.useSkillDirectories) {
132
+ // Directory-per-skill: .codex/skills/rune-{name}/SKILL.md
133
+ const dirName = `${adapter.skillPrefix}${parsed.name}`;
134
+ const skillDir = path.join(outputDir, dirName);
135
+ await mkdir(skillDir, { recursive: true });
136
+ outputPath = path.join(skillDir, adapter.skillFileName || 'SKILL.md');
137
+ displayName = `${dirName}/${adapter.skillFileName || 'SKILL.md'}`;
138
+ } else {
139
+ const fileName = outputFileName(parsed.name, adapter);
140
+ outputPath = path.join(outputDir, fileName);
141
+ displayName = fileName;
142
+ }
129
143
 
130
144
  await writeFile(outputPath, output, 'utf-8');
131
145
 
132
146
  stats.skillCount++;
133
147
  stats.crossRefsResolved += parsed.crossRefs.length;
134
148
  stats.toolRefsResolved += parsed.toolRefs.length;
135
- stats.files.push(fileName);
149
+ stats.files.push(displayName);
136
150
  } catch (err) {
137
151
  stats.errors.push({ file: skillPath, error: err.message });
138
152
  }
@@ -143,16 +157,33 @@ export async function buildAll({ runeRoot, outputRoot, adapter, disabledSkills =
143
157
  try {
144
158
  const content = await readFile(packPath, 'utf-8');
145
159
  const parsed = parsePack(content, packPath);
160
+ const packName = path.basename(path.dirname(packPath));
161
+
162
+ // Normalize pack name for headers (ext-trading instead of @rune/trading)
163
+ parsed.name = `ext-${packName}`;
164
+
146
165
  const { header, body, footer } = transformSkill(parsed, adapter);
147
166
  const output = [header, body, footer].filter(Boolean).join('\n');
148
- const packName = path.basename(path.dirname(packPath));
149
- const fileName = outputFileName(`ext-${packName}`, adapter);
150
- const outputPath = path.join(outputDir, fileName);
167
+
168
+ let outputPath;
169
+ let displayName;
170
+
171
+ if (adapter.useSkillDirectories) {
172
+ const dirName = `${adapter.skillPrefix}ext-${packName}`;
173
+ const packDir = path.join(outputDir, dirName);
174
+ await mkdir(packDir, { recursive: true });
175
+ outputPath = path.join(packDir, adapter.skillFileName || 'SKILL.md');
176
+ displayName = `${dirName}/${adapter.skillFileName || 'SKILL.md'}`;
177
+ } else {
178
+ const fileName = outputFileName(`ext-${packName}`, adapter);
179
+ outputPath = path.join(outputDir, fileName);
180
+ displayName = fileName;
181
+ }
151
182
 
152
183
  await writeFile(outputPath, output, 'utf-8');
153
184
 
154
185
  stats.packCount++;
155
- stats.files.push(fileName);
186
+ stats.files.push(displayName);
156
187
  } catch (err) {
157
188
  stats.errors.push({ file: packPath, error: err.message });
158
189
  }
@@ -221,12 +252,12 @@ function generateIndex(stats, adapter) {
221
252
  '## Core Skills',
222
253
  '',
223
254
  ...stats.files
224
- .filter(f => !f.includes('ext-') && !f.includes('index'))
255
+ .filter(f => !f.match(/[-/]ext-/) && !f.includes('index'))
225
256
  .map(f => `- ${f}`),
226
257
  '',
227
258
  ];
228
259
 
229
- const extFiles = stats.files.filter(f => f.includes('ext-'));
260
+ const extFiles = stats.files.filter(f => f.match(/[-/]ext-/));
230
261
  if (extFiles.length > 0) {
231
262
  lines.push('## Extension Packs', '', ...extFiles.map(f => `- ${f}`), '');
232
263
  }
@@ -197,6 +197,7 @@ export function parsePack(content, filePath = '') {
197
197
  description: frontmatter.description || '',
198
198
  version: frontmatter.version || '1.0.0',
199
199
  layer: 'L4',
200
+ group: 'extension',
200
201
  body,
201
202
  crossRefs: extractCrossRefs(body),
202
203
  toolRefs: extractToolRefs(body),
@@ -7,7 +7,7 @@
7
7
  const DEFAULT_FOOTER = [
8
8
  '',
9
9
  '---',
10
- '> **Rune Skill Mesh** — 49 skills, 170+ connections',
10
+ '> **Rune Skill Mesh** — 58 skills, 200+ connections',
11
11
  '> Source: https://github.com/rune-kit/rune',
12
12
  '> For the full experience with subagents, hooks, adaptive routing, and mesh analytics — use Rune as a Claude Code plugin.',
13
13
  ].join('\n');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rune-kit/rune",
3
- "version": "2.1.1",
4
- "description": "57-skill mesh for AI coding assistants — 5-layer architecture, 200+ connections, all platforms (Claude Code, Cursor, Windsurf, Antigravity)",
3
+ "version": "2.2.0",
4
+ "description": "58-skill mesh for AI coding assistants — 5-layer architecture, 200+ connections, 8 platforms (Claude Code, Cursor, Windsurf, Antigravity, Codex, OpenCode, OpenClaw, Generic)",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "rune": "./compiler/bin/rune.js"
@@ -16,6 +16,9 @@
16
16
  "cursor",
17
17
  "windsurf",
18
18
  "antigravity",
19
+ "codex",
20
+ "opencode",
21
+ "openclaw",
19
22
  "ai-assistant",
20
23
  "ai-coding",
21
24
  "skills",
@@ -170,6 +170,8 @@ This phase is lightweight — a Read + pattern match, not a full scan. It does N
170
170
 
171
171
  **Goal**: Detect if a master plan already exists for this task. If so, skip Phase 1-2 and resume from the current phase.
172
172
 
173
+ **Step 0.5 — Cross-Project Recall**: Call `neural-memory` (Recall Mode) with 3-5 topics relevant to the current task. Load applicable patterns, past decisions, and error history from neural memory. Always prefix queries with the project name to avoid cross-project noise (e.g., `"ProjectName auth pattern"` not just `"auth pattern"`). This activates neurons from past sessions and surfaces context that may not be in the local `.rune/` files.
174
+
173
175
  1. Use `Glob` to check for `.rune/plan-*.md` files
174
176
  2. If a master plan exists that matches the current task:
175
177
  - Read the master plan file
@@ -470,7 +472,8 @@ This is OPT-IN — only activate if:
470
472
  - If Phase 4 had 3 debug-fix loops (max) for a specific error pattern, write a routing override to `.rune/metrics/routing-overrides.json`:
471
473
  - Format: `{ "id": "r-<timestamp>", "condition": "<error pattern>", "action": "route to problem-solver before debug", "source": "auto", "active": true }`
472
474
  - Max 10 active rules — if exceeded, remove oldest inactive rule
473
- 7. Mark Phase 8 as `completed`
475
+ 7. **Step 8.5 Capture Learnings**: Call `neural-memory` (Capture Mode). Save 2-5 memories covering: architecture decisions made this session, patterns introduced or validated, errors encountered and their root-cause fixes, and any trade-offs chosen. Use rich cognitive language (causal, decisional, comparative — not flat facts). Tag each memory with `[project-name, technology, topic]`. Priority: 5 for routine patterns, 7-8 for key decisions, 9-10 for critical errors. Do NOT batch — save each memory immediately. Do NOT wait for the user to ask.
476
+ 8. Mark Phase 8 as `completed`
474
477
 
475
478
  ## Autonomous Loop Patterns
476
479
 
@@ -530,6 +533,7 @@ If any exit condition triggers without resolution → cook emits `BLOCKED` statu
530
533
 
531
534
  ## Calls (outbound)
532
535
 
536
+ - `neural-memory` (external): Phase 0 (resume) + Phase 8 (complete) — Recall project context at start, capture learnings at end
533
537
  - `sentinel-env` (L3): Phase 0.5 — environment pre-flight (first run only)
534
538
  - `scout` (L2): Phase 1 — scan codebase before planning
535
539
  - `onboard` (L2): Phase 1 — if no CLAUDE.md exists, initialize project context first
@@ -42,6 +42,7 @@ If root cause cannot be identified after 3 hypothesis cycles:
42
42
  - `problem-solver` (L3): structured reasoning (5 Whys, Fishbone) for complex bugs
43
43
  - `browser-pilot` (L3): capture browser console errors, network failures, visual bugs
44
44
  - `sequential-thinking` (L3): multi-variable root cause analysis
45
+ - `neural-memory` (L3): after root cause found — capture error pattern for future recognition
45
46
 
46
47
  ## Called By (inbound)
47
48
 
@@ -130,6 +131,10 @@ Narrow to the single actual cause.
130
131
  - Identify the specific file, line number, and code construct responsible
131
132
  - Note any contributing factors (environment, data, timing, config)
132
133
 
134
+ ### Step 5b: Capture Error Pattern
135
+
136
+ Call `neural-memory` (Capture Mode) to save the error pattern: root cause, symptoms, and fix approach. Tag with [project-name, error, technology].
137
+
133
138
  ### Step 6: 3-Fix Escalation Rule
134
139
 
135
140
  <HARD-GATE>
@@ -38,6 +38,7 @@ If unsure whether the test is wrong or the implementation is wrong → call `run
38
38
  - `docs-seeker` (L3): check correct API usage before applying changes
39
39
  - `hallucination-guard` (L3): verify imports after code changes
40
40
  - `scout` (L2): find related code before applying changes
41
+ - `neural-memory` (L3): after fix verified — capture fix pattern (cause → solution)
41
42
 
42
43
  ## Called By (inbound)
43
44
 
@@ -119,6 +120,10 @@ Verify correctness of the changes just made.
119
120
  - Call `rune:docs-seeker` if any external API, library method, or SDK call was added or changed
120
121
  - For complex or risky fixes (auth, data mutation, async logic): call `rune:review` for a full quality check
121
122
 
123
+ ### Step 6b: Capture Fix Pattern
124
+
125
+ Call `neural-memory` (Capture Mode) to save the fix pattern: what broke, why, and how it was fixed. Priority 7 for recurring bugs.
126
+
122
127
  ### Step 7: Report
123
128
 
124
129
  Produce a structured summary of all changes made.
@@ -0,0 +1,362 @@
1
+ ---
2
+ name: neural-memory
3
+ description: "Cross-session cognitive persistence via Neural Memory MCP. Captures decisions, patterns, errors, and insights with rich semantic links. Provides recall, hypothesis tracking, and evidence-based reasoning across projects."
4
+ metadata:
5
+ author: rune-kit
6
+ version: 0.1.0
7
+ layer: L3
8
+ model: haiku
9
+ group: state
10
+ tools:
11
+ - mcp__neural-memory__nmem_remember
12
+ - mcp__neural-memory__nmem_recall
13
+ - mcp__neural-memory__nmem_auto
14
+ - mcp__neural-memory__nmem_hypothesize
15
+ - mcp__neural-memory__nmem_evidence
16
+ - mcp__neural-memory__nmem_predict
17
+ - mcp__neural-memory__nmem_verify
18
+ - mcp__neural-memory__nmem_edit
19
+ - mcp__neural-memory__nmem_forget
20
+ - mcp__neural-memory__nmem_health
21
+ - mcp__neural-memory__nmem_consolidate
22
+ - mcp__neural-memory__nmem_explain
23
+ - mcp__neural-memory__nmem_gaps
24
+ - mcp__neural-memory__nmem_stats
25
+ - mcp__neural-memory__nmem_review
26
+ - mcp__neural-memory__nmem_cognitive
27
+ - Read
28
+ - Grep
29
+ ---
30
+
31
+ # neural-memory
32
+
33
+ ## Purpose
34
+
35
+ 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.
36
+
37
+ 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.
38
+
39
+ ## Triggers
40
+
41
+ **Auto-trigger:**
42
+ - Session start → Run **Recall Mode** (load relevant context before any work)
43
+ - After `cook` completes a feature → Run **Capture Mode** (save learnings)
44
+ - After `debug` finds root cause → Run **Capture Mode** (save error pattern)
45
+ - After `review` finds issues → Run **Capture Mode** (save code quality insight)
46
+ - After `rescue` completes a phase → Run **Capture Mode** (save refactoring pattern)
47
+ - After `journal` writes an ADR → Run **Capture Mode** (extract to nmem)
48
+ - Session end / before compaction → Run **Flush Mode** (capture remaining context)
49
+
50
+ **Manual trigger:**
51
+ - `/rune recall <topic>` — search neural memory for a topic
52
+ - `/rune remember <text>` — save a specific memory
53
+ - `/rune brain-health` — check neural memory health + maintenance
54
+ - `/rune hypothesize <question>` — start hypothesis tracking
55
+
56
+ ## Calls (outbound)
57
+
58
+ | Skill | When | Why |
59
+ |-------|------|-----|
60
+ | `session-bridge` | After Capture Mode | Sync key decisions back to `.rune/` files |
61
+
62
+ ## Called By (inbound)
63
+
64
+ | Skill | When | Why |
65
+ |-------|------|-----|
66
+ | `cook` | Phase 0 (resume) + Phase 8 (complete) | Recall project context at start, capture learnings at end |
67
+ | `debug` | After root cause found | Capture error pattern for future recognition |
68
+ | `fix` | After fix verified | Capture fix pattern (cause → solution) |
69
+ | `review` | After review complete | Capture code quality insight |
70
+ | `rescue` | Phase start + phase end | Recall past refactoring patterns, capture new ones |
71
+ | `plan` | Before architecture decisions | Recall past decisions on similar problems |
72
+ | `session-bridge` | Step 6 (cross-project extraction) | Extract generalizable patterns to nmem |
73
+ | `journal` | After ADR written | Extract decision + rejected alternatives to nmem |
74
+ | `context-engine` | Before compaction | Trigger Flush Mode to preserve context |
75
+ | `sentinel` | After security finding | Capture vulnerability pattern |
76
+ | `incident` | After resolution | Capture incident root cause + fix |
77
+
78
+ ## Modes
79
+
80
+ ### Mode 1: Recall (Session Start / Before Decisions)
81
+
82
+ Load relevant context from neural memory before starting work.
83
+
84
+ **Step 1 — Identify Recall Topics**
85
+ Read `.rune/progress.md` and current task context to determine 3-5 diverse recall topics.
86
+ Always prefix queries with the project name to avoid cross-project noise.
87
+
88
+ ```
89
+ GOOD: "Rune compiler cross-reference resolution"
90
+ GOOD: "MyTrend PocketBase auth session handling"
91
+ BAD: "cross-reference" (too generic, returns all projects)
92
+ BAD: "auth" (returns noise from every project)
93
+ ```
94
+
95
+ **Step 2 — Execute Recall**
96
+ Call `nmem_recall` for each topic. Use diverse angles:
97
+ - Technology-specific: `"<project> React state management"`
98
+ - Problem-specific: `"<project> caching strategy decision"`
99
+ - Pattern-specific: `"<project> error handling approach"`
100
+
101
+ **Step 3 — Synthesize Context**
102
+ Summarize recalled memories into actionable context:
103
+ - Decisions that apply to current task
104
+ - Patterns that worked (or failed) before
105
+ - Constraints or preferences from past sessions
106
+ - Open hypotheses still being tracked
107
+
108
+ **Step 4 — Surface Gaps**
109
+ If recall returns thin results for the current domain, note the gap.
110
+ Call `nmem_gaps(action="detect")` if working in a domain with sparse memories.
111
+
112
+ ---
113
+
114
+ ### Mode 2: Capture (After Task Completion)
115
+
116
+ Extract learnable patterns from completed work and save to neural memory.
117
+
118
+ **Step 1 — Classify What Happened**
119
+ Determine which memory types to create from the completed task:
120
+
121
+ | What happened | Memory type | Priority | Example |
122
+ |---------------|-------------|----------|---------|
123
+ | Chose approach A over B | `decision` | 7 | "Chose Zustand over Redux because single-store simpler for this scale" |
124
+ | Found and fixed a bug | `error` | 7 | "Root cause was stale closure in useEffect — fixed by adding dep array" |
125
+ | Discovered a reusable pattern | `insight` | 6 | "This codebase uses barrel exports for every feature module" |
126
+ | Learned user preference | `preference` | 8 | "User prefers Phosphor Icons over Lucide for all UI work" |
127
+ | Established a workflow | `workflow` | 6 | "Deploy: build → test → push → verify CI → tag" |
128
+ | Found a fact worth keeping | `fact` | 5 | "API rate limit is 100 req/min on free tier" |
129
+ | Received instruction to follow | `instruction` | 8 | "Always run prettier before commit in this project" |
130
+
131
+ **Step 2 — Craft Rich Memories**
132
+ Each memory MUST use cognitive language patterns for strong neural connections:
133
+
134
+ ```
135
+ BAD: "PostgreSQL" (flat, no context — orphan neuron)
136
+ GOOD: "Chose PostgreSQL over MongoDB because ACID needed for payment processing"
137
+
138
+ BAD: "Fixed auth bug" (no root cause — useless for future recall)
139
+ GOOD: "Auth cookie expired silently because SameSite=Lax blocked cross-origin. Fixed by setting SameSite=None + Secure flag"
140
+
141
+ BAD: "React project structure" (vague — won't match specific queries)
142
+ GOOD: "Rune compiler uses 3-stage pipeline: Parse SKILL.md → Transform cross-refs → Emit per-platform files"
143
+ ```
144
+
145
+ **Cognitive patterns to use:**
146
+ - **Causal**: "X caused Y because Z", "Root cause was X which led to Y"
147
+ - **Temporal**: "After upgrading to v3, the middleware broke because of new cookie format"
148
+ - **Decisional**: "Chose X over Y because Z", "Rejected X due to Y"
149
+ - **Comparative**: "X is 3x faster than Y for read-heavy workloads"
150
+ - **Relational**: "X depends on Y", "X replaced Y", "X connects to Y through Z"
151
+
152
+ **Step 3 — Tag and Prioritize**
153
+ Every memory MUST include:
154
+ - **Tags**: `[project-name, technology, topic]` — lowercase, specific
155
+ - **Priority**: 5 (normal), 7-8 (important decisions/errors), 9-10 (critical security/breaking)
156
+ - **Max length**: 1-3 sentences. If longer, split into focused pieces.
157
+
158
+ **Step 4 — Save Memories**
159
+ Call `nmem_remember` for each memory. Save 2-5 memories per completed task:
160
+ - A bug fix has: root cause, fix approach, prevention insight
161
+ - A feature has: architecture decision, pattern used, trade-off made
162
+ - A review has: quality issue found, fix suggestion, pattern to avoid
163
+
164
+ **Step 5 — Reinforce Connections**
165
+ After saving, call `nmem_recall` on the topic to reinforce new neural connections.
166
+ This activates related neurons and strengthens the memory graph.
167
+
168
+ ---
169
+
170
+ ### Mode 3: Hypothesis Tracking
171
+
172
+ Track uncertain decisions with evidence over time.
173
+
174
+ **Step 1 — Form Hypothesis**
175
+ When making an uncertain architectural or design decision:
176
+ ```
177
+ nmem_hypothesize("Redis will handle our session load better than Memcached
178
+ because our access pattern is 80% reads with complex data types")
179
+ ```
180
+
181
+ **Step 2 — Collect Evidence**
182
+ As you work, update the hypothesis with evidence:
183
+ ```
184
+ nmem_evidence(hypothesis_id, "Redis handled 10K concurrent sessions with
185
+ p99 < 5ms in load test — SUPPORTS hypothesis")
186
+
187
+ nmem_evidence(hypothesis_id, "Memory usage 2x higher than Memcached estimate
188
+ — WEAKENS hypothesis for memory-constrained deployments")
189
+ ```
190
+
191
+ **Step 3 — Make Predictions**
192
+ Create falsifiable predictions:
193
+ ```
194
+ nmem_predict("If we switch to Redis Cluster, session failover time will drop
195
+ from 30s to < 2s")
196
+ ```
197
+
198
+ **Step 4 — Verify Outcomes**
199
+ After deployment/testing, verify:
200
+ ```
201
+ nmem_verify(prediction_id, outcome="Failover time dropped to 1.2s — CONFIRMED")
202
+ ```
203
+
204
+ ---
205
+
206
+ ### Mode 4: Flush (Session End / Pre-Compaction)
207
+
208
+ Capture remaining context before session ends.
209
+
210
+ **Step 1 — Scan Unsaved Context**
211
+ Review the current session for:
212
+ - Decisions made but not yet captured
213
+ - Errors encountered and their resolutions
214
+ - Patterns discovered during exploration
215
+ - User preferences expressed
216
+
217
+ **Step 2 — Batch Save**
218
+ Call `nmem_auto(action="process", text="<session summary>")` with a concise summary
219
+ of the session's key outcomes, decisions, and learnings.
220
+
221
+ **Step 3 — Update Session Bridge**
222
+ If significant decisions were captured, also call `session-bridge` to sync
223
+ the most important ones to `.rune/decisions.md` for local persistence.
224
+
225
+ ---
226
+
227
+ ### Mode 5: Maintenance (Weekly / On-Demand)
228
+
229
+ Keep the neural memory healthy and useful.
230
+
231
+ **Step 1 — Health Check**
232
+ Call `nmem_health()` to assess brain status. Key metrics:
233
+ - Consolidation % (low = run consolidation)
234
+ - Orphan % (>20% = prune disconnected memories)
235
+ - Activation levels (low = recall more diverse topics)
236
+ - Connectivity (low = use richer cognitive language)
237
+ - Diversity (low = vary memory types)
238
+
239
+ **Step 2 — Consolidation**
240
+ If brain has >100 memories or consolidation is low:
241
+ ```
242
+ nmem_consolidate — merge episodic → semantic memories
243
+ ```
244
+
245
+ **Step 3 — Review Queue**
246
+ Call `nmem_review(action="queue")` to surface memories needing attention:
247
+ - Outdated decisions that may no longer apply
248
+ - Low-confidence memories that need evidence
249
+ - Wall-of-text memories (>500 chars) that should be split
250
+
251
+ **Step 4 — Corrections**
252
+ Fix bad memories:
253
+ - Wrong type → `nmem_edit(memory_id, type="correct_type")`
254
+ - Wrong content → `nmem_edit(memory_id, content="corrected text")`
255
+ - Outdated → `nmem_forget(memory_id, reason="outdated")`
256
+ - Sensitive/garbage → `nmem_forget(memory_id, hard=true)`
257
+
258
+ **Step 5 — Connection Tracing**
259
+ Use `nmem_explain(entity_a, entity_b)` to trace paths between concepts.
260
+ Useful for understanding why certain memories surface together.
261
+
262
+ ## Output Format
263
+
264
+ ### Recall Report
265
+ ```
266
+ ## Neural Memory Recall — <project>
267
+
268
+ ### Loaded Context
269
+ - <memory 1 summary — decision/pattern/insight>
270
+ - <memory 2 summary>
271
+ - <memory 3 summary>
272
+
273
+ ### Applicable to Current Task
274
+ - <how memory X applies>
275
+ - <how memory Y applies>
276
+
277
+ ### Gaps Detected
278
+ - <domain with sparse coverage>
279
+ ```
280
+
281
+ ### Capture Report
282
+ ```
283
+ ## Neural Memory Capture — <task summary>
284
+
285
+ ### Saved Memories
286
+ | # | Type | Priority | Tags | Content (preview) |
287
+ |---|------|----------|------|--------------------|
288
+ | 1 | decision | 7 | [project, tech, topic] | Chose X over Y because... |
289
+ | 2 | error | 7 | [project, bug, tech] | Root cause was X... |
290
+ | 3 | insight | 6 | [project, pattern] | This codebase uses... |
291
+
292
+ ### Reinforced Topics
293
+ - <topic recalled to strengthen connections>
294
+ ```
295
+
296
+ ### Health Report
297
+ ```
298
+ ## Neural Memory Health
299
+
300
+ | Metric | Value | Status |
301
+ |--------|-------|--------|
302
+ | Total memories | N | — |
303
+ | Consolidation | N% | ✅ / ⚠️ |
304
+ | Orphans | N% | ✅ / ⚠️ |
305
+ | Activation | level | ✅ / ⚠️ |
306
+ | Top penalty | <metric> | Fix: <action> |
307
+
308
+ ### Recommended Actions
309
+ 1. <action with command>
310
+ ```
311
+
312
+ ## Constraints
313
+
314
+ 1. **MUST prefix all recall queries with project name** — generic queries return cross-project noise that confuses the AI. The ONLY exception is intentional cross-project searches.
315
+ 2. **MUST use rich cognitive language** — flat facts ("X exists") create orphan neurons with zero connections. Every memory MUST include WHY, BECAUSE, or relationship context.
316
+ 3. **MUST NOT save wall-of-text memories** — max 1-3 sentences per memory. Split longer content into focused pieces. Memories >500 chars degrade recall quality.
317
+ 4. **MUST NOT duplicate file-based state** — don't save task progress, file paths, or git history to nmem. Those belong in `.rune/` files (session-bridge) or git. nmem is for *learnable patterns* only.
318
+ 5. **MUST save 2-5 memories per completed task** — a single memory per task is insufficient. Capture the decision, the reasoning, the pattern, and the prevention insight separately.
319
+ 6. **MUST NOT save sensitive data** — no API keys, passwords, tokens, or PII. Mask or omit sensitive values.
320
+ 7. **MUST tag every memory** — always include `[project-name, technology, topic]`. Tags enable future recall precision.
321
+
322
+ ## Sharp Edges
323
+
324
+ | Failure Mode | Severity | Mitigation |
325
+ |---|---|---|
326
+ | Cross-project noise from generic queries | HIGH | Always prefix queries with project name. Use `nmem_explain` to trace unexpected connections |
327
+ | Orphan neurons from flat facts | HIGH | Enforce cognitive language patterns (causal, decisional, comparative). Run `nmem_health` to detect orphan % |
328
+ | Memory bloat from over-saving | MEDIUM | Cap at 5 memories per task. Run `nmem_consolidate` weekly. Use `nmem_review` to prune |
329
+ | Stale decisions applied to changed codebase | MEDIUM | Include temporal context ("As of v2.1, ..."). Verify recalled decisions against current code before applying |
330
+ | Duplicate memories from repeated sessions | MEDIUM | Before saving, `nmem_recall` the topic first to check for existing memories. Update rather than create duplicates |
331
+ | Loss of nuance from oversimplification | LOW | Save rejected alternatives alongside chosen approach. Use `nmem_hypothesize` for uncertain decisions |
332
+
333
+ ## Done When
334
+
335
+ **Recall Mode:**
336
+ - 3-5 diverse topics recalled with project-name prefix
337
+ - Applicable context summarized for current task
338
+ - Gaps noted if coverage is thin
339
+
340
+ **Capture Mode:**
341
+ - 2-5 memories saved with rich cognitive language
342
+ - All memories tagged with `[project, technology, topic]`
343
+ - Priority assigned (5-10 scale)
344
+ - Connections reinforced via post-save recall
345
+
346
+ **Flush Mode:**
347
+ - All significant unsaved decisions captured
348
+ - `nmem_auto` called with session summary
349
+ - Session-bridge synced if major decisions made
350
+
351
+ **Maintenance Mode:**
352
+ - `nmem_health` run and metrics assessed
353
+ - Top penalty addressed with specific action
354
+ - Review queue processed (outdated/bloated memories fixed)
355
+
356
+ ## Cost Profile
357
+
358
+ - **Recall**: ~200-500 tokens (3-5 queries + synthesis)
359
+ - **Capture**: ~300-600 tokens (2-5 memories + reinforcement)
360
+ - **Flush**: ~100-300 tokens (auto-process + sync)
361
+ - **Maintenance**: ~500-1000 tokens (health + consolidate + review)
362
+ - **Hypothesis**: ~200-400 tokens per hypothesis lifecycle
@@ -88,6 +88,7 @@ High-level multi-feature planning — organize features into milestones.
88
88
  - `research` (L3): external knowledge lookup
89
89
  - `sequential-thinking` (L3): complex architecture with many trade-offs
90
90
  - L4 extension packs: domain-specific architecture patterns
91
+ - `neural-memory` | Before architecture decisions | Recall past decisions on similar problems
91
92
 
92
93
  ## Called By (inbound)
93
94
 
@@ -113,6 +114,8 @@ High-level multi-feature planning — organize features into milestones.
113
114
 
114
115
  Use findings from `rune:scout` if already available. If not, invoke `rune:scout` with the project root to scan directory structure, detect framework, identify key files, and extract existing patterns. Do NOT skip this step — plans without context produce wrong file paths.
115
116
 
117
+ Call `neural-memory` (Recall Mode) to check for past architecture decisions on similar problems before making new ones.
118
+
116
119
  ### Step 2 — Classify Complexity
117
120
 
118
121
  Determine if the task needs master plan + phase files or inline plan:
@@ -40,6 +40,7 @@ Legacy refactoring orchestrator for safely modernizing messy codebases. Rescue r
40
40
  - `session-bridge` (L3): save rescue state between sessions
41
41
  - `onboard` (L2): generate context for unfamiliar legacy project
42
42
  - `dependency-doctor` (L3): audit dependencies in legacy project
43
+ - `neural-memory` | Phase start + phase end | Recall past refactoring patterns, capture new ones
43
44
 
44
45
  ## Called By (inbound)
45
46
 
@@ -72,6 +73,8 @@ Note: SURGERY todos are added dynamically — one per module identified in Phase
72
73
 
73
74
  Mark todo[0] `in_progress`.
74
75
 
76
+ Call `neural-memory` (Recall Mode) for past refactoring patterns in similar codebases.
77
+
75
78
  **0a. Full health assessment.**
76
79
 
77
80
  ```
@@ -344,6 +347,8 @@ REQUIRED SUB-SKILL: rune:journal
344
347
  Bash: git tag rune-rescue-complete
345
348
  ```
346
349
 
350
+ Call `neural-memory` (Capture Mode) to save refactoring patterns and decisions from this rescue.
351
+
347
352
  Mark VERIFY todo `completed`.
348
353
 
349
354
  ---
@@ -41,6 +41,7 @@ Every review MUST cite at least one specific concern, suggestion, or explicit ap
41
41
  - `review-intake` (L2): structured intake for complex multi-file reviews
42
42
  - `sast` (L3): static analysis security scan on reviewed code
43
43
  - L4 extension packs: domain-specific review patterns when context matches (e.g., @rune/ui for frontend, @rune/security for auth code)
44
+ - `neural-memory` | After review complete | Capture code quality insight
44
45
 
45
46
  ## Called By (inbound)
46
47
 
@@ -181,6 +182,7 @@ After reporting:
181
182
  - If any CRITICAL findings: call `rune:fix` immediately with the finding details
182
183
  - If any HIGH findings: call `rune:fix` with the finding details
183
184
  - If untested code: call `rune:test` with specific coverage gaps identified
185
+ - Call `neural-memory` (Capture Mode) to save any novel code quality patterns or recurring issues found.
184
186
 
185
187
  ## Framework-Specific Checks
186
188
 
@@ -133,10 +133,13 @@ These are rarely invoked directly — they're called by Tier 1/2 skills:
133
133
  | `rune:completion-gate` | cook | Validate claims |
134
134
  | `rune:sentinel-env` | cook, scaffold, onboard | Environment pre-flight |
135
135
  | `rune:research` / `rune:docs-seeker` | any | Look up docs |
136
- | `rune:session-bridge` | cook, team | Save context |
136
+ | `rune:session-bridge` | cook, team | Save context (in-session state handoff) |
137
+ | `rune:journal` | cook, team | Persistent work log within a session |
138
+ | `rune:neural-memory` | cook, team, any L1/L2 | Cross-session cognitive persistence via Neural Memory MCP — semantic complement to session-bridge and journal |
137
139
  | `rune:git` | cook, scaffold, team, launch | Semantic commits, PRs, branches |
138
140
  | `rune:doc-processor` | docs, marketing | PDF/DOCX/XLSX/PPTX generation |
139
141
  | "Done" / "ship it" / "xong" | — | `rune:verification` → commit |
142
+ | "recall", "remember", "brain", "nmem", "cross-project memory" | `rune:neural-memory` | Retrieve or persist cross-session context |
140
143
 
141
144
  #### Tier 4 — Domain Extension Packs (L4)
142
145
 
@@ -209,6 +212,19 @@ Once routed:
209
212
  3. Follow the skill's workflow exactly
210
213
  4. If the skill has a checklist/phases, track via TodoWrite
211
214
 
215
+ ### Step 5 — Post-Completion Neural Memory Capture
216
+
217
+ After ANY L1 or L2 workflow completes (cook, team, launch, rescue, scaffold, plan, design, debug, fix, review, deploy, sentinel, perf, db, ba, docs, mcp-builder, etc.):
218
+
219
+ 1. Trigger `rune:neural-memory` in **Capture Mode** automatically
220
+ 2. Save 2–5 memories covering: key decisions made, bugs fixed, patterns applied, architectural choices
221
+ 3. Use rich cognitive language (causal, temporal, decisional) — NOT flat facts
222
+ 4. Tag memories with [project-name, skill-used, topic]
223
+ 5. This step is MANDATORY even if the user did not ask for it
224
+ 6. Exception: skip if the workflow produced zero technical output (e.g., only a clarifying question was asked)
225
+
226
+ **Capture Mode trigger phrase**: "Session artifact — capturing to Neural Memory."
227
+
212
228
  ## Routing Exceptions
213
229
 
214
230
  These DO NOT need skill routing: