Skip to content

Coding agents forget. statefulmemory remembers — Laya decides on-device.

Persistent memory for coding agents: per-project SQLite, hybrid search, code-anchored verify — plus a local System-1 (native MLX on Apple Silicon) that routes, decides, and judges conflicts in one forward pass. Self-host or use StatefulMemory Cloud.

brew install sanudatta11/tap/statefulmemory then smem install — wires your agent (MCP), git verify hooks, and the Laya System-1 sidecar. Skip Laya with –no-laya · same binary as sm

The full arc in two minutes — forget → remember → retrieve → verify → decide → connect → Laya.

14 install targets

Claude Code, Cursor, Windsurf, OpenCode, Codex, Gemini CLI, Amazon Q and more — MCP tools and skills wired in one command.

Inspectable SQLite

Per-project database under ~/.statefulmemory/ with FTS5. Read it, back it up, export it as a portable .mem archive — never a black box.

Hybrid, no API key

BM25 + dense retrieval fused with RRF, plus a local reranker on the self-host path. Search and context work fully offline.

On-device System-1

Native laya-mlx on Apple Silicon decides query tier, Decide, and conflict verdicts in one forward pass (~13 ms router P50 on an M3 Max). PyTorch elsewhere.

Your agent’s chat log dies with the window. Every new session, it re-learns the same decisions, re-trips the same pitfalls, and drifts on the same open questions. StatefulMemory keeps the durable record: what you decided, why, and which code it is pinned to — then hands the agent the right context the next time it starts.

Long context models still pay attention cost inside the window. Effective context compiles decisions, anchors, and facts into a fixed host window, so a 200k or 1M-token agent acts like a much larger working set.

Remember

smem obs save –type decision –title “use pgx not GORM” — every choice lands in per-project SQLite, optionally pinned to code.

Retrieve

smem obs context –query “which ORM should we use?” — hybrid BM25 + dense, token-budgeted, ranked for the task at hand.

Verify

smem obs save –anchor src/auth.rs::login … — git hooks re-check anchors; stale claims are withdrawn from context.

Decide

smem decide “SQLite or Postgres?” — conflicting memories get a typed verdict: in force, superseded, archived.

Connect

smem graph query auth –hops 2 — entity graph with PPR ranking surfaces related decisions you forgot existed.

Laya

smem install — a System-1 sidecar that answers router / decide / conflict questions locally, with silent fallback. Full story on the Laya page.

LAYA · SYSTEM-1

Thinks in one pass, not one round-trip.

The LLM is System-2: slow, token-hungry, remote. Laya is System-1: non-autoregressive, local, typed — it answers the discrete questions your memory layer asks (which retrieval tier, what should Decide say, does this conflict) in a single forward pass.

System-2

LLM round-trip

  • Tokens per call
  • Remote or paid
  • Latency on the network
System-1

Laya · one forward pass

  • Router ~30 ms / Decide ~100–200 ms on MLX
  • Loopback · no network
  • Open weights · Apache-2.0 · $0 self-hosted
query routerEasy skips dense · Hard expands + graph
deciderecommend a side · abstain when evidence is thin
conflict judgeSUPERSEDES verdicts for in-force memory
$ curl -s http://127.0.0.1:8765/health
{ "ok": true, "backend": "mlx", "loaded": [...], "error": null }

auto picks laya-mlx on Apple Silicon (macOS 14+, Python ≥ 3.11) and PyTorch elsewhere — same checkpoints, same typed schema. Weak calls soft-fail to heuristics or your agent CLI. Never a hard dependency. Read the Laya guide

Self-host

Daemon on your laptop (Unix socket) or team TCP+TLS. Data stays yours — inspect, backup, delete.

StatefulMemory Cloud

Same CLI and MCP surfaces, hosted storage and ops, when you would rather not run the daemon.

Portable

Export a .mem archive and import anywhere. Your memory follows you, not a vendor’s lock-in.

For LLM crawlers: llms.txt · llms-full.txt · AGENTS.md (OpenCode / Codex / local) · CLAUDE.md.