# Bounded context (/docs/agents/bounded-context)

```sh
ticketd context T-LG12
```

With no flags, the result holds the ticket itself: its reference, title,
description, status, availability and tags. Everything else is opt-in.

## Scopes

| Flag              | Adds                                                                                    |
| ----------------- | --------------------------------------------------------------------------------------- |
| `--project`       | The linked project.                                                                     |
| `--plan`          | The Plan the ticket belongs to.                                                         |
| `--relationships` | Parent, subtickets, blockers, dependents, related tickets and duplicates.               |
| `--activities`    | The authored updates.                                                                   |
| `--latest-update` | Only the most recent update.                                                            |
| `--evidence`      | Branches, commits, pull requests and verification results.                              |
| `--backlinks`     | Incoming references from other tickets and Documents.                                   |
| `--documents`     | Documents attached explicitly, mentioned in the description, or mentioned in an update. |
| `--conversation`  | For a ticket from an external source, its comments and events. Read-only.               |

```sh
ticketd context T-LG12 --latest-update --evidence --documents
```

The result includes only the scopes you request. For a ticket without a Plan,
`--plan` returns `"plan": null`. An empty list keeps its pagination fields.
For example, `--activities` returns `"activities": {"items": [], "next_offset": null}`
when the ticket has no updates.

## Limits

- **Lists hold at most 20 items.** Each list has a `next_offset`. When it is not
  null, repeat the command with `--offset` set to that value. The offset applies
  to every list in the response.
- **Text is capped.** Text values are objects with `text` and `truncated`.
  Descriptions and full Activity briefs in this view are limited to 4096 characters. The compact latest update shows up to 1024 characters. Short fields such as a title use a limit of 256.
- **Each call reads one snapshot.** Later pages can reflect changes made in
  between.

```json
{
  "ticket": {
    "reference": "T-LG12",
    "title": { "text": "Rate-limit failed login attempts", "truncated": false },
    "status": "In review",
    "availability": null,
    "tags": {
      "items": [{ "text": "security", "truncated": false }],
      "next_offset": null
    }
  }
}
```

> **Do not edit from the bounded description**
>
> The description in `context` may be truncated. To edit a ticket, read the full
> content with `ticketd show T-LG12` first.

## Fetching the full thing

The bounded result tells you what exists. Fetch full content only when you need
it:

| You need                    | Run                                        |
| --------------------------- | ------------------------------------------ |
| The whole ticket            | `ticketd show T-LG12`                      |
| A page of the activity feed | `ticketd activity list T-LG12`             |
| One complete update         | `ticketd activity show T-LG12 ACTIVITY_ID` |
| A page of a Document        | `ticketd document read DOCUMENT_ID`        |
| A page of evidence          | `ticketd evidence list T-LG12`             |

Each Document in the `documents` scope carries a `fetch` field with the exact
command to read it.

`activity list` and `evidence list` return up to 50 entries by default. To read every entry, keep
the same `--limit` and advance `--offset` by the number of entries returned.
Stop when the page is empty.

## Errors

A missing ticket, or a missing linked project or Plan, produces an error on
stderr and a nonzero exit code. Nothing is printed on stdout.

## Finding tickets

```sh
ticketd search "rate limit"
ticketd list --status "In review" --latest-update
ticketd backlinks T-LG12
```

`search` matches a literal substring. One or two characters search ticket
titles. Three or more characters also search descriptions and update briefs.
ASCII letters match without regard to case. Results exclude the trash.