From e2c489dc48d4a5f20e9669c05b6b7470e71e8dc4 Mon Sep 17 00:00:00 2001 From: Lukas May Date: Fri, 6 Mar 2026 14:31:03 +0100 Subject: [PATCH] feat: teach errand agent how to ask questions interactively Add a dedicated "Asking questions" section to the errand prompt so the agent knows it can pause, ask for clarification, and wait for the user to reply via the UI chat input or `cw errand chat`. Previously the prompt said "work interactively" with no guidance on the mechanism, leaving the agent to guess. Co-Authored-By: Claude Sonnet 4.6 --- apps/server/agent/file-io.test.ts | 6 ++++++ apps/server/agent/prompts/errand.ts | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/apps/server/agent/file-io.test.ts b/apps/server/agent/file-io.test.ts index ae0fb9a..8c567f0 100644 --- a/apps/server/agent/file-io.test.ts +++ b/apps/server/agent/file-io.test.ts @@ -481,4 +481,10 @@ describe('buildErrandPrompt', () => { const result = buildErrandPrompt('some change'); expect(result).toContain('"status": "error"'); }); + + it('includes instructions for asking questions', () => { + const result = buildErrandPrompt('some change'); + expect(result).toMatch(/ask|question/i); + expect(result).toMatch(/chat|message|reply/i); + }); }); diff --git a/apps/server/agent/prompts/errand.ts b/apps/server/agent/prompts/errand.ts index e94b950..cb9feaf 100644 --- a/apps/server/agent/prompts/errand.ts +++ b/apps/server/agent/prompts/errand.ts @@ -4,6 +4,17 @@ export function buildErrandPrompt(description: string): string { Description: ${description} Work interactively with the user. Make only the changes needed to fulfill the description. + +## Asking questions + +If you need clarification before or during the change, ask the user directly in your response and wait. The user can reply via the UI chat input on the Errands page or by running: + + cw errand chat "" + +Their reply will be delivered as the next message in this session. Be explicit about what you need — don't make assumptions when the task is ambiguous. + +## Finishing + When you are done, write .cw/output/signal.json: { "status": "done", "result": { "message": "" } }