# Repairs and doc gaps

After the gate each failing ticket gets at most one `repair.anchor` (name the H3s a cut H2 needs) and one `repair.split` (split an oversized unit), regated after each.

Doc gaps go back to the doc as questions; `tkt plan show <dcmp> --docgaps FILE` writes the proposed text and command.

## Details

- `repair.anchor` (`aitodo.plan.repair.anchor.v1`): `sections[]` (`introChars`, `children[]`, repeats as `### X (2)`); submit `{"unit": "<key>", "sections": [{"source": "## X", "anchors": ["### A"]}]}` (`anchor.unknown`, `anchor.notChild`, `anchor.empty`, `anchor.source`). Other H3s are excluded (`repair: not needed by <key>`); a non-blank intro is `uncovered[]` (preview, digest, epic Notes `Not covered: …`).
- `repair.split` (`aitodo.plan.repair.split.v1`, `OVERSIZED_BUNDLE`, 2+ sources): `{"unit", "parts": [{title, sources[], shared?[]}]}`, 2+ parts partitioning the sources (`split.partition`); `<key>-a`, `<key>-b` (`<key>-split-a` on collision); inline children to `-a`, waiters wait on the last part, later parts `relatesTo` `-a`; rewritten.
- Still failing: question `rewrite with my guidance` (free text = guidance, one rewrite), `I'll extend the doc`, `leave it (apply needs --force)`.
- Doc gaps (a write's `docGaps[]`, a cut H2 without H3s, a single-source unit over budget, with `raiseBudget`; a gap is `unit`, `missing`, `doc`, `section`, `proposedText?`) offer exactly `I'll extend the doc` or `proceed without it` (else `answer.option`). The latter notes `Doc gap: …`; the former stops (`stopped`, `reason: "docGap"`, `next` = the `tkt plan discard` and `tkt plan begin` commands, exit 0). Stopped: `show` and `--docgaps` work, `apply` is `ERR_DECOMPOSITION_STEP_MISMATCH`.
- `--docgaps` commands: `tkt doc section append <doc> '<H2>' --file -` or `tkt doc section set <doc> '<H2>' --file restructured.md`; none: "No doc gaps."; returned from a server store too.
