Skip to content

Kiro Hooks

Hooks live under upstream .kiro/hooks/*.kiro.hook using the IDE schema (enabled / when / then). Do not use the CLI 3.0 version: v1 + hooks[] wrapper — the Agent Hooks panel will not list those files.

Filewhen.typeBehavior
pr-readiness-coach.kiro.hookfileEdited (*.ts / *.tsx / *.js / *.mjs)Heuristic-only npm run hook, 30s
pr-readiness-full.kiro.hookuserTriggeredFull Bedrock (PR_READY_HOOK_LOCAL=0), 120s — use play in Agent Hooks
build-on-stop.kiro.hookagentStopnpm run build after agent turn
test-after-task.kiro.hookpostTaskExecutionnpm test after a spec task completes

src/hook/kiro-hook.ts always exits 0 (warn-only). It prints a human report; if the verdict is not READY, it reminds that analysis is warn-only. On timeout or error it prints “Analysis skipped; push proceeding” and still exits 0.

Local feedback on save (and on demand) without blocking merges; reuses the core module shared with CLI and Lambda. Full Bedrock stays on the slower userTriggered / CLI path so save stays under 30s — the full pipeline often exceeds that budget.

VariableRole
PR_READY_HOOK_LOCAL unset or not 0Default save path — local heuristics only
PR_READY_HOOK_LOCAL=0Full Bedrock profile
PR_READY_HOOK_TIMEOUT_MS=120000Timeout for the full profile (120s)
AWS_PROFILE / AWS_REGIONRequired for full mode; must be visible to the Kiro process

Hook runtime uses local tsx (project engines / Lambda use Node.js 24.x).

Terminal window
# Same as fileEdited default
npm run hook
# Same as userTriggered full profile (needs Bedrock credentials)
export AWS_PROFILE=<your-profile>
export AWS_REGION=<your-region>
aws sso login --profile "$AWS_PROFILE"
PR_READY_HOOK_LOCAL=0 PR_READY_HOOK_TIMEOUT_MS=120000 npm run hook
  • Keep fileEdited on heuristics — full Bedrock on save will miss the 30s ceiling
  • Hook must never hard-fail the editor workflow (always exit 0)
  • Do not claim Kiro runs inside GitHub Actions
  • CLI 3.0 hook JSON (trigger / action / hooks[]) is invisible in the IDE Agent Hooks panel
  • testPathAllowlist in ready.yml keeps fixture secrets under tests/** from failing the hook

Agent Hooks panel — Run Command Hook / PR Readiness Coach (Full):

Kiro Agent Hooks panel listing PR Readiness Coach hooks

Full-mode hook run (PR_READY_HOOK_LOCAL=0) returning READY with draft PR title/body:

Kiro or CLI full-mode hook run showing READY verdict