enforce single mode selection per run (#413)

Prevents the agent from calling select_mode multiple times, which caused
it to chain modes (e.g. Plan then Build) when the user only asked for a
plan. Also removes the Plan orchestrator guidance that explicitly
encouraged switching to Build after planning.

Closes #394

Made-with: Cursor
This commit is contained in:
David Blass
2026-03-05 23:06:05 +00:00
committed by pullfrog[bot]
parent 808849fcc8
commit fafe930c77
2 changed files with 15 additions and 4 deletions
+7 -2
View File
@@ -144064,7 +144064,7 @@ Use max effort for thorough reviews.`,
### Effort
Use mini or auto effort. After receiving the plan, you may delegate a Build subagent to implement it.`,
Use mini or auto effort.`,
Fix: `### Checklist
1. Before delegating, checkout the PR branch yourself via \`${ghPullfrogMcpName}/checkout_pr\` \u2014 subagents have no git/checkout tools.
@@ -144114,9 +144114,14 @@ function buildOrchestratorGuidance(mode) {
function SelectModeTool(ctx) {
return tool({
name: "select_mode",
description: "Select a mode and receive orchestrator-level guidance on how to handle it, including suggested delegation flows and prompt-crafting tips. Call this before delegating to understand the best approach for the task.",
description: "Select a mode and receive orchestrator-level guidance on how to handle it, including suggested delegation flows and prompt-crafting tips. Call this ONCE before delegating. Mode selection is final \u2014 you cannot switch modes after selecting.",
parameters: SelectModeParams,
execute: execute(async (params) => {
if (ctx.toolState.selectedMode) {
return {
error: `mode already selected: "${ctx.toolState.selectedMode}". mode selection is final and cannot be changed. complete your current workflow within this mode.`
};
}
const selectedMode = resolveMode(ctx.modes, params.mode);
if (!selectedMode) {
const availableModes = ctx.modes.map((m) => m.name).join(", ");
+8 -2
View File
@@ -135,7 +135,7 @@ Use max effort for thorough reviews.`,
### Effort
Use mini or auto effort. After receiving the plan, you may delegate a Build subagent to implement it.`,
Use mini or auto effort.`,
Fix: `### Checklist
@@ -196,9 +196,15 @@ export function SelectModeTool(ctx: ToolContext) {
return tool({
name: "select_mode",
description:
"Select a mode and receive orchestrator-level guidance on how to handle it, including suggested delegation flows and prompt-crafting tips. Call this before delegating to understand the best approach for the task.",
"Select a mode and receive orchestrator-level guidance on how to handle it, including suggested delegation flows and prompt-crafting tips. Call this ONCE before delegating. Mode selection is final — you cannot switch modes after selecting.",
parameters: SelectModeParams,
execute: execute(async (params) => {
if (ctx.toolState.selectedMode) {
return {
error: `mode already selected: "${ctx.toolState.selectedMode}". mode selection is final and cannot be changed. complete your current workflow within this mode.`,
};
}
const selectedMode = resolveMode(ctx.modes, params.mode);
if (!selectedMode) {