Token导航 LogoToken导航TokenDH.com
开发external-servicegithub未标认证来源可访问许可证需确认审计异常

hierarchical-agent-memory分层 Agent 记忆

Agent Skill

hierarchical-agent-memory 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,348

周安装

54

GitHub Stars

35,677

下载量

436
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:hierarchical-agent-memory(分层 Agent 记忆)
来源仓库:https://github.com/sickn33/antigravity-awesome-skills
仓库路径:skills/hierarchical-agent-memory
安装命令:
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill hierarchical-agent-memory
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill hierarchical-agent-memory

简介

hierarchical-agent-memory 实现 Agent 记忆分层管理与上下文复用。

  • 适用于多轮对话、任务延续和长期状态保持场景。
  • 可区分短期操作与长期目标,优化信息检索效率。
  • 使用前需确认记忆存储方式、过期策略和隐私保护机制。
  • 涉及敏感会话时应加密存储,防止信息外泄。hierarchical-agent-memory 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

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

TriggerWhat it does
go hamSet up HAM — auto-detect platform, generate CLAUDE.md files
ham savingsShow token and cost savings report
ham dashboardLaunch the interactive web dashboard
ham auditHealth check on memory files
ham insightsGenerate actionable insights from session data
ham routeAdd/update Context Routing section in root CLAUDE.md
ham carbonShow 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 audit every 2 weeks to catch stale or missing context files
  • Use ham route after adding new directories to keep routing current
  • Review .memory/inbox.md periodically — 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 patterns
  • agent-memory-mcp — MCP-based memory integration

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

40.43%
按下载量换算176

Claude

27.49%
按下载量换算120

Cursor

19.8%
按下载量换算86

Gemini CLI

9.91%
按下载量换算43

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills