Skip to content

Narrow /.agent* gitignore pattern to stop matching .AGENTS/ on Windows - #74

Merged
ms609 merged 1 commit into
cpp-searchfrom
feature/gitignore-agents-collision
Aug 5, 2026
Merged

Narrow /.agent* gitignore pattern to stop matching .AGENTS/ on Windows#74
ms609 merged 1 commit into
cpp-searchfrom
feature/gitignore-agents-collision

Conversation

@ms609

@ms609 ms609 commented Aug 5, 2026

Copy link
Copy Markdown

Problem

On Windows, git runs with core.ignorecase=true. .gitignore line 38's
pattern /.agent* (intended to ignore per-agent build library dirs like
.agent-<id>/, per AGENTS.md's tarball build recipe) case-folds and matches
the tracked .AGENTS/ directory too — the repo's own agent memory files
(.AGENTS/memory/architecture.md, etc.).

Symptom: editing any .AGENTS/memory/*.md file on Windows leaves it showing
as modified in git status, but git add .AGENTS/memory/<file>.md refuses
with "The following paths are ignored by one of your .gitignore files".
git add -f works around it, but agents hitting this may silently skip the
required memory update (AGENTS.md's standing instruction) instead of
force-adding — a lost-documentation failure mode. Confusingly,
git check-ignore -v .AGENTS returns nothing (exit 1), disagreeing with
git add's refusal.

Fix

  • Narrow /.agent* to /.agent-*, matching the actual .agent-<id> naming
    convention used everywhere in AGENTS.md and dev/benchmarks/*.R (grepped
    the whole repo — every real usage includes the hyphen).
  • Add a defensive !/.AGENTS/ negation immediately after, so a future
    reversion to a broader pattern can't reintroduce the collision silently.
  • Checked the sibling pattern /.ab-* (line 40, paired A/B benchmark
    libraries) for the same class of problem: no tracked path starts with
    .ab (case-insensitive), so it's not currently affected. Left as-is.

Test plan

  • git check-ignore -v .AGENTS — still nothing (exit 1), consistent with before
  • Edited .AGENTS/memory/architecture.md, ran bare git add .AGENTS/memory/architecture.md — succeeds without -f
  • Created a fresh .agent-test/ dir — still reported ignored by git check-ignore -v and absent from git status
  • Created a fresh .ab-testlib/ dir — still ignored (line 40 unaffected)
  • Grepped repo for any use of .agent<letters> without a hyphen — none found; all real usages are .agent-<id>/.agent-<name>

🤖 Generated with Claude Code

…/ on Windows

core.ignorecase=true on Windows folds "/.agent*" onto the tracked .AGENTS/
memory directory (case-insensitive prefix + wildcard suffix match), causing
`git add .AGENTS/memory/*.md` to silently refuse without -f. Narrow the
pattern to the actual .agent-<id> naming convention and add a defensive
negation for good measure.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ms609
ms609 merged commit 88cf860 into cpp-search Aug 5, 2026
7 checks passed
@ms609
ms609 deleted the feature/gitignore-agents-collision branch August 5, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant