Sessions and trajectories
Watcher groups a coding agent's activity into a session. Its recorded messages form one or more trajectories. Graders review trajectories. These two terms tell you exactly what a grade covers.
Sessions
A session identifies one interaction with a coding agent. For example, a single Claude Code, Codex or GitHub Copilot CLI conversation on a developer's machine. The Watcher client's hooks upload the conversation to your Watcher deployment after tool calls and at the end of each agent turn. A session is visible in the Analyzer while it is still in progress.
Each session records:
- The messages exchanged: user prompts, assistant replies, tool calls with their results, and the system prompt.
- Which coding agent produced it, such as Claude Code, Codex or GitHub Copilot CLI. Watcher can recognize agents from native captures or retained SDK adapter IDs. Unrecognized or conflicting identities appear as Other.
- The developer it belongs to.
- The hostname of the machine it ran on, as the Watcher client reports it. The Analyzer shows it beside the developer's name on the session page. Sessions recorded without the client, such as through the Aperture gateway, usually have none.
The coding agent is separate from the model it uses. For example, a Copilot session using a Claude model is still a GitHub Copilot CLI session.
Session lists, details and new alerts use the recognized agent name. Agent filters use that same name; Other excludes recognized agents. Older sessions can gain a name when their adapter ID is still retained, even after transcript content is removed. This changes reporting only. Stored identities, ownership, recording and tool rules stay the same. Exports and alerts already delivered elsewhere are not rewritten.
A recognized name does not establish support for every monitoring feature. Check the integration's limits before relying on recording or tool blocking.
Claude Code, Codex and GitHub Copilot CLI children recorded by the Watcher client have their own sessions. The parent's transcript keeps reports returned by children, rather than their full conversations. See Subagent coverage for review context and limits on readable content.
Transcript availability
A session can exist before its transcript arrives. For example, a child can identify its parent before Watcher receives the parent's messages. Later uploads use the same session ID.
The API returns transcript_state in session lists, details
and related-session summaries:
| Value | Meaning |
|---|---|
not_recorded | No transcript has been recorded. |
recorded | Transcript content is stored. It may be incomplete. |
scrubbed | Content was removed; session identity and retained information remain. |
These states apply to all sessions, independently of parentage, access permissions
and reviews. Scrubbed sessions remain scrubbed even though historical message
counts are retained. An empty upload does not change the state. If content is
recorded after scrubbing, the state becomes recorded again.
Session capture
Sessions retain a history of the integrations that delivered them. Each integration appears once, even when a delivery adds no new messages, and this history survives content scrubbing. Older records may identify only a broad category, such as Gateway or SDK.
The Analyzer uses these capture sources for session badges and filtering. One conversation can show both the Watcher client and LiteLLM. Source metadata does not select conversation identity or grant access.
The separate sources API field describes only retained messages. Duplicate
messages keep their first stored source, so it is not a complete delivery
history. See source filters.
Session metadata
The API returns a session's metadata object from GET /v1/sessions,
GET /v1/sessions/{session_id} and session search, and the
Python SDK as the session's metadata field. Watcher
fills these keys from the messages it stores for the session. Session detail
returns metadata as null to callers without
findings access.
| Key | Meaning | Reported by | Rule |
|---|---|---|---|
hostname | The machine the session ran on | The Watcher client | First value |
entrypoint | How the coding agent was started. Claude Code reports cli for the interactive terminal, sdk-cli for claude -p, and sdk-py or sdk-ts for its Agent SDKs. Codex reports its originator, such as codex-tui for the interactive terminal or codex_exec for codex exec. | Each Claude Code transcript entry, the Codex session record | First value |
agent_version | The coding agent's release, such as 2.1.319 | Each Claude Code transcript entry, the Codex or GitHub Copilot CLI session record | Highest release |
Claude Code writes both values on every transcript entry, so a Claude Code
session's agent_version follows an upgrade in the middle of the session.
Codex and GitHub Copilot CLI report their available values once, in the
session record at the start of their transcript, and Watcher copies that record's values onto every
message of the upload.
- First value. Watcher keeps the value from the first stored message that
names one, in the order Watcher stores messages, which is upload order, not
message timestamps. A later message can fill a missing value but never
replaces one. A Claude Code session started from the Agent SDK and resumed
in the terminal keeps
sdk-pyas itsentrypoint. - Highest release. Watcher keeps the highest release any stored message
named, in semantic-versioning order:
2.10.0is above2.9.9, and a prerelease such as0.158.0-alpha.2is below0.158.0. A value with no version number ranks below every numbered release. Releases that differ only by a leadingvor by build metadata after+rank equal, and so do two values with no version number: Watcher keeps the one it stored first. Uploads arriving late or out of order cannot lower it. It follows an upgrade during the session, but after a downgrade it still shows the higher release, so it is not necessarily the release running now.
A key is absent when no stored message reported a usable value: text that is
not empty once surrounding spaces are trimmed, has only printable characters,
and is at most 255 characters for hostname or 128 for the other keys. Sessions
recorded only through a gateway hook, such as Aperture,
have no entrypoint or agent_version, and usually no hostname: Watcher
reads the gateway request's user agent to recognize the coding agent, but does
not record a launch mode or release from it. Sessions whose messages were all
stored by an earlier Watcher release also have neither key. Treat other keys
in the object as possible and ignore the ones you do not use.
A trajectory's metadata, from
GET /v1/sessions/{session_id}/trajectories/{trajectory_id}, works
differently. It is the stored metadata of the trajectory's last message only,
not combined across messages, and its keys have other names:
- For Claude Code,
claude_code_entrypointandclaude_code_entry_versioncome from the transcript entry that message came from, so they describe that message. - For Codex,
originatorandcli_version, and for GitHub Copilot CLI,cli_version, are the session record's values copied onto every message of the upload. They do not show which release wrote that particular message. - For Codex transcript files,
effortandservice_tierare the reasoning effort and service tier that Codex's log had last recorded for the thread when it wrote that message. Read them with these limits:- They are what the log records, not what the model provider applied.
- A key is absent when the log had recorded no value by then.
- An absent
service_tierdoes not mean the default tier. Some Codex releases log a tier only once a setting changes. - A subagent does not log its parent's tier, so the
messages it inherits from its parent have no
service_tier. - Codex logs
defaultafter a tier is switched off. Some releases also log it when a thread starts or its model changes with no tier set. - Messages stored by an earlier Watcher release have neither key. Messages
added to such a session afterwards can have
effortbut lackservice_tieruntil Codex next logs its settings. - Sessions recorded only through a gateway hook have neither key.
The object also holds the upload's own metadata, such as hostname. After a
resume or an upgrade, these values can differ from the session's entrypoint
and agent_version. Use the session's keys to describe the session.
Trajectories
A trajectory is one linear path through a session's conversation. It is an unbroken chain of messages, in order, ending at one of the session's latest messages. Most trajectories start at the session's first message. A restarted chain starts where the restart happened. Its trajectories do not include the messages before it.
A straightforward conversation produces a single trajectory. A session contains more than one trajectory when its message history stops being a single chain.
Reasons for multiple trajectories include:
- Branching. The developer rewinds the conversation and continues from an earlier point. Watcher keeps both branches, each as its own trajectory. They share the messages up to the branch point. When a Claude Code developer rewinds to the very first prompt, each version of that prompt starts its own trajectory, and the versions share no messages.
- Restarted chains. The agent restructures its own message history mid-session. For example, a change of system prompt, or a context compaction Watcher does not continue. This starts a new chain in the same session. Compactions in Claude Code transcripts from the Watcher client do not restart the chain: the trajectory keeps the earlier turns, then the compaction summary and the turns after it. Likewise, when a Codex conversation compacts, or an OpenCode conversation captured through Aperture does, and Watcher already holds earlier turns of the same conversation (the same Codex thread ID, or the same OpenCode session ID and system prompt), Watcher continues the existing chain. That trajectory keeps the earlier turns, then the agent's summary, a compaction notice and the turns after it. This applies to Codex transcripts from the Watcher client and to Codex traffic captured through Aperture. See Gateway hooks.
- Two recorders. The Watcher client and the Aperture gateway hook can both record the same Claude Code or Codex conversation. The client records the agent's own transcript. Aperture records the requests the agent sent to the model. Both name the conversation by the agent's own conversation ID. When both record for the same developer, Watcher stores both copies in one session, whichever recorder is first. The two copies never share a message, so the session stores separate trajectories for each recorder. Each tool call still has one recorded decision, whichever copy holds it. Reading the session shows one reconciled transcript instead: the client's copy, with each tool call only Aperture saw inserted after the last call both copies share before it, and anything Aperture recorded beyond the client's copy added at the end of the turn it belongs to, so every call appears once. The Analyzer, the API, the tool-call list, Deep Review and fresh session summaries all read that transcript, and either copy's trajectory ID opens it. While the session is active, a summary refresh continues the last Triage call instead, so it describes the copy that call read; the summary written once the session goes idle reads the reconciled transcript. Where Watcher cannot tell which part of the client's copy an Aperture branch belongs to, it keeps that branch as a trajectory of its own rather than guess: a branch that shares no tool call with the client's copy (such as a subagent's requests), one that matches more than one branch of the client's copy equally, one adding calls the reconciled transcript does not otherwise hold (a different continuation of the conversation), and one with a tool call only Aperture saw that follows a prompt the client's copy lacks or repeats, which could not be shown without dropping that prompt or guessing which turn it belongs to. Every real branch of the conversation stays separate. Any trajectory ID of either copy opens a reconciled transcript, including an ID that names a message partway through a copy (such as a link to one tool call), which opens a current reconciled transcript covering that message. That transcript may show the Watcher client's copy of the message instead, or leave out a message only the gateway recorded. The API has no option to read one copy as stored. Session counts count reconciled transcripts too. Aperture attributes its copy to the developer its login identity names. The client must record for that same developer to join it. An ingest-only key or a different signed-in user records a separate session.
- Tool-name changes. Reuploading a Codex transcript stored with bare tool names can add a trajectory when Watcher includes their tool groups in the names. The new branch shares the unchanged prefix. Messages from the first renamed tool onward can be duplicated. Existing trajectories and grades stay in place; later uploads of the same transcript do not keep adding copies.
Session matching checks the organization, owner and compatible agent platform before matching conversation IDs, aliases or transcript history. Knowing an ID does not grant access to a session.
- Signed-in users record their own sessions. A trusted gateway with
sessions:write:anycan name the developer it records for. - A key with only
sessions:ingestrecords sessions with no individual owner. These stay separate from personal sessions, even when their IDs match. sessions:write:anyalso permits writes across owners. If such a key creates a session without naming a developer, that session has no individual owner.- Uploads never change an existing owner. A personal upload cannot take over an unowned session or gain access to its earlier content.
Creating, retrying or updating a subagent link requires write access to both
sessions in the same organization. A caller with sessions:write:any may link
sessions with different owners. Linking grants no transcript access and does
not change either owner. Reads and temporary content approvals apply to each
session separately.
Sessions in other organizations are never matched.
A fork that gets its own conversation ID is not a branch. For example, Claude
Code's --fork-session copies a conversation under a new session ID. When the
fork shares no conversation ID with the original, Watcher records it as a
separate session that starts with a copy of the shared history. The original
conversation keeps its session and ID.
What a grade covers
Graders review a trajectory, not a whole session. Each grade attaches to one specific trajectory. The last message the grader saw identifies it. A session accumulates grades over time. They come from different graders, from different models, and from re-grading the same trajectory.
When a trajectory has no grade on its own message chain, the API can return a grade from elsewhere in the same session. This fallback keeps an existing grade available. It still refers to the trajectory that was graded; it is not a new review of the selected branch.
While a session runs, review happens in two ways:
- Blocking review evaluates a tool call before it runs. It can allow it, deny it, or escalate it to a human.
- Trailing review grades the session's latest trajectory on the server. This happens as the session is ingested. It settles with a final pass once the session goes quiet.
Tool-call decisions
A tool call's record separates Watcher's evaluation from what happened on the developer's machine. An evaluation includes Watcher's judgment, the policy settings used, and any grades. The outcome records the human response and whether the tool completed, was blocked, was cancelled, or has an unknown outcome, such as a call whose agent process was killed before it finished.
The current decision's ingest_kind records the delivery path of its
current evaluation: client, gateway, sdk, or other. It is null when
the path was not recorded. Unknown stored values read as other.
api_key_id identifies the API key that authenticated the current evaluation.
api_key_name is its name at evaluation time. Both are null when no API-key
identity was recorded. A replacement evaluation replaces this attribution.
An outcome-only update preserves the stored evaluation's path and key name.
These fields are available with permission to read session findings.
For example, a gateway's Watcher integration can allow a command. Then the developer can reject it in the coding agent's own permission dialog. The record keeps both facts. Watcher allowed the call, and the human rejected it. An allow judgment alone does not prove that the command ran.
| Case | What the record shows |
|---|---|
| The client reports a human rejection without evaluating the call itself | Record the supplied human rejection and execution status. Keep the gateway's evaluation and linked grades. |
| The human rejection arrives before the gateway evaluation | Add the evaluation when it arrives and keep the reported human and execution outcomes. |
| The client repeats an outcome or omits an outcome it already reported | Repeated values leave the record unchanged. Missing human fields or a pending execution status do not erase known outcomes. |
| The gateway's evaluation failed or produced only some grades | An outcome-only client report still preserves that evaluation and its available evidence. |
| The client performs its own evaluation | Its upload can replace the stored evaluation. A grading failure counts as an evaluation attempt too. |
Observe mode records a judgment without applying it. A later hook observation can fill a missing judgment. It can also improve a failed evaluation that applied no action. It preserves completed judgments and decisions Watcher already applied.
The same tool-call ID can occur on multiple trajectories within a session. Each trajectory containing that ID shows the shared decision and its linked grades. A trajectory without the call does not show its record, unless a gateway names the call as withheld in favor of a message on that trajectory.
Prefer one monitoring integration per conversation. A gateway integration and the Watcher client might both evaluate a call. They may repeat grading. Watcher keeps one current decision per tool call in each session. A gateway that sends no Claude Code or Codex conversation ID can record the conversation as a separate session. Each session then keeps its own decision and grades. Linked grades can come from different attempts. Watcher does not keep a separate decision history for each integration. Conflicting human outcomes use upload arrival order. A late upload can replace a newer human response.
Counting messages
Session lists show a session's message count. This is the length of its longest trajectory, not the total number of stored messages. A heavily branched session holds more messages than its count shows.