fix: show the tracing reminder to the user, not just the agent - #18
Merged
Conversation
The SessionStart reminder was emitted as plain stdout, which Claude Code
injects into the *model's* context — the user never saw a banner. Emit a
top-level JSON `systemMessage` instead (exit 0), which Claude Code renders
to the user as a terminal banner. Drop the agent-context delivery: the
warning is for the human, not the model.
- cli.rs: on_start emits {"systemMessage": ...} JSON
- cli_test: assert the JSON systemMessage contract, no hookSpecificOutput
- harness: scenarios c/e now assert the user-facing hook_system_message
attachment (verified against claude 2.1.198), not just text in the transcript
- README: correct the --on-start description
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
winjer
marked this pull request as ready for review
July 21, 2026 09:42
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.
Follow-up to #17. In 0.4.0 the SessionStart hook fires, but it emits plain stdout — which Claude Code injects into the model's context, so the user never sees a banner. This makes the reminder actually visible to the user.
Change:
on_start()now emits a top-level JSONsystemMessage(exit 0), which Claude Code renders to the user as a terminal banner. The old agent-context delivery is dropped — the warning is for the human, not the model.Verified the mechanism with a probe against real Claude Code 2.1.198 (the pinned harness version): the
systemMessageis recorded as ahook_system_messagetranscript attachment (the user-facing banner element) and is not injected as model context. NoCLAUDE_CODE_VERSIONbump needed.cli.rs: emit{"systemMessage": ...}JSONcli_test: assert the JSON contract (systemMessage present, nohookSpecificOutput)hook_system_messageattachment, not just text in the transcript--on-startdescriptionAll 5 container-harness scenarios pass;
cargo test+ clippy clean.Behavior change: after this ships and users re-install, the reminder becomes a visible banner instead of silent agent context.