PitchHut logo
Reduce token usage and enhance AI efficiency with scoped memory.
Pitch

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.

Description

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.

Key Features

  • 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
    

Performance Insights

HAM provides substantial advantages:

  • Reduced Token Usage: The context per prompt is dramatically lower, ranging from 4,000 - 12,000 tokens to 2,000 - 6,000 tokens after implementation. This results in lower overall token consumption in multi-prompt sessions.
  • Cost Efficiency: For teams operating on a large scale, fewer tokens translate to reduced API expenses, which can be immediately realized.
  • Speed Enhancement: With less context to process, AI agents can respond more quickly, focusing on writing code rather than processing irrelevant information.
  • Sustainable AI Operation: By reducing token waste, HAM contributes to a greener approach to AI. With AI inference accounting for significant electricity consumption, minimizing unnecessary tokens is not just a cost-saving measure; it also promotes environmental sustainability.

Usage Commands

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:

CommandDescription
go hamSetup HAM in the project (auto-detects everything)
HAM savingsDisplays a report on token/cost savings with detailed calculations
HAM auditChecks the health of your memory system
HAM dashboardLaunches a web dashboard to visualize token usage and savings
HAM carbonProvides energy and carbon efficiency statistics

Visual Insights

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.

0 comments

No comments yet.

Sign in to be the first to comment.