--- name: otomode description: "Unattended work mode for when the user is away. `otomode 6h` asks everything up front in one round (tasks, how to check each, permissions), writes OTOMODE.md, turns on a hook that denies every permission prompt and question and logs it to QUESTIONS.md, then works task by task through every lane that answered the start-round probe (external CLIs through mmo-run, Claude sub-agents), verifies each with its own check and commits each separately, pauses at 85% usage and resumes by cron after the reset, with an hourly watchdog. `otomode off` turns the hook off, reports and asks the saved questions. Also handles `otomode resume`, `otomode watchdog`, `otomode status`." --- # otomode The user is away. Work through an agreed task list without ever waiting on them; leave everything reviewable: one commit per task, a plan file, a question log. Helper script (state, hook, log, usage readout): ```bash OTO="python $HOME/.claude/skills/otomode/scripts/otomode.py" # python3 where python is not on PATH $OTO on --project "" --hours # hook ON for this session (refuses: see step 6) $OTO off # hook OFF; prints cleanup_left_for_you $OTO status # state, session, crons, quick checks, denials, usage $OTO log "" # "- HH:MM " into the OTOMODE.md log $OTO gate [--percent P --reset ISO] # go / stop / unknown (with why) before each task $OTO lane T # record a Claude lane launch (scoreboard) $OTO merged T --quick-exit # after each cherry-pick: the quick check's exit code $OTO cron [--watchdog ID] [--resume ID] # record cron job ids in the state $OTO score # per-lane first-try passes from lanes.jsonl ``` `$OTO` is shorthand: write the full command each time (variables do not survive between tool calls), exactly as in its allow rule. Setup, once: `$OTO install` registers the hook in `~/.claude/settings.json` (`uninstall` removes it); it does nothing while otomode is off. For usage in the CLI use `scripts/statusline.py` as the status line; the desktop app has `get_usage` (section 3). While on, for this session only, the hook: - denies every permission prompt, `AskUserQuestion`, `EnterPlanMode` and `ExitPlanMode`, and appends each one to `/QUESTIONS.md`; - denies delete, deploy, push and send commands (rm, git push, branch or worktree removal, reset --hard, kubectl/terraform/az/aws, ssh/scp, POST requests, gh pr/issue writes, publish, mail, `| sh`) and MCP tools named send, post, delete, submit, upload and the like (plus custom words or regexes in `~/.config/mmo/otomode-block` or `$MMO_OTOMODE_BLOCK`), logged for the end report. Bash is judged by the commands that would run (echo and commit messages may name them); unparseable lines and PowerShell by whole-text regex. Denial classes: `off_limits` (as designed), `question`, `allowlist_gap` (a prompt the start round did not allow; a compound command gets one suggested rule per segment). `status` and `off` print counts and rules. A denial is not a failure to retry: take the safe default or mark the task blocked. ## Hard rules (whole run) - Never wait on the user; no AskUserQuestion after the start round. - Never delete, deploy, push or send messages, even if a task seems to need it; write what would be needed into the task's notes. Never remove worktrees or branches you created; list them in the report. - Commit only on the otomode branch, one commit per task, task id in the subject, following the repo's CLAUDE.md and trailer rules. - Every launch names its model (a sub-agent's `model`, an mmo-run lane's `-m`); no lane asks questions or commits. Every lane works on the otomode branch's code, never the default branch's (loop steps 1, 2 and 4). - Task checks go through `mmo-check` (loop step 3). mmo-check and mmo-run write a status header as the first line of their out file: run each as ONE simple command, then read that header in a separate call; no `; echo`. For a raw quick or full check never let a pipe hide the exit code: run ` > /.otomode/.log 2>&1; echo "exit=$?"` (needs `Bash(echo:*)`), read the log's tail in a separate call. If you must pipe, start with `set -o pipefail`. - Every segment of a compound command (`a; b`, `a && b`, pipes, `for`/`while` loops) needs its own allow rule, or the whole command is denied. Avoid chains and loops: one simple command per call, one call per worktree. - Your state is OTOMODE.md and `/.otomode/`, not the conversation: after a resume or a compaction rebuild from them; the `Lanes:` line is the routing table (re-probe when the roster is stale). - Never write a time from memory: `$OTO log` for log lines, else `date +%H:%M`. ## 1. Start: `otomode ` (e.g. `otomode 6h`) `TOOL ` stands for the one command form every lane tool runs in: `MMO_LOG=/.otomode/lanes.jsonl MMO_TASK= bash /.claude/skills/orchestra/scripts/` (absolute home, no `~`), written in full and always in exactly this form, so one allow rule covers mmo-run, mmo-check and mmo-roster. 1. Probe the lanes first, while the user is there: `TOOL mmo-roster probe --out /.otomode/roster.json` (`MMO_TASK=roster`; one tiny call per lane; `--models ` for lanes without a default id), then `... mmo-roster lineup --file /.otomode/roster.json`. 2. Ask **one** round, as a plain numbered message (not AskUserQuestion, so free text fits), and wait. It is not optional: paste the **lineup** from step 1 on top, unedited (which model plays which tier, what is unusable and why; the user may veto a lane or fix a sign-in now). `on` (step 6) refuses without a `Lanes:` line. If the message already lists tasks and checks, use them and ask only what is missing: 1. The tasks, in priority order, each with the files it may touch. 2. For each task, how to check it is done: a command (test, build, lint, script) whose exit code decides. Offer a concrete check per task. Also the repo's **quick check** (its fast gate, run after every merge) and **full check** (what CI runs), e.g. from CLAUDE.md or the CI config. 3. The permissions the run will need. Read `.claude/settings*.json` and `~/.claude/settings.json`, derive the commands from the tasks and checks (test runners, build, git checkout/add/commit/merge/cherry-pick/ worktree add, `date`), and list the allow rules still missing, e.g. `Bash(go test:*)`. Always include `Bash(echo:*)` (the `; echo "exit=$?"` tail), file edits `Edit(/**)`, `Edit(/wt-*/**)` (mmo-run worktrees) and `Edit(/.claude/worktrees/**)` (sub-agent worktrees) unless the session runs in auto or acceptEdits mode; the helper `Bash(python /.claude/skills/otomode/scripts/otomode.py:*)`; the lane tools `Bash(MMO_LOG=/.otomode/lanes.jsonl MMO_TASK=*)`; and `Read(/.claude/skills/**)`. Everything not allowed now is denied later, so be generous within the repo. Ask whether to add them to `.claude/settings.local.json`. 4. Anything off limits (files, directories, services, vendors). Every ready lane in the lineup may be used unless the user says otherwise. 5. A time budget per task in minutes (default 45); a lane past it is stopped. 6. Sub-agent worktrees start from the default branch unless `worktree.baseRef` is `"head"`; if unset, offer to add `"worktree": {"baseRef": "head"}` to `.claude/settings.local.json`. 7. If the work tree is dirty: leave it, or include it in the first commit? 3. After the answer: add the approved allow rules (and `worktree.baseRef` if accepted) to `.claude/settings.local.json` (merge, never replace; use the Write or Edit tool, not a shell heredoc, so the user sees one approval). If a write is refused, say which approval is needed and stop; do not turn the hook on with setup unfinished. (`on` writes `.otomode/` and `QUESTIONS.md` into `.git/info/exclude` itself; never edit that file.) Create the branch `otomode/` from HEAD unless told otherwise. Then run `TOOL mmo-roster show --file /.otomode/roster.json` (`MMO_TASK=smoke`, no model call): if that still prompts, the allow rule does not match the command form; fix it now, not at 3 a.m. 4. Run the quick check once on the new branch; note an existing failure in OTOMODE.md, so a later one is known to be the run's. 5. Write `OTOMODE.md` at the repo root (format below), with the lineup on the `Lanes:` line minus vetoed lanes, and commit it as `otomode: plan`. Copy lane and model names from `mmo-roster lineup` / `ready` as they print (` `, a space, no slash); never compose or shorten them. 6. Turn the hook on: `$OTO on --project "" --hours `. It refuses without a `Lanes:` line naming a lane (`--force`: do not) or a session id (`--all-sessions` only if the user asks). 7. Schedule the watchdog with CronCreate: cron `17 * * * *`, recurring, prompt `otomode watchdog`; then `$OTO cron --watchdog ` (the state is the reliable record) and the id in OTOMODE.md. 8. Say in one line that otomode is on and until when; start working. ### OTOMODE.md ```markdown # Otomode run Started: