# The plan gate

Before a write, each planned ticket's bundle is built on a scratch store copy at the workspace budget, hints at base severity.

Failures: `block:<HINT>` (not `UNRESOLVED_BLOCKER`, `TICKET_DEFERRED`), `unscoped`, `oversized`, `notFullyDelivered`, each with a `fix`. Default: report (write, exit 0); `--strict` refuses (`ERR_PLAN_GATE_FAILED`, nothing written); `--strict --force` writes.

## Details

- `oversized`: a cut of the ticket's own content, by the rule of the [context guard on writes](/en/docs/concepts/budget.md#context-write-guard): a budget cut, or a per-ref cap cut of an anchored section. A cut of the epic part, a changer, an inherited ref or a group section never fails; on the same new ticket the plan gate and the context guard agree.
- `notFullyDelivered`: a needed ref (own anchored provenance, `note: method`) has `fullyDelivered: false`; the epic's doc ref, `suggested:` and inherited refs never count. `group` (once, first): no repo anchor (`tkt group edit G --repo <url>`); `--strict` stops before planning.
- Failure `{key, rule, ref?, anchor?, fix?}`; `fix`: `narrowAnchor` (subsections: `--level h3` or anchors), `docGap` (add H3s), `raiseBudget` (lower bound for `bundleTokenBudget`).
- `--force` alone does nothing. `--out` gets `# gate (…)` YAML comments (still importable). Preview `✓ key  doc://d › ## X · 2 refs · 812/3000 tok`, then `Gate (report): 3 of 7 fail`.

- `tkt plan from-docs --json` adds `gate: {mode, passed, failing, failures, tickets, unchanged}`.

## Related

- Concept: [The bundle budget](/en/docs/concepts/budget.md): How much a bundle carries, the context guard that refuses a write that would cut the ticket's own content, and excluding an inherited ref.
- Error code · 409: [`ERR_PLAN_GATE_FAILED`](/en/docs/reference/errors.md#ERR_PLAN_GATE_FAILED): The strict plan gate refuses a plan whose tickets fail its rules
