feat(dispatch-worktree-automation): I-phase Sub-wave A — WorktreeCreate hook + paired-negative test (Candidate D2) - #279
Merged
Conversation
…te hook + paired-negative test (Candidate D2)
* .claude/hooks/worktree-setup.sh (107 LOC) — WorktreeCreate command hook.
On `claude -w <name>`: create worktree under .claude/worktrees/<name>/,
branch `worktree-<name>`, base ref origin/HEAD with fallback chain
(origin/main → main → HEAD), symlink node_modules + packages/core/node_modules
from primary checkout (project D2 customisation vs tfriedel's npm install).
Idempotent, jq-graceful, exit 1 with diagnostic on missing .name /
unresolvable project root.
* packages/core/hooks/worktree-setup.test.ts (237 LOC) — 10 tests:
7 positive (path, both symlinks, branch name, idempotency, single-line stdout,
CLAUDE_PROJECT_DIR precedence) + 3 paired-negative (missing .name,
empty .name, unresolvable project root). Runs against per-test temporary
git repo via mktemp + git init; no real-repo mutation.
Stdin schema verified live 2026-05-29 via `claude --print --worktree probe
--settings '{...inline WorktreeCreate hook...}' "exit"` invocation — captured
payload reproduces {.session_id, .transcript_path, .cwd, .hook_event_name,
.name}. Closes PR #271 §8 ATTN 4 («schema NOT published in docs»).
Settings.json install is maintainer-applied per agent-uncommittable invariant
(deny-list blocks Edit/Write on .claude/settings.json) — HEREDOC diff in PR
body §Install.
Out of Sub-wave A scope (separate I-phase edit targets per PR #271 §8):
.gitignore line for .claude/worktrees/ (item 7), SKILL.md / template /
placeholders updates (items 1-5), prior-art-evaluations.md SSOT entries
(item 8). Hook delivers the underlying mechanism; downstream artefacts
migrate in follow-up batches per umbrella sequencing.
Prior-art: prior-art-evaluations.md#65 (Superpowers using-git-worktrees ADOPT — native-primitive mandate; this hook is the WorktreeCreate adapter that operationalises §65's Red Flag #1).
Prior-art: tfriedel/claude-worktree-hooks (ADAPT precedent per PR #271 §3 Candidate D2 — same architecture; we customise project-setup step from npm install to symlinks per meta-kickoff.template.md §4a workspace-optimisation pattern).
This was referenced May 29, 2026
Merged
artyhoo
added a commit
that referenced
this pull request
May 29, 2026
….6 antipattern bug #39886 backstop + template §4a removal (PR #271 §8 item 4) Extension of commit 193758a per amended kickoff scope. PR #279 hook (WorktreeCreate `.claude/hooks/worktree-setup.sh`) shipped on its own branch → unblocks PR #271 §8 item 4 «DELETE template §4a IFF D2 hook lands first». §4a content is replaced with a brief migration note pointing to PR #279 + parallel-subwave-isolation.md §1 fallback for unwired-hook / non-CC harness setups (forward-going annotation per dual-implementation-discipline.md §9 — not silent deletion). * SKILL.md §7.6 antipattern (line 353, `#worker-dispatch-via-subagent`): add empirical-backstop reference to bug #39886 (anthropics/claude-code#39886, closed-as- duplicate; Agent tool + isolation:"worktree" for WRITE tasks silently fails; read-only Agent dispatch remains OK). Applied via /tmp/iphase-skill-edit.py (idempotent + reversible recipe; state in /tmp/iphase-skill-revert-state.json; revert via /tmp/iphase-skill-revert.py). * meta-kickoff.template.md §4a (was lines 126-148): REMOVED. Replaced with one-paragraph migration note: PR #279 hook handles symlinks when registered; unwired-hook / non-CC consumers fall back to parallel-subwave-isolation.md §1. Stays out of scope (separate batches per PR #271 §8): * item 6: parallel-subwave-isolation.md §1 rule edit (add `claude -w` preferred channel) — Class-A rule, separate atomic per Artifact Ownership Contract. * item 7: .gitignore for .claude/worktrees/ — separate trivial atomic. * item 8: 3 new SSOT entries in prior-art-evaluations.md — separate append-only batch. Prior-art: skipped — prose migration following on the capability commit in PR #279 (which already cited SSOT #65 Superpowers using-git-worktrees ADOPT + tfriedel ADAPT); no new dep, no new ≥80 LOC file, no new packages/core subdir. Bug-#39886 is an external evidence citation, not a new SSOT entry.
artyhoo
added a commit
that referenced
this pull request
May 29, 2026
…ceptance test (step count 7→2 verified) (#284) Acceptance report for the dispatch-worktree-automation I-phase (PR #279 hook + PR #282 skill prose). Measures kickoff §4 criterion 2 (step count ≤2) on two real, independent `claude -w` dispatches: - Primary: THIS session was spawned via `claude -w iphase-acceptance` (2 steps: cmd + paste), symlinks live @18:32 — self-applying measurement (T15). - Secondary: `claude -w aif-handoff-sw-A-resume` for the parked aif-handoff SW-A umbrella (1 step, headless), symlinks @18:42, worktree cleaned up after verify. Verdict: criterion 2 MET (7→2, →1 headless). STOP §10 not triggered (≤2 steps, hook fired, flag behaved as coded). MINOR finding (§3.2): `claude -w` branches from a stale `origin/HEAD`, not the live `origin/staging` tip — base-ref-hygiene follow-up surfaced for worktree-setup.sh; not patched here (C = acceptance only). CLAUDE.md §See also gains a 1-line pointer to the new dispatch convention (pointer, not duplication — dual-implementation-discipline §7). Prior-art: skipped — acceptance report + CLAUDE.md See-also pointer, doc-only, no new capability shipped (measures PR #279/#282 substrate).
6 tasks
artyhoo
added a commit
that referenced
this pull request
May 29, 2026
…285) Retrospective for the dispatch-worktree-automation umbrella (R #271 + I-phase A #279 / B #282 / C #284). Verdict GO, umbrella DONE. Authored inside a worktree the umbrella's own WorktreeCreate hook created (claude -w retro-dispatch-worktree-auto) — recursive self-application satisfied by environment, not assertion. 4th live dispatch of the shipped substrate; reproduced the §3.2 base-ref MINOR a 3rd time (origin/HEAD=bb3ecec, 138 commits behind staging). Findings carried forward: F1 worktree-setup.sh base-ref hardening (open follow-up, surfaced not silently patched); F2 VS-Code-tab dispatch channel DECISION-NEEDED; F3 no discipline-level principle test (deferred per kickoff §12). Prior-art: skipped — docs-only retro, no new capability or dependency added. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
artyhoo
added a commit
that referenced
this pull request
Jul 23, 2026
… pre-push preflight (#1101) * fix(worktree): SSOT provisioning helper + doctor sweep + self-healing pre-push preflight .claude/hooks/worktree-setup.sh has NEVER been registered: `git log -S'WorktreeCreate' -- .claude/settings.json` is empty and `jq '.hooks.WorktreeCreate'` is null in both the repo and the user-global settings. The hook shipped in PR #279 with its registration delivered as a PR-body HEREDOC for manual application; it was never applied, and .claude/settings.json is agent-uncommittable, so no agent could close the gap. CLAUDE.md:182 nevertheless stated the hook "auto-creates the worktree + node_modules symlinks". PR #1072 later added a self-heal block INSIDE that hook for this same incident class — it cannot help, because the hook it lives in never runs. Live census: 63 of 125 registered worktrees under .claude/worktrees/ are unprovisioned; 32 of them hold a real node_modules directory containing nothing but vitest's .vite caches. Root cause of the unrecoverable state: the principles section of this very hook shells out to vitest, which materialises node_modules/.vite inside the worktree. The path then EXISTS, so both channels' `[[ ! -e … ]]` guards are permanently false, and `ln -sfn TARGET node_modules` against that directory creates node_modules/node_modules — a link nested INSIDE the cache. Changes: - scripts/worktree-node-modules.sh (new) — single source of truth. Separates "free to replace" (absent | symlink | dir holding only .vite* caches) from "already provisioned" (conflating them was a real bug: a correct symlink is both). --check never writes. - .claude/hooks/worktree-setup.sh + scripts/create-worktree.sh — both now call the helper instead of carrying byte-identical copies of the block, which was #sync-by-copy-paste under a shared @dual-pair anchor (dual-implementation-discipline.md §7-§8). The hook's early "worktree exists → reuse" return now re-provisions before returning. - scripts/worktree-doctor.sh (new) — operator sweep over `git worktree list`; --fix applies. - packages/core/hooks/pre-push.ts — `worktree-provisioning` section, FIRST in ALL_SECTIONS so the symlinks land before any section can invoke vitest. Self-heals; blocks only when the primary itself has no node_modules, and then names the remediation. - CLAUDE.md — states what is actually true, including that the hook is not registered and how to verify it. - worktree-setup.test.ts + create-worktree.test.ts — fixtures now ship the helper the hooks depend on; without it both silently no-op on `|| true` and every symlink assertion fails. Paired fixture: packages/core/hooks/worktree-node-modules.test.ts. Verified red->green — 4 of 8 arms fail against the pre-fix inline logic (cache-poison heal, dangling-symlink re-point, unfixable-exit-2, --check-never-writes), 8/8 with the fix. Live: a real vite-poisoned worktree went cache-dirs -> symlinks with no nesting and tsx reachable again. Prior-art: prior-art-evaluations.md#87 (portable worktree-creation CLI landscape, verdict BUILD — unchanged). This commit extracts the shared provisioning block of that entry's own dual pair into one home and adds a sweep over it; no new capability area, no new dependency. Last reviewed updated in this commit. Superpowers `using-git-worktrees` (#65, ADOPT) remains the AI-session axis and is untouched. * chore(install-sh): regenerate npm-stack fingerprints after pre-push.ts edit The 8 npm-stack baselines carry a content hash of packages/core/hooks/pre-push.ts, which ships to consumers; adding the worktree-provisioning section changed it. Diff is exactly one hash line per baseline — the new scripts/worktree-*.sh are maintainer tooling and are NOT in the shipped fingerprint, which is why the section guards on existsSync(helper) and is tagged owner: 'maintainer' (composeSections filters it out of a consumer layout entirely). Pre-push runs test:principles, not the install-sh bash battery, so this surfaced only in CI shard C — the known regen path (SNAPSHOT_MODE=capture bash tests/install-sh/snapshot.sh). Prior-art: skipped — mechanical baseline regeneration after a shipped-file edit, no new capability and no new dependency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I-phase Sub-wave A of the
dispatch-worktree-automationumbrella — implements PR #271 verdict Candidate D2 (ADAPTtfriedel/claude-worktree-hooksprecedent). Adds aWorktreeCreatecommand hook that fires onclaude -w <name>, replaces default git behaviour with project-specific setup (worktree under.claude/worktrees/<name>/, branchworktree-<name>, base reforigin/HEAD,node_modulessymlinks). Companion paired-negative test asserts the CC command-hook contract verified live this PR viaclaude --print --worktree probe --settings '{...inline hook...}'. Closes PR #271 §8 ATTN 4 («WorktreeCreate stdin schema NOT published» → schema now empirically verified as{.session_id, .transcript_path, .cwd, .hook_event_name, .name}).Changes
.claude/hooks/worktree-setup.sh(107 LOC) — WorktreeCreate command hook. Behaviour: parse.namefrom stdin via jq; resolve project root viaCLAUDE_PROJECT_DIRenv (fallback chain: stdin.cwd→git rev-parse --show-toplevel); resolve base ref viaorigin/HEAD→origin/main→main→HEAD; create worktree at$PROJECT_DIR/.claude/worktrees/<name>/on branchworktree-<name>; symlinknode_modules+packages/core/node_modulesfrom primary checkout; print absolute path on stdout (ONLY thing on stdout per CC contract); idempotent on re-invoke (existing dir → reuse); exit 1 with stderr diagnostic on missing.name/ unresolvable root /git worktree addfailure (CAN BLOCK creation per CC contract).packages/core/hooks/worktree-setup.test.ts(237 LOC, 10 tests, all green) — 7 positive scenarios (path, both symlinks, branch name, idempotency, single-line stdout, env precedence) + 3 paired-negative (missing.name, empty.name, unresolvable project root). Per-test temporary git repo viamktemp+git init; no real-repo mutation; mirrorsinject-matching-rule.test.tspattern +describe.skipIf(!JQ)graceful jq fallback..claude/settings.json— see §Install below. Deny-listed for agent edit perfeedback_settings_json_agent_uncommittablememory → delivered as HEREDOC.Prior-art consult
Prior-art:trailer — cites SSOT feat(skill-drift): multi-channel drift detection from D-AuditC-5 #65 (Superpowersusing-git-worktreesADOPT — native-primitive mandate that this hook operationalises) +tfriedel/claude-worktree-hooks(ADAPT precedent per PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §3 Candidate D2; we customise project-setup step from npm-install to symlinks permeta-kickoff.template.md §4aworkspace-optimisation pattern).claude -w+ ADAPT WorktreeCreate hook #271 §6 verdict ADOPT (Candidate Eclaude -w) + ADAPT (Candidate D2 WorktreeCreate hook) drives this Sub-wave; no new SSOT capability area surfaced beyond what PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §8 enumerates (3 new entries proposed there are deferred to a follow-up I-phase batch — out of Sub-wave A scope).tfriedel/claude-worktree-hooksreturned «Repository not found» (not indexed); fell back to two phrasings of WebFetch (verbatim README + GitHub page) per T13 mandate — both confirm.namejq field + path-only stdout. Documented in commit body + §Active T-traps below.claude -w+ ADAPT WorktreeCreate hook #271 §2; no re-execution in Sub-wave A.Test plan
npx vitest run packages/core/hooks/worktree-setup.test.ts→ 10/10 green (positive 7, paired-negative 3)npm run typecheck --workspaces --if-present→ clean across@rules-as-tests/core,@rules-as-tests/meta-factory,@rules-as-tests/preset-next-15-canonicalnpx vitest run packages/core/principles/{02-paired-negative-test,12-ai-laziness-traps,15-skill-paired-negative}.test.ts packages/core/hooks/check-hook-marker.test.ts→ 21 passed / 4 skipped, no regressionclaude --print --worktree wtc-schema-probe --settings '{"hooks":{"WorktreeCreate":[{"hooks":[{"type":"command","command":"bash /tmp/probe-wtc.sh"}]}]}}' "exit"; captured stdin payload:{"session_id":"...","transcript_path":"...","cwd":"/Users/art/code/rules-as-tests-aif","hook_event_name":"WorktreeCreate","name":"wtc-schema-probe"}→.namefield is the primary identifier; probe artefacts cleaned viagit worktree remove --force+git branch -D(surgical, per T17 — preserve-before-destructive).claude/settings.jsonHEREDOC patch (§Install below), then runclaude -w probe-after-installfrom a fresh terminal tab to verify hook fires and worktree appears at.claude/worktrees/probe-after-install/. Expected: 1 command + paste replaces the existing ~7-step manual STEP 0 paste-block. Verification:git worktree listshows new entry; symlinks present (ls -la .claude/worktrees/probe-after-install/node_modules)git worktree remove .claude/worktrees/probe-after-install --force && git branch -D worktree-probe-after-installPre-existing staging failures unrelated to this PR (verified by stash + re-run on pristine staging):
pre-push.test.ts:55-65(memoryproject_warn_only_flip_and_ci_backstop— CI filter masks),check-doc-authority.test.tsboundary cases (3 failures on staging before this PR).§Install (maintainer-applied — agent-uncommittable per
feedback_settings_json_agent_uncommittable)Apply this patch from the repo root to add the
WorktreeCreateevent entry alongside the existingUserPromptSubmit/PreToolUse/PostToolUse/Stophook groups:The patched fragment (what the maintainer can also paste manually instead of running the script):
§1.7 Forward-check applied
Sweep across active
.claude/rules/for disciplines that bear on this hook + test:build-first-reuse-default.md §1— verdict ADAPT fortfriedel/claude-worktree-hooksper PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §3 Candidate D2: same problem class (WorktreeCreate hook for project setup), divergent mechanism (symlinks vs npm-install) rationalised viameta-kickoff.template.md §4aworkspace-optimisation precedent (file:line evidence: hook comment lines 21-24).dual-implementation-discipline.md §3— hook carries# @cc-only-rationale:marker (file:line.claude/hooks/worktree-setup.sh:26-27): WorktreeCreate hook event is CC-only; no portable equivalent fires at worktree-creation moment.no-paid-llm-in-ci.md §1— pure deterministic bash hook + vitest assertion; zero API-billed call in runtime or CI (file:line.claude/rules/no-paid-llm-in-ci.md:14).phase-research-coverage.md §1.11— stdin schema verified by direct live probe (claude --print --worktree probe --settings '{...}') rather than training-data assumption; evidence in §Test plan above + commit body §Summary (file:line.claude/rules/phase-research-coverage.md:79).phase-research-coverage.md §1.12— PR body leads with the verdict (ships hook + test + install diff per Candidate D2) + 4-point rationale in §Summary + falsifier in §Falsifier below; not option-dump (file:line.claude/rules/phase-research-coverage.md:92).ai-laziness-traps.md §3— active T-traps enumerated in §Active T-traps below: 8 canonical (T3, T7, T11, T13, T15, T17, T19, T20) + 3 domain-specific (T-DWA-IP-A/B/C) per kickoff-author obligation (file:line.claude/rules/ai-laziness-traps.md:14); blanket-reference avoided.parallel-subwave-isolation.md §1— work executed in worktree.claude/worktrees/iphase-hook/on branchworktree-iphase-hook; primary checkout (/Users/art/code/rules-as-tests-aif) untouched; no shared-workdir parallel violation (file:line.claude/rules/parallel-subwave-isolation.md:14).reviewer-discipline.md §2— open items from PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §8 (ATTN 1+2: worktree path + branch name convention) DECIDED upstream per dispatch args («CC default per ATTN 1+2 DECIDED — no rename needed»); no new DECISION-NEEDED surfaced in this Sub-wave (file:line.claude/rules/reviewer-discipline.md:17).§1.7 Backward-check applied
Sweep of existing artefacts under this PR's recommendation scope:
.claude/settings.json(line 60"hooks":) — hook event registry; receives newWorktreeCreateentry via maintainer-applied HEREDOC (§Install). Not touched by agent (deny-list at lines 56-57). Will register the hook post-apply..claude/hooks/inject-matching-rule.sh— precedent for bash hook structure (set -uo pipefail, jq stdin parsing,# @cc-only-rationale:marker,# spec:cross-ref). New hook mirrors the layout (file:line.claude/hooks/worktree-setup.sh:1-30vs precedent.claude/hooks/inject-matching-rule.sh:1-16).packages/core/hooks/inject-matching-rule.test.ts— precedent for vitest hook test (execFileSync('bash', [HOOK]),describe.skipIf(!JQ),runHookhelper). New test mirrors structure (file:linepackages/core/hooks/worktree-setup.test.ts:35-72) and adds paired-negative scenarios perprinciples/02-paired-negative-test.test.tsdiscipline..gitignore— does NOT yet ignore.claude/worktrees/(PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §2.6 confirmed). Out of Sub-wave A scope — separate I-phase edit target (PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §8 item 7). Hook works without this.gitignoreline; only consequence isgit statusshowing worktree contents as untracked in primary checkout until follow-up lands. Will raise as follow-up batch..claude/skills/meta-orchestrator/SKILL.md:324+templates/meta-kickoff.template.md §4 + §4a+references/placeholders.md:24— orchestrator template still emits manualgit worktree addpaste-blocks. Out of Sub-wave A scope — separate I-phase edit targets (PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §8 items 1, 3, 4, 5). Sequencing per §8 item 4: «delete §4a IF AND ONLY IF D2 hook lands first» — this PR satisfies the precondition; template migration is the next follow-up batch..claude/rules/parallel-subwave-isolation.md §1— mandatory worktree setup block still references manualgit worktree add. Out of Sub-wave A scope — separate I-phase edit target (PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §8 item 6). Rule will gainclaude -was preferred channel + manual as fallback in a follow-up touch (forward-going perdual-implementation-discipline.md §9«forward-going annotation»).docs/meta-factory/prior-art-evaluations.md— 3 new SSOT entries proposed in PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §8 item 8 (claude -wADOPT, WorktreeCreate event ADOPT,tfriedel/claude-worktree-hooksADAPT) NOT included here. Commit-bodyPrior-art:trailer cites existing SSOT feat(skill-drift): multi-channel drift detection from D-AuditC-5 #65 as the load-bearing precedent for this commit (Superpowersusing-git-worktrees— already in the register). SSOT-add follow-up batches separately.claude -w+ ADAPT WorktreeCreate hook #271 verdict. No re-open needed.No artefact silently superseded. Follow-up scope explicitly listed (
.gitignoreitem 7, SKILL.md / template / placeholders items 1+3+4+5,parallel-subwave-isolation.mditem 6, prior-art-evaluations.md item 8 — each is a separate atomic batch per umbrella sequencing).§Active T-traps (per
ai-laziness-traps.md §3— enumerate + extend, not blanket-reference)Inherited canonical from PR #271 §6:
.namemissing? what if root unresolvable?» — confirmed exit non-zero with empty stdout, not asserted. ✓claude -w+ ADAPT WorktreeCreate hook #271 §2.4 6-layer execution; no new candidate introduced. ✓tfriedel/claude-worktree-hooksDeepWiki returned «not indexed»; fell back to two phrasings WebFetch (GitHub repo page + raw README.md). Both confirm.namejq field + path-only stdout. Pattern adapted (not blind-copied): we customise project-setup step (symlinks vs npm-install) per workspace-optimisation pattern — rationale in hook comments lines 21-24. ✓/tmp/wtc-probe-87483, branchwtc-probe-87483) cleaned viagit worktree remove --force+git branch -D, surgical only — never bulk-recursive delete. Hook tests use NodermSyncfor tmpdir cleanup (not Bash → git-safety hook bypass safe by design). ✓.namefield choice. ✓Domain-specific I-phase traps:
claude --print --worktree probe --settings '{...inline hook...}'ran 2026-05-29 confirming the{.session_id, .transcript_path, .cwd, .hook_event_name, .name}payload shape. Closes PR research(dispatch-worktree-automation): R-phase — ADOPTclaude -w+ ADAPT WorktreeCreate hook #271 §8 ATTN 4. ✓readlinkSyncon both symlink paths (cases «symlinks node_modules» + «symlinks packages/core/node_modules»), asserting both target (not just file presence). Test repo commitspackages/core/.keepsogit worktree addchecks out the directory (production layout reproduction). ✓Edit/Write(.claude/settings.json)at settings.json lines 56-57; PR body §Install delivers HEREDOC Python recipe for maintainer-applied install perfeedback_settings_json_agent_uncommittablememory. No agent commit on the settings file. ✓§Falsifier
Wrong if:
(a)
.namestdin field renamed by Anthropic in a future CC release → hook exits 1 with diagnosticmissing .name in WorktreeCreate stdin payload; CC reports creation failure; maintainer notices first dispatch attempt failing → re-run probe, update field name. Re-probe procedure documented in §Test plan above.(b)
origin/HEADresolution fails on a fresh clone before firstgit fetch→ BASE_REF fallback chain catches viaorigin/main→main→HEAD; worktree still created. Verified by test «valid stdin → creates worktree» on a fresh tmp repo with only localmainbranch.(c) Primary checkout has no
node_modules(fresh clone before install) → symlink step silently skipped ([[ -e "$PROJECT_DIR/node_modules" ]]guard); worktree still created with bare structure; firstnpminvocation in worktree triggers fresh install (acceptable degraded path, matches tfriedel original behaviour).(d) WorktreeCreate hook contract changes from «print path on stdout» to a JSON output → hook continues to print path; would need migration. Mitigation: monitor
code.claude.com/docs/en/hooksfor contract change; the dual-channel discipline marker (# @dual-pair:if a portable agent equivalent ever exists) is currently not applicable per dual-implementation-discipline.md §3 (CC-only event).(e) CC silently ignores hook output and uses default behaviour despite hook installation → defeats Sub-wave A intent. Maintainer post-install smoke-test (§Test plan checkbox) catches this; falls back to manual STEP 0 paste-blocks while CC contract issue is filed upstream.
Prior-art: prior-art-evaluations.md#65 (Superpowers
using-git-worktreesADOPT — native-primitive mandate operationalised by this hook).