Repository navigation
Description
Refs #3465
Agent Brief
Type: Feature
Summary: Build the sweep-ledger machinery so the fetch ceiling, the response cache and the closure ledger are scoped to a sweep and survive an interrupted, resumed sweep.
Current behavior:
The report-only sweep's first run measured all three resume-semantics claims in #3465 as not implemented. The source-fetch reference scopes corpus_fetch_ceiling to "the run". The response cache lives in the run's memory slice. The closure ledger records closures and guard outcomes only, not spend or cache. The skill body states that no ledger script exists. The ledger is meant to be checkout-local under the gitignored .work/ directory, but no script references that directory, so nothing enforces it.
Desired behavior:
A sweep has an identity. The fetch ceiling counts spend across every invocation of that sweep, and the spend is recorded in the ledger. The response cache is scoped to the sweep, recorded in the ledger, and reused on resume only when still valid, never silently stale. Closed files are not re-decided on resume. The ledger is checkout-local: a sweep resumed in a different checkout is a new sweep, and the docs and the script say so. Exhausting the ceiling is reported as a neutral outcome, not an acquittal.
Key interfaces:
- A deterministic, tested script (shell or Python per the plugin's existing convention, Python linted through the pinned ruff wrapper) that creates, reads and updates the ledger: open sweep, record closure, record fetch spend, record cache entry, report closure count.
- The ledger's on-disk shape: sweep id, per-sweep spend against
corpus_fetch_ceiling, cache entries with a validity rule, closed-file records. - The source-fetch reference, the dispositions reference and the skill body, updated so their scoping language matches the built behavior.
Acceptance criteria:
- A test opens a sweep, spends part of the ceiling, simulates interruption, resumes, and shows the spend carried over rather than reset.
- A test shows a closed file is skipped on resume and the closure count is read from the ledger.
- A test shows a stale or mismatched cache entry is not reused.
- A test shows a ledger from another checkout is not resumed as the same sweep.
- The ledger lives under the ignored
.work/path and no tracked file is written. - Docs no longer say the ledger has no script, and state the checkout-local rule.
- The plugin's test suite passes; lint runs through the pinned ruff wrapper.
Out of scope:
- Running the sweep, applying dispositions, the convention engagement and the CI gate (blocked in provenance sweep sub-topic: repo-wide sweep, upstream-drift convention engagement, and the cleaned-state gate #3465 until a class reaches
min_n_per_class10). - The searched-surfaces mechanical floor.
- Editing provenance sweep sub-topic: repo-wide sweep, upstream-drift convention engagement, and the cleaned-state gate #3465's body or labels.
Activity