Track .claude/rules/ and leave the rest of .claude/ ignored - #101
Merged
Conversation
S192 left "track `.claude/` here" as an open decision; this settles it in
favour, but narrowly.
## The ignore rule
`.gitignore` had a bare `.claude/`. A directory exclusion makes git skip the
directory outright, so it never evaluates a `!` negation inside it — adding
`!.claude/rules/*.md` under `.claude/` tracks nothing at all. Reproduced
before writing the fix: with that pair in place, `git status
--untracked-files=all .claude/` printed nothing and `git check-ignore -v`
still attributed the ignore to the `.claude/` line.
The working form excludes the directory's *contents* and re-includes the one
subdirectory, so git descends into it:
.claude/*
!.claude/rules/
Verified after the change — `git status --untracked-files=all .claude/`
lists exactly `?? .claude/rules/docs-authoring.md`, `git check-ignore` exits
1 (not ignored) for that path, and the four excluded files are still
attributed to `.gitignore:13`.
## What is tracked, and what is not
Tracked: `.claude/rules/docs-authoring.md` — repo knowledge (sidebar
registration, section landing-page keys, the anchor-slug rules, the
OpenAPI-sibling convention).
Deliberately left ignored:
- `.claude/settings.json` — hardcodes a machine-local interpreter path
(`/home/my/.nvm/.../bin/caliber`) and registers four hooks that would then
fire on every tool use in every clone. Local state.
- `.claude/skills/{find-skills,save-learning,setup-caliber}/SKILL.md` —
generic caliber tooling, not repo knowledge. All three drive `caliber`,
whose state (`.caliber/`, `CALIBER_LEARNINGS.md`) is deliberately ignored
here, and `save-learning` instructs `git add CALIBER_LEARNINGS.md`, which
this repo ignores. Tracking them would propagate that inconsistency.
- `.claude/hooks/` — empty; git cannot track an empty directory.
Scanned `.claude/` for credentials before staging. The only hits were
`${{ secrets.ANTHROPIC_API_KEY }}`-style placeholder *references* inside the
setup-caliber skill doc, which is excluded anyway. No secret material.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Up to standards ✅🟢 Issues
|
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.
S192 left "track
.claude/in phlix-docs" as an open decision. This settles it.Tracks
.claude/rules/only, and leaves the rest of.claude/ignored.⚠ Premise correction — my stated reason was wrong
I justified this as "the rule was invisible, so the error shipped". That is not what happened.
README.md:57-61already documented the slug rule, and CI did go red. What actually failed is that a red advisory check does not block a merge.So tracking
.claude/rules/alone will not prevent recurrence — branch protection would. This is still worth doing (the rule belongs in version control, next to the docs it governs), but it should not be recorded as the fix for the S259 incident.The
.gitignorelandmine, reproduced before fixingWith
.claude/plus a naive!.claude/rules/*.md,git statusprinted nothing andcheck-ignorestill blamed the directory line — a directory exclusion is never descended into, so its own negations cannot fire.Fixed with
.claude/*+!.claude/rules/. Proven both directions:git statusshows exactly the one intended file,check-ignoreexits 1 for it, and the four excluded files remain attributed to.gitignore:13.What was deliberately excluded
settings.json— hardcodes a machine-local nvm path and registers 4 always-on hooks.No secrets: the only matches were
${{ secrets.X }}placeholders inside an excluded file.Gates
npm test0 (84) ·npm run docs:build0 · 158 pages, 3474 links, 0 dead.🤖 Generated with Claude Code