chore: adopt the house .claude/ gitignore pattern - #8
Open
rdtiv wants to merge 1 commit into
Open
Conversation
`.claude/worktrees/` holds whole checkouts — node_modules and all — inside the
repo, so `git add -A` from the repo root would stage a second copy of the tree.
It has shown up as untracked in every mission run against this repo so far.
The shape is claude-infra's rather than invented here: `.claude/*` plus the
whitelist that its README and `sync-repo.sh` both specify. Two properties a
narrower `.claude/worktrees/` entry would not have:
- Deny by default. Anything new under `.claude/` is ignored unless it is
named, instead of needing a fresh line every time Claude Code grows a
directory.
- The repo-level install keeps working. Cloud sessions have no `~/.claude`
to read agents, hooks or `landed.sh` from, so those have to be committed
here. `sync-repo.sh` reports on this file and never edits it, and what it
checks for is exactly this pattern.
Mind the star. `.claude/` without it excludes the directory itself, and git
never descends into an excluded directory, so `!` negations under it fail
silently while looking correct. `.claude/*` excludes the children instead,
which is what makes the whitelist work at all.
One addition to the house list: `!.claude/settings.json`. claude-infra's
whitelist omits it while its own setup prompt says to add the PreToolUse blocks
to the repo's `.claude/settings.json` and land it as a PR — which the pattern
as written makes impossible. Filed as rdtiv/claude-infra#12; this line comes
back out if that resolves the other way. `settings.local.json` stays ignored
regardless, which is correct.
Verified with `git check-ignore` rather than by reading the pattern: worktrees,
`settings.local.json` and any unnamed new path are ignored; `agents/`, `hooks/`,
`commands/`, `scripts/`, `workflows/`, `settings.json` and
`.claude-infra-version` are trackable.
Gates: npm run typecheck 0, npm run typecheck:py 0, npm run verify:docs 0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NsAeobZPagwRXXXDzqE6bW
rdtiv
force-pushed
the
chore/ignore-mission-worktrees
branch
from
August 15, 2026 12:25
5427a57 to
e356a29
Compare
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.
Punch-list item from the #5 / #7 review pass.
.claude/worktrees/holds whole checkouts —node_modulesand all — inside the repo, sogit add -Afrom the repo root would stage a second copy of the tree. It has shown as untracked in every mission run against this repo so far.The shape is claude-infra's, not invented here
.claude/*plus the whitelist specified in two places upstream —README.md:327-330and the check loop atsync-repo.sh:538-540. Adopting it rather than a narrower.claude/worktrees/buys two things:.claude/is ignored unless named, instead of needing a fresh line each time Claude Code grows a directory.~/.claudeto read agents, hooks orlanded.shfrom, so those must be committed in-repo.sync-repo.shreports on this file and never edits it, and what it checks for is exactly this pattern — a narrower entry falls to itselsebranch and gets no help.Mind the star.
.claude/without it excludes the directory itself, and git never descends into an excluded directory, so!negations under it fail silently while looking correct..claude/*excludes the children instead, which is what makes the whitelist work at all.One deviation, tracked
!.claude/settings.jsonis not in claude-infra's list, whilesettings/setup-prompt.template.md:58-65says to add thePreToolUseblocks to the repo's.claude/settings.jsonand land it as a PR — which the pattern as written makes impossible withoutgit add -f. Filed upstream as rdtiv/claude-infra#12. The line comes back out if that resolves the other way; the.gitignorecomment says so, so the deviation stays traceable.settings.local.jsonremains ignored either way, which is correct.Verified with
git check-ignore, not by reading the pattern.claude/worktrees/wt-5-audit-fixes/src/weather.ts.claude/settings.local.json.claude/anything-new.txt.claude/agents/scout.md.claude/hooks/g.mjs.claude/scripts/landed.sh.claude/workflows/w.js.claude/settings.json.claude/.claude-infra-versionGates
Exit codes checked individually, in a clean worktree off
origin/main:npm run typecheck→ 0npm run typecheck:py→ 0npm run verify:docs→ 0No API call. Nothing outside
.gitignoreis touched.History
An earlier revision of this PR used a targeted
.claude/worktrees/+.claude/settings.local.jsonpair, on the reasoning that negation patterns are a footgun. That reasoning was right about.claude/and wrong about the house pattern, which uses.claude/*precisely to avoid it — andsync-repo.sh:535-537had already documented the silent-failure case (.claude-infra-versionwritten but never tracked, so--scan"quietly lies about what is deployed") that the targeted version was trying to argue from. Amended to match.🤖 Generated with Claude Code
https://claude.ai/code/session_01NsAeobZPagwRXXXDzqE6bW