feat(sf): add type-level scaffolding for progressive planning (ADR-011)

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) <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-02 19:10:03 +02:00
parent be4257b411
commit fef2e4b6f4
2 changed files with 8 additions and 0 deletions

View file

@ -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 {

View file

@ -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 {