Memory Layer
How it works

Runtime topology

Memory Layer is built around one shared service and database. The CLI, TUI, browser UI, watcher manager, and MCP server are adapters around the same project-scoped backend.

Components

ComponentRole
memory CLIHuman and agent automation surface.
mem-serviceLocal HTTP API, web UI host, curation pipeline, embedding jobs, MCP HTTP mount.
TUITerminal dashboard for humans reviewing memory, evidence, agents, and diagnostics.
Browser UIWeb companion using the same service APIs as the TUI.
WatchersBackground processes that observe agent sessions and report activity.
MCP serverRead-first protocol adapter for MCP clients; it reuses the service API.
PostgreSQLDurable store for projects, memories, captures, activities, history, graph data, and embeddings.

Configuration layers

LayerTypical contents
Global configDatabase URL, service URL, API token, providers, service preferences.
Project configProject slug, repo root, project-specific options.
Repo-local .agents/Agent instructions and Memory Layer skills.
Runtime stateCheckpoints, service status, watcher heartbeats, generated logs.

Do not commit secrets, API keys, database URLs, or local runtime state. Repo-local project identity and agent instructions are normally safe to commit after review.

Service ports and modes

Packaged installs normally run the service in the background through systemd on Linux or launchd on macOS. Development runs use the foreground command:

memory service run

The foreground command should keep running in the terminal and should not daemonize itself. If you need background operation, use the packaged service manager.

MCP as an adapter

The built-in MCP server exposes read-first Memory tools to clients such as Codex and Claude. It does not write directly to the database. Stdio MCP runs as a local process; HTTP MCP is mounted by the service and should stay local and token-protected.

Operational rule

When something looks wrong, check the layers in order:

memory doctor
memory health
memory status --project <project-slug>

Then inspect the TUI Errors tab, service logs, watcher status, and embedding diagnostics.

© 2026 Olivier Van Acker (3vilM33pl3). Memory Layer is AGPL-3.0-or-later with commercial licensing available.

On this page