fix(agent): append system_prompt to the Claude Code preset instead of replacing - #92
Open
Mihaiii wants to merge 2 commits into
Open
fix(agent): append system_prompt to the Claude Code preset instead of replacing#92Mihaiii wants to merge 2 commits into
Mihaiii wants to merge 2 commits into
Conversation
… replacing A plain-string ClaudeAgentOptions.system_prompt replaces Claude Code's entire default system prompt. Every experiment that sets even a one-line system_prompt silently strips the harness's behavioral guidance — observed in skills nightly runs as zero parallel tool calls (the batching instruction lives in the default prompt), heavy narration, and raw cat/sed over Read/Grep. Wrap the configured prompt in the SDK's claude_code preset with append so the default prompt survives. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mihaiii
marked this pull request as ready for review
August 7, 2026 13:34
Mihaiii
requested review from
akshaylive,
bai-uipath,
tmatup and
uipreliga
as code owners
August 7, 2026 13:34
|
Claude finished @Mihaiii's task in 1m 46s —— View job 🔍 Reviewing PR #92: Fix system_prompt append behaviorTodo List:
|
Co-Authored-By: Claude Fable 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.

Why append instead of replace
ClaudeAgentOptions.system_promptaccepts either a plain string or theclaude_codepreset dict. A plain string replaces Claude Code's entire default system prompt — the only way to keep the default is{"type": "preset", "preset": "claude_code", "append": ...}. coder_eval passes the experiment'ssystem_promptstraight through as a string, so any experiment that sets even a one-line prompt silently strips every behavioral instruction the harness ships with.That is exactly what the skills-repo experiments do. The nightly config sets an innocuous sandbox guard:
https://github.com/UiPath/skills/blob/main/tests/experiments/nightly.yaml#L39-L40
(same pattern in
tests/experiments/default.yaml#L21,smoke.yaml#L39,smoke-windows.yaml#L23, and the skill-comparison templates)One sentence of sandbox policy costs the whole Claude Code system prompt.
Observed impact (skills nightly,
skill-rpa-execution-map-greenfield)The task is a turn-budget gate (
max_turns: 10, expected 6) that assumes the agent batches tool calls per turn. Everyclaude-sonnet-5run exhausted the cap; pass/fail depended on where the cap happened to land. Transcript analysis across four runs (31172161551, 31174117722 ×3 attempts, 31178128981, 31179344004 ×2 attempts):Bashcat/sed/findwhere the default prompt directs the dedicatedRead/Grep/Globtools (e.g.cd TextReport && cat project.json && cat Main.xaml), losing the harness's file-tracking and permission integration.Beyond the observed items, replacing the prompt also drops the default guidance on code-reference formatting, task management, professional tone, and the security guardrails — none of which an experiment author intends to disable when adding a sandbox-scoping sentence.
The change
claude_code_agent.py: whensystem_promptis configured, wrap it asSystemPromptPreset(type="preset", preset="claude_code", append=...)so the default prompt survives and the experiment text is appended.Nonestill means the untouched SDK default.agent_config.py:system_promptfield description updated ("appended to the agent's default system prompt" — previously "Replaces").tests/test_agent.py: two tests via the existing_capture_sdk_optionspattern (append wrapping;Nonepassthrough).Behavioral note for existing consumers
Every experiment that sets
system_promptswitches from replace to append semantics with this release. For the known consumers (sandbox-scoping one-liners) this is the intended repair. An experiment that deliberately relied on full replacement to suppress default Claude Code behavior would need a different mechanism.Judge (
agent_judge.py) and user-simulator paths construct their own options and are unaffected.🤖 Generated with Claude Code