get_thread_context
Packs thread messages, edits, references, FSM history, and workspace glossary into agent prompts with as-of replay, token caps, and delta updates.
Instructions
Pack thread messages, edits, references, FSM history, and the workspace glossary for agent prompts. Edits are lean by default (id/editor/timestamp only); pass include_edits=true for full before/after bodies. The glossary (canonical term definitions) is included by default when non-empty; pass include_glossary=false to drop it. Pass as_of=<event_id> to replay the thread as it stood at that event-log id (deterministic over the immutable log; audit / re-ask from before a tangent). Pass token_budget= to cap the message page by estimated tokens: the opening message and the recent tail are kept, the middle is folded into an auditable elision marker in fixed blocks. The result is two text parts: the stable prefix (workspace boot, brief, messages) and the volatile tail (state, lease, cursors, prefix sha256). Those strings are the bytes REST returns with split=true.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"thread_id": "<thread_id>"
},
"name": "get_thread_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | No | Event-log id: reconstruct the thread as it stood at that point (as-of replay). Omit for the live pack. | |
| delta | No | Return a delta instead of the whole pack. The first content part is always the delta head (delta, prefix_unchanged, prefix_sha256, prefix_bytes), never empty; the second is the volatile tail. When since_prefix_sha matches the current prefix, the head has prefix_unchanged true and no messages or prefix. With message_cursor, the head adds the messages after that cursor when appending them rebuilds the prefix; otherwise it carries the replacement prefix. | |
| max_bytes | No | Cap the canonical pack by bytes. Elision grows by fixed message blocks until the pack fits or only the opener and newest message remain. | |
| thread_id | Yes | ||
| token_budget | No | Cap the message page by estimated tokens (chars/4): keep the opening message and the recent tail, fold the middle into an auditable 'elision' marker. Omit to cap by rows only. | |
| include_edits | No | Include full body_before/body_after on each edit (heavy); default returns edit metadata only. | |
| message_limit | No | ||
| message_cursor | No | Page messages after this id. With delta, it is also the delta cursor. | |
| include_glossary | No | Include the workspace glossary (grounding); omitted when empty. Set false for a token-tight pack. | |
| since_prefix_sha | No | Hex sha256 of a prefix the caller already holds. Requests a delta on its own. | |
| transition_limit | No | ||
| include_parent_grounding | No | For a child thread, attach parent grounding (the parent's opening ask + latest decision) so a fresh claimer knows why the thread exists. Absent for root threads / cross-channel / DM parents. Set false for the leanest pack. | |
| include_accepted_decisions | No | Attach in-channel accepted/closed decisions (token-lean teasers) so a fresh claimer sees what the channel already decided. Waiter envelopes appear only when status is reviewed; result_kind is a namespaced string (e.g. example.review.result/1), not a closed enum. Withheld on DM channels. Set false for the leanest pack. |