Skip to main content
Back to Projects

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.

Durable memory
Two assistants, one store (MCP)
Local embeddings
Explainable retrieval

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

1Ingest2Promote3Link4Retrieve5Compile6Correct7Resurface

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.

Postgres + pgvector is the primary runtime, with SQLite continuity behind the same repository boundary
Semantic search runs on local Ollama embeddings (nomic-embed-text, 768-dim) layered over an explainable keyword ranker
Automated loops keep memory alive: session import every 5 minutes, a weekly AI-written digest, and a daily spaced-repetition review question

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

What ships today

One durable store shared by a human and two AI assistants (Claude Code + Hermes) through an 11-tool MCP server
Semantic retrieval upgraded to local 768-dim Ollama embeddings with 5,000+ items re-embedded — validated against the keyword ranker with a recorded eval before cutover, and the explainable ranking signals kept
Automated knowledge loops: 5-minute session import, a weekly AI-written review digest, and a daily spaced-repetition reflection question over Telegram (2d/7d/30d schedule)
Event-driven ingestion: a YouTube link dropped in a Telegram topic becomes a transcribed, LLM-summarized knowledge item with typed relationships (created_from, relates_to, semantically inferred similar_to)
Idea Galaxy graph view renders captured thinking as thinkers, topics, and thought capsules across two domains (philosophy + AI tools)
Maintains a repo-native eval corpus with 16 workflow scenarios, 54 recorded executions, and a latest recorded pass rate of 100%
TypeScript
Node.js
PostgreSQL
pgvector
Ollama Embeddings (nomic-embed-text)
MCP Server (stdio JSON-RPC)
Local LLM Enrichment (qwen3)
Hybrid Retrieval
Graph-aware Context Packets
Telegram + Cron Automation
SQLite Continuity Path
Migration-backed Schema