Background
Claude Code v2.1.85 added support for PreToolUse hooks to return updatedInput alongside permissionDecision: "allow", enabling headless integrations that collect answers via their own UI.
Feature
When CC asks a question via AskUserQuestion tool, Aegis should be able to intercept it via the PreToolUse hook and provide an answer programmatically.
API
POST /v1/sessions/:id/answer
{
"questionId": "<tool_use_id>",
"answer": "<user answer text>"
}
Flow
- CC invokes
AskUserQuestion tool
- Aegis PreToolUse hook fires with the question
- Aegis stores the pending question and emits a
ask_question status event (already done)
- External client calls POST /v1/sessions/:id/answer
- Aegis returns
{ permissionDecision: "allow", updatedInput: { answer: "..." } } from the hook
- CC receives the answer and continues
Priority
P1 — This is a key differentiator for headless CC orchestration.
Files
src/hooks.ts — hook handler for PreToolUse with updatedInput
src/server.ts — new endpoint POST /v1/sessions/:id/answer
src/session.ts — pending question tracking
src/events.ts — question event with ID for correlation
Background
Claude Code v2.1.85 added support for
PreToolUsehooks to returnupdatedInputalongsidepermissionDecision: "allow", enabling headless integrations that collect answers via their own UI.Feature
When CC asks a question via
AskUserQuestiontool, Aegis should be able to intercept it via the PreToolUse hook and provide an answer programmatically.API
Flow
AskUserQuestiontoolask_questionstatus event (already done){ permissionDecision: "allow", updatedInput: { answer: "..." } }from the hookPriority
P1 — This is a key differentiator for headless CC orchestration.
Files
src/hooks.ts— hook handler for PreToolUse with updatedInputsrc/server.ts— new endpoint POST /v1/sessions/:id/answersrc/session.ts— pending question trackingsrc/events.ts— question event with ID for correlation