Skip to main content

Hooks

chat-recall init and chat-recall install-hooks install these hooks. The MCP server installs missing hooks when it starts. A tool whose folder is not on the machine gets nothing.

Claude Code​

Registered in settings.json of each Claude profile (~/.claude and each ~/.claude-* with a projects folder).

EventHookWhat it doesOpt out
SessionStart (startup, clear)wake-upAdds the wake-up bundle of the project--no-wakeup
UserPromptSubmitresume hintSearches for similar past sessions and adds a note when one exists--no-resume-hint
SessionEndescalateAdds the session's decisions and outcome to the knowledge graph, in the background--no-escalate
PreToolUse (shell, edit, write)decision guardChecks the call against the decision register--no-guard
UserPromptSubmit, SessionEndtask boardClaims a board card when a prompt names its id, and closes it at the end of the session--no-task-board
SessionStart, UserPromptSubmit, Stop, SessionEndmessagesReports the session, delivers waiting messages--no-messages
SessionStart, UserPromptSubmit, Stop (background)message waiterWaits for a message and wakes the session, also when it is idle; it runs for a day, because Claude Code ends an async asyncRewake hook at its timeout and nothing starts another one while the session idles. It stands down while a channel delivers for the session--no-messages

Channels​

A session started with --channels server:chat-recall or --dangerously-load-development-channels server:chat-recall gets its messages from Claude Code instead of from the waiter: the MCP server declares the channel capability, long-polls the same endpoint and sends notifications/claude/channel, and the client takes a turn with it. No hook and no process of ours is involved in the delivery, so nothing can time out.

The session is served in the MCP server's own process rather than by the shared daemon, because the flag is on the session's command line and only that process can see it. CHAT_RECALL_CHANNEL=1 turns it on and 0 turns it off, whatever the command line says.

Two limits come from Claude Code, not from this repository: a plain server needs the development flag until it is on the approved-channels allowlist, and the account's managed settings must allow channels. See Run sessions that work together.

On Windows, the four shell hooks (resume hint, escalate, wake-up and guard) are not installed, because Claude Code runs hooks through cmd.exe. The task board and message hooks install on every platform.

Other AI tools​

ToolFileMessage hookDecision guard
Codex~/.codex/hooks.jsonSessionStart, UserPromptSubmit, Stop, SessionEndPreToolUse
Antigravity~/.gemini/config/hooks.jsonSessionStart, PreInvocation (first call of a turn), StopPreToolUse
Cursor~/.cursor/hooks.jsonsessionStart, beforeSubmitPrompt, stop, sessionEndbeforeShellExecution, afterFileEdit
OpenCode~/.config/opencode/plugins/plugin chat-recall-messages.js, with a waiter that wakes an idle session; the package chat-recall-tui/ next to it registers an OpenCode window before it has a session, so a message to its folder becomes its first promptplugin chat-recall-guard.js
pi~/.pi/agent/extensions/extension chat-recall-messages.js, with a waiter that wakes an idle session—

The other tools run the hooks through scripts in ~/.chat-recall/hooks/. On Windows, these scripts are not installed.

Codex runs a new hook only after you approve it with /hooks in Codex.

When each tool delivers a message is in Run sessions that work together.

Commands​

CommandEffect
chat-recall install-hooksInstall or repair all hooks
chat-recall install-hooks --no-<hook>Install all hooks except the named ones
chat-recall install-hooks --uninstallRemove every chat-recall hook; the MCP server then leaves them out
chat-recall doctorShow the hooks of each tool and profile

Each install replaces only chat-recall's own entries. Hooks of other programs in the same files stay.

Environment variables​

VariableEffect
CHAT_RECALL_MESSAGE_HOOK=0Turns the message hook off
CHAT_RECALL_MESSAGE_HOOK_DEBUG=1Writes the reason for each silent exit of the message hook to stderr
CHAT_RECALL_CHANNEL=1Delivers messages through Claude Code's channel, as if the session had passed the flag; 0 never does
CHAT_RECALL_GUARD=0Turns the decision guard off
CHAT_RECALL_GUARD_ENFORCE=1Makes the decision guard block instead of warn
CHAT_RECALL_WAKEUP_TIMEOUTSeconds before the wake-up hook gives up (default 10)