Skip to content

feat: prompt rework#688

Open
mykhailobuleshnyi wants to merge 2 commits intomainfrom
feat/prompt-rework
Open

feat: prompt rework#688
mykhailobuleshnyi wants to merge 2 commits intomainfrom
feat/prompt-rework

Conversation

@mykhailobuleshnyi
Copy link
Copy Markdown
Contributor

@mykhailobuleshnyi mykhailobuleshnyi commented Apr 10, 2026

Note

Medium Risk
Changes core agent prompt composition (new blocks, renamed sections, and different tool/instruction text), which can materially alter model behavior across agents. Low implementation complexity, but broad behavioral impact should be validated with regression prompt tests.

Overview
Refactors agent prompt building to support a new instructions field on Agent that appends user-provided text into the operational_instructions block during _init_prompt_blocks().

Reworks the ReAct prompt manager/template structure: renames secondary_instructions to operational_instructions, splits sandbox guidance into a dedicated environment block, and updates the base AGENT_PROMPT_TEMPLATE to a numbered/sectioned format with new behaviour/task guidance.

Adjusts ReAct prompt constants to be more concise and standardized (markdown headings), introduces REACT_BLOCK_TOOLS_BRIEF, and switches function-calling mode to use the brief tools block instead of the prior no-formats tools listing.

Reviewed by Cursor Bugbot for commit fd81f9a. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fd81f9a. Configure here.

self.system_prompt_manager.set_block(
"operational_instructions",
f"{existing}\n\n{self.instructions}" if existing else self.instructions,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User instructions lack Jinja raw wrapping unlike role

Medium Severity

The new self.instructions content is injected directly into the operational_instructions Jinja template block without {% raw %}...{% endraw %} wrapping. The role field has explicit protection against unintended Jinja rendering (lines 1591–1595), but instructions does not. If a user provides instructions containing {{ }} or {% %} syntax (e.g., "Use format {{ name }}: {{ value }}"), the Jinja renderer will attempt variable substitution, likely causing an UndefinedError or silently producing incorrect prompt content.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fd81f9a. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant