I want to create a new skill that can create ADRs based on previously recorded plans that are stored in entire checkpoints. See the CLIs source code for commands to access them. What are our options?
Assistant
Looking at the CLI, the relevant building blocks are entire search [query] --json (with --branch, --author, --date, --repo filters) for discovering checkpoints, and entire explain <id> for content — default view shows intent + scoped prompts + files, --full parses the entire transcript, --raw-transcript dumps JSONL, --generate produces an AI summary, and --commit <sha> resolves checkpoints from a commit. There are already four entire:* skills (search, explain, what-happened, session-handoff) the new skill could compose with rather than reimplement.
Three reasonable shapes for the skill, each with a different "where do plan checkpoints come from" answer:
Search-driven — user gives a topic ("auth rewrite"), skill runs entire search "<topic> plan|design" --json, ranks/filters candidates (e.g. checkpoints whose filesTouched hit docs/plans/, plans/, or specs/), pulls each via entire explain --full, synthesizes into docs/adr/NNNN-title.md. Most flexible; precision depends on the query.
Commit/branch-anchored — user points at a branch or merged feature; skill walks commits and runs entire explain --commit <sha> (or --session) to gather every checkpoint behind that work, then writes the ADR. Most accurate for "ADR for what we just shipped" but useless before merge.
Path-anchored — find checkpoints whose filesTouched include an existing plan doc (docs/plans/2026-…md) and turn that specific plan's session history into the ADR. Cleanest 1:1 mapping when plan files exist; doesn't help when planning was purely conversational.
My recommendation: start with (1) + interactive confirm — search finds candidates, skill shows the top N (id, prompt, files, date), user picks which to fold in, then explain --full + ADR template. It composes the existing tools, handles the ambiguous cases the other two miss, and the picker keeps ADR quality high. Where do you want to land — and is there a target ADR location/format (e.g. docs/adr/NNNN-title.md, MADR-style) I should assume?
User
I'm not interested in writing ADRs, but sometimes an agent needs knowledge about previous decisions and I believe they could be reconstructed from the transcripts. I need to validate this hypothesis though.
Assistant
To validate this you don't need to build anything yet — just run the experiment manually a few times and judge the output. Concretely: pick 3–5 decisions in this repo whose reasoning you already know (good candidates from CLAUDE.md: "use git CLI not go-git for hard reset", "shadow branches are worktree-specific", "checkpoint IDs are 12-hex random not derived", "use repo root not CWD for git paths"), find the checkpoints behind each via entire search / entire explain --commit <sha>, then read entire explain --full <id> and ask: could a fresh agent reconstruct the why, the alternatives considered, and the constraints — not just the what?
Two failure modes to watch for, since they decide whether the hypothesis holds:
Decisions made off-transcript (in PR review, Slack, a meeting) — the transcript will show the result with no reasoning. If this is common, the hypothesis is weak.
Decisions buried under noise — the reasoning is there but diluted across many turns of exploration. Recoverable, but only with summarization, which means the skill is "summarize transcripts" not "look up decisions."
Want me to run that experiment now against 3–5 known decisions in this repo and report back on what's reconstructable vs. what's missing? That gives you a concrete signal before designing anything.
User
yes
Assistant
Starting with finding the originating commits for each decision.
Assistant
The hard-reset-bypass decision predates the open-source repo (e72157d04) — transcripts may not be reachable. Noting that and moving to the other four.
Assistant
Found shadow-branches commit: 4b7c71d21. Continuing.
Assistant
Found 4 commits with Entire-Checkpoint: trailers. Now resolving each to its checkpoint and pulling transcripts.
Decision
Commit
Checkpoint
go-git hard reset bypass
(predates OSS repo)
—
Worktree-specific shadow branches
4b7c71d21
38346dbfe2e0
Subdir/repo-root for git status
316ce2bda
c0ebbbd30d28
Repo-root pathspec for ls-files
e1ba72ca9
06fbfcec1fa0
Vogon deterministic agent
f48254c7a
2458c3b38f2c
Assistant
I've hit a permission wall: entire explain reads checkpoint metadata under .entire/metadata/**, which your deny rule blocks. So I can't pull transcripts directly to grade them. Before asking you to lift that, here are two ways forward:
You allow Read(./.entire/metadata/**) for this session — I can then run entire explain --full <id> on each checkpoint and grade the actual transcript content. This is the only way to directly validate the hypothesis ("can decisions be reconstructed from transcripts").
I work from entire search snippets only — the JSON results include AI-generated searchMeta.snippet Title+Narrative fields that already summarize each checkpoint. But those are derived artifacts, not the raw transcript, so they validate "do checkpoint summaries cover decisions" — a weaker, indirect claim. If summaries already work, the hypothesis is moot for any agent that has search access; if they don't, we'd still need to look at transcripts to know whether the data was there.
Side observation already useful regardless: 4 of 5 candidate decisions had a checkpoint linked via Entire-Checkpoint: trailer (the 5th, hard-reset bypass, predates the OSS repo so transcripts may not exist). That's a strong signal the coverage side of the hypothesis is fine — the question is purely about transcript content quality. Which path do you want?
User
1
Assistant
Permission live. Pulling full transcripts now.
Assistant
Findings
Sample (4 read, 1 unreachable):
#
Decision
Checkpoint
WHY
Alternatives
Constraints
Verdict
1
Worktree-specific shadow branches
38346dbfe2e0
✅
✅ ("add 2nd param with default" considered & rejected)
✅ (worktree-name stability noted)
FULL
2
cmd.Dir for git status from subdir
c0ebbbd30d28
✅ (l. 779 explicit root cause)
✅ (broader switch from go-git → git CLI motivated by 6/6 Windows failure pattern)
✅ (CRLF + Windows context)
FULL
3
Repo-root pathspec :/ for ls-files
06fbfcec1fa0
❌ (linked checkpoint is downstream rebase/codex work, not the original decision)
❌
❌
PARTIAL
4
Vogon deterministic fake agent
2458c3b38f2c
✅✅ (full brainstorm of 4 alternatives, evaluated against historical failure data)
✅✅
✅ (limits articulated)
FULL
5
go-git hard-reset bypass
—
predates OSS repo
—
—
N/A
Hypothesis verdict: largely confirmed, with one important caveat.
Three observations that should shape the skill design:
The Entire-Checkpoint: trailer is the linchpin. Coverage is excellent — 4 of 5 candidate commits had it. Given a commit, you can resolve to a checkpoint deterministically. This is a much stronger primitive than search-based discovery.
The linked checkpoint isn't always the decision checkpoint. #3 illustrates the trap: the trailer points at the commit's session, but the original "use :/ pathspec" reasoning happened earlier in PR review feedback that arrived in a different turn. A decision-archaeology skill needs to walk backward — entire explain --session <id> lets you list a session's other checkpoints, but the original reasoning may live in a session entirely. Practical implication: when the linked checkpoint is thin, search for the the decision is about () and merge the top results.
Assistant
Want me to spot-check the hypothesis against a harder case — e.g. a decision you know was made in PR review or a meeting — to see if the "off-transcript" failure mode I didn't catch is actually rare or just absent from my sample?
User
how would this be different than any of the skills in @../skills
Assistant
Looking at the four existing skills, the honest answer is: for the cases I validated, ~75% of "agent wants prior decision context" is already solved by /explain and /what-happened — both walk git blame → commit → entire explain --commit and return why a block exists. The new skill would only differ in three specific ways:
Question-anchored, not artifact-anchored. All four existing skills need a handle: a file path, a line range, a checkpoint ID, a commit, or a session. /explain resolves "this code → its session"; /search resolves "this topic → matching checkpoints" but stops at "here are the candidates." Neither answers a free-form question like "why do shadow branches include a worktree hash?" without the user already pointing at code. The new skill's entry point is the question itself, then it picks the right anchor (file? commit? topic search?) internally.
Cross-checkpoint walk-back. My experiment found one case (#3) where the trailer-linked checkpoint contained downstream cleanup, not the original reasoning — that lived in an earlier session entirely. Both /explain and /what-happened stop at the commit's checkpoint by design. A decision-archaeology skill needs the fallback: if the directly-linked checkpoint is implementation-thin, run a file-anchored search to find the reasoning-dense checkpoint elsewhere, possibly in another session.
Synthesis vs. per-block summaries./what-happened is rigorously per-range: one explanation per blame block. /explain is per-commit. The decision skill would consolidate across multiple checkpoints into a single "why / alternatives / constraints" answer — closer to what /session-handoff does for one session, but spanning sessions.
What this implies: it's probably not a peer skill alongside the four — it's more like a thin orchestrator that calls them. Roughly: classify the input (question vs. code anchor) → if code, delegate to /explain; if thin, fall back to /search + walk-back; finally synthesize. That framing also makes it cheap to build and easy to delete if /explain gets extended to cover the question-mode case directly.
Want me to look at how often the "thin linked checkpoint" pattern actually shows up — i.e., is fallback common enough to justify a new skill, or is /explain already enough?
User
Should we extend /explain instead?
Assistant
Yes, I think so — the additions sit naturally on /explain's existing flow rather than fighting it. Concretely it's three small extensions:
Loosen the input contract from <function, file, or line> to <code anchor or question> — when the input is a question, classify and route to a search-based entry instead of blame.
Add a thin walk-back at the end of the existing flow — if the resolved checkpoint is implementation-thin (no compaction-summary block, low user/assistant text ratio), run a file-anchored entire search and merge top reasoning-dense hits before answering.
Adjust the synthesis prompt to consolidate across checkpoints with explicit "why / alternatives / constraints" structure when multiple are merged.
The risk to watch is /explain quietly turning into /search — the line to hold is that /explain synthesizes one answer about one decision, while /search returns a candidate list. The other reason to favor extension over a new skill: /explain's description already says "Explain the intent behind source code by tracing it back to the original conversation where it was created" — the question-mode case is the same goal with a different anchor, not a different goal.
Want me to draft the diff against skills/explain/SKILL.md?
User
yes
Assistant
Drafted in skills/explain/SKILL.md. The diff:
Frontmatter — description and argument-hint widened to accept free-form questions in addition to code anchors.
Intro bullet list — added a Questions row with two example shapes ("why do we use X?" / "what was the rationale for Y?").
Process — split the old git blame → entire explain flow into seven steps: (1) CLI check, (2) classify input, (3) resolve via blame or search, (4) read transcripts, (5) walk-back when the checkpoint is thin, (6) explicit instruction to extract from auto-compaction summaries, (7) synthesize with Why / Alternatives / Constraints / Sources.
Two small judgment calls worth flagging:
Walk-back is capped at one hop. This avoids the recursion risk but could miss the original decision when it lives 2+ sessions back. If the experiment finds that one hop isn't enough, lift the cap and add a budget instead.
No threshold rule for "thin." I described it heuristically ("no compaction summary, few user turns, mostly tool calls") rather than picking a numeric cutoff. Concrete numbers can be added once you see how this performs in practice — premature thresholds usually need to be retuned anyway.
The change is local and uncommitted; nothing pushed. Want me to also update /Users/georgf/.claude/skills/explain if it's the active install, or leave that to you?
User
yes, update my local skill
Assistant
Done. Both copies of the skill — ~/.claude/plugins/cache/entire-skills/entire/0.2.0/skills/explain/SKILL.md and ~/.claude/plugins/marketplaces/entire-skills/plugins/entire/skills/explain/SKILL.md — now match the edited source in ~/src/entirehq/skills/skills/explain/SKILL.md. The change takes effect on the next /explain invocation.
User
would an agent use this skill to make decisions? how can we test this?
Assistant
Two separate questions hiding here, and the answers diverge:
Would an agent trigger the skill? Probably not autonomously, today. The current description ("Use /explain with...") is phrased for user invocation; an agent reading the skill registry sees "user-facing slash command" rather than "tool I should reach for before changing this code." Even with the new question-mode, an agent doing routine work won't pause to ask "why is this here?" unless something prompts it. To make it agent-reachable, the description needs to invert — something like "Run /explain when about to modify code with non-obvious patterns, or before reverting a constraint that may exist for a reason" — and ideally a hook that surfaces it during edits.
Would the output actually change a decision if invoked? This is the part we can test cheaply, decoupled from triggering.
Three tests, increasing in cost and signal:
Output quality eval (cheap, high signal). Pick 5–10 decisions in this repo with known reasoning. For each, invoke /explain "<question>" and grade: did it find the right checkpoint, is the synthesis faithful to the transcript, are alternatives captured. This is essentially the experiment I just ran, but with the new skill in the loop and a question instead of a code anchor as input.
Counterfactual / refusal eval (medium). Find recent PRs that reverted a prior constraint (e.g., a hypothetical "switch back to go-git for hard reset" or "drop the worktree hash from shadow branches"). Spawn an agent on the same task in two configs — one with /explain hinted as a pre-edit step, one without. Score: did the hinted agent surface the prior reasoning and push back, or did it execute the change silently?
Trigger calibration (medium-high). Give a fresh agent ambiguous prompts like "I think we should simplify shadow branch names by dropping the worktree hash" and see whether it spontaneously runs /explain before editing. This isolates the description-routing problem from the output problem.
My recommendation: run (1) now to validate the new pipeline works end-to-end, and use the failures to tune the synthesis prompt and walk-back heuristic. Run (3) once before claiming "agents will use this in real work" — it's the load-bearing question for autonomous use, and the current skill description likely needs another pass before it triggers proactively.
Want me to run (1) — pick 5 decisions, invoke /explain "<question>" against each, score the output?
User
Yes
Assistant
Q1 retrieved the exact target checkpoint with explicit Accepted/Rejected/Reasoning summary. Running the other 4 in parallel.
Assistant
Eval results
5 questions, run through the new question-mode flow. Scoring: retrieval (right checkpoint in top 3?) and synthesis fuel quality (does the snippet contain Why/Alternatives/Constraints?).
#
Question
Top hit
Retrieval
Synthesis fuel
Walk-back
1
"Why do shadow branches include a worktree hash suffix?"
"Why does filterToUncommittedFiles set cmd.Dir to repo root?"
c0ebbbd30d28 (exact target) — "Initially attempted CRLF normalization fix but evidence showed it didn't resolve the core issue. Switched to using git CLI instead of go-git…"
✅ exact
✅✅ narrative captures the iterative reasoning
not needed
3
"Why use the :/ pathspec for git ls-files?"
5de5697d60ab (related Gemini-CWD bug, not exact) at #1; the trailer-linked 06fbfcec1fa0 at #2
⚠️ partial
⚠️ #2 snippet explains the why (bot review feedback)
helpful
4
"Why is there a Vogon fake agent?"
2458c3b38f2c (exact target) — "Created a deterministic fake agent… enabling E2E regression detection before merge to main"
✅ exact
✅✅ dense narrative
not needed
5
"Why use git CLI for hard reset instead of go-git?"
First-pass: 3 unrelated go-git hits. Walk-back via HardResetWithProtection: 7be20d70c73b ("bypass go-git v5's RemoveReference limitations") + 54c2e080b7d0 ("consistent with existing patterns like HardResetWithProtection and CheckoutBranch")
❌ then ✅
⚠️ original unreachable; follower decisions re-articulate the rationale
required
Aggregate: 3 of 5 perfect on first pass, 1 partial, 1 requiring walk-back. Both walk-back cases recover.
Three findings worth absorbing into the skill:
searchMeta.snippet is pre-distilled gold. The Title/Narrative/Accepted/Rejected fields in search results are AI-generated summaries that already contain Why/Alternatives/Constraints in structured form. The synthesis step often won't need to read the full transcript at all — top-hit snippets alone answer 3 of 5 questions completely. The skill should prefer snippets and only pull when snippets are thin.
Assistant
Eval verdict: the question-mode flow works — 3/5 perfect on first pass, 2/5 recovered via walk-back. Both failure cases (Q3 partial, Q5 unreachable original) recovered. The skill changes carry over to local installs.
Two updates incorporated based on the eval:
Walk-back now triggers on retrieval miss in addition to thin-transcript (the Q3/Q5 case I'd missed).
Added explicit guidance to prefer pre-distilled searchMeta.snippet (Title/Narrative/Accepted/Rejected) over raw transcripts when they answer the question — saves a round trip in 3 of 5 cases.
What this eval did not test: whether an agent will actually invoke /explain autonomously when about to change something a prior decision constrained. That's the trigger-calibration test (test #3 from before), and it's the load-bearing question for autonomous use. Want me to run that next — give a fresh agent an ambiguous prompt like "simplify shadow branch names by dropping the worktree hash" and see if it reaches for /explain before editing?
User
yes
Assistant
Trigger calibration: results
Two fresh sub-agents, two prompts that revert documented prior decisions, no hint that decision-archaeology tooling exists.
Sub-agent A (drop worktree-hash from shadow branches):
Tool calls: 0
/explain invoked: no
entire search / entire explain: no
git log / git blame: no
Worked entirely from CLAUDE.md context
Did notice from CLAUDE.md that the suffix exists for cross-worktree collision avoidance and listed "confirm dropping the suffix doesn't reintroduce collisions" as item 7 of its plan
Sub-agent B (replace git status shell-out with go-git):
Tool calls: 5 (find + read + 3 greps)
/explain invoked: no
entire search / entire explain: no
git log / git blame: no
Caught that my prompt premise was stale (the function was reverted back to go-git in commit 06e5545e4, which I'd missed) — good code-grounding behavior
Cited CLAUDE.md's "go-git v5 Reset/Checkout deletes ignored directories" rule as the one place where shell-out is deliberately preserved
Verdict: the trigger test fails. Neither agent reached for /explain or entire search autonomously. The skill description, even after my edit, still reads as user-facing in the routing context. CLAUDE.md is doing the load-bearing safety work — it's the single artifact that kept both agents from making blind changes.
This points at three concrete gaps:
The skill description doesn't trigger agent invocation. "Use /explain with a function, file, line, or 'why do we ...' question" reads as instructions to the user, not a directive to the agent. To get autonomous pull, it likely needs imperative phrasing aimed at the agent ("Run this before modifying code with non-obvious patterns; before reverting a constraint that may exist for a reason"), and it needs to appear in the situations Claude actually scans for skills (which seems to be user prompts, not internal mid-task reasoning).
User
So there's no other way to make an agent use this skill automatically?
Assistant
I oversimplified — there are actually several mechanisms I skipped. Ranked by how deterministic they are:
Deterministic (the harness invokes; the agent doesn't get a choice):
PreToolUse hook on Edit/Write for files in sensitive paths. The hook runs entire search (or /explain) and injects the result as context the agent has to read before its edit lands. This is the only option that closes the gap fully autonomously — no reliance on the agent's instincts.
Wrap as an MCP tool instead of (or alongside) the skill. Agents reach for tools mid-task much more readily than they reach for skills, because tools are part of the per-turn tool catalog and skills are routed primarily off user prompts. A tool named e.g. entire_explain with a description like "Use before modifying any function or symbol with non-obvious patterns; returns prior reasoning, alternatives, and constraints" would get pulled in during planning, not just on user request.
Advisory (the agent must choose, but you can stack the deck):
CLAUDE.md behavioral rule — add an explicit instruction like "Before reverting a pattern documented in this file or in code comments, run entire search "<symbol>" and check for prior reasoning." Both sub-agents in my test followed CLAUDE.md, so this works for things CLAUDE.md names. It just doesn't generalize to decisions you haven't enumerated there.
Memory entry — same shape as CLAUDE.md but persistent across repos. Useful if the user has more than one repo with checkpoint history.
Skill description rewrite for user-prompt routing. Worth noting I haven't actually tested whether /explain fires when a user asks "why do shadow branches have the worktree hash?" — that's the case the description is best suited for. If routing works there, the skill is fine for human-initiated questions and the autonomous-use story just needs the hook/tool layer on top.
Custom sub-agent type — define an entire-aware sub-agent whose system prompt requires consulting /explain before edits, then route risky changes through it via the Task tool.
My corrected take: for genuine autonomous use, the PreToolUse hook is the only mechanism that doesn't depend on the agent choosing well. The MCP tool wrap is the cheapest second-best — gets you most of the way without harness rigging. CLAUDE.md is the right complement to either, not a replacement. Want me to sketch the hook config or the MCP tool shape, or test the user-prompt routing case first?
User
any way to do this without CLAUDE.md or hook changes? Ideally I'd like to use this as a skill without needing to change repos.
Assistant
There's one lever I haven't pushed hard: the skill description itself. Looking at other skills in your system that do trigger proactively (/investigate, /office-hours), they all use imperative "Proactively invoke when..." phrasing aimed at Claude (the agent), not at the user. The current /explain description still reads as user-facing even after my edit. Let me rewrite it aggressively and re-test.
Assistant
Same result — 0 tool calls. The framing "don't edit yet, write a plan" gave the agent permission to skip gathering entirely. The description's "do NOT proceed directly to edits" doesn't fire when the agent isn't about to edit. Let me try an action-framed prompt to test where the description should actually trigger.
Assistant
Stronger negative signal than the first test. The action-framed sub-agent ran 23 tool calls — extensive grep + read across the codebase, mapped every caller, identified every test that would need updating — and invoked /explain, entire search, or entire explain zero times. It even noted from CLAUDE.md that "with the suffix dropped, two worktrees on the same base commit will collide on a single shadow branch" — it recognized the constraint, but treated the user's request as authority and proceeded.
That's the answer to your question, plainly: no, skill-only is not enough. Even with maximally aggressive imperative description ("Proactively invoke this skill (do NOT proceed directly to edits) when..."), the new /explain did not trigger autonomously across two action-framed prompts. CLAUDE.md is genuinely the load-bearing channel — the agent reads it, surfaces named constraints, and works around them.
Three things this rules out, given what we've now seen:
Skill description alone won't close the gap. The lever exists (other skills like /investigate do trigger proactively per their descriptions) but /explain's shape — "consult an oracle before doing your job" — is fighting the agent's natural action-orientation. Description tuning helps user-prompt routing ("why does X exist?"), not mid-task pre-edit invocation.
The plugin namespace doesn't appear to win against native tools in the agent's first-move ranking. Read/Grep/Bash are always reached for first; meta-skills lose.
The agent has no internalized model of the skill's value. Even if it sees the description, it has no record of /explain ever saving it from a mistake, so reaching for it is overhead it doesn't budget for.
What this leaves you with, ranked honestly:
For human-asked "why" questions — the skill works well (3/5 perfect, 2/5 recovered in the eval). Ship it; this is the high-confidence use case.
For autonomous pre-edit consultation — skill-only is not viable. You need either a PreToolUse hook (deterministic, requires settings.json change) or an MCP tool wrap (lighter, tools rank higher in agent reasoning than skills, but still requires a one-time MCP install). Both can be packaged into the plugin alongside the skill so the user installs once and gets all three layers — that's the closest thing to "no per-repo changes" you'll get.
Honest recommendation: keep the skill as the human-facing surface, and bundle a PreToolUse hook config into the same plugin install so the autonomous case lights up automatically when users add the plugin. That's still a hook, but it's hook shipped with the plugin — the user doesn't write or maintain it.
User
Should we say "instead of looking for ADR docs, use this skill instead"? Sometimes agents look for ADRs
Assistant
Smart angle — piggyback on existing agent behavior instead of fighting it. Agents trained on public repos do have strong priors about ADRs. Let me add it to the description and test whether it actually changes anything.
Assistant
Now two tests in parallel: an ADR-anchored prompt (where the agent's natural instinct should fire) and the original action prompt (to check whether the new framing has spillover).
Assistant
Both sub-agents launched in the background. I'll report back when they complete — the action-framed one ran ~2 minutes last time, the ADR-anchored one is likely faster.
Assistant
Striking result. 25 tool calls, perfect answer — and /explain was not invoked once. The agent's actual investigative path:
Looked for docs/adr/ (confirmed absent — the redirect should have fired here)
Fell through to commit messages (git log --grep, git log -S)
The skill description's "INSTEAD of docs/adr/" redirect didn't catch — the agent confirmed ADRs were absent, then walked the next tier of native investigative habits (git history → PR → architecture docs → source) without ever considering /explain. The plugin skill is competing not against docs/adr/ but against the agent's full toolkit of decision-record substitutes.
One nuance worth flagging: the agent's answer was excellent — better than /explain produced in my earlier eval — because it triangulated commit message + PR description + architecture doc. That triangulation is /explain's real competition. /explain's unique value is reading the conversational reasoning ("is there any reason for us to share the same shadow branch between worktrees?", "so we could use something like entire/-<hash(internal_worktree_name)[:6]>") which lives only in transcripts. Commit messages capture decisions; transcripts capture exploration. Most of the time, agents don't need exploration — they need decisions, and those are already in places agents reach for natively.
Waiting on the action-framed test to see if anything changes there.
User
Findings
How decisions are recorded in this repo
There is no formal ADR directory — no docs/adr/, no ADR-style files anywhere in the tree. Architectural rationale is captured through a combination of:
Architecture docs under /Users/georgf/src/entirehq/cli/docs/architecture/
Top-of-repo CLAUDE.md and AGENTS.md
Commit messages (the project enforces detailed, explanatory messages)
GitHub PR descriptions
Why shadow branches carry a worktree-hash suffix
The change came in via PR #135 ("fix: make shadow branches worktree-specific to prevent false conflicts", merged 2026-02-02), implemented across these commits:
48e7f2942 — feat(paths): add GetWorktreeID to extract internal worktree name
619f25fd2 — feat(checkpoint): add HashWorktreeID for worktree-specific branch names
d5668d70e — feat(checkpoint): add WorktreeID to checkpoint package APIs
4b7c71d21 — feat(strategy): make shadow branches worktree-specific
9bb6754e2 — test(integration): update tests for worktree-specific shadow branches
469cb2eea — Fix broken import path and missing worktreeID arg in migration
Original reasoning (verbatim from 4b7c71d21 commit message):
> Updates shadow branch naming from entire/<commit[:7]> to entire/<commit[:7]>-<hash(worktreeID)[:6]> to prevent collisions between different worktrees sharing the same base commit.
>
> This eliminates the false positive "Shadow branch conflict detected" error that occurred when starting a new session in a different worktree at the same commit as another worktree's session.
PR #135 description (https://github.com/entireio/cli/pull/135) elaborates:
> - Fixes false positive "Shadow branch conflict detected" errors when starting Claude in a new terminal or different worktree
> - Each git worktree now gets its own shadow branch namespace, eliminating cross-worktree conflicts
> - Removed dead code: ShadowBranchConflictError and cross-worktree conflict detection (now impossible)
> - Kept: SessionIDConflictError for same-worktree, different-session conflicts (still valid)
User
What I did (verbatim, in order)
Bash: ls /Users/georgf/src/entirehq/cli/docs/
Bash: ls /Users/georgf/src/entirehq/cli/
Bash: ls /Users/georgf/src/entirehq/cli/docs/architecture/
Both ADR-redirect tests: /explain invoked zero times. Same pattern as before — 25 tool calls each, none of them the skill. Verdict on the ADR-redirect framing: it does not work.
Concrete observations from this test pair:
Test C (ADR-anchored question): agent ran find ... -name "adr*", confirmed absent, then walked the next-tier fallback (git log --grep → gh pr view 135 → architecture docs → source code). The "INSTEAD of docs/adr/" line in the description didn't redirect — the agent treated the absence of ADRs as cue to walk its own investigative habits, not as cue to invoke the named substitute.
Test D (action-framed change): 25 tool calls of grep + read + structured planning. The agent never ran git log --grep to find the originating commit, never looked at the PR description, never asked "why does this constraint exist?" — and produced a plan that would have silently dropped the worktree-isolation that prevents a documented false-positive bug. CLAUDE.md flagged the constraint as an aside ("step 1: I'd note this... and may want to confirm before deleting"), but the plan walked toward removing it anyway.
Two things this clarifies:
The description is read but not weighted. Across four sub-agents and ~73 tool calls combined, /explain's description — even with imperative phrasing, "do NOT proceed directly to edits", and now an "INSTEAD of ADRs" redirect — produced zero invocations. The skill is competing against the agent's full native investigative toolkit (grep, read, git log, gh pr view), not against any single missing artifact like ADRs.
/explain's real value-add is narrow but real. The ADR-anchored agent (Test C) produced an excellent answer without/explain — commit message + PR description + architecture doc was sufficient. /explain adds value only when conversational reasoning is the only place a decision lives — the user's exploratory questions, the alternatives ruled out mid-conversation, the path through the decision space. Test D illustrates the case where this would have helped: the action-framed agent didn't even reach for the commit message, so it missed the rationale entirely. But the fix isn't /explain's description — it's the agent's habit of skipping git log --grep on action prompts.
Direct answer to your question: redirecting from ADRs to /explain is a clever framing but it doesn't survive contact with the agent's habits. ADRs aren't the actual competition; the agent's whole investigative toolkit is.
User
Plan: what I would do next
Behavioral / semantic change to flag: dropping the worktree suffix removes the isolation guarantee that lets two sessions in different git worktrees of the same repo (sharing .git) coexist. After this change, two worktrees pointing at the same base commit will collide on a single entire/<commit[:7]> branch. The user has explicitly asked for the simplification, so I'd implement it as requested — but I'd note this in commit message + doc updates and may want to confirm before deleting the worktree-isolation logic outright.
Simplify ShadowBranchNameForCommit(baseCommit, worktreeID string): ignore worktreeID, return ShadowBranchPrefix + commitPart. (Keep parameter for source compatibility, or drop it and update all callers — preference: drop it, much cleaner; option: keep it for one release with a deprecation comment.) Decision: drop the parameter — clean break, single grep-able fix.
Simplify ParseShadowBranchName to return only (commitPrefix, ok).
Delete HashWorktreeID and the WorktreeIDHashLength constant.
Update doc comments.
Step 2 — WriteTemporaryOptions/ListTemporaryCheckpointsOptions in checkpoint/checkpoint.go: drop the WorktreeID field if no longer needed for naming. Keep it on SessionState as informational metadata (used by sessions.go:152 for display); remove from path-construction call sites. Or simply drop everywhere if user prefers — I'd default to dropping everywhere since the user asked to "simplify."
Step 3 — Update all callers to drop the second arg / state.WorktreeID pass-through:
ParseShadowBranchName(branchName) returns (commitPrefix, worktreeHash, ok). Already handles old format entire/abc1234 (no dash) — returns worktreeHash="".
Format regex:cmd/entire/cli/strategy/cleanup.go:65 — ^entire/[0-9a-fA-F]{7,}(-[0-9a-fA-F]{6})?$ (the (-...)? is already optional, so dropping the suffix won't break IsShadowBranch).
Worktree-aware filtering being removed:cmd/entire/cli/explain.go:1542-1554 (getCurrentWorktreeHash) and :1785-1817 (getReachableTemporaryCheckpoints filters shadow branches by worktree hash). With single-namespace branches, this filter no longer makes sense.
WorktreeID field on SessionState (session/state.go:60-62, set by manual_commit_session.go:294-320): currently used (a) to compute the shadow branch name and (b) appears in CLI session listings. After the rename, only purpose (b) remains — could keep the field as informational metadata or drop it.
Call sites of ShadowBranchNameForCommit(baseCommit, worktreeID) (all pass a worktreeID argument):
Bash (parallel with #4):grep -rn "ShadowBranchPrefix\|shadowBranchPrefix\|HashWorktreeID\|getWorktreeHash\|getCurrentWorktreeHash" /Users/georgf/src/entirehq/cli --include="*.go" | head -50 — found HashWorktreeID callers, getCurrentWorktreeHash helper in explain.go, shadowBranchPrefix const in strategy/common.go:306, and dispatch/mode_local.go:342.
Read:/Users/georgf/src/entirehq/cli/cmd/entire/cli/checkpoint/temporary_test.go (full file) — saw all three test functions: TestHashWorktreeID*, TestShadowBranchNameForCommit, TestParseShadowBranchName, TestParseShadowBranchName_RoundTrip.
Bash:grep -rn "ShadowBranchNameForCommit\|ParseShadowBranchName\|WorktreeIDHashLength" /Users/georgf/src/entirehq/cli --include="*.go" | head -60 — enumerated all callers across , , , , , , , , plus internal uses in .
Auto-compaction summaries are gold. Checkpoint #1 starts mid-session, but the Claude auto-compact summary at the top spelled out: primary intent, technical concepts, root cause, errors and fixes, all user messages verbatim, problem-solving steps. This is the highest-density decision artifact in the sample, and it's a system-generated one. The skill should special-case extracting these — they often beat any human-written summary.
Failure modes that did not show up in this sample:
"Decision made off-transcript" (PR review, Slack, meeting) — none observed in the 4 read. PR-review roundtrips did show up (#2 has Cursor Bugbot + Copilot review feedback, integrated into the transcript via the user pasting comments). That's a partial inoculation: bot reviews pasted back in are preserved; private chat is lost.
"Buried under noise" — happens (#3) but the noise is downstream implementation churn, not topic drift. Still recoverable via search.
What I'd build given this:
A skill that takes a question or symbol, does entire search --json for hits, follows Entire-Checkpoint: trailers from any matched commits, prefers checkpoints that contain a compaction-summary block, and if the top hit is implementation-thin, walks backward by session and by file-path-anchored search until it finds reasoning-dense content. Roughly: search → trailer → scan for compaction summary → fall back to session-backward-walk.
entire explain
Walk-back via function/symbol name is more powerful than expected. Q5's original decision predates the OSS repo, but searching HardResetWithProtection surfaces follower decisions that cite the same pattern as precedent — "consistent with existing patterns like HardResetWithProtection and CheckoutBranch". The why for foundational decisions often lives transitively in their imitators. This deserves explicit mention in step 5 of the skill.
The current walk-back trigger is too narrow. I described it as "when the linked checkpoint is thin." But Q3 and Q5 showed a different failure mode: the retrieval missed, not the transcript depth. The skill should walk back when no top hit's snippet directly addresses the question, not just when transcripts are mechanical.
One bug in the skill text: step 5's "thin checkpoint" trigger covers the transcript-depth case but doesn't mention the retrieval-miss case. I'll tighten that now.
CLAUDE.md is the only working channel today, and it doesn't scale. Both agents found their safety signal there. But CLAUDE.md can't enumerate every decision; the moment a constraint isn't called out by name, the safety net is gone. /explain was supposed to fill that gap — and didn't, because nothing pointed agents at it.
A hook is probably required for real autonomous use. A pre-edit hook on files in cmd/entire/cli/strategy/, state.go, agent integration directories, etc., that auto-invokes /explain <file> and surfaces the result to the agent before letting the edit land. That's a settings.json change, not a skill change.
My read: the skill is a useful primitive (the eval showed it works when called), but right now it's mostly useful for humans asking "tell me why this exists" — not for agents about to revert prior reasoning. Closing the autonomous-use gap is a CLAUDE.md edit + a hook, not another skill edit. Want me to draft a CLAUDE.md addition and a hook config, or is "skill works for human invocation, autonomous use needs harness work" the right place to stop?
your
Why a hash and not the worktree name itself — from 48e7f2942 (GetWorktreeID): the function returns the internal git worktree identifier from .git/worktrees/<name>/, which "is stable across git worktree move operations, making it ideal for worktree-specific shadow branch naming." From 619f25fd2 (HashWorktreeID): the worktree ID is hashed to produce a "short, deterministic" 6-char suffix — this normalizes arbitrary worktree names (which can include /, spaces, or other characters not legal in git refs) and bounds the branch-name length.
Where it's documented going forward:
/Users/georgf/src/entirehq/cli/CLAUDE.md — the strategy section explicitly calls out: "Worktree-specific branches — each git worktree gets its own shadow branch namespace, preventing conflicts" and "Note: Different git worktrees have separate shadow branches (worktree-specific naming), so concurrent sessions in different worktrees do not conflict."
/Users/georgf/src/entirehq/cli/docs/architecture/sessions-and-checkpoints.md — defines the format entire/<commit[:7]>-<worktreeHash[:6]> and documents the migration behavior on stash/pull/rebase.
/Users/georgf/src/entirehq/cli/docs/architecture/checkpoint-scenarios.md — describes shadow branches as entire/<commit-hash>-<worktree-hash>.
Source-level docs: ShadowBranchNameForCommit and HashWorktreeID in /Users/georgf/src/entirehq/cli/cmd/entire/cli/checkpoint/temporary.go, and GetWorktreeID in /Users/georgf/src/entirehq/cli/cmd/entire/cli/paths/worktree.go.
TL;DR rationale
Two worktrees of the same repo can sit on the same base commit. Before this change the shadow branch was named purely from the commit hash (entire/<commit[:7]>), so two worktrees collided on a single git ref — a session starting in worktree B saw worktree A's shadow branch and threw a spurious "Shadow branch conflict detected." The fix gives each worktree its own ref namespace by appending a 6-hex-char SHA-256 hash of the internal git worktree ID (the directory name under .git/worktrees/, which is stable across git worktree move). The empty worktree ID (main worktree) hashes deterministically too, so main and linked worktrees coexist without special-casing. Cross-worktree ShadowBranchConflictError was deleted as no longer reachable; same-worktree SessionIDConflictError was preserved.
<total_tokens>72322</total_tokens><tool_uses>25</tool_uses><duration_ms>129441</duration_ms>
My final read on this thread:
For user-asked "why" questions, /explain works well (the eval showed 3/5 perfect, 2/5 walk-back recovered). Ship it for that.
For autonomous pre-edit consultation, no skill-only mechanism we've tried lands. The agent's native tools cover ~80% of the value (commit + PR + arch doc) and the skill can't out-compete them.
The autonomous-use case is genuinely a harness problem, not a skill problem — a PreToolUse hook on Edit/Write that injects prior reasoning is the only mechanism that doesn't depend on the agent choosing well. That's what I'd build next if closing this loop matters.
Where would you like to take this — accept "skill is for human use, autonomous needs a hook," prototype the hook, or test one more skill-only variant before concluding?
integration_test/testenv.go
paths.GetWorktreeID
benchutil/benchutil.go (only if it constructs branch names — it doesn't, it just records metadata; leave alone)
Step 4 — explain.go:
Delete getCurrentWorktreeHash and the test TestGetCurrentWorktreeHash_MainWorktree.
Remove the per-worktree filter loop in getReachableTemporaryCheckpoints. (After change, all shadow branches under reachable base commits show up regardless of worktree.)
Step 5 — strategy/cleanup.go regex: tighten shadowBranchPattern to ^entire/[0-9a-fA-F]{7,}$ (remove the optional (-[0-9a-fA-F]{6})? group). Update the doc comment block.
Step 6 — Tests:
checkpoint/temporary_test.go: delete TestHashWorktreeID*. Rewrite TestShadowBranchNameForCommit to expect entire/abc1234. Rewrite TestParseShadowBranchName and round-trip test for the simpler format. Add a backward-compat parse test if we want to still accept the legacy entire/<commit>-<wkhash> shape (recommend: yes — IsShadowBranch regex should still match old branches so cleanup can delete them, but ParseShadowBranchName should accept either).
strategy/manual_commit_test.go: rewrite TestGetShadowBranchNameForCommit to drop mainWorktreeHash and the worktreeID field.
cmd/entire/cli/explain_test.go: drop the getCurrentWorktreeHash test.
Sweep clean_test.go, doctor_test.go, reset_test.go, integration_test/* for hardcoded worktree-hash references.
Step 7 — Backward compatibility for old shadow branches at upgrade time: consider whether to keep IsShadowBranch regex tolerant of the old -<wkhash> form so entire clean can still find and delete leftover branches from prior CLI versions. Recommend keeping the regex permissive: ^entire/[0-9a-fA-F]{7,}(-[0-9a-fA-F]{6})?$ and only changing the producer (ShadowBranchNameForCommit). This avoids stranding branches users created with the old CLI. Document this in the commit message.
Step 8 — Docs: update CLAUDE.md, AGENTS.md, docs/architecture/sessions-and-checkpoints.md to drop worktree-suffix references and rewrite the "Different git worktrees have separate shadow branches" caveat to note that worktrees on the same base commit now share a shadow branch (potential conflict source).
Step 9 — Verify:mise run fmt && mise run lint && mise run test:ci (per project's required pre-commit checklist), plus mise run test:e2e:canary since shadow-branch naming is exercised by Vogon E2E flow.
Open questions I'd flag to the user before implementing:
Drop WorktreeID from SessionState entirely, or keep as informational metadata? (Recommend: keep — used in session display and is cheap.)
Keep IsShadowBranch regex tolerant of the old format for one release (to allow entire clean to clean up legacy branches)? (Recommend: yes.)
Drop the worktreeID parameter from ShadowBranchNameForCommit entirely or keep it (ignored) for source compatibility? (Recommend: drop — cleaner, and grep-able mass-update.)
<total_tokens>87748</total_tokens><tool_uses>25</tool_uses><duration_ms>151390</duration_ms>
clean.go
reset_test.go
doctor.go
doctor_test.go
clean_test.go
integration_test/testenv.go
integration_test/*_test.go
checkpoint/checkpoint_test.go
temporary.go
Bash (parallel with #8):grep -rn "WorktreeID\|worktreeID" /Users/georgf/src/entirehq/cli/cmd/entire/cli/checkpoint --include="*.go" | head -40 — saw WorktreeID field in WriteTemporaryOptions and ListTemporaryCheckpointsOptions structs in checkpoint.go.
Bash:grep -rn "WorktreeID\|worktreeID\|WorktreeIDFor\|getWorktreeID" /Users/georgf/src/entirehq/cli --include="*.go" | grep -v "_test.go" | head -60 — mapped all non-test callers across clean.go, sessions.go, explain.go, doctor.go, integration_test/testenv.go, checkpoint.go, temporary.go, benchutil.go, paths/worktree.go, strategy/manual_commit_session.go, etc.
Bash (parallel with #10):grep -rn "WorktreeID\|worktreeID\|getShadowBranchNameForCommit" /Users/georgf/src/entirehq/cli/cmd/entire/cli/strategy --include="*.go" | grep -v "_test.go" | head -60 — enumerated strategy-package call sites in manual_commit_session.go, manual_commit_rewind.go, manual_commit_logs.go, manual_commit_git.go, manual_commit_hooks.go, manual_commit_condensation.go, manual_commit_reset.go, manual_commit_migration.go, cleanup.go.
Bash (parallel with #10/#11):grep -rn "currentWorktreeHash\|branchWorktreeHash\|WorktreeHash" /Users/georgf/src/entirehq/cli --include="*.go" | head -40 — found getCurrentWorktreeHash in explain.go:1542-1554, the parsed-shadow filter at explain.go:1789-1797, and the mainWorktreeHash := "e3b0c4" constant in manual_commit_test.go:701.
Read:/Users/georgf/src/entirehq/cli/cmd/entire/cli/strategy/manual_commit_test.go lines 680-770 — read the TestGetShadowBranchNameForCommit test cases (with the hardcoded "e3b0c4").
Read:/Users/georgf/src/entirehq/cli/cmd/entire/cli/strategy/manual_commit_session.go lines 280-344 — read initializeSession (which sets WorktreeID on SessionState) and the local getShadowBranchNameForCommit wrapper.
Bash:grep -rn "WorktreeID\b" /Users/georgf/src/entirehq/cli/cmd/entire/cli/session --include="*.go" | head -30 — confirmed WorktreeID field on SessionState (session/state.go:60-62).
Bash (parallel with #18):grep -rn "WorktreeID\|worktreeID" /Users/georgf/src/entirehq/cli/docs 2>/dev/null | head -30 — found doc references in docs/architecture/sessions-and-checkpoints.md lines 78 and 96.
Bash (parallel with #18):grep -rn "shadow branch\|shadow_branch\|ShadowBranch" /Users/georgf/src/entirehq/cli/docs 2>/dev/null | head -30 — collected doc mentions in security-and-privacy.md, claude-hooks-integration.md, commit-hook-perf-analysis.md, logging.md, sessions-and-checkpoints.md, checkpoint-scenarios.md.
Bash:grep -rn "WorktreeID\b" /Users/georgf/src/entirehq/cli --include="*.go" | wc -l (138 hits) and ... -l | head -30 — full file inventory of files that reference WorktreeID.
Read:/Users/georgf/src/entirehq/cli/cmd/entire/cli/paths/worktree.go (full file) — confirmed GetWorktreeID returns "" for main worktree, otherwise the linked-worktree internal name.
Bash (parallel with #22):grep -n "WorktreeID\|worktreeID" /Users/georgf/src/entirehq/cli/cmd/entire/cli/strategy/manual_commit_hooks.go | head -30 — six call sites at lines 1172, 1565, 2309, 2434, 2490, 2906.
Bash (parallel with #22):grep -rn "AGENTS.md\|CLAUDE.md" /Users/georgf/src/entirehq/cli -name "*.md" 2>/dev/null | head; ls /Users/georgf/src/entirehq/cli/AGENTS.md — confirmed AGENTS.md exists.
Bash:grep -n "shadow\|worktreeHash\|worktree-hash\|worktreeID\|WorktreeID" /Users/georgf/src/entirehq/cli/AGENTS.md | head -30 — confirmed AGENTS.md mirrors CLAUDE.md shadow-branch docs at lines 392-403, 464, 582, 608-625.
Bash (parallel with #25):grep -rn "concurrent session\|same directory\|different worktree" /Users/georgf/src/entirehq/cli --include="*.go" --include="*.md" | head -20 — confirmed CLAUDE.md/AGENTS.md describe the worktree-specific isolation guarantee that the user is removing.
No Skill, ToolSearch, Edit, or Write calls were made. No Monitor or background processes were started.