fix: tighten tiny local repeat recovery

This commit is contained in:
TerminallyLazy 2026-06-24 04:37:32 -04:00
parent 15aa7d71f0
commit 2131a5f336
5 changed files with 26 additions and 1 deletions

View file

@ -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.

View file

@ -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" }}

View file

@ -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.

View file

@ -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.

View file

@ -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