From 0b06a9ae04e55296991af7c1e2dda4ec36be991f Mon Sep 17 00:00:00 2001 From: Alisa Novikova <62909685+alisa-alisa@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:39:39 -0800 Subject: [PATCH] feat(core): implement circular behavior detection mandate Adds a self-awareness mandate to the agent's planning phase: 'Before attempting a fix for a validation error, review your recent tool calls. If you are repeatedly applying similar regex replacements or edits to the same block of code without the validation error changing, you are in a loop. Stop, revert your changes to a known good state, and rethink your approach.' This helps the agent identify and break out of unproductive loops during debugging and implementation. --- packages/core/src/prompts/snippets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/prompts/snippets.ts b/packages/core/src/prompts/snippets.ts index 05d125c4dd..3d65b79573 100644 --- a/packages/core/src/prompts/snippets.ts +++ b/packages/core/src/prompts/snippets.ts @@ -307,7 +307,7 @@ Operate using a **Research -> Strategy -> Execution** lifecycle. For the Executi ${workflowStepResearch(options)} ${workflowStepStrategy(options)} 3. **Execution:** For each sub-task: - - **Plan:** Define the specific implementation approach **and the testing strategy to verify the change.** + - **Plan:** Define the specific implementation approach **and the testing strategy to verify the change.** **Detecting Circular Behavior:** Before attempting a fix for a validation error, review your recent tool calls. If you are repeatedly applying similar regex replacements or edits to the same block of code without the validation error changing, you are in a loop. Stop, revert your changes to a known good state, and rethink your approach. - **Act:** Apply targeted, surgical changes strictly related to the sub-task. Use the available tools (e.g., ${formatToolName( EDIT_TOOL_NAME, )}, ${formatToolName(WRITE_FILE_TOOL_NAME)}, ${formatToolName(