AI-dev library · memory systems · read 2026-08-10
Three ways to give an AI a brain, compared with gbrain as the anchor. Hermes asks: what tiny set of facts should sit in every single prompt? gbrain asks: how do I keep everything and still find the right piece? OpenBrain asks: how do all my AIs — Claude, ChatGPT, Cursor — share the one memory of me?
TL;DR
Hermes memory is two small text files, about 1,300 tokens total, pasted whole into the system prompt every turn. There is no search. When the files get full, the agent must tidy them itself, right then, or the write is refused. gbrain memory is a whole knowledge base: markdown pages as the source of truth, a Postgres cache on top, typed fact rows with confidence that decays, a graph, hybrid search, and a night shift (gbrain calls it the dream cycle) that consolidates yesterday into long-term pages while you sleep.
OpenBrain (Nate B Jones's OB1) is the simplest of the three: one Postgres table with vector search, reachable by any AI over MCP. One drawer, every AI has a key. Capture and governance are excellent; but nothing consolidates, nothing decays, and recall is a single flat semantic search the AI has to remember to run.
None of these are competitors. Hermes solves identity (who is this user, always in context). gbrain solves knowledge (everything ever said, findable on demand). OpenBrain solves sharing (one memory, every tool). A full stack wants all three shapes.
Part one
The two systems
"The best memory stops the user repeating themselves."
MEMORY.md (2,200 chars ≈ 800 tokens) + USER.md (1,375 chars ≈ 500 tokens). Free-text entries split by a § line. No IDs, no timestamps, no metadata.state.db, ~20ms, zero LLM.tools/memory_tool.py · agent/background_review.py · agent/memory_manager.py"The next Postgres for memory."
gbrain:facts:begin) mirrored to typed DB rows.recall op; top-10 hot facts stapled to every MCP reply; a zero-LLM reflex that points at relevant pages; and hybrid search — vector + keyword + graph, fused. P@5 49 vs ~18 for plain RAG on its own benchmark.src/core/facts/backstop.ts · src/core/cycle.ts · docs/architecture/system-of-record.mdThe mechanism
Same grid, both systems. Look at what each one has that the other doesn't: Hermes has no retrieval stage at all — the store is the prompt. gbrain has no "always in context" stage at all — everything goes through a channel.
Similarities
Five real convictions in common — this is the current consensus of the field, not coincidence:
~/.hermes. gbrain: a git repo, with the database demoted to a rebuildable cache (CI actually fails PRs that write derived tables directly)..bak on any suspicious drift. gbrain never deletes fact rows; forget is a visible strikethrough in the markdown with a reason, so it survives a full DB rebuild.[BLOCKED] in the prompt copy only, raw text left on disk for the user to inspect and delete. gbrain's sanitizer states the threat outright: "a claim row in the takes table contains attacker-supplied text." Every stored claim rendered into a prompt is pattern-stripped (30+ pinned jailbreak strings → [redacted]) and wrapped in <take> tags the model must treat as data, with tag-escape attempts neutralized. Behind that: private fences stripped before chunking/embedding and on remote reads (the leak direction), and dream-cycle writers caged to an allow-list of folders — the last line for an injection that fools the model anyway, not the first. True deletion of poison is a human act in both: edit the file, git revert.Differences
The library's own comparison keys (DECISIONS.md, Memory bank M1–M9). Read any row as: same question, opposite bet.
| Question | hermes-agent | gbrain |
|---|---|---|
| M1 storage & index | Two text files + one SQLite (FTS5) for transcripts. All local, no server. | Markdown repo canonical; Postgres/PGLite derived cache with pgvector HNSW + tsvector. Scales to 17K-page brains. |
| M2 unit of memory | A free-text entry between § lines. That's it. |
Typed rows: a fact (hot, decaying), a take (cold, attributed to a holder), a page (compiled truth + append-only timeline). |
| M3 schema & typing | Schemaless on purpose. No IDs, dates, confidence — the format literally cannot carry metadata. | Heavily typed: CHECK-constrained kinds, confidence 0–1, visibility, bi-temporal validity. New ontology dimensions are quarantined until confirmed so a hallucination can't shape context. |
| M4 ingestion & capture | Agent tool calls + the 10-turn background fork. Optional filing gate: write_approval stages writes for the user to approve. |
Always-on extraction on every save through one choke point (runFactsBackstop). The filing gate is a notability rubric: high files now, medium waits for the night shift, low is dropped. |
| M5 linking & structure | None. Entries are prose; structure lives in skills instead. | Typed graph drawn automatically on every save by pattern-matching links — zero LLM tokens, never falls behind. |
| M6 retrieval stack | For the brain: none — always loaded. For history: keyword BM25 only, ~20ms, with hand-tuned demotions (cron chatter caused "recall blindness"). | Vector + keyword + RRF fusion + graph traversal + reranker, across four channels (pull, ambient push, reflex pointers, deep search). The graph is the load-bearing wall: +31 P@5 over plain RAG. |
| M7 compile vs retrieve | Compile only: who-you-are compiles into MEMORY.md, how-to into skills. History is retrieved raw, never synthesized. |
Both sides of the fork: every page keeps a pre-computed "compiled truth" section and the full retrieval stack assembles answers at query time. |
| M8 consolidation | At the moment of overflow, in-turn: the error message hands the agent its full inventory and says "merge now, then retry." No scheduler. | The night shift: ~25 dream-cycle phases. Consolidation clusters ≥3 day-old facts (cosine 0.85) and promotes them to takes, keeping the originals as audit trail. |
| M9 forgetting & pruning | Almost never. The hard cap forces triage instead of decay. Manual delete via /journey; reset nukes the file. |
Read-time confidence decay by kind (event 7d, preference 90d, belief 365d) — no row ever mutated by aging. Purge GCs ephemera only; facts are forever. |
One more fork the register doesn't ask: where the LLM spend goes. Hermes spends ~zero on memory (recall is FTS5; the fork reuses the cached prefix). gbrain spends at write time (Sonnet extraction per save) and overnight (the cycle), buying cheap, precise reads.
Judgment
.bak files on every drift, pending-approval JSON, and state.db transcripts have no retention policy.forget was refactored to survive rebuilds.Part two
OpenBrain is Nate B Jones's system — the Unlock AI guide is the pitch and setup walkthrough; the actual system is open source (NateBJones-Projects/OB1, cloned into the library as ob1, HEAD 6779106). Its why is anti-silo: vendor memory is a moat — ChatGPT's memory lives in ChatGPT, Claude's projects live in Claude, and "a vendor that remembers you is a vendor that's hard to leave." OB1's answer: memory is just a database problem — a table that stores what you said, an index that finds it by meaning, an API any client can call — so own it, and "your context stops being a switching cost and starts being an asset that compounds." Same ingredients as gbrain — Postgres, pgvector, MCP, LLM extraction at the door — arranged around the opposite answer to "where does the truth live."
The two systems
"One brain. All of them."
thoughts) on Supabase's free tier: content + 1536-d embedding + metadata JSON. The database is the truth. Files only exist if you run the backup script.search_thoughts — flat cosine top-10, threshold 0.5. No always-loaded profile, no push. A "live retrieval" skill exists precisely because nothing reads back on its own.CHECK that makes agent-written memory evidence, not instruction until a human confirms it.server/index.ts (643 lines — the whole runtime) · schemas/agent-memory/schema.sql · docs/01-getting-started.md"The next Postgres for memory."
recall op, top-10 hot facts stapled to every MCP reply, a reflex that points at relevant pages, and hybrid vector + keyword + graph search.src/core/facts/backstop.ts · src/core/cycle.ts · docs/architecture/system-of-record.mdThe mechanism
Left: OB1's whole loop on the same grid as part one — notice what's missing versus gbrain: no night-shift loop, and no push channels. Right: the single deepest difference between the two.
Similarities
CHECK — an agent literally cannot promote its own note to instruction-grade without a human confirming it.UPDATE/DELETE grants at all — even a buggy function can't rewrite history.Differences
Same M1–M9 keys as part one, gbrain on the left this time.
| Question | gbrain | OB1 / OpenBrain |
|---|---|---|
| M1 storage & index | Markdown repo canonical; Postgres/PGLite derived cache (pgvector HNSW + tsvector). Local or hosted. | One Supabase Postgres table is the brain: content, 1536-d embedding, metadata JSON, HNSW index. Free tier. No file layer. |
| M2 unit of memory | Typed rows: a fact (hot, decaying), a take (cold, attributed), a page (compiled truth + timeline). | A "thought": one idea, free text + JSON metadata. One-idea-per-row is a prompt convention, not a schema rule — an atomizer recipe exists to retro-fix violations. Sharp domain facts (calendar, pantry, CRM, job hunt) skip thoughts entirely and live in six typed extension tables — same database, so the meal planner can see the family calendar. |
| M3 schema & typing | CHECK-constrained kinds, confidence, visibility, bi-temporal validity; new ontology dimensions quarantined until confirmed. |
Schemaless core, plus a heavily governed agent-memory sidecar (8 types × provenance × review × use-policy). Three type vocabularies in the repo disagree with each other. |
| M4 ingestion & capture | Always-on: every save runs extraction through one choke point; notability filter drops noise at the door. | Deliberately no daemon — "a behavioral cue, not a timer." Skills tell each AI when to call capture_thought; 52 import recipes for bulk; a regex gate blocks secrets and transcript dumps from agent write-back. |
| M5 linking & structure | Typed graph drawn automatically on every save, zero LLM tokens. | Optional entity-graph sidecar (entities, edges, extraction queue + worker). Off in the stock build. |
| M6 retrieval stack | Vector + keyword + RRF fusion + graph + reranker across four channels, push and pull. P@5 49 on its own benchmark. | One flat cosine top-10, pull-only. The SQL supports metadata filtering — the stock tool never passes it. Thresholds disagree per surface (0.7 SQL default, 0.5 MCP, 0.25 agent API). No rerank. |
| M7 compile vs retrieve | Both: pre-computed "compiled truth" on every page and the full retrieval stack. | Pure retrieve. "You don't need to organize them — the vector search handles retrieval by meaning." A wiki-compiler recipe can compile pages, but it's manual, opt-in. |
| M8 consolidation | The night shift: ~25 dream-cycle phases promote day-old fact clusters into takes, nightly, automatically. | No scheduler at all. Maintenance is the human: dedup scripts, enrichment runs, a review queue, and a "weekly review" prompt you run yourself. |
| M9 forgetting & pruning | Read-time half-life decay by kind; forget = strikethrough that survives rebuilds; purge GCs ephemera. | Nothing expires by default. A recency-blend search function ships with weight 0 (off); stale_after/ttl_days columns are written and never enforced. No sweeper exists. |
Cost fork: OB1 runs on ~$0.10–0.30/month of tokens — its real ceiling is Supabase's 500K free-tier invocations, which one measured multi-connector setup burned through at 1.8M/week before the optimization recipe. gbrain spends real LLM money at write time (Sonnet per save) and every night.
Judgment
So what
Don't pick one — they're layers. Hermes is the pocket: tiny, curated, always on you. gbrain is the archive: everything, findable. OpenBrain is the socket: one plug every AI fits. The composite shape for a real stack: a capped always-in-prompt identity note (Hermes-style) on top of a markdown-canonical retrievable store with a night shift (gbrain-style), exposed to every tool over MCP with OB1-style trust rails on anything an agent writes.
Steal from Hermes: the frozen-snapshot rule (memory writes must never break the prompt cache mid-session), the hard cap with overflow-refusal (forces curation better than any prompt asking nicely), and error-message design as agent training.
Steal from gbrain: markdown as system of record with the DB as a disposable cache, the hot/cold split with one-way promotion, read-time decay as a pure function, and confidence-gated push. And learn from its scar: give every memory row an ID and a timestamp from day one — Hermes's § format can't retrofit metadata, and half its fragility traces to that.
Steal from OpenBrain: the evidence-not-instruction CHECK and human review queue for anything an agent writes back; recall traces (log what was recalled, at what rank, and whether it got used — the only way to debug memory later); and the write-back filter that keeps secrets and raw transcripts out of durable storage. And learn from its scar: ship the recall side with the same care as capture, or the drawer just fills.
Sources: source-level reads of hermes-agent (HEAD 2446c8b), gbrain, and ob1 (NateBJones-Projects/OB1, HEAD 6779106) on 2026-08-10; cross-checked 2026-08-11 against the Unlock AI "Open Brain" guide page (the pitch + setup walkthrough for the same system). Terms per the library glossary — repo's own word in parentheses on first use. Companion atlases: hermes-agent-atlas, gbrain-atlas.