Skip to content

doctor.sh has no SessionEnd liveness check, so a SessionEnd hook that never fires reads as a healthy install #370

Closed

Description

@fdaviddpt

Surfaced by the review of #368 (SessionEnd hook). Filed rather than fixed there: #345's acceptance criteria name README and docs, not doctor.sh, and a new check needs its own marker convention.

Symptom

/remember:doctor reports a healthy install whether or not the SessionEnd hook has ever fired. A user whose hook is unregistered, whose harness does not emit the event on their exit path, or whose hook dies before it forks, sees the same verdict as a user whose hook works.

Location

scripts/doctor.sh:266-298 carries a detailed alive-marker check for PostToolUse. There is no equivalent for SessionEnd.

Mechanism

The PostToolUse check exists because a registered-but-not-firing hook is invisible from inside a session — the plugin cannot distinguish "no tool calls happened" from "the hook never ran". SessionEnd has the same property and a worse consequence: it fires at most once per session, at the moment there is no next chance, so a silent failure costs the whole tail of that session rather than one save.

It is also the hook whose firing conditions are not established. #368's own investigation found the Claude Code hooks reference documents clear/logout/prompt_input_exit/resume and is silent on crash, killed terminal and usage-cap endings. So the case where this hook does not run is not hypothetical — it is unmeasured, and a doctor check is the thing that would measure it on a real install rather than from documentation.

What would settle it

Decide the marker convention first: SessionEnd fires once per session, so a PostToolUse-style freshness window does not transfer — the honest reading is closer to "the last N sessions in this store each left an end-marker" than to "a marker was written recently". Then integrate it into the verdict logic.

Three states, not two: fired, did not fire, and no session has ended since the hook was installed — the third must not render as either of the first two.

Metadata

Metadata

Assignees

Labels

cohort-1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions