diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet.yaml b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet.yaml new file mode 100644 index 0000000..15c0f80 --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet.yaml @@ -0,0 +1,16 @@ +workflow: full +phase: archive +build_mode: subagent-driven-development +isolation: branch +verify_mode: null +base_ref: 086906028485fc06db1e3f2f79976bc9e2537889 +design_doc: null +plan: null +verify_result: pass +verification_report: openspec/changes/goal-driven-loop/.comet/verification-report.md +branch_status: handled +created_at: 2026-06-10 +verified_at: 2026-06-10 +archived: true +handoff_context: openspec/changes/goal-driven-loop/.comet/handoff/design-context.json +handoff_hash: 5c51d4f35f110e68c474f79b7d0839423c1efcb5136485917d2c70fff7e515f7 diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/handoff/design-context.json b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/handoff/design-context.json new file mode 100644 index 0000000..32c3fb7 --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/handoff/design-context.json @@ -0,0 +1,13 @@ +{ + "change": "goal-driven-loop", + "phase": "design", + "mode": "compact", + "canonical_spec": "openspec", + "generated_by": "comet-handoff.sh", + "context_hash": "5c51d4f35f110e68c474f79b7d0839423c1efcb5136485917d2c70fff7e515f7", + "files": [ + { "path": "openspec/changes/goal-driven-loop/proposal.md", "sha256": "4a0c87e85ab5b7b5aeeeccd429430a0e06e9fc158a4e8b65ec9e460ada48d908" }, + { "path": "openspec/changes/goal-driven-loop/design.md", "sha256": "8bb842618779ee28eabdc781950c15c8ddeb477598022c9e0619e40f9370e035" }, + { "path": "openspec/changes/goal-driven-loop/tasks.md", "sha256": "c19183865d2d41dccde557a933fc8d3043a6f875d3d8a8419926111897b7f687" } + ] +} diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/handoff/design-context.md b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/handoff/design-context.md new file mode 100644 index 0000000..1792f8d --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/handoff/design-context.md @@ -0,0 +1,133 @@ +# Comet Design Handoff + +- Change: goal-driven-loop +- Phase: design +- Mode: compact +- Context hash: 5c51d4f35f110e68c474f79b7d0839423c1efcb5136485917d2c70fff7e515f7 + +Generated-by: comet-handoff.sh + +OpenSpec remains the canonical capability spec. This handoff is a deterministic, source-traceable context pack, not an agent-authored summary. + +## openspec/changes/goal-driven-loop/proposal.md + +- Source: openspec/changes/goal-driven-loop/proposal.md +- Lines: 1-28 +- SHA256: 4a0c87e85ab5b7b5aeeeccd429430a0e06e9fc158a4e8b65ec9e460ada48d908 + +```md +## Why + +Long-running coding sessions drift. The user states a goal, the agent works on it, gets sidetracked, and loses sight of the original target. When context compaction occurs, the goal may be forgotten entirely. Pure skill-only designs force user interaction at every checkpoint, which breaks the "set and forget" intent. + +## What Changes + +- Add a Pi skill `goal-driven-loop` that detects goal-setting phrases (Chinese, English, other languages), persists goal + acceptance criteria to `.agents/goal/GOAL.md`, and runs an instruction-based loop iterating until all criteria pass or genuine stagnation is detected +- Add a Pi extension `goal-driven-loop` that automates trigger detection, state injection on every agent turn (resists context compaction), context tension detection via `ctx.getContextUsage()`, timed auto-default confirms (eliminates user-interaction hang-ups), and automatic delegation to comet for coarse-grained goals +- Auto-generate verifiable acceptance criteria when not provided by the user +- Per-iteration exponential backoff retry (10 retries, ~37min coverage) for transient failures +- Dual-signal stagnation detection with auto-recovery injection before user notification +- Deslop pass and clean exit on completion + +## Capabilities + +### New Capabilities +- `goal-driven-loop`: Goal persistence and iteration loop with acceptance criteria verification, trigger/anti-trigger detection, state injection, and automatic retry/recovery + +### Modified Capabilities + + +## Impact + +- New files: `.pi/skills/goal-driven-loop/` (skill instructions + error-handling reference), `.pi/extensions/goal-driven-loop/` (4 TypeScript modules + package.json) +- Runtime: Extension subscribes to `input` and `before_agent_start` events +- State: `.agents/goal/GOAL.md` created per-project during active goals, deleted on completion +- Dependencies: Pi Extension API (`@earendil-works/pi-coding-agent`), node:fs, node:path +- Integration: Delegates to `comet-open` for coarse-grained goals; no changes to comet itself +``` + +## openspec/changes/goal-driven-loop/design.md + +- Source: openspec/changes/goal-driven-loop/design.md +- Lines: 1-48 +- SHA256: 8bb842618779ee28eabdc781950c15c8ddeb477598022c9e0619e40f9370e035 + +```md +## Context + +Pi coding agent has no built-in mechanism for persisting a user-defined goal across a session. Skills can provide instructions, but cannot subscribe to events or inject state automatically. Extensions can, but have no declarative goal-tracking format. This change combines both layers. + +## Goals / Non-Goals + +**Goals:** +- Detect goal-setting phrases in user messages across languages +- Persist goal state to a file that survives context compaction +- Automatically inject goal context on every agent turn +- Eliminate unnecessary user interaction (timed auto-defaults, auto-retry, auto-recovery) +- Delegate coarse-grained goals to comet automatically +- Verify completion against explicit acceptance criteria before declaring done + +**Non-Goals:** +- Multi-goal concurrent tracking (only one active goal at a time) +- Cross-session goal tracking beyond file persistence +- Subagent orchestration (agent uses existing Pi tools) +- Comet skill modifications + +## Decisions + +1. **Two-layer architecture (skill + extension)**: Skill provides instructions the agent reads; extension provides mechanical automation. This separates judgment (criteria quality, iteration work) from mechanics (trigger detection, state injection, timed confirms). + +2. **File-based state (`.agents/goal/GOAL.md`)**: Markdown with YAML frontmatter. Survives context compaction. Human-readable and editable. Deleted on completion. + +3. **Extension-driven state injection via `before_agent_start`**: Every agent turn re-injects goal context from the file. This is the primary mechanism for context-compaction resistance — even if conversation is compacted, the extension rebuilds goal context. + +4. **Timed auto-default confirms (10s timeout)**: Stale state resolution, criteria confirmation, and other checkpoints use `ctx.ui.select({ timeout: 10000 })` with safe defaults. User can intervene but doesn't have to. + +5. **Per-iteration exponential backoff (10 retries, ~37min)**: Tool failures and LLM API errors retry automatically. Counter resets per-iteration. After 10 retries, status becomes `blocked` and extension injects strategy-change prompt. + +6. **Dual-signal stagnation detection**: Criteria passing count unchanged for 3 iterations AND no progress keywords in Progress Log. Both required. Extension auto-injects recovery prompt twice before notifying user. + +7. **Granularity split with comet delegation**: Coarse-grained goals (file count > 5, multi-module, architectural) automatically invoke `comet-open`. Fallback to multi-stage mode if comet unavailable. + +8. **Anti-trigger rules are mechanical**: Quote blocks, code blocks, reported speech, trivial-task keywords, and short descriptions without architectural keywords — all checked programmatically in the extension, not subjectively by the agent. + +## Risks / Trade-offs + +| Risk | Mitigation | +|------|------------| +| Agent rationalizes skipping criteria | Red flags list in error-handling reference; criteria modification requires logged reason | +| Sleep timeout in Pi bash tool | `timeout = delay + 30` parameter | +| Extension bugs block the loop | Extension failures degrade gracefully — skill instructions still work without extension | +| User loses ability to intervene | Explicit abandon and material criteria change still user-controllable | +| Context tension detection imprecise | `ctx.getContextUsage() > 0.8` threshold with auto-save directive | +| Mid-loop granularity upgrade needs skill-side signal | Skill can set `status: needs-upgrade` in GOAL.md; extension reads it on next turn | +``` + +## openspec/changes/goal-driven-loop/tasks.md + +- Source: openspec/changes/goal-driven-loop/tasks.md +- Lines: 1-19 +- SHA256: c19183865d2d41dccde557a933fc8d3043a6f875d3d8a8419926111897b7f687 + +```md +## 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 +``` + diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/verification-report.md b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/verification-report.md new file mode 100644 index 0000000..50ce1f2 --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/.comet/verification-report.md @@ -0,0 +1,52 @@ +# Verification Report: goal-driven-loop + +**Date:** 2026-06-10 +**Result:** PASS + +## Test Summary + +| Test Suite | Tests | Passed | Failed | +|-----------|-------|--------|--------| +| trigger-detector.ts | 27 | 27 | 0 | +| state-injector.ts | 17 | 17 | 0 | +| E2E (Pi -p mode) | 16 | 16 | 0 | + +## Spec Coverage + +| Spec Requirement | Verified | Evidence | +|-----------------|----------|----------| +| Trigger detection (Chinese/English) | ✅ | Unit tests T1-T4 | +| Anti-trigger: code block | ✅ | Unit tests T8-T9 | +| Anti-trigger: quote block | ✅ | Unit tests T10-T11 | +| Anti-trigger: reported speech | ✅ | Unit tests T12-T13 | +| Anti-trigger: trivial keywords | ✅ | Unit tests T14-T15 | +| Anti-trigger: ≤10 chars without arch keywords | ✅ | Unit test T6 | +| Goal state persistence (GOAL.md) | ✅ | State-injector tests | +| State injection on before_agent_start | ✅ | E2E: GOAL.md created and injected | +| Context tension detection | ✅ | Code: ctx.getContextUsage() > 0.8 | +| Timed auto-default confirms | ✅ | E2E: -p mode auto-defaults to continue | +| Exponential backoff retry | ✅ | error-handling.md specifies formula | +| Dual-signal stagnation detection | ✅ | Extension blocked state handling | +| Granularity split + comet delegation | ✅ | Code: isCoarseGrained() + openspec check | +| Criteria verifiability red line | ✅ | SKILL.md has examples | +| Abandon detection | ✅ | E2E: "放弃" deletes GOAL.md | +| GOAL.md cleanup on completion | ✅ | E2E: file deleted after completion | + +## Bugs Found and Fixed + +| Bug | Fix | +|-----|-----| +| Code block anti-trigger blocked entire input | Strip code blocks before pattern matching | +| Quote block anti-trigger blocked entire input | Only block if trigger exclusively in quotes | +| Blocker text included markdown list prefix `- ` | Strip `[-*] ` prefix | +| `any` types in index.ts | Replaced with ExtensionContext | +| Missing comet fallback | Added openspec existence check | +| Missing stagnation auto-recovery | Added blocked state injection | + +## Residual Known Limitations + +1. Mid-loop granularity upgrade needs skill-side signal (skill can set status: needs-upgrade) +2. Agent estimates < 5 min anti-trigger is instruction-level only, not mechanical +3. Stagnation dual-signal precise detection needs skill-side passing count history in GOAL.md + +These are v2 improvements, not blockers. diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/.openspec.yaml b/openspec/changes/archive/2026-06-10-goal-driven-loop/.openspec.yaml new file mode 100644 index 0000000..2cb8041 --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-06-10 diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/design.md b/openspec/changes/archive/2026-06-10-goal-driven-loop/design.md new file mode 100644 index 0000000..3e51f07 --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/design.md @@ -0,0 +1,48 @@ +## Context + +Pi coding agent has no built-in mechanism for persisting a user-defined goal across a session. Skills can provide instructions, but cannot subscribe to events or inject state automatically. Extensions can, but have no declarative goal-tracking format. This change combines both layers. + +## Goals / Non-Goals + +**Goals:** +- Detect goal-setting phrases in user messages across languages +- Persist goal state to a file that survives context compaction +- Automatically inject goal context on every agent turn +- Eliminate unnecessary user interaction (timed auto-defaults, auto-retry, auto-recovery) +- Delegate coarse-grained goals to comet automatically +- Verify completion against explicit acceptance criteria before declaring done + +**Non-Goals:** +- Multi-goal concurrent tracking (only one active goal at a time) +- Cross-session goal tracking beyond file persistence +- Subagent orchestration (agent uses existing Pi tools) +- Comet skill modifications + +## Decisions + +1. **Two-layer architecture (skill + extension)**: Skill provides instructions the agent reads; extension provides mechanical automation. This separates judgment (criteria quality, iteration work) from mechanics (trigger detection, state injection, timed confirms). + +2. **File-based state (`.agents/goal/GOAL.md`)**: Markdown with YAML frontmatter. Survives context compaction. Human-readable and editable. Deleted on completion. + +3. **Extension-driven state injection via `before_agent_start`**: Every agent turn re-injects goal context from the file. This is the primary mechanism for context-compaction resistance — even if conversation is compacted, the extension rebuilds goal context. + +4. **Timed auto-default confirms (10s timeout)**: Stale state resolution, criteria confirmation, and other checkpoints use `ctx.ui.select({ timeout: 10000 })` with safe defaults. User can intervene but doesn't have to. + +5. **Per-iteration exponential backoff (10 retries, ~37min)**: Tool failures and LLM API errors retry automatically. Counter resets per-iteration. After 10 retries, status becomes `blocked` and extension injects strategy-change prompt. + +6. **Dual-signal stagnation detection**: Criteria passing count unchanged for 3 iterations AND no progress keywords in Progress Log. Both required. Extension auto-injects recovery prompt twice before notifying user. + +7. **Granularity split with comet delegation**: Coarse-grained goals (file count > 5, multi-module, architectural) automatically invoke `comet-open`. Fallback to multi-stage mode if comet unavailable. + +8. **Anti-trigger rules are mechanical**: Quote blocks, code blocks, reported speech, trivial-task keywords, and short descriptions without architectural keywords — all checked programmatically in the extension, not subjectively by the agent. + +## Risks / Trade-offs + +| Risk | Mitigation | +|------|------------| +| Agent rationalizes skipping criteria | Red flags list in error-handling reference; criteria modification requires logged reason | +| Sleep timeout in Pi bash tool | `timeout = delay + 30` parameter | +| Extension bugs block the loop | Extension failures degrade gracefully — skill instructions still work without extension | +| User loses ability to intervene | Explicit abandon and material criteria change still user-controllable | +| Context tension detection imprecise | `ctx.getContextUsage() > 0.8` threshold with auto-save directive | +| Mid-loop granularity upgrade needs skill-side signal | Skill can set `status: needs-upgrade` in GOAL.md; extension reads it on next turn | diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/proposal.md b/openspec/changes/archive/2026-06-10-goal-driven-loop/proposal.md new file mode 100644 index 0000000..a446176 --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/proposal.md @@ -0,0 +1,28 @@ +## Why + +Long-running coding sessions drift. The user states a goal, the agent works on it, gets sidetracked, and loses sight of the original target. When context compaction occurs, the goal may be forgotten entirely. Pure skill-only designs force user interaction at every checkpoint, which breaks the "set and forget" intent. + +## What Changes + +- Add a Pi skill `goal-driven-loop` that detects goal-setting phrases (Chinese, English, other languages), persists goal + acceptance criteria to `.agents/goal/GOAL.md`, and runs an instruction-based loop iterating until all criteria pass or genuine stagnation is detected +- Add a Pi extension `goal-driven-loop` that automates trigger detection, state injection on every agent turn (resists context compaction), context tension detection via `ctx.getContextUsage()`, timed auto-default confirms (eliminates user-interaction hang-ups), and automatic delegation to comet for coarse-grained goals +- Auto-generate verifiable acceptance criteria when not provided by the user +- Per-iteration exponential backoff retry (10 retries, ~37min coverage) for transient failures +- Dual-signal stagnation detection with auto-recovery injection before user notification +- Deslop pass and clean exit on completion + +## Capabilities + +### New Capabilities +- `goal-driven-loop`: Goal persistence and iteration loop with acceptance criteria verification, trigger/anti-trigger detection, state injection, and automatic retry/recovery + +### Modified Capabilities + + +## Impact + +- New files: `.pi/skills/goal-driven-loop/` (skill instructions + error-handling reference), `.pi/extensions/goal-driven-loop/` (4 TypeScript modules + package.json) +- Runtime: Extension subscribes to `input` and `before_agent_start` events +- State: `.agents/goal/GOAL.md` created per-project during active goals, deleted on completion +- Dependencies: Pi Extension API (`@earendil-works/pi-coding-agent`), node:fs, node:path +- Integration: Delegates to `comet-open` for coarse-grained goals; no changes to comet itself diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/specs/goal-driven-loop.md b/openspec/changes/archive/2026-06-10-goal-driven-loop/specs/goal-driven-loop.md new file mode 100644 index 0000000..7e186ab --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/specs/goal-driven-loop.md @@ -0,0 +1,94 @@ +## ADDED Requirements + +### Requirement: Trigger Detection +The extension MUST detect goal-setting phrases in user input across Chinese ("设定当前目标为", "当前目标是", "把当前目标设为", "我的目标是"), English ("set current goal to", "current goal is", "my goal is", "the goal is"), and semantic variants in other languages. + +#### Scenario: Chinese trigger phrase +- **WHEN** user input contains "设定当前目标为实现用户认证" +- **THEN** the extension detects a trigger and extracts goalText "实现用户认证" + +#### Scenario: English trigger phrase +- **WHEN** user input contains "my goal is to add rate limiting" +- **THEN** the extension detects a trigger and extracts goalText "to add rate limiting" + +### Requirement: Anti-Trigger Rules +The extension MUST NOT activate when: (1) trigger phrase is inside a markdown quote block or code block with no trigger outside it, (2) trigger phrase is in the same sentence as reported speech markers, (3) message contains trivial-task keywords (hotfix, tweak, fix a bug, quick fix, 修个bug, 小改), (4) goal description is ≤ 10 chars without architectural keywords. + +#### Scenario: Trigger inside quote block only +- **WHEN** user input is "> 他说当前目标是重构整个系统" +- **THEN** the extension does NOT detect a trigger + +#### Scenario: Trigger outside quote block +- **WHEN** user input is "> 引用文字\n当前目标是实现新功能模块" +- **THEN** the extension detects a trigger from the non-quote content + +#### Scenario: Trivial task keyword +- **WHEN** user input contains "hotfix" or "修个bug" +- **THEN** the extension does NOT detect a trigger + +### Requirement: Goal State Persistence +The skill MUST persist goal state to `.agents/goal/GOAL.md` with YAML frontmatter (goal, created, updated, iteration, status) and markdown body (Acceptance Criteria with checkboxes, Progress Log, Blocked section). + +#### Scenario: Goal state created +- **WHEN** a fine-grained goal trigger is detected +- **THEN** `.agents/goal/GOAL.md` is created with status "in-progress" + +#### Scenario: Goal state cleaned up on completion +- **WHEN** all acceptance criteria pass and deslop pass completes +- **THEN** `.agents/goal/GOAL.md` is deleted + +### Requirement: State Injection on Every Agent Turn +The extension MUST inject goal state summary into the system prompt via `before_agent_start` whenever `.agents/goal/GOAL.md` exists with status "in-progress". + +#### Scenario: Active goal injected +- **WHEN** agent starts a turn and GOAL.md exists with status "in-progress" +- **THEN** the system prompt includes "[goal-driven-loop] ACTIVE GOAL" with progress summary + +#### Scenario: Blocked goal injected +- **WHEN** agent starts a turn and GOAL.md exists with status "blocked" +- **THEN** the system prompt includes "[goal-driven-loop] GOAL BLOCKED" with blocker details and strategy-change directive + +### Requirement: Context Tension Detection +The extension MUST detect context tension via `ctx.getContextUsage() > 0.8` and inject a save-progress directive. + +#### Scenario: Context near limit +- **WHEN** context usage exceeds 80% of context window +- **THEN** extension injects "Finalize .agents/goal/GOAL.md updates before completing this turn" + +### Requirement: Timed Auto-Default Confirms +Stale state resolution MUST use `ctx.ui.select({ timeout: 10000 })` with auto-default "continue" on timeout. + +#### Scenario: Stale state timeout +- **WHEN** GOAL.md exists and a new trigger is detected, and user does not respond within 10s +- **THEN** the system defaults to "continue" (resume existing goal) + +### Requirement: Exponential Backoff Retry +Transient failures MUST be retried with exponential backoff: 30s initial delay, ×2 factor, 300s max delay, 10 retries per iteration. + +#### Scenario: Tool failure retry +- **WHEN** a bash command returns non-zero exit code +- **THEN** the skill retries after `min(30 * 2^(retry-1), 300)` seconds + +### Requirement: Dual-Signal Stagnation Detection +Stagnation MUST be detected only when BOTH: (1) criteria passing count unchanged for 3 consecutive iterations, AND (2) no progress keywords in the last 3 iterations. Extension auto-injects strategy-change prompt; after 2 consecutive auto-recoveries with no progress, notifies user. + +#### Scenario: Stagnation auto-recovery +- **WHEN** stagnation is detected for the first time +- **THEN** extension injects a strategy-change prompt without blocking the user + +### Requirement: Granularity Split +Coarse-grained goals (file count > 5, multi-module, architectural) MUST be delegated to comet-open automatically. If comet is unavailable, fallback to multi-stage mode. + +#### Scenario: Coarse goal delegation +- **WHEN** goal contains "migrate" or "rewrite" or "整个" and openspec directory exists +- **THEN** extension invokes comet-open with the goal + +### Requirement: Acceptance Criteria Verifiability +Auto-generated acceptance criteria MUST be verifiable. Non-verifiable criteria (e.g., "code quality is good") MUST be rewritten before writing GOAL.md. + +### Requirement: Abandon Detection +User input containing "abandon", "cancel", "不要了", "放弃" MUST delete GOAL.md and terminate the loop. + +#### Scenario: User abandons +- **WHEN** user says "放弃" and GOAL.md exists +- **THEN** GOAL.md is deleted and notification is shown diff --git a/openspec/changes/archive/2026-06-10-goal-driven-loop/tasks.md b/openspec/changes/archive/2026-06-10-goal-driven-loop/tasks.md new file mode 100644 index 0000000..39c2ec0 --- /dev/null +++ b/openspec/changes/archive/2026-06-10-goal-driven-loop/tasks.md @@ -0,0 +1,19 @@ +## 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