A filesystem-native, infinitely scalable hierarchical memory system for AI coding agents.
Unlike flat two-file systems (Hermes), vector databases (Mem0), or virtual memory management (Letta), pi-memory-tree organizes agent memory as a knowledge tree โ keywords index โ detail files โ sub-branches, growing naturally as knowledge accumulates.
Layer F (always loaded) โ What to focus on
โโโโโโโโโโโโโโโโโโโโโโโโ
โ WATCH.md โ โ Current focus topics
โ "Daemon โ ๅพ
ๅฏๅจ" โ drives smart loading
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
Level 0 (always loaded) โ Where to find it
โโโโโโโโโโโโโโโโโโโโโโโโ
โ MEMORY.md โ โ Keywords โ file mapping
โ "Daemon โ MEMORY2" โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโผโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โMEMORY1 โโMEMORY2 โโMEMORY3 โ Level 1 (on-demand)
โ_sem.md โโ_epi.md โโ_pro.md โ
โ็ฏๅข้
็ฝฎ โโ Daemon โโ ๅทฅๅ
ท้ โ
โโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโ
โ โ
โผ โโโโโโโโโโโโ
โโโโโโโโโโ โผ โผ
โMEMORY1โ โโโโโโโโโโ โโโโโโโโโโ
โ-1_sem โ โMEMORY3 โ โMEMORY3 โ Level 2+
โๅผๅๅทฅๅ
ทโ โ-1_pro โ โ-2_pro โ
โโโโโโโโโ โ search โ โpattern โ
โโโโโโโโโโ โโโโโโโโโโ
| Feature | Description |
|---|---|
| ๐๏ธ Hierarchical Tree | Keywords index (Level 0) โ detail files (Level 1) โ sub-branches (Level 2+) |
| โพ๏ธ Infinite Scale | No capacity limit โ new files grow like tree branches |
| โก Lazy Loading | Only the index is loaded at session start; details loaded on demand |
| ๐๏ธ Focus Layer | WATCH.md โ a compact ~500 char board of current priorities, driving smart Level 1 preloading |
| ๐ Cross-Branch Links | Each file tracks related files via ๐ ๅ
ณ่ๆ (association links) |
| ๐ท๏ธ Memory Types | Semantic (facts), Episodic (timeline), Procedural (steps), Mixed |
| โฑ๏ธ Version Tracking | Timestamps on every entry; history preserved on updates |
| ๐ Zero Dependencies | Pure Bash + Markdown โ no databases, no npm packages |
| ๐ Full-Text Search | session_search.sh searches summaries; raw_search.sh searches raw transcripts |
| ๐ Memory Cascade | Auto: memory tree โ session summaries โ raw logs (no data loss) |
| ๐ Self-Improvement | pattern.sh captures recurring patterns as reusable knowledge |
| ๐ค Auto-Consolidation | Daemon scheduler checks memory health daily |
| ๐ก๏ธ Security Filtering | Automatic blocking of API keys, passwords, and secrets |
| Capability | pi-memory-tree | Hermes | Mem0 | Letta/MemGPT | Zep |
|---|---|---|---|---|---|
| Hierarchical tree | โ | โ | โ | โ | โ |
| Infinite capacity | โ | โ | โ | โ | โ |
| Zero dependencies | โ | โ | โ | โ | โ |
| Human-readable | โ | โ | โ | โ | โ |
| Cross-session persistence | โ | โ | โ | โ | โ |
| Full-text search | โ | โ | โ | โ | โ |
| Memory types | โ | โ | โ | โ | โ |
| Association links | โ | โ | โ | โ | โ |
| Version tracking | โ | โ | โ | โ | โ |
| Pattern recognition | โ | โ | โ | โ | โ |
| Self-nudge / proactive | โ | โ | โ | โ | โ |
# Clone directly into pi's skill directory
git clone https://github.com/ArtiNexus/pi-memory-tree.git ~/.pi/agent/skills/pi-memory-tree
bash ~/.pi/agent/skills/pi-memory-tree/install.shPi will auto-discover the skill. Next session, the agent knows how to use it.
git clone https://github.com/ArtiNexus/pi-memory-tree.git
cd pi-memory-tree
bash install.shStart your next session โ the agent will automatically:
- Load the focus board (WATCH.md) + index (MEMORY.md)
- Remember past conversations via 3-level cascade
- Save every Q&A as searchable session log
- Record important facts to the right branch file
pi-memory-tree/
โโโ AGENTS.md โ Protocol: auto-load memory at session start
โโโ install.sh โ One-command setup
โ
โโโ src/ โ Shell scripts (copy to ~/.pi/skills/pi-memory/scripts/)
โ โโโ memory.sh Core: add/replace/remove/list/search
โ โโโ session.sh Session logging
โ โโโ session_search.sh Full-text cross-session search
โ โโโ pattern.sh Pattern recognition / self-improvement
โ โโโ consolidate_memory.sh Daemon-driven health check
โ
โโโ template/
โ โโโ MEMORY_TEMPLATE.md โ Format spec for all branch files
โ
โโโ examples/ โ Example memory tree (rename/adapt)
โ โโโ MEMORY.md Level 0 index
โ โโโ MEMORY1_sem.md Semantic: environment config
โ โโโ MEMORY2_epi.md Episodic: project timeline
โ โโโ MEMORY3_pro.md Procedural: tool manuals
โ โโโ ...
โ
โโโ docs/
โโโ ARCHITECTURE.md โ Full design doc
โโโ COMPARISON.md โ Cross-system analysis
โโโ QUICKSTART.md โ Detailed setup guide
Every session, the agent loads the three-layer core:
- WATCH.md (Layer F) โ current focus board, drives smart Level 1 preloading
- MEMORY.md (Level 0) โ compact keyword โ file index
- USER.md โ user profile and preferences
When a topic comes up, the agent follows the index to the relevant Level 1 file and loads only that file โ keeping context efficient. It also preloads Level 1 files linked from WATCH.md priorities.
Memory Cascade: When asked "remember X?", the agent automatically cascades:
- Memory tree (already-loaded context + Level 1 files)
- Session summaries (
session_search.sh) - Raw transcripts (
raw_search.sh) โ no data loss guarantee
When new knowledge is learned:
- P0 (critical) โ saved immediately to the appropriate branch
- P1 (important) โ saved during or after the session
- Daily log โ every Q&A pair is timestamped in session files
MIT โ free to use, modify, share, and commercialize.
Built for Pi coding agent. Inspired by Hermes Agent (Nous Research), Mem0, Letta/MemGPT, and Zep. Distilled from cross-system analysis.