# Writing back while working

Writing one section at a time, and the rule by which every reader and writer finds the fixed sections.

## Writing back while working

Change one body section at a time, never with `--body` (it replaces the whole body); none of these changes the status. `tkt ticket note PAY-001 "<text>"` appends `- YYYY-MM-DD: text` to `## Notes`. `tkt ticket section set|append PAY-001 <Heading> --text "<md>"` (or `--file`, `-` = stdin) creates a missing section at its canonical place. `tkt ticket ac list|check|uncheck|add|edit|remove PAY-001 <selector>` takes a 1-based index or a text matching exactly one item, else `ERR_AC_SELECTOR_INVALID`; all or nothing.

### Details

- `--date` overrides the date; a bad one: `ERR_TIMESTAMP_INVALID`. Headings match by the [fixed sections](#loop-sections) rule; two with one name: `ERR_BODY_SECTION_AMBIGUOUS`, nothing written. A title that is only a deeper heading (`### Notes`): `ERR_BODY_SECTION_MISSING`, no second `## Notes`; likewise `tkt group section set|append` and `tkt milestone section set|append`.
- `ac`: the index is the one `ac list` prints; only the `[ ]` marker changes; `--all` ticks every item; an item already in that state: no write, exit 0; ticking the last item does not set `done`. `ac add` appends or inserts before `--at N` and creates a missing section (clearing `MISSING_ACCEPTANCE_CRITERIA`); `ac edit` rewrites a superseded item, marker kept; after `ac remove` the rest renumber (list again), and a parent goes only with its children. No section or checkbox: `ERR_BODY_SECTION_MISSING`. A line in a code fence is no item.

- `tkt ticket section set|append --json`: `{ticket_id, section, created, content, normalized}`; `tkt ticket ac list --json`: `{ticket_id, total, done, items}`.

## Fixed body sections

A ticket's fixed `##` sections, in order: `## Description`, `## Acceptance Criteria`, `## In Scope`, `## Out of Scope`, `## Implementation Notes`, `## Verification`, `## Context`, `## Notes`, and `## Value`; a group's `## Overview`, `## Conventions`, `## Gotchas`, `## Verification`; a milestone's `## Goal`, `## Exit Criteria`, `## Decisions`, `## Notes`. Not configurable.

- One rule finds them for every reader and writer: any case and spacing; the title may go on after a non-letter (`## Acceptance Criteria (MVP)`). Not in a code fence, not as `###`.
- Ticket writes (CLI and REST) rewrite an H2 `## AC`, `## Acceptance Criterion`, `## Elfogadási feltételek`, `## Elfogadási kritériumok` to `## Acceptance Criteria` and a `* [ ]` / `+ [ ]` item under it to `- [ ]`, and say so (stderr; `normalized` in `--json` and REST).
- A near-miss (`### Acceptance Criteria`, `## Acceptance Criterias`, a `1. [ ]` item) gets `MISNAMED_SECTION` with `data.canonical`, for every ticket type.

### Details

- Only when there is no `## Acceptance Criteria` yet and the variant is there once; `## AC (MVP)` and deeper headings never move. A title naming several suffixed sections: `ERR_BODY_SECTION_AMBIGUOUS` on a write; a reader takes the first.

## Commands on this page

- [`tkt ticket note`](/en/docs/reference/commands/ticket.md#tkt-ticket-note): Append a dated `- YYYY-MM-DD: text` entry to the ticket's ## Notes section
- [`tkt ticket section set`](/en/docs/reference/commands/ticket.md#tkt-ticket-section-set): Replace a section's content (heading kept; empty content clears it)
- [`tkt ticket section append`](/en/docs/reference/commands/ticket.md#tkt-ticket-section-append): Append content after the section's last line (no blank line inserted)
- [`tkt ticket ac add`](/en/docs/reference/commands/ticket.md#tkt-ticket-ac-add): Add an unchecked item; a missing AC section is created
- [`tkt ticket ac check`](/en/docs/reference/commands/ticket.md#tkt-ticket-ac-check): Tick items
- [`tkt ticket ac uncheck`](/en/docs/reference/commands/ticket.md#tkt-ticket-ac-uncheck): Untick items
- [`tkt ticket ac edit`](/en/docs/reference/commands/ticket.md#tkt-ticket-ac-edit): Rewrite one item's text; its checkbox state and position are kept
- [`tkt ticket ac remove`](/en/docs/reference/commands/ticket.md#tkt-ticket-ac-remove): Delete items
- [`tkt ticket ac list`](/en/docs/reference/commands/ticket.md#tkt-ticket-ac-list): List the Acceptance Criteria with their 1-based indices and done/total

## Related

- Error code · 422: [`ERR_AC_SELECTOR_INVALID`](/en/docs/reference/errors.md#ERR_AC_SELECTOR_INVALID): An acceptance-criteria selector (number, range, text) matches nothing or is malformed
- Error code · 422: [`ERR_BODY_SECTION_AMBIGUOUS`](/en/docs/reference/errors.md#ERR_BODY_SECTION_AMBIGUOUS): A section name matches more than one heading
- Hint · warning: [`MISNAMED_SECTION`](/en/docs/reference/hints.md#MISNAMED_SECTION): A heading or Acceptance Criteria item looks like a fixed one (### Acceptance Criteria, 1.
