Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(provider): push the recap on the turn's own stream, and page a context's history

0xken15523140432394
diff --git a/provider/example-provider/README.md b/provider/example-provider/README.md
index ab7c7abf2..37e676688 100644
--- a/provider/example-provider/README.md
+++ b/provider/example-provider/README.md
@@ -69,12 +69,29 @@ The user's message is passed **verbatim** — no wrapper text, no prepended hint
nothing. A pleasant side effect: **a turn typed straight into a terminal shows up in the session list
too** — it just does not stream live, since this app implements no `SubscribeToTask`.
+`GetTask` returns one TURN, which is not what a client opening a chat wants: a conversation is many
+turns, and a long one should arrive a page at a time. That is `autonomous.GetContextHistory`
+(`context-history`, HP-304) — a whole context, newest window first, `before` walking backwards. It
+reads the transcript whole rather than per-task, so nothing can fall into the gap between two turns'
+time windows, and a window's left edge is snapped back to a real user prompt so a page can never begin
+between a tool call and its result.
+
**One mapper, two callers.** `src/mapper.ts` is the only place Claude's shape becomes A2A. Stdout
events and JSONL lines carry the same Anthropic message shape, so writing two parsers is the reliable
way to make the live view and the post-refresh view disagree.
-**Recaps are generated per TURN**, after the stream closes, by a disposable one-shot `claude --print`
-(`src/recap.ts`). Three details are load-bearing:
+**Recaps are generated per TURN**, on the turn's own stream and just before its terminal event, by a
+disposable one-shot `claude --print` (`src/recap.ts`). The turn therefore stays open while the summary
+is written — deliberately, and announced: a `recap_start` part goes out before the wait and a
+`recap_end` after it (HP-212), so the client can say "preparing a recap" instead of showing a stall.
+
+The alternative — close the stream, summarise afterwards, let the client pull it with
+`autonomous.GetRecap` — is what this used to do, and it cannot work: that method is scoped to an AGENT
+and takes no task id, so a client asking the instant a turn ends gets either nothing or the PREVIOUS
+turn's headline. The recap is still persisted as well, because a device restoring its tiles after a
+reboot has no stream to read.
+
+Four details are load-bearing:
- **No `--resume`.** The summariser must never touch the live session, or the summary lands in the
transcript and the next turn's history contains a summary of the previous one.
@@ -86,9 +103,12 @@ way to make the live view and the post-refresh view disagree.
ellipsis: the tile renders on a small round display, where a line advertising its own truncation
reads worse than one that simply ends.
-A failed or cancelled turn gets no recap. If the one-shot fails, times out, or `RECAP_DISABLED=1`,
-the turn's own opening sentence is excerpted instead — a recap is a nicety and must never be able to
-retroactively fail a turn that succeeded.
+- **A `recap_start` is always followed by a `recap_end`**, even when there is nothing to say — the end
+ then carries no headline. An indicator that is opened and never closed is worse than one never shown.
+
+A failed or cancelled turn gets no recap, and no start/end pair either. If the one-shot fails, times
+out, or `RECAP_DISABLED=1`, the turn's own opening sentence is excerpted instead — a recap is a nicety
+and must never be able to retroactively fail a turn that succeeded.
## What it does not do
diff --git a/provider/example-provider/src/agentCard.ts b/provider/example-provider/src/agentCard.ts
index bc1911d45..4c05acd58 100644
--- a/provider/example-provider/src/agentCard.ts
+++ b/provider/example-provider/src/agentCard.ts
@@ -11,6 +11,7 @@ export const EXT = {
WORKSPACE_FILES: 'https://harness.autonomous.ai/api/a2a/ext/workspace-files',
WORKSPACE_WRITE: 'https://harness.autonomous.ai/api/a2a/ext/workspace-write',
SESSION_RECAP: 'https://harness.autonomous.ai/api/a2a/ext/session-recap',
+ CONTEXT_HISTORY: 'https://harness.autonomous.ai/api/a2a/ext/context-history',
VOICE: 'https://harness.autonomous.ai/api/a2a/ext/voice',
} as const
@@ -50,6 +51,7 @@ export function buildAgentCard(agents: AgentEntry[]): Record<string, unknown> {
extensions: [
{ uri: EXT.WORKSPACE_FILES, description: 'Browse and read files in the agent working directory.' },
{ uri: EXT.SESSION_RECAP, description: 'Recent turn summaries, from Claude transcripts.' },
+ { uri: EXT.CONTEXT_HISTORY, description: 'A whole conversation in one call, paged newest-first.' },
{
uri: EXT.WORKSPACE_WRITE,
description: 'Create and remove agents. Each one is a directory under the workspace root.',
diff --git a/provider/example-provider/src/mapper.ts b/provider/example-provider/src/mapper.ts
index f91210267..07849fe76 100644
--- a/provider/example-provider/src/mapper.ts
+++ b/provider/example-provider/src/mapper.ts
@@ -32,11 +32,22 @@ export interface AnthropicMessage {
content?: unknown
}
-const meta = (kind: NonNullable<PartMetadata['autonomous.ai/kind']>, extra: PartMetadata = {}): PartMetadata => ({
+export const meta = (kind: NonNullable<PartMetadata['autonomous.ai/kind']>, extra: PartMetadata = {}): PartMetadata => ({
'autonomous.ai/kind': kind,
...extra,
})
+/**
+ * Does this message BEGIN a turn?
+ *
+ * A real user prompt carries a `user_message` part. A `user`-role message carrying only tool results
+ * does NOT — it is the middle of an assistant's turn, wearing the user role because that is how the
+ * Anthropic format returns tool output. HP-304 snaps a history window back to one of these so a page
+ * can never start between a `tool_start` and its `tool_end`.
+ */
+export const isTurnStart = (parts: Part[]): boolean =>
+ parts.some((p) => p.metadata?.['autonomous.ai/kind'] === 'user_message')
+
/** Tool results arrive as a string or as an array of text blocks; normalise to one string. */
export function toolResultText(content: unknown): string {
if (typeof content === 'string') return content
diff --git a/provider/example-provider/src/server.spec.ts b/provider/example-provider/src/server.spec.ts
new file mode 100644
index 000000000..1869c3701
--- /dev/null
+++ b/provider/example-provider/src/server.spec.ts
@@ -0,0 +1,286 @@
+/**
+ * The wire, end to end: a real HTTP server, a fake `claude`, and a transcript on disk.
+ *
+ * Two things are pinned here that nothing else can pin:
+ * - **HP-212** — the recap rides the turn's OWN stream, immediately before the terminal event. Its
+ * position is the whole point: a recap that arrives after the stream closes cannot say which turn
+ * it belongs to.
+ * - **HP-304** — paging a context. The windows are asserted with exact indices, because the
+ * turn-snapping rule (a page may be LONGER than `limit`) is easy to "fix" into a plain slice and
+ * only a concrete expectation notices.
+ */
+import { afterAll, beforeAll, describe, expect, it } from 'vitest'
+import { chmodSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import type { AddressInfo } from 'node:net'
+import { createProviderServer } from './server.js'
+import { projectDir } from './jsonl.js'
+import type { Config } from './config.js'
+import type { Message, Part } from './types.js'
+
+const ROOT = join(tmpdir(), `example-provider-spec-${process.pid}`)
+const AGENT_CWD = join(ROOT, 'agent')
+const PROJECTS = join(ROOT, 'projects')
+const CLAUDE_SESSION = 'sess-1'
+
+/** A `claude` that prints the given stream-json lines and exits. */
+function fakeClaude(name: string, lines: unknown[]): string {
+ const path = join(ROOT, name)
+ const body = lines.map((l) => `echo '${JSON.stringify(l)}'`).join('\n')
+ // `cat > /dev/null` drains the stdin the provider writes the user's message to; without it the
+ // script can exit before the write lands and node raises EPIPE.
+ writeFileSync(path, `#!/bin/sh\ncat > /dev/null\n${body}\n`)
+ chmodSync(path, 0o755)
+ return path
+}
+
+const textLine = (text: string): unknown => ({
+ type: 'stream_event',
+ session_id: CLAUDE_SESSION,
+ event: { type: 'content_block_delta', delta: { type: 'text_delta', text } },
+})
+const resultLine = (failed = false): unknown => ({
+ type: 'result',
+ session_id: CLAUDE_SESSION,
+ ...(failed ? { is_error: true, result: 'boom' } : { subtype: 'success', result: 'ok' }),
+})
+
+function config(claudeBin: string): Config {
+ return {
+ agents: [{ id: 'scratch', name: 'Scratch', description: 'test agent', cwd: AGENT_CWD }],
+ workspaceRoot: ROOT,
+ agentsFile: join(ROOT, 'agents.json'),
+ claudeBin,
+ model: 'test-model',
+ port: 0,
+ stateFile: join(ROOT, `state-${Math.random().toString(36).slice(2)}.json`),
+ claudeProjectsDir: PROJECTS,
+ recapModel: 'test-recap',
+ // The recap one-shot would spawn a second `claude`. Disabled, `summariseTurn` excerpts the turn
+ // instead — same code path into the stream, no model.
+ recapDisabled: true,
+ }
+}
+
+interface SseEvent {
+ taskId?: string
+ contextId?: string
+ status?: { state?: string; message?: Message }
+ final?: boolean
+}
+
+/** Boot, run one request against it, shut down. Port 0 so tests never collide. */
+async function withServer<T>(claudeBin: string, fn: (port: number, deps: ReturnType<typeof createProviderServer>['deps']) => Promise<T>): Promise<T> {
+ const { server, deps } = createProviderServer(config(claudeBin))
+ await new Promise<void>((r) => server.listen(0, '127.0.0.1', r))
+ const { port } = server.address() as AddressInfo
+ try {
+ return await fn(port, deps)
+ } finally {
+ await new Promise<void>((r) => server.close(() => r()))
+ }
+}
+
+async function rpc<T = Record<string, unknown>>(port: number, method: string, params: unknown): Promise<T> {
+ const res = await fetch(`http://127.0.0.1:${port}/`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', 'x-api-key': 'test-key' },
+ body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),
+ })
+ const body = (await res.json()) as { result?: T; error?: unknown }
+ if (body.error) throw new Error(`rpc ${method} failed: ${JSON.stringify(body.error)}`)
+ return body.result as T
+}
+
+/** Run a turn and collect every SSE event, in order. */
+async function runTurn(port: number, text: string, contextId?: string): Promise<SseEvent[]> {
+ const res = await fetch(`http://127.0.0.1:${port}/`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', 'x-api-key': 'test-key' },
+ body: JSON.stringify({
+ jsonrpc: '2.0',
+ id: 1,
+ method: 'SendStreamingMessage',
+ params: { message: { role: 'ROLE_USER', messageId: 'm1', parts: [{ text }], ...(contextId ? { contextId } : {}) } },
+ }),
+ })
+ const raw = await res.text()
+ return raw
+ .split('\n\n')
+ .map((frame) => frame.split('\n').find((l) => l.startsWith('data:')))
+ .filter((l): l is string => !!l)
+ .map((l) => JSON.parse(l.slice(5).trim()) as SseEvent)
+}
+
+const kindsOf = (ev: SseEvent): string[] =>
+ (ev.status?.message?.parts ?? []).map((p: Part) => p.metadata?.['autonomous.ai/kind'] ?? '')
+
+beforeAll(() => {
+ mkdirSync(AGENT_CWD, { recursive: true })
+ mkdirSync(PROJECTS, { recursive: true })
+})
+afterAll(() => rmSync(ROOT, { recursive: true, force: true }))
+
+describe('SendStreamingMessage — the recap rides the stream (HP-212)', () => {
+ it('brackets the wait with recap_start/recap_end, then ends terminal', async () => {
+ const bin = fakeClaude('claude-ok.sh', [textLine('Acme is at 118% of pacing. Nothing else changed.'), resultLine()])
+ const events = await withServer(bin, (port) => runTurn(port, 'how is acme pacing?'))
+
+ // The order IS the contract: start announces a wait the client cannot otherwise see, end closes
+ // it, and the terminal event comes last so HP-102 still reads a terminal state at the tail.
+ const kinds = events.flatMap(kindsOf)
+ expect(kinds.filter((k) => k === 'recap_start')).toHaveLength(1)
+ expect(kinds.filter((k) => k === 'recap_end')).toHaveLength(1)
+ expect(events.findIndex((e) => kindsOf(e).includes('recap_start'))).toBe(events.length - 3)
+ expect(events.findIndex((e) => kindsOf(e).includes('recap_end'))).toBe(events.length - 2)
+
+ const last = events.at(-1)!
+ expect(last.status?.state).toBe('TASK_STATE_COMPLETED')
+ expect(last.final).toBe(true)
+
+ const end = events.at(-2)!
+ expect(end.status?.state).toBe('TASK_STATE_WORKING') // must not end the turn twice
+ const part = end.status!.message!.parts[0]!
+ expect(part.metadata?.['autonomous.ai/recap']).toBe('Acme is at 118% of pacing.')
+ expect(part.text).toContain('Nothing else changed.')
+ })
+
+ it('gives a FAILED turn neither half — a headline would read like an accomplishment', async () => {
+ const bin = fakeClaude('claude-fail.sh', [textLine('Started, then hit an error.'), resultLine(true)])
+ const events = await withServer(bin, (port) => runTurn(port, 'do the thing'))
+
+ const kinds = events.flatMap(kindsOf)
+ expect(kinds).not.toContain('recap_start')
+ expect(kinds).not.toContain('recap_end')
+ expect(events.at(-1)?.status?.state).toBe('TASK_STATE_FAILED')
+ expect(events.at(-1)?.final).toBe(true)
+ })
+
+ it('closes the indicator even when a silent turn produces no headline', async () => {
+ const bin = fakeClaude('claude-silent.sh', [resultLine()])
+ const events = await withServer(bin, (port) => runTurn(port, 'be quiet'))
+
+ // A `recap_start` without its `recap_end` leaves the client spinning forever, so the end must be
+ // there — carrying no headline, which is how it says "nothing to show".
+ const kinds = events.flatMap(kindsOf)
+ expect(kinds).toContain('recap_start')
+ expect(kinds).toContain('recap_end')
+ expect(events.at(-2)!.status!.message!.parts[0]!.metadata?.['autonomous.ai/recap']).toBeUndefined()
+ expect(events.at(-1)?.status?.state).toBe('TASK_STATE_COMPLETED')
+ })
+
+ it('still persists the recap, so GetRecap keeps working for a device with no stream', async () => {
+ const bin = fakeClaude('claude-persist.sh', [textLine('Shipped the pacing alert. Details follow.'), resultLine()])
+ const entries = await withServer(bin, async (port) => {
+ await runTurn(port, 'ship it')
+ const out = await rpc<{ entries: Array<{ recap: string; taskId?: string }> }>(port, 'autonomous.GetRecap', { agentId: 'scratch', n: 2 })
+ return out.entries
+ })
+ expect(entries).toHaveLength(1)
+ expect(entries[0]!.recap).toBe('Shipped the pacing alert.')
+ // The pull carries the taskId, which is what lets a client tell THIS turn's recap from the last one.
+ expect(entries[0]!.taskId).toBeTruthy()
+ })
+})
+
+describe('autonomous.GetContextHistory — a whole context, paged (HP-304)', () => {
+ const CONTEXT = 'ctx-history'
+ const TURNS = 6 // → 12 messages: user, assistant, user, assistant, …
+
+ /** A transcript of `TURNS` complete turns, written where the provider looks for it. */
+ function writeTranscript(): void {
+ const dir = projectDir(PROJECTS, AGENT_CWD)
+ mkdirSync(dir, { recursive: true })
+ const lines: string[] = []
+ for (let t = 0; t < TURNS; t++) {
+ lines.push(JSON.stringify({
+ type: 'user', uuid: `u${t}`, sessionId: CLAUDE_SESSION,
+ timestamp: new Date(1_700_000_000_000 + t * 2000).toISOString(),
+ message: { role: 'user', content: [{ type: 'text', text: `question ${t}` }] },
+ }))
+ lines.push(JSON.stringify({
+ type: 'assistant', uuid: `a${t}`, sessionId: CLAUDE_SESSION,
+ timestamp: new Date(1_700_000_000_000 + t * 2000 + 1000).toISOString(),
+ message: { role: 'assistant', content: [{ type: 'text', text: `answer ${t}` }] },
+ }))
+ }
+ writeFileSync(join(dir, `${CLAUDE_SESSION}.jsonl`), `${lines.join('\n')}\n`)
+ }
+
+ /** A server whose store already knows this context — no turn needs to run. */
+ async function withHistory<T>(fn: (port: number) => Promise<T>): Promise<T> {
+ writeTranscript()
+ return withServer(fakeClaude('claude-unused.sh', [resultLine()]), async (port, deps) => {
+ deps.store.ensureContext(CONTEXT, 'scratch')
+ deps.store.setClaudeSession(CONTEXT, CLAUDE_SESSION)
+ return fn(port)
+ })
+ }
+
+ interface HistoryResult {
+ contextId: string
+ messages: Message[]
+ hasMore?: boolean
+ oldestCursor?: string | null
+ staleCursor?: boolean
+ }
+
+ it('returns the WHOLE context — many turns, not the one GetTask would give', async () => {
+ const out = await withHistory((port) => rpc<HistoryResult>(port, 'autonomous.GetContextHistory', { contextId: CONTEXT }))
+ expect(out.messages).toHaveLength(TURNS * 2)
+ expect(out.messages[0]!.messageId).toBe('u0')
+ expect(out.messages.at(-1)!.messageId).toBe('a5')
+ // No `limit` asked → the paging fields must be ABSENT, not false. Their absence is how a client
+ // tells a complete answer from a windowed one.
+ expect('hasMore' in out).toBe(false)
+ expect('oldestCursor' in out).toBe(false)
+ })
+
+ it('windows to the NEWEST messages and snaps the edge back to a turn start', async () => {
+ const out = await withHistory((port) =>
+ rpc<HistoryResult>(port, 'autonomous.GetContextHistory', { contextId: CONTEXT, limit: 3 }))
+ // limit 3 lands mid-turn at index 9 (an assistant reply); snapping back to index 8 makes the
+ // window 4 long. Longer than asked, and deliberately so — see HP-304.
+ expect(out.messages.map((m) => m.messageId)).toEqual(['u4', 'a4', 'u5', 'a5'])
+ expect(out.hasMore).toBe(true)
+ expect(out.oldestCursor).toBe('u4')
+ })
+
+ it('pages older with `before`, without overlapping the page already held', async () => {
+ const out = await withHistory((port) =>
+ rpc<HistoryResult>(port, 'autonomous.GetContextHistory', { contextId: CONTEXT, limit: 3, before: 'u4' }))
+ expect(out.messages.map((m) => m.messageId)).toEqual(['u2', 'a2', 'u3', 'a3'])
+ expect(out.hasMore).toBe(true)
+ expect(out.oldestCursor).toBe('u2')
+ })
+
+ it('reports no further pages once the oldest turn is in the window', async () => {
+ const out = await withHistory((port) =>
+ rpc<HistoryResult>(port, 'autonomous.GetContextHistory', { contextId: CONTEXT, limit: 3, before: 'u2' }))
+ expect(out.messages.map((m) => m.messageId)).toEqual(['u0', 'a0', 'u1', 'a1'])
+ expect(out.hasMore).toBe(false)
+ expect(out.oldestCursor).toBe('u0')
+ })
+
+ it('flags a cursor that is no longer in the transcript instead of erroring', async () => {
+ const out = await withHistory((port) =>
+ rpc<HistoryResult>(port, 'autonomous.GetContextHistory', { contextId: CONTEXT, limit: 3, before: 'compacted-away' }))
+ expect(out.staleCursor).toBe(true)
+ expect(out.messages).toEqual([])
+ expect(out.hasMore).toBe(false)
+ expect(out.oldestCursor).toBeNull()
+ })
+
+ it('clamps an absurd limit rather than trusting the caller', async () => {
+ const out = await withHistory((port) =>
+ rpc<HistoryResult>(port, 'autonomous.GetContextHistory', { contextId: CONTEXT, limit: 10_000 }))
+ expect(out.messages).toHaveLength(TURNS * 2)
+ expect(out.hasMore).toBe(false)
+ })
+
+ it('refuses an unknown context rather than guessing one', async () => {
+ await expect(withHistory((port) =>
+ rpc(port, 'autonomous.GetContextHistory', { contextId: 'ctx-nope' }))).rejects.toThrow(/-32602|Invalid params/)
+ })
+})
diff --git a/provider/example-provider/src/server.ts b/provider/example-provider/src/server.ts
index 624c0bd89..49f0d407c 100644
--- a/provider/example-provider/src/server.ts
+++ b/provider/example-provider/src/server.ts
@@ -14,9 +14,9 @@ import { buildAgentCard, EXT } from './agentCard.js'
import { runTurn } from './claude.js'
import { loadConfig, type AgentEntry, type Config } from './config.js'
import { createAgent, deleteAgent, renameAgent, WorkspaceError } from './workspace.js'
-import { epoch, readTranscript, sliceByTime } from './jsonl.js'
+import { epoch, readTranscript, sliceByTime, type TranscriptLine } from './jsonl.js'
import { summariseTurn } from './recap.js'
-import { messageToParts, pairToolNames, sessionIdOf, streamLineToOutcome } from './mapper.js'
+import { isTurnStart, messageToParts, meta, pairToolNames, sessionIdOf, streamLineToOutcome } from './mapper.js'
import { SessionStore, type TaskRecord } from './sessions.js'
import {
isTerminal,
@@ -102,6 +102,7 @@ async function handle(req: IncomingMessage, res: ServerResponse, deps: Deps): Pr
case 'autonomous.ListFiles': return listFiles(res, deps, params, id)
case 'autonomous.ReadFile': return readFile(res, deps, params, id)
case 'autonomous.GetRecap': return getRecap(res, deps, params, id)
+ case 'autonomous.GetContextHistory': return getContextHistory(res, deps, params, id)
// `workspace-write` — agents only; the card declares params.sessions: false.
case 'autonomous.CreateAgent':
@@ -264,6 +265,15 @@ async function sendStreamingMessage(res: ServerResponse, deps: Deps, params: Rec
}
deps.store.finishTask(taskId, finalState)
+
+ // HP-212 — summarise BEFORE the terminal event, on the stream that is still open, so the recap is
+ // unambiguously THIS turn's. The turn therefore stays open for as long as the one-shot takes.
+ // That cost buys correctness the pull cannot give: `autonomous.GetRecap` is scoped to an AGENT and
+ // takes no task id, so a client asking the instant a turn ends either gets nothing (this turn is
+ // not summarised yet) or the PREVIOUS turn's headline. Only a turn that actually completed gets
+ // one — summarising a failure produces a headline that reads like an accomplishment.
+ if (finalState === TaskState.COMPLETED) await recapTurn(deps, res, taskId, contextId, agent, collected)
+
writeSse(res, {
taskId,
contextId,
@@ -271,23 +281,46 @@ async function sendStreamingMessage(res: ServerResponse, deps: Deps, params: Rec
final: true,
})
if (!res.destroyed) res.end()
-
- // HP-302 — summarise the turn AFTER closing the stream. Not awaited: the turn is over, and holding
- // the SSE response open for a summary would make every turn look slower than it was.
- // Only a turn that actually completed: summarising a failure produces a headline that reads like
- // an accomplishment.
- if (finalState === TaskState.COMPLETED) void recapTurn(deps, taskId, agent, collected)
}
-/** Summarise one finished turn and persist it on the task, for `autonomous.GetRecap` to serve. */
-async function recapTurn(deps: Deps, taskId: string, agent: AgentEntry, parts: Part[]): Promise<void> {
+/**
+ * Summarise one finished turn: push it on the still-open stream (HP-212) AND persist it on the task
+ * (HP-302).
+ *
+ * Both, not either. The stream serves the client watching this turn; the persisted copy serves a
+ * device restoring its tiles after a reboot, which has no stream to read.
+ */
+async function recapTurn(
+ deps: Deps,
+ res: ServerResponse,
+ taskId: string,
+ contextId: string,
+ agent: AgentEntry,
+ parts: Part[],
+): Promise<void> {
// The assistant's own words only — thinking and tool output are not what the turn accomplished.
const turnText = parts
.filter((p) => p.metadata?.['autonomous.ai/kind'] === 'text_delta')
.map((p) => p.text ?? '')
.join('')
+
+ // Non-terminal on purpose, both of them: the terminal event is still to come, and HP-102 is
+ // satisfied by the LAST event. Emitting either as terminal would end the turn twice.
+ const emit = (part: Part): void => {
+ writeSse(res, {
+ taskId,
+ contextId,
+ status: { state: TaskState.WORKING, message: agentMessage(taskId, contextId, [part]) },
+ })
+ }
+
+ // Announced BEFORE the wait, not after it: summarising is seconds of real time during which the
+ // turn has stopped speaking, and without this the client has nothing to show for it.
+ emit({ text: '', metadata: meta('recap_start') })
+
+ let recap: Awaited<ReturnType<typeof summariseTurn>> = null
try {
- const recap = await summariseTurn({
+ recap = await summariseTurn({
claudeBin: deps.config.claudeBin,
cwd: agent.cwd,
turnText,
@@ -296,9 +329,16 @@ async function recapTurn(deps: Deps, taskId: string, agent: AgentEntry, parts: P
})
if (recap) deps.store.setRecap(taskId, recap.recap, recap.body)
} catch (err) {
- // A recap is a nicety. It must never be able to retroactively fail a turn that succeeded.
+ // A recap is a nicety. It must never be able to retroactively fail a turn that succeeded, so the
+ // terminal event goes out either way — the caller emits it after this returns.
console.warn(`[example-provider] recap failed for ${taskId}:`, err instanceof Error ? err.message : String(err))
}
+
+ // ALWAYS, even with nothing to say (HP-212). A `recap_start` with no `recap_end` leaves the client
+ // spinning on an indicator that will never close — worse than never having opened one.
+ emit(recap
+ ? { text: recap.body, metadata: meta('recap_end', { 'autonomous.ai/recap': recap.recap }) }
+ : { text: '', metadata: meta('recap_end') })
}
// ── History (HP-200 … HP-202) ────────────────────────────────────────────────────────────────────
@@ -326,9 +366,37 @@ function listTasks(res: ServerResponse, deps: Deps, params: Record<string, unkno
sendRpcResult(res, id, { tasks })
}
+/**
+ * Transcript lines → A2A Messages.
+ *
+ * Tool names are paired across the WHOLE run rather than inside one line: a `tool_result` lands on a
+ * different transcript line than its `tool_use`, so pairing line by line leaves every `tool_end`
+ * anonymous. Lines that map to nothing renderable (an image block, a bare stop) are dropped.
+ */
+function linesToMessages(lines: TranscriptLine[], contextId: string, taskId?: string): Message[] {
+ const perLine = lines.map((line) => messageToParts(line.message))
+ const paired = pairToolNames(perLine.flat())
+ const out: Message[] = []
+ let cut = 0
+ for (const [index, parts] of perLine.entries()) {
+ const mine = paired.slice(cut, cut + parts.length)
+ cut += parts.length
+ if (!mine.length) continue
+ const line = lines[index]!
+ out.push({
+ role: line.type === 'user' ? 'ROLE_USER' : 'ROLE_AGENT',
+ messageId: line.uuid ?? '',
+ ...(taskId ? { taskId } : {}),
+ contextId,
+ parts: mine,
+ })
+ }
+ return out
+}
+
function taskToWire(deps: Deps, record: TaskRecord, opts: { history?: boolean } = {}): Record<string, unknown> {
const withHistory = opts.history !== false
- let history: unknown[] = []
+ let history: Message[] = []
if (withHistory) {
const context = deps.store.context(record.contextId)
const agent = agentById(deps, record.agentId)
@@ -338,13 +406,7 @@ function taskToWire(deps: Deps, record: TaskRecord, opts: { history?: boolean }
record.startedAt - 5_000, // Claude timestamps the line slightly before we record the task
record.endedAt ? record.endedAt + 5_000 : undefined,
)
- history = lines.map((line) => ({
- role: line.type === 'user' ? 'ROLE_USER' : 'ROLE_AGENT',
- messageId: line.uuid ?? '',
- taskId: record.taskId,
- contextId: record.contextId,
- parts: pairToolNames(messageToParts(line.message)),
- })).filter((m) => (m.parts as Part[]).length > 0)
+ history = linesToMessages(lines, record.contextId, record.taskId)
}
}
return {
@@ -352,7 +414,15 @@ function taskToWire(deps: Deps, record: TaskRecord, opts: { history?: boolean }
contextId: record.contextId,
status: { state: record.state },
history,
- metadata: { title: record.title, agentId: record.agentId },
+ // `startedAt`/`endedAt` so a client can order and date a session from real events. Without them
+ // it can only stamp "now" on every row, which sorts a session list at random (HP-220: omit
+ // rather than invent — a task still running genuinely has no end).
+ metadata: {
+ title: record.title,
+ agentId: record.agentId,
+ startedAt: new Date(record.startedAt).toISOString(),
+ ...(record.endedAt ? { endedAt: new Date(record.endedAt).toISOString() } : {}),
+ },
}
}
@@ -486,6 +556,83 @@ function getRecap(res: ServerResponse, deps: Deps, params: Record<string, unknow
sendRpcResult(res, id, { agentId: agent.id, entries })
}
+// ── Extension: context-history (HP-304) ──────────────────────────────────────────────────────────
+
+/** The window ceiling. The client asks for 60; this only stops a caller asking for the moon. */
+const MAX_HISTORY_LIMIT = 500
+
+/**
+ * A whole context's transcript, optionally windowed.
+ *
+ * Why this exists next to `GetTask`: a task is one TURN, but a client opening a chat wants the
+ * CONTEXT, which is many turns. Reading the transcript whole also removes the per-task time-window
+ * slicing, so nothing can fall into a gap between two turns' windows.
+ */
+function getContextHistory(res: ServerResponse, deps: Deps, params: Record<string, unknown>, id: string | number | null): void {
+ const contextId = typeof params.contextId === 'string' ? params.contextId : ''
+ const context = contextId ? deps.store.context(contextId) : undefined
+ const agent = context ? agentById(deps, context.agentId) : undefined
+ if (!context || !agent) {
+ sendRpcError(res, id, RpcErrors.INVALID_PARAMS)
+ return
+ }
+
+ // No claude session id yet = a context nobody has spoken in. Empty is the correct answer.
+ const all = linesToMessages(
+ context.claudeSessionId ? readTranscript(deps.config.claudeProjectsDir, agent.cwd, context.claudeSessionId) : [],
+ contextId,
+ )
+
+ // No `limit` = the complete transcript, and then NONE of the paging fields are emitted: their
+ // absence is exactly how the client tells a windowed answer from a whole one.
+ const raw = params.limit
+ const limit = typeof raw === 'number' && raw > 0 ? Math.min(Math.floor(raw), MAX_HISTORY_LIMIT) : undefined
+ if (!limit) {
+ sendRpcResult(res, id, { contextId, messages: all })
+ return
+ }
+
+ let end = all.length
+ const before = typeof params.before === 'string' && params.before ? params.before : undefined
+ if (before) {
+ const at = all.findIndex((m) => m.messageId === before)
+ if (at < 0) {
+ // The cursor is no longer in the transcript — a compaction moved it out from under the client
+ // between requests. Say so instead of erroring or quietly answering a different window: the
+ // client's recovery is a full reload, and it can only do that if it is told.
+ sendRpcResult(res, id, { contextId, messages: [], hasMore: false, oldestCursor: null, staleCursor: true })
+ return
+ }
+ end = at // exclusive — the client already holds this one
+ }
+
+ const start = snapToTurnStart(all, Math.max(0, end - limit))
+ const oldestCursor = all[start]?.messageId || null
+ sendRpcResult(res, id, {
+ contextId,
+ messages: all.slice(start, end),
+ // A page we cannot name a cursor for is a page the client could never ask for; promising one
+ // would loop it on the same window forever. Claude always writes a uuid, so this is a guard
+ // rather than a case.
+ hasMore: start > 0 && !!oldestCursor,
+ oldestCursor,
+ })
+}
+
+/**
+ * Walk the window's left edge back to the message that STARTS a turn.
+ *
+ * Without this a page can begin between a `tool_start` and its `tool_end`, and the client renders a
+ * result with no call above it. The cost is that a window may come back longer than `limit` — which
+ * is why HP-304 calls `limit` a floor rather than a count.
+ */
+function snapToTurnStart(messages: Message[], from: number): number {
+ for (let i = from; i > 0; i--) {
+ if (isTurnStart(messages[i]!.parts)) return i
+ }
+ return 0
+}
+
// ── Wire helpers ─────────────────────────────────────────────────────────────────────────────────
function agentMessage(taskId: string, contextId: string, parts: Part[]): Message {
diff --git a/provider/example-provider/src/types.ts b/provider/example-provider/src/types.ts
index 26e8f6ff9..5067f9d4b 100644
--- a/provider/example-provider/src/types.ts
+++ b/provider/example-provider/src/types.ts
@@ -40,6 +40,8 @@ export interface PartMetadata {
| 'tool_end'
| 'context_compact'
| 'done'
+ | 'recap_start'
+ | 'recap_end'
'autonomous.ai/thinkingId'?: string
'autonomous.ai/toolCallId'?: string
'autonomous.ai/parentToolCallId'?: string
@@ -49,6 +51,11 @@ export interface PartMetadata {
'autonomous.ai/summary'?: string
'autonomous.ai/durationSeconds'?: number
'autonomous.ai/title'?: string
+ /**
+ * `recap_end` only (HP-212): the headline. The Part's own `text` carries the fuller body.
+ * ABSENT on a `recap_end` means the turn produced no recap — the phase is over, show nothing.
+ */
+ 'autonomous.ai/recap'?: string
'autonomous.ai/compacted'?: {
userMessages?: number
assistantMessages?: number
diff --git a/provider/reference-provider/src/conformance.ts b/provider/reference-provider/src/conformance.ts
index 66769b5e2..1e33e347c 100644
--- a/provider/reference-provider/src/conformance.ts
+++ b/provider/reference-provider/src/conformance.ts
@@ -62,7 +62,7 @@ const firstSkillId = (ctx: Ctx): string | undefined =>
const KNOWN_KINDS = [
'user_message', 'thinking_delta', 'thinking_title', 'text_delta',
- 'tool_start', 'tool_end', 'context_compact', 'done',
+ 'tool_start', 'tool_end', 'context_compact', 'done', 'recap_start', 'recap_end',
]
const TERMINAL = ['TASK_STATE_COMPLETED', 'TASK_STATE_FAILED', 'TASK_STATE_CANCELED', 'TASK_STATE_REJECTED']
diff --git a/provider/reference-provider/src/types.ts b/provider/reference-provider/src/types.ts
index 26e8f6ff9..5067f9d4b 100644
--- a/provider/reference-provider/src/types.ts
+++ b/provider/reference-provider/src/types.ts
@@ -40,6 +40,8 @@ export interface PartMetadata {
| 'tool_end'
| 'context_compact'
| 'done'
+ | 'recap_start'
+ | 'recap_end'
'autonomous.ai/thinkingId'?: string
'autonomous.ai/toolCallId'?: string
'autonomous.ai/parentToolCallId'?: string
@@ -49,6 +51,11 @@ export interface PartMetadata {
'autonomous.ai/summary'?: string
'autonomous.ai/durationSeconds'?: number
'autonomous.ai/title'?: string
+ /**
+ * `recap_end` only (HP-212): the headline. The Part's own `text` carries the fuller body.
+ * ABSENT on a `recap_end` means the turn produced no recap — the phase is over, show nothing.
+ */
+ 'autonomous.ai/recap'?: string
'autonomous.ai/compacted'?: {
userMessages?: number
assistantMessages?: number
diff --git a/provider/spec/README.md b/provider/spec/README.md
index c61d3119b..4747293fe 100644
--- a/provider/spec/README.md
+++ b/provider/spec/README.md
@@ -154,8 +154,9 @@ than recommended: without them, a page refresh loses the conversation.
> **HP-201** The provider MUST implement `GetTask`, returning the full message history of the task.
> This backs the transcript view.
-> **HP-202** For v1 the provider MUST return the complete transcript in a single `GetTask` response.
-> Pagination is **not** part of this revision — see §10.1.
+> **HP-202** The provider MUST return the complete transcript in a single `GetTask` response.
+> `GetTask` itself is never paged; a provider that wants windowing declares `context-history`
+> (HP-304), which pages a whole context rather than a turn. See §10.1.
> **HP-203** A transcript exceeding **5 MB** serialized MAY be truncated by the provider, which MUST
> then mark the response so the client can tell the user the view is partial. Silent truncation is a
@@ -187,10 +188,39 @@ this contract does not inherit an internal shape:
| `tool_end` | a tool invocation finished (with output, error flag, summary) |
| `context_compact` | the provider compacted its own context |
| `done` | the turn's final result text |
+| `recap_start` | the turn is being summarised (HP-212) |
+| `recap_end` | the summary, or its absence — the recap phase is over (HP-212) |
Turn lifecycle (`turn_started` / `turn_ended`) is **not** metadata — it is derived from A2A task
states, per HP-102.
+> **HP-212** A provider MAY deliver the turn's recap in-stream, as a **pair** of parts on non-terminal
+> status events emitted after the turn's output and **before** the terminal event:
+>
+> - `recap_start` — summarising has begun. Carries no content; it exists so the client can show a
+> "preparing a recap" indicator and hold its busy state open for a wait it cannot otherwise see.
+> - `recap_end` — the phase is over. The headline travels in `autonomous.ai/recap` (≤ 200 chars) and
+> the fuller body as the Part's own `text`, meaning exactly what `recapEntry.recap` and
+> `recapEntry.body` mean in HP-302. **`autonomous.ai/recap` absent means no recap was produced** —
+> a turn that said nothing, or a summariser that failed. The client then clears its indicator and
+> paints nothing.
+>
+> A provider that emits `recap_start` MUST emit a matching `recap_end` before the terminal event, even
+> when there is no recap: an indicator that is opened and never closed is worse than no indicator.
+> A client that receives a `recap_end` MUST prefer it over `autonomous.GetRecap`, because it is
+> unambiguously **this** turn's recap.
+>
+> The problem this solves: `autonomous.GetRecap` is scoped to an AGENT and takes no task id, so a
+> client asking for "the latest recap" the moment a turn ends can only guess — and if the provider
+> has not finished summarising yet, the newest entry it holds is the PREVIOUS turn's. Pushing the
+> recap on the turn's own stream removes the guess. The cost is honest and bounded: the terminal event
+> waits for the summary, so the turn stays open for as long as summarising takes — which is precisely
+> what `recap_start` lets the client explain to the user. A provider that would rather close the turn
+> immediately simply emits neither kind and keeps HP-302 alone.
+>
+> This does NOT replace HP-302: a device restoring its tiles after a reboot has no stream to read, so
+> a provider that pushes SHOULD also persist.
+
Schema: `schema/part-metadata.json`.
---
@@ -205,6 +235,7 @@ entirely when an extension is absent, rather than offering a control that fails.
| `https://harness.autonomous.ai/api/a2a/ext/workspace-files` | browse and read files in an agent |
| `https://harness.autonomous.ai/api/a2a/ext/workspace-write` | create / rename / delete agents and sessions |
| `https://harness.autonomous.ai/api/a2a/ext/session-recap` | short persisted per-turn summaries (used by the device) |
+| `https://harness.autonomous.ai/api/a2a/ext/context-history` | a whole context's transcript in one call, optionally windowed |
| `https://harness.autonomous.ai/api/a2a/ext/voice` | provider-side routing of a spoken task to an agent |
### 8.1 Method naming
@@ -246,6 +277,21 @@ Extension methods travel on the **same JSON-RPC endpoint** as A2A core — there
> A `agentId` of `null` declines and hands routing back to Autonomous.
> Schema: `schema/ext-voice.json`.
+> **HP-304** `context-history` — one context's transcript in a single call, optionally windowed.
+> Method: **`autonomous.GetContextHistory`** (`{ contextId, limit?, before? }` →
+> `{ contextId, messages, hasMore?, oldestCursor?, staleCursor?, truncated? }`).
+> `GetTask` (HP-201) returns one TURN, but a client opening a chat wants the whole CONTEXT — without
+> this it must call `ListTasks` then `GetTask` once per turn, each at full size. `limit` absent means
+> the complete transcript, and the provider MUST then omit the three paging fields entirely; that
+> absence is how a client tells a windowed response from a whole one. Paging runs backwards only:
+> `before` is a `messageId` the client already holds (exclusive), taken from the previous response's
+> `oldestCursor`. `messages` is ALWAYS oldest-first so a page can be prepended as received. A window's
+> start MUST be snapped back to a turn boundary so it never splits a tool call from its result — which
+> is why a window may be LONGER than `limit`, and why `limit` is a floor rather than a count. A
+> `before` that is no longer in the transcript MUST answer `staleCursor: true` with empty `messages`
+> rather than an error, so the client can reload instead of showing a broken chat.
+> Schema: `schema/ext-context-history.json`.
+
---
## 9. Out of scope
@@ -278,11 +324,16 @@ have to guess. **Most are synthesised by the Autonomous backend — the provider
### 10.1 Transcript pagination
The Autonomous client can request a windowed transcript (a limit plus a cursor). A2A `GetTask` has no
-equivalent.
+equivalent — and it is scoped to one TURN besides, while the client is opening a whole CONTEXT.
-**Resolution for v1:** the provider returns the full transcript (HP-202); the backend serves windowed
-requests from that response and reports no further pages. A paging extension is deferred until a real
-provider hits the 5 MB ceiling of HP-203. Recorded as a known limitation, not an oversight.
+**Resolution:** the `context-history` extension (HP-304). It takes `{ contextId, limit?, before? }`
+and answers `{ messages, hasMore?, oldestCursor?, staleCursor? }` — deliberately the same field names
+the Autonomous client already sends and reads, so nothing has to be translated in the middle.
+
+A provider that does not declare it is still fully conformant: HP-202 stands unchanged, and a client
+falls back to `ListTasks` + `GetTask` per turn at full size. What that fallback cannot do is page —
+so a long conversation arrives whole or not at all, which is exactly what the 5 MB ceiling of HP-203
+was there to bound.
### 10.2 `engine`
@@ -395,7 +446,7 @@ gap in the spec.** Re-run this audit whenever the client gains an operation.
| `new_chat` | Tier 0 — no call; mint a fresh `contextId` (§2) |
| `agents_list` | Tier 0 — `AgentCard.skills` (HP-023) |
| `sessions_list` | Tier 0 — `ListTasks` (HP-200) |
-| `session_get` | Tier 0 — `GetTask` (HP-201) |
+| `session_get` | Tier 0 — `GetTask` (HP-201); whole-context and paged via `context-history` (HP-304) when declared |
| `agent_files` | Extension — `workspace-files` (HP-300) |
| `agent_read_file` | Extension — `workspace-files` (HP-300) |
| `agent_create` | Extension — `workspace-write` (HP-301) |
@@ -421,10 +472,15 @@ unresolved gap, not an implicit "no" — if you find one, say so rather than gue
### Event-kind coverage
-The eight kinds in §7 (`user_message`, `thinking_delta`, `thinking_title`, `text_delta`, `tool_start`,
-`tool_end`, `context_compact`, `done`) cover the client's full render vocabulary. Turn lifecycle
-(`turn_started` / `turn_ended`) is carried by A2A task states per HP-102 and is deliberately not a
-metadata kind. Nothing in the client's vocabulary is unrepresented.
+The ten kinds in §7 (`user_message`, `thinking_delta`, `thinking_title`, `text_delta`, `tool_start`,
+`tool_end`, `context_compact`, `done`, `recap_start`, `recap_end`) cover the client's full render
+vocabulary. Turn lifecycle (`turn_started` / `turn_ended`) is carried by A2A task states per HP-102 and
+is deliberately not a metadata kind. Nothing in the client's vocabulary is unrepresented.
+
+`recap_start` / `recap_end` are the two kinds that are not raw turn output: they are the summary OF the
+turn. They exist as kinds because the alternative — asking for it afterwards with
+`autonomous.GetRecap` — cannot say WHICH turn it wants, and because the wait between them is real time
+the user is watching (HP-212).
---
diff --git a/provider/spec/schema/ext-context-history.json b/provider/spec/schema/ext-context-history.json
new file mode 100644
index 000000000..9c1a450b4
--- /dev/null
+++ b/provider/spec/schema/ext-context-history.json
@@ -0,0 +1,81 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://harness.autonomous.ai/api/a2a/ext/context-history",
+ "title": "Extension: context-history",
+ "description": "A whole conversation's transcript, in one call and optionally windowed (HP-304). `GetTask` returns one TURN; a client opening a chat wants the CONTEXT, which is many turns, and for a long one it wants only the newest slice. Without this extension a client must fall back to HP-201/HP-202 and pull every turn separately at full size. Each $defs entry carries its own examples.",
+ "type": "object",
+ "$defs": {
+ "historyRequest": {
+ "type": "object",
+ "required": ["contextId"],
+ "properties": {
+ "contextId": {
+ "type": "string",
+ "description": "The A2A context — the id the CLIENT minted, never the provider's own internal session id."
+ },
+ "limit": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 500,
+ "description": "Window size. ABSENT means the complete transcript, and the provider then MUST omit hasMore/oldestCursor/staleCursor entirely — that absence is what tells the client this response is not windowed. A window may come back LONGER than `limit`: see oldestCursor."
+ },
+ "before": {
+ "type": "string",
+ "description": "A `messageId` — the oldest message the client already holds, taken from a previous response's `oldestCursor`. The window returned ends immediately BEFORE it (exclusive), so pages never overlap. Paging is backwards-only; there is no `after` (live turns arrive on the stream instead). Honoured only together with `limit`."
+ }
+ },
+ "examples": [
+ { "contextId": "ctx-91af", "limit": 60 },
+ { "contextId": "ctx-91af", "limit": 60, "before": "b3f2c1d0-5a44-4e1b-9c77-2f0a1e6d8b31" },
+ { "contextId": "ctx-91af" }
+ ]
+ },
+ "historyResponse": {
+ "type": "object",
+ "required": ["contextId", "messages"],
+ "properties": {
+ "contextId": { "type": "string" },
+ "messages": {
+ "type": "array",
+ "description": "Standard A2A Messages, ALWAYS oldest-first, so a client prepends a page exactly as received. An empty array is a legitimate answer for a context that has not spoken yet.",
+ "items": { "type": "object" }
+ },
+ "hasMore": {
+ "type": "boolean",
+ "description": "Older messages exist before this window. Omitted when the request carried no `limit`."
+ },
+ "oldestCursor": {
+ "type": ["string", "null"],
+ "description": "The `messageId` of the window's FIRST message — pass it back as `before` to page older. Null when nothing older remains. Because the window start is snapped back to a real turn boundary (so a window never splits a tool call from its result), the returned window MAY contain more messages than `limit` asked for; `limit` is a floor, not an exact count."
+ },
+ "staleCursor": {
+ "type": "boolean",
+ "description": "The `before` cursor is no longer in the transcript — typically a compaction moved it out from under the client. The provider MUST then answer with empty `messages`, `hasMore: false` and `oldestCursor: null` rather than an error, and the client reloads the context from the newest page. Omitted when false."
+ },
+ "truncated": {
+ "type": "boolean",
+ "description": "Content was dropped to stay under the HP-203 size ceiling. Silent truncation is a violation (HP-203), so this MUST be set whenever anything was cut."
+ }
+ },
+ "examples": [
+ {
+ "contextId": "ctx-91af",
+ "messages": [
+ { "role": "ROLE_USER", "messageId": "b3f2c1d0-5a44-4e1b-9c77-2f0a1e6d8b31", "parts": [{ "text": "How is Acme pacing?" }] },
+ { "role": "ROLE_AGENT", "messageId": "7c1e9a22-08d3-4f5a-bb90-1d6e4c2f7a55", "parts": [{ "text": "Acme is at 118% of pacing.", "metadata": { "autonomous.ai/kind": "text_delta" } }] }
+ ],
+ "hasMore": true,
+ "oldestCursor": "b3f2c1d0-5a44-4e1b-9c77-2f0a1e6d8b31"
+ },
+ {
+ "contextId": "ctx-91af",
+ "messages": [],
+ "hasMore": false,
+ "oldestCursor": null,
+ "staleCursor": true
+ },
+ { "contextId": "ctx-91af", "messages": [] }
+ ]
+ }
+ }
+}
diff --git a/provider/spec/schema/part-metadata.json b/provider/spec/schema/part-metadata.json
index c3e799936..200f12519 100644
--- a/provider/spec/schema/part-metadata.json
+++ b/provider/spec/schema/part-metadata.json
@@ -14,7 +14,9 @@
"tool_start",
"tool_end",
"context_compact",
- "done"
+ "done",
+ "recap_start",
+ "recap_end"
]
},
"autonomous.ai/thinkingId": {
@@ -53,6 +55,11 @@
"type": "string",
"description": "thinking_title only."
},
+ "autonomous.ai/recap": {
+ "type": "string",
+ "maxLength": 200,
+ "description": "recap_end only (HP-212): the headline of what the turn ACCOMPLISHED, rendered on one line of a small round display. The fuller body travels as the Part's own text. Same 200-character ceiling as recapEntry.recap in ext-session-recap.json — the two carry the same value by different routes. ABSENT on a recap_end means the turn produced no recap: the phase is over and the client clears its indicator without painting a card."
+ },
"autonomous.ai/compacted": {
"type": "object",
"description": "context_compact only. All counts optional — omit rather than guess (HP-220). The human-readable explanation travels as the Part's own text.",
@@ -106,6 +113,9 @@
"autonomous.ai/durationSeconds": 1.4
},
{ "autonomous.ai/kind": "done" },
+ { "autonomous.ai/kind": "recap_start" },
+ { "autonomous.ai/kind": "recap_end", "autonomous.ai/recap": "Flagged Acme overspend at 118% of pacing" },
+ { "autonomous.ai/kind": "recap_end" },
{
"autonomous.ai/kind": "context_compact",
"autonomous.ai/compacted": { "userMessages": 12, "assistantMessages": 12, "toolUses": 41 }