agentleFS
isabelle-barpisabelle-barp/agent-brain/CLAUDE.md

agent-brain

CLAUDE.md0 starsChanged 5 months agoApache-2.0View on GitHub

This repo IS the centralized Claude Code configuration that gets symlinked into host projects as their .claude/ content. You are editing the system, not using it. Blast radius: every change here propagates immediately to every wired project. Treat edits with the same discipline the system demands of its own agents. Do not confuse this file with CLAUDE_TEMPLATE.md — that is the template host projects copy as their CLAUDE.md. This file governs work on the config repo only. Adding or renaming…

  • Commits and pushes

The file

We split this CLAUDE.md into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not confuse this file with CLAUDE_TEMPLATE.md — that is the template host projects copy as *their* CLAUDE.md.

    line 5
  2. Distinctive:

    Run before every commit; a failure is a stop, not a warning:

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md — working on global-claude-files itself

This repo IS the centralized Claude Code configuration that gets symlinked into host projects as their .claude/ content. You are editing the system, not using it. Blast radius: every change here propagates immediately to every wired project. Treat edits with the same discipline the system demands of its own agents.

Do not confuse this file with CLAUDE_TEMPLATE.md — that is the template host projects copy as their CLAUDE.md. This file governs work on the config repo only.

Non-negotiable editing rules

  1. Frontmatter is load-bearing. Every file in agents/ requires valid YAML frontmatter: name (kebab, MUST equal the filename minus .md), description (with when-to-use triggers), model ∈ fable | opus | sonnet | haiku (NEVER inherit — model routing is always explicit; criterion in docs/templates/AGENT_TEMPLATE.md), tools (minimal set; report-only agents get no Edit/Write). A frontmatter error silently kills the agent.
  2. Filenames are interfaces. commands/<name>.md ⇒ /​<name>. Kebab-case for commands/, agents/, skills/; SCREAMING_SNAKE for rules/, docs/, workflows/ (see rules/MARKDOWN_FILENAME_CONVENTION.md §Scope). APFS is case-insensitive: case-only renames require explicit git mv (plain mv leaves the old casing tracked) and same-letter UPPER/kebab names collide on disk.
  3. Rule IDs are permanent. R-<FAMILY>-NN never gets renumbered or deleted — deprecate in place. Every rule file carries the Family code / Loaded by metadata header. New family ⇒ add it to rules/README_RULES.md §4.2 list AND §7 catalog.
  4. Skills have a wire format. Every skills/*/SKILL.md carries frontmatter (name = directory name). Every skills/stack-*/SKILL.md additionally carries the five literal headings: ## When this applies, ## Implementation patterns, ## Testing on this stack, ## Spec validation checks, ## Live validation commands — spec validators delegate by the exact heading text, so renaming a heading silently disables those checks. The skills/flow-* playbooks are process flows, not stack overlays (nothing stack-detects them): they carry only ## When this applies and ## Spec validation checks — do NOT bolt the other three empty headings onto them.
  5. Stack-agnostic cores. Agent/rule/workflow cores never name a concrete stack, broker, cloud, or MCP server. Stack detail lives in skills/stack-*; project detail lives in the host's generated docs/. If you are typing "Prisma", "NATS", or "datagrip" outside skills/ or docs/DEFAULT_TARGET_ARCHITECTURE.md, stop.
  6. Honest automation. Never document an "auto-trigger" the harness does not execute. Real mechanisms: the six hooks in settings.template.json (UserPromptSubmit → hooks/prompt-banner.sh, SessionStart → hooks/session-start.sh, PreToolUse on the subagent-dispatch tool → hooks/subagent-model-guard.sh + hooks/dispatch-attempt-guard.sh, PreToolUse on Write/Edit/MultiEdit/NotebookEdit → hooks/subagent-scope-guard.sh, PreToolUse on Workflow → hooks/workflow-model-guard.sh). Everything else is a documented orchestrator protocol — word it that way.
  7. A modification invalidates a prior review tick. Every file you edit MUST have its REVIEW_FILES.md entry flipped from - [x] to - [ ] in the SAME response (one Edit per file touched; the box stays unticked until a human re-reviews). Applies to every tracked file the checklist names — agents, commands, rules, workflows, docs, scripts, hooks, templates, root files. Exempt: edits to REVIEW_FILES.md itself and to the two generated digests (rules/AUDIT_DIGEST_*.md, regenerated mechanically). A ticked box on a file you just modified is a stale-review HARD VIOLATION.

Cross-file consistency contract

Adding or renaming an agent, command, rule, skill, or layer touches ALL of these — partial updates are the repo's historical failure mode (see AUDIT.md):

You changedMust also update
agent (add/rename/model)Task→Agent matrix in CLAUDE_TEMPLATE.md + workflows/FEATURE_WORKFLOW.md · README directory-map counts · rules/ Loaded-by headers naming it · MIGRATION.md routing table
commandthe matrices above · README count · every file referencing the slash name (grep -rn '/<name>')
rule / rule IDrules/README_RULES.md §7 catalog (+ §4.2 if new family) · agents whose Self-audit/Inputs list the file · hooks/PROMPT_REMINDERS.md if it has a reminder line · regenerate the audit digests (scripts/generation/generate-audit-digest.sh) for any code-pattern change — AUDIT_DIGEST_*.md are GENERATED, never hand-edited
skillREADME skills row · agents/repository-discovery.md detection-evidence examples (bare token) · stack-consuming agents if the token set changed
layer labellayer enum in agents/planner.md (TASKS.md format) · both workflow matrices · the matching commands/dev-*.md / test-*.md
TASKS.md per-task formatagents/planner.md §"Phase 7" owns the canonical spec; workflows/FEATURE_WORKFLOW.md Phase B links to it (no fenced restate); docs/ISSUE_PATTERN.md mirrors body fields; docs/CONVENTION_MIGRATIONS.md gets an M-NNN entry when a new task field lands (host TASKS.md needs re-plan via /sync-conventions)
spec §-map or artifact pathsall 11 agents/spec/* + docs/templates/SPEC_TEMPLATE.md + commands/create-spec.md + both workflows — in lockstep, never partially
devcontainer/ artifactsdevcontainer/README.md + rules/DEVCONTAINERS.md (R-DEVC-03) + the template devcontainer.json + docker-compose.yml + sidecar trio (Dockerfile.sidecar, sidecar-firewall.sh, sidecar-entrypoint.sh) + agent/ profile + scripts/orchestration/spawn-agent-run.sh (compose project/workspace env) + agents/devcontainer-engineer.md — in lockstep (privilege model, firewall behavior, mounts), never partially. Two shared images now: claude-sandbox AND claude-dind-sidecar
CLAUDE_TEMPLATE.mdhost projects' CLAUDE.md copies go stale — scripts/sync/sync-template.sh --check detects (sync stamp), --apply re-merges
github/ payload (labels, forms)github/labels.yml ↔ rules/ISSUE_GOVERNANCE.md taxonomy/dispatch table ↔ docs/ISSUE_PATTERN.md ↔ planner's issue-creation phase — in lockstep. Carve-out: the Block: B-N body field documented in ISSUE_PATTERN.md (autopilot --blocks mode only) is intentionally NOT mirrored in github/ISSUE_TEMPLATE/task.yml — autopilot creates these issues via gh API not the form, so a manual form slot would just confuse human filers; the contract spans planner → ISSUE_PATTERN → gh API, bypassing the form.
host-impacting convention (a rules/* shape, docs/ISSUE_PATTERN.md, a template, or any change existing host live-artifacts must adopt)append a docs/CONVENTION_MIGRATIONS.md entry (M-NNN) so wired hosts learn via /sync-conventions — see rules/CONVENTION_SYNC.md; no entry = hosts silently violate the new convention. Internal-only / new-artifact-only changes need none

Pre-commit verification (this repo's definition of "live validation")

Run before every commit; a failure is a stop, not a warning:

# 1. All frontmatter parses; names match filenames; models are legal
ruby -ryaml -e 'Dir.glob("agents/**/*.md").each { |f| d=YAML.load(File.read(f,encoding:"UTF-8").split(/^---\s*$/)[1]); raise f unless %w[fable opus sonnet haiku].include?(d["model"]) && d["name"]==File.basename(f,".md") }; puts "agents OK"'
# 2. No dangling .claude/* references (new/edited files)
grep -roE '\.claude/(rules|skills|agents|commands|docs|workflows)/[A-Za-z0-9_./-]+\.(md|yml)' <changed files> | sort -u | while read r; do [ -e "${r#.claude/}" ] || echo "DANGLING: $r"; done
# 3. No uppercase tracked files outside rules/docs/workflows/hooks (SKILL.md exempt)
git ls-files | grep -E '^(agents|commands)/.*[A-Z]'
# 4. Dead-convention residue (must be empty outside AUDIT.md/MIGRATION.md):
grep -rln --include='*.md' --exclude='CLAUDE.md' -iE '\.brain/|business/specs|tmp/business|spec-writer' . | grep -vE 'AUDIT|MIGRATION'
# 5. Script regression tests (hooks + wiring + digest generator + convention-sync + lane pool + supervisor + cross-refs)
hooks/prompt-banner.test.sh && hooks/session-start.test.sh && hooks/subagent-model-guard.test.sh && hooks/subagent-scope-guard.test.sh && hooks/dispatch-attempt-guard.test.sh && hooks/workflow-model-guard.test.sh && scripts/project/wire-project.test.sh && scripts/sync/sync-template.test.sh && scripts/project/create-new-project-at.test.sh && scripts/generation/generate-audit-digest.test.sh && scripts/project/list-wired-projects.test.sh && scripts/orchestration/lane-pool.test.sh && scripts/orchestration/supervisor.test.sh && scripts/validation/validate-cross-refs.test.sh
# 5a. Cross-reference validator itself (file refs + R-IDs + duplicates + digest freshness)
scripts/validation/validate-cross-refs.sh
# 6. Audit digests are fresh (regenerate on any code-pattern rule change)
scripts/generation/generate-audit-digest.sh --check
# 7. The two Task→Agent matrices reference the SAME agent set (guards the convention-reconciler-class drift):
a=$(ls agents/*.md | xargs -n1 basename | sed 's/\.md$//' | sort -u); \
t=$(grep -oE '`[a-z][a-z0-9-]+`' CLAUDE_TEMPLATE.md | tr -d '`' | sort -u); \
w=$(grep -oE '`[a-z][a-z0-9-]+`' workflows/FEATURE_WORKFLOW.md | tr -d '`' | sort -u); \
miss=$(comm -23 <(echo "$a") <(echo "$t"); comm -23 <(echo "$a") <(echo "$w")); \
[ -z "$miss" ] && echo "matrices in sync" || { echo "MATRIX DRIFT — agent missing from a matrix:"; echo "$miss"; }

These checks are mechanized — activate the git hooks once per clone: git config core.hooksPath scripts/git-hooks (details in scripts/README.md).

  • pre-commit → scripts/validation/validate-all.sh runs the fast validators (checks 1–7) on every commit.
  • pre-push → validators + full *.test.sh suite + render of the diagrams changed in the push (rendering all ~60 every push is too slow — validate-all.sh --full renders all, for CI). Render degrades to a WARN when mermaid-cli is offline, so a push is never blocked by missing tooling.
  • post-turn Stop hook (.claude/settings.json → scripts/validation/validate-changed.sh) runs only the validators relevant to the changed files after every turn, surfacing drift (non-blocking) before you commit.

Those three are the DETERMINISTIC keeper. The SEMANTIC keeper — prose-vs-reality drift no script can judge (agent claims vs the rules they cite, command docs vs behavior, README/matrix accuracy) — is the brain-local /maintain-brain command: report-and-propose, never silent (the brain's blast radius is every wired project). It is NOT in the symlinked commands/, so it never reaches hosts.

Git discipline

Conventional Commits, atomic (one concern per commit), imperative subject. Direct-to-main, no exceptions (this repo follows the same R-VCS-07 trunk-based rule it prescribes for hosts — see rules/VERSION_CONTROL.md). Remote: origin → git@github.com:isabelle-barp/global-claude-files.git — push after every commit batch (git push); never force-push (host projects symlink against this history). History note: this public mirror ships a sanitized history (identities rewritten, pre-refactor private artifacts removed); the pre-refactor baseline and anything ever deleted are recoverable only from the private original.

Decision records

AUDIT.md = what was broken and why (2026-06 repair). MIGRATION.md = every design decision, including the deliberately revertable ones (the feature-branch isolation model, R-CLEAN-16, model tiers). Read MIGRATION.md before "fixing" something that looks odd — several oddities are documented decisions with stated revert paths. New decisions of that weight get appended there, not buried in commit messages.

Testing changes safely

Wire a sandbox project before trusting an edit: ./scripts/project/wire-project.sh /path/to/scratch-repo (symlinks the seven dirs, copies the two templates, idempotent), run /repository-bootstrap, then exercise the changed surface (claude /agents must list all agents — a parse failure drops the agent silently).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.