diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-02 20:36:18 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-02 20:36:18 -0500 |
| commit | 526df6dd7872890e525b9af33917169cfdf705d8 (patch) | |
| tree | 0db8e87a7099f525a45d4592269368109b70e615 /hooks/settings-snippet.json | |
| parent | 4a5a30280c541006be04f47ebb45c8aab28e9f3c (diff) | |
| download | rulesets-526df6dd7872890e525b9af33917169cfdf705d8.tar.gz rulesets-526df6dd7872890e525b9af33917169cfdf705d8.zip | |
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.
Diffstat (limited to 'hooks/settings-snippet.json')
| -rw-r--r-- | hooks/settings-snippet.json | 8 |
1 files changed, 8 insertions, 0 deletions
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": [ |
