diff --git a/agents/tiny-local/AGENTS.md b/agents/tiny-local/AGENTS.md index 465b55bf3..e176f2422 100644 --- a/agents/tiny-local/AGENTS.md +++ b/agents/tiny-local/AGENTS.md @@ -10,13 +10,15 @@ - `agent.yaml` owns profile metadata for discovery and profile switching. - `prompts/agent.system.main.communication.md` owns the local-model communication contract. - `prompts/agent.system.main.solving.md` owns the local-model problem-solving contract and suppresses inherited visible reasoning requirements. +- `prompts/fw.msg_repeat.md` owns Tiny Local's profile-specific recovery instructions when the framework rejects a duplicate assistant message. - `prompts/agent.system.tools.md` owns the Tiny Local tools wrapper and final output-shape reminder after tool listing. - `prompts/agent.system.tool.*.md` files own Tiny Local-specific tool examples that avoid inherited reasoning fields and repeated writes. ## Local Contracts - Preserve the normal Agent Zero tool-call shape: `tool_name` plus `tool_args`. -- Do not add parser repair, duplicate suppression, model transport, memory, or text-editor runtime behavior here. +- Do not add parser repair, duplicate suppression runtime, model transport, memory, or text-editor runtime behavior here. +- Duplicate-message handling may be tightened through profile prompts only. - Keep prompt text short enough for small local models to follow. - Treat continuation requests such as `proceed` or `continue` as commands to execute the next unfinished step, not as prompts for another status response. - Do not include user-specific provider names, API keys, local paths, or secrets. diff --git a/agents/tiny-local/prompts/agent.system.main.communication.md b/agents/tiny-local/prompts/agent.system.main.communication.md index 690220def..65f79edef 100644 --- a/agents/tiny-local/prompts/agent.system.main.communication.md +++ b/agents/tiny-local/prompts/agent.system.main.communication.md @@ -26,4 +26,6 @@ For work that requires a command, file action, browser action, or any other avai If the framework warns that your prior message was malformed, repeated, or reasoning-only, output a corrected JSON tool request immediately without explaining the warning. +When the warning says you sent the same message again, do not resend the same JSON. Change the tool, action, arguments, or final answer so the next message is meaningfully different. + {{ include "agent.system.main.communication_additions.md" }} diff --git a/agents/tiny-local/prompts/agent.system.main.solving.md b/agents/tiny-local/prompts/agent.system.main.solving.md index 6806760c8..2e410be4a 100644 --- a/agents/tiny-local/prompts/agent.system.main.solving.md +++ b/agents/tiny-local/prompts/agent.system.main.solving.md @@ -12,6 +12,7 @@ For tasks that need shell commands, files, browser actions, or other capabilitie - inspect outputs before deciding the next tool call - never claim success from timeout output or a still-running command - after a successful tool result, do not repeat the same exact tool call +- after a repeated-message warning, do not repeat the same status response or exact tool request; choose the next different executable action or report a blocker - when finished, use the `response` tool with a brief result Do not include `thoughts`, `headline`, analysis, plans, or prose outside the JSON object. diff --git a/agents/tiny-local/prompts/fw.msg_repeat.md b/agents/tiny-local/prompts/fw.msg_repeat.md new file mode 100644 index 000000000..10602a558 --- /dev/null +++ b/agents/tiny-local/prompts/fw.msg_repeat.md @@ -0,0 +1,13 @@ +You have sent the same message again. You have to do something else. + +Your repeated JSON was recorded, but it did not execute another tool. Do not send the same JSON object again. + +Choose one different action now: +- If work is unfinished, call a real tool for the next unfinished step. +- If your previous JSON used `response` while work remains, replace it with the next real tool call. +- If a file write or patch already succeeded, read that file or answer with the observed result. +- If a command already ran, inspect its output or run a different next command. +- If the user only said "proceed" or "continue", continue with the next real tool call. +- If no different action is possible, use `response` with a brief blocker. + +Output exactly one JSON object with `tool_name` and `tool_args`. No prose or markdown. diff --git a/tests/test_default_prompt_budget.py b/tests/test_default_prompt_budget.py index b10cb3a32..eddac9b44 100644 --- a/tests/test_default_prompt_budget.py +++ b/tests/test_default_prompt_budget.py @@ -83,6 +83,9 @@ async def test_tiny_local_profile_prompt_is_action_first_json_contract(): response_prompt = ( PROJECT_ROOT / "agents" / "tiny-local" / "prompts" / "agent.system.tool.response.md" ).read_text(encoding="utf-8") + repeat_prompt = ( + PROJECT_ROOT / "agents" / "tiny-local" / "prompts" / "fw.msg_repeat.md" + ).read_text(encoding="utf-8") text_editor_prompt = ( PROJECT_ROOT / "agents" / "tiny-local" / "prompts" / "agent.system.tool.text_editor.md" ).read_text(encoding="utf-8") @@ -98,6 +101,7 @@ async def test_tiny_local_profile_prompt_is_action_first_json_contract(): assert "If the user says \"proceed\", \"continue\", \"go ahead\", \"do it\", \"excellent proceed\"" in system_text assert "Do not explain what command the user could run manually." in system_text assert "output a corrected JSON tool request immediately" in system_text + assert "do not resend the same JSON" in system_text assert "## Tiny Local Output Rule" in system_text assert "~~~json" not in communication_prompt assert "~~~json" not in code_prompt @@ -110,6 +114,9 @@ async def test_tiny_local_profile_prompt_is_action_first_json_contract(): assert "Continuation words" in solving_prompt assert "Do not respond by saying you will begin, continue, start, proceed, or investigate." in solving_prompt assert "Do not use this tool for \"proceed\", \"continue\", \"go ahead\"" in response_prompt + assert "Your repeated JSON was recorded, but it did not execute another tool." in repeat_prompt + assert "replace it with the next real tool call" in repeat_prompt + assert "do not repeat the same status response or exact tool request" in solving_prompt assert "do not repeat the same exact tool call" in solving_prompt assert '"open_in_canvas":true' in text_editor_prompt assert "do not repeat the same tool call" in text_editor_prompt