autoresearch: tidy-up helper to pause and resume a campaign - #76
Merged
Merged
Conversation
Add references/tidy-up.md and helpers/tidy_attempts.py. The helper inventories every attempt worktree/branch, decides keep/drop/ask by rule, packs kept attempts onto their own branches (build artifacts ignored, pushed when a remote exists, worktree removed), deletes empty ones, and writes research/ATTEMPTS.md with each attempt's hypothesis, validator outcome, and disposition. Only genuinely uncertain rows are batched into one question at the end. The stage is unchanged so the campaign resumes from the soft gate; STATE.md gains an optional last_tidy date. Closes #66 Co-Authored-By: Claude Fable 5.1 <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.
Resolves #66 as a pause, not an end state.
What it does
references/tidy-up.md+helpers/tidy_attempts.py, entered from the dispatcher on "tidy / pause / close" or offered when the user answers 0 at a soft gate.inventory(read-only) lists everyattempt-NNNworktree/branch with LOG.md hypothesis, validator status/score, uncommitted work, detected build artifacts, and push state, and decides per attempt: keep (has LOG.md, report.json, or code changes), drop (empty worktree), ask (changes but no LOG.md, or a >10 MB untracked file that matches no artifact pattern). Terminal output is counts plus the ask rows only; the full table goes to a JSON snapshot.applydoes the git work in bulk: ignores artifacts, commits each kept worktree on its own branch, pushes when a remote exists, removes the worktree directory; deletes dropped worktrees and branches; leaves ask rows alone until a second pass with--drop/--keep. Re-running on the same snapshot is safe.recordwritesresearch/ATTEMPTS.md: STATE.md position, one row per attempt (kind, parent, status, score, branch, disposition pushed / local only / dropped, hypothesis, dropped rows kept from the snapshot), a local-only warning when there is no remote, and how to resume.No new stage.
STATE.mdgains an optionallast_tidy:date.attempt-protocol.mdnow says worktrees stay until a tidy-up;run.md's soft gate offers the tidy-up on 0.Verification
tests/test_tidy_attempts.pybuilds a fixture repo with four worktrees (scored with an artifact and an uncommitted edit; validator error; code without LOG.md; empty), with and without a bare remote. It checks classification, the commit/ignore/push/remove behaviour, the untouched ask row, the idempotent second pass, the record contents including the dropped row and local-only warning, and the CLI summary.🤖 Generated with Claude Code