agentmemory-hooks

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
The Claude Code plugin registers lifecycle hooks so memory is captured automatically. You do not have to call
memory_save
for routine work; the hooks observe tool use, prompts, and session boundaries and write observations for you.
Claude Code插件会注册生命周期钩子,从而自动捕获内存数据。在日常工作中,你无需调用
memory_save
;这些钩子会监控工具使用情况、提示词以及会话边界,并自动为你记录观察数据。

Quick start

快速开始

Install the plugin and the hooks register themselves:
bash
/plugin marketplace add rohitg00/agentmemory
/plugin install agentmemory
Watch observations land live at
http://localhost:3113
.
安装插件后,钩子会自动注册:
bash
/plugin marketplace add rohitg00/agentmemory
/plugin install agentmemory
可在
http://localhost:3113
实时查看观察数据。

What the hooks do

钩子功能

  • Session start and end frame each unit of work and let
    handoff
    resume it.
  • Tool-use hooks capture what changed and why, the raw material for
    recall
    and
    recap
    .
  • Prompt-submit captures intent. Pre-compact preserves context before the host trims it.
  • A post-commit hook links commits to sessions, which powers
    commit-context
    and
    commit-history
    .
  • 会话开始和结束钩子会标记每个工作单元,并允许
    handoff
    功能恢复会话。
  • 工具使用钩子会捕获变更内容及原因,为
    recall
    recap
    功能提供原始数据。
  • 提示词提交钩子会捕获用户意图。预压缩功能会在宿主裁剪上下文之前保留相关内容。
  • 提交后钩子会将代码提交与会话关联,为
    commit-context
    commit-history
    功能提供支持。

Important

重要说明

  • Capture is on by default and is zero-LLM. Turning observations into LLM summaries (
    AGENTMEMORY_AUTO_COMPRESS
    ) and injecting them back into context (
    AGENTMEMORY_INJECT_CONTEXT
    ) are separate opt-ins because they spend tokens.
  • If observations are missing, confirm the plugin is enabled and the server is running. See ../_shared/TROUBLESHOOTING.md.
  • 捕获功能默认开启,且无需调用大语言模型(LLM)。将观察数据转换为LLM摘要(
    AGENTMEMORY_AUTO_COMPRESS
    )并注入回上下文(
    AGENTMEMORY_INJECT_CONTEXT
    )是独立的可选功能,因为这些操作会消耗令牌(tokens)。
  • 如果观察数据缺失,请确认插件已启用且服务器正在运行。详见../_shared/TROUBLESHOOTING.md。

See also

另请参阅

  • agentmemory-config for the capture and injection flags.
  • The handoff, recap, and session-history skills consume what these hooks record.
  • agentmemory-config:包含捕获和注入相关的配置标志。
  • handoff、recap和session-history功能会使用这些钩子记录的数据。

Reference

参考文档

The exact registered hook events live in REFERENCE.md, generated from
plugin/hooks/hooks.json
.
已注册的具体钩子事件可查看REFERENCE.md,该文档由
plugin/hooks/hooks.json
生成。