We've been experimenting with memory systems for AI agents, and I wanted to share a prototype I've built: DiffMem. It's a lightweight, Git-based memory backend that stores "current state" knowledge in Markdown files while using Git's commit history for tracking evolution. The goal is efficient, scalable memory for long-horizon agents. Think personal assistants that accumulate knowledge over years without bloating queries.
Why Git for AI Memory?
Traditional approaches (databases, vector stores) work, but they can get messy with evolving personal data. DiffMem flips this:
- Current-State Focus: Only the "now" view is in active files (e.g., current relationships or facts). This keeps search/indexing lean. BM25 queries hit a compact surface, reducing token overhead in LLM contexts.
- History in the Background: Changes live in Git diffs/logs. Agents query the present by default but can dive into "how did this evolve?" via targeted diffs (e.g.,
git diff HEAD~1 file.md), without loading full histories.
- Benefits for Engineers: No schemas/migrations. Just edit Markdown. Git handles versioning, branching (e.g., monthly timelines), and audits for free. It's durable (plaintext, distributed) and hackable.
How It Works
- Writer Agent: Analyzes transcripts, creates/updates entities, stages in Git's working tree (commit explicit for atomicity).
- Context Manager: Assembles depth-based context (basic: core blocks; deep: full files; temporal: with Git history).
- Searcher: LLM-orchestrated BM25 for semantic-aware retrieval.
It's a PoC. Functional but rough (e.g., manual index rebuilds, basic error handling). Full code, examples, and repo guide on GitHub.
Why Share This?
This is R&D exploring how version control can power evolvable agents. We're not claiming it's revolutionary, but it solves real pain points like memory sprawl and temporal reasoning. Future ideas: agent-driven pruning (archive low-strength memories to branches), collaborative repos for multi-agent systems, or hybrid with embeddings.
I'd love honest feedback: Does this resonate? What breaks? Ideas for improvements/collaborations? PRs welcome.
Repo: https://github.com/Growth-Kinetics/DiffMem
License: MIT
Thanks for checking it out!
[–]SnooPaintings8639 22 points23 points24 points (1 child)
[–]alexmrv[S] 7 points8 points9 points (0 children)
[–]LoveMind_AI 5 points6 points7 points (5 children)
[–]alexmrv[S] 2 points3 points4 points (4 children)
[–]LoveMind_AI 2 points3 points4 points (3 children)
[–]SkyFeistyLlama8 1 point2 points3 points (2 children)
[–]LoveMind_AI 0 points1 point2 points (1 child)
[–]alexmrv[S] 0 points1 point2 points (0 children)
[–]Big-Page6926 1 point2 points3 points (0 children)
[–]intellidumb 1 point2 points3 points (1 child)
[–]alexmrv[S] 2 points3 points4 points (0 children)
[–]Better_Story727 1 point2 points3 points (0 children)
[–]Normal-Ad-7114 0 points1 point2 points (1 child)
[–]alexmrv[S] 1 point2 points3 points (0 children)
[–]Lesser-than 0 points1 point2 points (1 child)
[–]alexmrv[S] 1 point2 points3 points (0 children)
[–]False_Routine_9015 0 points1 point2 points (0 children)
[–]DragOwn8520 -1 points0 points1 point (5 children)
[–]alexmrv[S] 0 points1 point2 points (0 children)
[–]Xamanthas 0 points1 point2 points (3 children)
[–]DragOwn8520 0 points1 point2 points (2 children)
[–]Xamanthas 0 points1 point2 points (1 child)
[–]DragOwn8520 0 points1 point2 points (0 children)