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
/plugin marketplace add dodo-labs-ai/mem-forge
/plugin install memory@memforgeWhat 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@memforge2Manually: put the files in place
.claude/settings.jsonThe 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