kanevry/session-orchestrator/autopilot
Claude Code and agent skill by kanevry/session-orchestrator
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when running an autonomous session-orchestration loop. Chains session-start → session-plan → wave-executor → session-end for N iterations with all 10 kill-switches (SPIRAL, FAILED wave, carryover > 50%, max-hours, max-sessions, resource-overload, token-budget, stall-timeout, sub-threshold confidence, user-abort). Reads Mode-Selector output (Phase B) to decide auto-execute vs. fallback. Writes one autopilot.jsonl record per loop run. Phase C scaffold (issue #277); implementation l…
Install
npx vskill@latest install kanevry/session-orchestrator/autopilotSKILL.md
The same SKILL.md was published earlier as kanevry/session-orchestrator/autopilot.
Autopilot Skill
Plugin root:${CLAUDE_PLUGIN_ROOT}. Claude Code replaces this with the plugin's absolute path when it loads this file. Where it appears unreplaced — in a file this skill reads with the Read tool, or on Codex, Cursor or Pi — the plugin root is the directory that contains this skill'sskills/folder (two levels above the folder of this SKILL.md). Write that absolute path literally into every command that starts a plugin script: the Bash tool has no plugin variable, and shell variables do not survive between tool calls.
Invocation
The user invokes /autopilot with arguments: $ARGUMENTS. This is autonomous session-orchestration mode — a top-level invocation only, never from inside a running session.
Parse $ARGUMENTS before anything else. Unrecognized flags are ignored; out-of-range values silently clamp to bounds. Use parseFlags from scripts/lib/autopilot.mjs for canonical parsing — never re-implement clamping inline. The loop flags (--max-sessions, --max-hours, --confidence-threshold, --dry-run) and their defaults/bounds are tabled once in § Command Surface below. Two further flags belong to the invocation surface only:
| Flag | Default | Meaning | |
|---|---|---|---|
--headless | false | Run via the standalone driver scripts/autopilot.mjs, which spawns claude -p '/session <mode>' as a child process per iteration. Required for unattended walk-away mode. Without it, /autopilot runs the in-process driver inside the current chat session (see § Production Wiring). | |
--verbose | false | Verbose driver output. |
Headless (claude -p)
Headless requirements:
- Anthropic API key configured for
claude -p(Claude Code CLI auth). scripts/autopilot.mjsstarts each child with--session-id <fresh uuid>and, after it
exits, reads the one canonical sessions.jsonl record whose raw_session_id is that uuid to construct the sessionRunner return shape — the spawned session must complete cleanly and append its record (session-end Phase 3.7 handles this). No such record, or more than one, stops the loop with failed-wave instead of reading the ledger tail (#1457). So does a unique record that is only a backfill stub (no waves/agents/token totals — the child never closed): its token usage is unknown, not 0, so it is never counted as a healthy 0-token iteration (#1457 F2).
AUTOPILOT_RUN_IDenv var is set in the child's env, but nothing reads it yet
(measured 2026-10-01: rg -n "AUTOPILOT_RUN_ID" scripts hooks skills finds only the writer in scripts/autopilot.mjs and this line). CLI-driven iterations therefore carry no autopilot_run_id on their sessions.jsonl record yet; join them to autopilot.jsonl via the sessions list there, not via that field.
Do NOT re-implement loop logic inline — this skill and scripts/lib/autopilot.mjs are authoritative. Kill-switches are enforced by scripts/lib/autopilot.mjs, not inline by Claude. The runtime writes ONE record to .orchestrator/metrics/autopilot.jsonl per invocation via atomic tmp+rename; no other code path appends to that file.
Phase 0.5: Parallel-Aware Preamble
Skip silently whenpersistence: falsein Session Config.
Before any Phase 1 work, run the parallel-aware preamble per skills/_shared/parallel-aware-preamble.md. The preamble detects other active sessions in the worktree-family via findPeers(repoRoot, { mySessionId }), classifies the caller's mode via classifyMode(callerMode) against the exclusivity-matrix, and either:
- Returns
PASS_THROUGH(no other session /always-okmode) → continue to Phase 1 - Returns
EXCLUSIVE_BLOCKED→ fires Exclusive-Conflict AUQ fromskills/_shared/parallel-aware-auq.md - Returns
PROMOTION_OFFER→ fires Worktree-Promotion AUQ (viaenterWorktree()fromscripts/lib/autopilot/worktree-pipeline.mjs— seeparallel-aware-auq.mdoutcome-handling)
On any non-PASS_THROUGH outcome that does not result in immediate exit, append a Deviation to STATE.md via appendDeviationOnDisk(repoRoot, isoTimestamp, message) from scripts/lib/state-md.mjs.
Implementation reference: skills/_shared/parallel-aware-preamble.md § Implementation. AUQ reference: skills/_shared/parallel-aware-auq.md.
Status
Phase C-1.b complete (2026-04-25, issues #295 + #300). Runtime at scripts/lib/autopilot/kill-switches.mjs:18-32 (the frozen KILL_SWITCHES enum is SSOT) enforces all 10 kill-switches:
- Pre-iteration (6, #295 + #355):
max-sessions-reached,max-hours-exceeded,
resource-overload, low-confidence-fallback (with iter-1-fallback / iter-2+-exit asymmetry), user-abort, token-budget-exceeded (cumulative tokens ≥ --max-tokens).
- Post-iteration (1, ADR-364 §3):
stall-timeout— no progress marker in
autopilot.jsonl within the threshold (default 600s; missing file → no kill).
- Post-session (3, #300):
spiral,failed-wave,carryover-too-high.
Read schema-canonical fields off the sessionRunner return shape: agent_summary.{spiral, failed} (numeric counts) and effectiveness.{carryover, planned_issues}. Absent fields → no kill (forward-compatible: a sessionRunner that does not yet emit those fields silently no-ops the post-session gates).
Atomic autopilot.jsonl writer (tmp+rename, schema_version 1) and silent-clamp parseFlags shipped in C-1. autopilot_run_id is passed into sessionRunner via args.autopilotRunId; production callers MUST persist it into the per-iteration sessions.jsonl record (additive optional field, schema_version 1 compatible). See skills/wave-executor/SKILL.md § Return Shape Contract and skills/session-end/SKILL.md § Phase 3.7.
Purpose
Autopilot collapses the per-session attention cost when Mode-Selector is confident enough to make routine decisions autonomously. A productive day commonly ships 3–7 sessions; each manual session-start costs the user 10–60 seconds of context-switch attention. When the session is genuinely routine (mechanical refactor, post-merge housekeeping, repeated follow-ups from a planned epic), that attention cost is pure overhead.
/autopilot reads the Mode-Selector recommendation, executes the recommended session if confidence clears the threshold, then loops — checking kill-switches between iterations. The user invokes the loop once and walks away; autopilot stops itself when work runs out or quality degrades.
This is opt-in by design: autopilot never starts itself. The user must run /autopilot explicitly. Configuration thresholds (--max-sessions, --max-hours, --confidence-threshold) are CLI flags, not Session Config defaults — the user signals intent for THIS run, not a standing policy.
Command Surface
| Flag | Default | Bounds | Meaning | |
|---|---|---|---|---|
--max-sessions | 5 | 1..50 | Iteration cap (graceful exit when reached) | |
--max-hours | 4.0 | 0.5..24.0 | Wall-clock budget for entire loop | |
--confidence-threshold | 0.85 | 0.0..1.0 | Minimum selectMode confidence for auto-execute | |
--max-tokens | 0 (off) | 0..10000000 | Token budget for token-budget-exceeded. Unit: cumulative subagent OUTPUT tokens, summed from each sessions.jsonl record's total_token_output (falling back to total_tokens, which is subagent-only as well) — coordinator tokens are not counted. Off by default until calibrated: one measured deep session's subagents produced 450 499 output tokens, so a six-figure budget stops the loop after about one deep session. An iteration whose record carries no token figure adds nothing and is counted as tokens_unknown_sessions (state, return value, autopilot.jsonl, and the run summary line on stdout, which prints tokens=<sum> and — when non-zero — tokens_unknown_sessions=<n>), so with any such iteration the sum is a LOWER bound and the budget can be overshot | |
--dry-run | false | — | Print planned iterations without executing |
Out-of-range values silently clamp to bounds. --dry-run exits after printing — never invokes session lifecycle.
Loop Semantics
Atomicity rule: iteration boundaries are atomic. A session must complete (/close including the post-session writes) before the next iteration starts. Autopilot does NOT abort sessions mid-flight; kill-switches are checked AFTER each session completes.
Kill-Switches
All 10 kill-switches, grouped by check phase (mirrors the KILL_SWITCHES enum in scripts/lib/autopilot/kill-switches.mjs:18-32):
| Kill-switch | Phase | Trigger | Recovery hint | |
|---|---|---|---|---|
max-sessions-reached | pre-iteration | iterations_completed >= --max-sessions | Graceful — not an error. | |
max-hours-exceeded | pre-iteration | Wall-clock exceeds --max-hours | Re-run with higher --max-hours or address slow waves. | |
resource-overload | pre-iteration | verdict==critical AND peers > autopilot-peer-abort | Wait for peer sessions to complete or close them. | |
low-confidence-fallback | pre-iteration | confidence < threshold (iteration 2+) | Re-run with lower --confidence-threshold or run next session manually. | |
user-abort | pre-iteration | Ctrl+C / Esc (AbortSignal) | Re-run when ready. | |
token-budget-exceeded | pre-iteration | cumulative_tokens >= --max-tokens (#355) | Re-run with a higher --max-tokens budget or split the work. | |
stall-timeout | post-iteration | No progress marker in autopilot.jsonl within threshold (ADR-364 §3; default 600s) | Inspect the stalled iteration; missing telemetry file is NOT a kill. | |
spiral | post-session | wave-executor spiral detection fires (agent_summary.spiral > 0) | Triage the spiraling wave manually; autopilot will not retry. | |
failed-wave | post-session | Any wave reports agent_summary.failed > 0 | Investigate failure mode (test contract drift, env issue). Re-run after fix. | |
carryover-too-high | post-session | carryover/planned > 0.50 | Last session under-delivered. Reduce scope or split issues before resuming. |
Resource-Adaptive Concurrency
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/autopilot/SKILL.md
Popularity
- Repository stars
- 54
- Repository forks
- 6
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kanevry/session-orchestrator/autopilot)