From fef2e4b6f44f38210896465b17c321a19ed0e05b Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Sat, 2 May 2026 19:10:03 +0200 Subject: [PATCH] feat(sf): add type-level scaffolding for progressive planning (ADR-011) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three additive type changes that prepare SF to wire refine-slice through the state machine. Pure type-level — no runtime behavior change yet: 1. types.ts:14 — Phase union gains "refining" between "planning" and "evaluating-gates". State derivation will yield this when a slice has is_sketch=1 AND phases.progressive_planning=true. 2. types.ts:354 — PhaseSkipPreferences.progressive_planning?: boolean. Off by default; turning it on enables sketch→refine flow. 3. sf-db.ts:2321 — SliceRow.is_sketch?: number. Column DDL not yet added; this just lets the type compile when migration lands. This is the smallest forward step toward closing the refine-slice gap identified by sf-moojsmkg-72k3ei. Next steps (separate PRs): - DB migration: ALTER TABLE slices ADD COLUMN is_sketch INTEGER NOT NULL DEFAULT 0 (mirroring gsd-2 sf-db.ts:381,1074) - state.ts: derivation rule emit phase="refining" when sketch+flag - auto-dispatch.ts: "refining → refine-slice" rule + import buildRefineSlicePrompt - Tests: progressive-planning.test.ts equivalent Existing buildRefineSlicePrompt + prompts/refine-slice.md already in place — only the FSM path is missing. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/resources/extensions/sf/sf-db.ts | 3 +++ src/resources/extensions/sf/types.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/resources/extensions/sf/sf-db.ts b/src/resources/extensions/sf/sf-db.ts index dc64e23f0..1c7fe8a9a 100644 --- a/src/resources/extensions/sf/sf-db.ts +++ b/src/resources/extensions/sf/sf-db.ts @@ -2317,6 +2317,9 @@ export interface SliceRow { replan_triggered_at: string | null; /** Optional freeform scope sketch written at plan-slice time. */ sketch_scope?: string | null; + /** ADR-011: 1 = slice is a sketch awaiting refinement, 0 = full plan. Column may be absent on + * pre-migration installs (gated by phases.progressive_planning preference). */ + is_sketch?: number; } function parsePlanningMeeting(raw: unknown): PlanningMeetingRecord | null { diff --git a/src/resources/extensions/sf/types.ts b/src/resources/extensions/sf/types.ts index 41c72f812..c81aa2676 100644 --- a/src/resources/extensions/sf/types.ts +++ b/src/resources/extensions/sf/types.ts @@ -11,6 +11,7 @@ export type Phase = | "discussing" | "researching" | "planning" + | "refining" | "evaluating-gates" | "executing" | "verifying" @@ -349,6 +350,10 @@ export interface PhaseSkipPreferences { require_slice_discussion?: boolean; /** ADR-011 Phase 2: when true, mid-execution escalation overrides are injected into the execute-task prompt. */ mid_execution_escalation?: boolean; + /** ADR-011: when true, sketch slices (slices.is_sketch=1) enter the "refining" phase + * and dispatch through refine-slice instead of plan-slice. When false (default), sketches + * are indistinguishable from missing plans and fall through to the normal "planning" phase. */ + progressive_planning?: boolean; } export interface NotificationPreferences {