{"slug": "show-hn-graft-local-first-persistent-memory-for-coding-agents", "title": "Show HN: Graft – local-first persistent memory for coding agents", "summary": "Developer AEndrix03 released Graft, an open-source local-first persistent memory tool for AI coding agents that stores fixes, decisions, and project knowledge in SQLite with sqlite-vec and FTS5 and surfaces them via hybrid retrieval. Graft works with Claude Code, Codex, ChatGPT, Claude Desktop, Gemini CLI, and Open Code, requires no SaaS, external embedding API, account, or API key, and installs via Homebrew or a shell script with optional CUDA and HIP GPU acceleration. The tool offers three commands — graft query for top-1 lookup with STRONG, WEAK, or MISS confidence gating, graft retrieve for combining several memories, and graft explore for graph-based relationship walking — positioning it as agent memory rather than document storage.", "body_md": "**Persistent local memory for AI coding agents.**\n\nGraft brings back useful fixes, decisions, gotchas and project knowledge when they become relevant again.\n\nThe agent still reasons. **Graft gives it a head start.**\n\n**Claude Code · Codex · ChatGPT · Claude Desktop · Gemini CLI · Open Code · custom agents**\n\n<sub>C11 · SQLite · sqlite-vec · FTS5 · BGE-M3 · llama.cpp · MCP · MessagePack</sub>\n\nYour agent solves something difficult.\n\n**Graft remembers the useful part.**\n\nLater, another session hits a similar problem.\n\n**Graft surfaces the old learning before the agent wastes time rediscovering it.**\n\n```\nsolve something\n      │\n      ▼\n remember what mattered\n      │\n      ▼\n     Graft\n      │\n      ├── likely same problem ──► verified recall\n      ├── related knowledge ────► hybrid retrieval\n      └── broader context ──────► graph exploration\n                                  │\n                                  ▼\n                              your agent\n```\n\n**No SaaS. No external embedding API. No account. No API key.**\n\nGraft does not replace the agent's reasoning. It gives the agent relevant prior knowledge and lets the agent decide what to do with it.\n\nWithout persistent memory:\n\n```\nsession 1\nbug → investigate → understand → fix → context disappears\n\nsession 27\nsimilar bug → investigate → understand → fix → context disappears\n```\n\nWith Graft:\n\n```\nsession 1\nbug → investigate → fix → remember\n\nsession 27\nsimilar bug → recall → decide → continue\n```\n\nGraft is useful for knowledge that is expensive to rediscover:\n\n- root causes that took hours to find\n- architectural decisions and why they were made\n- framework and infrastructure gotchas\n- project-specific conventions\n- dependency constraints\n- failed approaches worth avoiding\n- fixes that may apply again\n\nThis is **agent memory**, not document storage.\n\n```\nbrew tap AEndrix03/graft https://github.com/AEndrix03/Graft.git\nbrew install graft\n\ngraft stats\n```\n\nNo database server. No model download by hand. No config required for the first run.\n\n```\ngit clone https://github.com/AEndrix03/Graft.git\ncd Graft\nbash scripts/install.sh\n```\n\nWindows:\n\n```\npwsh scripts/install.ps1\n```\n\nOptional GPU acceleration:\n\n```\nGRAFT_GPU=cuda bash scripts/install.sh\nGRAFT_GPU=hip  bash scripts/install.sh\n```\n\nFull installation reference → `docs/install/`\n\nFirst, the memory is empty:\n\n``` bash\n$ graft query \"spring validation nested dto not working\"\n{\n  \"status\": 0,\n  \"result\": { \"hit\": \"MISS\" }\n}\n```\n\nThe agent investigates and solves the issue. Save the useful part:\n\n```\ngraft insert \\\n  --title \"Spring @Valid must also be applied to nested DTO fields\" \\\n  --body \"Without @Valid on the nested field, validation does not cascade into it.\" \\\n  --keyword spring-boot \\\n  --keyword validation \\\n  --keyword gotcha\n```\n\nWeeks later, with different wording:\n\n``` bash\n$ graft query \"why are constraints inside my nested request object ignored?\"\n{\n  \"status\": 0,\n  \"result\": {\n    \"hit\": \"STRONG\",\n    \"title\": \"Spring @Valid must also be applied to nested DTO fields\",\n    \"body\": \"Without @Valid on the nested field, validation does not cascade into it.\"\n  }\n}\n```\n\nDifferent prompt. Same underlying problem.\n\n**Graft surfaces the prior learning. The agent decides whether it is useful.**\n\n| `graft query` Fast top-1 lookup with confidence gating: `STRONG` ·`WEAK` ·`MISS` Use it when the agent wants to know:   | `graft retrieve` Combines:  Use it when several memories may help. | `graft explore` Walks semantic and keyword relationships with beam search, score decay and MMR diversity. Use it when the agent wants to know:   | \n\nBecause Graft is shaped around **what an agent learns while working**, not around bulk document ingestion.\n\n|  | Vector DB / traditional RAG | Graft | \n|---|---|---|\n| Primary data | Documents | Agent learnings | \n| Typical write | Bulk ingestion | Remember something useful | \n| Typical read | Top-k chunks | Recall / retrieve / explore | \n| Consumer | Application | AI agent | \n| Confidence | Similarity ranking | `STRONG` /`WEAK` /`MISS` | \n| Relationships | Usually external | Semantic + keyword graph | \n| Knowledge changes | Replace/update documents | Supersession | \n| Deployment | Database/service | Local binary + SQLite | \n\nIf you need to index millions of documents, use a vector database.\n\nIf you want your agent to remember **what it discovered while solving real problems**, Graft is built for that.\n\nGraft is a binary with a CLI contract. Any agent that can run a subprocess can use it.\n\n| Agent | Integration | Setup | \n|---|---|---|\n| **Claude Code** | Skills + optional hooks | `graft setup claudecode` | \n| **Codex** | Skills + optional hooks / `AGENTS.md` | `graft setup codex` | \n| **Open Code** | Native skills | `graft setup opencode` | \n| **Gemini CLI** | `GEMINI.md` workflow | [`integrations/gemini-cli/`](https://github.com/AEndrix03/Graft/blob/master/integrations/gemini-cli) | \n| **Claude Desktop** | MCP | [`integrations/claude-ai/`](https://github.com/AEndrix03/Graft/blob/master/integrations/claude-ai) | \n| **ChatGPT** | MCP stdio / HTTP | [`integrations/chatgpt/`](https://github.com/AEndrix03/Graft/blob/master/integrations/chatgpt) | \n| **Your agent** | CLI, subprocess, REST or MCP | [`docs/integrations/`](https://github.com/AEndrix03/Graft/blob/master/docs/integrations) | \n\nThe shipped integrations teach agents a simple pattern:\n\n```\nnon-trivial task\n      │\n      ▼\n search memory\n      │\n      ├── useful memory ───────► consider it\n      │\n      └── nothing useful ──────► solve normally\n                                      │\n                                      ▼\n                              worth remembering?\n                                      │\n                                      ▼\n                                   save it\n```\n\nFor Claude Code, Graft includes skills such as:\n\n- `recall` — smart search that escalates only when needed\n- `memoryze` — distill useful learnings into reusable memories\n- `learn` — intentionally ingest useful knowledge\n- `memory-audit` — inspect memory quality and reuse\n\nOptional hooks can make recall deterministic at supported harness events. Hook wiring is currently manual.\n\nGraft keeps its core runtime on your machine:\n\n```\nagent\n  │\n  ▼\ngraft CLI\n  │\n  │ MessagePack / AF_UNIX\n  ▼\ngraftd\n  │\n  ├── SQLite + FTS5 + sqlite-vec\n  │\n  └── llama.cpp + BGE-M3\n```\n\nThat means:\n\n- one local database\n- local embeddings\n- no managed memory service\n- no telemetry requirement\n- no external API key\n- CPU works out of the box\n- CUDA / ROCm are optional\n\nChat clients can reach the same core through MCP.\n\n```\nChatGPT / Claude Desktop\n          │\n         MCP\n          │\n          ▼\n    MCP adapter\n          │\n          ▼\n      graft CLI\n          │\n          ▼\n        graftd\ngraft query \"docker container exits after healthcheck\"\n```\n\nReturns one confidence-gated result.\n\n```\ngraft retrieve \"docker healthcheck networking\"\n```\n\nReturns ranked memories using dense + lexical retrieval.\n\n```\ngraft explore \"deployment failures\" --keyword docker\n```\n\nWalks the memory graph for broader context.\n\n```\nquery\n  → BGE-M3 embedding\n  → vector candidates\n  → lexical verification\n  → confidence gating\n  → STRONG / WEAK / MISS\nvector search ─┐\nBM25 title ────┼─→ RRF → ranked memories\nBM25 body ─────┘\nsemantic seed\n  → graph edges\n  → beam search\n  → score decay\n  → MMR diversity\n```\n\nThe core is written in C11. Embeddings run locally through llama.cpp using BGE-M3. Storage is SQLite with FTS5 and sqlite-vec.\n\nGraft itself does not require an external LLM call to store or retrieve memory.\n\nA memory node contains:\n\n```\ntitle\nbody\nkeywords\nvector\nrelationships\nstatus\n```\n\nNodes can be connected through keyword and semantic edges.\n\nWhen knowledge becomes outdated, Graft supports **supersession** rather than silently pretending the old knowledge never existed:\n\n```\nold decision\n     │\n     └── SUPERSEDED BY ──► new decision\n```\n\nHistory stays inspectable while the newer memory becomes the useful one.\n\nSeparate memory spaces without running separate products:\n\n```\nGRAFT_PROFILE=work graft query \"deployment rule\"\nGRAFT_PROFILE=personal graft query \"docker workaround\"\n```\n\nProfiles can be created, switched, exported, imported and merged.\n\n```\ngraft profile list\ngraft profile add project-x\ngraft profile set project-x\n```\n\nThis also gives you a straightforward way to move or combine local memory stores when needed.\n\nThe memory is not hidden behind a hosted platform.\n\n```\ngraft stats\ngraft analytics\ngraft get <id>\ngraft delete <id>\n```\n\nOptional tooling includes:\n\n- REST API\n- MCP access\n- browser graph viewer\n- profile management\n- usage analytics\n\n**Not an LLM.**\n\nYour agent still reasons.\n\n**Not a chatbot.**\n\nBring your own agent.\n\n**Not a hosted memory SaaS.**\n\nThe default runtime is local.\n\n**Not a vector database replacement.**\n\nIt is opinionated around agent memory.\n\n**Not just a semantic cache.**\n\nVerified reuse is one primitive. Graft also provides ranked retrieval, graph exploration, evolving memories and agent workflows.\n\nThe same primitives can sit in front of an LLM-backed service:\n\n```\nrequest\n   │\n   ▼\nexact cache\n   │ MISS\n   ▼\nGraft\n   │ no useful memory\n   ▼\nLLM\n   │\n   └──► remember result\n```\n\nThis is an **experimental design pattern**, not Graft's primary positioning.\n\nSee [`docs/microservices/`](https://github.com/AEndrix03/Graft/blob/master/docs/microservices).\n\n**Active alpha — v0.1.x**\n\nWorking today:\n\n- local daemon + CLI\n- SQLite storage\n- BGE-M3 embeddings\n- verified recall\n- hybrid retrieval\n- graph exploration\n- profiles\n- Claude Code / Codex / Open Code skills\n- MCP bridge\n- optional REST API and graph viewer\n\nStill evolving:\n\n- API surface before 1.0\n- packaging and platform coverage\n- remote / shared memory\n- team workflows\n- neural reranking\n\nThe cross-encoder reranker is currently scaffolded but not active; verification currently relies on vector similarity plus lexical signals.\n\n**Now**\n\n- harden CLI and JSON contracts\n- improve coding-agent integrations\n- improve memory quality and observability\n- publish better benchmarks\n\n**Next**\n\n- BGE reranker\n- contradiction detection\n- adaptive thresholds\n- richer hooks\n- remote read-only profiles\n\n**Later**\n\n- shared team memory\n- distributed profile sync\n- automatic consolidation\n- richer admin tooling\n\n| **Getting started** | [`docs/install/`](https://github.com/AEndrix03/Graft/blob/master/docs/install) | \n| **Use cases** | [`docs/use-cases.md`](https://github.com/AEndrix03/Graft/blob/master/docs/use-cases.md) | \n| **Concepts** | [`docs/concepts.md`](https://github.com/AEndrix03/Graft/blob/master/docs/concepts.md) | \n| **Integrations** | [`docs/integrations/`](https://github.com/AEndrix03/Graft/blob/master/docs/integrations) | \n| **Architecture** | [`docs/architecture/`](https://github.com/AEndrix03/Graft/blob/master/docs/architecture) | \n| **CLI** | [`docs/cli/`](https://github.com/AEndrix03/Graft/blob/master/docs/cli) | \n| **Retrieval** | [`docs/retrieval/`](https://github.com/AEndrix03/Graft/blob/master/docs/retrieval) | \n| **Storage** | [`docs/storage/`](https://github.com/AEndrix03/Graft/blob/master/docs/storage) | \n| **Embeddings** | [`docs/embeddings/`](https://github.com/AEndrix03/Graft/blob/master/docs/embeddings) | \n| **Profiles** | [`docs/profiles/`](https://github.com/AEndrix03/Graft/blob/master/docs/profiles) | \n| **HTTP API** | [`docs/http-api/`](https://github.com/AEndrix03/Graft/blob/master/docs/http-api) | \n\nFull documentation → `docs/`\n\n```\ngit clone https://github.com/AEndrix03/Graft.git\ncd Graft\nbash scripts/install.sh\ngraft stats\n```\n\nRun tests with:\n\n```\ncmake --build build --target test\n```\n\nSee [`CONTRIBUTING.md`](https://github.com/AEndrix03/Graft/blob/master/CONTRIBUTING.md).\n\nYou can use, modify, distribute and embed Graft in proprietary projects subject to the license terms.", "url": "https://wpnews.pro/news/show-hn-graft-local-first-persistent-memory-for-coding-agents", "canonical_source": "https://github.com/AEndrix03/Graft", "published_at": "2026-09-16 02:23:36+00:00", "updated_at": "2026-09-16 02:37:42.920763+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-products", "ai-infrastructure"], "entities": ["Graft", "AEndrix03", "Claude Code", "Codex", "ChatGPT", "Claude Desktop", "Gemini CLI", "Open Code"], "alternates": {"html": "https://wpnews.pro/news/show-hn-graft-local-first-persistent-memory-for-coding-agents", "markdown": "https://wpnews.pro/news/show-hn-graft-local-first-persistent-memory-for-coding-agents.md", "text": "https://wpnews.pro/news/show-hn-graft-local-first-persistent-memory-for-coding-agents.txt", "jsonld": "https://wpnews.pro/news/show-hn-graft-local-first-persistent-memory-for-coding-agents.jsonld"}}