agentleFS
AnastasiyaWAnastasiyaW/codex-claude-code-config/AGENTS.md

codex-claude-code-config

AGENTS.md153 starsChanged 7 months agoMITView on GitHub

This is a configuration system repository for AI coding agents, not an application. It collects battle-tested architectural principles, security hardening, and decision frameworks that any coding agent can drop into any project. When the user asks you to "set up this project" or "apply these principles": Every clone/copy/move/sync command requires a .claude/transfers/<id>.json contract and a # transfer-contract: marker. The contract records source, destination, operation/settings, purpose, motivation, deadline, verification, source cleanup, and the next action. The transfer Stop hook blocks unfinished…

The file

Show its rules and text

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

15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the user asks you to "set up this project" or "apply these principles":

    line 19
  2. Distinctive:

    Read README.md first - it maps principles to the problems they solve

    line 21
  3. Very specific:

    Read principles/README.md for the maturity-level map (L1 -> L2 -> L3)

    line 22
  4. Distinctive:

    Do NOT bulk-copy everything.

    line 23
  5. Distinctive:

    Before copying a principle, verify the user's stack matches the examples

    line 29
  6. Very specific:

    After setup, run scripts/validate_config.py --strict and the relevant hook self-tests to catch drift in the freshly assembled config

    line 30
  7. Very specific:

    Every clone/copy/move/sync command requires a .claude/transfers/<id>.json contract and a # transfer-contract: marker.

    line 34
  8. Distinctive:

    When the user's acceptance condition is a finished job, dataset, migration, rollout, or other terminal outcome, a schedule/watchdog is a …

    line 42
  9. Distinctive:

    If an additional mechanism compensates for a weakness introduced by the base solution, first revise or simplify the base candidate.

    line 72
  10. Very specific:

    Keep SKILL.md under 5000 words.

    line 98
  11. Very specific:

    After installing into a local Codex/Claude environment, also run python scripts/test_task_completion_hooks.py and consult …

    line 121
  12. Very specific:

    When the user explicitly authorizes automatic cooperation and the current work has two or more independent, bounded scopes (not merely two …

    line 127
  13. Very specific:

    Before dispatching any Claude subagent, render the task-bound contract with python hooks/agent-skill-contract.py --task "<child task>".

    line 132
  14. Distinctive:

    No timestamps or dynamic content

    line 163
  15. Very specific:

    When a verified RTK executable is available, use it only for repetitive, diagnostic shell output such as rtk git status, rtk git diff, rtk …

    line 176

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

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

AGENTS.md

This is a configuration system repository for AI coding agents, not an application. It collects battle-tested architectural principles, security hardening, and decision frameworks that any coding agent can drop into any project.

Purpose

  • principles/ - architectural principles, each preventing a specific failure mode
  • alternatives/ - side-by-side comparisons of 2-5 approaches per problem
  • hooks/ - ready-to-use Python hook scripts (session management, safety guards); installer: scripts/install_hooks.py
  • templates/ - starter CLAUDE.md and REVIEW.md files for different project types
  • skills/ - domain-specific knowledge bundles (loaded on demand)
  • rules/ - drop-in .claude/rules/ files (agent-harness design rules live on-demand in the agent-harness-design skill, not always-on)
  • workflows/ - dynamic-workflow commands + cost lessons
  • scripts/ - utilities (hook installer, config drift validator, KV-cache stats, public-repo sync)
  • CLAUDE.md - Claude Code-specific overlay (extends this file)

How agents should use this repo

When the user asks you to "set up this project" or "apply these principles":

  1. Read README.md first - it maps principles to the problems they solve
  2. Read principles/README.md for the maturity-level map (L1 -> L2 -> L3)
  3. Do NOT bulk-copy everything. Pick what matches the user's actual project:
    • Any project: Principle 09 (Supply Chain Defense), Principle 10 (Agent Security), Principle 11 (Documentation Integrity)
    • Long sessions expected: Principle 07 (Codified Context) + alternatives/context-management.md
    • Long-running project: templates/long-run-project/, a Git worktree with an origin remote, and an agent-facing KB before creating feature_list.json (that marker enables the completion gates)
    • Multi-agent work: Principle 01 (Harness Design) + Principle 06 (Multi-Agent Decomposition)
    • Iterative optimization: Principle 03 (Autoresearch)
  4. Before copying a principle, verify the user's stack matches the examples
  5. After setup, run scripts/validate_config.py --strict and the relevant hook self-tests to catch drift in the freshly assembled config

File transfers

Every clone/copy/move/sync command requires a .claude/transfers/<id>.json contract and a # transfer-contract: marker. The contract records source, destination, operation/settings, purpose, motivation, deadline, verification, source cleanup, and the next action. The transfer Stop hook blocks unfinished or invalid records; never remove a source before the destination is verified.

Long-running completion supervisors

When the user's acceptance condition is a finished job, dataset, migration, rollout, or other terminal outcome, a schedule/watchdog is a completion supervisor, not a passive status monitor. An early process exit without a terminal receipt is INTERNAL_FIXABLE or RETRYABLE: reconcile the possible side effect, then perform the next safe idempotent resume/repair within a durable attempt budget. A .failed marker or failed receipt proves that an attempt failed; it does not prove that the cause is external. A reproducible local input or software defect remains INTERNAL_FIXABLE: preserve its evidence, make the minimal Git-backed causal repair and successor contract, then resume from the last valid checkpoint. A generated prompt may use report-only/never-restart behavior only when the user explicitly requested observation-only operation or a measured external/irreversible boundary makes recovery unauthorized. Persist process identity, checkpoint/output, idempotency key, attempt/limit, recovery predicate, and terminal proof; a heartbeat or blocker paragraph is not progress by itself.

Reasoning Policy: Selection Before Expansion

Core rule: a sufficient solution is a reason to stop expanding, not an invitation to add optional improvements.

Within the discretion left to you, keep any material solution you create or choose as a candidate until its necessity, sufficiency, material consequences, and total ownership cost support it as the simplest known way to satisfy the requested outcome and required contracts.

Once a sufficient solution exists, do not propose or add improvements by inertia. Treat every additional mechanism, abstraction, safeguard, edge-case handling, future-proofing measure, or process as a separate candidate. Include it only when an accepted requirement, an applicable constraint, or an evidenced material risk justifies its total implementation, verification, and ownership cost. Possible usefulness, best practice, or a desire for greater completeness is not sufficient justification.

If an additional mechanism compensates for a weakness introduced by the base solution, first revise or simplify the base candidate. Stop when the outcome and required contracts are satisfied. Do not include optional improvements or rejected candidates unless the user explicitly asks for them.

This gate does not authorize reopening accepted requirements, explicit operator decisions, or governing sources.

Written in English deliberately: these instructions are read by models that reason in English first, so a Russian original risks being applied through a translation nobody reviewed.

Relation to the two advisories in hooks/. over-engineering-advisor asks whether a change is the smallest solution; module-shape-advisor asks whether a file has outgrown its shape. This policy is the reasoning-level rule they enforce mechanically at opposite ends, and it is what keeps them from being read as contradicting each other: neither argues for more or less code as such, both ask whether the next addition has earned its cost.

Style conventions for this repo

  • Principles are standalone files in principles/NN-name.md
  • Each principle has: Overview, The Paradigm, The Mechanism, Case Study, Sources
  • Alternatives follow the 5-approach comparison format with a decision table
  • Skills are skills/<category>/<name>/SKILL.md with an optional references/ folder
  • Descriptions must be model triggers, not human summaries
  • Keep SKILL.md under 5000 words; detail goes in references/

Do not touch

  • principles/ existing files: edit only to fix drift, not to restructure
  • scripts/validate_config.py: any change requires re-testing against the full repo
  • LICENSE, UPDATES.md commit history: append only

Commands

This repository has no application build or deploy step. Its verification suite checks documentation, skills, hook behavior, and live runtime wiring:

python scripts/validate_config.py --strict
python scripts/generate_skills_lock.py --check
python scripts/generate_skills_catalog.py --check
python evals/hooks/run_hook_evals.py
python scripts/test_lifecycle_hook_contracts.py
python scripts/test_dependency_provenance_guard.py
python scripts/dependency-alternatives.py --self-test
python scripts/test_test_strategy.py

After installing into a local Codex/Claude environment, also run python scripts/test_task_completion_hooks.py and consult docs/runtime-wiring.md.

Delegating agents

When the user explicitly authorizes automatic cooperation and the current work has two or more independent, bounded scopes (not merely two coupled files), dispatch them with the actually available native collaboration.spawn_agent/Task tool and join their receipt-bound results as required by rules/finish-the-task.md.

Before dispatching any Claude subagent, render the task-bound contract with python hooks/agent-skill-contract.py --task "<child task>"; use --profile codex only for a manually rendered Codex brief. Append it to the exact child prompt. It selects the minimum curated skill set (or an explicit no-route result), requires source-backed decisions, and records INCONCLUSIVE when no current source is available. Claude Task and Codex PreToolUse(Agent)/PostToolUse(Agent) plus SubagentStart/SubagentStop are contract enforcement only where those events are actually emitted; current desktop collaboration.spawn_agent bypasses them and has LIMITED transcript coverage under the linked rule. The rendered contract also keeps explicit task instructions above skill methodology and requires the child to name the exact skill instruction whenever that methodology causes a pause or divergence. A missing routed skill starts a bounded search: inventory and audit candidates with the existing install checklist; if none passes, build a research-backed local skill with real-task evidence, primary sources, baseline and held-out evals, independent review, and an owner/version/update/rollback contract, then resume the original task. The gate measures behavior and maintainability, not size. It does not stop the task or authorize an unreviewed third-party install. Codex PreToolUse(Agent) adds a client-profile-bound contract before launch and its post-hook binds the route to agent_id; unavailable capabilities stay in missing-skills, never masquerade as loaded Claude-only skills. SubagentStop rejects a routed NO_MATCH and accepts GAP_RESOLVED only when per-source research maps to exact skill instructions, typed case evidence beats the baseline, and a separate digest-bound receipt proves the resumed original task.

Context engineering notes

This file is designed for KV-cache efficiency and the 150-line AGENTS.md standard:

  • Under 80 lines - fits in a single cached prompt prefix
  • No timestamps or dynamic content
  • Stable section order - do not shuffle
  • Append-only edits preferred over restructuring
  • For Claude Code-specific behaviors (hooks, skills automation), see CLAUDE.md as an overlay

Related standards

Optional RTK Output Compression

When a verified RTK executable is available, use it only for repetitive, diagnostic shell output such as rtk git status, rtk git diff, rtk git log, rtk read, and supported test runners. Preserve raw output for exact evidence, novel commands, destructive operations, and logs where ordering matters. RTK does not replace safety hooks or test gates; its failure mode must be pass-through.

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.