Repository navigation
feat(prompt_agent): let a post-turn hook give the user sim a note - #828
Merged
Merged
Conversation
turn.ask_user(note=...) shows the note to an LLM user sim with the agent's reply, as what the person found checking the work themselves. The agent never sees it. A peer user sim gets it as one more text part after the reply; a built-in user sim gets it in its read as user_note. A human peer gets none. The note is recorded under metadata user_side_notes (peer) or in the stored read (built-in). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cikowski
approved these changes
Nov 20, 2026
cikowski
left a comment
Collaborator
There was a problem hiding this comment.
Looks good. The note reaches both kinds of user sim, never the agent, and the no-note path is unchanged. Tests cover the wiring through the step for each path, which is what I wanted to see.
A few small things inline, none blocking.
One thing to plan for: this conflicts with #597 in _UserSide.ask and _ask_peer. I'd land this first and rebase #597 on it. When you do, the note should go on the first send to the peer only (not on the gate's rewrite request), and the gate's judge needs to see the note, otherwise a user sim that reports what it found gets flagged as writing in the assistant's voice.
…in sim's notes are recorded too - The user side is asked once a turn: a note passed after it was already asked, without that note, now raises instead of being dropped with no trace. One passed after an agent trigger answered the turn has no one to reach, which is documented, not an error. - A note to a user sim deploy_user_sim_agent deployed is recorded in metadata["user_side_notes"] too, as the peer path's is, so there is one place to look for what the user sim was told. - ask's docstring says a note reaches no one when an agent trigger answers the turn or once end_after is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kaihackney-scale
added a commit
that referenced
this pull request
Nov 21, 2026
#828 (a post-turn hook's note to the user sim) landed on main and met the gate in _UserSide. Both are kept, as the review asked: the note goes with the user sim's first message only, never with the gate's rewrite request, for a peer user sim (_ask_peer sends the first message with it through _send_to_peer, the rewrites without) and for the built-in one. The gate's judge is shown the note (run_gate and check take user_note; the judge's prompt says what the user found checking the work themselves), so a user sim reporting that check isn't read as the assistant. The note is recorded in user_side_notes on both paths, as #828 does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What and why
A post-turn hook can already read the envs after each agent turn and decide what happens next, but it can't tell the
LLM user sim what it found. A hook that checks the agent's work (say, a sheet the agent claims to have made) needs the
user sim to react as the person would after looking: "I don't see the sheet yet". Without a channel, the sim judges
the work from the agent's own description of it.
turn.ask_user(note=...)adds that channel. The note goes to the user sim with the agent's reply, as something onlythe sim sees: what the person found when checking the work themselves. The agent never sees it.
It is recorded under
metadata["user_side_notes"].deploy_user_sim_agent) gets it in its read asuser_note, rendered as its own section. Itis kept in the stored read.
ask_user()with no note behaves exactly as before. An empty or non-text note is refused.How it was tested
test_prompt_agent_post_turn_hooks.py: the note reaches a peer user sim after the reply, isrecorded, never reaches the agent, a human peer gets none, and a bad note is refused. In
test_prompt_agent_built_in_user_sim.py: the built-in user sim's read carries it and the prompt shows it.pytest tst/unit/task_step -k "prompt_agent or user_sim or post_turn": 820 passed.make lint: passed.agent-env task runof a multi-turn task on deployed sandboxes, with a peer LLM user sim and apost-turn hook that checked the agent's work in the env after each turn and passed a note when something was
missing. The notes reached the user sim, it raised them in its own words in its next message, the agent then
fixed the missing item, and no note text appeared in anything the agent received.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Adds
turn.ask_user(note=...)so a post-turn hook can tell the user sim what it found.No new actionable issues were found.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Post-turn hook"] --> B["turn.ask_user(note=...)"] B --> C{"Who answers?"} C -->|Trigger| D["Return trigger answer"] C -->|Human| E["Send agent reply only"] C -->|Peer sim| F["Send reply plus note"] C -->|Built-in sim| G["Add user_note to read"] F --> H["Record note"] G --> H F --> I["Return sim answer"] G --> I I --> J["Send answer to solver"]Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'framework/..." · Reviewed by Greptile