Skip to main content
hook CX Codex

tree-ring-memory — Claude Code hook: features and setup

tree-ring-memory is a Claude Code hook that loads saved context when a session starts and checks memory when it ends. It also runs at subagent start and stop.

MIT ★ 1,596 updated 2026-10-29

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/settings.json
Open on GitHub

What tree-ring-memory does

The hook loads a bounded amount of Tree Ring context at session startup, then checks memory when the session ends. It calls codex-hook.sh from the plugin directory. The same actions are configured for subagents.

At shutdown, the check creates an agent-mediated memory checkpoint. The memory workflow covers evidence-backed lessons, privacy-safe capture, audits, consolidation, and explicit forgetting. For Claude Code, the setup file is .claude/settings.json.

What it helps with

  • load saved context at session startup
  • check memory when an agent or subagent stops
  • create an agent-mediated memory checkpoint
  • audit and consolidate stored lessons

Example prompts for the agent

  • Start a session with Tree Ring context for this task.
  • Finish the task and check whether a memory checkpoint is needed.
  • Stop the subagent after the task and check its memory.

How to install tree-ring-memory

Manually: put the files in place

.claude/settings.json

The hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json

Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command

Questions about tree-ring-memory

How do I install tree-ring-memory in Claude Code?

Add the hook configuration to .claude/settings.json.

What does tree-ring-memory do?

It loads context at session startup, then checks memory and creates an agent-mediated checkpoint when the session ends.

Which events trigger tree-ring-memory?

It runs when a session starts or stops, and when a subagent starts or stops.

Source text

codex-hooks.json · MIT
Hooks bundle shipped with the tree-ring-memory plugin for Claude Code.

Local-first memory lifecycle guidance for Codex agents with recall, evidence-backed lessons, privacy-safe memory capture, audit, consolidation, and explicit forgetting.

Triggers on: SessionStart, Stop, SubagentStop.

```json
{
  "description": "Load bounded Tree Ring context at startup and enforce one agent-mediated memory checkpoint at stop.",
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "\"${PLUGIN_ROOT}/hooks/codex-hook.sh\"",
            "timeout": 10,
            "statusMessage": "Loading Tree Ring context",
            "additionalContextLimit": 6000
          }
        ]
      }
    ],
    "SubagentStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "\"${PLUGIN_ROOT}/hooks/codex-hook.sh\"",
            "timeout": 10,
            "statusMessage": "Loading Tree Ring worker context",
            "additionalContextLimit": 6000
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "\"${PLUGIN_ROOT}/hooks/codex-hook.sh\"",
            "timeout": 10,
            "statusMessage": "Checking Tree Ring memory"
          }
        ]
      }
    ],
    "SubagentStop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "\"${PLUGIN_ROOT}/hooks/codex-hook.sh\"",
            "timeout": 10,
            "statusMessage": "Checking Tree Ring worker memory"
          }
        ]
      }
    ]
  }
}

```

© TerminallyLazy · MIT · hashgraph-online/awesome-codex-plugins

Similar hooks

All hooks for Agent setup: memory, context, orchestration →

From the same set391

The whole set →
codex-seo This hook runs a schema check when Claude Code edits or writes a file. It ships with codex-seo, a plugin bundle for SEO workflows. CX Codex ★ 1,596repo stars carsxe carsxe is a Claude Code hook that loads the CarsXE API key at session start. The API provides vehicle data such as VIN details, market value, history, and OBD codes. CX Codex ★ 1,596repo stars wtfm wtfm generates illustrated end-user help articles from codebase files and renders screenshots locally from the actual interface code. CX Codex ★ 1,596repo stars vibestretch vibestretch is a Claude Code hook that prints a stretch or eye-rest prompt and plays a soft chime after the agent has kept you waiting. It runs on prompt submission, tool use, and agent stop. CX Codex ★ 1,596repo stars tailtest tailtest detects files modified during an agent turn and triggers automated test writing and execution. Works across 8 languages with zero config. CX Codex ★ 1,596repo stars stop-that-shit The stop-that-shit hook for Claude Code and Codex checks agent actions against explicit task modes and bounds decisions about dependencies, hashes, and subagents. CX Codex ★ 1,596repo stars board A SessionStart hook that tells the agent what is on the project board. The board lives in plain Markdown files, so you can read it straight from the terminal. CX Codex ★ 1,596repo stars steinwall The steinwall hook for Claude Code and Codex provides cost controls, action guards, and loop recovery for unattended agent sessions with shell execution. CX Codex ★ 1,596repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open