runoff
AGENTS.md0 starsChanged 6 months agoMITView on GitHub
Instructions for AI coding agents (Cursor, Claude Code, Codex, etc.) working in this repository. runoff is an MCP server that orchestrates multi-step LLM/agent workflows over a user repository. The host agent calls MCP tools; this repo implements pipeline execution, not the host UI. Smoke tests use real git worktrees (~10s). Orchestration smoke: npx tsx --test tests/e2e/orchestration.smoke.test.ts. Execution layer rules: see docs/architecture/execution-layers.md. Do not implement worktree/lock logic in TypeScript beyond delegating to Python. Main pipeline path (no legacy runner): runPipelineExecution →…
- Installs packages
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,542 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.
- CLAUDE.mdCLAUDE.md
- dev-pipelineSkill
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Read ROADMAP.md — Phase 0–8 + Backlog B2–B8 done.
- Distinctive: line 16
Prefer surgical edits; do not rewrite large files wholesale.
- Very specific: line 109
Guardrails: When runtime.governance.enabled, extended guardrails default on (secrets, PII, injection, paths).
- Very specific: line 117
Add tests under tests/ (mock or stub).
- Very specific: line 137
After governance / runner changes, run at least tests/e2e/orchestration.smoke.test.ts
- Distinctive: line 139
Only add tests that assert real behavior.
- Distinctive: line 143
When changing behavior, update the smallest relevant doc:
- Very specific: line 155
Treat ROADMAP Phase 0–8 + Backlog B2–B8 as done.
≈ “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.
Files
AGENTS.md — runoff
Instructions for AI coding agents (Cursor, Claude Code, Codex, etc.) working in this repository.
What this project is
runoff is an MCP server that orchestrates multi-step LLM/agent workflows over a user repository. The host agent calls MCP tools; this repo implements pipeline execution, not the host UI.
- Config-driven DAG:
pipeline.config.jsondefines steps, providers, dependencies, retries, routing, orchestration, runtime governance. - Split runtime: TypeScript owns orchestration, state, traces, governance; Python owns subprocess execution and git worktree isolation.
- IPC contract: CLI providers write
*.task.json/ read*.result.json; schema must stay in sync betweensrc/core/ipc.tsandscripts/python/task_runner.py.
Before you change code
- Read ROADMAP.md — Phase 0–8 + Backlog B2–B8 done. Current Runtime: Config →
agent-graph.ts→ Orchestrator →AgentStepRunner→PipelineStepAgent→step-execution.ts. Industry alignment: docs/reference/industry-benchmark.md; refresh pins:./scripts/refresh-benchmark-pins.sh. - Prefer surgical edits; do not rewrite large files wholesale.
- For files > 200 lines, use Grep to locate symbols, then Read with
offset/limit(do not load entiresrc/tools/run-pipeline.tsunless necessary). - Scope searches:
path: "src"orpath: "tests", not repo root (avoidsnode_modules).
Build & verify
npm install
npm test # full suite
npm run check-ipc-sync # required after src/core/ipc.ts changes
npx tsc --noEmit
npm run ci:gates # ipc-sync + gate2 + gate3 + all testsSmoke tests use real git worktrees (~10s). Orchestration smoke: npx tsx --test tests/e2e/orchestration.smoke.test.ts.
Architecture (where to edit)
Host MCP client
→ src/index.ts (register tools only)
→ src/tools/run-pipeline.ts (MCP runoff_run_pipeline registration)
→ src/orchestration/pipeline-mcp-run.ts (MCP session / approval resume)
→ src/orchestration/pipeline-execution.ts (plan gate, AgentGraph compile)
→ src/orchestration/pipeline-runner.ts (DAG loop, step-runner, governance hooks)
→ src/orchestration/step-execution.ts (single-step execution, races)
→ src/providers/* (OpenAI, CLI, mock)
→ scripts/python/task_runner.py + workspace_manager.py (worktree, lock, patch)Execution layer rules: see docs/architecture/execution-layers.md. Do not implement worktree/lock logic in TypeScript beyond delegating to Python.
Main pipeline path (no legacy runner):
runPipelineExecution → compileAgentGraphFromPipeline → createAndGatePlan → runPipelineDAGLoop with agentGraph / executionPlan + stepRunner + orchestrator.
MCP tools (do not rename without migration plan)
| Tool | Module |
runoff_run_pipeline | src/tools/run-pipeline.ts |
runoff_run_step | src/tools/run-step.ts |
runoff_show_config | src/tools/show-config.ts |
runoff_show_agent_graph | src/tools/show-agent-graph.ts |
runoff_query_traces | src/tools/query-traces.ts |
runoff_score_trace | src/tools/score-trace.ts |
runoff_query_experiments | src/tools/query-experiments.ts |
runoff_memory_status | src/tools/memory-status.ts |
runoff_query_memory | src/tools/query-memory.ts |
runoff_query_context | src/tools/query-context.ts |
runoff_dream_run | src/tools/dream-run.ts |
runoff_dreamify_tune | src/tools/dreamify-tune.ts |
runoff_dream_export | src/tools/dream-export.ts |
runoff_race_apply / runoff_race_abort | src/tools/race.ts |
MCP response contract: success and error bodies are JSON in content[0].text. Errors use { "error", "prefix" } with isError: true. Pipeline/race/step semantics live in JSON fields (status, reason, cleanupErrors) — do not rely on isError alone. See skill/SKILL.md §MCP response contract.
New tools: add src/tools/<name>.ts and register in src/index.ts.
Common tasks → files
| Goal | Files |
| New MCP tool | src/tools/*.ts, src/index.ts |
| Pipeline orchestration | src/orchestration/pipeline-execution.ts, pipeline-runner.ts, orchestrator.ts |
| AgentGraph (B7) | src/orchestration/agent-graph.ts |
| Step execution (B8) | src/orchestration/step-execution.ts, pipeline-step-agent.ts, step-runner.ts |
| A2A federation sync (B5) | src/experimental/a2a/federation-sync.ts |
| Orchestrator plan waves | src/orchestration/plan-scheduler.ts |
| Single-step / race execution | src/orchestration/step-execution.ts, src/runtime/race-execution.ts |
| Provider routing / retry pick | src/routing/router.ts, src/routing/retry-strategy.ts |
| IPC schema | src/core/ipc.ts + scripts/python/task_runner.py → npm run check-ipc-sync |
| Workspace / worktree | src/runtime/workspace.ts, scripts/python/workspace_manager.py |
| Checkpoints / status machine | src/core/state.ts |
| Traces / query | src/observability/trace.ts, src/tools/query-traces.ts |
| Observation summaries | src/orchestration/observation.ts, src/core/state.ts, src/core/pipeline-run-types.ts |
| Harness evolution | Split out to the standalone agent-evolution project (host-agnostic propose → evaluate → accept loop). Not part of this repo anymore. |
| Policy / approval / guardrails | src/orchestration/policy.ts, approval.ts, execution-governance.ts, guardrails.ts, guardrail-scan.ts |
| Agent registry | src/orchestration/agent.ts, registry.ts, agent-state.ts |
| A2A HTTP / federation | src/experimental/a2a/* (shims under experimental/a2a/) |
| OTel export | src/observability/trace-exporter.ts, src/pipeline/pipeline-hooks.ts |
| Config validation | src/core/config.ts |
| Pipeline run types | src/core/pipeline-run-types.ts |
| Python executor | scripts/python/task_runner.py |
Hard constraints (breaking these fails CI or production)
- IPC sync: Any change to
src/core/ipc.tsfield manifests / schema version must mirrorscripts/python/task_runner.py. Runnpm run check-ipc-sync. - No mock provider removal — tests depend on
type: "mock". run-pipeline.tssize — Do not add >50 lines of new feature logic inline; extract tosrc/orchestration/orsrc/tools/helpers.- Workspace isolation — Physical git ops only in
workspace_manager.py; TS calls workspace APIs, does not reimplement locks. typescriptis a runtime dependency —src/ast_utils.tsuses the compiler API forisSyntaxValid; keep it independencies, not only devDependencies.- Governance order: Policy → Guardrails → Approval in
ExecutionGovernance.beforeStep/afterStep. Raceawaiting_judgemust be handled beforeorchestrator.onStepCompleteinpipeline-runner.ts(see smoke tests). - Guardrails: When
runtime.governance.enabled, extended guardrails default on (secrets, PII, injection, paths). Document new toggles indocs/architecture/governance-config.md. - Observation layer:
StepResult.observationandPipelineResult.observationare deterministic, schema-versioned work memory for the next host/model turn. Keep full audit material inartifacts/traces; do not replace them with summaries. - Harness evolution (extracted): the harness-evolution control plane was split into the standalone, host-agnostic
agent-evolutionproject; runoff no longer imports or depends on it. Its audit-artifact, acceptance, and non-mutation contracts (no automatic repo edits, promotion-export-only, clean proposal + observed diff + audit + held-in/held-out gate required) live in that project's own AGENTS.md. runoff-side artifacts that referenced it (runoff_query_contextresolve_routemode,pipeline harness …CLI surface,getHarnessEvolutionDir) were removed.
Provider integration
- Implement
LLMProviderinsrc/providers/types.tsshape. - Register in
src/config.tscreateProvider(). - Add tests under
tests/(mock or stub). - Sample config snippet in
pipeline.config.jsonor docs.
For CLI-backed agents, use src/providers/cli.ts and extend Python runner only when IPC fields change.
Reference subagent spec: .claude/agents/provider-integrator.md.
Orchestration modes (orchestration.mode)
| Mode | Class | Notes |
dag (default) | DAGOrchestrator | Deterministic waves from pipeline DAG |
workflow | WorkflowOrchestrator | Parallel stages via workflow agents |
llm-driven | LLMOrchestrator | plannerProvider + applyExecutionPlanToAgentGraph |
Testing conventions
- Runner:
npm testornode --import tsx --test tests/<subdir>/<file>.test.ts - Gate e2e:
tests/e2e/gate2-control-plane.e2e.test.ts,tests/e2e/gate3-orchestrator.e2e.test.ts - Guardrails:
tests/unit/guardrails-extended.test.ts,tests/unit/execution-governance.test.ts - After governance / runner changes, run at least
tests/e2e/orchestration.smoke.test.ts
Only add tests that assert real behavior; avoid trivial “construct-only” tests.
Documentation to keep in sync
When changing behavior, update the smallest relevant doc:
- User-facing: README.md
- Agents: this file
- Governance: docs/architecture/governance-config.md
- Roadmap / backlog: ROADMAP.md
What not to do
- Force-push, amend commits, or change git config unless the user explicitly asks.
- Introduce new npm dependencies without strong reason.
- Duplicate DAG rules in
task_runner.py. - Treat ROADMAP Phase 0–8 + Backlog B2–B8 as done; steps run via
PipelineStepAgent→executePipelineStep(ExecutionScheduler类已移除)。未排期项见 ROADMAP Future;历史 phase 见 docs/history/roadmap-delivered-phases.md。
Related agent instructions
- CLAUDE.md — token efficiency and Claude-specific search rules (complements this file).
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.

