{"slug": "rune-persistent-context-for-ai-coding-tools", "title": "Rune – persistent context for AI coding tools", "summary": "Rune, a software intelligence runtime from developer pypl100, provides persistent, shared, and explainable context for AI coding tools like Cursor, Codex, and Claude Code by continuously maintaining an understanding graph of a codebase. It is available as npm package @pypl100/rune and pip package north-rune, with a CLI and MCP server, and it is read-only, never writing to source code.", "body_md": "**The Software Intelligence Runtime.**\n\nCursor, Codex, Claude Code — they all read your codebase cold, every session, and forget everything when it ends. Rune is the thing that runs underneath them, continuously, so every session starts already knowing your codebase instead of re-deriving it.\n\n**Without Rune:**\n\n``` php\nflowchart LR\n    A1[\"New AI session\"] --> A2[\"Reads files cold\"]\n    A2 --> A3[\"Reasons, answers\"]\n    A3 --> A4[\"Session ends\"]\n    A4 -.->|\"understanding lost\"| A1\n```\n\n**With Rune:**\n\n``` php\nflowchart LR\n    B1[\"Code changes\"] --> B2[\"rune watch rebuilds automatically\"]\n    B2 --> B3[\"Understanding always current\"]\n    B3 --> B4[\"New AI session\"]\n    B4 --> B5[\"Queries Rune over MCP\"]\n    B5 --> B6[\"Evidence-backed answer, cited to file + line\"]\n    B6 -.->|\"stays current\"| B3\n```\n\n[What it does](#what-rune-does) · [How it works](#how-it-works) · [Install](#install) · [Quickstart](#quickstart) · [See real output](#what-this-actually-looks-like) · [CLI](#cli) · [MCP tools](#mcp-tools-exposed) · [Limitations](#current-scope-and-honest-limitations) · [Security](#security-notes)\n\n**Always current**—`rune watch`\n\nkeeps the understanding graph up to date as you edit, not just when someone remembers to re-run a scan. It's a runtime, not a one-shot CLI.**Persistent**— understanding survives past any single session. Every AI you connect starts already knowing your software, instead of re-reading it cold.**Shared**— one understanding, many AI clients. Claude, GPT, Gemini, whatever you're running next month — they all ask the same Rune instance instead of maintaining separate, inconsistent mental models of your code.**Explainable**— nothing Rune tells an AI is a black box. Ask it to justify any claim and it shows the exact source location behind it.** Read-only, suggest-only**— Rune never writes to your source. That's the actual moat: everything else in this space is racing toward autonomous code-writing; Rune stays strictly on the reading, understanding, and (later) suggesting side of that line. It never becomes the thing you have to double-check for silently breaking your code.\n\nTwo layers, and every conclusion traces back to evidence — not asserted, always inspectable:\n\n``` php\nflowchart LR\n    F1[\"Fact: import react, UserCard.jsx line 1\"] --> D[\"Derived: React component UserCard\"]\n    F2[\"Fact: function UserCard, UserCard.jsx line 3\"] --> D\n    F3[\"Fact: useState hook, UserCard.jsx line 4\"] --> D\n    D --> C[\"AI answer: this project has a UserCard component\"]\n    C -.->|\"rune_explain\"| F1\n    C -.->|\"rune_explain\"| F2\n    C -.->|\"rune_explain\"| F3\n```\n\nCall `rune explain <id>`\n\n(or the `rune_explain`\n\nMCP tool) on anything and get that chain back. An AI using Rune isn't guessing about your architecture — and neither is Rune.\n\n```\nnpm install @pypl100/rune\n```\n\n*A Python distribution exists at python/ with full feature parity (same fact/derived model, same detectors, same MCP tool surface) for teams who'd rather not require Node.js — published as pip install north-rune (the CLI command is still rune; see python/README.md).*\n\nIf you install both(`@pypl100/rune`\n\nvia npm globally, and`north-rune`\n\nvia pip) on the same machine, only one`rune`\n\ncommand will actually be on your`PATH`\n\n— whichever your shell finds first, not whichever you installed most recently. Check with`which -a rune`\n\n; if it lists more than one path, that's why. There's no version-detection magic here — it's plain OS`PATH`\n\nresolution, same as any two unrelated tools that happen to install a same-named binary. If you need a specific one, invoke it by its full path rather than relying on bare`rune`\n\n.\n\n```\ncd your-project\nnpm install -g @pypl100/rune   # or: npx -p @pypl100/rune rune <command>\nrune init      # sets up Rune in your project\nrune watch &    # keeps the understanding current in the background as you work\nrune serve      # starts an MCP server exposing it to any AI client\n```\n\n`rune watch`\n\nis the recommended default — it's what makes Rune a runtime instead of a tool you have to remember to re-run. (For CI or a one-shot check, use `rune scan`\n\ninstead.)\n\n```\nsequenceDiagram\n    participant Dev as You\n    participant Watch as rune watch\n    participant Graph as graph file\n    participant AI as AI client (Claude Code, Cursor, etc.)\n\n    Dev->>Watch: save a file\n    Watch->>Watch: detect change (debounced)\n    Watch->>Graph: rebuild + write\n    AI->>Graph: rune_search / rune_explain (via rune serve)\n    Graph-->>AI: current, evidence-backed answer\n```\n\nPoint any MCP-compatible client (Claude Desktop, Claude Code, custom agents, etc.) at the `rune serve`\n\nprocess. Every connected AI shares the same, continuously current understanding — no restart, no manual rescan.\n\nExample MCP client config entry:\n\n```\n{\n  \"mcpServers\": {\n    \"rune\": {\n      \"command\": \"npx\",\n      \"args\": [\"-p\", \"@pypl100/rune\", \"rune\", \"serve\", \"/absolute/path/to/your-project\"]\n    }\n  }\n}\n```\n\nReal output, from the fixture project in this repo — not staged:\n\n``` bash\n$ rune scan .\n[rune] scanned 4 file(s) in 34ms\n[rune] facts: 10, derived conclusions: 4\n[rune] graph written to /project/.rune/graph.json\n\n$ rune explain component_2\n{\n  \"kind\": \"function\",\n  \"id\": \"component_2\",\n  \"type\": \"react_component\",\n  \"file\": \"components/UserCard.jsx\",\n  \"line\": 3,\n  \"name\": \"UserCard\",\n  \"evidence\": \"export function UserCard({ user }) {\"\n}\n```\n\nThat's the whole trust model in one example: Rune doesn't just say \"there's a `UserCard`\n\ncomponent\" — it points at the exact file, the exact line, and the exact text it matched. Ask it to explain anything, and you get the receipts, not a claim.\n\n| Command | What it does |\n|---|---|\n`rune init [dir]` |\nSets up `.rune/` in the current (or given) project |\n`rune scan [dir]` |\nBuilds (or rebuilds) the understanding graph, once |\n`rune watch [dir]` |\nKeeps the understanding graph current as files change (Ctrl+C to stop) |\n`rune serve [dir]` |\nStarts the MCP server |\n`rune explain <id>` |\nPrints the evidence trail behind any fact or conclusion |\n`rune --version` |\nPrints the installed Rune version |\n\n`rune init`\n\nwrites `.rune/config.json`\n\n. The only setting today is `ignore`\n\n— an array of directory/file names to exclude from scanning, on top of the built-in defaults (`node_modules`\n\n, `.git`\n\n, `dist`\n\n, `build`\n\n, `.next`\n\n, `coverage`\n\n, etc., and all dotfiles unconditionally):\n\n```\n{\n  \"ignore\": [\"legacy\", \"vendor\"],\n  \"version\": 1\n}\n```\n\n| Tool | Purpose |\n|---|---|\n`rune_get_overview` |\nArchitecture summary — start here |\n`rune_list_components` |\nAll detected React components |\n`rune_list_routes` |\nUnified Express + Next.js route list |\n`rune_search` |\nFind facts/derived nodes by name, file, or route substring |\n`rune_explain` |\nFull evidence trail for any id |\n`rune_get_file_dependencies` |\nInternal import graph for a file |\n`rune_rescan` |\nRe-scan on demand after code changes |\n\nRune is intentionally narrow right now:\n\n**Framework support:** React, Next.js (pages + app router), Express. Everything else gets generic file/import scanning only.**Extraction method:** heuristic, regex-based pattern matching — not a full AST parser. This keeps the scanner dependency-free and fast, and every fact still carries file/line/matched-text evidence, but it will miss unusual code shapes (e.g. components returned via`React.createElement`\n\nwith no JSX, dynamically constructed route strings, deeply re-exported components). A real AST-based extractor is the natural next upgrade — the fact schema is designed so extraction method can be swapped without touching anything downstream.**No cross-file route-prefix resolution:** an Express route mounted via`app.use('/api', router)`\n\nin one file and defined in another isn't stitched into a single path yet.**Read-only:** Rune never writes to your source files. It only ever writes its own graph to`.rune/graph.json`\n\n.**Single-process, stdio MCP transport**— no multi-client daemon yet.\n\n- Rune\n**never scans dotfiles or dot-directories**(`.env`\n\n,`.env.*.js`\n\n,`.git`\n\n,`.ssh`\n\n, editor configs, etc.), with no exceptions. This is enforced in the scanner and covered by a regression test — a config file with a matching code extension (e.g.`.env.js`\n\n) will not have its contents read or embedded as evidence. - Symlinks are not traversed, so a symlink pointing outside the project root can't pull external files into the scan.\n`.rune/graph.json`\n\nis excluded from git by`rune init`\n\n(it creates`.gitignore`\n\nif one doesn't already exist).- The graph itself is the only thing Rune writes. If you share\n`.rune/graph.json`\n\nwith an AI client, you're sharing everything in it — treat it like any other file that quotes snippets of your source.\n\nThe unit test suite (`npm test`\n\n) covers scanning and the understanding graph, but doesn't spin up a real MCP client. `scripts/verify-mcp-server.mjs`\n\ndoes: it spawns `rune serve`\n\nas a real child process and drives it through the actual JSON-RPC handshake (`initialize`\n\n→ `notifications/initialized`\n\n→ `tools/list`\n\n→ `tools/call`\n\n), checks that all expected tools are exposed, and confirms a genuinely invalid call is rejected cleanly rather than crashing the server.\n\n```\nnpm install\nnpm run verify:mcp\n# or against a real project instead of the bundled fixture:\nnpm run verify:mcp -- /path/to/your-project\n```\n\n- AST-based extraction (swap-in replacement for the regex scanner)\n- Cross-file route resolution\n- Data-flow tracing between frontend calls and backend routes\n- True incremental re-scan —\n`rune watch`\n\nexists now, but it still does a full rebuild on every change, not a diff of just what changed. Fine for small-to-medium projects; will matter on very large ones. - Suggestion tools (e.g. flagging a known-vulnerable dependency pattern with evidence, proposing a reviewable fix) — strictly additive to the read-only model, never auto-applied\n\nMIT\n\nIf you want to support the circus: ETH `0xbc0979dde621c353737d21f6d7b4eb361f7bc11f`", "url": "https://wpnews.pro/news/rune-persistent-context-for-ai-coding-tools", "canonical_source": "https://github.com/thecolourfoundation/rune", "published_at": "2026-08-19 09:32:15+00:00", "updated_at": "2026-08-19 09:42:23.271283+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-infrastructure"], "entities": ["Rune", "Cursor", "Codex", "Claude Code", "pypl100", "@pypl100/rune", "north-rune"], "alternates": {"html": "https://wpnews.pro/news/rune-persistent-context-for-ai-coding-tools", "markdown": "https://wpnews.pro/news/rune-persistent-context-for-ai-coding-tools.md", "text": "https://wpnews.pro/news/rune-persistent-context-for-ai-coding-tools.txt", "jsonld": "https://wpnews.pro/news/rune-persistent-context-for-ai-coding-tools.jsonld"}}