{"slug": "should-you-commit-claude-md-and-the-claude-folder", "title": "Should you commit CLAUDE.md and the .claude folder?", "summary": "Anthropic's .claude directory reference, checked on 2026-09-23 against Claude Code 2.1.280, advises committing CLAUDE.md, .claude/settings.json, .claude/rules/, skills, agents, commands and .mcp.json to git while keeping CLAUDE.local.md and .claude/settings.local.json untracked. The guidance notes that committing .claude/settings.json is safe but should be reviewed like code because its hooks run shell commands on every teammate's machine, and that Claude Code automatically adds **/.claude/settings.local.json to a user's global git excludes the first time it writes that file. Auto memory lives under ~/.claude/projects/<project>/memory/ and is never synced into a repository.", "body_md": "Blog\n\n# Should you commit CLAUDE.md and the .claude folder?\n\nPublished: September 23, 2026\n\nYes. Commit `CLAUDE.md`, `.claude/settings.json`, `.claude/rules/`, skills, agents, commands and `.mcp.json`, so everyone who clones the repo gets the same setup. Keep `CLAUDE.local.md` and `.claude/settings.local.json` out of git. Auto memory never enters the repo; it lives under `~/.claude`.\n\nThis follows Anthropic's own [.claude directory reference](https://code.claude.com/docs/en/claude-directory), which marks each file as committed, gitignored or local, and the [settings docs](https://code.claude.com/docs/en/settings), both checked on 2026-09-23 against Claude Code 2.1.280.\n\n## Which files in .claude should I commit?\n\n| File | Commit? | Why | \n|---|---|---|\n| `CLAUDE.md` or`.claude/CLAUDE.md` | Yes | Team instructions. The docs describe it as shared with team members through source control. | \n| `CLAUDE.local.md` | No | Your private notes for this project. Create it by hand and add it to .gitignore. | \n| `.claude/settings.json` | Yes | Shared permissions, hooks, env and plugins for everyone who clones. | \n| `.claude/settings.local.json` | No | Personal overrides. Claude Code adds it to your global git excludes when it first writes it. | \n| `.claude/rules/*.md` | Yes | Topic or path-scoped instructions for the team. | \n| `.claude/skills/` ,`.claude/commands/` | Yes | Shared /name workflows. Commands and skills are now the same mechanism; new ones should be skills. | \n| `.claude/agents/*.md` | Yes | Shared subagent definitions. | \n| `.claude/agent-memory/` | Yes, if you use it | Written by subagents with memory: project. Use memory: local to keep it out of git. | \n| `.mcp.json` | Yes | Team MCP servers. Personal ones go in ~/.claude.json. | \n| `.worktreeinclude` | Yes | Lists gitignored files, like .env, to copy into new worktrees. | \n| `~/.claude/CLAUDE.md` , auto memory | Never in a repo | Machine-local. Auto memory lives in ~/.claude/projects/<project>/memory/ and is not synced. | \n\n## Should I commit the .claude folder?\n\nMostly, yes. The docs put it plainly: commit most files in `.claude/` so the team shares them. The one file that should never be tracked is `settings.local.json`, and Claude Code handles it for you: the first time it writes that file in a repo that does not already ignore it, it adds `**/.claude/settings.local.json` to your global git excludes. That protects you, not your teammates. If you want the rule in the repo, add the same line to the project `.gitignore`.\n\nTracking the local file has a side effect worth knowing. While it is untracked, its allow rules apply without the workspace trust step. Once git tracks it, the trust step applies to it as it does to the committed `settings.json`.\n\n## What is CLAUDE.local.md for?\n\nYour sandbox URLs, your preferred test data, anything true for you and not for the team. Claude Code loads it after the `CLAUDE.md` at the same level, so it is the last thing Claude reads there. Two traps:\n\n- It only exists in the worktree where you created it. For notes that follow you across worktrees, import a file from your home directory instead.\n- It counts as a `CLAUDE.md` for the[AGENTS.md check](https://gethrbr.com/blog/does-claude-code-read-agents-md) . In a repo that relies on`AGENTS.md` , creating one stops Claude reading`AGENTS.md` for you under the default mode.\n\n## Is it safe to commit .claude/settings.json?\n\nIt is safe to commit and worth reviewing like code, because it is code. The settings docs recommend committing it so everyone gets the same permissions, hooks and plugins. A hook in that file runs shell commands on every teammate's machine, which is why Claude Code asks each person to trust the workspace before project hooks and allow rules take effect. Keep secrets out of its `env` block; it is in git.\n\nThe same caution applies to `CLAUDE.md` imports. The first time Claude Code sees an `@path` import that resolves outside the working directory, it asks for approval, because a file someone else committed chose what gets loaded.\n\n## Should CLAUDE.md be in .gitignore?\n\nThe project file, no. Ignoring it means every engineer writes their own, and the agent on each laptop works from a different brief. If something in it is personal, that line belongs in `CLAUDE.local.md`; if it is true for you in every repo, it belongs in `~/.claude/CLAUDE.md`. The one case for keeping a project file out of a public repo is content you would not publish: internal hostnames, customer names, incident details. Strip those rather than ignore the file.\n\n## Can I commit Claude Code's auto memory?\n\nNot in any supported way. Auto memory is written to `~/.claude/projects/<project>/memory/`, one directory per repository shared across its worktrees, and the docs say plainly that it is not shared across machines or cloud environments. The `autoMemoryDirectory` setting moves it, but only to an absolute path or one under `~/`. When Claude saves something the whole team should know, the route today is by hand: open `MEMORY.md` with `/memory`, copy the line into `CLAUDE.md`, and open a pull request.\n\n## How do I share CLAUDE.md with my team?\n\nCommit it, and review changes to it in pull requests like any other file. For rules that must reach every repo in the company, an admin can deploy a managed `CLAUDE.md` to a fixed system path (`/Library/Application Support/ClaudeCode/CLAUDE.md` on macOS, `/etc/claude-code/CLAUDE.md` on Linux). Managed files cannot be excluded by individual settings.\n\n## What git does not solve\n\nGit answers where the file lives and who changed which line. Three questions stay open.\n\n- **Who reviews a rule?** A pull request review checks the diff. It does not check whether the line is still true, or whether it contradicts a line someone else added in another directory. The docs warn that when two rules conflict, Claude may pick one arbitrarily.\n- **Where does the rule come from?** The decision that webhook handlers acknowledge and enqueue was made in`#eng-payments` and argued again in a review thread. It reaches the file only when someone remembers to copy it.\n- **What does each agent actually get?** Claude Code's auto memory is machine-local and not synced. What one engineer's agent learned on Tuesday is not in anyone's committed file on Wednesday, and a teammate on Codex never sees it.\n\nHarbor is built for those three. It reads the places the team already decides (Slack channels you opt in, merged pull requests and their review threads, docs) and turns them into facts. You set the gate: under the default Hybrid mode routine conventions are added automatically, and anything that contradicts an existing fact is always held for a person. `harbor init` wires the same approved facts into Claude Code, Codex and Cursor, and what a session learns is written back for review, not straight into anyone's prompt. The [quickstart](https://gethrbr.com/docs/quickstart) is the place to start.\n\nRelated: [how each agent's memory is scoped](https://gethrbr.com/blog/claude-code-memory-vs-codex-cursor-copilot) and [one memory for Claude Code, Cursor and Codex](https://gethrbr.com/blog/share-memory-claude-code-cursor-codex).\n\n## Questions\n\n### Should CLAUDE.md be in .gitignore?\n\nNo. The project CLAUDE.md is meant to be shared through source control. Personal notes go in CLAUDE.local.md, which you should gitignore, or in ~/.claude/CLAUDE.md for every repo.\n\n### Should I commit .claude/settings.local.json?\n\nNo. It holds your personal overrides and the permissions you approved. Claude Code adds it to your global git excludes the first time it writes the file; add it to the project .gitignore too if you want the rule shared.\n\n### Is Claude Code auto memory shared with my team?\n\nNo. Auto memory lives under ~/.claude/projects on your machine and is not shared across machines or cloud environments. To share something it learned, copy the line into CLAUDE.md and open a pull request.\n\n### Can teammates using Codex use my CLAUDE.md?\n\nCodex does not read CLAUDE.md by default. Put the shared rules in AGENTS.md and add a CLAUDE.md that imports it with @AGENTS.md, so Claude Code, Codex, Cursor and Copilot read the same text.", "url": "https://wpnews.pro/news/should-you-commit-claude-md-and-the-claude-folder", "canonical_source": "https://gethrbr.com/blog/should-you-commit-claude-md", "published_at": "2026-09-23 00:00:00+00:00", "updated_at": "2026-09-27 16:00:21.124913+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "agent-protocols"], "entities": ["Anthropic", "Claude Code"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/should-you-commit-claude-md-and-the-claude-folder", "markdown": "https://wpnews.pro/news/should-you-commit-claude-md-and-the-claude-folder.md", "text": "https://wpnews.pro/news/should-you-commit-claude-md-and-the-claude-folder.txt", "jsonld": "https://wpnews.pro/news/should-you-commit-claude-md-and-the-claude-folder.jsonld"}}