aboutsummaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-02 21:14:56 -0500
committerCraig Jennings <c@cjennings.net>2026-06-02 21:14:56 -0500
commit2433e74131582e7010fba4e561f40d793bdc5334 (patch)
treeb8283e08a77d6252be2b1d764590766a94f1791b /hooks
parent656f11d8aea1595ce72f04b44744764c1ef343fa (diff)
downloadrulesets-2433e74131582e7010fba4e561f40d793bdc5334.tar.gz
rulesets-2433e74131582e7010fba4e561f40d793bdc5334.zip
feat(flush): read notes.org before the anchor on resume
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.
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/session-clear-resume.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/hooks/session-clear-resume.sh b/hooks/session-clear-resume.sh
index 6692f54..56b7b2f 100755
--- a/hooks/session-clear-resume.sh
+++ b/hooks/session-clear-resume.sh
@@ -45,7 +45,17 @@ else
fi
if [ -f "$sc" ]; then
- ctx="A context flush just happened (/clear). The session-context anchor is at ${sc}. Read it now — the * Summary (Active Goal, Next Steps) plus the most recent * Session Log entries — then reply with 'flushed.' on its own line, followed by one line restating the Active Goal and the immediate Next Step, and resume that work. This is a mid-session resume, NOT a fresh start: do not run the startup workflow, do not re-pull rulesets or re-sync templates."
+ # On resume, read notes.org standing knowledge (code-repo paths,
+ # conventions, key contacts) BEFORE the anchor — the anchor carries
+ # session state, notes.org carries the project context a resumed session
+ # needs to act correctly. Same "key sections" scope startup uses. Only
+ # when notes.org is present; otherwise resume from the anchor alone.
+ if [ -f ".ai/notes.org" ]; then
+ read_order="First read .ai/notes.org key sections (Project-Specific Context, Active Reminders, Pending Decisions; skip About This File) for the project's standing knowledge — code-repo paths, conventions, key contacts. Then read the session-context anchor at ${sc}"
+ else
+ read_order="Read the session-context anchor at ${sc}"
+ fi
+ ctx="A context flush just happened (/clear). ${read_order} — the * Summary (Active Goal, Next Steps) plus the most recent * Session Log entries. Then reply with 'flushed.' on its own line, followed by one line restating the Active Goal and the immediate Next Step, and resume that work. This is a mid-session resume, NOT a fresh start: do not run the startup workflow, do not re-pull rulesets or re-sync templates."
else
ctx="Session started with no session-context anchor present (.ai/session-context.org absent). Run the startup workflow at .ai/workflows/startup.org."
fi