From 526df6dd7872890e525b9af33917169cfdf705d8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 2 Jun 2026 20:36:18 -0500 Subject: feat(flush): add /flush skill and SessionStart(clear) resume hook Flush is the checkpoint half of the wrap/restart rhythm. It refreshes the session-context anchor in place, the user runs /clear, and the session resumes from the anchor instead of starting cold. One logical session stays alive across a /clear boundary without the archive-and-commit of wrap-it-up or the full cold boot of startup, which buys cheaper tokens and a sharper context window. The mechanism splits into two halves around /clear, which wipes the conversation so nothing runs straight through it. The /flush skill is the pre-clear half: dump live state, refresh the anchor's Summary, append a dated flush marker, verify the write landed, then prompt the user to /clear. The agent can initiate at a clean task boundary on its own judgment, but /clear is user-only, so the agent does the work and the user supplies the single keystroke. The session-clear-resume.sh hook is the post-clear half, a SessionStart matcher=clear hook that points the fresh session at the anchor to resume, or at startup when no anchor exists. I packaged the pre-clear half as a skill rather than a project-workflow doc so both halves are global. The hook was already global, so /flush is now callable by name from any project with no per-project sync. The hook is canonicalized under hooks/ and symlinked into ~/.claude/hooks/, matching precompact-priorities.sh. settings.json wires the SessionStart entry, and settings-snippet.json carries it so a fresh machine wires the hook on make install-hooks. --- hooks/settings-snippet.json | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hooks/settings-snippet.json') diff --git a/hooks/settings-snippet.json b/hooks/settings-snippet.json index 11459f2..1be5f00 100644 --- a/hooks/settings-snippet.json +++ b/hooks/settings-snippet.json @@ -1,5 +1,13 @@ { "hooks": { + "SessionStart": [ + { + "matcher": "clear", + "hooks": [ + { "type": "command", "command": "~/.claude/hooks/session-clear-resume.sh" } + ] + } + ], "PreCompact": [ { "hooks": [ -- cgit v1.2.3