Skip to content

adamayoung/TMDb / .claude/skills/deliver

deliver

Verified

FileKindSize
SKILL.mdskill md47.7 KB
references/auto-and-async.mdmarkdown9.5 KB
references/next-mode.mdmarkdown40.2 KB
references/reflexive.mdmarkdown3.0 KB
references/review-loops.mdmarkdown4.1 KB
references/worktree-lifecycle.mdmarkdown27.5 KB
references/wrap-up.mdmarkdown7.8 KB

references/worktree-lifecycle.md

View on GitHub
# /deliver — worktree lifecycle (reference)

Read on demand from `/deliver` **Phase 1** (enter) and **Phase 12** (teardown).
The rules live in `SKILL.md`; this file holds the procedures and the traps.

## Reconcile sweep procedure (Phase 1, before entering)

This run is the garbage collector for the *previous* delivery's deferred merge —
Phase 12 only fires on an in-session merge, and the common path is "merged
later, elsewhere". It also catches runs that **died before opening a PR**, which
the old merged-PR-keyed sweep could not see at all.

> **Enumerate with `git worktree list --porcelain` — never `ls
> .claude/worktrees/`.** That directory is a **CWD-relative** path that **does
> not exist inside a worktree**, so the old sweep silently enumerated *nothing*
> whenever `/deliver` ran from one — passing while doing no work. A sweep that
> reports "0 items, all clean" because it looked in the wrong place is the
> **False green** family (`knowledge/gotchas.md`).

**Scope: only worktrees under `<main-root>/.claude/worktrees/`.**
`git worktree list` reports the **main checkout first** and every worktree of
the repo, including ones you created by hand elsewhere. Skip the main checkout
and anything outside that directory — a worktree `/deliver` did not create is
outside its remit, and removing a hand-made workspace is not a GC, it is data
loss.

```bash
main_root=$(git worktree list --porcelain | awk '/^worktree /{print $2; exit}')
git worktree list --porcelain | awk -v r="$main_root/.claude/worktrees/" \
  '/^worktree /{p=$2} /^branch /{if (index(p, r)==1) print p, $2}'
```

1. Get every PR's state in **one** call — `mcp__github__list_pull_requests`
   (owner/repo from the `origin` remote, `state: all`, `perPage: 100`) — and
   build a `head.ref → {open, merged}` map (a merged PR reports `state: closed`
   + `merged: true`). Tool calls can't run inside a bash loop, so gather first,
   then act.
2. Classify each in-scope worktree **top-to-bottom, first match wins** — the
   rows overlap deliberately, so order carries the safety:

   | # | Bucket | Test | Action |
   | --- | --- | --- | --- |
   | 1 | `live` | lock PID **alive** | **Never touch.** Another session owns it |
   | 2 | `report` | lock absent, unparseable, or not written by `/deliver`; `@{u}` errors; removal refused | **Report, never remove** |
   | 3 | `reclaim` | PR **merged** *and* both Phase 12 proofs | Unlock → remove → **verify gone** |
   | 4 | `resumable` | PID **dead**, run file `open`, **no PR at all** | Adopt, or leave standing |
   | 5 | `settled` | run file whose worktree is already gone | Close the file; no worktree action |
   | 6 | `report` | everything else | **Report, never remove** |

   Rows 2 and 6 make this total: **nothing can fail to classify**, so the sweep
   can never brick the pipeline on an unrecognised state.

3. **Release stranded selection claims** — the canonical procedure; `SKILL.md`
   Phase 1 summarises it. For every run file whose `mode` names a
   **selection-policy token** (`next` or `explicit`) **or which carries a
   `selection.policy`** — two witnesses, because a hand-written `mode` has
   already been observed missing its token on a real run — with `pr: null`,
   `status: open`, no `claimHandedBack`, and `selection.claimed` not `false`:
   test its `conductorPid` with `kill -0`. **Dead** → move that issue back to
   **`selection.claimedFrom`** (defaulting to **Ready** when the field is
   absent, which is every pre-change run file), stamp
   `claimHandedBack: <iso8601>` on the deliverable, and count it. **Alive,
   `EPERM`, or no parseable PID** → leave it and report it, cross-checking a
   suspiciously old PID against `ps -p <pid> -o lstart=` exactly as the
   lock-liveness rule does. Every clause is load-bearing:

   + **Release to `claimedFrom`, never unconditionally to `Ready`.** An
     `explicit` pick may have been claimed out of **Backlog**, and returning
     that to `Ready` would promote untriaged work past `/triage-issues`' Ready
     test with no Priority or Size — giving that column a second owner and
     feeding unvetted work to the next unattended `next` run. This sweep runs
     in a *later, different session* than the run it cleans up, so the origin
     column has to have been persisted at claim time
     ([`next-mode.md`](next-mode.md) §6); it cannot be inferred here.
   + **`selection.claimed` not `false`** — that run's claim write failed and it
     proceeded unclaimed ([`next-mode.md`](next-mode.md) §6). It never held the
     issue, so there is nothing to give back — and by now another run may
     legitimately hold it.
   + **`claimHandedBack` makes the release idempotent.** The predicate is
     otherwise still true after a release, so every later run re-releases the
     same issue — and once anyone has legitimately re-claimed it, that repeat
     is a theft rather than a recovery. Nothing else closes the file: bucket 4
     explicitly permits a dead run file to be left standing.
   + **Evaluate the predicate at two scopes** — it mixes them, and only looks
     unambiguous at one deliverable. `mode`, `conductorPid` and
     `selection.claimed` are **run**-scoped; `pr`, `status`, `issue` and
     `claimHandedBack` are **per-deliverable**. Walk the deliverables and
     release + stamp **each qualifying one independently**, rather than asking
     whether "the run" has a PR — a batch where deliverable 1 has merged and
     2–3 are still open otherwise either never releases anything or strands
     the rest behind one stamp. (A selection pick *can* decompose: Phase 0's
     decomposition runs after selection.) One corollary: `claimed: false`
     suppresses the release of `selection.picked`'s issue **only** — a batch's
     other issues reached **In progress** via Phase 1 step 5, not via the
     claim, so that flag never described them.
   + **Key on the PID, never on the worktree buckets.** `resumable` tests the
     PID, but `settled` tests no liveness at all — and, decisively, a selection
     run holds its claim from **Phase 0, before any worktree exists to
     classify**. A bucket-keyed rule therefore either releases a **live**
     conductor's claim while it waits at the approval stop (re-opening the
     double-delivery the claim prevents, in the exact window it was designed
     for) or never releases it at all. The PID test is the only thing that
     separates those two.
4. Record one ledger line: `reconciled: <n> in scope / <k> reclaimed / <r>
   resumable / <o> reported / <c> claims released`, and carry it into the retro
   (Phase 8). **Claims released needs its own slot**, not a share of an existing
   one — see the `swept:`/`reconciled:` incident below for what happens when two
   counts contend for one key.
   **The key is `reconciled:`, never `swept:`** — `swept:` belongs to Phase 7's
   knowledge-retirement sweep, and when both wrote the same key the Phase 7 form
   occupied the slot for four consecutive deliveries while this tripwire went
   missing unnoticed. A filled slot looked identical to the right one. See
   `SKILL.md` Phase 1 and `references/wrap-up.md`'s retro format.

### Liveness is a fact, not a timeout

`EnterWorktree` writes `.git/worktrees/<name>/locked` containing
`claude session <branch> (pid <PID> start <time>)`. **Test the PID** —
`kill -0 <pid>` — and never infer liveness from a file's age: a normal Phase 3
or Phase 9 goes quiet for far longer than any plausible timeout, so an
mtime heuristic will eventually adopt a **running** delivery and put two
conductors and two Swift builds in one scratch directory.

+ PID **alive** → `live`. Never touch, under any circumstances. (Treat an
  `EPERM` from `kill -0` as alive.)
+ PID **reused** by an unrelated process is possible on a long-lived machine;
  it fails *safe* (a false `live`). To avoid blocking resume forever,
  cross-check the lock's `start` against `ps -p <pid> -o lstart=`.
+ Lock **absent, unparseable, or not `/deliver`'s** → `report`. Never guess.
+ The lock **outlives the session that made it**, so a dead-session worktree is
  still locked: `git worktree remove --force` **refuses** on it. Unlock first
  (`git worktree unlock <path>`), and if removal still refuses, that is bucket 2
  — report it with the unlock hint. **A refused removal must never be counted as
  `reclaimed`**; verify the directory is gone before reporting one.

### Removal keeps Phase 12's proofs

Reclaiming uses the *same* two proofs Phase 12 demands, not a weaker bar:
`pull_request_read → merged: true`, **and** `git status --porcelain` empty
**and** `git rev-parse HEAD` equal to `git rev-parse @{u}`.

> `@{u}` **errors** (rather than returning false) on a never-pushed branch, so
> treat that as *unproven* → `report`, not as a failed comparison.

```bash
git worktree unlock "$wt" 2>/dev/null
git worktree remove "$wt" && git branch -D "$br" 2>/dev/null
test -d "$wt" && echo "STILL PRESENT — report, do not count as reclaimed"
```

`git branch -D`, not `-d`: this repo squash-merges with `deleteBranchOnMerge`,
so the branch's commits are never literally on `main` and `-d` refuses once the
remote-tracking ref is pruned — leaking the branch while the sweep reports
success.

Empty leftover directory husks can be cleared with
`find "$main_root/.claude/worktrees" -type d -empty -delete`.

## Run state, reconcile & resume

The `TaskCreate` ledger is **not** durable — `SKILL.md` states it is cleared by
`EnterWorktree`, an MCP reconnect, or a plan-mode exit. So a run that dies
mid-pipeline loses the rubric, the decomposition and every phase's status. The
run file is the durable half.

**Location:** `$(git rev-parse --path-format=absolute --git-common-dir)/deliver/<id>.json`
— i.e. `<main checkout>/.git/deliver/`. Chosen because it **cannot enter a diff
by construction** (`.git` is not a working-tree path, so it can never appear in
`git status`, `git diff`, or `git add -A`), it is **shared by every worktree**
via the *common* dir so batch state is reachable from any of them, and it
**survives `ExitWorktree(remove)`** so deliverable 1's teardown doesn't destroy
the state of deliverables 2..N. `<id>` is the slug plus an ISO timestamp — the
branch does not exist yet when Phase 0 writes it.

**The gate is a data dependency, not a checklist item.** Phase 0 writes the file
**before** Phase 1; Phase 1 records its reconcile result into it; **Phase 6
reads the rubric from it**. Skipping the sweep therefore doesn't merely omit a
step — it removes the input a later *mandatory* phase requires, so the run fails
loudly instead of silently. **A missing run file at Phase 6 is a hard stop**,
exactly as a dead grader is not a pass. `rubric: none` (present, empty) is the
sanctioned rubric-less path and is *not* the same as a missing file.

**Writing it from inside a worktree — use `Scripts/deliver-runfile.py`, and
never assume a write landed.** Phase 0 writes the file *before* `EnterWorktree`,
so no guard applies there. Later updates do: a worktree-isolated session refuses
`Bash` commands it cannot statically prove stay inside the worktree, and
`.git/deliver/` is outside it **by design** (it lives in the common git dir).
`Edit`/`Write` on that path are refused too, and some `Bash` refusals are
**silent** — a heredoc rewrite produced no output, no error and no write
(PR #474), and in the #493 delivery two unnoticed refusals led the conductor to
certify a plan revision to the juror panel that was not on disk. So every
post-Phase-0 run-file update goes through the script (ADR-0015 addendum):

```bash
python3 Scripts/deliver-runfile.py set /abs/literal/.git/deliver/<id>.json \
  deliverables.0.stamps.reviewedClean "<content hash>"
```

Single-purpose, fully literal arguments — the shape the guard accepts — and the
script **verifies its own postcondition**: it re-reads the file from disk and
exits non-zero (`2`) if the value is not there, printing `verified: <path> =
<value>` when it is. **Treat any exit other than 0 as a hard stop on the phase's
write, never as done** — a run-file write that reports nothing has told you
nothing, and a phase that carries on regardless ends up certifying state that
does not exist. Ad-hoc `sed`/heredoc routes are retired; the guard-shape detail
lives in `knowledge/gotchas.md` → *In a worktree session, Bash refuses commands
it can't prove stay inside it*.

`rubricProvenance` records where the ACs came from — `supplied` when the plan
carried them, or `derived — <source>` when Phase 0 derived them from a linked
issue or an explicit test list (its second entry-gate case). It exists so a
derived rubric is auditable rather than indistinguishable from a supplied one:
Phase 6 grades both identically, but a reader can tell which was which, and the
PR body is required to say so. A plan drafted by a **selection run** — under either policy — is never
`supplied`,
however many ACs its text carries — the `Plan` agent wrote them, and `supplied`
is a claim that a human set the bar.

```json
{
  "id": "harden-delivery-skills-2026-07-29T19:28:23Z",
  "goal": "…", "weight": "full",
  "reflexive": false,
  "consulted": "gotchas §False green, §Docs scratch path; ADR-0014",
  "reconciled": { "inScope": 1, "reclaimed": 0, "resumable": 0, "reported": 0,
                  "claimsReleased": 0 },
  "mode": "auto merge next",
  "conductorPid": 90982,
  "planReview": "forced — auto-top-of-run-list",
  "invocation": "auto merge next",
  "selection": {
    "policy": "top-of-run-list",
    "requested": null,
    "source": "run-list@cc7cba55",
    "verifiedAt": "527682f7",
    "listed": 12, "picked": 448, "breakingClass": "none", "claimed": true,
    "claimedFrom": "Ready", "mergeRefused": null,
    "authorAssociation": "OWNER",
    "passedOver": [{ "issue": 434, "why": "filtered — closed, still showing Ready" }],
    "rejected": [{ "issue": 426, "verdict": "needs-decision", "why": "three competing fixes; demoted" }]
  },
  "deliverables": [{
    "title": "…", "issue": 448, "dependsOn": [],
    "worktree": "…/.claude/worktrees/chore+harden-delivery-skills",
    "branch": "chore/harden-delivery-skills",
    "entry": "created",
    "claimHandedBack": null,
    "rubric": ["Given …, when …, then …"],
    "rubricProvenance": "derived — issue 448",
    "stamps": { "reviewedClean": "<content hash>", "securityClean": null,
                "rubricGraded": null },
    "openFindings": [], "knowledgeCandidates": [], "pr": null,
    "status": "open"
  }]
}
```

A **batch is the N=1 case generalised** — more entries in `deliverables[]`. No
separate mechanism, and it is the only state that survives Phase 10's
background-watch handoff, where the conductor moves to the next worktree.

Seven run-scoped fields sit outside `deliverables[]` because they describe the
run, not a deliverable. **`consulted`** is Phase 0's knowledge-consult proof —
the ledger that would otherwise hold it does not survive `EnterWorktree`, so
this is its durable home, and Phase 8 copies it into the retro.
**`reflexive`** is true when the diff touches the **reflexive set** —
`.claude/skills/**`, `.claude/agents/**`, `.claude/workflows/**`,
`.claude/docs/**` or `.github/CODE_REVIEW.md` — which changes what Phases 4
and 5 do (see `SKILL.md` Phase 0). That set is **defined** in `SKILL.md`
Phase 0 and quoted here and in [`next-mode.md`](next-mode.md) §5b; all three
must match exactly — **change all three or none**.

`Scripts/tests/test_deliver_selection_prose.py` asserts they do, because this
copy had already drifted (it omitted `.claude/workflows/**`, the glob covering
`deliver-panel.js` — the script defining the panel that authorises unattended
work) while `SKILL.md` still claimed the set was quoted in exactly one other
place. A field mandated by a phase but absent from
this schema is a field nothing ends up writing.

**`planReview`** records the one sanctioned override of the weight rule: an
`auto` run under **either** selection policy always runs `/review-plan`'s
critics, because nobody read its
self-drafted plan. Its value is `forced — auto-<policy>`, so
`forced — auto-top-of-run-list` or `forced — auto-explicit`. Naming an issue
yourself does not exempt the run: it puts a human between you and the *issue*,
not between anyone and the *plan*. It exists as a
field rather than a habit for the reason this whole file exists — Phase 6
hard-stops when an `auto` selection run reaches the gate without it, so "the
critics were skipped" cannot look identical to "the critics ran".

**`mode`**, **`conductorPid`**, **`invocation`** and **`selection`** belong to
**selection runs**
under either policy ([`next-mode.md`](next-mode.md)). `mode` and `conductorPid`
are written **when
Phase 0 parses the invocation keywords — before selection runs**, not after it.
`conductorPid` in particular is written for *every* selection run, not just
`next` ones: it is the only thing Phase 1's sweep can test, so a run that omits
it holds its claim for good.

**`mode` is a space-separated set drawn from `auto`, `merge`, `next` and
`explicit`**, of which **`next` and `explicit` are the two selection-policy
tokens**. Four gates key on "does `mode` name a policy token?" rather than on
the literal word `next` — Phase 1's stranded-claim sweep, Phase 6's selection
and `planReview` stops, and Phase 10's merge-drop. Keeping `next` *as* a policy
token is what makes backward compatibility structural: a run file written before
`explicit` existed carries `"mode": "auto merge next"` and satisfies all four by
construction, with no legacy clause to maintain. `Scripts/tests/test_deliver_selection_prose.py`
asserts each of the four **primary** statements in `SKILL.md` still names both
tokens, and that this file's restatements do too.

**`invocation`** is the raw argument string, verbatim. A reflexive change to the
grammar cannot be dogfooded before merge, so recording what was actually typed
next to what it was parsed as is the cheapest thing that makes a mis-parse
*provable after the fact* rather than a matter of recollection.
That ordering is the whole point: written afterwards, a run that skipped
selection would carry neither field and grade as an ordinary run, which is
precisely the green the gate exists to catch.

`mode` records the **whole parsed invocation** — `"auto merge next"`, not
`"next"`. `auto` and `merge` are read after the point where they could still be
remembered: Phase 6's `planReview` stop runs past an `EnterWorktree`, and Phase
10's merge-drop runs in the background, potentially in a resumed session. A
keyword kept only in the ledger is a keyword those two phases silently no-op on.

**`conductorPid`** is what makes a stranded claim recoverable — step 3 above
owns the sweep it feeds and the PID-not-buckets rationale.

`selection` records how the issue was chosen —
the ordering source and its sha, the sha every candidate was re-verified
against, the pick, its `Breaking class`, whether the claim actually landed
(**`claimed`**), every candidate a verifier **`rejected`** with its verdict, and
every candidate **`passedOver`** without one. It is **read, not merely
written**: Phase 6 hard-stops when `mode` names a selection-policy token
(`next` or `explicit`) and `selection` is missing
or empty, the same way it does on a missing `reconciled` block, and Phase 1's
sweep reads `claimed` to decide whether this run has a claim worth releasing at
all. Both fields are absent on an ordinary run, and a policy token without
`selection` is the failure the gate exists to catch — not a default.

**`claimHandedBack`** sits on the **deliverable**, not here, because it is
written by a *later* run than the one it describes: Phase 1's sweep stamps it
when it hands a dead run's issue back to its `claimedFrom` column (step 3 above
owns the idempotency rationale). An adopt of a run carrying it must re-claim
before resuming (`SKILL.md` Phase 1).

`rubricProvenance` on a selection run is always `derived — issue <number>`; see
the note above on why it is never `supplied`.

**`issue`** is per-*deliverable*, not run-scoped: a batch can implement several
issues, or none. It is the GitHub issue number this deliverable closes, or
`null` when the work is untracked. Phase 1 reads it to move the issue to **In
progress** and Phase 10 to move it to **In review** (columns and call:
[`.github/ISSUE_FILING.md`](../../../../.github/ISSUE_FILING.md) → *Board status
— the column lifecycle*). It lives here rather than in the ledger for the reason
the whole file exists — `EnterWorktree` clears the ledger, and Phase 10 runs in
the background, potentially long after the conductor has moved on.

### Stamps: hash content, never a commit

`/pr` rebases onto `origin/main`, which **rewrites every SHA**, so a commit-sha
stamp is void after every rebase by construction. And Phases 7-9 commit to
`knowledge/` (capture, retro, PR-number backfill), which would void a
commit-based stamp for changes nobody needs re-reviewed. Hash the *reviewable
content* instead:

```bash
git ls-tree -r HEAD | grep -v $'\tknowledge/' | git hash-object --stdin
```

> **Not `git ls-tree -r HEAD -- . ':!knowledge'`** — `ls-tree` has no exclude
> pathspec magic; it fails, `hash-object` reads empty stdin, and you get git's
> empty blob `e69de29b…` *every time*, so two stamps compare equal while
> measuring nothing (`knowledge/gotchas.md`).

**Honouring an equal stamp also requires `git status --porcelain` empty** — the
stamp hashes `HEAD` only, so uncommitted or untracked post-review edits are
invisible to it. Equal stamp **and** clean tree → the review still holds;
anything else → re-review. When the whole diff vs `main` is under `knowledge/`
the stamp is **vacuous** (it cannot move), so re-grade rather than inherit.

**Resume rule:** re-enter the recorded worktree, restore rubric, decomposition,
findings and knowledge candidates into a fresh ledger, then advance to the
**earliest** phase whose evidence is absent or whose stamp no longer matches.
Phases 1, 3, 7, 8, 9, 10 and 12 have ground truth in git or the PR — trust that
over the file. Phases 4, 5 and 6 leave no trace, which is exactly why they are
stamped.

### Adoption

Enter an existing worktree with `EnterWorktree(path: <recorded path>)` and set
`entry: "adopted"`. Flip the run file's status **before** re-locking, so two
concurrent resumes cannot both adopt. Abandoning a resumable run instead
requires the branch **pushed** or the worktree **left standing** — abandonment
must never destroy unpushed commits.

## Entering

+ `EnterWorktree(name: "feature/<slug>")` creates the worktree under
  `.claude/worktrees/` and switches the session into it. This is the
  sanctioned auto-use for `/deliver` — do it without asking.
+ **Verify the branch name after entering** — the tool has been seen to name
  the branch `worktree-<slug>` (with `/` → `+`) instead of the requested name
  (`knowledge/gotchas.md`). Rename before any push:
  `git branch -m feature/<slug>` (safe — nothing is pushed yet), and confirm
  with `git branch --show-current`.
+ **Base ref:** by default (`worktree.baseRef: fresh`) the branch is cut from
  **`origin/main`**; with `worktree.baseRef: head` it's cut from local HEAD —
  don't assume `origin/main` unconditionally. The `fresh` consequence: any
  **uncommitted or local-only** state (including an uncommitted on-disk plan
  file) is **absent** from the worktree — which is why Phase 0 reads the
  plan's content into the conversation first.
+ **Already in a worktree?** Don't nest — use the current worktree and just
  create the branch in it (`git checkout -b feature/<slug>`). `EnterWorktree`
  refuses to nest anyway.

## Confirm `.claude/settings.local.json` arrived

**`.worktreeinclude` copies it in.** The repo-root `.worktreeinclude` lists this
file (and `*.xctestplan`), and Claude Code copies every gitignored file it names
into each worktree it creates. So this is a **verification, not a copy**:

```bash
test -f .claude/settings.local.json || echo "MISSING — copy from the main checkout"
```

Missing → copy it from the main checkout and say so in the ledger, because a
worktree without it is a worktree that cannot authenticate.

**It carries the credentials, not just permissions.** `TMDB_API_KEY`,
`TMDB_USERNAME`, `TMDB_PASSWORD` and the two v4 tokens live in its `env` block
(`.claude/docs/tooling.md` → *Shell Environment*), and a fresh checkout has
none of them — so without this file `make integration-test` fails at
`.check-env-vars` and the v4
suites skip. Treat it as credential-bearing: never paste its contents, never
commit it. It stays gitignored inside the worktree.

Permission *approvals* no longer need copying at all: since Claude Code
v2.1.211 an approval granted in a worktree saves to the **main checkout's** copy
and applies across every worktree of the repo.

## The main-checkout path trap

A file `Read` *before* `EnterWorktree` yields a **main-checkout** absolute
path; continuing to `Edit` that exact path after entering writes to **`main`**,
not the worktree (they share `.git` but have **separate working dirs**). The
trap is self-concealing: the build/test then runs against the still-pristine
worktree and returns **baseline** counts, so a green run "confirms" work that
never landed (bit #359 via fanned-out subagents and #361 via the conductor —
see `knowledge/gotchas.md` → *Edits can land in the main checkout*).

Hence the Phase 1 checkpoint: after entering, **re-`Read` source files before
editing them**, and **verify `git status` shows your diff in the worktree
before trusting the first green build** (an empty diff + baseline test counts
= edits went to `main`). Rescue stranded edits with a shared stash:
`git -C <main-checkout> stash` then `git stash pop` in the worktree. When
fanning work out to subagents, give them worktree-absolute paths explicitly.

## Teardown procedure (Phase 12)

Both preconditions from `SKILL.md` verified (PR `merged: true`; tree clean
**and** `HEAD == @{u}`), then **branch on how the worktree was entered** — the
run file's `entry` field.

**`entry: "created"`** (this session made it) — the normal path:

```text
ExitWorktree(action: "remove", discard_changes: true)
```

**`entry: "adopted"`** (resumed from a previous run via `EnterWorktree(path:)`) —
`ExitWorktree` **only operates on worktrees it created in this session**, and
its own contract says a worktree entered by `path` "will not be removed; use
`action: "keep"`". Calling `remove` here **silently no-ops while you report a
reclaim** — a false green. Do it by hand instead:

```text
ExitWorktree(action: "keep")     # return to the main checkout first
```

```bash
git worktree unlock "$wt" 2>/dev/null   # EnterWorktree locked it
git worktree remove "$wt" && git branch -D "$br"
test -d "$wt" && echo "STILL PRESENT — report, do not count as reclaimed"
```

**Either path verifies the directory is gone before reporting a reclaim.**
`-D` not `-d`, for the squash-merge reason below.

+ `remove` deletes the worktree directory (which **is** its `.build` — the
  multi-GB reclaim) and the local branch, then returns the session to the
  main checkout.
+ `discard_changes: true` is needed only because a **squash**-merge lands the
  work as a *new* commit on `main`, so the branch's pushed-and-merged commits
  aren't *literally* on `main` and `ExitWorktree` would otherwise refuse. It
  is safe **only because** the preconditions proved there's nothing un-merged
  left to lose. Never pass it on an unverified tree.

**Leave the main checkout as you found it.** Do *not* auto-`merge --ff-only`
it: the user may be actively working there with uncommitted or diverged state.
Only if it is **clean and on `main`** (`git status --porcelain` empty) may you
fast-forward it (`git fetch origin && git merge --ff-only origin/main`);
otherwise just note "main checkout left as-is (N commits behind)". Report the
reclaimed worktree in the final summary.
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall