gitwtfhub

wtf is two-tier-memory?

tadelstein9/two-tier-memory — explained in plain English

Analysis updated 2026-05-18

4PythonAudience · developerComplexity · 2/5LicenseSetup · easy

TL;DR

A lightweight SQLite based memory tool that lets AI coding agents look up past solved problems instead of reloading a growing pile of markdown files.

Mindmap

mindmap
  root((two-tier-memory))
    What it does
      Long term agent memory
      Two tier design
      SQLite backed
    Tech stack
      Python
      SQLite
    Use cases
      Store solved problems
      Search past solutions
      Keep always loaded index
    Audience
      Developers
      AI agent builders
    Commands
      init
      add
      query
      index

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Give a coding agent a searchable database of previously solved problems instead of loading every note file into context.

REASON 2

Keep a small always-loaded index of known issues while storing full details in a queryable database.

REASON 3

Search past solutions by keyword using built in full text search when a familiar problem comes up again.

REASON 4

Track root causes, gotchas, and fixes for recurring technical problems in a team or personal project.

What's in the stack?

PythonSQLite

How it stacks up

tadelstein9/two-tier-memory1038lab/agnes-ai3eyedtiger/video2vrcemote
Stars444
LanguagePythonPythonPython
Setup difficultyeasyeasyeasy
Complexity2/52/51/5
Audiencedevelopervibe codervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

No dependencies beyond Python 3 and its built in sqlite3 module.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

Wtf does this do

Two-tier-memory is a small tool that gives AI coding agents a better way to remember things they have already solved, instead of relying on a growing pile of markdown files loaded into the agent's context at the start of every session. The README explains that this approach works fine with a handful of files but breaks down once there are a hundred or more, because everything competes for the same limited context space, and once that space runs out the agent starts quietly forgetting things and re-solving problems it already fixed. The fix here borrows an old idea from databases: instead of loading everything, keep two separate layers. The first layer is a small, always-loaded index file with just a title and pointer for each solved problem, so the agent knows what already exists without needing the full details. The second layer is a plain SQLite database where each hard problem is stored as a row, including the problem itself, its root cause, what worked, and any gotchas. The database can hold thousands of entries cheaply, since the agent only looks something up when it actually needs it, using a built in search feature. The tool is a single Python script with no external dependencies beyond Python's own built in SQLite support. It offers simple commands to set up the database, add a new solved problem, search past entries, look up a specific one, and regenerate the always-loaded index file from the database. The author notes that the tool alone does not solve the problem. It only works well if the agent is instructed to search the memory before trying to solve something again, and if entries are kept accurate and removed once they turn out to be wrong. This project is released under the MIT license.

Yoink these prompts

Prompt 1
Show me how to set up this memory tool and add my first solved problem to it.
Prompt 2
Explain the difference between the tier 1 index and the tier 2 database in this project.
Prompt 3
Help me write project instructions so my coding agent queries this memory before solving a new problem.
Prompt 4
Walk me through the memory.py commands for adding, querying, and listing entries.

Frequently asked questions

wtf is two-tier-memory?

A lightweight SQLite based memory tool that lets AI coding agents look up past solved problems instead of reloading a growing pile of markdown files.

What language is two-tier-memory written in?

Mainly Python. The stack also includes Python, SQLite.

What license does two-tier-memory use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is two-tier-memory to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is two-tier-memory for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.