agentleFS
BordaBorda/AI-Rig/CLAUDE.md

AI-Rig

CLAUDE.md31 starsChanged 3 months agoApache-2.0View on GitHub

Repository-wide policy belongs in this top-level file. Lower-scope instruction files inherit it and must add only narrower rules or explicit exceptions, never repeat the same policy. When a top-level policy changes, review lower layers for conflicts or obsolete duplication rather than copying the new text into them. This file is for maintaining this repository only and is never shipped — plugin users never see it. Anything general, meant for every project or every install, must be distributed in the plugin…

The file

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

9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When a top-level policy changes, review lower layers for conflicts or obsolete duplication rather than copying the new text into them.

    line 16
  2. Distinctive:

    Treat routine incomplete handoffs and self-created process blockers as defects, not successful outcomes.

    line 27
  3. Very specific:

    Before changing any shipped version or serialized artifact schema, identify its version family and read that family's value from the last …

    line 33
  4. Very specific:

    Check the proposed value against HEAD before handoff and record the comparison with the affected verification.

    line 35
  5. Very specific:

    ALL edits must stay within this project directory: Never directly edit ~/.claude/ or $CODEX_HOME (cache, settings, hooks, or any file under …

    line 42
  6. Very specific:

    Never run make sync-*/make clear-* against uncommitted/unpushed changes — cache will not reflect them

    line 53
  7. Distinctive:

    Never suggest or initiate propagation mid-workflow

    line 54
  8. Very specific:

    Run tests with .venv/bin/python -m pytest <paths> — not uv run pytest or a bare pytest.

    line 66
  9. Distinctive:

    Never write to MEMORY.md or create memory files

    line 129

≈ “Common” is an estimate: at least 1 in 5 of the 28,633 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

AI-Rig — Project-Only Instructions

<!-- Scope: maintaining this repository only; never shipped. Policy meant for every project or install goes into the plugin that ships it, never here. --><!-- policy-sibling-sync: CLAUDE.md, AGENTS.md, plugins/AGENTS.md, plugins/CLAUDE.md -->
  • Any policy change in one listed instruction file must trigger a relevance review of every other listed file before completion.
  • Synchronize applicable shared policy in either direction.
  • Preserve intentional agent-specific differences.
  • Record when no counterpart change is needed.

Instruction Layering

Repository-wide policy belongs in this top-level file. Lower-scope instruction files inherit it and must add only narrower rules or explicit exceptions, never repeat the same policy.

When a top-level policy changes, review lower layers for conflicts or obsolete duplication rather than copying the new text into them.

This file is for maintaining this repository only and is never shipped — plugin users never see it. Anything general, meant for every project or every install, must be distributed in the plugin that ships it (plugins/cc_foundry/rules/ or plugins/cc_foundry/CLAUDE.src.md for Claude, plugins/codex-rig/assets/AGENTS.md or plugins/codex-rig/shared/ for Codex), never added here. This file holds only this repository's own conventions and pointers to those shipped rules.

Plugin Design Principles

Apply these repository product principles to every plugin built here:

  • Make everyday workflows consistent, reliable, efficient, and focused on completing the user's practical goal. Choose the simplest design that meets the actual contract; avoid machinery that adds fragility without a current need.
  • Fix the proven root cause of plugin failures, never just patch their symptoms. Establish the cause with evidence and a falsification check before changing behavior; if it is unproven, continue investigating. Verify the original failure and affected sibling workflows before calling the fix complete.
  • Correct and recover automatically when authorized: reuse all still-valid, verifiable evidence and rerun missing, stale, or unusable work through the current workflow. Do not require repair or acceptance of older formats merely to resume.
  • Treat routine incomplete handoffs and self-created process blockers as defects, not successful outcomes. Stop honestly for genuine permission denials, unavailable prerequisites, or decisions that require the user; preserve safety, provenance, and required verification.

Version Continuity

This repository's own convention, not shipped policy: other projects commonly decide SemVer at release time rather than per commit.

  • Before changing any shipped version or serialized artifact schema, identify its version family and read that family's value from the last committed HEAD; do not use an earlier uncommitted edit or an unrelated nested version as the baseline.
  • A changed integer schema advances exactly one step from its committed current value. A new version family starts at 1. Keep older versions only as explicitly labeled historical readers; several revisions before the next commit still produce one bump from HEAD.
  • Check the proposed value against HEAD before handoff and record the comparison with the affected verification. Reject skipped or downgraded versions. Plugin release versions also follow the separate SemVer pre-bump gate in plugins/CLAUDE.md.
  • Plugin release versions are determined at commit time, never while editing: manifests keep their HEAD value during the work, and the committing step derives each bump from that plugin's ## Unreleased changelog entries for the changes the commit lands and writes it in the same commit as the changelog flip, consolidating that version's entries by topic first (plugins/CLAUDE.md §Versioning).
  • Serialized schema versions are not deferred: write them with the change, verify them, and advance them one step from HEAD, as above.
  • One step per commit, never skipped: every commit that changes a version family moves it exactly one step past the value in that commit's own parent. Amending, rebasing or squashing a commit that already carries a bump uses its parent as baseline (HEAD~1 for git commit --amend), not HEAD: keep the existing bump rather than adding another, and roll back any second bump to one step past the parent.

Edit Scope — Hard Constraint

ALL edits must stay within this project directory. Never directly edit ~/.claude/ or $CODEX_HOME (cache, settings, hooks, or any file under the user home).

Permitted edit roots (project-local):

  • .claude/settings.json, .claude/settings.local.json — project Claude config
  • .codex/ — project Codex config, skills, session policy (mirrored to $CODEX_HOME by Makefile, never edited there)
  • plugins/*/{agents,skills,rules,hooks,bin,src,scripts,tests}/ — plugin source

Propagation to live cache at ~/.claude/plugins/cache/:

  • Makefile installs from the pushed GitHub remote, not local working tree — commit and push first, then make sync-claude
  • Never run make sync-*/make clear-* against uncommitted/unpushed changes — cache will not reflect them
  • Never suggest or initiate propagation mid-workflow
  • Applies to all skills — no skill auto-syncs

Lint/Format — Use pre-commit Hooks, Not Direct Tools

Generic rule: foundry:rules/claude-config.md §Lint/Format (command forms: foundry:rules/python-code.md §Lint/Format). Hook ids (from .pre-commit-config.yaml): ruff-check, ruff-format, eslint, mdformat, codespell, pyproject-fmt, validate-pyproject, end-of-file-fixer, trailing-whitespace.

Test Workflow

  • Python minimum 3.10. Repository root is an environment anchor, not an installable package.
  • Python 3.10 is past end of life and will be deprecated soon: keep code and tests compatible on a best-effort basis, and fix a 3.10 failure at its source when the fix is small. Only when compatibility is too costly, mark that test @pytest.mark.skipif(sys.version_info < (3, 11), reason="<why>") instead of contorting the code; never skip a test whose failure shows a real defect.
  • Bootstrap test tooling with uv sync --only-group test; benchmark-only dependencies use uv sync --only-group bench.
  • Run tests with .venv/bin/python -m pytest <paths> — not uv run pytest or a bare pytest; the project venv is the pinned environment. Start focused, broaden to the affected suite before completion.
  • plugins/opencode-rig is the Node exception: make rig-check runs its typecheck, Prettier, Vitest, version-source, and tarball gates, and npx vitest run <paths> is the focused form. It has no pytest module.
  • Broad local runs go parallel: .venv/bin/python -m pytest -n 4 <paths> (pytest-xdist, already in the test group). Measured on the full suite: 11556 tests in ~5 min at -n 4, several times faster than the same run serial. Use -n 4 for any run wide enough to be worth waiting on; keep focused single-file runs serial, where worker startup costs more than it saves.
  • Coverage tracing is opt-in: CI passes the --cov=<plugin>/bin list (see .github/workflows/ci-tests.yml), and a local run measures only when you add --cov=<path> with --cov-report=term-missing. Keep sources out of [tool.coverage]: it also configures tests that start their own coverage run. Untraced is the default because tracing slows every test, most on Windows.
  • Reading a failure serially, and a pass-serial/fail-under--n test being a real isolation defect: foundry:rules/python-testing.md §Parallel Runs (pytest-xdist).
  • Optional pytest triage through rtk: rtk test .venv/bin/python -m pytest <paths> (the pinned runner prefix) keeps the exit code but hides assertion messages, -rs skip reasons and warnings, so use it only to find which tests fail, then re-run those raw. Never for --co, -rs, -s, warning review or completion proof.

Test Selection

Generic marker discipline: foundry:rules/python-testing.md §Test Selection — Markers. This repository's vocabulary and commands:

  • integration for real component interactions; installed_plugin for tests runnable without repository context; packaging for build/install/payload contracts; live for real external services or credentials.
  • installed_plugin does not imply packaging. A live test also carries integration and retains explicit opt-in guards; selection never authorizes network or paid execution. Capability probes remain separate.
  • Register selectors in repository and shipped test configuration.
  • From the repository root, use .venv/bin/python -m pytest -m installed_plugin or .venv/bin/python -m pytest -m "packaging and not live"; omit paths for project-wide discovery. On Windows use .venv\Scripts\python.exe.
  • Behaviour vs bookkeeping checks: foundry:rules/python-testing.md §Behaviour vs Bookkeeping Checks; this repository's bookkeeping hook example is check-shared-drift.

Shipped Generic Policy — Pointers

Policy below applies to any project; the full text ships in foundry (plugins/cc_foundry/rules/, delivered to Claude as ~/.claude/rules/foundry-<name>.md). Cited as foundry:rules/<file>.md. In this repository read plugins/cc_foundry/rules/<file>.md directly: the installed copy lags the working tree until it is published and synced with make sync-claude.

TopicFoundry home
Test parametrization (pytest.param IDs, trailing commas)python-testing.md §Test Structure
Python record types (dataclass default, dict boundaries)python-code.md §Structured Data
Docstring conventions (plain-English opening line)python-code.md §Docstring Style
Multi-OS executablespython-code.md §Multi-OS Executables; tests python-testing.md §Cross-OS Tests
Adversarial convergence loopquality-gates.md §Adversarial Convergence Loop; _full/adversarial-loop.md
Notebook authoring (.ipynb and Jupytext # %% scripts)notebooks.md; _full/notebook-style.md
Markdown authoring (no hard-wrap, structure selection)markdown.md §Markdown Authoring
Instruction-file compression gatemarkdown.md §Instruction-File Compression Gate
Plan and benchmark isolation from shipped contentartifact-lifecycle.md §Evidence Isolation

Repository-specific additions:

  • Adversarial convergence loop: AGENTS.md links the Codex source-tree entrypoint; Foundry ships a local copy for Claude.
  • Multi-OS executables: this repository supports Linux, macOS, and native Windows, so the conditional rule always applies here, without exception.
  • Windows is a CI gate, never a follow-up. Before handoff, a change touching subprocess output, file or sentinel writes, paths, environment, config locations, timeouts or fixtures is walked against the Multi-OS bullets above (decode in threads, CRLF sentinels, Git Bash paths, per-OS config, tight timeouts); macOS green is not evidence. A Windows-only failure is fixed in the code, or in an OS-aware test that keeps the case on every OS, never by a blanket skip. A fixture or test over 10 s on a Windows leg is optimized (one build per run shared across xdist workers, fewer spawned processes), not given a longer deadline.
  • Instruction-file compression gate: save the byte-exact backup under .codex/caveman-compress/backups/; this repository's calibration gate (plugins/codex-rig/runtime/calibration/run.py --layout plugin) is mandatory.

Interpreter Commands — Fix the Launcher, Not the Call Site

Claude recipe commands retain python identities used by allow rules and blueprint digests. Codex does not add plugin bin/ to shell PATH: its packaged helper recipes explicitly use the plugin's portable launcher, a narrow exception to the fixed-command rule.

  • Preserve explicit project interpreters, managed-environment commands, and recorded command identities. Never add per-call interpreter selection or repeat interpreter-selection instructions across skills.
  • Portable launchers validate the runtime before executing the workload, preserve arguments and exit status, and never retry a failed workload with another interpreter.
  • Fix each launch layer at its owning boundary:
Launch layerMechanism
Claude Bash toolByte-identical plugin bin/python fallback, propagated by propagate_shared.py; real system python keeps its PATH precedence.
Claude hooksPlugin-owned hook launchers; JavaScript hooks retain their existing Node probe and SessionStart diagnostic.
Codex helper recipes and hooksExplicit plugin bin/python on POSIX or bin/python.cmd on native Windows; quote paths for the host shell.
Codex MCP serversFixed python executable prerequisite, checked during setup; no global shim installation or automatic PATH modification.
  • Guards: tests/test_hook_interpreter_fallback.py and plugins/codex-rig/tests/packaging/install/test_sync_codex.py. Extend them when adding a launch layer.

Memory Policy

Nothing to auto-memory (~/.claude/projects/.../memory/). Learnings → skills, agents, rules, plugin files (versioned, distributed with plugin).

  • New rule/guideline → edit plugins/*/skills/*/SKILL.md, plugins/*/agents/*.md, or plugins/*/rules/*.md
  • Lesson/correction → update governing skill/agent/rule
  • Never write to MEMORY.md or create memory files

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.