---
phase: 10-multi-question-schema
plan: 02
type: execute
wave: 2
depends_on: ["10-01"]
files_modified:
  - src/agent/manager.ts
  - src/agent/mock-manager.ts
autonomous: true
---

<objective>
Update ClaudeAgentManager and MockAgentManager to handle questions array and batched answers.

Purpose: Implementations must match the updated schema and types from Plan 01.
Output: Both managers handle multi-question flow with batched resume answers.
</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/phases/10-multi-question-schema/10-01-SUMMARY.md

@src/agent/schema.ts
@src/agent/types.ts
@src/agent/manager.ts
@src/agent/mock-manager.ts
</context>

<tasks>

<task type="auto">
  <name>Task 1: Update ClaudeAgentManager for questions array</name>
  <files>src/agent/manager.ts</files>
  <action>
Update handleAgentCompletion to handle 'questions' status (was 'question'):

1. In switch statement, rename case 'question' to case 'questions'
2. Store pendingQuestions (plural) with the full questions array:
```typescript
case 'questions': {
  if (active) {
    active.pendingQuestions = {
      questions: agentOutput.questions,
    };
  }
  // ... emit event with questions array
}
```

3. Update ActiveAgent interface:
```typescript
interface ActiveAgent {
  subprocess: ResultPromise;
  result?: AgentResult;
  pendingQuestions?: PendingQuestions;  // was pendingQuestion
}
```

4. Rename getPendingQuestion to getPendingQuestions, return pendingQuestions

5. Update resume() signature to accept answers map:
```typescript
async resume(agentId: string, answers: Record<string, string>): Promise<void>
```
The answers map keys are question IDs, values are the user's answers.
Format answers as structured prompt for Claude: one line per answer.
  </action>
  <verify>npm run typecheck passes</verify>
  <done>ClaudeAgentManager handles questions array and batched answers</done>
</task>

<task type="auto">
  <name>Task 2: Update MockAgentManager for questions array</name>
  <files>src/agent/mock-manager.ts</files>
  <action>
1. Update MockAgentScenario type:
```typescript
| {
    status: 'questions';  // was 'question'
    questions: Array<{
      id: string;
      question: string;
      options?: Array<{ label: string; description?: string }>;
      multiSelect?: boolean;
    }>;
    delay?: number;
  }
```

2. Update MockAgentRecord interface:
```typescript
pendingQuestions?: PendingQuestions;  // was pendingQuestion
```

3. Update completeAgent() switch case from 'question' to 'questions':
```typescript
case 'questions':
  record.info.status = 'waiting_for_input';
  record.pendingQuestions = {
    questions: scenario.questions,
  };
  // emit event with questions array
```

4. Rename getPendingQuestion to getPendingQuestions

5. Update resume() signature:
```typescript
async resume(agentId: string, answers: Record<string, string>): Promise<void>
```
Clear pendingQuestions on resume.
  </action>
  <verify>npm run typecheck passes</verify>
  <done>MockAgentManager handles questions array and batched answers</done>
</task>

</tasks>

<verification>
Before declaring plan complete:
- [ ] `npm run typecheck` passes
- [ ] `npm run build` succeeds
- [ ] Both managers use questions array consistently
- [ ] resume() accepts answers map on both managers
</verification>

<success_criteria>

- All tasks completed
- ClaudeAgentManager handles 'questions' status
- MockAgentManager handles 'questions' status
- Both resume() methods accept Record<string, string> answers
- getPendingQuestions returns array-based type
</success_criteria>

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