Shared Memory Layer
Second Brain
Postgres-Backed Shared Memory for Humans, Agents, and Service Workflows
A shared memory substrate where humans, agents, and service-generated workflow data operate on the same durable relational base. The current implementation combines Postgres + pgvector, evidence-first ingest, explicit and inferred links, canonical identity resolution, hybrid retrieval, and graph-aware context packet assembly.
Postgres + pgvector
Primary runtime path
Service ingest
Evidence-first data path
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 now ingests workflow evidence, promotes durable records, and returns compact graph-aware packets that can continue a run without dumping raw logs.
01
Why it matters
Operational agent systems lose continuity when useful workflow state is trapped in traces, task logs, reflections, and chat fragments. The memory layer needs to separate durable knowledge from execution noise, preserve provenance, keep corrections visible, and compile context that is compact enough to continue real work.
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 the system as a TypeScript-first Node service with one repository boundary across SQLite and PostgreSQL. Postgres + pgvector is the primary runtime path, while SQLite remains available for continuity and local runs. Service-generated workflow data is ingested through the same shared service layer, promoted into durable memory items and relationships, enriched with semantic and identity links, and assembled into bounded graph-aware context packets with explainable signals and provenance summaries.
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



