aitododocs Coming soonAutonomous delivery

The bundle budget

Markdown

How much a bundle carries, the context guard that refuses a write that would cut the ticket's own content, and excluding an inherited ref.

Conceptabout 8 min2 commands
On this page

The bundle budget#

The bundle is capped on purpose (3000 tokens by default): load-bearing excerpts, not whole files, because too much context is a failure too.

  • Per call --budget 10000; per workspace tkt config set bundleTokenBudget 4000.
  • OVERSIZED_BUNDLE: essential context was cut (own refs, required reading, critical gotchas, changers, the epic, a group ## Gotchas); INHERITED_CONTEXT_TRIMMED: background only, run its fetch if needed.
Details4 items

--budget works on tkt lint too (API: ?budget=); the budget is 500 to 50 000; never hand-edit .aitodo/config.yaml. guard.budget.source says which value applied.

Tiers (_tier): 1 = load-bearing own refs (named in the AC or In Scope), 2 = inherited requiredReading, 3 = other own refs, 4 = the groups' contextRefs (a group's ## Gotchas right after tier 4's critical gotchas, ## Conventions and ## Verification after tier 4), 5 = the epic's contextRefs. With tier 1 claim the named sections (own anchored refs, anchored mentions), cited decisions and every critical gotcha that fits whole, then the parent epic part. Within a tier gotchas before docs, critical, warn, info; tiers 5, 4, 3 degrade first (excerpt, summary, pointer). Cite a group ref on the ticket only when its AC depends on it: that makes it tier 1.

Floor: inherited required reading, critical gotchas and decision changers (_list: "changers") are never a bare pointer: their summary, else mode: "brief" (the description or first paragraph, at most 600 chars), even past the budget. An inherited ref that runs out first gets the target's description as summary. One ref carries at most 3200 chars (about 800 tokens) or a quarter of the budget. What went past the budget: guard.budget.floor_tokens, per floor kind floor_tokens_by (required, critical, changer, epic); a changer's brief may go at most a quarter of the budget past it, beyond that it is a D63: title line.

Section cap: a group ## Gotchas is OVERSIZED_BUNDLE only as a pointer; a cut by the 800-char cap (any group part) is INHERITED_CONTEXT_TRIMMED, data.sections: [{group, section, delivered, total}]; tkt doctor flags the long section as GROUP_SECTION_TOO_LONG.

The context guard on writes#

A write that makes an own cut new or bigger fails (ERR_CONTEXT_GUARD_REFUSED; --over-budget).

Details7 items
  • Where: tkt ticket new|update, tkt ticket ref add|remove, tkt ticket ac add|edit.

  • What counts: a cut of the ticket's own refs and body mentions, made by the budget, or a per-ref cap cut of an anchored section; a per-ref cap cut of an unanchored doc does not. The bundle is built before and after the write (get phase, bundleTokenBudget); an already oversized ticket stays editable as long as the write makes nothing worse. update checks when the title, body, refs, groups, parent or relationships change.

  • Fix: split the scope, anchor the ref to a section, raise bundleTokenBudget, or --over-budget (its ## Notes line: Over budget: <target › anchor delivered/total>).

  • Warnings (the write goes through, stderr): an inherited cut (the epic part, changers, group sections) on a new ticket or a group or parent change; and an epic body longer than a child can receive (epic_too_long): shorten it, or move the detail into a doc and reference it.

  • Not checked: AC check, uncheck and remove, section and note edits, status, assignee, priority, labels, claims, tkt ticket import, tkt reorg, tkt plan from-docs (it has its own plan gate, on the same rule).

  • REST: POST /v1/tickets and PATCH /v1/tickets/{ticket_id} alike (409, "overBudget": true in the request, warnings in the response); ?budget= sizes only the returned bundle, never the check. On a server store the forwarded command runs on the server.

  • tkt ticket new|update --json (and the other guarded writes): the same object plus a warnings list ({kind: "inherited_cut" | "epic_too_long", message, target, anchor, delivered, total, fetch}, [] when none). A refusal prints the error envelope ({"error": …}) on stdout, one details[] item per cut (field: "cuts", target, anchor, delivered, total, cutBy).

Excluding an inherited ref#

A ticket can leave out of its bundle an inherited ref (a group's or the epic's, a milestone decision, a decision changer) that does not apply to it: tkt ticket ref exclude PAY-001 doc://plan, undone by tkt ticket ref include. The bundle names it in cuts[] (cutBy: "excluded"). Required reading, a critical gotcha or a changer needs --note and draws FLOOR_REF_EXCLUDED. It applies to this ticket only, never to its children.

Details7 items

What can be excluded: what the ticket inherits: its groups' requiredReading and contextRefs entries, its epic's contextRefs, a milestone's ## Decisions mention, and a decision that arrives with a cited one over extends / amends / refines / exceptionTo (or as its successor). An excluded decision brings no changers either. The room it frees goes to the other refs.

The ticket's own word wins: excluding an own contextRefs entry is ERR_REF_OWN, and the error names tkt ticket ref remove; a body mention is ERR_REF_OWN too (edit the body). A ref that becomes own later, or that the body mentions, is delivered: the exclusion has no effect. A ref the ticket does not inherit: ERR_REF_NOT_INHERITED, details lists what it does inherit. When the group no longer carries the ref, the stored exclusion does nothing.

Floor: required reading, a critical gotcha and a decision changer without a note are ERR_EXCLUDE_NOTE_REQUIRED. With one, its cuts[] entry is essential, and the context guard's FLOOR_REF_EXCLUDED warning (info on a closed ticket) names it, with the note and the include command.

This ticket only: an epic's exclusion does not reach its children; a child excludes the ref with its own tkt ticket ref exclude when it does not apply there either.

Identity: the ref and its anchor as tkt ticket get shows them: "doc://plan › ## Refunds", or the ref and tkt ticket ref exclude --anchor. An unanchored ref matches no anchored one; a heading matches without its #s, case and whitespace. The ticket stores the bundle's form: excludedRefs: [{ref, anchor, note}]. A repeated exclude updates the note.

REST and import: PATCH replaces the whole excludedRefs list, with the same errors (a stored entry passes unchanged); a tkt ticket import tickets[] or updates[] item can carry it too, and a refusal rolls the whole import back.

tkt ticket ref list prints them after the own refs (excluded <ref> ... <note>; --json: excludedRefs, the include command as fetch); tkt ticket get names each under "Not delivered in full" as (excluded: <note>); a cuts[] entry carries note, floor, source, and is essential for a floor item; tkt report context counts them as cutEntriesExcluded.

Commands on this page#

Generated from the registry: src/aitodo/api/selfdoc_entries/context.py · context.budget, context.write-guard, context.excludev0.1.298