Skip to content

fix: show the tracing reminder to the user, not just the agent - #18

Merged
winjer merged 1 commit into
mainfrom
fix/onstart-user-visible-warning
Jul 21, 2026
Merged

fix: show the tracing reminder to the user, not just the agent#18
winjer merged 1 commit into
mainfrom
fix/onstart-user-visible-warning

Conversation

@winjer

@winjer winjer commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

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 JSON systemMessage (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 systemMessage is recorded as a hook_system_message transcript attachment (the user-facing banner element) and is not injected as model context. No CLAUDE_CODE_VERSION bump needed.

  • cli.rs: emit {"systemMessage": ...} JSON
  • cli_test: assert the JSON contract (systemMessage present, no hookSpecificOutput)
  • harness scenarios (c)/(e): assert the user-facing hook_system_message attachment, not just text in the transcript
  • README: correct the --on-start description

All 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.

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
winjer marked this pull request as ready for review July 21, 2026 09:42
@winjer
winjer merged commit 5091ef3 into main Jul 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant