{"slug": "show-hn-coding-agent-with-algebraic-memory-vsa-instead-of-rag", "title": "Show HN: Coding agent with algebraic memory (VSA) instead of RAG", "summary": "A developer released Raidho, an open-source coding agent that uses a hybrid architecture with separate models for reasoning and execution, plus a durable algebraic memory (VSA) instead of RAG. The agent reduces costs by up to 70% on repeated tasks and supports provider-agnostic backends including Claude, DeepSeek, and OpenAI.", "body_md": "**A coding agent that plans with one model, executes with another, and remembers what it learns.**\n\nMost coding agents are one model in a tool loop. Raidho splits the work: use a\n**smart, expensive model to reason and plan**, a **cheap, fast model to execute**,\nand a **durable memory** that carries facts across runs — all\nprovider-agnostic, with your own API key.\n\nThe name is the rune\n\nRaidho(ᚱ) — \"journey / movement\".\n\nStatus: alpha.Tested end-to-end live against both backends (DeepSeek and Claude through the official Anthropic SDK, including the agentic tool-loop). A reproducible real-API benchmark ships in`benchmarks/real_task_opus.py`\n\nwith full evidence (`evidence/2026-06-11_opus_vs_raidho/`\n\n): same task, same model — deterministic procedure $0.05 / context-first hybrid $0.116 / pure tool-loop $0.301; the hybrid matched the loop's report quality at ×2.6 less cost. APIs may change before 1.0.\n\n**Reasoning ≠ execution.**`text`\n\nmode (reasoning, no tools) and`code`\n\nmode (agentic tool loop) can run on**different providers**. Plan on Claude, grind on DeepSeek — you choose where the expensive thinking happens and where the cheap doing happens.** Council mode.**Have two providers*debate*a question and a neutral pass distill the consensus (points of agreement, residual disagreements, recommendation) — e.g. Claude vs DeepSeek. Depersonalized and provider-pluggable; no built-in personas.**Durable, structural memory — persists across runs.** The agent remembers`(subject, relation, object)`\n\nfacts and recalls the relevant ones into its prompt each turn; it saves new ones itself via a`remember`\n\ntool, and**council verdicts are distilled into facts automatically**. Memory is written to disk per project (`<workdir>/.raidho/memory`\n\n) and reloaded next run — so a decision reached today resurfaces tomorrow, recalled only when relevant (cheap; no history bloat) and across languages (a Russian query finds an English fact). It's a Vector Symbolic Architecture (VSA), not RAG: facts are composed algebraically, similarity is bit-packed (32× less RAM than float, identical ranking). You don't need to know any of that to use it — see[docs/MEMORY.md](/vitaliyfedotovpro-art/raidho/blob/main/docs/MEMORY.md)if you want to.**Gets cheaper with repetition (opt-in).** Turn on auto-distillation and a successful read-only tool-loop is captured as a deterministic procedure: the next similar task replaces the multi-iteration LLM loop with deterministic data-collection + one synthesis call. Heavily gated for safety (read-only commands and pipelines only, a safety-verify pass, neutral fitness that sinks a bad procedure; writes always stay on the LLM path). Measured live (deepseek-chat,`evidence/2026-06-12_autodistill_curve/`\n\n): the win scales with**iteration overhead**, not task size — a repeated multi-step task over small data dropped**×9.6 per repeat (70% over 5 runs)**, while a data-heavy audit (cost dominated by file contents, few iterations to cut) saved ~nothing. Honest rule: it removes repeated per-iteration context cost, not the cost of the data itself.**Tiny and hackable.** The memory core depends only on`numpy`\n\n; the whole agent is a handful of files. Swap providers, tools, or the embedder without fighting a framework.**Bring your own key.** Claude (default), DeepSeek, OpenAI, or any OpenAI-compatible endpoint.\n\n**Guided (recommended)** — one interactive script that explains every step,\nverifies your API key live, runs a real smoke test and shows how to use the\nagent (concept: [MavKa](https://github.com/MozgAI/MavKa) by MozgAI):\n\n```\nbash install.sh\n```\n\n**Manual:**\n\n```\npip install -e '.[anthropic]'      # Claude backend (official Anthropic SDK)\npip install -e '.[openai-compat]'  # DeepSeek / OpenAI-compatible (httpx)\npip install -e '.[embed]'          # semantic memory (sentence-transformers)\npip install -e '.[dev]'            # + pytest\n```\n\nPython ≥ 3.11.\n\n```\nexport CODER_PROVIDER=deepseek\nexport DEEPSEEK_API_KEY=sk-...\ncoder \"create a FastAPI hello-world app and run it\"\nexport CODER_PROVIDER=deepseek          # execution (code mode, tool loop)\nexport DEEPSEEK_API_KEY=sk-...\nexport CODER_REASON_PROVIDER=anthropic  # reasoning (text mode)\nexport ANTHROPIC_API_KEY=sk-ant-...\ncoder                                    # REPL: /text plans on Claude, /code executes on DeepSeek\n```\n\nThe expensive model is used only where it earns its keep; the token-heavy tool loop runs on the cheap one.\n\n```\ncoder                 # interactive REPL (default mode: code)\ncoder \"<task>\"        # headless: run one task, print result, exit\n```\n\nIn the REPL: `/code`\n\nagentic coding, `/text`\n\nreasoning chat, `/ctx`\n\ntoggle\ncontext-first, `/learn`\n\ntoggle auto-distill, `/council <question>`\n\ntwo-provider debate → consensus, `/quit`\n\nto\nexit. Memory persists per project at `<workdir>/.raidho/memory`\n\n— the REPL shows\nhow many facts it loaded on start.\n\n``` python\nimport asyncio\nfrom agent.providers import get_provider\nfrom agent.loop import Session\nfrom agent.memory import AgentMemory\n\nreason = get_provider({\"provider\": \"anthropic\", \"api_key\": \"sk-ant-...\"})        # smart\nexecute = get_provider({\"provider\": \"deepseek\",  \"api_key\": \"sk-...\",            # cheap\n                        \"model\": \"deepseek-chat\"})\n\n# path=... makes memory persist across runs (omit it for an in-RAM, ephemeral memory)\nmemory = AgentMemory(path=\".raidho/memory\")\nsession = Session(execute, workdir=\".\", memory=memory, reason_provider=reason)\n\nasyncio.run(session.chat(\"plan how to add auth to this app\"))   # → reason provider\nasyncio.run(session.code(\"implement the plan and add a test\"))  # → execution provider\n# facts the agent stored are now on disk; a new Session(path=...) reloads them\n```\n\nOmit `reason_provider`\n\nand both modes use the single provider.\n\n``` python\nfrom agent.council import Council\n\ncouncil = Council(reason, execute, name_a=\"claude\", name_b=\"deepseek\")\nresult = await council.consensus(\"pin exact deps or use ranges?\", rounds=2)\nprint(result[\"verdict\"])      # points of agreement / residual disagreements / recommendation\n# result[\"transcript\"] holds the full exchange\n\n# Via a Session with memory, the verdict is auto-distilled into facts and stored:\nres = await session.council(\"pin exact deps or use ranges?\")\nprint(res[\"remembered\"])      # e.g. [(\"dependencies\", \"pinned\", \"exact\")] — recalled later\n```\n\nOr `Session(...).council(\"...\")`\n\n, which seats `reason_provider`\n\nvs `provider`\n\n.\n\n| Variable | Meaning | Default |\n|---|---|---|\n`CODER_PROVIDER` |\nexecution provider: `anthropic` | `deepseek` | `openai` | `openai-compat` |\n`anthropic` |\n`CODER_MODEL` |\noverride execution model | provider default |\n`CODER_REASON_PROVIDER` |\noptional separate provider for `text` /reasoning |\n= `CODER_PROVIDER` |\n`CODER_REASON_MODEL` |\nreasoning model | provider default |\n`CODER_BASE_URL` |\nendpoint URL for `openai-compat` |\n— |\n`CODER_CONTEXT_FIRST` |\n`1` packs the workspace into the first call (fewer tool iterations) |\noff |\n`CODER_AUTODISTILL` |\n`1` learns read-only procedures from successful runs (gets cheaper with repetition) |\noff |\n`CODER_MEMORY` |\nmemory file path; `off` disables persistence |\n`<workdir>/.raidho/memory` |\n`ANTHROPIC_API_KEY` / `DEEPSEEK_API_KEY` / `OPENAI_API_KEY` / `CODER_API_KEY` |\nAPI keys (provider-specific first, then `CODER_API_KEY` ) |\n— |\n\nSee [docs/PROVIDERS.md](/vitaliyfedotovpro-art/raidho/blob/main/docs/PROVIDERS.md) for adding a provider and the auth hook.\n\n[docs/ARCHITECTURE.md](/vitaliyfedotovpro-art/raidho/blob/main/docs/ARCHITECTURE.md)— components and data flow.[docs/MEMORY.md](/vitaliyfedotovpro-art/raidho/blob/main/docs/MEMORY.md)— the VSA memory model and bit-packing.[docs/OPENWEBUI.md](/vitaliyfedotovpro-art/raidho/blob/main/docs/OPENWEBUI.md)— drive Raidho from Open WebUI (chat / council / code as selectable models).\n\n- Broader benchmark coverage (success rate on a task set vs. single-model baseline; SWE-bench-style eval) — a first real-API cost benchmark with evidence is already in\n`benchmarks/`\n\n+`evidence/`\n\n. - Streaming responses in the Open WebUI plugin (currently the reply lands at once).\n\nRecently shipped: persistent memory across runs · council verdicts saved as facts · context-first mode · auto-picked semantic embedder · automatic Open WebUI setup.\n\nThe `bash`\n\ntool runs **unsandboxed** in the working directory; in `code`\n\nmode the\nmodel decides which commands to run. Use Raidho only on code and tasks you trust —\nideally inside a container or a throwaway directory. See [SECURITY.md](/vitaliyfedotovpro-art/raidho/blob/main/SECURITY.md).\n\nDual-licensed: **AGPL-3.0-or-later** for open-source / research / non-commercial use,\nor a commercial license — see [COMMERCIAL.md](/vitaliyfedotovpro-art/raidho/blob/main/COMMERCIAL.md).\n\nSee [CONTRIBUTING.md](/vitaliyfedotovpro-art/raidho/blob/main/CONTRIBUTING.md). Issues and pull requests welcome.\n\n— the web interface Raidho plugs into. It's an excellent, polished chat UI and a perfect fit for this agent; rather than reinvent it, Raidho ships a Pipe plugin and the installer can wire itself in automatically. Thanks to the Open WebUI team.[Open WebUI](https://github.com/open-webui/open-webui)— this project's critic throughout its path: his reviews shaped the retry layer, the embedder honesty, the history budget and more. The guided installer ([Oles Lytvyn (MozgAI)](https://github.com/MozgAI)`install.sh`\n\n) follows the concept he pioneered in— an installer that explains everything out of the box (\"AI installs itself\").[MavKa](https://github.com/MozgAI/MavKa)", "url": "https://wpnews.pro/news/show-hn-coding-agent-with-algebraic-memory-vsa-instead-of-rag", "canonical_source": "https://github.com/vitaliyfedotovpro-art/raidho", "published_at": "2026-06-14 23:44:56+00:00", "updated_at": "2026-06-15 00:12:38.091000+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models", "ai-infrastructure"], "entities": ["Raidho", "Claude", "DeepSeek", "OpenAI", "Anthropic", "VSA", "MozgAI", "MavKa"], "alternates": {"html": "https://wpnews.pro/news/show-hn-coding-agent-with-algebraic-memory-vsa-instead-of-rag", "markdown": "https://wpnews.pro/news/show-hn-coding-agent-with-algebraic-memory-vsa-instead-of-rag.md", "text": "https://wpnews.pro/news/show-hn-coding-agent-with-algebraic-memory-vsa-instead-of-rag.txt", "jsonld": "https://wpnews.pro/news/show-hn-coding-agent-with-algebraic-memory-vsa-instead-of-rag.jsonld"}}