Adversarial planning before a Linear project exists. Takes the user's plan and expectations, refuses to continue without measurable KPIs, drafts the full plan, sends it to a pre-mortem by one Tier 0 model of another vendor (Tier 1 when none is eligible) ("we are at the deadline and we failed, why?"), shows the failure reasons to the user, folds a guardrail for each into the plan, gets the user's approval, then creates the Linear project with milestones, tickets and dependencies ready for /max...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Maxxfactory Plan?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/icarossio-maxxfactory-plan)
---
name: maxxfactory-plan
description: Adversarial planning before a Linear project exists. Takes the user's plan and expectations, refuses to continue without measurable KPIs, drafts the full plan, sends it to a pre-mortem by one Tier 0 model of another vendor (Tier 1 when none is eligible) ("we are at the deadline and we failed, why?"), shows the failure reasons to the user, folds a guardrail for each into the plan, gets the user's approval, then creates the Linear project with milestones, tickets and dependencies ready for /maxxfactory-run. Use when the user says "plan this project", "pre-mortem", "/maxxfactory-plan", "create the Linear project for ...", or brings a plan or spec to execute with the autopilot.
---
# Autopilot: plan
**Caveman, always.** Your first action, before any other tool call: invoke the `caveman` skill (`/caveman`), and keep it for the whole session, including after a resume or a context compaction (invoke it again then). If it is not installed, follow its rules anyway: answer first, no ceremony, commands, paths, numbers and errors verbatim. Every subagent you start talks caveman too: `run-model` adds the rule to every model prompt by itself, and every Agent-tool (subagent) prompt you write starts with "Invoke the `caveman` skill first and answer terse." Persisted text stays plain prose: code, comments, docs, commits, Linear, `PLAN.md`.
You are the **master planner**, and planning is Tier 0 work (2026-11-25): run this session on a Tier 0 model of the roster when the owner has one (`/model`; `bin/run-model pool plan_review` lists them first) and use its roster key as `--planner`. Without a Tier 0 subscription a Tier 1 session plans, as before. Work added to a project that exists is not planned here: `/maxxfactory-plan-more` sizes it first and gives it a lane (a small change skips the pre-mortem and the plan review). The user is present for this phase: ask what you need, show your work, and do not create anything in Linear before the user approves the plan. Everything you write goes to the target repository (`PLAN.md` at its root and `.maxxfactory/plan/`), so `/maxxfactory-run` can resume from disk.
`bin/<x>` below means the `bin` directory next to this SKILL.md (`~/.claude/skills/maxxfactory-plan/bin/<x>` after `install.sh`, `${CLAUDE_PLUGIN_ROOT}/skills/maxxfactory-plan/bin/<x>` as a plugin); templates are in `templates/` of the same repo. The roster comes from `/maxxfactory-init` (`~/.config/maxxfactory/models.json`).
| Script | Role |
|---|---|
| `bin/premortem` | `premortem <PLAN.md> --planner <key>`: pre-mortem by a Tier 0 model of another vendor (else Tier 1, logged), two passes, `.maxxfactory/plan/premortem.md`. `--out-dir` for a milestone's own. |
| `bin/decision` | `decision add|list|check|synced`: the sourced Decision log in `PLAN.md`. |
| `bin/linear` | `linear import <tickets.json> --team KEY`: project, milestones, issues, relations; idempotent checkpoint. |
| `bin/milestone` | `seed` (state from the imported plan), `add <spec>` (a milestone, or tickets of an existing one, added later, driven by `/maxxfactory-plan-more`), `recompute`, `sync` (milestone target dates + bars in a project update, and tidy), `tidy [--dry-run]`, `list`. |
| `bin/eta` | One progress bar + ETA per milestone, then overall; `--json`. |
| `bin/idea` | `/maxxfactory-idea`: owner ideas parked unscheduled in the "Ideas (unscheduled)" milestone; `promote` writes a milestone spec skeleton from ideas for `/maxxfactory-plan-more` (see "Extending a project"). |
## Every change of plan is sourced
From the first draft of `PLAN.md` on, any change to it is a decision: a KPI, scope or non-goal edited, a ticket added, split, merged, dropped or reordered, an architecture choice reversed, a guardrail or rule added or rejected, an open human decision settled. Whatever causes it (an answer to one of your questions, a pre-mortem reason, a reviewer, your own re-reading of the repo), record it before or together with the edit, never later:
```
bin/decision add --change "<before -> after>" --source <kind>:<reference> --by <owner | your roster key> --why "<one sentence>" --affects "<K1, PM-3, slugs>"
```
- The source names where the decision comes from, precisely enough for someone who was not there to check it: `user:"<the user's answer, quoted verbatim>"`, `premortem:PM-4`, `plan-review:...`, `coordinator:<the command or file that proves it>`. `bin/decision` refuses an entry without one.
- A rejected proposal is a decision too (a pre-mortem reason rejected, a user suggestion declined with their agreement): log it with the evidence.
- Before the Linear project exists, entries are `pre-linear`: step 7 puts the whole `PLAN.md`, log included, in the project content. After it exists (a late change during step 7 or 8), mirror each entry in Linear as described in step 7 and mark it with `bin/decision synced`.
- The intake answers of step 0 are the baseline, not decisions: they go verbatim in their sections. A later answer that changes them is a decision.
## 0. Intake gate (no plan without expectations)
**Before anything else, on macOS: `bin/spotlight check`** (run it from the repo; it checks the folder that holds the repo and its future `<repo>-wt` worktrees directory). Exit 1: tell the owner, run `bin/spotlight fix` (it opens Search Privacy and prints the folder to add), and check again; the intake questions go on meanwhile, but no model is started (pre-mortem, plan review) and nothing is created while it fails, unless the owner says to go on with Spotlight on (recorded with `bin/decision add` once `PLAN.md` exists). A repo directly in the home directory: advise moving it into a folder for code first, since worktrees are created next to it.
**Ask only what changes the plan.** What the user's message, the repo or your memory of the owner's standing decisions already answers is stated as one `Assumed: ...` line the owner corrects, not asked. A question is asked only when two answers would produce two different plans, each with your default.
Ask for, and do not proceed without:
1. **The user's plan**: goal, scope, deadline, repo, constraints, what is out of scope. A link, a doc, a spec or a conversation all work.
2. **Expectations and KPIs**: how the user will know the project succeeded at the deadline. Each KPI must have a target and a measurement (a command, a query, a count, a date). Push back on vague ones ("works well", "fast enough") until each has a number or a binary check. If the user cannot name one, propose three from the goal and let them pick or edit. A plan without at least one measurable KPI stops here.
3. **Who decides** open questions during the run (the owner), and whether pushing and opening a draft PR are allowed. If they are: the PR stays a draft and CI must not run on its pushes until the work is ready to merge. Read the repo's workflows now; one that starts on every push of a branch or of a draft PR needs a change (see `bin/ci -h`): get the owner's agreement to it here, and make it the first ticket of the plan.
4. **Model tiers per phase.** Run `bin/run-model usage --apply` and `bin/run-model pool <role>` for every role, then show the owner one table: phase (planning, pre-mortem, plan review, milestone review, implementation, fix rounds, ticket review, trivial tasks, coordination), the tier allowed, the models and accounts that can take it right now (with their capacity and credit left), and the accounts excluded or kept as last resort (the coordinator's own account). Defaults: Tier 0 plans, pre-mortems and reviews plans (Tier 1 when no Tier 0 of another vendor is eligible, logged; `"plan_tier0": false` in models.json keeps planning on Tier 1); Tier 1 coordinates the run and writes and reviews Express changes; Tier 2 implements, fixes and reviews ticket code, never the same model as implementer and reviewer of a ticket; Tier 3 implements only if the owner pins it; Tier 4 trivial tasks only. Then ask which **tier profile** the project takes (state.json `tier_profile`, read by every draw of this project; `bin/state set tier_profile '"max"'`): `standard` (the default, the table above) or `max`: planning stays Tier 0 and every ticket role moves up to Tier 1 (implementation, fixes, escalation and code reviews; implementer and reviewer are still never the same model). `max` is for a project where a failed round costs more than the quota of a flagship: say that it draws only on the Tier 1 subscriptions, and that a Tier 1 entry flagged `no_implement` does not implement. Show `bin/run-model pool implement` under the chosen profile before the owner confirms. The owner confirms or changes it; their answer goes verbatim in the `Model tiers per phase` section of `PLAN.md`, and a change from the defaults is set in models.json `roles` or state.json `exclude` before the run.
5. **Quality bar for everything a user sees (design bar).** Whenever the work has a UI (a page, a table, a panel, a chart, a chat, a report, an email, a CLI output people read), it must look polished, modern and on par with the best products of its category, not merely work. A UI that passes every functional check but looks raw, cramped or broken is not done. Ask the owner for references: products, screens or screenshots they consider the bar. Store every reference image under `.maxxfactory/plan/refs/` (or the milestone folder) and name it in `PLAN.md` "Design bar". **When the owner names or shows a reference, matching its quality is a success criterion, never a nice-to-have**: it becomes a KPI and an acceptance line of each ticket it touches. Without references, the default bar is still "a design-literate user would call it polished and modern". Turn the bar into checks that fail on an ugly result, together with the owner's sign-off:
- measurable look criteria on realistic data (long names, many rows, every state): one line per table row with a height limit, no wrapping of identifiers, no raw ids (UUIDs, hashes) or raw markup (markdown, JSON) shown to users, no clipped or overflowing content, no empty half-cards, consistent spacing, type scale and tokens, loading, empty and error states, desktop and phone widths;
- full-page screenshots at desktop and phone widths, side by side with the references, in the ticket notes;
- a design KPI per UI milestone: "screenshots side by side with the references; the owner signs off". Functional KPIs (speed, sections present, accessibility scan) never stand in for it.
Record the answers verbatim in the `Expectations and KPIs`, `Constraints`, `Design bar` and `Model tiers per phase` sections of `PLAN.md` (from `templates/PLAN.md`).
## 1. Draft the plan (you, Tier 0)
Before writing, read the repository: conventions, existing checks, generators, data, agent docs (AGENTS.md / CLAUDE.md), recent history. A plan that is wrong about the repo is the most common failure cause.
**Latest technologies by default.** For a new project or a new dependency, choose the latest stable release of the language, runtime and libraries (e.g. the newest Python, Node LTS or current, framework majors), not a conservative older pin. Verify it before writing it into the plan: install the candidate stack in a scratch directory on this machine (`uv init --python <latest>` + `uv add ...`, `npm view <pkg> version`, etc.) and import or run it once. Pin what passed exactly; write the next-older version as the project-wide fallback (switch the whole project, never work around one library). An existing repo keeps its own versions unless the user asks to upgrade.
Then write `PLAN.md` with:
- Goal, KPIs, non-goals, constraints, architecture decisions (with the rejected alternatives).
- Major milestones, in order: one or several from the start, each a shippable outcome with its own KPIs or acceptance (measurable, like the project KPIs) in its section of `PLAN.md`. Each becomes a Linear milestone with its own progress bar and ETA. Blockers may cross milestones.
- Every ticket belongs to a milestone, the one whose outcome it serves best (`bin/linear import` refuses a ticket without `milestone`). Work that serves none is a sign that a milestone is missing: add it.
- Tickets per milestone: slug, title, size (S/M), `touches`, blocked-by, checks, guardrails. One ticket is one commit (one concern, under ~400 changed lines); split otherwise, group tiny ones. **Atomic tickets (enforced).** Splitting the work is a goal of planning, not a detail. Every ticket is one concern of at most about 400 changed lines, estimate S or M (never L: split it), and declares `touches`: the files or modules it changes (max 8). Two tickets that can run in parallel never change the same file outside a shared test or docs path (a directory named tests, test, __tests__ or docs at any depth, or a file named *.test.*, *.spec.*, test_*.py or *_test.py): give each hot file (an API router, the runtime, a shared store) one owner per stage, and chain the others with `blocked_by`. Prefer vertical slices that each ship a working, checked piece over a big ticket and a cleanup ticket. `bin/linear import` and `bin/milestone add` refuse a ticket list that breaks these rules, and the plan review checks them. Why: on 2026-11-12 an L ticket (22 files, +2051/-638 lines) took 18 rounds: each new reviewer found new bugs in the big diff, and parallel tickets editing the same files forced 5 merge rounds. Include the tickets nobody likes to write: scaffold and checks, test data sampled from real inputs, integration after parallel work, docs merge, final QA. **Fan-out: contract first, then one reference (enforced by the plan review).** When three or more tickets apply the same pattern (convert N pages, add N connectors, port N endpoints), the plan has, before them: (1) a contract ticket that lands every shared type, prop and component signature the N tickets need, so none of them has to touch a shared file; (2) one reference ticket, implemented at Tier 1 (`inflight.<ISSUE>.pool` or a `Tier 1` note), that converts the first instance end to end (code, tests, screenshots, notes) and that every other ticket of the fan-out is blocked by and names as the pattern to copy. A ticket that would need a shared file changed stops with `STATUS: blocked` (the pipeline hands it to the coordinator at once). **No shared ledger files.** A docs or test-helper file that every ticket of a fan-out edits (an inventory, a registry, a list of headings) is generated from the code or split into one file per ticket. Why: on 2026-11-20 ten parallel page conversions each hit the same missing prop, invented their own, and spent 1 to 3 extra review rounds each on it; every one of them also edited the same shared inventory file, which produced merge rounds and a red project branch.
- **Every ticket names its lane (enforced).** Give every ticket `lines` (non-mechanical changed lines), the plan a `risk` list, and each risk flag to the tickets it concerns. `bin/milestone lanes <tickets.json>` then prints the lane of every ticket and why: direct (small and safe: one Tier 1 implementer, one Tier 1 review, one fix), express (safe, bigger: a Tier 1 implementer and two Tier 1 reviewers), full (a risk flag, or no size: review rounds until approved). Put that list in `PLAN.md` next to the ticket table and show it to the owner with the plan: they approve the lanes with it. Optimize before you show it: a ticket that is full only because it has no `lines` gets sized; one small risky part is split from a large safe one; a chain of small tickets becomes an Express part. `bin/milestone seed` records the lanes. Details in `/maxxfactory-plan-more` "Which lane".
- **Express parts.** A big plan keeps its pre-mortem, and the groups of small tickets in it that are safe for the Express lane run as one Express ticket each (one worktree, a Tier 1 implementer, two Tier 1 reviewers, no per-ticket plan review). Give `tickets.json` a top-level `"risk"` list (`[]` when none applies), `lines` on every ticket, and `"risk": [...]` on each ticket a flag concerns; then `bin/milestone parts <tickets.json>` lists the parts and why every other ticket is not eligible. Show them to the owner; with their agreement `bin/milestone parts <tickets.json> --apply` merges them before `bin/linear import`, and `bin/milestone seed` records their lane. The rules and the reasons are in `/maxxfactory-plan-more`, "Express parts of a bigger plan".
- **Checks in two levels.** Give each ticket a `CHECKS_FAST:` line (or the project a state.json `checks_fast`): typecheck, lint and the tests of what it touches, a few minutes. The full suite (`CHECKS:`) runs once, after the review approves.
- Rules for implementers and reviewers (forbidden shortcuts, required tests).
- For every ticket that changes something a user sees: the references it must match, its look criteria and its screenshot acceptance (see the design bar in step 0). A UI ticket whose acceptance is only functional is a planning defect.
- Open human decisions with a safe default each.
- **Access before clicks** (the `Human prerequisites` table, rows `H1`, `H2`, ...). The agents do the maximum themselves: the owner is asked for access, not for manual steps. In this order:
1. **Inventory what the agents can already do.** `bin/access scan` (ops CLIs installed and logged in, MCP servers connected or waiting for authentication, the names of the `.env` variables), plus this session's own tool list. **A variable is missing only after `bin/access env NAME` says so**: it looks in the environment, then the project's `.env` (and the main checkout's from a worktree), and never prints a value. Never tell the owner a key does not exist from `echo $NAME` or a script's error alone. Then walk every ticket and every step outside the repo (DNS, hosting, deploys, environment variables, mail domains, webhooks, OAuth apps, analytics, the tracker) and ask: "which CLI, MCP tool or API does this?" Look it up in the provider's documentation before deciding that none does: Cloudflare, Vercel, GitHub, Resend, Stripe, Linear and most SaaS expose nearly everything in an API.
2. **Doable with the access of today: not a row.** A ticket does it. Do not ask.
3. **Doable with more access: the row asks for the access** (route `access`), never for the clicks. Say exactly what to grant: the login command (`! vercel login`), the MCP server to connect or authenticate, or the token to create with its exact scopes on the exact resource (e.g. "Cloudflare API token, `Zone.DNS:Edit` on example.com", "GitHub token with `actions:write` on this repo"), handed over with `! pbcopyenv <NAME>`. The verify command proves the right, not only the presence: a read call or a dry run with that credential on that resource.
4. **Human-only is the exception** (route `human`), and the row says why no tool can do it: no API exists (name the doc you checked), a payment, a legal or design sign-off, 2FA or a captcha, a physical device, real data only the owner has. "It is simpler by hand" is not a reason. If the owner prefers to do an automatable step by hand, that is their decision: log it.
Look for: accounts to create, API keys, tokens and webhook secrets, OAuth apps and their redirect URLs, paid plans or quota raises, DNS and domains, access grants (a repo, an org, a database, a VPN), real data or exports, test users and devices, sign-offs. Each row names the tickets that need it, its route, how it is handed over and its verify command.
- **Pre-authorized actions** (the `Pre-authorized actions` table, rows `A1`, `A2`, ...): every action of the run that the harness would stop to ask about or block with nobody there, each with its exact command or MCP tool: publishing or deploying (`gh workflow run publish.yml *`, `vercel deploy --prod *`), DNS and hosting changes, sending mail, merging to the default branch, writes through an MCP server, the project's check commands. The owner approves them with the plan, once; they are then pre-allowed and the coordinator runs them itself when their ticket is due, in the order and under the conditions the row states (e.g. "after the final QA passes on preview"). **Anticipate, do not wait for a block**: start from `bin/permit suggest` (candidate rules read from the repo: dispatchable workflows, package scripts, deploy configs, pull requests, connected MCP servers), then walk every ticket and ask "which command or MCP tool will this run, from the first check to the last deploy?". For each row: `bin/permit add '<rule>' --why "A<n>: <what>"` (an action no rule can name, such as a deploy through an MCP tool with many uses: also `bin/permit note '<one plain sentence>'`). Never a row: paying for credits or a plan, deleting data, a repository or a production resource; those stay with the owner.
**Ask for them now, in one message**, as soon as the draft exists: the numbered list, access rows first, what to grant or do for each (the exact command, scopes or page), the `Pre-authorized actions` table to approve with the request to add its rules to the allowed commands of this machine (`bin/permit check` prints them), and for every secret the line to type, `! pbcopyenv <NAME>` (it appends `NAME=<clipboard>` to `.env` without printing it; `/maxxfactory-init` installs it; when it is not installed, the owner edits `.env` themselves). Never ask the owner to paste a secret in the chat, never print a `.env` value, and check that `.env` is ignored by git. The owner works on the list while the pre-mortem runs; the gate is step 5b.
## 2. Pre-mortem (one Tier 0 model of another vendor)
**Rehearse first.** In a repo that has code and checks, before the pre-mortem: apply the cheapest destructive version of the riskiest change in a scratch worktree (`bin/pipeline wt <name> --detach`), run the full checks, and write what you ran and what happened in a `Rehearsal` paragraph of `PLAN.md`. The reviewer treats it as settled and spends its time on what a run cannot find (detail: `/maxxfactory-plan-more`, step 1b).
```
bin/run-model usage --apply # know which Tier 0 and Tier 1 models are available now
bin/premortem <repo>/PLAN.md --repo <repo> --planner <your roster key> --dry-run # who would review (no quota spent)
bin/premortem <repo>/PLAN.md --repo <repo> --planner <your roster key> # the roster key of the model you run as (state.json `coordinator`)
```
`--planner` is mandatory: `premortem` excludes your vendor and your model id on every account (a model must not review its own plan), then draws one healthy Tier 0 model, or a Tier 1 one when no Tier 0 is eligible (logged in state.json `tier_fallbacks`) (roles `premortem` / `plan_review`, weighted by the credit left on each account) (`--k 2` adds a second reviewer of a distinct vendor, only when the user asks for it). It runs pass 1 (the pre-mortem) and pass 2 (an adversarial self-review: the reviewer re-checks its own reasons against the repo, drops the generic ones and adds the angles it missed), and ranks by probability x impact, and writes `.maxxfactory/plan/premortem.md` and `premortem.json` (with each reviewer's status per pass). It takes 10 to 40 minutes: run it in the background and keep working on the ticket breakdown meanwhile. Exit 1 means degraded (no pass 2, or fewer reviewers than `--k`): the table says so; tell the user and offer to rerun later (`bin/run-model wait premortem`) or continue degraded with their consent. Exit 2: nothing usable.
Pre-mortems are Tier 0, then Tier 1, never lower (see the README, Tiers). If your own vendor is the only Tier 0 and Tier 1 vendor available, do not substitute another account of it and do not fall to Tier 2: wait for a reset (`bin/run-model wait premortem`), and when the wait is long tell the user (a CRITICAL alert says so too). The old `--allow-mid` is refused.
## 3. Show the failure reasons to the user, explicitly
Paste the table from `.maxxfactory/plan/premortem.md` verbatim (every reason, probability, impact, early signal, guardrail), plus each reviewer's one-sentence summary. The list has as many reasons as the reviewer found real: no prompt asks for a number. Each carries a `class`: only `kpi-blocking` reasons are folded into the plan; `hardening` and `out-of-scope` ones are shown to the owner and parked with `/maxxfactory-idea`. Each accepted reason gets the cheapest guardrail that works: a check command, then an acceptance criterion or a rule on an existing ticket, and a new ticket only when none of those can do it. Then your own verdict per reason: accept, reject with evidence, or merge. Do not soften the list: the point is that the user sees how the project most probably fails before anything is built.
## 4. Fold the guardrails into the plan
For every accepted reason, add a guardrail with a home, so it is enforced and not just written:
- a **KPI or acceptance criterion** (measurable at the deadline or at the ticket's review),
- a **check command** on a ticket's `CHECKS:` line (the cheapest guardrail: a check that fails when the shortcut is taken),
- a **dedicated ticket** (e.g. real-data fixtures, an integration ticket, a load test) with `blocks` on what depends on it,
- or a **rule** in `PLAN.md` "Rules for implementers and reviewers" (copied into every ticket file by the run skill).
Fill the `Pre-mortem` table of `PLAN.md` with the reason, its guardrail and where it lives, and add the early signals to a "Watch for" list the run skill checks on each heartbeat. Rejected reasons stay listed as rejected, with the evidence. Every plan change a reason causes (a new ticket, a new check, a moved KPI, a reason rejected) gets its `bin/decision add --source premortem:PM-<n>` entry.
## 5. User review loop
Show the updated plan (goal, KPIs, ticket table, pre-mortem table, open decisions). Iterate until the user says it is approved. Each change the user asks for, or agrees to after one of your questions, is logged with `--source user:"<their words>"` and `--by <owner>` in the same step as the edit; show the new Decision log rows with the updated plan, so the user sees what was recorded in their name. Record "Plan approved by <owner> on <date>" and "Pre-mortem reviewed by <models>" in the Approval section. If the user changes the scope materially after the pre-mortem, rerun step 2 on the changed parts (`--only-pass 1` is enough for a small delta).
## 5b. Human prerequisites gate (nothing created while one is missing)
The run is unattended: a missing account or key found at 3 a.m. stops a ticket, and often everything behind it, until the owner wakes up. So before any ticket is written to Linear:
1. **Rebuild the list from the approved plan.** The pre-mortem and the review loop added tickets: walk every ticket again, add the rows they need, and ask for the new ones in one message.
2. **Verify each row yourself.** Run its verify command (a login check, a one-call API ping or dry run that needs the granted scope, `dig`, a `test -s`); mark it `provided` with the date only when the command passes. "The owner says it is done" is not verified. Never echo a secret to check it.
3. **A row the owner cannot provide today is deferred, never left open.** Ask for the fallback (a mock, a sandbox, a stub behind a flag, a preview URL), name the tickets held back, give them `blocked_by` so they are scheduled last, and say when the owner expects to provide it. Log it: `bin/decision add --change "H<n> deferred: <fallback>" --source user:"<their words>" --by <owner> --affects "<slugs>"`.
4. **Stop while any row is `missing`.** No `tickets.json`, no Linear project. Tell the owner which rows are left and what each blocks.
5. **Pre-allow the approved actions.** `bin/permit check` lists the rules still missing (the runtime's own scripts and the `A` rows). Show the owner the full list and ask for their consent to add it to the allowed commands of this machine (the user settings, so every worktree and later session has them). On their yes, run `bin/permit apply`; if the harness refuses that write (settings files are protected), the owner types `! <bin>/permit apply`. Run `bin/permit check` again: it must print `nothing missing`.
6. **Logins outlast the run.** `bin/harness logins --min-hours <hours to the deadline, at least 48>`: an account that is logged out, or whose login ends before the run does, is logged in again now (the line gives the command), the coordinator's own first.
A prerequisite found after this gate is a planning defect: add the row, log the decision, and say so.
## 6. Ticket breakdown file
Write `.maxxfactory/plan/tickets.json` (format in `bin/linear --help`): project name, description (one paragraph) and content (the whole `PLAN.md`), milestones (name, `id` slug, description with its KPIs), and every ticket with slug, title, markdown description, milestone, estimate (S=1 or M=2; L is refused: split it), `touches` (files or modules it changes), priority, `blocked_by` slugs and labels. Each ticket description carries: precise instructions, `CHECKS:` line, `**Acceptance**`, the guardrails that apply (with their PM ids), what not to touch, and the notes it builds on. The run skill rewrites them into ticket files, so write them as instructions for a cheap implementer, not as user stories.
## 7. Create the Linear project
Only after approval. Create the project, milestones, issues and `blocks` relations:
- With this harness's Linear tools (MCP): create the project with `PLAN.md` as its content, the milestones, then the issues in dependency order and the relations. Checkpoint after EVERY creation in `.maxxfactory/plan/tickets.created.json`: `{"project_id", "project_url", "project_created": true, "milestones": {name: id}, "tickets": {slug: {"id", "identifier", "url"}}, "relations": ["blocker-slug->blocked-slug"]}`. `project_created: true` is the evidence this autopilot created that project (the same field `bin/linear import` writes when it creates one). Set it when the project is created, and do not drop it later. A checkpoint for a project that already existed (`bin/linear import --project-id`, or issues filed into someone else's project) is `project_created: false` and is not creation evidence. Before each creation, check the checkpoint; after a failure or a timeout, search Linear for the title in the project before creating again (a lost response is not a missing issue). A resumed session continues from the checkpoint, never from scratch.
- Without Linear tools: `LINEAR_API_KEY=... bin/linear import .maxxfactory/plan/tickets.json --team <KEY>` (idempotent; `--dry-run` first).
Then post a project update with the KPI table, the top pre-mortem reasons and the Decision log, so the humans who follow the project in Linear see what the autopilot is guarding against and why the plan looks the way it does.
From now on, a change of plan reaches Linear as well as `PLAN.md`: re-sync the project content (`bin/linear project-content <project-id> PLAN.md`, or the MCP project update), update the description of every affected issue (or create / cancel the issue, with its relations), comment on each affected issue with the entry (`D-<n>: change, why, source`), and `bin/decision synced D-<n> <comment url>`. `bin/decision check` must pass before the handoff.
## 8. Handoff
- Commit `PLAN.md` on a branch `maxxfactory/<project-slug>` if the user agrees (ask; the user is here). Add `.maxxfactory/` to `.git/info/exclude`.
- Seed `<repo>/.maxxfactory/state.json` from `templates/state.json`: project, project id, team, branch, push, checks, coordinator. Then `bin/milestone seed .maxxfactory/plan/tickets.json`: `milestones`, `blockers`, `sizes`, `queue`, `stages` and `critical_path` from the plan (with MCP tools, write `tickets.created.json` in the same format first). Then `bin/milestone sync`: target dates and the first milestone bars in Linear.
- Tell the user, in a few lines: the Linear project link, the number of tickets and milestones, the top three failure reasons and their guardrails, the human prerequisites deferred (what each holds back, and when the owner said they would provide it), and that `/maxxfactory-run` will execute it.
## Extending a project (tickets or a milestone added later)
Adding scope to a project that already exists is `/maxxfactory-plan-more`, through `bin/milestone add`. A new major milestone gets the same intake gate, pre-mortem, plan review and approval as this plan, scoped to the milestone. Tickets added to a milestone that exists (one ticket, a few, a QA pass) inherit its KPIs and its pre-mortem and get the plan review and the approval only. Never hand-edit state, `PLAN.md` or Linear for either. It also takes ideas parked with `/maxxfactory-idea` as input (`/maxxfactory-plan-more ENG-40,ENG-41`): it promotes them and, on approval, closes them as duplicates of the new tickets.
When a plan is folded into an existing project as a milestone, the Linear project created for that plan is left with no issues. Preserve the creation evidence: keep `project_created: true` and set `created_project_id` to the project this autopilot created. `project_id` may name the destination the tickets moved into; tidy archives `created_project_id`, not that destination. Do not rewrite the checkpoint so the created id disappears, and do not set `project_created` false on it. The destination's own checkpoint, if you write one, has `project_created: false`. The next `bin/milestone sync` archives the empty created project: tidy archives a project only when `project_created: true` (or a legacy reserved project id, or state.json `autopilot_project_ids`) records it, the id is not the current `project_id`, and the project has no issues. An imported destination is never archived.
## Rules
- You plan; you never implement during this phase. Reading the repo is allowed, editing code is not.
- Pre-mortem reviewers are read-only; `premortem` restores the tree if one of them changes it.
- Keep each reviewer's full output on disk (`.maxxfactory/plan/premortem-<key>-<pass>.md`) and never paraphrase a reason into something weaker than the reviewer wrote.
- Nothing asked of the owner that a CLI, an MCP tool or an API can do: such a row asks for the access instead. Every outward action of the run is an approved `A` row and `bin/permit check` passes.
- No human prerequisite left open: every `H` row is `provided` (verified by its command) or `deferred` (fallback, held-back tickets, decision logged) before anything is created in Linear. Secrets go through `! pbcopyenv`, never through the chat.
- No decision unsourced: a `PLAN.md` change without its Decision log row, or a row still `pending` in Linear, is a defect to fix before anything else.
- Budget: planning is where Tier 0 models are spent on purpose (the planner session, the pre-mortem, plan reviews and milestone reviews). One reviewer, two passes, once per plan (plus one rerun on a material change). Never pay for extra credits to run it: wait for a reset instead (`bin/run-model wait premortem`).