# Tickets in bulk

Many tickets at once, without AI: from an import file, or from docs where the doc is the epic and each H2 a story.

## Bulk import

`tkt ticket import plan.yaml` creates a whole plan (epics, stories, dependencies) from one YAML or JSON file, all or nothing. `--dry-run` validates and prints the ids a real run would get; `-` reads stdin. REST: `POST /v1/tickets:import` (`?dryRun=true`).

### Details

```yaml
groups: [payments]          # default groups; the first is primary
tickets:
- {key: e1, title: Sync engine, type: epic}   # keys live in this file only
- {key: s2, title: Push contacts, parent: e1, blockedBy: [s1, PAY-012]}
```

- `updates:` patches existing tickets in the same step (`id` plus `title`, `body`, `contextRefs`, each replaced whole; `tickets` may be empty): the shape `tkt plan from-docs --out` writes.
- Output `key → id`, ids in dependency order. All problems are listed first (`tickets[N].field: …`: unknown key or id, duplicate key, `blockedBy` cycle, parent rules, unknown group, bad enum): exit 1, nothing written; a half-way failure deletes what it made and restores the counters.
- Status as `tkt ticket new`: `backlog` by default. Bad YAML/JSON: `ERR_FILE_PARSE`; unreadable path: exit 2.

- Fields: `key`, `title` (required), `type`, `status`, `priority`, `groups`, `assignee`, `labels`, `estimate`, `value`, `valueRationale`, `parent` (a key or an id), `blockedBy`, `relatesTo`, `contextRefs`, `body` (else the type's template). Unknown fields are errors.

- `tkt ticket import --json`: `{dryRun, created: [{key, id, title}]}`.

## Tickets from plan docs

`tkt plan from-docs 'plan-*' -g payments` splits by headings, no AI: a doc is an epic, each `##` a story with the section's `- [ ]` items as criteria (else numbered items, else bullets). A re-run shows a diff; it writes after one confirmation (`--yes`) through the [plan gate](/en/docs/concepts/plan-gate.md#plan-gate); `--out plan.yaml` writes an import file instead.

### Details

- No argument: every `type: plan` doc. Epic: the doc's `title` (else H1, else id), described by the text before the first H2. `--level h3` splits an H2 per H3; `--skip 'Döntések*'` drops non-work sections (never reported gone). Fenced code is never structure.
- Groups: `appliesTo.groups`, else `-g` (first is primary); neither: `ERR_GROUP_UNKNOWN`.
- Re-run: new section, new ticket; changed, updated title, description, criteria (unchanged checked items stay checked); `done`/`canceled` untouched; gone sections only reported. Preview `+` new, `~` update, `✓` closed, `?` gone. `--json` and `--out` write nothing. Decomposed docs are skipped.
- Without AI a prose section yields a story without criteria (counted in a warning). `--llm` (or `AITODO_LLM_CMD`) sends those sections to the provider for criteria and proposes value, rationale and `## Value` "Proposed by an LLM" per new draft (`proposedValue`), written on confirmation.
- `tkt suggest value [PAY-001] [-g G]`: proposals for unvalued tickets (a given one always) with accept commands, writing nothing; cached per ticket (`source`: `llm`/`cache`; `--refresh` re-asks; a failed batch keeps earlier ones). Without an LLM nothing fails; it names the setup (`AITODO_LLM_CMD`, `--llm`, `--llm-provider server`).

- Provenance ref per ticket (`doc://<id>`, `anchor` = heading, `sourceRev`, `note: provenance`); each story gets `## In Scope` ("The work described in doc://d › Heading."); new tickets get high-confidence ref suggestions (`suggested: <reason>`; `--no-suggest` turns off).

- `tkt plan from-docs --json`: `{plan, entries, counts, skipped, warnings, gate}`.

## Commands on this page

- [`tkt ticket import`](/en/docs/reference/commands/ticket.md#tkt-ticket-import): Create many tickets from one plan; dependencies reference each other by `key`
- [`tkt plan from-docs`](/en/docs/reference/commands/plan.md#tkt-plan-from-docs): Plan epics and stories from docs (doc = epic, heading = story), each linked to its section
- [`tkt suggest value`](/en/docs/reference/commands/knowledge.md#tkt-suggest-value): Propose a business value (1\|2\|3\|5\|8) with a rationale (#117)

## Related

- Concept: [The plan gate](/en/docs/concepts/plan-gate.md): Before a write, each planned ticket's bundle is built on a scratch store copy at the workspace budget, hints at base severity.
