agent-sop
CLAUDE.md4 starsChanged 2 months agoMITView on GitHub
The reference implementation for consistent, productive Claude Code and Codex sessions. Project type: code — Markdown by volume, but the hooks, installer and validators under scripts/ are bash with fixture suites, and the ship-sop gate reviews them. Read by scripts/hooks/sop-project-type.sh; without the line the heuristics would say non-code (no manifest). This project IS the SOP library and follows docs/sop/claude-agent-sop.md itself. This file is the authority on project conventions, the SOP on process. Start: the context hook prints project state on…
- Commits and pushes
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- finishSkill
- migrate-to-multi-agentSkill
- restart-sopSkill
- source-command-finishSkill
- source-command-migrate-to-multi-agentSkill
- source-command-restart-sopSkill
- source-command-update-agent-sopSkill
- source-command-update-sopSkill
- update-agent-sopSkill
- update-sopSkill
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Test: bash docs/benchmark/hook-fixtures/run-tests.sh (also resume-path-fixtures, state-transition-fixtures, drift-fixtures, …
- Distinctive: line 75
Read the Backlog item, then the existing code, before changing anything.
- Distinctive: line 77
Every hook or validator change carries a fixture that fails against the previous commit.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 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.
Files
Agent SOP — Standard Operating Procedure Library for Claude Code and Codex
The reference implementation for consistent, productive Claude Code and Codex sessions.
Project type: code — Markdown by volume, but the hooks, installer and validators under scripts/ are bash with fixture suites, and the ship-sop gate reviews them. Read by scripts/hooks/sop-project-type.sh; without the line the heuristics would say non-code (no manifest).
Agent SOP
This project IS the SOP library and follows docs/sop/claude-agent-sop.md itself. This file is the authority on project conventions, the SOP on process. Start: the context hook prints project state on the first prompt, then /restart-sop reads the work item. End: /update-sop; the Stop hook enforces the minimum record and the ship-sop gate here. Never delete without a trace; when files disagree, code and git win, then this file, then Backlog.md.
Key Documents & Dispatch
| When you need to... | Start at | Notes |
| Check or update work items | Backlog.md | Grep ^### P<n>, read only that range; closed items older than 90 days live in docs/backlog-archive.md |
| Read why something was decided, or what bites | docs/agent-memory/decisions/, docs/agent-memory/gotchas/ | Search by task/path first; the two reviewer-overwrite gotchas before launching any Bash-armed subagent |
| Change process rules | docs/sop/claude-agent-sop.md | Section numbers are stable; the compliance checklist greps them |
| Change what a hook does | scripts/hooks/sop-lib.sh (shared rules), then the hook script | Every rule the Stop hook, push gate and context block share lives in the lib; fixtures in docs/benchmark/hook-fixtures/run-tests.sh |
| Change the validator | scripts/validate-state-transitions.sh, the [SHIPPED] block | Fixtures in docs/benchmark/state-transition-fixtures/; expect-stdout files pin messages |
| Change what a consumer project receives | .claude/commands/update-agent-sop.md, the file table | Pristine-replica rows are SHA-tracked in ~/.claude/agent-sop.config.json |
| Audit a project | .claude/agents/sop-checker.md, docs/sop/compliance-checklist.md | Check IDs are stable |
| Run more than one agent on this repo | docs/sop/multi-agent.md | Worktrees, agent-ids, merge discipline |
| Read phase architecture | docs/build-plans/ | Each file carries its own Status:; planning notes, not a required log |
Test: bash docs/benchmark/hook-fixtures/run-tests.sh (also resume-path-fixtures, state-transition-fixtures, drift-fixtures, priorities-fixtures; run every suite when touching scripts/)
Current priority items
<!-- Derived from Backlog.md by scripts/refresh-priorities.sh at every /update-sop. Do not edit by hand. --><!-- priority-items:start -->Derived from Backlog.md by scripts/refresh-priorities.sh. Do not edit by hand — the Backlog is the source of truth. Last refreshed: 2026-09-30.
- P8 — Web app domain variant — [OPEN] [Feature] [has-open-questions]
- P9 — Marketing domain variant — [OPEN] [Feature] [has-open-questions]
- P10 — Data/analytics domain variant — [OPEN] [Feature] [has-open-questions]
- P78 — Automate
cross-layer-rules.mdTier 0 across instruction files — [OPEN] [Feature] - P79 —
sandboxing.mdtreats the sandbox as protecting the host, never the reverse — [OPEN] [Iteration] - P80 — Benchmark rubric: pairwise scoring, and read judge reasoning not scores — [OPEN] [Iteration]
- P108 — Codex compatibility follow-ups from native-runtime review — [OPEN] [Iteration]
<!-- priority-items:end -->Backlog Management
Backlog.md is the single source of truth for work items. Status first, type second, never reversed: [OPEN] [IN PROGRESS] [BLOCKED] [DEFERRED] [SHIPPED - YYYY-MM-DD] [VERIFIED - YYYY-MM-DD] [WON'T], then [Feature] [Iteration] [Bug] [Refactor]. [DEFERRED] states **Reopens when:**; [WON'T] states Reason:. A shipped [Feature] or [Refactor] carries a review: line or a review skipped (P<n>): <reason> token; this repo's own SOP-executed files trigger the review for every item. Never delete an item.
Stack
- Markdown, plus bash and Python tooling in
scripts/(setup.sh,install-hooks.sh, the hooks underscripts/hooks/,validate-state-transitions.sh,resolve-resume-path.sh,archive-backlog.sh,migrate-to-multi-agent.py) - Hosting: GitHub,
mmjclayton/agent-sop, public; CI runs fixture suites on pull requests - Tests: the fixture suites under
docs/benchmark/*-fixtures/run-tests.sh
Common Mistakes — Read Before Working
- A subagent with Bash writes into the live tree even when told not to and given a worktree path; launch every reviewer with
isolation: "worktree"(gotchas 2026-09-04 and 2026-09-05). - The push gate matches a push verb anywhere outside quotes and heredoc bodies; a command that only mentions
git pushin a quoted string is fine, one that runs it is refused until a report covers HEAD. - Editing a pristine-replica file (the
update-agent-sop.mdtable) without refreshingbaseline_shasin~/.claude/agent-sop.config.jsonfails--check-replication; the installed copy is what runs, not the repo. LC_ALL=Cis exported bysop-lib.sh: every pattern there is ASCII, and a UTF-8 locale made BSD grep abort a whole file on one invalid byte.- The fixture helpers (
push_json,commit_record) are defined at the top ofrun-tests.sh; a case that calls a helper before its definition passes vacuously.
Rules for Automated Builds
- Read the Backlog item, then the existing code, before changing anything.
- New SOP documents go in
docs/sop/, templates indocs/templates/, guides indocs/guides/; every new document has a Backlog entry. - Every hook or validator change carries a fixture that fails against the previous commit.
- Conventional commits:
feat:,fix:,docs:,refactor:.
Where the history lives
Session records: docs/recent-work/, rolled up in docs/RECENT-WORK.md. Status: Backlog.md. Neither is duplicated here.
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.

