Skip to content

Fix 'ok' short predictions: add explicit instruction to agent_input#6

Merged
Turtle-Hwan merged 1 commit into
mainfrom
fix/agent-input-instruction-block
May 12, 2026
Merged

Fix 'ok' short predictions: add explicit instruction to agent_input#6
Turtle-Hwan merged 1 commit into
mainfrom
fix/agent-input-instruction-block

Conversation

@Turtle-Hwan
Copy link
Copy Markdown
Contributor

Problem

Clone MCP kept returning single-word or bare-affirmation predictions —
"ok", "looks good", "go ahead" — instead of specific, actionable next
prompts. This caused the loop to escalate to humans even on iterations
where the work was clearly proceeding well.

Root cause

formatConversationHistory() (shared by both hooks) dumped the
conversation context and then just ended. Clone MCP had no guidance on
what kind of response to produce, so it defaulted to the shortest
plausible user reply — a terse approval.

The ask-user-question hook already appends:

"Predict the exact natural-language answer... Return only the answer text."
…and gets specific responses. The stop hook had no equivalent.

Fix

Append a 5-rule instruction block to formatConversationHistory():

  • write as the user typing their next message
  • reference concrete artifacts, file names, or test results
  • minimum 1 full sentence — no single words, no "ok", no bare affirmations
  • if work is complete, ask for the next logical action

Since formatConversationHistory() is shared, both hooks get the fix
in one change.

Evidence

Live e2e against https://api.clone.is/mcp (demo token):

predicted_response
Before "yeah go ahead"
After "Go ahead and write the supertest integration tests for the validation error cases."

Reasoning also improved — now explicitly cites prior turns.

Test plan

  • pnpm test → 23/23 passing, including new assertions that the
    instruction block appears in agent_input.
  • node scripts/manual-e2e-multiturn.mjs → specific full-sentence
    prediction confirmed.

🤖 Generated with Claude Code

…onses

Clone MCP kept returning single-word or bare-affirmation responses
("ok", "looks good", "go ahead") because the agent_input gave it context
but no guidance on what to produce. The ask-user-question hook already
appends an explicit instruction block ("Predict the exact natural-language
answer... Return only the answer text") and gets specific responses — the
stop hook had no equivalent.

Add a 5-rule instruction block at the end of formatConversationHistory():
- write as the user typing their next message
- reference concrete artifacts, file names, or test results
- minimum 1 full sentence — no bare affirmations
- if work is complete, ask for the next logical action

Live e2e result before: "yeah go ahead"
Live e2e result after:  "Go ahead and write the supertest integration tests
                         for the validation error cases."

Since formatConversationHistory() is shared, this also improves the
AskUserQuestion hook context quality (the instruction is appended before
the question block, adding further specificity to the surrounding context).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Turtle-Hwan Turtle-Hwan merged commit a259385 into main May 12, 2026
@Turtle-Hwan Turtle-Hwan deleted the fix/agent-input-instruction-block branch May 12, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant