Skip to content

refactor(workflows): make Ralplan and Ultragoal validation compaction-resilient and risk-proportional #4560

Description

@Yeachan-Heo

Problem

The current ralplan -> ultragoal path can apply multiple overlapping LLM review layers to the same plan or frozen change set. Ultragoal already parallelizes independent executor work and its boundary cohort (cleaner || architect || QA), so reviewer-count reduction does not translate linearly into wall-clock gains; however, excessive review still increases token cost, failure surface, and the probability of compaction during long runs.

When compaction happens during a long planning/execution/review loop, the runtime currently preserves only a thin best-effort state projection (active goal objective/status, workflow phase, and open todos) and then emits a generic continuation prompt. The durable Ralplan/Ultragoal contracts contain more precise scope and evidence than this projection. Reconstructing work from a lossy summary can therefore increase scope drift, duplicate review generations, or produce long zero-progress continuation loops.

Maintainer-defined direction

Implement the smallest coherent improvement that follows the repository's existing direction:

  • preserve the recent simplification trajectory: small single-domain/single-PR work should not be forced through Ralplan;
  • retain Ultragoal's executor and boundary-cohort parallelism;
  • make expensive LLM validation proportional to task/change risk rather than unconditional ceremony;
  • avoid duplicate reruns when the reviewed source has not changed;
  • preserve deterministic safety mechanisms (sourceHash, receipts, provenance, join, bounded iteration/recursion);
  • make compaction/recovery consume a durable, structured workflow scope/progress contract instead of relying only on generated summary prose;
  • treat compaction as reloading the current work contract, not reopening product scope;
  • bound zero-progress review/continuation cycles without claiming perfect determinism.

Expected implementation areas

Ralplan

  • Move material intent/scope reconciliation before expensive consensus where possible.
  • Keep Architect/Critic consensus for genuinely ambiguous, cross-domain, cross-cutting, or high-risk plans.
  • Produce a durable structured handoff containing objective, accepted scope, non-goals, acceptance criteria, unresolved decisions, and verification obligations for Ultragoal/compaction recovery.

Ultragoal

  • Keep independent executor work and cleaner || architect || QA concurrency.
  • Introduce explicit, deterministic risk/applicability selection for expensive boundary lanes; do not delegate the decision to free-form model prose.
  • Require rerun only when source/evidence-invalidating state changed.
  • Make terminal critic proportional to aggregate complexity/risk/evidence uncertainty rather than universally duplicating already-joined proof.
  • Persist enough active goal, scope, progress, evidence, and exact-next-action state for compaction recovery.
  • Reject or explicitly classify post-compaction scope expansion instead of silently accepting it.
  • Bound repeated compaction/review generations that produce no measurable progress.

Evidence standard

This is an improvement claim, not a perfect-equivalence claim. Do not require identical outputs or zero scope drift.

Compare baseline and candidate workflows across small, medium/multi-goal, and high-risk fixtures, with no forced compaction, one forced compaction, and repeated forced compaction. Use multiple runs where model behavior is involved.

A successful candidate should demonstrate:

  • ordinary-task success and high-risk defect detection are non-inferior within a predeclared tolerance;
  • reduced reviewer invocations, token use, mean/P95 runtime, and zero-progress generations;
  • improved correct-goal/next-action resumption after compaction;
  • reduced frequency and magnitude of scope drift;
  • preserved high-risk QA, real-surface evidence, sourceHash, receipt, provenance, and join guarantees;
  • no loss of existing executor/cohort parallelism.

Tests must include forced compaction during Ralplan review, Ultragoal implementation, parallel executor work, parallel boundary cohort review, and blocker-fix/re-review.

Delivery constraint

This is a large workflow/architecture change. Present it as one Draft PR targeting dev; do not mark ready or merge without fresh owner direction.

Credit the originating design direction to @HaD0Yun in the commit trailer and Draft PR description.


[repo owner's gaebal-gajae (clawdbot) 🦞]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions