---
phase: 10-multi-question-schema
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - src/agent/schema.ts
  - src/agent/types.ts
  - src/events/types.ts
autonomous: true
---

<objective>
Extend agent output schema to return array of questions; update types throughout.

Purpose: Enable agents to ask multiple questions in one pause, reducing round-trips.
Output: Updated Zod schema, TypeScript types, and event payloads supporting questions array.
</objective>

<execution_context>
@~/.claude/get-shit-done/workflows/execute-plan.md
@~/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/08.1-agent-output-schema/08.1-01-SUMMARY.md

@src/agent/schema.ts
@src/agent/types.ts
@src/events/types.ts
</context>

<tasks>

<task type="auto">
  <name>Task 1: Update agent output schema to questions array</name>
  <files>src/agent/schema.ts</files>
  <action>
Change `question` status variant from single question to array:

Before:
```typescript
z.object({
  status: z.literal('question'),
  question: z.string(),
  options: z.array(optionSchema).optional(),
  multiSelect: z.boolean().optional(),
})
```

After:
```typescript
z.object({
  status: z.literal('questions'),  // plural
  questions: z.array(z.object({
    id: z.string(),  // unique identifier for matching answers
    question: z.string(),
    options: z.array(optionSchema).optional(),
    multiSelect: z.boolean().optional(),
  })),
})
```

Update `agentOutputJsonSchema` to match the Zod schema.

Key points:
- Rename status from 'question' to 'questions' (plural) for clarity
- Each question has an `id` field so answers can be matched
- Single question case: `questions: [{ id: "q1", question: "..." }]`
  </action>
  <verify>npm run typecheck passes</verify>
  <done>Schema exports updated AgentOutput type with questions array</done>
</task>

<task type="auto">
  <name>Task 2: Update PendingQuestion type to PendingQuestions</name>
  <files>src/agent/types.ts</files>
  <action>
Rename and restructure PendingQuestion:

Before:
```typescript
export interface PendingQuestion {
  question: string;
  options?: Array<{ label: string; description?: string }>;
  multiSelect?: boolean;
}
```

After:
```typescript
export interface QuestionItem {
  id: string;
  question: string;
  options?: Array<{ label: string; description?: string }>;
  multiSelect?: boolean;
}

export interface PendingQuestions {
  questions: QuestionItem[];
}
```

Update AgentManager interface:
- Rename `getPendingQuestion` to `getPendingQuestions`
- Return type: `Promise<PendingQuestions | null>`
  </action>
  <verify>npm run typecheck passes</verify>
  <done>Types updated to array-based questions</done>
</task>

<task type="auto">
  <name>Task 3: Update AgentWaitingEvent payload</name>
  <files>src/events/types.ts</files>
  <action>
Update AgentWaitingEvent payload to use questions array:

Before:
```typescript
export interface AgentWaitingEvent extends DomainEvent {
  type: 'agent:waiting';
  payload: {
    agentId: string;
    name: string;
    taskId: string;
    sessionId: string;
    question: string;
    options?: Array<{ label: string; description?: string }>;
    multiSelect?: boolean;
  };
}
```

After:
```typescript
export interface AgentWaitingEvent extends DomainEvent {
  type: 'agent:waiting';
  payload: {
    agentId: string;
    name: string;
    taskId: string;
    sessionId: string;
    questions: Array<{
      id: string;
      question: string;
      options?: Array<{ label: string; description?: string }>;
      multiSelect?: boolean;
    }>;
  };
}
```
  </action>
  <verify>npm run typecheck passes</verify>
  <done>Event payload uses questions array</done>
</task>

</tasks>

<verification>
Before declaring plan complete:
- [ ] `npm run typecheck` passes
- [ ] `npm run build` succeeds
- [ ] Schema changes are consistent across all three files
</verification>

<success_criteria>

- All tasks completed
- Agent output schema uses `questions` array (not single question)
- PendingQuestions type uses array
- AgentWaitingEvent payload uses questions array
- Each question has `id` field for answer matching
</success_criteria>

<output>
After completion, create `.planning/phases/10-multi-question-schema/10-01-SUMMARY.md`
</output>
