# Alignment

Alignment shows recorded agent activity and security-review findings for your
organization. Enable **Beta features** from the organization menu in the console
(click the organization's name at the top of the sidebar) or
**More → Beta features** in the native app, then open **The Grid → Alignment**.
The preference belongs to your account and syncs between signed-in apps.

**Tool calls** connects calling surfaces, conversations and tools. **Agent
interactions** displays analyzed swarms in one rotating 3D network. Select a
swarm, agent or interaction to inspect its linked tool calls, findings and
captured evidence. **Needs attention only** filters the network to recorded
review signals. Pause rotation or drag the network to inspect its layout.

The dashboards refresh while active. Collection can initially be pending while
Grid reconstructs a swarm's captured history. A failed refresh retains the last
available analysis and identifies its age.

## Account and organization scope

Alignment requires a signed-in person with Beta features enabled and access to
the requested organization. Organization and member tokens receive `403 person-required`. Personal OAuth
credentials use the account preference. A session case requires the
caller's own currently shared session in that organization. A private, removed
or another person's session receives `404 case-not-found`.

The console and native app use these routes. The MCP `grid_api` read uses the
corresponding organization-relative paths with personal OAuth authentication.

| Console path | MCP path | Result |
|---|---|---|
| `GET /api/orgs/{org_id}/alignment?days=7` | `/api/org/alignment` | Organization activity and review coverage |
| `GET /api/orgs/{org_id}/alignment?days=7&session={id}` | `/api/org/alignment` with `session` | Organization window with a selected session analysis |
| `GET /api/orgs/{org_id}/alignment/cases` | `/api/org/alignment/cases` | Available swarm analyses and collection progress |

`days` accepts `1`, `7` or `30` and defaults to `7`. The UTC window includes
`window.start` and excludes `window.end`. `series` carries hourly buckets,
including empty hours. `session` accepts a full UUID or a hexadecimal prefix of
at least eight characters. An ambiguous prefix requires the full UUID.

## Measurements

| Field | Meaning |
|---|---|
| `metrics.total_tokens` | Recorded provider input and output token usage, including repeated input context |
| `metrics.model_calls` | Recorded gateway calls in the selected window |
| `metrics.tool_calls` | Stored tool-call events, which can include delivery retries |
| `metrics.flagged_tool_calls` | Refused tool events with a policy rule or refusal code |
| `metrics.error_tool_calls` | Tool events with a recorded error outcome |
| `metrics.reviewed_tokens` | Token usage covered by valid inspection receipts, or `null` when unmeasured |
| `metrics.reviewed_sessions` | Conversations with an automated judge verdict in the window |
| `metrics.sessions_with_concerns` | Conversations whose latest verdict in the window records a concern |

`review_coverage` describes the `automated-security-rules-v1` evaluator over
captured gateway content. `reviewed_input_tokens` and `reviewed_output_tokens`
credit only complete inspected sides with known provider token counts.
`reviewed_tokens` is their sum. `recorded_tokens` is the known provider usage
within the receipt collection. `scanned_calls`, `fully_reviewed_calls`,
`reviewed_calls` and `total_calls` describe distinct captured calls.

Redaction, truncation, unsupported multimodal content, malformed captures,
missing blobs and incomplete request history appear in `gaps`. One call can have
several gaps. Repeated receipt versions count each captured call once. The
latest evaluation timestamp wins, with the receipt hash resolving a tie.
A measured zero differs from absent coverage.

The rules identify approval-bypass options, instruction overrides, credential
transfer language and destructive commands. A match requires investigation and
can come from quoted material. A `needs_review` finding records that match and
its evidence. Human authorization and context determine the outcome of triage.

`review_worker` reports the continuous review worker's recorded heartbeat,
completion time, backlog and error state. The source timestamps show when data
was captured or reviewed. A current page refresh alone does not establish
current source data.

## Networks and evidence

`graph` connects organization-scoped pseudonymous conversation IDs to calling
surfaces and tools. Token volume belongs to model-call edges. Individual tool
edges carry call counts because gateway usage is attributed to model calls.
Selection prioritizes policy refusals, errors and conversation-review signals,
then tool activity and token volume. `graph.coverage` reports the displayed
subset and its selection rule.

`agent_interactions` uses explicit agent receipts when available. Historical
cases reconstruct recorded CLI dispatches, observations and report reads.
A successful terminal-typing receipt with Enter pressed supports a delegation.
A report path read supports an inferred report edge. Worker-reported outcomes
remain attributed to their captured source.

Case evidence includes source record and call IDs, capture timestamps, tool
names, redacted argument excerpts and result excerpts. Arguments are limited to
1,200 characters and results to 800 characters. `excerpt_truncated` identifies
shortened text. `coverage.archive_complete` reports whether the selected history
was available within collection limits.

A case analyzes at most 256 retained gateway calls and 4,000 messages. Archive
retrieval has a 25-second budget, a 64 MiB total download budget, a 20 MiB limit
per object, and a 2,000-name listing limit. The catalog considers up to 50
currently shared cases owned by the account. It returns bounded summaries with
`analysis_cases` and `analysis_collection`, including pending, failed and
returned collection counts. Case objects are limited to 500,000 bytes. The compact case catalog is limited to 650,000 bytes and the snapshot summary
list to 500,000 bytes. Catalog entries retain topology and finding metadata.
Selecting a case reads its detailed evidence separately. An explicit selector can resolve an older case beyond the default 50-case
catalog. A newly requested analysis can return
`409 case-pending` while reconstruction runs. Retry after the supplied delay.

## Refusals

| Status and code | Action |
|---|---|
| `401 sign_in_required` | Sign in again |
| `403 person-required` | Use a personal sign-in |
| `403 beta-required` | Enable Beta features from the organization menu |
| `404 case-not-found` | Select a currently available session you own |
| `409 ambiguous-session` | Supply the full session UUID |
| `409 case-pending` | Retry after the indicated delay |
| `422 bad-request` | Correct the time window or session selector |
| `503 alignment-unavailable` | Retry after the source becomes available |

Snapshots are limited to 1,400,000 bytes. MCP returns complete JSON within
1,500,000 bytes including the response envelope. A response above the relevant
limit returns `result-too-large`. Use a smaller time window or the console
route for the selected read.
