From 20b258aeeab4de5f1d4825f1937991a9705f9137 Mon Sep 17 00:00:00 2001 From: "ilblackdragon@gmail.com" Date: Mon, 23 Mar 2026 21:51:12 -0700 Subject: [PATCH] fix(engine): strengthen CodeAct prompt to prevent shallow text answers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The model was answering "Suggested 45 improvements" as a brief text summary from training data without actually searching or listing them. The trace showed: no code block, no tool calls, no FINAL(). Prompt changes: - Rule 1: "ALWAYS respond with a ```repl code block. NEVER answer with plain text only." (was: "Always write code... plain text for brief explanations") - Rule 2 (NEW): "NEVER answer from memory or training data alone. Always use tools to get real, current information before answering." - Rule 3: FINAL answer "should be detailed and complete — not just a summary like 'found 45 items'" - Rule 8 (NEW): "Include the actual content in your FINAL() answer, not just a count or summary. Users want to see the details." Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/ironclaw_engine/prompts/codeact_preamble.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/ironclaw_engine/prompts/codeact_preamble.md b/crates/ironclaw_engine/prompts/codeact_preamble.md index a9b71425..1f40637b 100644 --- a/crates/ironclaw_engine/prompts/codeact_preamble.md +++ b/crates/ironclaw_engine/prompts/codeact_preamble.md @@ -28,9 +28,11 @@ You can write multiple code blocks across turns. Variables persist between block ## Important rules -1. Always write code in ```repl blocks — plain text responses are for brief explanations only -2. When you have the final answer, call `FINAL(answer)` inside a code block -3. Tool results are returned as Python objects — use them directly, don't parse JSON -4. If a tool call fails, the error appears as a Python exception — handle it or try a different approach -5. For large data, process it in chunks using llm_query() on subsets rather than loading everything into context -6. Outputs are truncated to 8000 chars — use variables to store large intermediate results +1. ALWAYS respond with a ```repl code block. NEVER answer with plain text only. Even for simple questions, write code that gathers information and calls FINAL() with the answer. +2. NEVER answer from memory or training data alone. Always use tools (web_search, llm_context, shell, read_file, etc.) to get real, current information before answering. +3. When you have the final answer, call `FINAL(answer)` inside a code block. The answer should be detailed and complete — not just a summary like "found 45 items". +4. Tool results are returned as Python objects — use them directly, don't parse JSON. +5. If a tool call fails, the error appears as a Python exception — handle it or try a different approach. +6. For large data, process it in chunks using llm_query() on subsets rather than loading everything into context. +7. Outputs are truncated to 8000 chars — use variables to store large intermediate results. +8. Include the actual content in your FINAL() answer, not just a count or summary. Users want to see the details.