Let take_screenshot skip chat display for internal verification captures#4097
Open
bcotrim wants to merge 2 commits into
Open
Let take_screenshot skip chat display for internal verification captures#4097bcotrim wants to merge 2 commits into
bcotrim wants to merge 2 commits into
Conversation
Collaborator
📊 Performance Test ResultsComparing e6a0a77 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
| }, | ||
| "bin": { | ||
| "pi-ai": "./dist/cli.js" | ||
| "pi-ai": "dist/cli.js" |
Contributor
There was a problem hiding this comment.
I am not sure what are these changes so just leaving the comment to flag this 😅
katinthehatsite
approved these changes
Jul 7, 2026
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.

Related issues
How AI was used in this PR
Implemented and tested with Claude Code, based on a confirmed finding from a multi-agent review of #3982; human-reviewed before opening.
Proposed Changes
Since #3982, every
take_screenshotcapture is automatically shown to the user as an inline chat artifact. That is right for deliberate captures, but the agent also screenshots constantly for its own eyes — the visual-polish loop alone takes up to 5 verification passes per page, and a light/dark × desktop/mobile check produces 4 images per call. Iterative design sessions flood the conversation with near-identical screenshots the user never asked for, and each one is persisted in the session transcript. (The previous presentation rule's "Do not present every internal verification screenshot" guidance was lost in the #3982 rewrite, and the model had no mechanism to comply with it anyway.)This PR gives the agent that mechanism: an optional
displayinput ontake_screenshot(defaulttrue, so current behavior is unchanged). Passingdisplay: falsekeeps the capture out of the chat while the model still receives the image for its own visual verification, and the presentation rule now tells the agent to use it while iterating so users only see deliberate milestone captures.Testing Instructions
npm test -- apps/cli/ai/tests/tools.test.ts apps/cli/ai/tests/system-prompt.test.ts packages/commonnpm run typecheckPre-merge Checklist
🤖 Generated with Claude Code