Skip to main content
hook CX Codex

memory — Claude Code hook: what it does, how to install

memory is a Claude Code hook that loads MemForge guidance and MCP memory tools at session start. It triggers automatically whenever a session starts, resumes, or compacts.

Apache-2.0 ★ 104 updated 2026-11-17

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add dodo-labs-ai/mem-forge
/plugin install memory@memforge
Open on GitHub

What memory does

The hook executes memforge_hook.py on the SessionStart event. It matches startup, resume, and compact triggers, injecting MemForge context and memory tools before interaction begins.

Execution requires python3 and an sh shell. The hook has a 10-second timeout; if the script is missing from ${CODEX_PLUGIN_ROOT} or ${PLUGIN_ROOT}, it logs a message to standard error and exits cleanly.

What it helps with

  • load MemForge guidance at session startup
  • restore memory context after resuming a session
  • inject MCP memory tools during context compaction

Example prompts for the agent

  • /compact
  • Resume the previous development session
  • Start a new session and load project context

How to install memory

1Plugin marketplace

/plugin marketplace add dodo-labs-ai/mem-forge
/plugin install memory@memforge

2Manually: 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 memory

How to install memory in Claude Code?

Add the repository by running /plugin marketplace add dodo-labs-ai/mem-forge, then install the hook with /plugin install memory@memforge. Configuration is saved to .claude/settings.json.

What does memory do?

It runs a setup script during session start, resume, or compaction events to provide MemForge instructions and memory tools.

What is required to run memory?

The hook requires a local python3 installation and a functional sh shell.

Source text

hooks.json · Apache-2.0
Hooks bundle shipped with the memory plugin for Claude Code.

MemForge memory for Codex: session-start guidance and MCP memory tools.

Triggers on: SessionStart.

```json
{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup|resume|compact",
        "hooks": [
          {
            "type": "command",
            "command": "sh -lc 'root=\"${CODEX_PLUGIN_ROOT:-${PLUGIN_ROOT:-}}\"; script=\"$root/scripts/memforge_hook.py\"; if [ ! -f \"$script\" ]; then echo \"MemForge hook script not found\" >&2; exit 0; fi; exec python3 \"$script\" context --client codex'",
            "timeout": 10,
            "statusMessage": "Loading MemForge usage guidance"
          }
        ]
      }
    ]
  }
}

```

© MemForge Team · Apache-2.0 · dodo-labs-ai/mem-forge

Similar hooks

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

From the same set8

memory memory is a Claude Code plugin that connects to MemForge search and memory tools. Session-start guidance appears automatically; retrieval runs on request. CX Codex ★ 104repo stars memory memory is a Claude Code plugin that links the agent to the MemForge API via a local MCP proxy. It adds session guidance and on-demand memory lookup tools. CX Codex ★ 104repo stars lifecycle-canary-convergence lifecycle-canary-convergence is a Claude Code skill that checks Memory lifecycle state through an inventory, dry-run, apply, and audit. It runs before another retry or canary. CX Codex +1 ★ 104repo stars self-hosted-release-validation self-hosted-release-validation is a Claude Code skill that validates OSS self-hosted releases via Docker Compose. Evaluates SQLite persistence, agent sources, and beta readiness. CX Codex +1 ★ 104repo stars memforge-setup memforge-setup is a Claude Code skill for configuring MemForge workspace routing. It runs on requests to bind or remove a project binding, or to diagnose workspace selection. CX Codex +1 ★ 104repo stars plugin-release-validation plugin-release-validation is a Claude Code skill that validates MemForge memory plugin releases via remote marketplace paths. Runs when testing RC tags, checking caches, hooks, and MCP servers. CX Codex +1 ★ 104repo stars memforge-daemon-setup memforge-daemon-setup is a Claude Code skill that installs and configures the MemForge local daemon as a macOS or Linux user service. It runs for requests to connect, inspect, repair, or remove that service. CX Codex +1 ★ 104repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open