From fa2516e53eb23f60ec591e78b3a7df3ef69f7def Mon Sep 17 00:00:00 2001 From: wolfy Date: Sun, 31 May 2026 12:17:21 -0500 Subject: [PATCH] chore: use thinking mode --- agents/ollama.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/agents/ollama.ts b/agents/ollama.ts index 9eb3da4..5f7f99b 100644 --- a/agents/ollama.ts +++ b/agents/ollama.ts @@ -119,7 +119,8 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise { tools, keep_alive: "10m", options: { - think: false, + think: true, + num_ctx: 32768, } as Record, }); } catch (err) { @@ -206,13 +207,32 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise { // re-calling select_mode instead of executing the workflow. if (calledSelectMode && !pendingModeNudge) { pendingModeNudge = true; + + // Parse the selected mode name from the tool result so we can give a + // more specific first-step instruction. + let selectedMode = ""; + try { + const lastToolMsg = messages[messages.length - 1]; + const parsed = JSON.parse( + typeof lastToolMsg.content === "string" ? lastToolMsg.content : "", + ); + if (typeof parsed?.modeName === "string") selectedMode = parsed.modeName; + } catch { + // best-effort + } + + const firstStep = + selectedMode === "Review" || selectedMode === "IncrementalReview" + ? "Your first tool call must be checkout_pr with the PR number from the event context." + : "Call the first tool required by the workflow now."; + messages.push({ role: "user", content: - "Good. You have selected a mode and received the workflow. " + + `Good. You have selected ${selectedMode || "a"} mode and received the workflow. ` + "Do NOT call select_mode again. " + - "Call the next tool to execute the workflow now (e.g. checkout_pr, get_issue, create_pull_request_review). " + - "Start immediately.", + `${firstStep} ` + + "Execute the complete workflow step by step until you call create_pull_request_review or report_progress.", }); } }