agentleFS
howar31howar31/magi-workflow/references/AGENTS.md

magi-workflow / references

AGENTS.md3 starsChanged 7 months agoMITView on GitHub

This file is the single source of truth for how the coordinator and subagents operate inside a user's project. Every skill SKILL.md should read this before doing non-trivial work. English only. If a user's own CLAUDE.md or AGENTS.md (in their project root) contradicts something here, the user's file wins — it is the local override. The plugin uses three model classes; the right one for the right job: - Bump magi-developer to Opus via /magi:go --model opus when the task…

  • Reads credentials
  • Deletes or force-pushes
  • Commits and pushes
  • 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 repository16 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

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

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a user's own CLAUDE.md or AGENTS.md (in their project root) contradicts something here, the user's file wins — it is the local override.

    line 7
  2. Very specific:

    Never hard-code a specific model version (e.g.

    line 30
  3. Very specific:

    Always read the user's project conventions first (<project-root>/CLAUDE.md, <project-root>/AGENTS.md, .editorconfig, tsconfig.json, …

    line 36
  4. Distinctive:

    only: when those are missing or silent.

    line 39
  5. Distinctive:

    Comments: write why, not what. Skip obvious comments.

    line 47
  6. Very specific:

    Avoid barrel files (index.ts re-exporting) unless the project already uses them — they hurt tree-shaking.

    line 62
  7. Very specific:

    Keep module-level side effects out (no work in __init__.py beyond imports).

    line 72
  8. Very specific:

    Avoid interface{} / any; prefer concrete types or generics (Go 1.18+).

    line 80
  9. Very specific:

    All variables quoted: "$var".

    line 90
  10. Distinctive:

    Never use git commit --amend on commits that may have been pushed.

    line 138
  11. Very specific:

    Never use --no-verify to skip hooks.

    line 139
  12. Distinctive:

    Never sign commits as the user without their consent.

    line 140
  13. Distinctive:

    When code was AI-assisted, append:

    line 144
  14. Distinctive:

    When choosing between equivalent tools, prefer:

    line 155
  15. Distinctive:

    Always honour what the project actually uses.

    line 168
  16. Very specific:

    If the project has git hooks (.git/hooks/*), do not bypass them.

    line 198
  17. Distinctive:

    If a slash command is interrupted mid-flow, leave the artefacts in place (prompt files, workdirs, partial PLAN.md) so the user can resume.

    line 254
  18. Very specific:

    All SKILL.md / agent system prompts: English.

    line 262
  19. Distinctive:

    Commit messages: English subject.

    line 267
  20. Distinctive:

    Does not auto-commit or push code.

    line 274
  21. Common:

    Does not apply Terraform, deploy services, run migrations, or rotate secrets.

    line 275
  22. Distinctive:

    Does not auto-fix issues found in code review — surfaces them for human decision.

    line 277
  23. Distinctive:

    Does not access third-party services beyond the configured CLIs (claude / gemini / codex).

    line 279
  24. Very specific:

    Does not learn from the user's data — every invocation is stateless beyond ~/.config/magi-workflow/config.json.

    line 281
  25. Distinctive:

    Update this file alongside any change to skill behaviour.

    line 298
  26. Very specific:

    When in doubt: read the SKILL.md, then read AGENTS.md, then ask.

    line 302

≈ “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.

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

AGENTS.md — canonical guidelines for magi-workflow

This file is the single source of truth for how the coordinator and subagents operate inside a user's project. Every skill SKILL.md should read this before doing non-trivial work. English only.

If a user's own CLAUDE.md or AGENTS.md (in their project root) contradicts something here, the user's file wins — it is the local override.

1. Model routing

The plugin uses three model classes; the right one for the right job:

JobModel classWhy
Coordinator (main session) — planning, dispatching, validating, applying MAGI rulesOpus-classDeep reasoning, large context, judgement calls.
magi-developer subagent — TDD implementationSonnet-classFast, cheap, strong at structured code work.
magi-reviewer subagent — single-reviewer fallbackOpus-classDefensive review needs reasoning.
Multi-CLI MAGI reviewers (claude / gemini / codex)per CLI flagshipIndependent perspectives; each CLI's strongest model.

When to override

  • Bump magi-developer to Opus via /magi:go --model opus when the task involves multi-module refactors, intricate algorithm work, or the developer reported BLOCKED citing complexity on first dispatch.
  • Drop the multi-CLI MAGI to single-Opus via /magi:review-code --single when iterating quickly on tiny diffs and saving tokens matters.

Never hard-code a specific model version (e.g. claude-opus-4-7). Use the short class name (opus, sonnet) so the plugin keeps working when new versions release.

2. Coding standards (defaults if project is silent)

Always read the user's project conventions first (<project-root>/CLAUDE.md, <project-root>/AGENTS.md, .editorconfig, tsconfig.json, language-specific configs). The defaults below apply only when those are missing or silent.

Language-agnostic

  • Format: rely on the project's formatter (prettier, ruff format, gofmt, cargo fmt). If none, do not introduce one as a side effect.
  • Line length: respect .editorconfig if present; otherwise stay consistent with neighbouring files.
  • Comments: write why, not what. Skip obvious comments.
  • Test names: describe behaviour ("should reject empty email"), not implementation ("calls validateEmail").
  • No commented-out code — git history exists.

TypeScript / JavaScript

  • ESM modules (import / export) unless the project is CJS-only.
  • Strict TS: no any without justification; prefer unknown + narrowing.
  • Functions over classes for stateless work; classes only for things with identity / lifecycle.
  • Pure functions in libs; side effects pushed to edges.
  • File naming: kebab-case (user-profile.ts).
  • Identifier naming: camelCase for vars/funcs, UpperCamelCase for classes/types, SCREAMING_SNAKE for constants.
  • Avoid barrel files (index.ts re-exporting) unless the project already uses them — they hurt tree-shaking.

Python

  • 3.11+ if the project allows.
  • ruff for lint+format if available; else black + flake8.
  • Type hints on every public function.
  • pathlib over os.path for new code.
  • pytest over unittest unless the project commits to unittest.
  • Keep module-level side effects out (no work in __init__.py beyond imports).

Go

  • go fmt / goimports mandatory.
  • Idiomatic naming: short receivers (u *User), exported = capitalised, errors as last return value.
  • Avoid interface{} / any; prefer concrete types or generics (Go 1.18+).
  • Return errors, never panic in libraries.
  • Context propagation: every IO function takes ctx context.Context first.

Bash

  • set -uo pipefail at top. Avoid set -e — explicit || rc=$? is clearer for orchestration.
  • Bash 3.2 compatible (macOS default): no mapfile, readarray, declare -A, ${var^^}.
  • All variables quoted: "$var".
  • Initialise arrays before indexed access (arr=()).

3. Commit conventions

The plugin never auto-commits. When a user asks the coordinator to commit, follow these rules:

Format

Conventional Commits:

<type>(<scope>): <subject>

<body>

<footer>

<type> is one of:

  • feat — new feature
  • fix — bug fix
  • docs — documentation
  • refactor — code restructure, no behaviour change
  • perf — performance improvement
  • test — tests only
  • build — build system / dependencies
  • ci — CI config
  • chore — boring maintenance
  • revert — revert a previous commit

<scope> is optional but useful for monorepos (e.g. feat(auth): ...).

<subject> is imperative, lowercase, no trailing period, ≤ 72 chars.

<body> (when needed) explains the WHY. Wrap at ~72 chars. Bullet lists allowed.

<footer> may include BREAKING CHANGE:, Refs: #123, Co-Authored-By:.

Coordinator behaviour

  • One feature = one commit. Do not split a feature across multiple commits unless the user asks.
  • Documentation updates that accompany code changes go in the same commit as the code, not a follow-up.
  • Never use git commit --amend on commits that may have been pushed.
  • Never use --no-verify to skip hooks.
  • Never sign commits as the user without their consent.

Co-author trailer

When code was AI-assisted, append:

Co-Authored-By: Claude <model> <noreply@anthropic.com>

…where <model> is the model name visible in the session (e.g. Opus 4.7 (1M context)). Do this once per commit, not per file.

4. Tool preferences

When choosing between equivalent tools, prefer:

TaskPreferredFallback
Node package managerpnpmnpm (only if project uses it)
Python package / venvuvpip + venv
Search coderg (ripgrep)grep
Find filesfdfind
JSONjqpython json.tool
YAMLyqpython yaml
HTTPcurlwget
Processstructured logs (jq)grep on text

Always honour what the project actually uses. Do not introduce a new tool just because it is preferred — surface the preference as a "Note" but follow the project's existing toolchain.

5. When to ask vs when to act

Ask before

  • Deleting any file the user did not explicitly mark for deletion.
  • Running terraform apply, kubectl apply, gcloud ... create/delete, or any non-dry-run cloud mutation.
  • git push, git push --force, git rebase of pushed branches.
  • Opening a PR (gh pr create).
  • Sending a message to Slack / Discord / email / external API.
  • Installing a new dependency.
  • Modifying .git/, .gitignore, or hook scripts the user installed.
  • Running anything that touches ~/.ssh, ~/.kube, ~/.config/gcloud.

Act without asking

  • Reading any file in the project.
  • Running tests, lints, type-checks, formatters in dry-run / check mode.
  • Running git status / git diff / git log.
  • Creating files inside the sprint dir (magi/<num>-<slug>/) — this is scratch space the workflow owns.
  • Spawning a subagent dispatch via the Task tool, when the slash command expects it.

Special: hooks

If the project has git hooks (.git/hooks/*), do not bypass them. If a hook fails, surface the cause and let the user decide. Never --no-verify.

6. SSOT discipline

A sprint's magi/<num>-<slug>/ folder is the single source of truth for that feature. It owns:

  • PLAN.md — early exploration, options, recommendations
  • SPEC.md — formal spec with ADRs and acceptance criteria
  • TASKS.md — milestones and atomic tasks
  • WORKS.md — append-only journal of decisions made during execution
  • INFRA.md (when infra changes) — Terraform plan, IAM diff, cost
  • CI.md (when pipeline changes) — stages, secrets, deployment strategy
  • MAGI_PLAN_REVIEW.md, MAGI_CODE_REVIEW.md — multi-model verdicts

Any change to the feature flows through these documents. Code changes without a corresponding WORKS.md entry are an anti-pattern (the journal exists so future you can answer "why did we do it this way?").

Spec deltas (declared root-doc contract)

PLAN.md and SPEC.md carry a ## Spec deltas section declaring which project-level living documents (root SPEC.md / root CLAUDE.md / magi/PRD.md / magi/TECHSTACK.md) the sprint expects to modify. The section has four fixed subheadings; if no modification is planned, write (none) under the subheading rather than omitting it.

This is the sprint's outward-facing contract:

  • /magi:review-plan reviewers evaluate whether declared modifications are justified, complete, and non-conflicting with existing contracts.
  • /magi:commit (sprint mode) verifies the declarations against the actual diff. Missing modifications (D1) and undeclared modifications (D2) trigger interactive prompts; matched declarations (D3) pass silently.

TICKET.md and HOTFIX.md deliberately omit ## Spec deltas — they are scoped below the project-doc tier. Root-doc changes from those artifacts (rare) flow through /magi:commit's Level 1 heuristic only.

Spec deltas are prospective (declared at plan time); DRIFT.md is retrospective (detected at code-review time). The two are complementary: deltas declare intent for project-level docs, drift detects deviation against the per-sprint contract.

7. Decision points and pauses

The plugin pauses for user confirmation at every gate. Never skip a gate. The user is the final authority on:

  • PLAN approval (after /magi:plan)
  • TASKS approval (after /magi:tasks)
  • MAGI verdict acceptance (after /magi:review-plan or /magi:review-code)
  • Implementation acceptance (after each /magi:go batch)
  • Commit decision

If a slash command is interrupted mid-flow, leave the artefacts in place (prompt files, workdirs, partial PLAN.md) so the user can resume.

8. Output language

The plugin outputs human-facing text in config.output_language (default zh-TW). Internal text stays in English:

  • All SKILL.md / agent system prompts: English.
  • references/**: English.
  • Code identifiers, file paths, command names: English.
  • Prose in PLAN.md / SPEC.md / TASKS.md / WORKS.md / MAGI reports: in user's preferred language (zh-TW by default, configurable).
  • Commit messages: English subject; body may be bilingual or in user's language if the project convention allows.

9. What this plugin does not do

To set expectations and avoid scope creep:

  • Does not auto-commit or push code.
  • Does not apply Terraform, deploy services, run migrations, or rotate secrets.
  • Does not auto-fix issues found in code review — surfaces them for human decision.
  • Does not access third-party services beyond the configured CLIs (claude / gemini / codex).
  • Does not learn from the user's data — every invocation is stateless beyond ~/.config/magi-workflow/config.json.

10. Failure modes and what to do

SymptomWhat to do
~/.config/magi-workflow/config.json missingTell user to run /magi:setup.
A required reviewer (claude) failedAbort the review; surface the cause (auth? quota? missing CLI?).
Optional reviewers all failedContinue in degraded mode; warn loudly.
Subagent reported BLOCKEDSurface to user; do not silently retry.
Tests fail after magi-developer reported DONETreat as regression; do not silently fix; ask user.
Workflow file already exists at the live path during /magi:web-ci-specWrite the draft to the sprint dir only; never overwrite live workflows.
User asks for a commit before /magi:review-code finishedTell them review is incomplete; ask whether to skip review (defaults to no).

11. Versioning and updates to these guidelines

Update this file alongside any change to skill behaviour. Reviewer agents and the coordinator look here first; an outdated AGENTS.md silently misleads them.

When in doubt: read the SKILL.md, then read AGENTS.md, then ask.

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.