# Decisions

A decision made during development (product, scope, a deviation from the plan) is recorded with `tkt decision new`, not as a row in a doc table; tickets cite it as `decision://D63` or a bare `D63`.

Change it with a new decision (`--amends`, `--supersedes`, `--refines`, `--extends`, `--exception-to`), never by editing the old one.

- A cited decision arrives with its active changers right after it (`_list: "changers"`); a superseded one with its successor. Who cites it: `tkt decision refs D63` (also the `origin` ticket and the tickets reached through `affects`).
- `--origin PAY-001` also adds `decision://D63` to PAY-001's refs in the same write, so its bundle delivers the decision (`--no-link`: not).
- What builds on a decision, and what it builds on: `tkt graph D63` (also `doc://plan`, `group://auth`; `--depth 2`), every kind; on a ticket graph `--kinds decision,doc` (or `all`) draws the items the tickets link to as well.
- A range names every id in it: `D18-D21` (`D18..D21`, `D18…D21`, or with an en or em dash) brings D18, D19, D20 and D21 into the bundle, and `PAY-2..PAY-5` every ticket. So name only what the ticket needs: a range is handier than a list, but it also brings in the decisions the ticket does not need.

## Details

**Graph:** only declared links are drawn (text mentions are not), dashed and named by their field, the way the field reads (`D1 -affects-> doc://plan`); an item that is no ticket is `[/ … /]`, named by its URI. `--kinds` stays within `--max-nodes`. `--json` and REST (`GET /v1/graph?ref=D63`, `kinds` on every graph route): a node carries `kind`, an edge `role` (CONTAINS, BLOCKS, REFERS, BUILDS_ON, REPLACES, PROVENANCE) and `binding` (`bound`, `match`); around an item the `scope` is `item`.

**Hints:** `SUPERSEDED_DECISION`, `EXPIRED_DECISION`, `OPEN_DECISION` (builds on a `proposed` one; no block), `DANGLING_DECISION`.

**File:** `decisions/<id>.md`; id = `decisionPrefix` (default `D`) + the next free number; body `## Decision`, `## Rationale`; `get` takes any case and prints the body verbatim. **Status:** `proposed` → `active` | `rejected`; `active` → `superseded` (`--superseded-by`) | `expired` (its `--until` date or tickets met) | `withdrawn`; else `ERR_STATUS_TRANSITION`. **Relationships** point from new to old: `refines`, `extends`, `amends`, `supersedes`, `exceptionTo`, `basedOn` (`--based-on`; background, not delivered). Targets must exist, a cycle is `ERR_REL_CYCLE`; on `edit` a flag replaces that type's list, `--clear` empties it; `--supersedes X` sets X `superseded` (X must be `active`, or already replaced by it). Inverses are computed (`inverse`).

**Bundle:** an own ref, a mention, a bare `D63`, or a group, epic or milestone ref all deliver it (`_source: "amends:D21"`); a cited decision claims like a named section, and a tight budget turns a changer into a pointer, never drops it. A bare `D63` naming no decision stays text; a `decision://D9` naming nothing is `DANGLING_DECISION` (doctor too).

**Range:** both ends are whole ids of one prefix (`D151-157` is D151 only). It names at most `idRangeMax` ids (default 50); a wider one only its two ends, and `tkt doctor` reports it (`ID_RANGE_TOO_WIDE`: split it or raise the setting). An id inside a range that names nothing is no error. A renumber keeps what a range names: in `D18-D21`, D19 → D40 gives `D18, D40, D20-D21`.

**Origin link:** only `--origin` writes to a ticket (`decision new|edit`); a ref already there stays as it is, never twice. What happened: `originLink` in the `--json` and REST answer (REST: `link: false` is `--no-link`). `affects` and a gotcha's or doc's `appliesTo` never write to tickets: one decision must not rewrite many tickets.

**Affects:** what the decision affects: `doc://plan`, a section of it (`doc://plan › Heading`, as `tkt doc get --anchor`), `gotcha://x` or a ticket id. A write checks every target it adds (`ERR_AFFECTS_INVALID`: malformed, an unknown kind, an item or section that does not exist); one already in the file is reported by `tkt doctor`, never rewritten. `--affects` replaces the list; one target: `tkt decision edit D63 --add-affects doc://x` / `--remove-affects`. `--supersedes` and `--amends` (not `--extends`) compare the old decision's targets: nothing is copied, line 2 (`AFFECTS_DROPPED`) names what the new one leaves out; `--inherit-affects` takes them (`inheritedAffects`), `--no-inherit-affects` records the drop (`droppedAffects`).

**Old decision-log view:** an older `tkt` may have turned the decision-log table doc into a generated view (`generated: decisions`). Nothing refreshes it any more: `tkt doctor` names it (`DECISION_VIEW`), `tkt reorg` deletes it, rewrites a row ref (`doc://dontesek › D63`) to `decision://D63`, takes a ref to the whole table off and lists the text mentions of open items for a hand edit. The table on demand: `tkt decision list --md`. Renumbering: [After a merge](/en/docs/guides/team/git.md#maint-merge-damage); REST: [Store API](/en/docs/reference/store-api.md#ref-store-api).

## Commands on this page

- [`tkt decision new`](/en/docs/reference/commands/knowledge.md#tkt-decision-new): Record a new decision; the store assigns its id (D\<n\>)
- [`tkt decision get`](/en/docs/reference/commands/knowledge.md#tkt-decision-get): Show one decision: its fields and relationships both ways, then ## Decision and ## Rationale
- [`tkt decision list`](/en/docs/reference/commands/knowledge.md#tkt-decision-list): List decisions in id order, optionally by status or affected doc
- [`tkt decision edit`](/en/docs/reference/commands/knowledge.md#tkt-decision-edit): Change a decision's fields, status (validated transitions), relationships or body sections
- [`tkt decision refs`](/en/docs/reference/commands/knowledge.md#tkt-decision-refs): List the tickets, groups, milestones, docs and decisions that reference a decision, and how (contextRef, requiredReading, mention, a bare D\<n\>, or a relationship), and the tickets it points at itself (origin; affects:\<ref\> when their bundle carries a doc or gotcha it affects)
- [`tkt decision renumber`](/en/docs/reference/commands/knowledge.md#tkt-decision-renumber): Give a decision a new id; every reference follows

## Related

- Guide: [Git: merge drivers and after a merge](/en/docs/guides/team/git.md): The merge drivers prevent merge damage in the store; when it happened anyway, here is the repair.
- Reference: [Store API](/en/docs/reference/store-api.md): One store's endpoints, for local and dev runs.
- Hint · warning: [`SUPERSEDED_DECISION`](/en/docs/reference/hints.md#SUPERSEDED_DECISION): A decision it links, mentions in the text or inherits was superseded; it names the active end of the chain, which is delivered with it
- Hint · warning: [`EXPIRED_DECISION`](/en/docs/reference/hints.md#EXPIRED_DECISION): A linked decision's until condition is met
- Hint · warning: [`OPEN_DECISION`](/en/docs/reference/hints.md#OPEN_DECISION): A linked decision is still proposed
- Hint · warning: [`DANGLING_DECISION`](/en/docs/reference/hints.md#DANGLING_DECISION): A decision:// ref or mention names no decision
- Doctor · warning: [`DECISION_VIEW`](/en/docs/reference/doctor.md#doctor-DECISION_VIEW): A doc tkt decision import generated from the decisions, which tkt no longer renders: tkt reorg deletes it
- Config key: [`decisionPrefix`](/en/docs/reference/config.md#decisionPrefix): The prefix of decision ids (D63)
- Hint · warning: [`AFFECTS_DROPPED`](/en/docs/reference/hints.md#AFFECTS_DROPPED): A superseding or amending decision leaves out affects targets of the old one, neither kept nor recorded as dropped
- Error code · 422: [`ERR_AFFECTS_INVALID`](/en/docs/reference/errors.md#ERR_AFFECTS_INVALID): An affects target that is malformed, of an unknown kind, or names nothing
- Config key: [`idRangeMax`](/en/docs/reference/config.md#idRangeMax): The most ids an id range (D18-D21, SG-4..SG-9) names; a wider one names only its two ends
- Doctor · warning: [`ID_RANGE_TOO_WIDE`](/en/docs/reference/doctor.md#doctor-ID_RANGE_TOO_WIDE): An id range (D18-D21) holds more ids than idRangeMax, so only its two ends are read: split it or raise the setting
