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 <noreply@anthropic.com>
This commit is contained in:
Lukas May
2026-03-06 14:31:03 +01:00
parent 343c6a83a8
commit e2c489dc48
2 changed files with 17 additions and 0 deletions

View File

@@ -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);
});
});

View File

@@ -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 <id> "<your answer>"
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": "<one-sentence summary of what you changed>" } }