Give Your Agents Persistent Memory in One Prompt

"Memory is not a volume to be filled, its a surface to be encoded"

local-first · open source · self-improving

SEAM is Surface Encoded Agent Memory. It is a self-improving memory layer designed to give AI real persistence. It takes a machine-first approach by compressing natural language into a machine-first shorthand called MIRL. MIRL is a token compression language that is directly queryable and 100% lossless. SEAM uses Postgres and SQL as the canonical source of truth, making it 100% lossless. Hybrid retrieval treats RAG as an acceleration layer, achieving token compression of up to 90%.

bash — seam
╭─ Architecture ─╮

The canonical data path.

SEAM compiles untrusted source material into canonical MIRL records (the readable semantic IR), persists them as durable truth in SQLite, derives rebuildable indexes, orchestrates six retrieval signals, and emits token-bounded PACK context. RAW preserves the original evidence. Retrieved content is always data — never authority.

Source
Files
Ingest
RAW
Preserve
MIRL
Compiler
SQLite
Vector
Index
PACK
Context
╭─ Surface Compile ─╮

The holographic memory surface. Live.

Canonical MIRL (or SEAM-RC/1 readable compression) gets wrapped in a SEAM-HS/1 holographic envelope and embedded losslessly into PNG pixel data. Direct query, search, and context packing happen straight from the image in memory — no OCR, no decompression, no loss of provenance.

╭─ Invariants ─╮

Architectural guarantees.

These are not aspirational — they are enforced.

01RAW preserves source detail required for exact recovery.
02MIRL preserves canonical meaning, structure, uncertainty, contradiction, time, and provenance.
03SQLite remains canonical source of truth.
04Vector, graph, and search indexes remain rebuildable acceleration layers.
05Retrieved content never automatically receives tool or operator authority.
06PACK preserves prompt-time utility and remains derived.
07Lossless claims require exact reconstruction and integrity verification.
08Benchmark claims remain auditable, diffed, gated, and isolated from tuning leakage.
╭─ Interfaces ─╮

Four Interfaces. Same Runtime.

Every surface — CLI, MCP stdio, REST + browser dashboard, and more — drives the exact same runtime. Ingest, MIRL compilation, retrieval orchestration, PACK emission, and refinement all happen in the core. The interfaces are thin, auditable adapters.

seam $ start [OK] Connected [OK] Ready seam $

CLI

Operator-facing composition surface.

seam <command>

MCP

Standard agent-tool protocol via stdio.

stdio · agents
GET POST :8765

REST

FastAPI with browser dashboard.

seam serve :8765
PERF-X

Dashboard

Operator observation and control.

seam dashboard
╭─ System Context ─╮

One runtime.
Four surfaces.

SEAM exposes its core memory runtime to operators and agents through four primary external interfaces, or surfaces. All four of these surfaces share and call the exact same underlying runtime behaviors rather than reimplementing them:

  • CLI (Command Line Interface): This is the primary composition and operational surface for human operators. It provides cross-platform commands for tasks like ingestion, retrieval, context packing, and benchmark execution.
  • MCP (Model Context Protocol): This is the standard external agent-tool bridge. Operating over stdio, it allows AI agents (like Claude, Gemini, or Cursor) to natively discover and interact with SEAM's memory. Its security boundary explicitly handles tool descriptions, bounded arguments, and error redaction so sensitive internal errors aren't leaked to untrusted clients.
  • REST API: This HTTP surface exposes SEAM's runtime operations (like /compile, /search, and /context) and serves the browser dashboard. It acts as a strict trust boundary, enforcing necessary controls like Bearer token authentication, CORS, rate limits, and request body size budgets.
  • Dashboard and Browser UI: This surface is dedicated to operator observation and control. It includes both the interactive Textual terminal dashboard and the browser WebUI. While it provides a rich visual state of the system (including memory records, retrieval traces, and runtime health), the UI state itself is never considered the canonical source of truth.
SEAM Runtime Operator AI Agent Source Files CLI / MCP / REST / Dashboard SQLite canonical state Vector Stores derived
╭─ Layers ─╮

Four representation layers.

RAW preserves exact evidence. MIRL is the canonical semantic IR. PACK produces dense, budgeted context for agents. LENS shapes task-specific views — all with unbreakable provenance back to source.

RAW

Preserve exact source detail for recovery. Source identity, hashes, exact spans and offsets, provenance, and prompt-injection containment before anything becomes canonical.

MIRL

The canonical MIRL semantic IR. Deterministic records with stable identities, entity/relation consistency, uncertainty, contradiction state, temporal semantics, and full provenance bindings.

PACK

Token-bounded context projection for agents. Relevance + displacement scoring, strict budgets, provenance retention, and explicit lossy-vs-exact modes.

LENS

Task- or interface-specific views over canonical records. View filtering with stable back-references. No promotion of summaries into truth.

╭─ Skill Factory ─╮

Continuously evolve the Agent Compiler.

The SEAM Skill Factory is an adaptive system designed to continuously evolve and improve the static Agent Compiler over time. Its core principle is that as SEAM improves, the agents operating it should improve alongside it.

Rather than just writing one-off prompts, the Skill Factory works through a structured, 7-layer loop that observes agent behavior, proposes optimizations, and safely applies them:

01 Identity Layer Detects the specific agent or harness being used, such as Claude, Codex, Gemini, Cursor, Aider, or generic.
02 Profile Layer Outlines the agent's constraints, expected output shape, verbosity, and path templates.
03 Observation Layer Records repeated issues and automation opportunities as structured notes. Uses the "improvement stream" logging these observations as retrieval-signal and repeated-hit events.
04 Proposal Layer Generates candidate skill changes from the recorded observations. These proposals materialize as propose-rule events in the improvement stream.
05 Rendering Layer Writes the target-specific skill artifacts based on the proposal.
06 Verification Layer Evaluates the candidate skills to ensure they work correctly before promotion.
07 Promotion Layer Applies the optimized skills to the agent, which is strictly gated by an explicit operator review.
[!] STRICT SAFETY RULES

To prevent the system from self-corrupting or creating unstable agent instructions, the Skill Factory operates under absolute safety invariants:

╭─ Retrieval ─╮

Six retrieval signals.
One orchestrator.

Lexical, vector, graph, temporal, hybrid, and mix signals are orchestrated together. The system measures displacement and precision, not just recall. Every decision produces full traces back to the exact MIRL records used.

Modes6
SignalsMulti
BudgetToken-bounded
SEAM retrieval modes performance comparison: lexical, vector, graph, temporal, hybrid, mix
╭─ Capabilities ─╮

Built for agents. Engineered for trust.

Canonical MIRL in SQLite. Rebuildable indexes. Multi-signal retrieval. Token-bounded PACK. Self-improving refinement. Holographic surfaces. Everything an agent needs to remember — exactly, durably, and on its own terms.

Canonical SQLite

Records live in SQLite as the single source of truth. Indexes exist only as query accelerators and can be thrown away and rebuilt without loss.

Retrieval Orchestration

Multiple orthogonal signals are combined at query time, with full traces so you can see exactly why a record was chosen.

Token-Bounded Context

Context is produced under explicit token limits. Every projection keeps provenance back-pointers and declares whether it is lossy or exact.

Agent Bridge (MCP)

Standard MCP stdio protocol. Works with Gemini, Claude, Cursor, and any MCP-compatible client.

REST API & Dashboard

FastAPI/Uvicorn server with auth, CORS, rate limiting, SSRF controls, and a full browser dashboard.

NL/Document Compiler

Source-to-MIRL transformation with provenance preservation. Evidence survives compilation.

Graph & Temporal

Entity relationships, temporal semantics, contradiction state. Supersession-aware ranking prevents stale data.

Security-First

Retrieved content never gains authority. Prompt-injection containment, scope isolation, atomic writes.

Self-Improvement Loop

Refinement agents detect contradictions and drift. New records emitted during operation are compiled back into the canonical store, updating indexes, skills, and future retrieval.

Skill Compiler

.skill.md files declare triggers, steps, and contracts. Compiled into versioned, reloadable capabilities with provenance — skills become first-class MIRL citizens.

Benchmark Glassbox

Every run records the exact MIRL ids, retrieval traces, PACK contents, and decision paths used. Holdout-sealed and hash-verified — no score without its glassbox evidence.

╭─ Support ─╮

Support the developer.

If you find SEAM valuable, consider supporting the research.

Follow on X Ko-fi Buy Me a Coffee Patreon