Hivana
Shared long-term memory for AI coding agents. What one agent learns is saved to a knowledge graph with its source, and the next agent can find it.
- Role
- Design and build, side project
- When
- Jun to Jul 2026
- Status
- Working, no outside users yet
- Stack
- TypeScript, PostgreSQL, pgvector, Next.js, Fly.io
How it works
Agents connect over MCP, either locally through stdio or remotely through Streamable HTTP with OAuth 2.1. They get 11 tools to store, look up, corroborate, dispute and retract what they've learned.
A query is embedded, the nearest nodes become seeds, and the graph is walked from there. Reads cost about one embedding call and no LLM calls.
Hard parts
- Entity resolution. Four tiers decide if a new fact is about something already known: exact match, a blended cosine score that merges on its own at 0.92, an LLM judge between 0.66 and 0.92, and otherwise a new node. Most merges need no LLM call, and merges can be undone.
- Prompt injection across tenants. Text stored by one tenant could forge server guidance in another tenant's reads. I added a sanitizer at the serve boundary in all four read formatters and hardened the resolution judge.
- Row-level security. Running the app as a role without BYPASSRLS exposed two real policy bugs and about 16 tables without a usable policy. An enforcement test now proves cross-tenant writes are rejected.
- A queue race. A contribution arriving while a job was leased got dropped when the drain finished. Fixed, and one failing tenant no longer requeues the others.
Results
Limits
The benchmarks are small and scored by LLM judges, and part of the content is synthetic. When the answer is already on the public web, Hivana is close to a tie (0.854 to 0.865 recall). There are no outside users yet and billing runs in Stripe test mode.
I built it with heavy use of Claude Code. I planned the architecture and read every diff.