Skip to content

Silent no-op when the plugin is enabled mid-session: PostToolUse never registers, no error surfaced #200

Closed

Description

@fmanimashaun

Thanks for the plugin — the pipeline itself works well. Reporting a failure mode that is silent, which made it hard to notice: memory simply never gets written, with no error anywhere.

What happened

On Windows (Git Bash), the plugin was installed and enabled mid-session in a long-running Claude Code session. Result: ~/.remember/<slug>/logs/ contained a single session-start line and nothing else. No memory files were produced for that project over many hours and hundreds of tool calls. logs/hook-errors.log was empty, so nothing indicated a problem.

Root cause

PostToolUse (which drives save-session.sh) was never registered, because Claude Code loads hook definitions at session start and the plugin was enabled after that session began. The plugin was working exactly as designed — it simply was not wired in yet.

Invoking the hook manually confirmed the pipeline is healthy end to end:

post-tool: PROJECT_DIR=... PYTHON=python3 REMEMBER_DIR=...
save-session: ...
[extract] 2490 exchanges (154 human)
[haiku] calling (branch: main)
[write] appended: ## 18:00 | main
[ndc] now.md -> today-2026-07-26.md
[ndc] 312->267b (-14%)

So the fix is just "restart Claude Code" — but there is no way for a user to discover that.

Suggestions

  1. Make the gap detectable. The SessionStart hook already runs; it could check whether a PostToolUse registration is visible (or simply whether any save has ever occurred for this project) and print a one-line notice such as "remember: PostToolUse not active in this session — restart Claude Code to enable capture." One line at session start would have saved a full day of silent no-ops.
  2. Say it in the README install steps. "Restart Claude Code after enabling, otherwise capture will not run until the next session" — currently a user reasonably assumes enabling is sufficient.
  3. Optional: a doctor-style command reporting resolved paths, detected tools, whether hooks are active, and the timestamp of the last successful save. That single output would make this class of problem self-diagnosing.

Happy to test a fix on Windows/Git Bash if useful. Environment: Windows 11, Git Bash (MSYS), Python 3.14, Node 25, remember 0.8.3 via claude-plugins-official, external storage mode (data_dir: ~/.remember/{slug}) with git backup enabled.

Activity

  1. fdaviddpt commented on Jul 27, 2026

    @fdaviddpt
    Contributor

    Thank you — this is an unusually good report. You did the diagnosis yourself, including the manual hook invocation that proved the pipeline was healthy end to end, which is the part that would otherwise have taken us the longest.

    #201 implements suggestions 2 and 3, and as much of 1 as turns out to be possible.

    On suggestion 1 — it can't be done live, and it's worth saying why. I checked before building: there is no way for a hook to see which hooks are registered (no env var, no file, no CLI — /hooks is a read-only UI a script can't invoke), and SessionStart's source field is only startup|resume|clear|compact|fork, so a plugin-enable is indistinguishable from a fresh start. So the gap genuinely cannot be detected while it is happening.

    What it can do is report it afterwards, using exactly the signature your logs showed: a session where SessionStart ran and PostToolUse never did. PostToolUse now records the session id it saw, and the next SessionStart compares it against the previous session's. If that session used tools at all, you get a one-line notice at your next prompt. It's delivered through systemMessage — the only hook output the human actually sees, rather than one that only reaches the model, which is how this stayed invisible in the first place.

    That doesn't rescue the lost session, but it means nobody spends a second day wondering.

    Suggestion 3 became /remember:doctor and is the piece I think you'll get the most out of: resolved paths, detected tools, storage mode, whether the session directory Claude Code actually created matches the slug the plugin computes (a separate silent no-op, #144), last successful save, and whether PostToolUse has ever fired. OK/WARN/FAIL per line and a one-line verdict.

    Suggestion 2 is now in the install steps.

    Two bugs turned up while testing the doctor, both worth mentioning because they're the same species as the one you reported: it initially told existing installs "PostToolUse has never fired" while printing a successful save two lines later, and it printed an empty slug as OK while silently skipping the check that slug feeds. Both fixed — the second now says it could not check, which is not the same as "no problem."

    On your offer to test on Windows/Git Bash — yes please, if you still have the appetite. We have no Windows machine here. Everything is written for bash 3.2 and MSYS and the suite passes on our runners, but /remember:doctor on a real MSYS terminal, and the notice actually appearing after a mid-session enable, are two things only you can confirm. The branch is max/detect-silent-noop-and-doctor.

    One thing we haven't resolved: /reload-plugins exists, but the docs don't say whether it re-registers hooks. If it does, the answer is a reload rather than a full restart. If you happen to try it, that's useful to know.

  2. fdaviddpt commented on Jul 27, 2026

    @fdaviddpt
    Contributor

    Update: this is merged to main (e58f3a6), so the branch I pointed you at is gone — sorry about that. Testing target is main, and it goes out in 0.8.9 (#203).

    Review turned up two things worth knowing before you try it, both of which would have hit you specifically:

    The doctor would have misdiagnosed you. Its PostToolUse has never fired marker was written after the hook's no-transcript early exit — so on a slug mismatch, or with a Python it can't find, the marker was never written and the verdict came out as "restart Claude Code", which fixes neither. Since you're on Windows/Git Bash with Python 3.14, the Python path was a realistic route for you. It now distinguishes "the hook is wired" from "the hook serviced a session", and names the specific cause before the generic one.

    The notice could have eaten your prompt. It's delivered as systemMessage, which is built with jq — and jq was the last command in the script, so its exit status became the hook's. jq exits 2 on a usage error, and on UserPromptSubmit exit 2 blocks the prompt and erases what you typed. That would have fired on every prompt with a notice pending. Now the JSON is built first and only printed if it was produced, with the hook always exiting 0.

    Also, one thing I got wrong first time: the check was gated on having run before, which meant it could only ever have caught a recurrence — not the mid-session enable that happened to you, since no hook runs then and no stamp is written. That gate is gone. A fresh install now sees the notice once per project, worded to cover both readings.

    If you do get a chance to try it, the three useful signals are: /remember:doctor output on a real MSYS terminal, whether the notice appears at your next prompt after a mid-session enable, and whether the verdict line matches reality. Any of the three is useful on its own.

    Known limits, so they're not a surprise: the alive marker is per project rather than per session, so two Claude Code windows on the same project can produce a spurious notice; and a notice is consumed by the next prompt in any session, so a session closed before its first prompt hands it to the following one.

    Still open, and genuinely useful if you happen to test it: whether /reload-plugins re-registers hooks. If it does, the answer to all of this is a reload rather than a full restart, and the README should say so.

  3. added a commit that references this issue on Aug 18, 2026
  4. added a commit that references this issue on Sep 28, 2026
  5. added 3 commits that reference this issue on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions