NotNessie registers five Claude Code lifecycle hooks in
.claude/settings.json (written by notnessie init). Hooks are how memory flows
automatically: context goes in at the start of a session and summaries come
out at the end.
Each hook is just the CLI invoked with an event name. Claude Code runs them and passes a JSON event payload on stdin; you do not run them by hand.
{
"hooks": {
"SessionStart": [{ "matcher": "", "hooks": [{ "type": "command", "command": "notnessie hook session-start" }] }],
"UserPromptSubmit": [{ "matcher": "", "hooks": [{ "type": "command", "command": "notnessie hook user-prompt-submit" }] }],
"PostToolUse": [{ "matcher": "", "hooks": [{ "type": "command", "command": "notnessie hook post-tool-use" }] }],
"Stop": [{ "matcher": "", "hooks": [{ "type": "command", "command": "notnessie hook stop" }] }],
"PreCompact": [{ "matcher": "", "hooks": [{ "type": "command", "command": "notnessie hook pre-compact" }] }]
}
}
!!! note βHooks never break your sessionβ Every hook reads stdin, runs its handler, and always exits cleanly β even on error, it just logs to stderr. Hooks also close the database pool on exit so they never hold the session open.
Runs when a Claude Code session starts. It builds a context pack for the repository and injects it, so the assistant begins with the most relevant decisions, constraints, verified commands, and open questions already in view.
Runs when you submit a prompt. It can surface task-specific context for what you just asked, keeping the most relevant memory in front of the assistant as the conversation moves between tasks.
Runs after Claude Code uses a tool. It captures memory conservatively: it records recognized, non-destructive, secret-free build/test commands that succeeded as verified commands. It does not store raw terminal output or arbitrary tool results.
Runs when a session ends. It summarizes the session into memory β decisions made, files changed, commands verified, failed approaches, and new TODOs β and persists the result. Summaries are produced with the Claude Agent SDK, with a heuristic fallback when the SDK or its auth is unavailable.
Runs just before Claude Code compacts the conversation. It performs the same
summarization as Stop, so the useful context of a long conversation is captured
into memory before the transcript is shortened.
Hooks honor your project configuration:
autoSave* flags β for example, they
skip auto-saving task summaries when autoSaveTaskSummaries is off, and skip
command capture when autoSaveCommands is off.The hooks live in .claude/settings.json, which is a normal Claude Code settings
file. To turn off a particular hook, remove its entry; to change behavior more
broadly, adjust the config flags rather than the hook wiring.
Re-running notnessie init --force regenerates the default hook set.