Repository navigation
feat(prompt_agent): let a post-turn hook give the user sim a note - #828
Open
kaihackney-scale wants to merge 1 commit into
Open
kaihackney-scale wants to merge 1 commit into
kaihackney-scale wants to merge 1 commit into
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>
This branch has not been deployed
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.Summary
Post-turn hooks can now give user simulators a private note about the agent’s work.
No actionable issues found.
Reviews (1) · Last reviewed commit: "feat(prompt_agent): let a post-turn hook..." · Reviewed by Greptile