Skip to content

SessionEnd hooks skipped on /clear and /compact — learnings lost #1043

@qozle

Description

@qozle

Problem

/clear and /compact destroy conversation context but don't trigger SessionEnd. This means:

  • WorkCompletionLearning never fires — work state, ISC progress, and session insights are lost
  • RelationshipMemory never fires — interaction patterns from the session aren't captured
  • Session progress isn't snapshotted — if the user continues in the same session, there's no record of what came before

/compact fires PostCompact, but that hook only re-injects state — it doesn't save anything.

Impact

Users who frequently use /clear (to start fresh mid-session) or /compact (to manage context) lose all the learning/relationship data that SessionEnd would have captured. The more actively someone manages their context, the more data they lose.

Proposed fix

A UserPromptSubmit hook that detects /clear and /compact in the prompt text and runs a lightweight harvest before the command executes:

  1. Work completion learning — same as WorkCompletionLearning: capture work state, ISC progress
  2. Relationship notes — same as RelationshipMemory: extract W/B/O notes from transcript
  3. Progress snapshot — annotate active progress files with a context-reset marker
  4. Rating signal flush — mark the reset point in ratings.jsonl so analysis knows context changed

The hook does NOT run cleanup (tab reset, state deletion) since the session continues after both commands.

Fast exit (<5ms) for all non-matching prompts — zero overhead on normal usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions