Two-tier memory enables queryable long-term storage for agents
For practitioners building AI coding agents, a compact index plus on-demand detailed storage reduces context-window costs and lowers repeated work during debugging and repair. Per the public GitHub repository tadelstein9/two-tier-memory, the project implements a two-tier long-term memory: a lightweight always-loaded index (INDEX.md) and a SQLite-backed, queryable Tier 2 that stores one row per solved problem (fields such as problem, root cause, what worked, gotcha, artifacts). Per the repository README, the index is generated from the database so it stays synchronized and the repo includes CLI examples (python3 memory.py init, python3 memory.py add) showing how to add and query entries.
Editorial analysis
For agent builders, the practical value of a two-tier pattern is reducing token waste while preserving recall and reproducibility; keeping a tiny discoverability index in session and fetching full records only when relevant lowers accidental forgetting and repeated rework.
What the repository provides, Per the GitHub README for tadelstein9/two-tier-memory, the project describes a two-tier architecture: Tier 1, a one-line-per-problem index intended to be cheap to load every session (INDEX.md); and Tier 2, a plain SQLite file that stores detailed rows (problem, root cause, what worked, gotcha, artifacts) and is queried on demand. The README includes usage snippets and a companion essay explaining the motivation.
Technical note, The repository shows generating the INDEX.md from the Tier 2 SQLite store so the index does not drift, and includes simple CLI commands such as python3 memory.py init and python3 memory.py add to populate and query the database. The pattern explicitly contrasts loading many markdown files into context with selective retrieval from a structured table.
Industry context
Teams building retrieval-augmented agents commonly choose between vector stores, embeddings, or structured metadata. The two-tier design maps to a discoverability-first index plus payload store, a pattern that complements both local-first workflows and hybrid RAG pipelines.
What to watch
adoption in agent frameworks, how teams map the Tier 2 schema to vector indexes or document stores, and tooling for automated indexing and query templates.
Key Points
- 1A compact, always-loaded index reduces context-window churn by restricting what enters the model prompt until relevance is established.
- 2Separating discoverability from payload aligns with RAG best practices, lowering token cost and improving retrieval precision for coding agents.
- 3A local SQLite-backed Tier 2 simplifies reproducibility and offline debugging compared with ad hoc file dumps and full-document context loading.
Scoring Rationale
This is a practical engineering pattern useful to practitioners building agent memory systems. It is not a frontier research breakthrough but offers a low-friction approach that can improve reliability and token efficiency for coding agents.
Sources
Public references used for this report.
Practice interview problems based on real data
1,625 SQL & Python problems across 15 industry datasets — the exact type of data you work with.
Try 250 free problems