agentleFS
alexangelzhangalexangelzhang/runoff/AGENTS.md

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.

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
  1. Very specific:

    Read ROADMAP.md — Phase 0–8 + Backlog B2–B8 done.

    line 15
  2. Distinctive:

    Prefer surgical edits; do not rewrite large files wholesale.

    line 16
  3. Very specific:

    Guardrails: When runtime.governance.enabled, extended guardrails default on (secrets, PII, injection, paths).

    line 109
  4. Very specific:

    Add tests under tests/ (mock or stub).

    line 117
  5. Very specific:

    After governance / runner changes, run at least tests/e2e/orchestration.smoke.test.ts

    line 137
  6. Distinctive:

    Only add tests that assert real behavior.

    line 139
  7. Distinctive:

    When changing behavior, update the smallest relevant doc:

    line 143
  8. Very specific:

    Treat ROADMAP Phase 0–8 + Backlog B2–B8 as done.

    line 155

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

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.json defines 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 between src/core/ipc.ts and scripts/python/task_runner.py.

Before you change code

  1. 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.
  2. Prefer surgical edits; do not rewrite large files wholesale.
  3. For files > 200 lines, use Grep to locate symbols, then Read with offset/limit (do not load entire src/tools/run-pipeline.ts unless necessary).
  4. Scope searches: path: "src" or path: "tests", not repo root (avoids node_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 tests

Smoke 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)

ToolModule
runoff_run_pipelinesrc/tools/run-pipeline.ts
runoff_run_stepsrc/tools/run-step.ts
runoff_show_configsrc/tools/show-config.ts
runoff_show_agent_graphsrc/tools/show-agent-graph.ts
runoff_query_tracessrc/tools/query-traces.ts
runoff_score_tracesrc/tools/score-trace.ts
runoff_query_experimentssrc/tools/query-experiments.ts
runoff_memory_statussrc/tools/memory-status.ts
runoff_query_memorysrc/tools/query-memory.ts
runoff_query_contextsrc/tools/query-context.ts
runoff_dream_runsrc/tools/dream-run.ts
runoff_dreamify_tunesrc/tools/dreamify-tune.ts
runoff_dream_exportsrc/tools/dream-export.ts
runoff_race_apply / runoff_race_abortsrc/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

GoalFiles
New MCP toolsrc/tools/*.ts, src/index.ts
Pipeline orchestrationsrc/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 wavessrc/orchestration/plan-scheduler.ts
Single-step / race executionsrc/orchestration/step-execution.ts, src/runtime/race-execution.ts
Provider routing / retry picksrc/routing/router.ts, src/routing/retry-strategy.ts
IPC schemasrc/core/ipc.ts + scripts/python/task_runner.py → npm run check-ipc-sync
Workspace / worktreesrc/runtime/workspace.ts, scripts/python/workspace_manager.py
Checkpoints / status machinesrc/core/state.ts
Traces / querysrc/observability/trace.ts, src/tools/query-traces.ts
Observation summariessrc/orchestration/observation.ts, src/core/state.ts, src/core/pipeline-run-types.ts
Harness evolutionSplit out to the standalone agent-evolution project (host-agnostic propose → evaluate → accept loop). Not part of this repo anymore.
Policy / approval / guardrailssrc/orchestration/policy.ts, approval.ts, execution-governance.ts, guardrails.ts, guardrail-scan.ts
Agent registrysrc/orchestration/agent.ts, registry.ts, agent-state.ts
A2A HTTP / federationsrc/experimental/a2a/* (shims under experimental/a2a/)
OTel exportsrc/observability/trace-exporter.ts, src/pipeline/pipeline-hooks.ts
Config validationsrc/core/config.ts
Pipeline run typessrc/core/pipeline-run-types.ts
Python executorscripts/python/task_runner.py

Hard constraints (breaking these fails CI or production)

  1. IPC sync: Any change to src/core/ipc.ts field manifests / schema version must mirror scripts/python/task_runner.py. Run npm run check-ipc-sync.
  2. No mock provider removal — tests depend on type: "mock".
  3. run-pipeline.ts size — Do not add >50 lines of new feature logic inline; extract to src/orchestration/ or src/tools/ helpers.
  4. Workspace isolation — Physical git ops only in workspace_manager.py; TS calls workspace APIs, does not reimplement locks.
  5. typescript is a runtime dependency — src/ast_utils.ts uses the compiler API for isSyntaxValid; keep it in dependencies, not only devDependencies.
  6. Governance order: Policy → Guardrails → Approval in ExecutionGovernance.beforeStep / afterStep. Race awaiting_judge must be handled before orchestrator.onStepComplete in pipeline-runner.ts (see smoke tests).
  7. Guardrails: When runtime.governance.enabled, extended guardrails default on (secrets, PII, injection, paths). Document new toggles in docs/architecture/governance-config.md.
  8. Observation layer: StepResult.observation and PipelineResult.observation are deterministic, schema-versioned work memory for the next host/model turn. Keep full audit material in artifacts / traces; do not replace them with summaries.
  9. Harness evolution (extracted): the harness-evolution control plane was split into the standalone, host-agnostic agent-evolution project; 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_context resolve_route mode, pipeline harness … CLI surface, getHarnessEvolutionDir) were removed.

Provider integration

  1. Implement LLMProvider in src/providers/types.ts shape.
  2. Register in src/config.ts createProvider().
  3. Add tests under tests/ (mock or stub).
  4. Sample config snippet in pipeline.config.json or 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)

ModeClassNotes
dag (default)DAGOrchestratorDeterministic waves from pipeline DAG
workflowWorkflowOrchestratorParallel stages via workflow agents
llm-drivenLLMOrchestratorplannerProvider + applyExecutionPlanToAgentGraph

Testing conventions

  • Runner: npm test or node --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).

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.