feat(engine): purge work-unit scratch cache at close + migration 050 backfill#502
Merged
Conversation
…backfill
Work-unit close now removes the unit's .workflows/.cache/{wu}/ scratch
(complete, cancel, and absorb — the absorbed feature's cache goes with
it). Caches are rebuildable per-phase scratch: their only job is
surviving a context refresh mid-phase, and reactivation regenerates
them on demand — the restart paths already rm -rf them today.
Disk-only in the normal case (cache is gitignored via
.workflows/.gitignore since migration 049), with one guard: files
tracked from before 049 exist in old installs, so purgeWorkUnitCache
checks the index and, when residue is tracked, hands the pathspec to
the transaction commit so the deletions land inside it rather than
lingering as dirt.
Migration 050 backfills: purges the caches of already-completed and
already-cancelled work units, and orphan cache dirs whose work unit no
longer exists (absorbed features). In-progress units and unreadable
manifests keep their caches — never delete scratch under live work.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
leeovery
added a commit
that referenced
this pull request
Jul 22, 2026
…eraction in engine.md (#503) * docs(lifecycle): closing a work unit clears its scratch working files The cache purge landed in #502; the lifecycle doc now says so in its own register — scaffolding goes at close, artifacts and history stay, reactivation rebuilds working files on demand. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(engine): the interactive layer is engine-rendered too The v0.6.4 render-surface work in the docs voice: menus, gates, resume notes, and entry blockers come from the deterministic core and are relayed verbatim; state-dependent verdicts are computed at the moment of asking; approved changes are shown as true diffs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Banked from the render-surfaces programme (design log #489, stage-5 notes): the cache-purge-at-close item, now as its own PR.
What
Close purges scratch.
workunit complete,workunit cancel, andworkunit absorb(the absorbed feature's cache) remove.workflows/.cache/{wu}/inside the transaction. Caches are rebuildable per-phase scratch — their job is surviving a context refresh mid-phase; reactivation regenerates them on demand, and the restart paths alreadyrm -rfthem.Disk-only, with one honest guard. Cache is gitignored (
.workflows/.gitignore, migration 049), so the purge is normally pure disk. But gitignore never untracked files committed before 049 — sopurgeWorkUnitCachechecks the index and, when tracked residue exists, hands the pathspec to the transaction commit so the deletions land inside it rather than lingering as dirt outside the.workflows/{wu}scope.Migration 050 backfills existing installs: purges caches of already-
completed/cancelledunits and orphan cache dirs whose unit no longer exists. In-progress units and unreadable manifests keep their caches — unknown state is live state.During investigation we also confirmed (correcting an earlier mis-read): the durable per-cycle analysis/review artifacts live in the phase directory (
.workflows/{wu}/implementation/{topic}/…), not cache — nothing deliberately commits cache; the split is already right.Test plan
git show --name-only); cancel purges; absorb purges the feature's cache.npm test1543/1543 ·npm run test:migrations10/10 · typecheck clean.🤖 Generated with Claude Code