{"slug": "show-hn-local-first-semantic-knowledge-graph-with-magnetic-pull-retrieval", "title": "Show HN: Local-first semantic knowledge graph with magnetic-pull retrieval", "summary": "Rig launched a local-first semantic knowledge graph tool that transforms codebases into interactive, navigable maps for AI coding agents. The tool runs entirely on the user's machine with no API keys or data uploads, enabling agents to query code by structure, meaning, and historical context rather than relying on blind grep searches.", "body_md": "**Watch your codebase become a constellation — and give your AI agent a map of it.**\n\n[\n](https://github.com/Astralchemist/rig/releases/download/v0.1.0/demo.mp4)\n\n[▶ Watch the full demo with audio](https://github.com/Astralchemist/rig/releases/download/v0.1.0/demo.mp4)\n\nRig builds a local-first semantic knowledge graph of your project, renders it as an interactive map you can fly through, and exposes it to coding agents (Claude Code, Cursor, Codex, …) over MCP. Your agent stops grepping blindly and starts navigating — by structure, by meaning, and by what it's touched before.\n\nEverything runs on your machine. No API key, no upload, nothing leaves your laptop.\n\nIn any project directory:\n\n```\nnpx rig-constellation\n```\n\n(Have [Bun](https://bun.sh)? `bunx rig-constellation`\n\nworks too.) That's the whole thing. One command:\n\n```\n  ⬡ Rig — mapping my-project\n  http://localhost:7491\n\n  ✓ initialized  ./.rig\n  ✓ map live    http://localhost:7491\n  → 1/6 extract      ██████████████████ 212/212\n  → 5/6 hubness      ████████████████░░\n  ✓ indexed     1,204 nodes · 3,891 edges · 212 files · 36 skills\n  ✓ wired       claude\n\n  press Ctrl-C to stop the map.\n```\n\nIt initializes `.rig/`\n\n, opens the live map **first**, then indexes your code so the\ngraph assembles in the already-open browser tab in real time, and wires up whichever\nagent it detects. The map title and port are derived per project, so two checkouts can\nrun side by side on stable, distinct ports. Re-run any time, or use the explicit\nsubcommands below.\n\nThe command is\n\n`rig`\n\n(alias:`rig-constellation`\n\n). Prefer a global install?`npm i -g rig-constellation`\n\n(or`bun install -g rig-constellation`\n\n), then`rig start`\n\n. Installed locally with`npm i rig-constellation`\n\n? The binary lives in`node_modules/.bin`\n\n— run it with`npx rig start`\n\n(or install with`-g`\n\nto get`rig`\n\non your`PATH`\n\n).\n\n**A map of your codebase.** Files, symbols, calls, imports, and dependencies as a navigable graph — not a file tree.**Magnetic pull.** Ask \"what's related to X\" and get a ranked answer that blends graph distance, semantic similarity, and what's been active recently.**Hubs.** The structurally important anchors surface first, so a 5k-node graph stays legible.**Dependency intelligence.**\"What version of X do I have?\" and \"what's declared but never imported?\" become one-hop graph queries.** Waypoints.**Your agent drops durable markers at decisions and constraints that survive context-window compaction — so a new session picks up oriented.**An MCP tool surface** your agent calls directly: search, pull, callers/callees, impact, hubs, deps, and more.\n\nWithout a map, an agent answers *\"what breaks if I change parseConfig?\"* by grepping the string and reading whatever files match — blind, lossy, and token-expensive.\n\nWith Rig it's one call:\n\n```\nrig_impact parseConfig\n→ 7 transitive callers, ranked:\n   loadSettings          calls · depth 1\n   bootstrap             calls · depth 2\n   __tests__/config…     tests · depth 1\n   …\n```\n\nAnd *\"what else should I look at?\"* isn't a guess — `rig_pull`\n\nreturns related anchors scored by graph distance, on-device embedding similarity, and recent activity, with the three components broken out so the ranking is **explainable, not a black box**:\n\n```\nrig_pull parseConfig\n→ { node: \"validateSchema\", score: 0.81,\n    components: { structural: 0.4, semantic: 0.9, recency: 0.7 } }\n```\n\nThat ranked, self-explaining retrieval — not a flat grep dump — is the difference.\n\n- Embeddings run locally via a small on-device model (\n`bge-small`\n\n).**No API key required.** - The graph lives in\n`.rig/rig.db`\n\nin your project.`rig`\n\nauto-adds`.rig/`\n\nto your`.gitignore`\n\n. - Nothing is uploaded. The map UI is served on loopback only.\n\n`bunx rig-constellation`\n\nauto-detects and wires the agents you have installed. To wire one explicitly:\n\n```\nrig install claude      # also: cursor · codex · opencode · openrouter\n```\n\nThis merges Rig's MCP server into the agent's config; the agent spawns `rig serve --mcp`\n\non demand.\n\n| Command | What it does |\n|---|---|\n`rig start` |\nOne-shot: init + index + wire agent + open the live map |\n`rig index` |\nExtract + write nodes (`--include` / `--exclude <glob>` ) |\n`rig sync` |\nIncremental update |\n`rig query` |\nCLI search |\n`rig serve --all` |\nStart MCP and/or the web map (`--mcp` / `--web` / `--auth` ) |\n`rig status` |\nIndex health |\n`rig doctor` |\nDiagnose environment, db, model cache, agent configs |\n`rig export-docs` |\nRender waypoints into a markdown doc tree |\n\nRun `rig --help`\n\nfor the full list.\n\n`.contracts/`\n\nis the declarative source of truth (tools, anchors, migrations, events); `bun run gen`\n\nemits the matching code into `generated/`\n\n. The graph is plain SQLite. Retrieval is a single magnetic-pull scoring function over structural edges, on-device embeddings, and recency. The map UI is a force-graph over WebSocket.\n\n`packages/core`\n\n— the`Rig`\n\nclass: DB, extraction, graph, embeddings, magnetic pull`packages/mcp`\n\n— MCP stdio server + tool dispatch`packages/web`\n\n— Fastify + WebSocket + React map UI`packages/cli`\n\n— the`rig`\n\nbinary`packages/contracts`\n\n—`defineToolContract`\n\n& friends\n\nSee [ docs/contracts.md](/Astralchemist/rig/blob/main/docs/contracts.md) to add a tool,\n\n[for the architecture, and](/Astralchemist/rig/blob/main/docs/integration.md)\n\n`docs/integration.md`\n\n[for the stability promise.](/Astralchemist/rig/blob/main/COMPATIBILITY.md)\n\n`COMPATIBILITY.md`\n\n[Bun](https://bun.sh)≥ 1.1 (primary), or Node ≥ 20 (fallback).- Works on macOS, Linux, and Windows.\n\nAdding a tool means touching one file in `.contracts/`\n\nand one implementation — the generator wires the rest. Start with [ docs/contracts.md](/Astralchemist/rig/blob/main/docs/contracts.md), then\n\n[for where new ideas plug in. Stable tools are protected by a compatibility gate (](/Astralchemist/rig/blob/main/docs/integration.md)\n\n`docs/integration.md`\n\n`bun run check:compat`\n\n); see [.](/Astralchemist/rig/blob/main/COMPATIBILITY.md)\n\n`COMPATIBILITY.md`\n\n[Apache-2.0](/Astralchemist/rig/blob/main/LICENSE). Rig's extraction layer is derived from [CodeGraph](https://github.com/colbymchenry/codegraph) (MIT, © Colby Mchenry); those portions remain under their original MIT terms — see [ LICENSE-CODEGRAPH.txt](/Astralchemist/rig/blob/main/LICENSE-CODEGRAPH.txt) and\n\n[. With thanks.](/Astralchemist/rig/blob/main/NOTICE)\n\n`NOTICE`", "url": "https://wpnews.pro/news/show-hn-local-first-semantic-knowledge-graph-with-magnetic-pull-retrieval", "canonical_source": "https://github.com/Astralchemist/rig", "published_at": "2026-05-29 13:31:01+00:00", "updated_at": "2026-05-29 13:47:25.639079+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "ai-infrastructure"], "entities": ["Claude Code", "Cursor", "Codex", "Rig", "Bun", "MCP"], "alternates": {"html": "https://wpnews.pro/news/show-hn-local-first-semantic-knowledge-graph-with-magnetic-pull-retrieval", "markdown": "https://wpnews.pro/news/show-hn-local-first-semantic-knowledge-graph-with-magnetic-pull-retrieval.md", "text": "https://wpnews.pro/news/show-hn-local-first-semantic-knowledge-graph-with-magnetic-pull-retrieval.txt", "jsonld": "https://wpnews.pro/news/show-hn-local-first-semantic-knowledge-graph-with-magnetic-pull-retrieval.jsonld"}}