Saved prompts: transcript redaction + per-submission custom instructions #3358
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.
Closes #3013
Why
/name
). Users can override via CLI/config.Before
What We Did (Overview)
/<name>
or/<name> <instruction>
). The full saved prompt body is still sent to the agent.--show-saved-prompt
, alias--no-redact-saved-prompt
) and config keyredact_saved_prompt_body
(default true)./<name> <instruction>
(multiline supported). Agent receives a structured Directive where priority is explicit (CustomInstruction > SavedPrompt
). Both parts wrapped in CDATA for robustness.prompts.md
andconfig.md
updated.After
Technical Details
SubmittedWithDisplay { text, display, pretty_unredacted }
. History usesdisplay
(redaction ON) orpretty_unredacted
(redaction OFF). Agent always usestext
.pretty_unredacted
layout (“Custom instruction:” then “Saved prompt:”) when redaction OFF.display_text
; history selectsdisplay_text
vspretty_unredacted
based on config.redact_saved_prompt_body
key; wire CLI flags--show-saved-prompt
/--no-redact-saved-prompt
.exec
andmcp-server
initializers updated withredact_saved_prompt_body: None
; core tests updated.Tests Added / Updated
selecting_custom_prompt_submits_file_contents
(updated)selecting_custom_prompt_with_instruction_wraps_and_displays_typed
(added)custom_prompt_shows_command_in_history
(added)custom_prompt_shows_body_when_redaction_disabled
(added)custom_instruction_with_cdata_terminator_does_not_panic_and_is_included
(added)flag_show_saved_prompt_sets_override_false
alias_no_redact_saved_prompt_sets_override_false
default_no_flag_sets_no_override
Docs
prompts.md
: sections “Transcript redaction of saved prompts” and “Custom instructions for saved prompts”.config.md
: new keyredact_saved_prompt_body
.