Projects

Strata: A Tiered Memory System for AI Agents

Creator & Lead Developer

2026-05-25

PythonSQLiteMarkdownCLIMCP

GitHub · Blog Post

Most memory systems treat all information the same way. A conversation from five minutes ago gets the same treatment as a decision from six months ago. Same storage cost. Same retrieval method. Same everything.

I think this is wasteful. Information decays over time, and your storage should reflect that.

Strata separates memory into three tiers (like geological layers). The top layer is for active work. The middle layer is for things that have cooled down. The bottom layer is a deep archive with a keyword-searchable index. Files move between layers automatically based on age and access patterns. No LLM calls needed.

How it works

The system uses three filesystem directories. Each one serves a different purpose.

1st Stratum is the agent's working memory. These are plain markdown files sitting in active/. The agent reads and writes directly to them. There's no database and no vector index. An auto-generated index.md file lists everything available, so the agent can find what it needs by reading the map first.

2nd Stratum is for files that have cooled down. The Janitor (a background process) moves them from active/ to cooled/ based on age (default is 14 days for projects, 60 for entities). The files are still on disk and still searchable. But the agent can't write to them directly. If it needs to edit something, the file gets rehydrated back to the 1st Stratum first.

3rd Stratum is the archive. The Janitor evicts cold files here based on how long it's been since they were last accessed (default is 90 days). Content gets saved as JSON in archive/. A lightweight Shadow Index (SQLite with FTS5) keeps everything searchable by keyword. When a search finds something in the archive, the file gets pulled back into active automatically.

The Shadow Index

This part matters. When a file gets archived, the Janitor doesn't delete it. It stores a lightweight entry with keywords, a short preview, and a pointer to the JSON file. A million of these entries cost almost nothing to store.

When you search and don't find anything in active or cooled, Strata checks the Shadow Index. A match means the file gets rehydrated back to active, ready for the agent to read and edit. The memory comes back because it proved useful again.

Design decisions

Zero dependencies. The core has no pip packages at all. Phase 1 uses pathlib. Phase 3 uses sqlite3 and json. All of these are in Python's standard library. The only optional dependency is QMD for hybrid search, and that's just a CLI call if you have it installed.

Files instead of databases. Every memory is a markdown file on disk. The agent can grep it, edit it, version it with git, or pipe it into another tool. No API calls and no SDK required.

CLI-first. The strata command handles everything. There are 18 commands covering read, write, search, lifecycle management, daemon control, and agent integration. It also exposes an MCP server for agents that speak the Model Context Protocol.

The daemon. strata serve starts a background Janitor that runs migration and eviction on a schedule (every 15 minutes by default). It logs everything, handles shutdown signals gracefully, and starts with a dry-run cycle so you can see what would happen before it runs live.

Testing

There are 99 tests across 11 files covering all three strata, the Janitor, the query engine, the daemon, the MCP server, and the CLI. The full suite runs in under 2 seconds.

What I learned

The original design had LLM compression built into the migration step. You'd feed a raw file to GPT-4o and get back a 200-word summary with entity tags. It worked, but it was overkill. The Janitor doesn't need to be smart. It needs to be reliable.

Moving to a filesystem-only architecture eliminated the most expensive operation in the system. The Janitor went from "call an API and parse JSON" to "check a timestamp and maybe copy a file." The lifecycle logic got simpler, the tests got faster, and the system became truly zero-dependency.

The Shadow Index turned out to be the most important piece. I initially thought of it as a minor feature, but it's what separates Strata from systems like mem0 or QMD. Those either grow forever or delete permanently. The Shadow Index gives you an infinite memory horizon at near-zero storage cost. You never truly lose anything. It just gets put away until you need it again.