A hierarchical session tracking system for AI assistants that reduces token usage by 60-80%
When working with AI assistants on large repositories, loading context can consume 20-30k tokens per session. This system solves that problem with a smart three-tier hierarchical structure that lets you load only the context you need.
See QUICKSTART_FOR_OTHERS.md for a 5-minute setup guide.
Before (flat structure):
After (three-tier system):
The system organizes documentation into three tiers:
Content automatically propagates UP from Tier 3 → Tier 2 → Tier 1, so every tier has complete context (detailed or summarized).
What are you working on today?
↓
┌───────┴───────┬──────────────┬─────────────┐
│ │ │ │
Single Project Multi-Project Vault Work Quick Check
│ │ │ │
↓ ↓ ↓ ↓
Read Tier 3 Read Tier 2 Read Tier 1 git log -5
(~3-5k tokens) (~5-8k tokens) (~10k tokens) (~1-3k tokens)
│ │ │ │
↓ ↓ ↓ ↓
88% savings 80% savings 60% savings 90%+ savings
Example:
projects/website/website-claude.md (Tier 3)projects/projects-claude.md (Tier 2)docs/docs-claude.md (Tier 1)git log -5 --oneline --stat git diff --stat
↓
Detect areas changed
↓
┌─────────────────┼──────────────────┐
│ │ │
Single Project Multi-Project Vault-Level
Work Work Work
│ │ │
↓ ↓ ↓
Update T3 Update T3s Update T1
Update T2 Update T2 (only)
Update T1 Update T1
│ │ │
└─────────────────┼──────────────────┘
↓
Commit all modified session files
↓
Push to GitHub
Example:
projects/website/src/index.html? → Update Tier 3 (website) + Tier 2 + Tier 1api/ and frontend/? → Update both Tier 3s + Tier 2 + Tier 1README.md and docs/? → Update Tier 1 onlyThe agent handles this automatically! Just run @agents/close_and_commit_GIT.md
# Copy templates to your repository
cp -r TEMPLATES /path/to/your-repo/
# Run automated setup
cd /path/to/your-repo
bash TEMPLATES/setup-three-tier.sh
# Customize the templates and start using!
See QUICKSTART_FOR_OTHERS.md for detailed instructions.
“Load only what you need”
Most work is focused on ONE area. Reading everything is wasteful. Context should be available at appropriate granularity. Smart architecture upfront pays dividends in reduced token costs.
This system builds upon:
While session tracking patterns exist, the three-tier hierarchical approach with automatic propagation and smart tier detection is a novel solution specifically designed for token efficiency at scale.
MIT License - Feel free to use, modify, and share!
Found this useful? Have improvements? Issues and pull requests welcome!
Quick Reference:
| Work Type | Files to Read | Token Cost | Savings |
|---|---|---|---|
| Specific project | Tier 3 project files | ~3-5k | 88% |
| Multiple projects | Tier 2 files | ~5-8k | 80% |
| Vault structure | Tier 1 files | ~10k | 60% |
| Quick context | git log -5 --oneline --stat |
~1-3k | 90%+ |
Start saving tokens today! 🚀