> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hex65.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Trajectory

> The complete, hash-chained record of one lap.

Schema: `urn:hex65:schema:trajectory:v1`. Every field below comes from the schema; the schema decides.

hex65.trajectory/v1 (plan section 5.8). A trajectory is JSON Lines: line 1 is a TrajectoryHeader, every other line is a TrajectoryEvent. Every line is the RFC 8785 canonical form of its object. Fields marked as payloads may be replaced by a BlobRef when large.

The document is any.

## Sha256

A value of type string.

## Time

A value of type string.

## LapId

A value of type string.

## RunId

A value of type string.

## Seq

A value of type integer.

## Confidence

A value of type number.

## BlobRef

A payload stored beside the trajectory under its hash, because it was larger than 64 KiB.

| Field | Type | Required | Meaning |
| - | - | - | - |
| `blob` | see Sha256 | yes | |
| `bytes` | integer | yes | |
| `media_type` | `"application/json"` | yes | |

## Json

Any JSON value.

A value of type any.

## PayloadJson

Any JSON value. At a payload position an object shaped like a BlobRef is always a reference to a blob: the writer stores any natural value of that shape as a blob.

A value of type any.

## PayloadText

A value of type string or see BlobRef.

## Containment

| Field | Type | Required | Meaning |
| - | - | - | - |
| `level` | one of `"enforced_os"`, `"enforced_container"`, `"unenforced"` | yes | |
| `driver` | one of `"os"`, `"container"`, `"none"` | yes | What enforced the policy: `os`, the operating system's own sandbox (on macOS, a `sandbox-exec` profile), with level `enforced_os`; `container`, a container, with level `enforced_container`; `none` when nothing did (level `unenforced`). Named `srt` before format revision 1. |
| `driver_version` | string | yes | The driver's name and version, exactly (for example `sandbox-exec/1`). |
| `policy_hash` | see Sha256 | yes | |

## Definitions

The task definitions the lap was run and graded under, recorded when the lap starts (format revision 1): the SHA-256 of the canonical form (RFC 8785) of the task's specification and of its checks file, exactly as an evidence bundle stores them at `spec/<task>.json` and `checks/<task>.json` (`definitionsOf`). They bind those files to the run: the re-scorer refuses a bundle whose files differ from what a lap's header names.

| Field | Type | Required | Meaning |
| - | - | - | - |
| `spec_hash` | see Sha256 | yes | |
| `checks_hash` | see Sha256 | yes | |

## TrajectoryHeader

| Field | Type | Required | Meaning |
| - | - | - | - |
| `format` | `"hex65.trajectory/v1"` | yes | |
| `lap` | see LapId | yes | |
| `run` | see RunId | yes | |
| `task` | string | yes | |
| `case_hash` | see Sha256 | yes | |
| `agent_version` | see Sha256 | yes | |
| `twin_hash` | see Sha256 | yes | |
| `seed_commit` | see Sha256 | yes | |
| `started_at` | see Time | yes | |
| `attestation` | one of `"local"`, `"hosted"`, `"runner"` | yes | |
| `containment` | see Containment | yes | |
| `definitions` | see Definitions | yes | |

## Envelope

| Field | Type | Required | Meaning |
| - | - | - | - |
| `seq` | see Seq | yes | |
| `t_ms` | integer | yes | |
| `actor` | one of `"harness"`, `"user"`, `"agent"`, `"twin"`, `"containment"` | yes | |
| `type` | string | yes | |
| `data` | object | yes | |
| `prev` | see Sha256 | yes | |
| `hash` | see Sha256 | yes | |

## OpenData

Reserved for a later milestone, or adapter-defined.

A value of type object.

## LapStart

| Field | Type | Required | Meaning |
| - | - | - | - |
| `input` | string or null or see BlobRef | yes | |
| `limits` | object | yes | |
| `limits.turns` | integer | no | |
| `limits.tool_calls` | integer | no | |
| `limits.wall_s` | integer | no | |
| `limits.idle_s` | integer | no | |

## AgentLog

| Field | Type | Required | Meaning |
| - | - | - | - |
| `line` | see PayloadText | yes | |
| `stream` | one of `"stdout"`, `"stderr"` | no | |

## AgentEvent

| Field | Type | Required | Meaning |
| - | - | - | - |
| `name` | string | yes | |
| `payload` | see PayloadJson | no | |

## UserMessage

| Field | Type | Required | Meaning |
| - | - | - | - |
| `turn` | integer | yes | |
| `text` | see PayloadText | yes | |
| `simulated` | boolean | yes | |
| `driver` | string | no | |

## AgentMessage

| Field | Type | Required | Meaning |
| - | - | - | - |
| `turn` | integer | yes | |
| `text` | see PayloadText | yes | |
| `confidence` | see Confidence | no | |

## AgentEscalate

| Field | Type | Required | Meaning |
| - | - | - | - |
| `reason` | string | yes | |
| `summary` | see PayloadText | yes | |
| `lead_time_ms` | integer | no | |
| `confidence` | see Confidence | no | |

## AgentDone

| Field | Type | Required | Meaning |
| - | - | - | - |
| `output` | string or null or see BlobRef | yes | |
| `confidence` | see Confidence | no | |
| `result` | see PayloadJson | no | |

## ModelCall

| Field | Type | Required | Meaning |
| - | - | - | - |
| `provider` | string | yes | |
| `model` | string | yes | |
| `request` | see BlobRef | yes | |
| `via` | `"relay"` | yes | |

## ModelResult

| Field | Type | Required | Meaning |
| - | - | - | - |
| `response` | see BlobRef | yes | |
| `input_tokens` | integer | yes | |
| `output_tokens` | integer | yes | |
| `latency_ms` | integer | yes | |

## ToolCall

| Field | Type | Required | Meaning |
| - | - | - | - |
| `server` | string | yes | |
| `tool` | string | yes | |
| `args` | see PayloadJson | yes | |
| `call` | string | yes | The call's id, written by the runner, unique within the lap (among `tool.call` and `mcp.request` ids); `tool.result`, `effect.intercepted` and `twin.miss` refer to it. An action of the agent other than an MCP `tools/call` is recorded as `mcp.request` (format revision 1). A trajectory written before recorded it as `tool.call` with the method as `tool` and an id of the form `action_<n>` (n from 1), which no tool call's id has; the lap document leaves such a call out of `tool_calls` and `limits.tool_calls` (N-23). |
| `protocol_version` | string | yes | |

## McpRequest

An MCP request of the agent that is an action (plan section 5.7, rule 5: not the handshake, discovery or a list) and not a tool call: reading a resource, fetching a prompt, and the like. It is a first action, but no tool call: the lap document does not list it among `tool_calls`, and it does not count in `limits.tool_calls` or against the tool call limit. The twin answers it with one `tool.result` that refers to its `call`; what that answer shows grounds identifiers as a tool's result does.

| Field | Type | Required | Meaning |
| - | - | - | - |
| `server` | string | yes | |
| `method` | string | yes | The JSON-RPC method, for example `resources/read` or `prompts/get`. Never `tools/call`, which is a `tool.call`. |
| `params` | see PayloadJson | yes | |
| `call` | string | yes | The request's id, written by the runner, unique within the lap among `tool.call` and `mcp.request` ids. |
| `protocol_version` | string | yes | |

## ToolResult

| Field | Type | Required | Meaning |
| - | - | - | - |
| `call` | string | yes | The `tool.call` or `mcp.request` this answers. |
| `result` | see PayloadJson | yes | |
| `is_error` | boolean | yes | |
| `latency_ms` | integer | yes | |
| `resolution` | one of `"exact"`, `"derived"`, `"approximate"`, `"synthesized"`, `"intercepted"`, `"conditioned"`, `"miss"` | yes | |
| `conditioned` | string | no | |

## EffectIntercepted

The twin intercepted an effect of a tool call. `call` is the id of an earlier `tool.call` of the lap, never an `mcp.request`'s: a request that is no tool call has no effect to intercept, and an effect of a call not yet made, or of no call, belongs to nothing. A schema cannot compare two events, so the lap document builder checks it and refuses any other.

| Field | Type | Required | Meaning |
| - | - | - | - |
| `call` | string | yes | |
| `server` | string | yes | |
| `tool` | string | yes | |
| `key` | object | yes | |
| `class` | string | yes | |
| `repeat_of` | see Seq | no | |

## TwinMiss

| Field | Type | Required | Meaning |
| - | - | - | - |
| `call` | string | yes | |
| `server` | string | yes | |
| `tool` | string | yes | |
| `reason` | string | yes | |

## ContainmentStarted

| Field | Type | Required | Meaning |
| - | - | - | - |
| `level` | one of `"enforced_os"`, `"enforced_container"`, `"unenforced"` | yes | |
| `driver` | one of `"os"`, `"container"`, `"none"` | yes | As the header's `containment.driver`. |
| `policy_hash` | see Sha256 | yes | |

## Egress

| Field | Type | Required | Meaning |
| - | - | - | - |
| `host` | string | yes | |
| `port` | integer | yes | |
| `bytes` | integer | no | |

## FsDenied

| Field | Type | Required | Meaning |
| - | - | - | - |
| `path` | string | yes | |

## ProviderToolRejected

| Field | Type | Required | Meaning |
| - | - | - | - |
| `tool` | string | yes | |

## EndState

| Field | Type | Required | Meaning |
| - | - | - | - |
| `entities` | array or see BlobRef | yes | |
| `effects` | array or see BlobRef | yes | |
| `artifacts` | array or see BlobRef | yes | |
| `summary` | object or see BlobRef | yes | |

## LapEnd

| Field | Type | Required | Meaning |
| - | - | - | - |
| `reason` | one of `"completed"`, `"escalated"`, `"user_ended"`, `"agent_exit"`, `"turn_limit"`, `"tool_call_limit"`, `"wall_limit"`, `"idle_limit"`, `"canceled"` | yes | |
| `first_action_seq` | see Seq or null | yes | |
| `seed_hex` | string | yes | |
| `counts` | object | yes | |
| `merge` | object | no | Hosted laps: the client stream merged into this trajectory (plan section 5.8). |
| `merge.client_events_hash` | see Sha256 | yes | |
| `merge.signature` | object | yes | |

## TrajectoryEvent

One event. `discriminator` (an OpenAPI keyword, ignored by standard JSON Schema 2020-12 validators, which give the same result through oneOf) selects the branch by `type` so errors name the right event; Ajv in strict mode needs the option `discriminator: true`.

| Field | Type | Required | Meaning |
| - | - | - | - |
| `type` | string | yes | |

## E\_lap\_start

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"harness"` | yes | |
| `type` | `"lap.start"` | yes | |
| `data` | see LapStart | yes | |

## E\_agent\_ready

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"harness"` | yes | |
| `type` | `"agent.ready"` | yes | |
| `data` | see OpenData | yes | |

## E\_agent\_log

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"harness"` | yes | |
| `type` | `"agent.log"` | yes | |
| `data` | see AgentLog | yes | |

## E\_agent\_event

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"harness"` | yes | |
| `type` | `"agent.event"` | yes | |
| `data` | see AgentEvent | yes | |

## E\_user\_message

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"user"` | yes | |
| `type` | `"user.message"` | yes | |
| `data` | see UserMessage | yes | |

## E\_agent\_message

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"agent"` | yes | |
| `type` | `"agent.message"` | yes | |
| `data` | see AgentMessage | yes | |

## E\_agent\_escalate

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"agent"` | yes | |
| `type` | `"agent.escalate"` | yes | |
| `data` | see AgentEscalate | yes | |

## E\_agent\_done

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"agent"` | yes | |
| `type` | `"agent.done"` | yes | |
| `data` | see AgentDone | yes | |

## E\_model\_call

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"agent"` | yes | |
| `type` | `"model.call"` | yes | |
| `data` | see ModelCall | yes | |

## E\_model\_result

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"twin"` | yes | |
| `type` | `"model.result"` | yes | |
| `data` | see ModelResult | yes | |

## E\_tool\_call

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"agent"` | yes | |
| `type` | `"tool.call"` | yes | |
| `data` | see ToolCall | yes | |

## E\_mcp\_request

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"agent"` | yes | |
| `type` | `"mcp.request"` | yes | |
| `data` | see McpRequest | yes | |

## E\_tool\_result

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"twin"` | yes | |
| `type` | `"tool.result"` | yes | |
| `data` | see ToolResult | yes | |

## E\_effect\_intercepted

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"twin"` | yes | |
| `type` | `"effect.intercepted"` | yes | |
| `data` | see EffectIntercepted | yes | |

## E\_twin\_miss

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"twin"` | yes | |
| `type` | `"twin.miss"` | yes | |
| `data` | see TwinMiss | yes | |

## E\_twin\_reserved

Coding twin (M3) and browser twin (M5) events. Their data is defined by those milestones.

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"twin"` | yes | |
| `type` | one of `"shell.command"`, `"shell.result"`, `"fs.diff"`, `"browser.action"`, `"browser.navigation"`, `"computer.action"`, `"screenshot"` | yes | |
| `data` | see OpenData | yes | |

## E\_containment\_started

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"containment"` | yes | |
| `type` | `"containment.started"` | yes | |
| `data` | see ContainmentStarted | yes | |

## E\_egress

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"containment"` | yes | |
| `type` | one of `"egress.denied"`, `"egress.allowed_opaque"` | yes | |
| `data` | see Egress | yes | |

## E\_fs\_denied

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"containment"` | yes | |
| `type` | `"fs.denied"` | yes | |
| `data` | see FsDenied | yes | |

## E\_provider\_tool\_rejected

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"containment"` | yes | |
| `type` | `"provider_tool.rejected"` | yes | |
| `data` | see ProviderToolRejected | yes | |

## E\_end\_state

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"twin"` | yes | |
| `type` | `"end_state"` | yes | |
| `data` | see EndState | yes | |

## E\_lap\_end

| Field | Type | Required | Meaning |
| - | - | - | - |
| `actor` | `"harness"` | yes | |
| `type` | `"lap.end"` | yes | |
| `data` | see LapEnd | yes | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.