Back to blog
EngineeringDate unavailable· min read

When Git Status Trains You to Ignore the Gate

Two lines in .gitignore just fixed a trust problem that no amount of discipline could solve.

The CLAUDE.md documentation for every Strug City project starts with the same instruction: "git status first." Before you read context, before you plan your next move, check if your working tree is clean. It's the foundation of every QA gate we run.

Except it stopped working. Not because anyone ignored it deliberately, but because git status was always dirty. Two files showed up in every working tree, every time: .last-verified and .claude/session-branch. Both written by tooling. Both harmless. Both permanently present.

When you see the same untracked files every single time you run git status, you learn to skim past them. That's not laziness—it's pattern recognition doing exactly what it's supposed to do. The problem is that this trained behavior breaks the gate. If you're trained to ignore two files, you might miss the third one that actually matters.

You can't fix this with discipline. The human brain will always filter repeated non-threats. The only fix is to make git status actually clean when it should be clean.

What Shipped

Two entries in .gitignore: .last-verified (written by the pre-push visual verification gate) and .claude/session-branch (written by Claude Code's session tooling). Both are generated artifacts that have no business being tracked.

But adding two lines to .gitignore only solves the immediate problem. The second problem is that nothing prevented this in the first place, and nothing would stop it from regressing. The pre-push hook from PR #87 already shipped, and it writes .last-verified every time it runs. That file should have been ignored from day one.

Guarding the Fix

A 113-line audit test now asserts that four generated artifacts are ignored. It doesn't check the text of .gitignore—it runs git check-ignore to verify that git actually ignores each path. A text assertion would pass on a commented-out line. git check-ignore can't be fooled that way.

The test also protects against sync-gitignore.js, the script that rewrites managed sections of .gitignore from strug-standards. If a future sync widened the managed pattern set and accidentally absorbed these hand-added entries, the test would catch it. The reconcile() function is imported from the sibling strug-standards checkout and run against the current .gitignore content to verify both entries survive.

Bonus: an unclean working tree blocks retire-merged-worktrees.js, the script that cleans up merged Claude Code worktrees. These two ignored files were preventing cleanup in every worktree. Now cleanup runs without manual intervention.

What's Next

The next sync-gitignore.js improvement should recognize "generated artifact" as a managed category and own these entries. Right now they're hand-added, which means they won't propagate to other repositories automatically. If .last-verified is a problem in strug-enterprise-site, it's a problem everywhere the pre-push hook runs.

Longer term: when tooling writes a file, that same commit should add it to .gitignore. PR #87 shipped the pre-push hook. PR #88 cleaned up the artifact two merges later. That gap shouldn't exist.