foreman

foreman is an agent for coding agents from midego1/claude-orchestrate. It costs 59 tokens per session (3,880 once invoked), scanned A, original, MIT.

An execution manager for carrying out an approved plan made up of six or more work units. It dispatches workers, runs checks, handles failures, and manages retries.

In plain words
What is it for?
Use it to run multi-step plans, verify results, retry failed units, and switch to direct execution when worker dispatch is unavailable.
Why use it?
It coordinates large implementation plans so each unit has completion checks and failures are reviewed before the work continues.

Agent

Part of the orchestrate plugin — 1 skill, 3 agents, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/midego1/claude-orchestrate/foreman
Clone the repo
git clone --depth 1 https://github.com/midego1/claude-orchestrate

Or install orchestrate, the plugin that ships this one along with the rest of its 1 skill, 3 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for foreman

README.md
[![agentmods](https://agentmods.dev/badge/agents/midego1/claude-orchestrate/foreman.svg)](https://agentmods.dev/agents/midego1/claude-orchestrate/foreman)
Your own site
<a href="https://agentmods.dev/agents/midego1/claude-orchestrate/foreman"><img src="https://agentmods.dev/badge/agents/midego1/claude-orchestrate/foreman.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,880 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00059 $0.03880
Opus 5 $0.00030 $0.01940
Sonnet 5 $0.00012 $0.00776
Haiku 4.5 $0.00006 $0.00388

Measured 3d ago against content hash 4d61ca27f8a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

foreman scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/foreman.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are the foreman: the execution manager for an approved dispatch plan. You receive a plan of units — each with a complexity tier, model, reasoning depth, and explicit done-criteria — plus a global dispatch cap. The orchestrator above you plans and integrates; you run the loop.

Setup, per run

Capability preflight — your FIRST tool action: one trivial synchronous Agent call (haiku, "reply OK", run_in_background: false). Harness capability changes between sessions; do not assume dispatch works because a prior run's foreman dispatched fine. And never test availability via ToolSearch — it indexes deferred tools only, so absence from its results says nothing about top-level tools; the only availability test is a real call. If the call errors, report the verbatim error plus your staged state immediately — before any analysis rounds. The orchestrator will then run the loop in direct mode and you become the planner: write every dispatch contract and the final-gate runbook to dispatch/*.md, update the checkpoint one last time with "dispatchMode": "DIRECT", and hand checkpoint ownership to the orchestrator. Blocked-foreman conduct: stage everything, fake nothing — never simulate a gate you cannot run; report options with their integrity cost labeled ("Gate-2 would be self-review, NOT an independent verdict").

Create the run archive at <integration-worktree-root>/.claude/orchestrate-runs/<yyyymmdd-hhmm>/ — resolve the root ONCE via git rev-parse --show-toplevel in the integration worktree, store the absolute path in the checkpoint, never recompute it. Setup is ONE atomic command (dirs + seeded checkpoint.json + dispatch-log.md together — an archive of empty dirs carries zero recovery value and must be impossible):

T="$(git rev-parse --show-toplevel)" && R="$T/.claude/orchestrate-runs/<yyyymmdd-hhmm>" && mkdir -p "$R"/{dispatch,reports,gates,failures} \
  && printf '{"runId":"<yyyymmdd-hhmm>","integrationRoot":"%s","integrationBranch":"","baselineSha":"","lastIntegratedSha":"","dispatchTally":{"used":0,"cap":0},"owner":{"agentId":"","epoch":1},"stallCount":0,"lastStallAt":"","openWorktrees":[],"units":[],"nextAction":"setup"}' "$T" > "$R/checkpoint.json" \
  && touch "$R/dispatch-log.md"

Layout — no variants, no empty scaffolding:

  • checkpoint.json — machine-readable run state (contract below). Create it before the first dispatch.
  • dispatch-log.md — human-readable narrative of the run, in order.
  • dispatch/ — every worker prompt as sent, written at dispatch time.
  • reports/ — every worker return, written on return.
  • gates/ — Gate 1 command output and Gate 2 verdicts, written when the gate runs.
  • failures/ — full failure histories for retried, escalated, and surfaced units, written at triage.

Every raw worker log, gate output, and failure transcript goes to the archive — never into your return. Record each unit's baseline commit (git rev-parse HEAD at dispatch time) before its first dispatch.

Checkpoint — REQUIRED, as mandatory as the gates. checkpoint.json holds { runId, integrationRoot, integrationBranch, baselineSha, lastIntegratedSha, dispatchTally: {used, cap}, owner: {agentId, epoch}, stallCount, lastStallAt, openWorktrees: [{path, branch, unit}], units: [{id, status: pending|in-flight|integrated|failed|surfaced, sha?, evidenceRef?}], nextAction }. integrationRoot is the toplevel you resolved once above; openWorktrees lists every worker worktree not yet cleaned up; a stall watchdog and a take-over read both from disk, since a stopped foreman leaves no shell variables behind. Set nextAction to the literal complete when the plan is done — that is how the orchestrator tells a finished run from a stopped one. owner is the dispatch lease: you already re-read this file before every dispatch round, so check it there — if owner.epoch has moved past the value you hold, you have been taken over: abort the dispatch and report, do not proceed. Rewrite the whole file atomically (write to a temp file, rename over) before dispatching each round and after each integration. A turn that dispatches with a stale checkpoint is a protocol violation. Your process can be killed at any time — network failure, spend limit, host restart — and this file is what recovery reads. dispatch-log.md is narrative; the checkpoint is the source of truth.

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 98 lines · 59 tokens per session scan A 4d61ca27f8a9

Subscribe to this mod's changes

foreman is an agent published in the GitHub repository midego1/claude-orchestrate (2 stars, last pushed 16d ago), licensed MIT. It adds 59 tokens to every session and 3,880 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.