AI-Rig
AGENTS.md31 starsChanged 3 months agoApache-2.0View on GitHub
Apply these repository product principles to every plugin built here: These generic rules ship in the global template (section names as in that file) and are not restated here: core principles and focused delegation (§Execution Discipline, §Subagent Spawn Rules, §Code Quality), internal record types (packaged shared/global-baseline-details.md §"Code standard details", Internal records), docstring opening line (§Docstring Style Resolution), Multi-OS Executables, Markdown Authoring, the lossless instruction compression gate (§Scope And Layering), pytest parametrization, marker discipline and xdist isolation (§Testing), pre-commit hooks over…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- benchmarks/AGENTS.mdAGENTS.md
- plugins/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- plugins/CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- Distinctive: line 23
Treat routine incomplete handoffs and self-created process blockers as defects, not successful outcomes.
- Very specific: line 31
All edits stay inside this project directory.
- Distinctive: line 34
Never initiate propagation mid-task.
- Very specific: line 40
Before changing any shipped version or serialized artifact schema, identify its version family and read that family's value from the last …
- Very specific: line 42
Check the proposed value against HEAD before handoff and record the comparison with the affected verification.
- Very specific: line 76
Use semantic markers: integration for real component interactions.
- Very specific: line 94
Run focused tests with .venv/bin/python -m pytest <paths> and broaden to the affected suite before completion.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.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.
Files
AI-Rig — Project-Only Agent 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 and 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 (the Codex Rig global template plugins/codex-rig/assets/AGENTS.md or
plugins/codex-rig/shared/; foundry rules for Claude), never added here. This file holds only this repository's own conventions and restates none of the shipped baseline.
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.
Shipped Global Baseline
These generic rules ship in the global template (section names as in that file) and are not restated here: core principles and focused delegation (§Execution Discipline, §Subagent Spawn Rules, §Code Quality), internal record types (packaged shared/global-baseline-details.md §"Code standard details", Internal records), docstring opening line (§Docstring Style Resolution), Multi-OS Executables, Markdown Authoring, the lossless instruction compression gate (§Scope And Layering), pytest parametrization, marker discipline and xdist isolation (§Testing), pre-commit hooks over bare lint tools (§Code Quality, Project hygiene), benchmark isolation (§Testing), plan isolation (§Work Handover) and Notebook Authoring. Sections below add only this repository's specifics. This repository supports Linux, macOS, and native Windows, so the conditional Multi-OS Executables rule always applies here.
Edit Scope
- All edits stay inside this project directory. Never edit
$CODEX_HOMEor~/.claude/directly — both are install targets populated from this checkout, and a hand-edit there is overwritten on the next sync. - Permitted roots:
.codex/(Codex config, skills, session policy),.claude/settings.jsonand.claude/settings.local.json,plugins/*/{agents,skills,rules,hooks,bin,src,scripts,tests}/. - The Makefile installs from the pushed GitHub remote, not the local working tree: commit and push first, then
make sync-claudeormake sync-codex. Running it against uncommitted work silently installs the previous state. - Never initiate propagation mid-task; it is a deliberate human-triggered step.
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
HEADbefore 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/AGENTS.md. - Plugin release versions are determined at commit time, never while editing: manifests keep their
HEADvalue during the work, and the committing step derives each bump from that plugin's## Unreleasedchangelog 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/AGENTS.md §Version Pre-Bump Gate). - 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~1forgit commit --amend), notHEAD: keep the existing bump rather than adding another, and roll back any second bump to one step past the parent.
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 layer | Mechanism |
| Claude Bash tool | Byte-identical plugin bin/python fallback, propagated by propagate_shared.py; real system python keeps its PATH precedence. |
| Claude hooks | Plugin-owned hook launchers; JavaScript hooks retain their existing Node probe and SessionStart diagnostic. |
| Codex helper recipes and hooks | Explicit plugin bin/python on POSIX or bin/python.cmd on native Windows; quote paths for the host shell. |
| Codex MCP servers | Fixed python executable prerequisite, checked during setup; no global shim installation or automatic PATH modification. |
- Guards:
tests/test_hook_interpreter_fallback.pyandplugins/codex-rig/tests/packaging/install/test_sync_codex.py. Extend them when adding a launch layer.
Adversarial Convergence Loop
The loop ships in the global template. In this repository read the source-tree copy plugins/codex-rig/shared/adversarial-loop.md directly before every independent review → authorized-fix cycle: the installed copy lags the working tree until it is published and synced.
Lossless Instruction Compression Handover Gate
The gate ships in the global template (§Scope And Layering). Repository specifics: this repository's calibration gate (plugins/codex-rig/runtime/calibration/run.py --layout plugin) is mandatory; save the byte-exact backup under .codex/caveman-compress/backups/, and plugin-specific authoring, installability, cross-reference, versioning, and verification rules live in plugins/AGENTS.md.
Test Selection
Generic marker discipline ships in the global template (§Testing). This repository's vocabulary and commands:
- Use semantic markers:
integrationfor real component interactions;installed_pluginfor tests runnable without repository context;packagingfor build/install/payload contracts;livefor real external services or credentials. installed_plugindoes not implypackaging. Alivetest also carriesintegrationand retains explicit opt-in guards; selection never authorizes network or paid execution. Capability probes remain separate.- From the repository root, use
.venv/bin/python -m pytest -m installed_pluginor.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 follow the global template (§Testing); this repository's bookkeeping hook example is
check-shared-drift.
Multi-OS Verification
This repository supports Linux, macOS, and native Windows, so the shipped multi-OS rules always apply (global template §Multi-OS Executables; packaged shared/global-baseline-details.md carries the detail).
- 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 those bullets (decode in pipe 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.
Project Workflow
- Python minimum: 3.10. The 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 useuv sync --only-group bench. - Run focused tests with
.venv/bin/python -m pytest <paths>and broaden to the affected suite before completion. - The
plugins/opencode-rignpm package is the Node exception:make rig-checkruns its typecheck, Prettier, Vitest, version-source, and tarball gates, andnpx vitest run <paths>is the focused form. - 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 4for 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>/binlist (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. - The generic xdist isolation rule ships in the global template (§Testing); in this repository the usual shared machine-global state is a
${TMPDIR}sentinel without its-${CSID}suffix. - Lint/format edits via the pinned pre-commit hooks (generic rule: global template §Code Quality, Project hygiene):
pre-commit run ruff-check --files <changed-python-paths>,pre-commit run ruff-format --files <changed-python-paths>, andpre-commit run mdformat --files <changed-markdown-paths>; directrufformdformatinvocation drifts from the version/config pinned in.pre-commit-config.yaml. Usepre-commit run --all-filesonly when the task requires the repository-wide gate. - Release and build entry points are plugin-specific; follow
plugins/AGENTS.mdand the owning plugin's scripts and README. Remote publication remains human-owned.
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
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.

