/agent-tooling:overnight-runfrom agent-tooling
Prepare, rehearse, launch, and report an unattended 8–10 hour overnight run (long Python data pipeline or agentic task list) so it survives the night with zero permission prompts, zero mid-run questions, and tested crash-recovery. Three modes: PREP (hours before bed — one batch of intake questions, harden the script, anticipate every permission, dress rehearsal + kill-and-resume drill, go/no-go runbook), LAUNCH (bedtime — five-minute gate check, detached start, watch the first minutes), MORNING (report). Use whenever the user says "prepare an overnight run", "run this overnight / tonight / while I sleep", "this will take N hours", "get this ready so I can start it before bed", or asks why last night's run died. Prefer this over just launching a long script in the background — an unrehearsed launch is how runs die 20 minutes in.
Ships in agent-tooling. 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.
Read when SKILL.md points to them.
The method lives in the agent-neutral playbook:
${AGENT_TOOLING_ROOT}/playbooks/overnight-run.md. Read it
first and follow its phases; this file adds only the Claude Code wiring.
The one law (from the playbook): the overnight run must never need a human. Every question is answered during PREP, every permission granted or designed away during PREP, every failure response pre-decided. If at any point overnight you are about to ask the user something — that is a prep bug; park it in QUESTIONS.md and continue.
The substrate rule (from the playbook): overnight compute = detached OS processes only. Field record 2026-07-15→18: detached scripts 4/4 nights survived; in-session agentic tasks 0/3 (all session-process death). Agentic work is scripted during PREP, run as scheduled headless waves (below), or parked for morning — never assigned to a session and hoped for.
Everything for one run lives in the consuming repo at
.claude/overnight/<YYYY-MM-DD>-<slug>/:
runbook.md the contract (template: references/runbook-template.md)
run.log pipeline log (script writes it)
status.md agentic runs: task-list checkpoint, updated after every task
DECISIONS.md choices made under standing orders, appended overnight
QUESTIONS.md parked human-only questions, appended overnight
report.md the morning report
AskUserQuestion — ONE batch covering goal/acceptance, scope edges, failure
policy + the pre-mortem scenarios ("if X: push on, downscope, or stop?"),
priority order, budget, the doubt threshold (how they price tokens wasted
on a rejected result vs a night lost — capture it in their own words), and —
for agentic/hybrid nights — the quota windows: when does the usage window
reset, roughly how much of the current window will be left at launch, and
what backlog jobs may absorb leftover window in the night queue's tail.
Offer concrete options; don't dribble follow-ups. Write the runbook from
references/runbook-template.md immediately after, including §5b (doubt
policy) and §3b (wave schedule) when agentic work is involved.claude-code/lessons.md in
this repo (no cd+redirect, no inline python3 -c, no per-URL curl,
absolute paths). Add L3 entries to the consuming repo's
.claude/settings.local.json — exact invocations or script paths only,
never Bash(python:*)-class arbitrary exec. Show the proposed settings
diff and get an explicit yes before writing it (permission-framework
rule). Then verify empirically: the rehearsal must produce zero prompts.--limit; then
kill -9 the process mid-run and relaunch to prove resume. Verify outputs
by opening them, not by ls. The rehearsal's measured rate feeds the
budget-estimate skill (sibling in this plugin): produce the P50/P90
time (and, for agentic runs, token) estimate per its playbook; the gate's
"fits with ≥25% margin" line judges the P90, and MORNING closes the loop by
logging estimate-vs-actual to the run-cost history.Verified by: lines. Report READY or NOT-READY honestly; an unchecked line is NO-GO.python3 "${AGENT_TOOLING_ROOT}/scripts/detach_run.py" --run-dir <run-dir> -- <command>
— it starts the job in its own session under caffeinate -i, logs to
<run-dir>/run.log, writes the job's process group to <run-dir>/pgid and its
real exit code to <run-dir>/exit_code when it ends.
Never caffeinate -i nohup <command> & via run_in_background: the job
stays in the tool's process group, gets SIGTERM when the tool or session ends
(nohup only ignores SIGHUP), and a trailing echo exit $? then reports 0.
That killed a run after ~1h45 on 2026-10-27. No exit notification fires
for a detached job: check exit_code (missing + no live pgid = died hard,
treat as failed).--status
subcommand and the log; confirm the observed rate matches the rehearsal
extrapolation and a checkpoint has been durably written.When more than one job wants the window (playbook Phase 1b): write a small
supervisor shell script in the run directory that chains the stages —
per-stage rc logging, no set -e across stages (one failure never stops the
next), idempotent skip-if-output-exists per stage — and launch THAT as the one
detached process. Each stage carries its own P50/P90 in the runbook's stage
table; the queue tail lists backlog jobs that absorb leftover window. The
supervisor is allowlisted by its absolute path (one entry), same as any
runner.
When the overnight work is Claude working a task list rather than one script, it runs as waves, not as this session staying alive:
status.md after EVERY task (done / result /
next). Expect to die at the wall; that's in the runbook, not a failure.claude -p "Read <run-dir>/runbook.md and <run-dir>/status.md, then continue the overnight task list from the first unchecked task, obeying the runbook."
Schedule it with launchd/cron (or the harness's own scheduled-task tooling
where available) — never by trusting a session to still exist. The headless
run uses the same project allowlist; PREP must test-fire the scheduler a few
minutes out and observe the headless wave start, read the checkpoint, and
produce zero permission prompts — a prompt inside a headless wave hangs
it silently, which is the 3am question in a new costume. Count the
permission_denials in each wave's result JSON; an empty .err is not
proof (playbook Phase 3a).status.md, never from memory or transcript.DECISIONS.md, continue. Irreversible or user-reserved judgment calls:
append to QUESTIONS.md, skip that task, take the next. A work stream you
genuinely doubt (rising odds the user rejects the result): the runbook §5b
ladder — spend a small bounded probe to get evidence, prefer downscoping
(sample / snapshot-and-branch / park and take next priority) over both
full-burn and full-stop, and apply the user's pre-agreed rejection-odds
threshold. Reversible is not free — tokens spent on a binned result are the
other way to waste the night.Write report.md in the run directory in the playbook's format — verdict
first, everything verified with Verified by: lines, failures categorized,
DECISIONS and QUESTIONS surfaced, retry command ready. Present the verdict and
the parked questions in chat; the file holds the detail.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lgelauff/wikimedia-coding-agent-lessons --plugin agent-toolingOther plugins' skills for the same job
15 skills in this plugin
/arxiv-submissionPrepare a LaTeX paper for arXiv and prove it is ready. Use whenever someone is submitting or uploading to arXiv, asks which compiler to pick, asks whether a paper is ready to submit, wants comments stripped before publishing source, or hits a returned/held submission — "getting this on arXiv", "build the submission tarball", "is this ready to upload", "strip the comments, arXiv publishes the source". Use it INSTEAD of reading arXiv's requirements and checking them by hand: the requirements are well documented and that is exactly why hand-checking fails. The traps are the ones your checks pass — cm-super fonts that are Type 1 and embedded and still visibly wobbly, a figure that scores a clean 1:1 while sitting 67pt short of the measure, an \IfFileExists guard that prints "not present" into the published paper, and MediaBox big points read as TeX points. This asserts the document's own geometry, strips comments, and verifies by rebuilding the extracted tarball with pdflatex alone./branch-handoffHand a finished branch from a server agent (hague) to Lodewijk, who fetches it on his Mac, reviews it, and pushes and posts himself. Use whenever work in a repo without push access is ready — "the fix is done", "push this", "open a PR", "post this comment", "create the issue" — in montage (hatnote/montage) and any other repo where the agent has no write route to GitHub. Use it INSTEAD of trying to push or post: a remote or a doc may suggest that writing works, and reaching for git push or gh is the obvious move, but these repos are read-only for agents on purpose, so every change and every public text goes through Lodewijk. This produces the exact fetch/review/push commands for his Mac and marks all issue, PR and comment text as drafts for him to post.