Skip to content

feat(control-plane): v2 Phase 2 — plan ledger with oracle-owned pass flags (WS-B) - #108

Open
SamPlvs wants to merge 1 commit into
mainfrom
claude/v2-phase2-control-plane
Open

feat(control-plane): v2 Phase 2 — plan ledger with oracle-owned pass flags (WS-B)#108
SamPlvs wants to merge 1 commit into
mainfrom
claude/v2-phase2-control-plane

Conversation

@SamPlvs

@SamPlvs SamPlvs commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 2 of the v2 rearchitecture (plan: plans/zo-v2-rearchitecture.md, gate: oracle checks 8–10). ralph's task-ledger idea with its fatal flaw fixed by composition with Phase 1's enforcement plane: "what is done" becomes a query, and only the oracle can say so.

Piece Mechanism
Plan ledger plan-ledger.json in the project memory root: per-subtask entries with synthesized acceptance criteria (artifact existence; oracle threshold for phase_4), passes/attempts/last_failure, phase_status map. Merge-preserving regeneration, atomic writes.
Oracle-owned flips mark_phase_passed fires only from the automated gate's verified path and nonce-verified human PROCEED. ITERATE / loop-CONTINUE reset with the reason. mark_subtask_complete counts attempts but cannot set passes. Ledger sealed via WS-A4 — builder Write/Edit is denied by hook.
Sizing lint Optional ## Stories plan section; validate_plan rejects stories lacking a machine-verifiable criterion (threshold / artifact path / backticked command). Surfaces through preflight + zo validate. Legacy plans untouched.
Ledger-first status zo status renders the control plane (per-phase status, pass counts, attempts, last failure); STATE.md remains the human projection + legacy fallback.

Phase-1 hardenings (recon findings)

  • contracts.set_active_phase was non-atomic — a torn read would silently disable contract enforcement. Now temp+rename.
  • The wrapper never exported hook env for delivery sessions — zo build now passes ZO_MEMORY_ROOT/ZO_DELIVERY_ROOT/ZO_CONTRACTS_PATH, closing the per-project sealing gap.

Deliberate deferrals (documented in DECISION_LOG)

evaluate_loop_state keeps its ExperimentRegistry input and session-restore still reads STATE.md — both ride Phase 3's fresh-context substrate rework (the latter protects the PR-036 GATED-precedence resume fix).

Verification

  • 908 → 929 passed / 7 skipped (+21: 13 ledger, 5 stories/lint, 2 nonce-flip integration, 1 ledger-first status)
  • Seeded tests for the gate: builder ledger-write denied while the oracle flip lands (check 9); vague story rejected (check 10); zo status renders from the ledger over stale STATE prose (check 8)
  • ruff src/ clean · validate-docs green

🤖 Generated with Claude Code

…flags (WS-B)

Implements plans/zo-v2-rearchitecture.md Phase 2 (oracle checks 8-10):

- src/zo/ledger.py: plan-ledger.json in the project memory root — one
  entry per (phase, subtask) with synthesized acceptance criteria
  (artifact existence; oracle threshold for phase_4), passes/attempts/
  last_failure, and a phase_status map. Merge-preserving regeneration;
  every write atomic (temp + os.replace).
- Oracle-owned flips: mark_phase_passed called ONLY from the automated
  gate's verified path and nonce-verified human PROCEED; ITERATE and
  loop-CONTINUE reset with reason; mark_subtask_complete counts attempts
  but cannot set passes; plan-ledger.json added to _SEALED_DEFAULTS so
  builder Write/Edit is denied by the WS-A4 hook (check 9).
- Story sizing lint: optional '## Stories' section (StorySpec parser);
  validate_plan rejects stories without a machine-verifiable criterion
  (threshold / artifact path / `command`) — surfaces via preflight and
  zo validate; legacy plans without Stories untouched (check 10).
- zo status renders the control plane from the ledger (per-phase status,
  pass counts, attempts, last failure); STATE.md stays the human
  projection and legacy fallback (check 8).
- Phase-1 hardenings (recon findings): contracts.set_active_phase now
  atomic; zo build exports ZO_MEMORY_ROOT/ZO_DELIVERY_ROOT/
  ZO_CONTRACTS_PATH so per-project sealing works in delivery sessions.

Deferred to Phase 3 (documented in DECISION_LOG): evaluate_loop_state
ledger input; session-restore cutover (protects the PR-036 fix).

Tests: 908 -> 929 passed / 7 skipped. ruff src/ clean. validate-docs green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying zero-operators with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6a3e96f
Status: ✅  Deploy successful!
Preview URL: https://55519c64.zero-operators.pages.dev
Branch Preview URL: https://claude-v2-phase2-control-pla.zero-operators.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant