memory-flywheel
Skill1 starsChanged 5 months agoMITView on GitHub
Use to persist and recall per-project cross-session working memory so long or multi-project sessions don't lose detail to context compaction. Record each round of progress (verbatim I/O + reasoning + metadata) into a project memory dir, read a coarse INDEX first, then open only what keyword recall points at. Deterministic, grep-native, LLM-as-component.
In this repository42 other files it gives its agents.
- codex/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- new-hookSkill
- new-ruleSkill
- new-skillSkill
- publishSkill
- agent-config-adapterSkill
- agent-update-watcherSkill
- autopilotSkill
- autoresearch-toolfinderSkill
- claude-desktop-sessionsSkill
- code-verifierSkill
- doc-writingSkill
- end-of-turn-markerSkill
- figma-authoring-constraintsSkill
- figma-design-fetchSkill
- autopilotSkill
- autoresearch-toolfinderSkill
- code-verifierSkill
- linux-freeze-triageSkill
- long-running-tasksSkill
- preview-templateSkill
- privacy-redactSkill
- research-criticSkill
- agent-harness-generalSkill
- system-cleanupSkill
- verify-templateSkill
- verify-visualSkill
- init-codex-configSkill
- long-running-tasksSkill
- preview-templateSkill
- privacy-redactSkill
- prompt-librarySkill
- research-criticSkill
- system-cleanupSkill
- task-orchestratorSkill
- feature-audit-templateSkill
- workflow-fix-templateSkill
- task-relationship-analysisSkill
- tui-installerSkill
- verify-templateSkill
- verify-visualSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Recall: before acting, progressively — never load everything:
- Very specific: line 35
read INDEX.md (coarse), then
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
memory-flywheel
A per-project, cross-session memory built as an iterating data flywheel (WS-B; overhaul tasks 3/4/5).
It complements the raw JSONL logs and the compaction-summary memory: JSONL is too bulky to load whole,
and /compact is lossy (it keeps file states + decisions but drops intermediate reasoning and rejected
approaches — verified). The flywheel keeps the verbatim detail in grep-native files with a coarse→fine
index, so nothing important is silently lost and recall is cheap.
Design (see docs/strategy/agent-harness-overhaul-2026-07-09/00-research.md §B): integrative of Zep's
episodic→semantic tiers, MemWalker's descend-a-summary-tree, A-MEM's keyword/graph overlay, and Anthropic's
memory-tool + Skills progressive disclosure. The novel niche is a coding-agent, per-project, grep-native file
memory combining verbatim leaves + control metadata + a descended coarse→fine index + keyword recall.
Layout (under --root, default .agent-memory/)
<root>/<project>/
rounds/NNNN-<kind>.md one file per round: frontmatter (id, kind, title, ts, keywords) + VERBATIM body
INDEX.md coarse layer — a table of every round; READ THIS FIRSTThe loop (each substantive round)
- Record the round verbatim (raw input/output/decision), tagged with a kind + keywords:
python3 scripts/mem.py record --project P --kind design --title "…" --keywords a,b < body(auto-refreshesINDEX.md.) - Recall before acting, progressively — never load everything:
- read
INDEX.md(coarse), then python3 scripts/mem.py recall --project P --query "terms"→ ranked round files; open only those.- or plain
grep -ri terms <root>/P/rounds/(it's just files).
- read
- The store grows and recall improves as you use it — the flywheel.
Why LLM-as-component
record / index / recall are pure deterministic code (no model call). The model only writes the round content and reads what recall returns. This keeps memory cheap, reproducible, and front-end-inspectable.
Status
Extra recall knobs: recall --fuzzy matches similar/variant keywords (memory↔memories); link --from A --to B
records a graph edge and recall --graph pulls in rounds linked to a keyword hit (1 hop) so related context
surfaces without a shared keyword.
Evaluation: scripts/mem_eval.py --fixtures f.json runs recall over a synthetic corpus + gold-labelled
queries and reports recall@k (see eval-fixtures.example.json). Plug real sessions + gold labels into the same
JSON to measure on live data. Deterministic; tested (test_mem_eval.py, 3/3).
v0.3 (record / index / recall + --fuzzy + link & --graph overlay + runnable eval harness), tested
(test_mem.py 9/9, test_mem_eval.py 3/3). Planned: a supervising hook that reminds the agent to record, and
extending the eval harness with the lossiness-delta / descent-efficiency / flywheel-gain metrics from the paper.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

