Skip to content

Pre-compaction transcript not captured by Stop hook? #537

Description

@kzarzycki

Problem

If I'm reading the hook flow right, Stop's parse-transcript.sh runs after any compaction has already collapsed the pre-compact transcript into a single isCompactSummary marker. A long agentic run that compacts mid-stream seems to lose that detail before memsearch ever sees it. I believe a lot of valuable memories can be lost in long running sessions.

Trace

One real session, one /compact:

$ wc -l session.jsonl
644

$ grep -n '"isCompactSummary":true' session.jsonl
527:{...}                          # compaction marker

$ bash parse-transcript.sh session.jsonl | wc -l
7                                  # what Stop sends to the summarizer

The ~526 pre-compact lines (the agentic work) never reach the summarizer — only the trailing post-compact turn does.

Suggestion

A PreCompact hook mirroring stop.sh's pipeline could capture full state at each compaction boundary, before the JSONL is collapsed. Its input also carries a trigger field (manual/auto) worth recording on the entry.

Happy to be told I've misread something, or to take a stab at a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions