aboutsummaryrefslogtreecommitdiff
path: root/hooks/session-clear-resume.sh
Commit message (Collapse)AuthorAgeFilesLines
* feat(flush): read notes.org before the anchor on resumeCraig Jennings11 days1-1/+11
| | | | | | On a flush resume, the SessionStart(clear) hook now reads .ai/notes.org key sections before the session-context anchor. The anchor carries session state. notes.org carries the project's standing knowledge (code-repo paths, conventions, key contacts) that a resumed session needs to act correctly. A resume with the anchor alone floundered on context notes.org already documents, hunting for a repo whose path notes.org records. The hook guards on notes.org presence: when it's absent, the resume reads the anchor alone. flush/SKILL.md documents the same read order so the skill and the hook agree. The handoff rationale is preserved in docs/design/2026-06-02-flush-promotion.org.
* feat(flush): add /flush skill and SessionStart(clear) resume hookCraig Jennings11 days1-0/+55
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.