hierarchical-agent-memory
Fungsinya
Alat ini membantu mengatur memori sebuah program komputer. Alat ini membuat 'contekan' informasi untuk setiap bagian proyek, sehingga program tidak perlu membaca ulang semuanya. Ini menghemat waktu dan sumber daya.
Kapan dipakai
- βSaat Anda punya proyek besar dengan banyak folder.
- βSaat Anda ingin program menggunakan lebih sedikit 'memori' (token) untuk setiap tugas.
- βSaat Anda ingin melihat ringkasan berapa banyak waktu dan biaya yang dihemat.
Link skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hierarchical-agent-memory/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βAtur memori untuk proyek saya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Alat ini membuat file 'context' untuk setiap folder di proyek Anda. Sebuah file utama berisi informasi umum, dan file lain berisi detail spesifik untuk setiap bagian. Sebuah dashboard menunjukkan berapa banyak yang Anda hemat.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Hierarchical Agent Memory (HAM)
Scoped memory system that gives AI coding agents a cheat sheet for each directory instead of re-reading your entire project every prompt. Root CLAUDE.md holds global context (200 tokens), subdirectory CLAUDE.md files hold scoped context (250 tokens each), and a .memory/ layer stores decisions, patterns, and an inbox for unconfirmed inferences.
When to Use This Skill
- Use when you want to reduce input token costs across Claude Code sessions
- Use when your project has 3+ directories and the agent keeps re-reading the same files
- Use when you want directory-scoped context instead of one monolithic CLAUDE.md
- Use when you want a dashboard to visualize token savings, session history, and context health
- Use when setting up a new project and want structured agent memory from day one
How It Works
Step 1: Setup ("go ham")
Auto-detects your project platform and maturity, then generates the memory structure:
project/
βββ CLAUDE.md # Root context (~200 tokens)
βββ .memory/
β βββ decisions.md # Architecture Decision Records
β βββ patterns.md # Reusable patterns
β βββ inbox.md # Inferred items awaiting confirmation
β βββ audit-log.md # Audit history
βββ src/
βββ api/CLAUDE.md # Scoped context for api/
βββ components/CLAUDE.md
βββ lib/CLAUDE.md
Step 2: Context Routing
The root CLAUDE.md includes a routing section that tells the agent exactly which sub-context to load:
## Context Routing
β api: src/api/CLAUDE.md
β components: src/components/CLAUDE.md
β lib: src/lib/CLAUDE.md
The agent reads root, then immediately loads the relevant subdirectory context β no guessing.
Step 3: Dashboard ("ham dashboard")
Launches a web dashboard at localhost:7777 that visualizes:
- Token savings (HAM-on vs HAM-off sessions)
- Daily token and cost trends
- Per-directory session breakdown
- Context file health (missing/stale/inherited CLAUDE.md coverage)
- Routing compliance (how often the agent follows the routing map)
- Carbon/energy estimates
Commands
| Trigger | What it does |
|---|---|
go ham |
Set up HAM β auto-detect platform, generate CLAUDE.md files |
ham savings |
Show token and cost savings report |
ham dashboard |
Launch the interactive web dashboard |
ham audit |
Health check on memory files |
ham insights |
Generate actionable insights from session data |
ham route |
Add/update Context Routing section in root CLAUDE.md |
ham carbon |
Show energy and carbon efficiency data |
Examples
Example 1: First-time setup
User: go ham
Agent: HAM setup complete. Created 8 files.
- CLAUDE.md (root)
- .memory/decisions.md
- .memory/patterns.md
- .memory/inbox.md
- src/api/CLAUDE.md
- src/components/CLAUDE.md
- src/lib/CLAUDE.md
- src/utils/CLAUDE.md
Baseline captured in .memory/baseline.json
Run "HAM savings" to see your token and cost savings.
Example 2: Checking savings
User: ham savings
Agent:
Before HAM: ~7,500 tokens/prompt
After HAM: ~450 tokens/prompt
Savings: 7,050 tokens (94%)
Monthly projection (1,500 prompts):
Sonnet: ~$31.73 saved
Opus: ~$158.63 saved
Best Practices
- Keep root CLAUDE.md under 60 lines / 250 tokens
- Keep subdirectory CLAUDE.md files under 75 lines each
- Run
ham auditevery 2 weeks to catch stale or missing context files - Use
ham routeafter adding new directories to keep routing current - Review
.memory/inbox.mdperiodically β confirm or reject inferred items
Limitations
- Token estimates use ~4 chars = 1 token approximation, not a real tokenizer
- Baseline savings comparisons are estimates based on typical agent behavior
- Dashboard requires Node.js 18+ and reads session data from
~/.claude/projects/ - Context routing detection relies on CLAUDE.md read order in session JSONL files
- Does not auto-update subdirectory CLAUDE.md content β you maintain those manually or via
ham audit - Carbon estimates use regional grid averages, not real-time energy data
Related Skills
agent-memory-systemsβ general agent memory architecture patternsagent-memory-mcpβ MCP-based memory integration
Pertanyaan umum
Apa itu 'token'?
Token adalah potongan kecil teks yang dipahami program komputer. Semakin banyak token yang digunakan, semakin mahal biayanya.
Apa itu CLAUDE.md?
Itu adalah file tempat program menyimpan informasi penting proyek, seperti instruksi atau deskripsi.
Apakah dashboard menampilkan informasi real-time?
Dashboard menampilkan perkiraan berdasarkan penggunaan dan data yang tersimpan. Ini membantu memvisualisasikan kemajuan dan biaya.
Detail
Deskripsi asli dari pembuat
Scoped CLAUDE.md memory system that reduces context token spend. Creates directory-level context files, tracks savings via dashboard, and routes agents to the right sub-context.
Popularitas
- Bintang GitHub
- 48k
- Peringkat
- #4809
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- β¦
Skill lain dari repositori ini
00-andruia-consultant
48kMembantu agent Anda memulai atau meningkatkan proyek AI. Agent menganalisis kode, menyarankan tools, dan membuat rencana aksi dalam bahasa Spanyol.
007
48kMemungkinkan agent Anda melakukan audit keamanan dan threat modeling. Berguna untuk melindungi proyek dari serangan dan celah keamanan.
10-andruia-skill-smith
48kMembantu agent Anda membuat atau meningkatkan tools AI. Agent mendefinisikan cara kerja tools, menulis dokumentasi, dan memvalidasi strukturnya.
20-andruia-niche-intelligence
48kMemungkinkan agent Anda membuat ringkasan industri tertentu. Berguna untuk memahami konteks, aturan, pola penggunaan, dan risiko proyek dengan sumber terpercaya.
Skill serupa
add-model-provider
394kMemungkinkan agent Anda menghubungkan penyedia model AI baru ke OpenClaw dengan perintah pengaturan yang aman, menjaga kunci API tetap di luar teks biasa, dan menjalankan uji langsung.
acp-router
394kMembantu agent Anda mengirim tugas ke asisten pemrograman seperti Claude Code atau Cursor lewat OpenClaw, sehingga pekerjaan dijalankan di alat tersebut.
browser-automation
394kMengajari agent Anda mengendalikan halaman web langkah demi langkah, termasuk login, tab, dan pemulihan saat halaman berhenti merespons.