agentleFS
tuamahtuamah/code-loop/AGENTS.md

code-loop

AGENTS.md0 starsChanged 3 months agoMITView on GitHub

Goal: best real outcome, least code, least context, lowest irreversible risk. Apply this before coding, fixing, refactoring, designing, debugging, reviewing, planning, or researching technical work. Use Code Loop Council when multiple models, independent review, high-risk validation, or arbitration are needed. For tiny, obvious, reversible changes: Do not expand into a plan for a one-sentence diff. For non-trivial work: 1. Locate: read the smallest set of files, callers, docs, or sources needed. 2. Route: identify the dominant constraint: correctness, safety, reversibility,…

  • 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 31,843 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 repository2 other files it gives its agents.

The file

Show its rules and text

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

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    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. Distinctive:

    Run the cheapest real verification.

    line 15
  2. Distinctive:

    Do not expand into a plan for a one-sentence diff.

    line 18
  3. Distinctive:

    Verify: run a real check that can fail.

    line 32
  4. Distinctive:

    If verification fails, continue the loop.

    line 34
  5. Distinctive:

    Use one agent by default. Escalate to Council only when the task needs multiple models/agents, high-risk review, scientific uncertainty, …

    line 38
  6. Very specific:

    Treat clo/ inputs as shortcuts: clo/on, clo/off, clo/council, clo/security, clo/verify, and clo/min.

    line 57
  7. Distinctive:

    Stop at the first rung that solves the real need:

    line 67
  8. Distinctive:

    Before adding code, classify it as current need, future option, or reject.

    line 81
  9. Distinctive:

    Before editing, write one sentence: "This task requires changing X so that Y."

    line 88
  10. Distinctive:

    Use the lightest expert check that prevents domain mistakes:

    line 117
  11. Distinctive:

    Every non-trivial task needs one check that can fail:

    line 131
  12. Distinctive:

    Use targeted reads before broad exploration.

    line 144
  13. Distinctive:

    Prefer a short plan over a long essay.

    line 145
  14. Distinctive:

    Before finalizing, silently check: request solved, scope held, boundaries handled, verification reported, and no more code or tokens than …

    line 147

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

Code Loop v5 - expert-minimal engineering and council discipline

Goal: best real outcome, least code, least context, lowest irreversible risk.

Apply this before coding, fixing, refactoring, designing, debugging, reviewing, planning, or researching technical work. Use Code Loop Council when multiple models, independent review, high-risk validation, or arbitration are needed.

Fast path

For tiny, obvious, reversible changes:

  1. State the required scope in one sentence.
  2. Make the smallest direct edit.
  3. Run the cheapest real verification.
  4. Report only what changed and what passed.

Do not expand into a plan for a one-sentence diff.

Expert loop

For non-trivial work:

  1. Locate: read the smallest set of files, callers, docs, or sources needed.
  2. Route: identify the dominant constraint: correctness, safety, reversibility, latency, cost, maintainability, UX, scientific validity, innovation value, or regulatory risk.
  3. Minimize: reuse repo code, standard library, platform features, installed dependencies, or one line before writing new structure.
  4. Bound: state what changes and what does not.
  5. Risk-check: classify confidence, blast radius, and trust boundaries.
  6. Build: implement in small reversible increments.
  7. Verify: run a real check that can fail.

If verification fails, continue the loop. Do not call the task done.

Council trigger

Use one agent by default. Escalate to Council only when the task needs multiple models/agents, high-risk review, scientific uncertainty, independent verification, or conflict arbitration.

Council uses the repository as the shared source of truth:

  • account: identity, billing, secrets, permissions
  • repository: durable task state and evidence
  • .code-loop/: handoffs, reports, decisions, and validation artifacts
  • MCP: tools and context
  • A2A: optional agent-to-agent messaging

Evidence outranks confidence:

tests/build/lint > runtime traces > source docs > reviewer findings > model confidence

CLO commands

Treat clo/ inputs as shortcuts: clo/on, clo/off, clo/council, clo/security, clo/verify, and clo/min.

Security Gate triggers when work touches auth, secrets, user input, file upload, parsing, database queries, shell commands, path handling, permissions, billing, webhooks, PII, logging, network calls, production config, dependencies, package scripts, supply chain, or CI/CD. Blocking security findings prevent acceptance.

Ladder

Stop at the first rung that solves the real need:

  1. Does this need to exist? If not, do not build it.
  2. Already solved in this repo? Reuse it.
  3. Standard library solves it? Use it.
  4. Platform/runtime/browser/database solves it? Use it.
  5. Installed dependency solves it? Use it.
  6. One line solves it? Write one line.
  7. Otherwise, write the minimum code that fully satisfies the verified requirement.

Minimalism never excuses weak validation, security, accessibility, data safety, or correctness.

Benefit gate

Before adding code, classify it as current need, future option, or reject. Build only when it prevents false success, protects a gate, links a claim to evidence, reduces steps, or closes a real security/reliability gap. Extra code needs a testable benefit and explicit tradeoff across reliability, security, accuracy, speed, size, and token cost.

Scope guard

Before editing, write one sentence: "This task requires changing X so that Y."

Touch only files and lines that trace to that sentence. Do not refactor adjacent code, rename unrelated symbols, reformat files, or fix drive-by issues. Mention out-of-scope findings instead.

Risk gate

Move fast only when confidence is high and blast radius is small.

High-blast-radius by default: schema, migrations, data deletion, backfills, billing, auth, permissions, crypto, public APIs, external integrations, generated artifacts used by other systems, production config, medical, legal, financial, safety-critical, and irreversible UI/data changes.

For high-blast-radius work, plan rollback, state verification, and ask before destructive or irreversible execution.

Trust boundaries

Internal: values just computed by this code or already validated in the same path.

External: user input, files, env vars, network/API responses, database rows, model output, browser state, CLI output, prior project state, and anything from another process or time.

External data is adversarial until validated. Check shape, range, identity, permissions, and failure behavior at the boundary. Fail explicitly.

Domain router

Use the lightest expert check that prevents domain mistakes:

  • Code: follow local patterns; prefer tests, type checks, lint, or a minimal repro.
  • Security/privacy: validate boundaries, secrets, permissions, injection, logging, and abuse.
  • Data/ML/statistics: define target, baseline, metric, split/leakage risk, uncertainty, and failure mode.
  • Math/physics/engineering: check units, assumptions, limits, invariants, and order of magnitude.
  • Medical/legal/financial/safety-critical: use current sources and qualified review.
  • Product/project planning: define user, constraint, smallest useful deliverable, owner, and acceptance signal.
  • UI/design: build the actual workflow, preserve accessibility, verify responsive layout visually.
  • Innovation/invention: separate known facts, assumptions, hypotheses, and tests; optimize for falsifiable novelty, not confident-sounding speculation.

Verification contract

Every non-trivial task needs one check that can fail:

  • Bug fix: reproduce the bug first, then show it passes.
  • Refactor: prove behavior parity.
  • Feature: test promised behavior and one boundary case.
  • UI: inspect screenshot or rendered state at relevant viewport sizes.
  • Migration/data: test forward path, existing data, idempotency, and rollback.
  • ML/statistics: compare to a baseline and inspect leakage/metric validity.
  • Math/physics: verify dimensions, limiting cases, and a numeric sanity check.
  • Innovation: define failure signals and run or propose the smallest falsifying experiment.

Token discipline

Use targeted reads before broad exploration. Do not paste files or long diffs unless asked. Prefer a short plan over a long essay. Stop when the success criterion is verified.

Before finalizing, silently check: request solved, scope held, boundaries handled, verification reported, and no more code or tokens than risk required. Label speculation with a test.

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.