fix: tighten tiny local repeat recovery

TerminallyLazy committed Jun 24, 2026 at 04:37 UTC 2131a5f33658546b804a4af6bdf889115d9e7fb3
5 files changed +26 -1
agents/tiny-local/AGENTS.md
+3 -1
@@ -10,13 +10,15 @@
10 - `agent.yaml` owns profile metadata for discovery and profile switching.
11 - `prompts/agent.system.main.communication.md` owns the local-model communication contract.
12 - `prompts/agent.system.main.solving.md` owns the local-model problem-solving contract and suppresses inherited visible reasoning requirements.
13 +- `prompts/fw.msg_repeat.md` owns Tiny Local's profile-specific recovery instructions when the framework rejects a duplicate assistant message.
14 - `prompts/agent.system.tools.md` owns the Tiny Local tools wrapper and final output-shape reminder after tool listing.
15 - `prompts/agent.system.tool.*.md` files own Tiny Local-specific tool examples that avoid inherited reasoning fields and repeated writes.
16
17 ## Local Contracts
18
19 - Preserve the normal Agent Zero tool-call shape: `tool_name` plus `tool_args`.
19 -- Do not add parser repair, duplicate suppression, model transport, memory, or text-editor runtime behavior here.
20 +- Do not add parser repair, duplicate suppression runtime, model transport, memory, or text-editor runtime behavior here.
21 +- Duplicate-message handling may be tightened through profile prompts only.
22 - Keep prompt text short enough for small local models to follow.
23 - Treat continuation requests such as `proceed` or `continue` as commands to execute the next unfinished step, not as prompts for another status response.
24 - Do not include user-specific provider names, API keys, local paths, or secrets.
agents/tiny-local/prompts/agent.system.main.communication.md
+2
@@ -26,4 +26,6 @@ For work that requires a command, file action, browser action, or any other avai
26
27 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.
28
29 +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.
30 +
31 {{ include "agent.system.main.communication_additions.md" }}
agents/tiny-local/prompts/agent.system.main.solving.md
+1
@@ -12,6 +12,7 @@ For tasks that need shell commands, files, browser actions, or other capabilitie
12 - inspect outputs before deciding the next tool call
13 - never claim success from timeout output or a still-running command
14 - after a successful tool result, do not repeat the same exact tool call
15 +- 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
16 - when finished, use the `response` tool with a brief result
17
18 Do not include `thoughts`, `headline`, analysis, plans, or prose outside the JSON object.
agents/tiny-local/prompts/fw.msg_repeat.md new
+13
@@ -0,0 +1,13 @@
1 +You have sent the same message again. You have to do something else.
2 +
3 +Your repeated JSON was recorded, but it did not execute another tool. Do not send the same JSON object again.
4 +
5 +Choose one different action now:
6 +- If work is unfinished, call a real tool for the next unfinished step.
7 +- If your previous JSON used `response` while work remains, replace it with the next real tool call.
8 +- If a file write or patch already succeeded, read that file or answer with the observed result.
9 +- If a command already ran, inspect its output or run a different next command.
10 +- If the user only said "proceed" or "continue", continue with the next real tool call.
11 +- If no different action is possible, use `response` with a brief blocker.
12 +
13 +Output exactly one JSON object with `tool_name` and `tool_args`. No prose or markdown.
tests/test_default_prompt_budget.py
+7
@@ -83,6 +83,9 @@ async def test_tiny_local_profile_prompt_is_action_first_json_contract():
83 response_prompt = (
84 PROJECT_ROOT / "agents" / "tiny-local" / "prompts" / "agent.system.tool.response.md"
85 ).read_text(encoding="utf-8")
86 + repeat_prompt = (
87 + PROJECT_ROOT / "agents" / "tiny-local" / "prompts" / "fw.msg_repeat.md"
88 + ).read_text(encoding="utf-8")
89 text_editor_prompt = (
90 PROJECT_ROOT / "agents" / "tiny-local" / "prompts" / "agent.system.tool.text_editor.md"
91 ).read_text(encoding="utf-8")
@@ -98,6 +101,7 @@ async def test_tiny_local_profile_prompt_is_action_first_json_contract():
101 assert "If the user says \"proceed\", \"continue\", \"go ahead\", \"do it\", \"excellent proceed\"" in system_text
102 assert "Do not explain what command the user could run manually." in system_text
103 assert "output a corrected JSON tool request immediately" in system_text
104 + assert "do not resend the same JSON" in system_text
105 assert "## Tiny Local Output Rule" in system_text
106 assert "~~~json" not in communication_prompt
107 assert "~~~json" not in code_prompt
@@ -110,6 +114,9 @@ async def test_tiny_local_profile_prompt_is_action_first_json_contract():
114 assert "Continuation words" in solving_prompt
115 assert "Do not respond by saying you will begin, continue, start, proceed, or investigate." in solving_prompt
116 assert "Do not use this tool for \"proceed\", \"continue\", \"go ahead\"" in response_prompt
117 + assert "Your repeated JSON was recorded, but it did not execute another tool." in repeat_prompt
118 + assert "replace it with the next real tool call" in repeat_prompt
119 + assert "do not repeat the same status response or exact tool request" in solving_prompt
120 assert "do not repeat the same exact tool call" in solving_prompt
121 assert '"open_in_canvas":true' in text_editor_prompt
122 assert "do not repeat the same tool call" in text_editor_prompt