## Tasks - [x] Create skill directory structure (`.pi/skills/goal-driven-loop/`) - [x] Write `SKILL.md` (≤500 words, Agent Skills standard compliant) - [x] Write `references/error-handling.md` (retry strategy, exception classification, stagnation rules, red flags) - [x] Create extension directory (`.pi/extensions/goal-driven-loop/`) - [x] Write `trigger-detector.ts` (trigger phrase matching + anti-trigger logic) - [x] Write `state-injector.ts` (GOAL.md parsing + injection text generation) - [x] Write `ui-prompts.ts` (timed auto-default confirms + notification helpers) - [x] Write `index.ts` (event wiring: input, before_agent_start) - [x] Add `package.json` for extension discovery - [x] Fix code block anti-trigger (strip code blocks before pattern matching) - [x] Fix quote block anti-trigger (only block if trigger exclusively in quotes) - [x] Fix blocker parsing (strip markdown list prefix) - [x] Add stagnation auto-recovery injection in extension - [x] Add comet fallback when openspec unavailable - [x] Replace `any` types with `ExtensionContext` - [x] Unit tests: 27/27 trigger-detector, 17/17 state-injector - [x] E2E tests: trigger, anti-trigger, abandon, stale state, state injection