Skip to main content
Back to Projects

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.

Durable memory
Human + agent shared path
Explainable retrieval

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

1Ingest2Promote3Link4Retrieve5Compile6Correct

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.

Postgres + pgvector is the primary runtime, with SQLite continuity behind the same repository boundary
Evidence-first ingest promotes durable items, explicit relationships, semantic links, and canonical entities
Hybrid retrieval compiles bounded graph-aware context packets with inspectable signals and provenance

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

What ships today

Runs PostgreSQL + pgvector as the full-feature runtime while preserving SQLite behind the same repository boundary
Ingests workflow evidence from services into durable items, explicit relationships, semantic relationships, and canonical entities with provenance
Compiles graph-aware context packets by combining semantic anchors, explicit links, inferred links, and identity expansion under a bounded role-aware budget
Keeps retrieval explainable with inspectable ranking signals, provenance summaries, correction visibility, and audit history
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
SQLite Continuity Path
Server-rendered UI
JSON API
Service Data Ingestion
Hybrid Retrieval
Graph-aware Context Packets
Migration-backed Schema