Shared Memory Layer
Second Brain
One Durable Memory Shared by a Human and Two AI Assistants
A shared memory substrate where a human and two AI assistants — Claude Code and Hermes — operate on the same durable store through an MCP server. Postgres + pgvector with local Ollama embeddings, evidence-first ingest, typed relationships, explainable hybrid retrieval, graph-aware context packets, and automated loops that ingest, enrich, and resurface knowledge.
11 MCP tools
Shared by Claude Code + Hermes
768-dim local embeddings
Ollama nomic-embed-text
16 scenarios
Workflow eval corpus
Shared Memory Model
One durable memory substrate for UI, agents, and service-originated workflow data
PostgreSQL + pgvector is now the full-feature runtime path. SQLite remains available for local continuity, but all callers still route through the same repository and memory service boundary.
Workflow shape
This is no longer just a memory foundation. It ingests workflow evidence, promotes durable records, returns compact graph-aware packets — and closes the loop by resurfacing knowledge through a weekly digest and a daily spaced-repetition review question over Telegram.
01
Why it matters
Operational agent systems lose continuity when useful workflow state is trapped in traces, task logs, reflections, and chat fragments. And a memory that only stores is not enough: without provenance, explainable ranking, and loops that bring old insights back at the right moment, a knowledge store degrades into a write-only archive nobody trusts.
Workflow noise can pollute memory
Service traces, reflections, blockers, and next actions are useful only if durable signals are separated from transient execution chatter.
Provenance gets lost at retrieval time
If retrieved context cannot show where it came from or why it ranked, agents and humans cannot trust it enough to continue real work.
Shared memory fragments across callers
A memory layer breaks down if the UI, imports, and agent API each bypass the same repository and service path.
02
System shape
Built as a TypeScript-first Node service with one repository boundary across SQLite and PostgreSQL; Postgres + pgvector is the primary runtime. Semantic search runs on local Ollama embeddings (nomic-embed-text, 768-dim) layered over an explainable keyword ranker — the cutover was validated with a recorded eval comparison, not vibes. A hand-rolled MCP server exposes 11 tools (search, context packets, capture, relate, enrich, graph) to both assistants. Automation keeps the store alive: sessions import every 5 minutes, a weekly cron agent writes a review digest, a daily loop asks one spaced-repetition reflection question over Telegram, and an event-driven pipeline turns YouTube links dropped in chat into transcribed, LLM-summarized, cross-linked knowledge items rendered in an "Idea Galaxy" graph view.
Relational base
Items, relationships, and activity history stay durable and inspectable.
Evidence + provenance
Conversation evidence, promoted memory, semantic links, and alias resolution stay inspectable instead of collapsing into opaque context.
Shared service
UI, API, and service-ingest pipelines all write and retrieve through the same repository and service layer.
Graph-aware packet compiler
Semantic anchors, explicit links, inferred links, identity expansion, and role-aware trimming produce bounded context packets.
03



