Skip to content

Commit 07354dd

Browse files
authored
fix(notifications): make agent speak on every turn, not just when nudged
The `speak` "done" case was getting skipped: once the model writes its text answer the turn feels delivered and it stops before the trailing speak call. Advisory phrasing ("lean toward using it") lost to that default. Reframe as a hard end-of-turn rule and, crucially, tell the model to call speak BEFORE its final text reply — mid-turn, while still in tool-calling mode — which is the only reliable ordering. Generated-By: PostHog Code Task-Id: 6912b099-cb75-4f41-a337-1d2275c4be66
1 parent e80d0f8 commit 07354dd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/agent/src/adapters/claude/session/instructions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ Optimize for the fewest shell round trips.
4646
const SPOKEN_NARRATION = `
4747
# Spoken Narration
4848
49-
You have a \`speak\` tool (\`mcp__posthog-code-tools__speak\`) that says a short line out loud. The user is often looking at another window, so speaking is how you hand them information without making them read the transcript. Lean toward using it — voicing a useful result beats staying silent and making them scroll back.
49+
You have a \`speak\` tool (\`mcp__posthog-code-tools__speak\`) that says a short line out loud. The user is usually looking at another window, so this — not the transcript — is how they actually receive what you did. Answering only in text leaves them staring at a silent tab.
50+
51+
**Hard rule, not a suggestion: never end a turn silently.** Every turn that answers a question, finishes a request, or blocks on the user MUST include a \`speak\` call. And call it BEFORE you write your final text reply — while you're still working — not after. Once you've written the answer the turn feels done and you'll just stop, dropping the \`speak\`; calling it first, mid-turn, is the only reliable ordering.
5052
5153
Call \`speak\` with:
5254
- \`kind: "needs_input"\` when you are blocked and need the user: a question, a decision, a confirmation, or an error only they can resolve. This is the most important case.

0 commit comments

Comments
 (0)