Skip to content

chore(repo): remove auto-generated AGENTS.md and CLAUDE.md from git tracking#145

Merged
benediktms merged 2 commits into
masterfrom
chore/remove-generated-agent-docs-from-git
May 11, 2026
Merged

chore(repo): remove auto-generated AGENTS.md and CLAUDE.md from git tracking#145
benediktms merged 2 commits into
masterfrom
chore/remove-generated-agent-docs-from-git

Conversation

@benediktms
Copy link
Copy Markdown
Owner

Summary

Stops committing AGENTS.md and CLAUDE.md — they're per-machine references generated by brain docs from a template in init.rs. They were being force-added by the pre-commit hook on every commit, producing noisy "Updated brain section in AGENTS.md" diffs that polluted PR signal.

What changed

  • git rm --cached AGENTS.md CLAUDE.md — removes from the index, keeps the files on disk locally
  • .gitignore — adds CLAUDE.md (AGENTS.md was already listed but still tracked because it predated the entry)
  • scripts/pre-commit and hooks/pre-commit — drop the git add -f AGENTS.md line. The regeneration step stays so the local copy is kept fresh for AI agents reading the repo; we just no longer force-stage it
  • The pre-commit hook now also regenerates CLAUDE.md (implicitly, since brain docs already produces both)

Contributor flow after this lands

  1. Clone the repo (no AGENTS.md or CLAUDE.md in the working tree)
  2. just install (or cargo install --path crates/cli)
  3. brain docs — regenerates both files locally
  4. AI agents reading the repo see the up-to-date generated copy

A documentation update to call this out in the README's contributor section will land separately as part of the broader docs sweep.

Test plan

  • CI green
  • After merge, run brain docs on a fresh checkout and verify both files are generated
  • Verify a subsequent git commit does NOT include either file in the commit diff

🤖 Generated with Claude Code

benediktms and others added 2 commits May 11, 2026 16:29
…racking

Both files are generated by `brain docs` from a template in init.rs and
were always meant to be per-machine references for AI agents reading
the repo. They were previously committed (and force-added on every
commit by the pre-commit hook) which had two costs:

- every commit produced a noisy "Updated brain section in AGENTS.md"
  diff that polluted PR signal-to-noise
- the committed files drifted from the template anytime a contributor's
  brain binary was stale, leading to confusing diffs

This change:

- Removes both files from the git index (`git rm --cached`) but keeps
  them on disk for the user's current checkout.
- Adds CLAUDE.md to .gitignore (AGENTS.md was already there but tracked
  because it predated the entry — `git rm --cached` was needed to
  actually stop tracking it).
- Updates `scripts/pre-commit` and `hooks/pre-commit` to drop the
  `git add -f AGENTS.md` line. The regeneration step stays so the
  local copy is kept fresh for AI agents; we just no longer force the
  file into the commit.

After this change, a contributor cloning fresh runs `cargo install
--path crates/cli` (or `just install`) and then `brain docs` to
regenerate the two files locally. They're never committed again.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d/CLAUDE.md

Adds a brief note in the "From source" subsection of Installation
explaining that AGENTS.md and CLAUDE.md are not committed and need to
be generated locally via `just docs`. Closes the workflow gap a
multi-lens review of this PR flagged: fresh-clone contributors had no
documented path to the docs that the project's own CLAUDE.md
historically pointed at.

Verified locally: `brain docs` regenerates both files cleanly on a
fresh checkout of this branch (`Generated AGENTS.md` /
`Generated CLAUDE.md (bridge to AGENTS.md)`).

Also confirmed during this work:

- `just install-hooks` already exists and sets `core.hooksPath = hooks/`,
  so the "stale local hook" concern from review is mitigated by existing
  infrastructure (anyone who runs `just install` is on the versioned
  hooks directory).
- The existing user-content fence in `upsert_agent_docs` preserves
  anything outside the `<!-- brain:start -->...<!-- brain:end -->`
  markers, so user additions to CLAUDE.md (like graphify integration
  blocks) survive regeneration.
- Sub-directory AGENTS.md files (`.github/`, `tests/`, etc.) are not
  tracked by git and never were — the depth-matching gitignore pattern
  catches them by design.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@benediktms benediktms merged commit 6b2e8bd into master May 11, 2026
12 checks passed
@benediktms benediktms deleted the chore/remove-generated-agent-docs-from-git branch May 11, 2026 15:56
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