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. --- .claude/settings.json | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to '.claude/settings.json') diff --git a/.claude/settings.json b/.claude/settings.json index 0f76d18..4734d45 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -28,6 +28,17 @@ } ] } + ], + "SessionStart": [ + { + "matcher": "clear", + "hooks": [ + { + "type": "command", + "command": "~/.claude/hooks/session-clear-resume.sh" + } + ] + } ] }, "enabledPlugins": { -- cgit v1.2.3