# From a plan doc to an epic with tickets

A plan doc becomes an epic and its stories in one step, without AI: the doc is the epic, each H2 is a story, the `- [ ]` lines are the acceptance criteria, and every story points at its own section.

Before writing, the plan gate checks every ticket's bundle.

1. Create a store in the `.tickets/` subfolder and pin it to the folder: `--pin` writes `.aitodo.yaml`, so every `tkt` command run here uses this store.

   ```console
   $ tkt init shop --workspace-dir .tickets --pin
   Workspace 'shop' initialized
   ```

2. Create a group with the `PAY` prefix. Without the group's repo anchor (`--repo`, `--branch`, `--base-ref`) no ticket can start.

   ```console
   $ tkt group new Payments --kind project --prefix PAY --repo https://example.com/shop.git --branch main --base-ref main --description 'Card payments and refunds'
   Created group payments
   ```

3. Write the plan doc and store it. The title is the epic, the two H2s are two stories.

   `refunds.md`:

   ```text
   # Refunds

   Customers get money back for a returned order.

   ## Partial refund

   Refund a part of an order's amount; the rest stays charged.

   - [ ] The refund is at most the charged amount
   - [ ] The order shows the refunded part

   ## Refund export

   Export the day's refunds as CSV for accounting.

   - [ ] One CSV row per refund
   ```

   ```console
   $ tkt doc new refunds --file refunds.md --description 'How refunds work'
   Doc saved doc://refunds
   ```

4. Look at the plan without writing it: `--out` only writes an import file. The gate passes all three tickets.

   ```console
   $ tkt plan from-docs refunds -g payments --no-llm --out plan.json
   Gate (report): 0 of 3 fail
   Wrote the plan to plan.json
   ```

5. Write it to the store. `--yes` skips the confirmation prompt.

   ```console
   $ tkt plan from-docs refunds -g payments --no-llm --yes
   Created 3, updated 0 ticket(s)
   ```

6. The epic and the two stories in the tree, with their counts of acceptance criteria.

   ```console
   $ tkt tree
   Partial refund
   0/2 AC
   ```

7. Each story points at its own section; in the bundle the agent gets that section.

   ```console
   $ tkt ticket ref list PAY-002
   doc://refunds
   Partial refund
   ```

8. The context guard finds only info hints, so the exit code is 1: the story can start.

   ```console
   $ tkt lint PAY-002
   NO_VERIFICATION_STEPS
   exit code: 1
   ```

## Details

When the doc's sections describe the work in prose, there are no acceptance criteria without AI. Then your coding agent splits the doc: [AI decomposition](/en/docs/guides/plan/decompose.md#plan-decompose). A re-run writes a diff: a new section becomes a new ticket, a changed one an update ([Tickets in bulk](/en/docs/guides/plan/import.md#plan-from-docs)).

## Related

- Guide: [AI decomposition](/en/docs/guides/plan/decompose.md): tkt plan begin plans an epic and stories from docs; you, the coding agent, do the AI work, one step at a time.
- Guide: [Tickets in bulk](/en/docs/guides/plan/import.md): Many tickets at once, without AI: from an import file, or from docs where the doc is the epic and each H2 a story.
