HAM is a memory system designed for AI coding agents, minimizing token consumption by up to 50%. By scoping memory usage to relevant directories, it streamlines context retrieval for improved speed and reduced costs, making AI interactions more efficient and environmentally friendly.
HAM (Hierarchical Agent Memory) is an innovative memory system designed for AI coding agents that aims to significantly reduce token consumption by up to 50%. By scoping memory to the working directory rather than the entire project context, HAM optimizes the performance and efficiency of AI applications.
Context Optimization: HAM eliminates the need to reload vast amounts of information for every session, allowing the AI agent to focus on the relevant context needed for the immediate task. This system replaces a bloated CLAUDE.md file with smaller, context-specific memory files located at each directory level, as illustrated below:
project-root/
├── CLAUDE.md # Global conventions (under 250 tokens)
├── src/
│ ├── CLAUDE.md # Shared src patterns
│ ├── api/
│ │ └── CLAUDE.md # API auth, rate limits, endpoint patterns
│ ├── components/
│ │ └── CLAUDE.md # Component conventions, styling rules
│ └── db/
│ └── CLAUDE.md # Schema context, query patterns
└── .memory/
├── decisions.md # Architecture decisions with rationale
└── patterns.md # Implementation patterns
HAM provides substantial advantages:
To get started with HAM, simply run:
go ham
This command auto-detects your project stack and generates the necessary scoped CLAUDE.md files throughout your codebase.
A variety of commands are available to manage your AI memory system:
| Command | Description |
|---|---|
go ham | Setup HAM in the project (auto-detects everything) |
HAM savings | Displays a report on token/cost savings with detailed calculations |
HAM audit | Checks the health of your memory system |
HAM dashboard | Launches a web dashboard to visualize token usage and savings |
HAM carbon | Provides energy and carbon efficiency statistics |
Launching the interactive web dashboard with the command HAM dashboard allows visualization of various metrics such as token savings, session history, and context health, helping you understand your AI agent's performance and efficiency at a glance. The dashboard aggregates data directly from Claude Code's session files, ensuring accuracy without relying on external services.
With HAM, optimize your AI workflow, enhance efficiency, and contribute to sustainability in the tech industry.
No comments yet.
Sign in to be the first to comment.