Skip to content

Improve .gitignore and CLAUDE.md context files#139

Open
MatiasFernandez wants to merge 4 commits into
mainfrom
mfernandez.improve-claude-files
Open

Improve .gitignore and CLAUDE.md context files#139
MatiasFernandez wants to merge 4 commits into
mainfrom
mfernandez.improve-claude-files

Conversation

@MatiasFernandez

@MatiasFernandez MatiasFernandez commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two independent changes bundled together, both aimed at making Claude Code sessions in this repo more effective:

1. .gitignore: allow committing shared Claude Code config

Previously the entire .claude/ directory was gitignored, which meant any Claude Code config could only ever be a personal, local artifact — there was no way to share rules, settings, or skills with the team via source control.

Per the official Claude Code docs (settings, memory, worktrees, and .claude/ directory reference), only three things are meant to stay personal/machine-local:

  • CLAUDE.local.md
  • .claude/settings.local.json
  • .claude/worktrees/

Everything else under .claude/ (settings.json, rules/, skills/, commands/, agents/, output-styles/) is intended to be committed and shared with the team, the same way CLAUDE.md itself is. This PR removes the blanket .claude/ ignore and replaces it with ignore rules for just those three personal/local paths, unblocking the CLAUDE.md restructuring below.

⚠️ This does not mean anything you create under .claude/ should be committed by default. Only commit content there once it's an established, team-agreed setting, tool, or practice — experimental rules, skills, or commands you're still trying out should stay uncommitted (or go in one of the personal/local paths above) until the team has actually agreed to adopt them.

2. CLAUDE.md: apply progressive disclosure to avoid context pollution

The root CLAUDE.md had grown into a full architecture reference — a per-subsystem breakdown of the client, server, and mcp-server workspaces, GCI/native library notes, and detailed test-authoring conventions — all loaded into every agent's context on every session, whether or not the task touched those areas.

The restructuring keeps CLAUDE.md as a lean top-level map (commands, high-level workspace layout, a short pointer to where deeper detail lives) and moves subsystem-specific detail out into scoped docs that only load when relevant:

  • .claude/rules/class-sync.md, gci.md, mcp.md — each scoped via paths: frontmatter to the files it's actually about, so it only enters context when those files are in play.
  • client/src/__tests__/CLAUDE.md — test-authoring conventions, auto-loaded by Claude Code when working under that directory.

The mindset: an agent's context window is a scarce, shared resource, and instructions that aren't relevant to the current task are pure noise that crowds out the things that are. Rather than trying to write one document that anticipates every task, structure context so the right slice loads on demand for the task at hand, and let the top-level file stay a map rather than the territory. This is guided by:

A follow-up commit (809754e) adds a note to the new client/src/__tests__/CLAUDE.md about an unawaited-promise gotcha in systemBrowser.ts, discovered while dogfooding these changes against a real bug fix — it documents current (buggy) behavior tests need to account for, not a pattern to imitate.

Test plan

  • Open a fresh Claude Code session in this repo and confirm CLAUDE.md loads lean (no GCI/class-sync/MCP detail) unless the relevant files are touched
  • Touch a file under client/src/gciLibrary.ts / client/src/sync/** / mcp-server/** and confirm the matching .claude/rules/*.md auto-loads
  • Touch a file under client/src/__tests__/** and confirm its CLAUDE.md auto-loads
  • git status shows .claude/settings.local.json (if present) as ignored, and .claude/rules/*.md as tracked

…to context pollution by applying progressive disclosure
…ts to circumvent a current issue with un-awaited promises.

I added this because while testing the CLAUDE.md changes with a real bug fix the agent stumbled upon this unpredictable behavior
@MatiasFernandez MatiasFernandez requested a review from npapagna July 3, 2026 17:39
@MatiasFernandez MatiasFernandez marked this pull request as ready for review July 3, 2026 17:39
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