fix: harvest session state before /clear and /compact#1044
Open
qozle wants to merge 1 commit intodanielmiessler:mainfrom
Open
fix: harvest session state before /clear and /compact#1044qozle wants to merge 1 commit intodanielmiessler:mainfrom
qozle wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
SessionEnd hooks (WorkCompletionLearning, RelationshipMemory) never fire on /clear or /compact, so learnings, relationship notes, and progress snapshots are silently lost. This adds a UserPromptSubmit hook that detects these commands and runs a lightweight harvest before context is destroyed. Fast exit (<5ms) for all non-matching prompts — zero overhead on normal usage. Closes danielmiessler#1043
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/clearand/compactdestroy conversation context without triggeringSessionEnd, soWorkCompletionLearning,RelationshipMemory, and progress snapshots are silently lostPreContextReset.hook.ts— aUserPromptSubmithook that detects/clearand/compactand runs a lightweight harvest before context is destroyedUserPromptSubmithook chain so it runs before other hooksWhat it harvests
MEMORY/LEARNING/MEMORY/RELATIONSHIP/ratings.jsonlso downstream analysis knows context changedDoes NOT run cleanup (tab reset, state deletion) since the session continues after both commands.
Performance
Test plan
/clear— verify learning file created, relationship note appended, rating marker written/compact— same verificationCloses #1043