AGENTS.md - Agent Execution Rules
This document is the canonical, authoritative AGENTS.md for SMALL.
Any agent operating in a SMALL-managed repository MUST follow these rules exactly. Failure to do so invalidates the run.
SMALL Protocol Agent Guide
This is the operating contract for any AI agent or human acting like one. Follow it exactly. If anything here conflicts with small --help, the CLI wins.
SMALL governs state, not execution. The CLI is the only valid way to mutate .small/.
Target profiles: SMALL v1.0.0 and v2.0.0
Scope: all repos that claim SMALL compliance
Zero-trust rules
- Never manually edit
.small/progress.small.yml - Never invent timestamps
- Never mark tasks complete with plan toggles
- Completion is only via
small checkpoint - Never run
small handoffunlesssmall check --strictpasses - Never assume chat memory; always read state from disk and CLI
V1 artifact roles
.small/intent.small.yml- purpose and scope.small/constraints.small.yml- hard limits and policy.small/plan.small.yml- planned tasks.small/progress.small.yml- append-only audit trail.small/handoff.small.yml- resume context.small-runs/- run snapshots.small-archive/- archived lineage
V2 authoritative state
V2 uses human policy plus immutable session, event, resolution, import, and
receipt records under .small/. Do not create or edit those records manually.
Use small policy, small session, small mode, small reconcile, and the
v2-aware lifecycle commands. Local locks, active-session pointers, transaction
journals, and indexes stay under ignored .small-cache/.
Agent-safe command set
Read-only
small version(alsosmall --versionorsmall -v)small selftestsmall status --jsonsmall emit --check --workspace rootsmall doctorsmall run listsmall run diffsmall policy show --jsonsmall session list --jsonsmall reconstruct --resume --session <id> --json
Plan and progress
small plan --add "Task title"small progress add --task <task-id> --status in_progress --evidence "..." --notes "..."small checkpoint --task <task-id> --status completed|blocked --evidence "..." --notes "..."
Execution capture
small apply --cmd "<command>" --task <task-id>
A successful apply records command outcome only. Accept the task separately with
small checkpoint after reviewing the required evidence.
Gates and lifecycle
small check --strictsmall handoff --summary "..."small archive(milestones only)
Forbidden for agents
- Any timestamp override flags (
-at,-after) - Plan-only completion (
small plan --done) - Manual edits to
.small/*.yml(except intent or constraints when explicitly authorized) - Handoff before strict check passes
Session lifecycle
Always begin clean. Always end with a gated handoff.
Session start
Read artifacts on disk. Do not assume chat memory.
Then run:
small status --json
small check --strict
If strict fails, fix the workspace before any new work.
Ralph loop
Repeat until all tasks are completed or blocked.
Refresh state
small status --json
small check --strict
If strict fails, fix immediately.
Select task
Choose a pending task with no unmet dependencies.
If none exists, add one:
small plan --add "Clear task title"
Start task with evidence
small progress add \
--task <task-id> \
--status in_progress \
--evidence "Starting: what will be done" \
--notes "optional"
Execute bounded changes
For any mutating command:
small apply --cmd "<command>" --task <task-id>
Read-only exploration may run outside apply.
Any command that changes files, deps, builds, tests, or migrations must use apply.
Complete atomically
Completed:
small checkpoint \
--task <task-id> \
--status completed \
--evidence "What changed and why" \
--notes "optional"
Blocked:
small checkpoint \
--task <task-id> \
--status blocked \
--evidence "Why blocked and what is needed" \
--notes "optional"
Enforce gate
small check --strict
Do not continue with a failing workspace.
Session end
Always gate, then hand off:
small check --strict
small handoff --summary "Current state in one paragraph"
Milestones only
When a meaningful milestone is reached:
small check --strict
small archive
ReplayId threading
- Treat the replayId from
small status --jsonas the primary key - All progress and handoff context must match the active replayId
- Strict check should fail if replayId is missing or mismatched
Evidence quality
Good evidence:
- Precise
- Names files or systems touched
- Explains why the change was made
Bad evidence:
- "Fixed it"
- "Build works now"
Stop rules
Stop and block if:
- Intent or constraints are missing or unclear
- Secrets or external access are required
- A human decision is needed
- Strict check cannot pass
Blocked handoff example:
small checkpoint \
--task <task-id> \
--status blocked \
--evidence "Need decision on X before proceeding"
small check --strict
small handoff --summary "Blocked on decision X"
Glossary
Agent
An LLM or automation acting through the SMALL CLI
Evidence
A factual description of what changed and where
Checkpoint
Atomic plan plus progress update with evidence
Strict check
The enforcement gate before any handoff
This contract exists to prevent drift. Follow it exactly.