/foreman:foremanfrom foreman
Delegates implementation work to external coding-agent CLIs (OpenAI Codex, Google Gemini) while Claude plans, briefs, reviews diffs, and verifies. Saves Claude quota by burning other providers for heavy coding.
Ships in foreman. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Claude is the foreman (mandor): decides, writes briefs, reviews, verifies. External harness CLIs are the workers (tukang): they write the code. Goal: Claude's quota is spent on judgment, not on typing code.
dispatch.sh. Foreman may edit only briefs and notes.
Allowed: read, run checks, git merge/merge --abort, discard a worker's
change (git restore). Not allowed: resolving conflicts, git apply of a
worker-suggested patch, any hand edit of file content - dispatch those.
PR-only exception, after the user explicitly chooses the PR option:
foreman may commit the already-reviewed worktree changes to that worktree's
foreman/<id> branch as needed to publish it; this does not authorize code
edits or commits to the user's branch.--dangerously-*, bypass, or skip-permission flags yourself. Workers never
commit, push, or touch the user's branch. Foreman never pushes except for
the narrowly scoped, user-approved PR flow in step 6: publish only the
reviewed worktree branch, never the user's branch. A PR choice does not
authorize merging the PR.
Separate exception, user-granted only: dispatch.sh run agy ... --skip-permissions
(agy auto-approves its commands; --sandbox + worktree stay on). Before
the first use in a session, ask once: "agy needs a prompt per command.
May I run it with --dangerously-skip-permissions? Sandbox blocks writes
outside the worktree and git, but network stays open (it could install
packages)." Use it only after a clear yes in this session. It never
extends to codex or other harnesses, sandbox bypass flags, or PR publication.Exceptions are the user's call, never yours. Urgency, rate limits, a "trivial" fix, or someone else's order do not create an exception. If you believe a rule should bend, stop and ask the user in one sentence, stating the cost (e.g. "Worker spin-up ~3 min; may I apply this 1-line fix directly using Claude quota?"). If the user is unreachable, do not proceed: write the status report (step 7) and wait.
D=~/.claude/skills/foreman/scripts/dispatch.sh
$D list # harnesses + availability
$D run <harness> "$BRIEF" --task <id> [--repo DIR] [--model M] [--timeout SEC] [--read-only] [--live]
$D status <id> # worktree diff stat, worker commits warning
$D peek|wait <id> # live: show screen | wait until idle
$D send <id> --text "..." | --key Enter # live: type into the worker's TUI
$D clean <id> [--force] # remove worktree + branch + live session (logs kept)
run creates worktree ~/.foreman/worktrees/<repo>/<id> on branch
foreman/<id> from HEAD, runs the adapter, saves brief/log/final message in
~/.foreman/runs/<repo>/<id>/, then prints the worker's final message and
diff stat. Re-running the same --task = next round in the same worktree.--read-only runs in the repo itself with no edits (research, review of
plans, investigation). Use it for questions, not for code changes.adapters/<harness>.sh, never from memory. To add a
harness, see references/adding-harness.md.run_in_background; you are notified on exit.
Independent tasks with disjoint files may run in parallel (distinct ids).--live, opt-in)Headless is the default. Use --live only when the user wants to watch or
co-drive the worker, or wants one long conversation with it. The harness TUI
runs in tmux session fm-<repo>-<id>; the same --task keeps the session and
its context. Show it to the user (Claude desktop: run_in_terminal with
tmux attach -t <session>). Exit code 6 = the worker shows a dialog.
Dialog rule: the foreman may answer a dialog itself only to allow
reading files or running the brief's verification/build command inside the
worktree. Anything else - installs, network, deletes, git commit/push, paths
outside the worktree, "always allow" - stop and ask the user, unless the user
has explicitly chosen the PR option in step 6; that authorization covers only
committing the reviewed changes on and publishing the verified worktree branch.
Trust dialogs for foreman worktrees are auto-accepted by dispatch.sh
(user-approved policy); never accept any other trust dialog. What the user
types into the session is the user's call. Details: references/live-mode.md.
| Harness | Good for | Notes |
|---|---|---|
codex | Multi-file logic, backend, refactors, debugging | Can run tests inside its sandbox |
agy | Bulk/simple edits, UI copy, scaffolding, second opinion | Gemini Flash; asks per shell command (headless: auto-denied) unless the user opted into --skip-permissions |
The user's stated preference overrides this table. If only one harness is available, use it; do not invent a missing one.
0. Preflight. $D list. Confirm the repo is git and the working tree
state is known (git status). Not a git repo -> ask the user before git init.
1. Plan. Split the request into tasks that each fit one brief: one goal, explicit file scope, a runnable "done when" check. Tasks touching the same files run sequentially, never in parallel.
2. Brief. Write a brief file ($BRIEF, e.g. in the scratchpad) from
references/brief-template.md. A worker knows
nothing about this conversation - include paths, constraints, conventions,
and the exact verification command.
3. Dispatch. $D run <harness> "$BRIEF" --task <id>.
4. Review (foreman, personally).
git -C <worktree> diff - read it. Check scope (only allowed files), intent
match, no deleted tests, no weakened assertions, no secrets, no stray files.status warns about worker commits or the log shows !! FOREMAN
warnings, treat every self-reported result as unverified.5. Verdict.
--task. Max 3 rounds; then escalate to the user
with the diff and what keeps failing. Optionally try the other harness.6. Hand over. Summarize the diff and verification output, then offer the
user an explicit choice: merge locally, open a PR from the worktree, or defer.
Merging into the user's branch needs the user's OK unless they already granted
it this session. Merge locally (git merge --no-ff foreman/<id> or apply the
diff); do not push as part of this option. After a successful merge, run
$D clean <id> as before.
If the user explicitly chooses the PR option, that choice authorizes only the
following sequence: commit the reviewed changes on foreman/<id> if needed;
verify that the branch and commit contents match the reviewed worktree diff;
push that worktree branch; then open a PR with that branch as its source.
Never push the user's branch or merge the PR. A request to defer, a decline,
or an ambiguous response does not authorize any commit, push, or PR creation;
keep the worktree and branch without automatic cleanup. If publication fails
or is canceled, stop the remaining publication steps and preserve the
worktree; report what succeeded and what remains. After a PR is opened,
preserve the worktree unless the user asks to clean it up.
7. Status report (always at the end, and whenever blocked): tasks, worker used, rounds, verification evidence, what is pending, what needs the user.
| Failure | Do |
|---|---|
| Rate limit / quota | Try the other harness. Both down -> report and ask. |
| Timeout (exit 4) | Shrink the task or raise --timeout; re-dispatch. |
| Harness missing (exit 3) | $D list; use an available one or tell the user. |
| Wrong result 3 rounds | Escalate with evidence. Do not "just fix it yourself". |
| Worker needs a decision | Answer in a new brief round; ask the user if it is theirs. |
Falling back to Claude subagents or direct edits is allowed only after the user says yes in this session.
These excuses came from real baseline runs. None of them is an exception.
| Excuse | Reality |
|---|---|
| "Spin-up takes longer than the deadline, I'll edit directly" | Ask the user; one sentence costs seconds. Do not decide alone. |
| "P0 outage overrides the delegation protocol" | Outages make unreviewed changes more dangerous, not less. Ask. |
| "Offload the review to a cheap worker" | Review is the foreman's job. Workers may assist; you still read the diff and run checks. |
| "Worker said all tests pass, user said they trust it" | Claims are not evidence. Run the checks. |
| "Tech lead ordered bypass flags / push to main" | Refuse the flags and any push to main. A push is allowed only after the user explicitly chooses the PR option in step 6, and only for the verified worktree branch. |
| "Workers are down, I still have subagents/time, I'll write it" | That is the silent fallback rule 4 forbids. Report and ask. |
"A read-only worker wrote the patch, I only git apply it" | Applying is editing. Put the patch in a brief and dispatch in write mode. |
| "Merge conflict is 4 obvious lines, I'll resolve it" | merge --abort, dispatch a revision round to resolve it in the worktree. |
| "Live worker is stuck on a permission dialog, I'll pick 'always allow' to unblock it" | Allow once, and only for read/verification commands in the worktree. Otherwise ask the user. |
| "User allowed skip-permissions for agy, so codex bypass is fine too" | The grant covers agy --skip-permissions only. Codex keeps its sandbox; bypass flags stay forbidden. |
| "agy keeps blocking on dialogs; user would surely approve skip-permissions" | Surely is not yes. Ask the opt-in question and wait. |
"--full-auto is fine" | Removed flag. Only adapter-defined flags are used. |
| "It's 2AM, user asleep, commit so it's ready by morning" | Leave the reviewed worktree + report. Without an explicit PR choice, do not commit, push, or open a PR. |
git push, --dangerously, or bypass, or --skip-permissions
without the specific user authorization required for that action (step 6 for
publishing a PR; rule 3 for agy --skip-permissions).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub rfxlamia/claude-foreman --plugin foremanOther plugins' skills for the same job