A slash makes a gitignore rule local
Four session transcripts reached main, one of them 103 KB
inside a feat(cc)! PR. Nothing was misconfigured; the rules were written
the way most people write them.
The rule that did not travel
A pattern containing a slash is anchored to the directory holding the
.gitignore. Pick a path to see whether the root-anchored rule reaches it.
What was tracked, and why it survived
| Path | Size | Landed in |
|---|---|---|
docs/feat--opus5-cc220-adoption/.claude/memory/sessions/<uuid>/events.jsonl | 103 KB | #3141 |
src/hooks/src/pretool/bash/.claude/memory/sessions/<uuid>/events.jsonl | - | - |
src/mcp-server/.claude/memory/sessions/<uuid>/events.jsonl (x2) | - | - |
**/.claude/memory/ was added later and does cover this going forward.
But .gitignore never untracks retroactively, so a file already in
the index stays there no matter how well the rule is written afterwards.
The fix, and the part deliberately left alone
+ **/.claude/state/ + **/.claude/telemetry/
Verified inert for existing files: 0 tracked under a
nested state/ or telemetry/ today, so these stop new writes
and disturb nothing.
Not extended to orchestration/,
coordination/ or agent-memory/. src/hooks holds 18 real
test fixtures under .claude/orchestration/, and project-scope
.claude/agent-memory/ is tracked on purpose. A blanket rule there would
silently swallow a legitimate addition, which is worse than the bug being fixed
because nothing surfaces at git add time.
Two probes that lied on the way here
- A
check-ignoresweep usingprobe.tmpreported every path ignored.*.tmpwas matching, not the.clauderules. Re-running with-vto print the matching rule showed five real gaps. - A verification step flagged "new fixture now ignored, I broke it". The
matching rule was
**/hooks/.claude/at line 128 on main, pre-existing. Checking which rule matched, and against which ref, separated a pre-existing condition from a regression.
Found by a peer session hitting the identical anchoring bug in another repo.