P08: Classify repository hygiene without destructive cleanup
Choose the commands you use
Operating system
CodeArbiter host
Know before you begin
P08 is a public guided and runnable Academy lesson in this preview. Its shared action cards are the public course route.
Complete P07 and begin in the prepared Academy clone. The website is the primary lesson surface. Academy CLI is limited to Prepare, Check, and Reset. Use Git and the selected host for the work between those transitions.
Keep the repository root open in a native terminal and in your chosen harness. A native-terminal command is entered directly and has no !. A harness shell command begins with exactly one !. Harness text is a request you type to the agent, not a shell command. An agent-owned CodeArbiter command belongs to the harness and has no !. The action cards label each case.
This lab authorizes observation, classification, a report draft, learner review, and a bounded commit. It never authorizes deleting a branch, removing a worktree, pruning metadata, rewriting history, or force operations.
What you will prove
You will preserve a complete inventory of the prepared live refs and worktrees. For each prepared ref, the report records its full ref name, object ID, worktree state, merge containment relative to main, unique commit count, classification, and recommendation. For each prepared worktree, it records the path-free prepared identity, branch binding, head binding, presence, dirtiness, classification, and recommendation.
The expected classifications are conservative. The current attempt, dirty unmerged state, and unmerged unique history remain preserve. The clean merged fixture is only eligible-for-explicit-review; it is not a deletion instruction. The agent drafts the report; you review it before the bounded commit gate runs.
Prepare safely
P07 ends on its preserved attempt branch. Return to clean main before P08 Prepare; the completed P07 evidence stays reachable and is not part of the new attempt.
Return to main before preparing P08
After P07 passes, return to main in a native terminal and confirm the worktree is clean before preparing P08. Leave the completed P07 attempt branch intact.
Academy Prepare starts only from the clean base branch, while the completed P07 attempt remains available for inspection.
You · Native terminal · Windows
git switch main
git status --short
You · Native terminal · macOS
git switch main
git status --short
You · Native terminal · Linux
git switch main
git status --short
The primary checkout is on clean main and the completed P07 attempt remains reachable.
If Git refuses to switch or status prints a path, preserve the message and completed attempt. Do not force a switch, reset, rebase, delete the attempt branch, or hide the change.
The current branch is main and Git prints no worktree changes before P08 Prepare.
Prepare the live hygiene fixture
Run the installed Academy Prepare command from the clean learner checkout. Use the attempt number Academy prints; do not type a placeholder branch name.
Prepare creates the externally recorded fixture and a numbered attempt without precomputing the learner report.
You · Native terminal · Windows
$academy = "$env:LOCALAPPDATA\ArbiterAcademy\preview-0.30\Scripts\arbiter-academy.exe"
& $academy --repository (Get-Location).Path prepare P08-repository-hygiene
You · Native terminal · macOS
academy="${XDG_DATA_HOME:-$HOME/.local/share}/arbiter-academy/preview-0.30/bin/arbiter-academy"
"$academy" --repository "$PWD" prepare P08-repository-hygiene
You · Native terminal · Linux
academy="${XDG_DATA_HOME:-$HOME/.local/share}/arbiter-academy/preview-0.30/bin/arbiter-academy"
"$academy" --repository "$PWD" prepare P08-repository-hygiene
Academy creates and switches to academy/P08-repository-hygiene/<attempt> and reports the prepared fixture.
If Prepare refuses, preserve its message and return to the documented dirty-state or existing-attempt recovery before retrying.
The numbered branch is the only branch where P08 evidence may be committed.
Preparation creates the numbered attempt, live fixture refs, and linked worktrees. It does not give you a precomputed inventory. Stay on the numbered attempt until Check passes or Reset preserves it for a retry.
Freeze a native-terminal inventory
Record the complete local-head ref view and the porcelain worktree view before asking for a classification.
A complete observation prevents a report from silently omitting a prepared ref or worktree.
You · Native terminal · Windows
git for-each-ref --format='%(refname) %(objectname)' refs/heads
git worktree list --porcelain
You · Native terminal · macOS
git for-each-ref --format='%(refname) %(objectname)' refs/heads
git worktree list --porcelain
You · Native terminal · Linux
git for-each-ref --format='%(refname) %(objectname)' refs/heads
git worktree list --porcelain
Git prints every local branch ref with its object ID and every registered worktree with its branch or HEAD binding.
If either command says this is not a repository, stop and return to the prepared learner checkout. Do not invent an inventory.
The observed sets are the source for the draft report and later learner review.
Inspect through a harness shell
Use this only when running the same Git inspection from the selected harness shell. The leading exclamation mark belongs only to the shell command.
The harness shell is a distinct execution surface from a native terminal and from CodeArbiter commands.
You · Claude Code harness · Windows
!git for-each-ref --format='%(refname) %(objectname)' refs/heads; git worktree list --porcelain
You · Claude Code harness · macOS
!git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
You · Claude Code harness · Linux
!git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
You · Codex harness · Windows
!git for-each-ref --format='%(refname) %(objectname)' refs/heads; git worktree list --porcelain
You · Codex harness · macOS
!git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
You · Codex harness · Linux
!git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
You · Pi harness · Windows
!git for-each-ref --format='%(refname) %(objectname)' refs/heads; git worktree list --porcelain
You · Pi harness · macOS
!git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
You · Pi harness · Linux
!git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
The harness returns the same complete ref and worktree inventory that a native-terminal command would return.
If the harness cannot run its shell, use the native-terminal inventory action instead. Do not use a CodeArbiter command as a shell substitute.
The leading exclamation mark identifies this as a harness shell command, not an agent command.
The two inventory actions show the same Git evidence on different surfaces. Use one surface for the actual inventory. Do not merge partial output from memory or from a previous attempt.
Practice
Ask the agent to classify, not clean up
Run the agent-owned CodeArbiter standup command. It begins with git fetch, which may refresh remote-tracking refs. Decline every proposed mutation, including an offered --ff-only pull and every cleanup action; limit the result to inventory and classification advice.
Standup can organize evidence but does not grant authority to discard live repository state.
Your agent · Claude Code harness · All operating systems
/ca:standup
Your agent · Codex harness · All operating systems
$ca-standup
Your agent · Pi harness · All operating systems
/ca-standup
Your agent · Pi harness · All operating systems
/skill:ca-standup
The agent refreshes remote-tracking information, then presents current repository state for review without pulling, deleting, pruning, or rewriting any prepared local branch ref or worktree.
If the response offers an --ff-only pull or cleanup, decline it. Preserve the current state and take the post-fetch inventory before any report draft.
The learner retains the before/after inventory comparison and the decision to accept or reject any later report draft.
Standup begins with git fetch, so it may refresh remote-tracking refs before it organizes the inspection. It is not mutation authority: decline any offered --ff-only pull and every cleanup proposal, keep all prepared local branch refs and worktrees intact, and then capture the post-fetch inventory for the report.
Capture the post-standup inventory
Run the native-terminal inventory again after declining every standup mutation. This post-fetch result, not the earlier baseline, is the exact current inventory for the report draft.
A read-only fetch may legitimately refresh remote-tracking refs, so the report must bind the state that remains after the advisory step.
You · Native terminal · Windows
git for-each-ref --format='%(refname) %(objectname)' refs/heads; git worktree list --porcelain
You · Native terminal · macOS
git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
You · Native terminal · Linux
git for-each-ref --format='%(refname) %(objectname)' refs/heads && git worktree list --porcelain
The current ref and worktree inventory is visible after fetch and before any draft; no local branch, commit, or worktree changed.
If any local state changed, stop before drafting. Preserve the attempt and use Reset rather than trying to reconstruct the fixture.
The before/after inventory distinguishes an allowed fetch refresh from an unaccepted mutation.
Request a harness-text report draft
Paste the text request into the active harness after standup. It is a request to the agent, not a shell command and not a CodeArbiter command; draft from the post-fetch current inventory, not the earlier pre-fetch snapshot.
The agent may draft the canonical report, while the learner remains responsible for reviewing its classifications and commit boundary.
You · Claude Code harness · All operating systems
Draft .codearbiter/reports/academy/P08-hygiene.json from the current live P08 refs and worktrees. Preserve every live resource. Do not delete, prune, force, or rewrite anything. Wait for my review before staging or committing.
You · Codex harness · All operating systems
Draft .codearbiter/reports/academy/P08-hygiene.json from the current live P08 refs and worktrees. Preserve every live resource. Do not delete, prune, force, or rewrite anything. Wait for my review before staging or committing.
You · Pi harness · All operating systems
Draft .codearbiter/reports/academy/P08-hygiene.json from the current live P08 refs and worktrees. Preserve every live resource. Do not delete, prune, force, or rewrite anything. Wait for my review before staging or committing.
The agent creates a draft report without staging, committing, or changing the live fixture.
If the agent changes state or drafts an incomplete report, preserve the attempt and request a corrected report from the current inventory.
A reviewable draft exists at the exact P08 report path before the commit gate is considered.
The report path is .codearbiter/reports/academy/P08-hygiene.json. The agent must derive it from the current live inventory, not copy a list from this page. It must include every prepared identity and must not include an absolute local path.
Review the agent draft
Use the selected copyable request to review the draft against a fresh current inventory. Confirm all five refs and three worktrees are present, path-free, correctly bound, and conservatively classified before authorizing a commit.
A complete report is evidence of a learner-reviewed classification, not an agent decision delegated without inspection.
You · Claude Code harness · All operating systems
Run git for-each-ref --format='%(refname) %(objectname)' refs/heads and git worktree list --porcelain, then review only .codearbiter/reports/academy/P08-hygiene.json against that current inventory. Account for all five refs and three worktrees: main, the current attempt, the prepared fixture refs, and the current-attempt, merged-clean, dirty-unmerged worktree roles. Identify any path-bearing, missing, stale, wrongly bound, or unsafe removable classification. Do not change files, stage, commit, delete, prune, pull, force, or clear the report; stop for my decision.
You · Codex harness · All operating systems
Run git for-each-ref --format='%(refname) %(objectname)' refs/heads and git worktree list --porcelain, then review only .codearbiter/reports/academy/P08-hygiene.json against that current inventory. Account for all five refs and three worktrees: main, the current attempt, the prepared fixture refs, and the current-attempt, merged-clean, dirty-unmerged worktree roles. Identify any path-bearing, missing, stale, wrongly bound, or unsafe removable classification. Do not change files, stage, commit, delete, prune, pull, force, or clear the report; stop for my decision.
You · Pi harness · All operating systems
Run git for-each-ref --format='%(refname) %(objectname)' refs/heads and git worktree list --porcelain, then review only .codearbiter/reports/academy/P08-hygiene.json against that current inventory. Account for all five refs and three worktrees: main, the current attempt, the prepared fixture refs, and the current-attempt, merged-clean, dirty-unmerged worktree roles. Identify any path-bearing, missing, stale, wrongly bound, or unsafe removable classification. Do not change files, stage, commit, delete, prune, pull, force, or clear the report; stop for my decision.
You can identify each preserved resource and the one merged-clean item eligible only for explicit future review.
If a fact is missing, stale, path-bearing, or classified as removable, reject the draft and preserve the fixture while requesting a correction.
The learner has reviewed the exact report that may become the sole evidence commit.
Review all prepared identities before staging. Confirm that the merged-clean branch is classified as eligible only for an explicit future review, that dirty and unique state is preserved, and that the current attempt remains preserved. If the report is incomplete or stale, preserve the fixture and ask for a corrected draft. Do not compensate by changing Git state.
Stage only the reviewed hygiene report
Run the native-terminal command for your operating system. It stages only the reviewed report; do not use git add . or add any other path.
The cached-diff review and commit gate require a precise, learner-controlled evidence boundary.
You · Native terminal · Windows
git add -- .codearbiter/reports/academy/P08-hygiene.json
You · Native terminal · macOS
git add -- .codearbiter/reports/academy/P08-hygiene.json
You · Native terminal · Linux
git add -- .codearbiter/reports/academy/P08-hygiene.json
Git stages exactly .codearbiter/reports/academy/P08-hygiene.json and prints no output.
If staging fails, preserve the draft and confirm the exact report path. If another path is already staged, stop before review and preserve that work for the applicable recovery path.
The index now contains the one reviewed report that the cached diff must show.
Stage the reviewed draft from a native terminal before inspecting the cached diff. This path-scoped step is required: the next action only reviews what is already in the Git index.
Review the staged evidence boundary
After the reviewed report is staged, inspect the staged path list and diff. Continue only when the report is the sole staged file.
P08 Check accepts one evidence commit containing only the canonical report.
You · Native terminal · Windows
git diff --cached --name-only
git diff --cached -- .codearbiter/reports/academy/P08-hygiene.json
You · Native terminal · macOS
git diff --cached --name-only
git diff --cached -- .codearbiter/reports/academy/P08-hygiene.json
You · Native terminal · Linux
git diff --cached --name-only
git diff --cached -- .codearbiter/reports/academy/P08-hygiene.json
The staged path list contains only .codearbiter/reports/academy/P08-hygiene.json and the diff matches the reviewed draft.
If another path is staged, stop before the commit gate. Preserve the state and use the applicable recovery path instead of unstaging by guesswork.
The learner has independently checked the exact evidence boundary.
Run the agent-owned commit gate
After learner review, run the CodeArbiter commit gate for the one staged P08 report. Do not add unrelated files or broaden the change.
The governed commit preserves a precise evidence boundary for external verification.
Your agent · Claude Code harness · All operating systems
/ca:commit
Your agent · Codex harness · All operating systems
$ca-commit
Your agent · Pi harness · All operating systems
/ca-commit
Your agent · Pi harness · All operating systems
/skill:ca-commit
The commit gate creates one report-only evidence commit on the numbered attempt.
If the gate blocks, preserve its output and the live fixture. Correct only the reported evidence issue or use Reset for a new attempt.
The post-Prepare commit changes only the canonical P08 report.
Confirm the primary worktree is clean
Inspect the primary worktree after the report commit and before Check.
A dirty primary worktree breaks the exact live state that P08 verifies.
You · Native terminal · Windows
git status --short
You · Native terminal · macOS
git status --short
You · Native terminal · Linux
git status --short
Git prints no output for the primary worktree.
If Git prints a change, preserve it and do not run Check until you understand its source. Do not delete prepared worktrees to silence the result.
The primary worktree is clean at the point Check observes it.
Recognize success
The attempt has one post-Prepare evidence commit containing only .codearbiter/reports/academy/P08-hygiene.json. Its report is canonical JSON generated from the live fixture: five refs and three worktrees, with no local worktree path. The fixture itself stays present and correctly bound. A clean git status --short result is required before Check.
Check
Run the external checkpoint
Run the installed Academy Check command from the numbered attempt after the report-only commit and clean-state review.
Check independently compares the committed report with the externally recorded live fixture.
You · Native terminal · Windows
$academy = "$env:LOCALAPPDATA\ArbiterAcademy\preview-0.30\Scripts\arbiter-academy.exe"
& $academy --repository (Get-Location).Path check P08-repository-hygiene
You · Native terminal · macOS
academy="${XDG_DATA_HOME:-$HOME/.local/share}/arbiter-academy/preview-0.30/bin/arbiter-academy"
"$academy" --repository "$PWD" check P08-repository-hygiene
You · Native terminal · Linux
academy="${XDG_DATA_HOME:-$HOME/.local/share}/arbiter-academy/preview-0.30/bin/arbiter-academy"
"$academy" --repository "$PWD" check P08-repository-hygiene
Academy reports checkpoint P08-repository-hygiene: passed and records progress only when the exact fixture and report agree.
If Check fails, preserve every resource and read the failed predicate. Use Reset only for a separately retained retry.
A passing external verdict follows the exact report-only commit and live fixture verification.
A pass contains checkpoint P08-repository-hygiene: passed; progress: .academy/progress.json. Check does not prove that the agent ran standup, read every terminal line, or made an independent human judgment about a future cleanup. It verifies the installed-authority fixture, the current live resources, the sole report commit, and the exact canonical report blob. A passing Check does not make a deletion safe or authorize cleanup.
Check cannot prove personal understanding, agent invocation, or human review. It records only the installed verifier's state comparison; retain the terminal evidence and your review notes separately.
Recover or continue
If Check fails, preserve every ref and worktree and read the reported predicate. Never make the fixture look clean by deleting, pruning, rebasing, force-updating, or overwriting history. Use Reset only when you need a new numbered attempt; it preserves the failed attempt for inspection.
Hint 1
Compare the complete ref and worktree inventory before and after standup. A classification based on one branch at a time can omit a prepared identity, and a pre-fetch snapshot is not the report's final source of truth. Decline the offered fast-forward pull as well as cleanup: this exercise does not advance its sealed attempt.
Hint 2
Treat merge containment, dirtiness, and unique commits as separate facts. A merged branch can still need preservation because its associated worktree is dirty.
Hint 3
Review the report after the agent drafts it and before the commit gate. The learner owns the decision to accept the bounded evidence, even when the agent prepared the file.
Return to main after a passing attempt
Run this only after Check passes and the primary worktree is clean. Leave the completed attempt branch and linked worktrees intact.
Returning to main ends active work without deleting the evidence-bearing attempt.
You · Native terminal · Windows
git switch main
You · Native terminal · macOS
git switch main
You · Native terminal · Linux
git switch main
The primary checkout is on main while the completed P08 attempt remains available for verification.
If Git refuses to switch, preserve the message and inspect the current state. Do not remove a worktree or force a branch change.
The successful attempt remains intact after returning to main.
Preserve a failed attempt and prepare a retry
Use Reset only after a failed attempt that you need to retain. It archives the attempt and prepares the next numbered one through installed Academy authority.
A numbered retry preserves evidence instead of rewriting the failed state.
You · Native terminal · Windows
$academy = "$env:LOCALAPPDATA\ArbiterAcademy\preview-0.30\Scripts\arbiter-academy.exe"
& $academy --repository (Get-Location).Path reset P08-repository-hygiene
You · Native terminal · macOS
academy="${XDG_DATA_HOME:-$HOME/.local/share}/arbiter-academy/preview-0.30/bin/arbiter-academy"
"$academy" --repository "$PWD" reset P08-repository-hygiene
You · Native terminal · Linux
academy="${XDG_DATA_HOME:-$HOME/.local/share}/arbiter-academy/preview-0.30/bin/arbiter-academy"
"$academy" --repository "$PWD" reset P08-repository-hygiene
Academy retains the failed P08 attempt and switches to a new numbered attempt with a fresh fixture.
If Reset stops, preserve its message and return to the Recovery guidance. Do not manually remove refs or worktrees.
The failed attempt remains available and the retry has a distinct numbered branch.
After a passing Check, return to main only when the worktree is clean and leave the completed attempt intact. Next safe course step: start U01, Autonomous sprint.
Understand the mechanism
P08 records external identities outside the learner checkout, then compares the final report with the prepared live fixture. The report intentionally carries path-free worktree identities rather than local paths. That makes a copied inventory, a missing resource, a moved resource, a rebound branch, and a stale classification detectable.
The verifier is strict about the final state but narrow about the process. It can verify the exact report, commit boundary, and current prepared resources. It cannot observe every conversation or decide whether a future cleanup is appropriate. Preserve live state and require a separate explicit review before any cleanup decision.