← Back to Pull requests

Remove shadow branches and line attribution #2692

Closed
unknown closed this pull request without merging on Oct 08, 2026 20:34 UTC
View on GitHub
unknown unknown commented on Oct 07, 2026 15:30 UTC
Author

<!-- entire-trail-link-start -->
https://entire.io/gh/entireio/cli/trails/1509
<!-- entire-trail-link-end -->

Summary

Agent turns no longer write anything to git. Older versions committed a full working-tree snapshot to a per-worktree shadow branch (entire/<commit>-<worktree>) at every turn end. That was the source of runaway local storage, and cleaning those branches up at the wrong moment made uncondensed work unreachable. Turn ends now record pending work in session state only: the step count, the files the agent touched, and each touched file's git blob hash. A checkpoint is written only when you commit.

Line attribution is removed entirely, including the AI/Human/Mixed labels in entire blame, which now reports whether each line's commit is linked to a checkpoint. Checkpoint metadata no longer carries initial_attribution or combined_attribution; entire.io derives the experts counts from those and must be told they stop arriving.

Commits link to a session by file name: any committed path the session touched links it, except a new file at a path the agent deleted. Carry-forward after a partial commit compares the recorded hashes with the commit and the worktree, so a git add -p remainder, a pending deletion, or a session upgraded from the old state format keeps its uncommitted work. Gitignored files, submodule pointers, and paths inside a submodule or beneath a symlinked directory never enter the tracked files, so they can no longer keep a session pending forever; edits inside a submodule belong to the nested repository's own session. Whether a committed file still has uncommitted agent changes is asked of git status, so repositories with text=auto or core.autocrlf no longer keep fully committed files pending.

Lifecycle decisions (condensation, the zombie sweep, orphan cleanup, doctor) key on one predicate over session state instead of whether a shadow ref exists. Pending step rows, explain of temporary checkpoints, incremental task checkpoints and the Claude Code post-todo hook install are gone. checkpoint list --pending now previews what the next commit's checkpoint will contain.

Claude Code gains a transcript prompt extractor, so its prompts no longer depend on prompt.txt alone.

Addresses #2663, #2378, #2350, #1730, #1807 and #2653. Supersedes trail 1486 (soph/fix-shadow-after-midturn-commit), which patches code this PR deletes.

Migrations

Turn ends no longer write shadow branches (entire/<commit>-<worktree>): pending work is tracked in session state and checkpoints are written only when you commit. Branches left by older versions are not removed automatically. entire doctor and entire status report them, and entire doctor --force or entire disable --uninstall deletes the entire/<commit>-<worktree> form without touching session state. The oldest bare entire/<commit> form is only ever listed, since a branch of your own named after a short SHA looks the same; entire clean --all removes it behind a confirmation. Do not use plain entire clean for this: it also clears pending session state. They hold full snapshots of your working tree, so run it once after upgrading. Deleting the branches frees no space by itself: a later git gc reclaims it once their objects are two weeks old. git gc --prune=now frees it immediately, but it drops every unreachable object in the repository (recently dropped stashes included) and must only run when no other git process is active.

entire blame --json reports a per-line status (checkpoint, commit, uncommitted) instead of authorship and tag. Its summary reports checkpoint-linked, commit and uncommitted line counts instead of AI/Human/Mixed counts.

New checkpoints no longer include initial_attribution, combined_attribution or prompt_attributions; checkpoints written by older versions keep theirs, and rewrites (explain --generate, attach) carry them through unchanged. Session state files written by older versions still load; their attribution and last_checkpoint_commit_hash keys are dropped on the next save.

The Claude Code post-todo hook is no longer installed, and any entire enable prunes it and says so. Its subcommand stays so older hook configs keep working. An older CLI run against the same tracked .claude/settings.json reports the hooks as out of date and re-adds it; this CLI removes it again on the next entire enable.

Commit pending agent work before downgrading to a previous release: the previous CLI deletes ended but uncondensed session state when its shadow branch is missing, and this release never writes one.

entire session info --json and entire session current --json report the number of turns not yet condensed into a checkpoint as pending_turns. The old checkpoints field is still emitted with the same value for this release only and will be removed in the next one; switch scripts to pending_turns. entire status --json adds legacy_shadow_branches.

Follow-ups, not in this PR

Downgrade safety: the previous CLI deletes ended but uncondensed session state when its shadow branch is missing, and this release never writes one, so rolling back after pending work discards it. The migration note covers it; a patch on the previous release line whose orphan check also requires no pending work, named as the minimum safe downgrade target, is a release-management follow-up (trail finding 01M4DD0R83YC).

Worktree scoping, deferred to the #2531 work: scoping the zombie sweep and doctor to the current worktree, retiring the stored transcript copy with the growth check moving to the live transcript position, prompts and transcript for guest-linked commits, and capture following the event's cwd. #2531 itself must be reworked after this lands, since it pins sessions through shadow-branch steps; #2486 is expected to close in its favour.

Tracked on the priority list for go-git (#DM2KFD6): its worktree hashing lacks gitattributes, filter, and index-aware CRLF handling, which is why this PR asks git status instead of hashing; porting that logic into go-git would let the CLI drop the subprocess.

Test plan

mise run check (fmt, lint, unit, integration, Vogon canary) and GOOS=windows go vet ./... on the final tree, with a cold lint cache, after merging main at 375819df95. Every commit builds and vets on its own. A focused security review of the cross-worktree stored-transcript read (a path taken from on-disk session state, gated by git worktree list registration and the .entire anchor) found no findings. The only local failures are the known OpenCode seed-cache guard and the Claude config-probe timeout, which passes alone.

New unit, integration and command tests cover: recorded-hash carry-forward (partial commits, pending, committed and re-created deletions, upgraded sessions, an unreadable worktree); name-based linking; gitignored and submodule paths on every capture route; the doctor legacy-branch check; the --pending preview in text and JSON without a TTY; and the Claude prompt extractor against the real transcript fixture.

Real-agent E2E passed on 44ebccb136 for every leg (claude-code, codex, cursor-cli, copilot-cli, factoryai-droid, opencode, antigravity, roger-roger, and Windows): https://github.com/entireio/cli/actions/runs/37655720329. One changed expectation is TestInteractiveNewFileLinksAfterUserRewrite, which now expects a trailer after a user rewrites an agent-created file.

🤖 Generated with Claude Code

<!-- CURSOR_SUMMARY -->
---

[!NOTE]

High Risk

This rewrites core session-to-checkpoint lifecycle, persistent metadata contracts, and labs blame JSON—high blast radius for upgrades, downstream consumers (e.g. entire.io attribution fields), and real-agent E2E behavior.

> Overview

Turn-end work stays out of git. Agent stops no longer commit working-tree snapshots to entire/<commit>-<worktree> shadow branches; SaveStep only updates local session state (step count, files touched, content hashes, transcript copy). Permanent checkpoints are written at git commit onto metadata refs, matching the updated README/CLAUDE contract.

> Checkpoint storage and metadata slim down. The ephemeral/shadow-branch store (EphemeralStore, WriteTemporary, task step writes, related benchmarks and tests) is removed. CheckpointAttribution and all Attribution fields (initial_attribution, combined_attribution, prompt_attributions, EphemeralBranch) drop out of api/checkpoint and git/fs backends.

> entire blame / why semantics change. Per-line AI/Human/Mixed authorship is gone; JSON uses status (checkpoint, commit, uncommitted) and summaries count checkpoint-linked vs other commits. Help text states Entire does not attribute lines to AI vs humans—only whether the blame commit carries an Entire-Checkpoint trailer.

> Claude Code hooks and prompts. The post-todo (TaskCreate|TaskUpdate) hook is no longer installed; entire enable prunes stale installs while keeping the subcommand registered. New prompts.go implements PromptExtractor / TranscriptPromptExtractor so user prompts come from transcript bytes with injected/meta lines filtered.

> Operator/docs touchpoints. checkpoint list --pending documents is_next_checkpoint preview semantics; legacy shadow branches are called out for entire doctor / entire clean. E2E/debug skills swap “attribution” for file tracking language.

> <sup>Reviewed by Cursor Bugbot for commit 19b37c48aedde9efe68606e4a9ca48b42ae13064. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Diff: 650 lines (+487 / -163) across 8 files Reviewer: hiddeco Review duration: 1743m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
0.52
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.388
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2692"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 52% (MEDIUM) · Higher = larger blast radius
52%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 20.5% · Safe to merge
20.5%
Repository