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.

Deliver shared coding memory through native OpenCode prompts (#579)

Dee922c9dc9c63a
diff --git a/cli/scripts/memory-native-opencode-recall-probe.mjs b/cli/scripts/memory-native-opencode-recall-probe.mjs
new file mode 100644
index 000000000..96e98de3d
--- /dev/null
+++ b/cli/scripts/memory-native-opencode-recall-probe.mjs
@@ -0,0 +1,224 @@
+// Native hook research: OpenCode 1.18.34, disposable HOME/database and localhost model only.
+// This records the outgoing request and native storage; it does not grade semantic memory use.
+import assert from 'node:assert/strict'
+import { execFileSync, spawn } from 'node:child_process'
+import { createServer } from 'node:http'
+import { mkdtemp, mkdir, realpath, rm, writeFile } from 'node:fs/promises'
+import { tmpdir } from 'node:os'
+import { dirname, join } from 'node:path'
+import { fileURLToPath, pathToFileURL } from 'node:url'
+import { DatabaseSync } from 'node:sqlite'
+import { build } from 'esbuild'
+
+const directory = await realpath(await mkdtemp(join(tmpdir(), 'memory-opencode-recall-')))
+const workspace = join(directory, 'work'), database = join(directory, 'native.db')
+const marker = 'harness-memory-transport-619f9e'
+const correctedMarker = 'harness-memory-corrected-883bb0'
+const requests = [], observations = []
+const owner = 'synthetic-owner', access = { profileId: owner, projectIds: [], includeProfile: true }
+let native, nativeUrl, stdout = '', stderr = '', allowedSession, phase = 'on', runtime, store, requestAgent
+let report
+let overflowSent = false
+const server = createServer(async (request, response) => {
+ const chunks = []
+ for await (const chunk of request) chunks.push(chunk)
+ const body = JSON.parse(Buffer.concat(chunks))
+ if (request.url === '/fixture/observe') {
+ observations.push(body)
+ if (body.hook === 'chat.params') requestAgent = body.agent
+ response.writeHead(200, { 'content-type': 'application/json' }).end('{}'); return
+ }
+ if (request.url?.startsWith('/api/hook/')) {
+ // The HTTP shim supplies the fixture's known process/session binding; production hook-server
+ // authentication/ancestry is covered separately, not claimed by this transport probe.
+ assert.equal(body.callerPid, native.pid)
+ assert.equal(request.headers['x-harness-hook-token'], 'synthetic-hook-token')
+ if (body.sessionId !== allowedSession) { response.writeHead(403).end(); return }
+ if (phase === 'unavailable') { response.writeHead(503).end(); return }
+ let result
+ if (request.url.endsWith('/memory-emitted')) {
+ result = { recorded: await runtime.promptRecallEmitted('fixture-agent', body.memoryReceiptId) }
+ } else {
+ const prepared = await runtime.preparePromptRecall('fixture-agent', { query: body.prompt },
+ { engine: body.engine, cliVersion: body.cliVersion })
+ result = { additionalContext: prepared.packet.text, memoryReceiptId: prepared.receipt?.id }
+ }
+ response.writeHead(200, { 'content-type': 'application/json' }).end(JSON.stringify(result)); return
+ }
+ const matching = (body.messages ?? []).filter(message => JSON.stringify(message).includes(marker))
+ requests.push({ phase, agent: requestAgent, model: body.model, roles: matching.map(message => message.role),
+ markers: JSON.stringify(body).split(marker).length - 1,
+ correctedMarkers: JSON.stringify(body).split(correctedMarker).length - 1,
+ hasCurrentRequest: JSON.stringify(body).includes('Synthetic parser review') })
+ response.writeHead(200, { 'content-type': 'text/event-stream' })
+ const overflow = phase === 'auto-prime' && !overflowSent
+ if (overflow) overflowSent = true
+ const base = { id: 'chatcmpl_fixture', object: 'chat.completion.chunk', created: 1, model: body.model }
+ for (const [delta, finish_reason] of [[{ role: 'assistant', content: 'Ready.' }, null], [{}, 'stop']]) {
+ response.write('data: ' + JSON.stringify({ ...base, choices: [{ index: 0, delta, finish_reason }],
+ ...(finish_reason ? { usage: { prompt_tokens: overflow ? 127000 : 100, completion_tokens: 2, total_tokens: overflow ? 127002 : 102 } } : {}) }) + '\n\n')
+ }
+ response.end('data: [DONE]\n\n')
+})
+
+try {
+ await new Promise((resolve, reject) => { server.once('error', reject); server.listen(0, '127.0.0.1', resolve) })
+ for (const name of ['home', 'config', 'data', 'cache', 'state', 'work']) await mkdir(join(directory, name), { mode: 0o700 })
+ execFileSync('git', ['init', '-q', workspace])
+ const url = `http://127.0.0.1:${server.address().port}`
+ const cli = dirname(dirname(fileURLToPath(import.meta.url))), bundle = join(directory, 'probe.mjs')
+ await build({ stdin: { contents: [
+ `export { opencodeRecallPluginSource } from ${JSON.stringify(join(cli, 'src/lib/opencodeRecallPlugin.ts'))};`,
+ `export { CodingMemoryStore } from ${JSON.stringify(join(cli, 'src/memory/store.ts'))};`,
+ `export { CodingMemoryRuntime } from ${JSON.stringify(join(cli, 'src/memory/runtime.ts'))};`,
+ `export { QUEUE_OPERATIONS } from ${JSON.stringify(join(cli, 'src/memory/operations.ts'))};`,
+ ].join('\n'), resolveDir: cli }, outfile: bundle, bundle: true, platform: 'node', format: 'esm', target: 'node22',
+ banner: { js: "import { createRequire as createFixtureRequire } from 'node:module'; const require = createFixtureRequire(import.meta.url);" } })
+ const { opencodeRecallPluginSource, CodingMemoryStore, CodingMemoryRuntime, QUEUE_OPERATIONS } = await import(pathToFileURL(bundle).href)
+ runtime = new CodingMemoryRuntime({ directory: join(directory, 'memory'),
+ context: () => ({ experimental: true, watching: true, profileId: owner }),
+ sessions: () => allowedSession ? [{ agentId: 'fixture-agent', engine: 'opencode', sessionId: allowedSession,
+ workspace, transcriptPath: database, scope: 'profile', busy: false, coding: true }] : [],
+ inference: { target: async () => ({ state: 'waiting' }), run: async () => { throw new Error('No model extraction in transport probe') } },
+ create: profileId => {
+ const opened = CodingMemoryStore.open({ directory: join(directory, 'memory'), profileId })
+ assert.ok(opened.ok); store = opened.store
+ return { request: async (operation, args) => (QUEUE_OPERATIONS.includes(operation) ? store.learning : store)[operation](...args),
+ close: async () => store.close() }
+ },
+ })
+ const plugin = join(directory, 'recall.mjs')
+ await writeFile(plugin, `const hookToken = () => 'synthetic-hook-token';
+ export const Fixture = async ({client}) => {
+ ${opencodeRecallPluginSource(server.address().port)}
+ const post = async (route, body) => {
+ const response = await fetch(${JSON.stringify(url)} + route, { method: 'POST', signal: AbortSignal.timeout(400),
+ headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) })
+ return response.ok ? response.json() : null
+ }
+ return {
+ 'chat.message': async (input, output) => {
+ await recallMessage(input, output)
+ await post('/fixture/observe', { hook: 'chat.message', input, message: output.message,
+ parts: output.parts.map(part => ({ ...part, text: part.text ? '[synthetic prompt]' : undefined })) })
+ },
+ 'experimental.session.compacting': async (input) => {
+ await recallCompacting(input)
+ await post('/fixture/observe', { hook: 'compacting', input })
+ },
+ 'experimental.compaction.autocontinue': async (input) => {
+ await recallAutoContinue(input)
+ await post('/fixture/observe', { hook: 'autocontinue', input: { sessionID: input.sessionID,
+ agent: input.agent, message: input.message, overflow: input.overflow } })
+ },
+ 'chat.params': async (input) => { await post('/fixture/observe', { hook: 'chat.params', agent: input.agent, sessionID: input.sessionID }) },
+ 'experimental.chat.messages.transform': async (_input, output) => {
+ try {
+ await post('/fixture/observe', { hook: 'messages.transform', messages: output.messages.map(item => ({
+ info: item.info, parts: item.parts.map(part => ({ id: part.id, type: part.type, synthetic: part.synthetic,
+ metadata: part.metadata, auto: part.auto, overflow: part.overflow })) })) })
+ await recallTransform(_input, output)
+ } catch { /* Optional recall cannot fail the native request. */ }
+ },
+ }
+ }`, { mode: 0o600 })
+ const config = { autoupdate: false, share: 'disabled', snapshot: false, permission: { '*': 'deny' },
+ plugin: [pathToFileURL(plugin).href], mcp: {}, instructions: [], enabled_providers: ['fixture'],
+ model: 'fixture/model', small_model: 'fixture/model', compaction: { auto: true, prune: false },
+ agent: { memory_fixture: { mode: 'primary', description: 'Synthetic recall fixture',
+ prompt: 'Answer briefly without tools.', permission: { '*': 'deny' }, steps: 1 } },
+ provider: { fixture: { npm: '@ai-sdk/openai-compatible', options: { apiKey: 'synthetic', baseURL: url + '/v1' },
+ models: { model: { name: 'Synthetic', limit: { context: 128000, output: 4096 } } } } } }
+ native = spawn(process.env.OPENCODE_PATH || 'opencode', ['serve', '--hostname', '127.0.0.1', '--port', '0'], {
+ cwd: workspace, detached: true, stdio: ['ignore', 'pipe', 'pipe'], env: { PATH: process.env.PATH, TMUX_PANE: '%424242',
+ HOME: join(directory, 'home'), TMPDIR: directory, XDG_CONFIG_HOME: join(directory, 'config'),
+ XDG_DATA_HOME: join(directory, 'data'), XDG_CACHE_HOME: join(directory, 'cache'), XDG_STATE_HOME: join(directory, 'state'),
+ OPENCODE_DB: database, OPENCODE_CONFIG_CONTENT: JSON.stringify(config), OPENCODE_AUTH_CONTENT: '{}',
+ OPENCODE_DISABLE_PROJECT_CONFIG: '1', OPENCODE_DISABLE_AUTOUPDATE: '1', OPENCODE_DISABLE_MODELS_FETCH: '1',
+ TERM: 'dumb' },
+ })
+ native.stdout.on('data', chunk => { stdout = (stdout + chunk).slice(-5000); nativeUrl = stdout.match(/http:\/\/127\.0\.0\.1:\d+/)?.[0] })
+ native.stderr.on('data', chunk => { stderr = (stderr + chunk).slice(-5000) })
+ const deadline = Date.now() + 10000
+ while (!nativeUrl && native.exitCode === null && Date.now() < deadline) await new Promise(resolve => setTimeout(resolve, 50))
+ assert.ok(nativeUrl, `Native server did not start: ${stderr}`)
+ const call = async (route, body) => {
+ const response = await fetch(nativeUrl + route, { method: body === undefined ? 'GET' : 'POST',
+ headers: { 'content-type': 'application/json', 'x-opencode-directory': workspace },
+ signal: AbortSignal.timeout(25000), ...(body === undefined ? {} : { body: JSON.stringify(body) }) })
+ assert.ok(response.ok, `${route}: ${response.status}`)
+ return response.json()
+ }
+ assert.equal((await call('/global/health')).version, '1.18.34')
+ allowedSession = (await call('/session', { title: 'Synthetic recall source' })).id
+ await runtime.tick()
+ const claim = `For parser reviews, start with a small failing example. ${marker}`
+ store.ingest({ id: 'synthetic-claude-source', profileId: owner, projectId: null, engine: 'claude', sessionId: 'synthetic-claude',
+ nativeEventId: 'synthetic-statement', role: 'user', eligibility: 'coding', observedAt: Date.now(),
+ rootIds: ['synthetic-claude-source'], text: claim })
+ const draft = { kind: 'working_preference', facet: 'debugging', assertionType: 'stated_preference', scope: { profileId: owner },
+ claim, rationale: null, futureAction: 'For parser reviews, start with a small failing example.', applicability: {}, exceptions: [], retrievalCues: ['parser', 'review'],
+ evidenceClass: 'user_stated', evidence: [{ sourceEventId: 'synthetic-claude-source', quote: claim,
+ paths: ['/claim', '/futureAction', '/applicability'] }], conflictKey: 'parser-review',
+ validity: { validFrom: null, validUntil: null, recheckWhen: [] } }
+ const record = store.propose(draft, access).record
+ await runtime.configure({ learn: false, recall: true })
+ const send = id => call(`/session/${id}/message`, { agent: 'memory_fixture', model: { providerID: 'fixture', modelID: 'model' },
+ parts: [{ type: 'text', text: 'Synthetic parser review. Respond briefly without tools.' }] })
+ await send(allowedSession)
+ assert.ok(requests.some(request => request.phase === 'on' && request.markers === 1 && request.roles[0] === 'user' && request.hasCurrentRequest))
+ const db = new DatabaseSync(database, { readOnly: true })
+ try {
+ const persisted = db.prepare('SELECT COUNT(*) AS n FROM part WHERE instr(data,?)>0').get(marker).n
+ assert.equal(persisted, 0, 'Ephemeral recall must not become native user evidence')
+ phase = 'off'; await runtime.configure({ learn: false, recall: false }); await send(allowedSession)
+ await runtime.configure({ learn: false, recall: true })
+ phase = 'source-private'; store.setSessionIncluded('claude', 'synthetic-claude', false); await send(allowedSession)
+ store.setSessionIncluded('claude', 'synthetic-claude', true)
+ phase = 'unavailable'; await send(allowedSession)
+ phase = 'other-session'; await send((await call('/session', { title: 'Unrelated synthetic session' })).id)
+ for (const name of ['off', 'source-private', 'unavailable', 'other-session']) {
+ const sent = requests.filter(request => request.phase === name && request.hasCurrentRequest)
+ assert.ok(sent.length > 0); assert.ok(sent.every(request => request.markers === 0))
+ }
+ phase = 'compaction'
+ await call(`/session/${allowedSession}/summarize`, { providerID: 'fixture', modelID: 'model' })
+ assert.ok(requests.filter(request => request.phase === 'compaction').every(request => request.markers === 0))
+ phase = 'auto-prime'; await send(allowedSession)
+ phase = 'auto-compact'; await send(allowedSession)
+ const automatic = requests.filter(request => request.phase === 'auto-prime')
+ assert.equal(automatic.filter(request => request.agent === 'compaction').length, 1)
+ assert.ok(automatic.filter(request => request.agent === 'compaction').every(request => request.markers === 0))
+ assert.equal(automatic.filter(request => request.agent === 'memory_fixture' && request.markers === 1).length, 2)
+ const { evidence: _evidence, evidenceClass: _class, ...correction } = draft
+ const corrected = store.correctFromUser(record.id, record.revision, { ...correction,
+ claim: `For parser reviews, first confirm the failing example. ${correctedMarker}`,
+ futureAction: 'For parser reviews, first confirm the failing example.' }, access)
+ phase = 'corrected'; await send(allowedSession)
+ assert.ok(requests.filter(request => request.phase === 'corrected').every(request => request.markers === 0 && request.correctedMarkers === 1))
+ store.forget(record.id, corrected.revision, access)
+ phase = 'forgotten'; await send(allowedSession)
+ assert.ok(requests.filter(request => request.phase === 'forgotten').every(request => request.markers === 0 && request.correctedMarkers === 0))
+ assert.equal(db.prepare('SELECT COUNT(*) AS n FROM part WHERE instr(data,?)>0').get(marker).n, 0)
+ assert.equal(db.prepare('SELECT COUNT(*) AS n FROM part WHERE instr(data,?)>0').get(correctedMarker).n, 0)
+ report = { version: '1.18.34', requests, result: { nativeModelRequestReceivedContext: true,
+ persistedMemoryParts: persisted, offReceivedContext: false, unavailableBlockedPrompt: false,
+ otherSessionReceivedContext: false, compactionReceivedContext: false, automaticContinuationReceivedContext: true,
+ correctedReceivedLatestRevision: true, forgottenReceivedContext: false, sourcePrivacyRespected: true,
+ sourceEngine: 'claude', receivingEngine: 'opencode', learnOffRecallOn: true },
+ limitations: ['Synthetic seeded Claude evidence/proposal; no real model extraction or semantic usefulness measurement.',
+ 'Production plugin and shared runtime/store; fixture HTTP/process binding, not production ancestry resolution.',
+ 'No interactive TUI, overflow replay or provider matrix certification.'] }
+ console.log(JSON.stringify(report, null, 2))
+ } finally { db.close() }
+} finally {
+ if (process.env.MEMORY_RECALL_RECORDING) await writeFile(process.env.MEMORY_RECALL_RECORDING,
+ JSON.stringify({ ...report, requests, observations }, null, 2).replaceAll(directory, '/fixture') + '\n', { mode: 0o600 })
+ if (native?.exitCode === null && native?.signalCode === null) {
+ try { process.kill(-native.pid, 'SIGKILL') } catch { native.kill('SIGKILL') }
+ await new Promise(resolve => native.once('close', resolve))
+ }
+ await runtime?.close()
+ server.closeAllConnections(); await new Promise(resolve => server.close(resolve))
+ await rm(directory, { recursive: true, force: true })
+}
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 23a5b81b6..91b7e3c87 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -4178,6 +4178,11 @@ async function runForeground(session: AuthSession | null): Promise<void> {
...(recalled?.receipt ? { memoryReceiptId: recalled.receipt.id } : {}) }
},
onMemoryContextEmitted: async (agentId, receiptId) => await codingMemory?.promptRecallEmitted(agentId, receiptId) ?? false,
+ onMemoryContext: async (agentId, prompt, adapter) => {
+ const recalled = await codingMemory?.preparePromptRecall(agentId, { query: prompt }, adapter)
+ return recalled?.packet.text ? { additionalContext: recalled.packet.text,
+ ...(recalled.receipt ? { memoryReceiptId: recalled.receipt.id } : {}) } : null
+ },
onOpenCodeMemoryRuntime: (agent, input) => {
if (!agent.processIdentity) return { observe: false }
const result = openCodeMemoryBinding?.receive({ agentId: agent.agentId, sessionId: agent.sessionId,
diff --git a/cli/src/hookServer.spec.ts b/cli/src/hookServer.spec.ts
index bfacf4886..f99b54a48 100644
--- a/cli/src/hookServer.spec.ts
+++ b/cli/src/hookServer.spec.ts
@@ -63,6 +63,61 @@ async function start(overrides: Partial<HookServerHandlers> = {}) {
}
describe('process-owned hook server', () => {
+ it.each(['claude', 'codex', 'opencode'] as const)('serves shared memory only to the live bound %s adapter', async engine => {
+ const entry = { engine, agentId: 'coding-agent', sessionId: 'native',
+ processIdentity: { pid: 42, executable: engine, startMarker: 'same-process' } } as RegisteredSession
+ const resolveHookAgent = vi.fn(async () => entry as RegisteredSession | null)
+ const onMemoryContext = vi.fn(() => ({ additionalContext: 'Historical coding context',
+ memoryReceiptId: '77777777-7777-4777-8777-777777777777' }))
+ const registration = vi.spyOn(registry, 'register')
+ try {
+ const { base, headers } = await start({ resolveHookAgent, onMemoryContext })
+ const body = { engine, sessionId: 'native', callerPid: 42, tmuxPane: '%41', cliVersion: 'test-version', prompt: 'Review parser\nchanges.' }
+ const submit = (value: unknown = body, authenticated = true) => fetch(`${base}/api/hook/memory-context`, {
+ method: 'POST', headers: authenticated ? headers : {}, body: JSON.stringify(value) })
+ expect((await submit(body, false)).status).toBe(401)
+ expect((await submit({ ...body, sessionId: 'other-session' })).status).toBe(403)
+ for (const changes of [{ callerPid: undefined }, { cliVersion: undefined }, { prompt: ' ' },
+ { prompt: 'x'.repeat(4001) }, { projectId: 'caller-selected' }, { engine: 'terminal' }]) {
+ expect((await submit({ ...body, ...changes })).status).toBe(400)
+ }
+ expect(onMemoryContext).not.toHaveBeenCalled()
+ expect(await (await submit()).json()).toEqual({ ok: true, additionalContext: 'Historical coding context',
+ memoryReceiptId: '77777777-7777-4777-8777-777777777777' })
+ expect(onMemoryContext).toHaveBeenCalledExactlyOnceWith('coding-agent', 'Review parser\nchanges.', { engine, cliVersion: 'test-version' })
+ expect(registration).not.toHaveBeenCalled()
+ resolveHookAgent.mockResolvedValue(null)
+ expect((await submit()).status).toBe(403)
+ } finally { registration.mockRestore() }
+ })
+
+ it('never falls back to pane-only ownership for memory reads or OpenCode acknowledgements', async () => {
+ const onMemoryContext = vi.fn(), onMemoryContextEmitted = vi.fn(async () => true)
+ const lookup = vi.spyOn(registry, 'byPaneEngine').mockReturnValue({ engine: 'opencode', sessionId: 'native' } as RegisteredSession)
+ try {
+ const { base, headers } = await start({ onMemoryContext, onMemoryContextEmitted })
+ const body = { engine: 'opencode', sessionId: 'native', callerPid: 42, tmuxPane: '%41', cliVersion: '1.18.34', prompt: 'Review parser.' }
+ for (const route of ['memory-context', 'memory-emitted']) {
+ const response = await fetch(`${base}/api/hook/${route}`, { method: 'POST', headers,
+ body: JSON.stringify({ ...body, memoryReceiptId: '77777777-7777-4777-8777-777777777777' }) })
+ expect(response.status).toBe(403)
+ }
+ expect(lookup).not.toHaveBeenCalled()
+ expect(onMemoryContext).not.toHaveBeenCalled()
+ expect(onMemoryContextEmitted).not.toHaveBeenCalled()
+ } finally { lookup.mockRestore() }
+ })
+
+ it('bounds a stalled adapter read without sending late context', async () => {
+ const entry = { engine: 'opencode', agentId: 'coding-agent', sessionId: 'native',
+ processIdentity: { pid: 42, executable: 'opencode', startMarker: 'same-process' } } as RegisteredSession
+ const { base, headers } = await start({ resolveHookAgent: async () => entry,
+ onMemoryContext: async () => new Promise(() => {}) })
+ const result = await fetch(`${base}/api/hook/memory-context`, { method: 'POST', headers,
+ body: JSON.stringify({ engine: 'opencode', sessionId: 'native', callerPid: 42, tmuxPane: '%41', cliVersion: '1.18.34', prompt: 'Review parser.' }) })
+ expect(await result.json()).toEqual({ ok: true })
+ })
+
it('accepts private OpenCode runtime observations only from the verified live session', async () => {
const entry = { engine: 'opencode', agentId: 'companion', sessionId: 'native',
processIdentity: { pid: 42, executable: 'opencode', startMarker: 'same-process' } } as RegisteredSession
@@ -153,12 +208,13 @@ describe('process-owned hook server', () => {
} finally { registration.mockRestore() }
})
- it('accepts emitted receipts only from a hook bound to the same live native session', async () => {
- const entry = { engine: 'codex', agentId: 'memory_agent', sessionId: 'memory_session' } as RegisteredSession
+ it.each(['codex', 'opencode'] as const)('accepts emitted receipts only from a %s hook bound to the same live native session', async engine => {
+ const entry = { engine, agentId: 'memory_agent', sessionId: 'memory_session',
+ processIdentity: { pid: 42, executable: engine, startMarker: 'same-process' } } as RegisteredSession
const resolveHookAgent = vi.fn(async () => entry)
const onMemoryContextEmitted = vi.fn(async () => true)
const { base, headers } = await start({ resolveHookAgent, onMemoryContextEmitted })
- const body = { engine: 'codex', sessionId: entry.sessionId, tmuxPane: '%41', memoryReceiptId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' }
+ const body = { engine, callerPid: 42, sessionId: entry.sessionId, tmuxPane: '%41', memoryReceiptId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' }
const submit = (value = body, authenticated = true) => fetch(`${base}/api/hook/memory-emitted`, {
method: 'POST', headers: authenticated ? headers : { 'content-type': 'application/json' }, body: JSON.stringify(value) })
expect((await submit(body, false)).status).toBe(401)
diff --git a/cli/src/hookServer.ts b/cli/src/hookServer.ts
index a2b7045e8..262397f74 100644
--- a/cli/src/hookServer.ts
+++ b/cli/src/hookServer.ts
@@ -76,6 +76,8 @@ async function boundedPromptContext(read: () => PromptContext | Promise<PromptCo
export interface HookServerHandlers {
/** Context for a verified process-owned agent, only on its real user turn. */
onPromptContext?: (agentId: string, prompt: string) => PromptContext | Promise<PromptContext>
+ /** Shared recall for a live, process-verified native adapter. Scope always comes from the host. */
+ onMemoryContext?: (agentId: string, prompt: string, adapter: { engine: AgentEngine; cliVersion: string }) => PromptContext | Promise<PromptContext>
/** Called only for the same process-owned native session after its hook writes context to stdout. */
onMemoryContextEmitted?: (agentId: string, receiptId: string) => Promise<boolean>
/** Private, process-verified OpenCode request metadata. Never enters the session registry or clients. */
@@ -607,17 +609,35 @@ export function startHookServer(
json(200, handlers.onOpenCodeMemoryRuntime?.(agent, body.input) ?? { observe: false }); return
}
+ if (req.method === 'POST' && url === '/api/hook/memory-context') {
+ if (!hookOk) { json(401, { error: 'UNAUTHORIZED' }); return }
+ let body: BoundHookBody
+ try {
+ const parsed: unknown = JSON.parse(await readBody(req))
+ if (!validHookBody(parsed) || !['claude', 'codex', 'opencode'].includes(parsed.engine ?? '')
+ || !parsed.callerPid || !parsed.cliVersion || typeof parsed.prompt !== 'string'
+ || !parsed.prompt.trim() || parsed.prompt.length > 4_000) { json(400, { error: 'invalid hook body' }); return }
+ body = parsed
+ } catch { json(400, { error: 'bad json' }); return }
+ const agent = handlers.resolveHookAgent ? await verifiedBoundMutation(body, handlers) : null
+ if (!agent?.processIdentity) { json(403, { error: 'UNBOUND_HOOK' }); return }
+ const context = handlers.onMemoryContext ? await boundedPromptContext(() => handlers.onMemoryContext!(
+ agent.agentId, body.prompt!, { engine: agent.engine, cliVersion: body.cliVersion! })) : null
+ json(200, { ok: true, ...context }); return
+ }
+
if (req.method === 'POST' && url === '/api/hook/memory-emitted') {
if (!hookOk) { json(401, { error: 'UNAUTHORIZED' }); return }
let body: BoundHookBody
try {
const parsed: unknown = JSON.parse(await readBody(req))
if (!validHookBody(parsed) || !/^[a-f0-9-]{36}$/.test(parsed.memoryReceiptId ?? '')
- || !['claude', 'codex'].includes(parsed.engine ?? '')) { json(400, { error: 'invalid hook body' }); return }
+ || !['claude', 'codex', 'opencode'].includes(parsed.engine ?? '')
+ || (parsed.engine === 'opencode' && !parsed.callerPid)) { json(400, { error: 'invalid hook body' }); return }
body = parsed
} catch { json(400, { error: 'bad json' }); return }
- const agent = await verifiedBoundMutation(body, handlers)
- if (!agent) { json(403, { error: 'UNBOUND_HOOK' }); return }
+ const agent = body.engine === 'opencode' && !handlers.resolveHookAgent ? null : await verifiedBoundMutation(body, handlers)
+ if (!agent || (body.engine === 'opencode' && !agent.processIdentity)) { json(403, { error: 'UNBOUND_HOOK' }); return }
const recorded = await handlers.onMemoryContextEmitted?.(agent.agentId, body.memoryReceiptId!).catch(() => false) ?? false
json(200, { ok: true, recorded, delivery: 'unverified' }); return
}
diff --git a/cli/src/lib/hooks.ts b/cli/src/lib/hooks.ts
index 10ef8e74c..146756464 100644
--- a/cli/src/lib/hooks.ts
+++ b/cli/src/lib/hooks.ts
@@ -15,6 +15,7 @@ import { VERSION } from '../version.js'
import { hermesConfigHomes } from '../engines/hermes/home.js'
import { managedNodePath } from './nodeRuntime.js'
import { opencodeMemoryPluginSource } from './opencodeMemoryPlugin.js'
+import { opencodeRecallPluginSource } from './opencodeRecallPlugin.js'
const SETTINGS_PATH = join(homedir(), '.claude', 'settings.json')
const GROK_HOOKS_PATH = join(env.GROK_HOME, 'hooks', 'harness.json')
@@ -450,8 +451,11 @@ export const MachineRegister = async ({ directory, worktree, project, client })
} catch {}
}
${engine === 'opencode' ? opencodeMemoryPluginSource(port) : ''}
+${engine === 'opencode' ? opencodeRecallPluginSource(port) : ''}
return {
- ${engine === 'opencode' ? '"chat.message": memoryMessage, "chat.params": memoryParams,' : ''}
+ ${engine === 'opencode' ? `"chat.message": async (input, output) => { await memoryMessage(input, output); await recallMessage(input, output) },
+ "chat.params": memoryParams, "experimental.chat.messages.transform": recallTransform,
+ "experimental.session.compacting": recallCompacting, "experimental.compaction.autocontinue": recallAutoContinue,` : ''}
event: async ({ event }) => {
if (!event) return
if (event.type === "session.created" || event.type === "session.updated") {
diff --git a/cli/src/lib/opencodeRecallPlugin.spec.ts b/cli/src/lib/opencodeRecallPlugin.spec.ts
new file mode 100644
index 000000000..18614c685
--- /dev/null
+++ b/cli/src/lib/opencodeRecallPlugin.spec.ts
@@ -0,0 +1,116 @@
+import { afterEach, expect, it, vi } from 'vitest'
+import { opencodeRecallPluginSource } from './opencodeRecallPlugin.js'
+
+afterEach(() => { vi.restoreAllMocks(); vi.unstubAllEnvs(); vi.useRealTimers() })
+
+// Hook and part shapes recorded by memory-native-opencode-recall-probe.mjs on 1.18.34.
+function fixture() {
+ vi.stubEnv('TMUX_PANE', '%42')
+ let token = 'synthetic-hook-token'
+ const context = 'Historical context: prefer a small reproducer for parser bugs.'
+ const receipt = '77777777-7777-4777-8777-777777777777'
+ const fetch = vi.spyOn(globalThis, 'fetch').mockImplementation(async url => new Response(JSON.stringify(
+ String(url).endsWith('memory-context') ? { additionalContext: context, memoryReceiptId: receipt } : { recorded: true })))
+ const health = vi.fn(async () => ({ data: { version: '1.18.34' } }))
+ const hooks = new Function('client', 'hookToken', `${opencodeRecallPluginSource(12345)};
+ return { submitted: recallMessage, transform: recallTransform, compacting: recallCompacting, continuation: recallAutoContinue }`)(
+ { _client: { get: health } }, () => token)
+ const row = { info: { id: 'user-one', sessionID: 'native', role: 'user', agent: 'build' },
+ parts: [{ id: 'part-one', sessionID: 'native', messageID: 'user-one', type: 'text', text: 'Review the parser bug.' }] }
+ void hooks.submitted({ sessionID: 'native' }, { message: row.info, parts: row.parts })
+ const output = { messages: [row] }
+ return { ...hooks, output, row, context, receipt, fetch, health, disableToken: () => { token = '' } }
+}
+
+it('delivers shared context as an ephemeral user part and acknowledges without any provider credential', async () => {
+ const f = fixture(), original = structuredClone(f.row.parts)
+ await f.transform({}, f.output)
+ expect(f.row.parts.slice(1)).toEqual(original)
+ expect(f.row.parts[0]).toMatchObject({ type: 'text', text: f.context, synthetic: true, sessionID: 'native', messageID: 'user-one' })
+ expect(JSON.parse(String(f.fetch.mock.calls[0][1]?.body))).toEqual({ engine: 'opencode', sessionId: 'native', callerPid: process.pid,
+ tmuxPane: '%42', runtimeHints: [{ backend: 'tmux', paneId: '%42' }], cliVersion: '1.18.34', prompt: 'Review the parser bug.' })
+ expect(String(f.fetch.mock.calls[1][0])).toMatch(/memory-emitted$/)
+ expect(JSON.parse(String(f.fetch.mock.calls[1][1]?.body)).memoryReceiptId).toBe(f.receipt)
+})
+
+it('revalidates shared state on every request and removes old context after a clone and recall being turned off', async () => {
+ const f = fixture()
+ await f.transform({}, f.output)
+ const copy = structuredClone(f.output)
+ f.fetch.mockImplementation(async () => new Response('{"ok":true}'))
+ await f.transform({}, copy)
+ expect(copy.messages[0].parts).toHaveLength(1)
+ expect(copy.messages[0].parts[0].text).toBe('Review the parser bug.')
+ expect(f.health).toHaveBeenCalledOnce()
+})
+
+it('excludes compaction input even when recall is on, then recalls again for the native automatic continuation', async () => {
+ const f = fixture()
+ await f.compacting({ sessionID: 'native' })
+ await f.transform({}, f.output)
+ expect(f.fetch).not.toHaveBeenCalled()
+ await f.continuation({ sessionID: 'native', agent: 'build', message: { agent: 'build' } })
+ const resumed = { messages: [{ info: { ...f.row.info, id: 'native-continue' }, parts: [
+ { ...f.row.parts[0], id: 'continue-part', messageID: 'native-continue', text: 'Continue if you have next steps.',
+ synthetic: true, metadata: { compaction_continue: true } },
+ ] }] }
+ await f.transform({}, resumed)
+ expect(resumed.messages[0].parts[0].text).toBe(f.context)
+ expect(JSON.parse(String(f.fetch.mock.calls[0][1]?.body)).prompt).toBe('Review the parser bug.')
+ await f.submitted({ sessionID: 'native' }, { message: { ...f.row.info, id: 'file-only' }, parts: [{ type: 'file' }] })
+ f.fetch.mockClear()
+ await f.transform({}, resumed)
+ expect(f.fetch).not.toHaveBeenCalled()
+ expect(resumed.messages[0].parts).toHaveLength(1)
+})
+
+it('does not infer continuation from synthetic text, another agent or an unknown message', async () => {
+ const f = fixture()
+ for (const info of [{ ...f.row.info, id: 'unobserved' }, { ...f.row.info, agent: 'compaction' }]) {
+ await f.transform({}, { messages: [{ info, parts: f.row.parts }] })
+ }
+ await f.transform({}, { messages: [{ info: f.row.info, parts: [{ ...f.row.parts[0], synthetic: true }] }] })
+ expect(f.fetch).not.toHaveBeenCalled()
+})
+
+it('keeps simultaneous sessions separate and ignores a late reply for a replaced user turn', async () => {
+ const f = fixture()
+ let resolve!: (response: Response) => void
+ f.fetch.mockImplementationOnce(() => new Promise<Response>(done => { resolve = done }))
+ const running = f.transform({}, f.output)
+ await vi.waitFor(() => expect(resolve).toBeTypeOf('function'))
+ await f.submitted({ sessionID: 'native' }, { message: { ...f.row.info, id: 'next-user' }, parts: f.row.parts })
+ resolve(new Response(JSON.stringify({ additionalContext: 'stale context' })))
+ await running
+ expect(f.row.parts).toHaveLength(1)
+ await f.transform({}, { messages: [{ info: { ...f.row.info, sessionID: 'foreign' }, parts: f.row.parts }] })
+ expect(f.fetch).toHaveBeenCalledOnce()
+})
+
+it('bounds a hung host and cannot mutate the request after the deadline', async () => {
+ vi.useFakeTimers()
+ const f = fixture()
+ let resolve!: (response: Response) => void
+ f.fetch.mockImplementationOnce(() => new Promise<Response>(done => { resolve = done }))
+ const running = f.transform({}, f.output)
+ await vi.advanceTimersByTimeAsync(700)
+ await running
+ expect(f.row.parts).toHaveLength(1)
+ resolve(new Response(JSON.stringify({ additionalContext: 'too late' })))
+ await vi.advanceTimersByTimeAsync(1)
+ expect(f.row.parts).toHaveLength(1)
+})
+
+it.each(['wrong-version', 'no-token', 'no-pane', 'unavailable', 'oversized-context', 'oversized-body'])(
+ 'continues without context for %s', async reason => {
+ const f = fixture()
+ if (reason === 'wrong-version') f.health.mockResolvedValue({ data: { version: '2.0.0' } })
+ if (reason === 'no-token') f.disableToken()
+ if (reason === 'no-pane') vi.stubEnv('TMUX_PANE', '')
+ if (reason === 'unavailable') f.fetch.mockResolvedValue(new Response('', { status: 403 }))
+ if (reason === 'oversized-context') f.fetch.mockResolvedValue(new Response(JSON.stringify({ additionalContext: 'x'.repeat(8001) })))
+ if (reason === 'oversized-body') f.fetch.mockResolvedValue(new Response('x'.repeat(64001)))
+ await f.transform({}, f.output)
+ expect(f.row.parts).toHaveLength(1)
+ if (reason.startsWith('no-')) expect(f.health).not.toHaveBeenCalled()
+ })
diff --git a/cli/src/lib/opencodeRecallPlugin.ts b/cli/src/lib/opencodeRecallPlugin.ts
new file mode 100644
index 000000000..53d338e20
--- /dev/null
+++ b/cli/src/lib/opencodeRecallPlugin.ts
@@ -0,0 +1,91 @@
+/** Native transport only. Retrieval, evidence, scope and controls remain in Harness's shared core. */
+export function opencodeRecallPluginSource(port: number): string {
+ return `
+ const recallTurns = new Map(), recallCompactions = new Set(), recallParts = new Set()
+ let recallVersion
+ const recallMessage = async (input, output) => {
+ const message = output.message
+ if (!input.sessionID || message?.sessionID !== input.sessionID || message.role !== "user"
+ || typeof message.id !== "string" || typeof message.agent !== "string") return
+ const query = (output.parts || []).filter(part => part.type === "text" && !part.synthetic && !part.ignored
+ && typeof part.text === "string").map(part => part.text).join("\\n").slice(0, 4000).trim()
+ recallTurns.delete(input.sessionID)
+ // File-only requests must replace a previous query too; never recall for a stale user turn.
+ recallTurns.set(input.sessionID, { id: message.id, agent: message.agent, query, continuation: false })
+ if (recallTurns.size > 128) {
+ const oldest = recallTurns.keys().next().value
+ recallTurns.delete(oldest); recallCompactions.delete(oldest)
+ }
+ }
+ const recallCompacting = async ({sessionID}) => {
+ if (recallTurns.has(sessionID)) recallCompactions.add(sessionID)
+ }
+ const recallAutoContinue = async (input) => {
+ const turn = recallTurns.get(input.sessionID)
+ if (turn && turn.agent === input.agent && input.message?.agent === input.agent) turn.continuation = true
+ }
+ const recallRequest = async (route, sessionID, body, signal) => {
+ const pane = process.env.TMUX_PANE, token = hookToken()
+ if (!pane || !token) return null
+ const response = await fetch("http://127.0.0.1:${port}/api/hook/" + route, {
+ method: "POST", signal, headers: { "content-type": "application/json", "x-harness-hook-token": token },
+ body: JSON.stringify({ engine: "opencode", sessionId: sessionID, callerPid: process.pid,
+ tmuxPane: pane, runtimeHints: [{ backend: "tmux", paneId: pane }], ...body }),
+ })
+ if (!response.ok || !response.body) return null
+ const reader = response.body.getReader(), chunks = []
+ let bytes = 0
+ try {
+ for (;;) {
+ const { done, value } = await reader.read()
+ if (done) break
+ bytes += value.byteLength
+ if (bytes > 64000) { await reader.cancel(); return null }
+ chunks.push(value)
+ }
+ return JSON.parse(Buffer.concat(chunks).toString("utf8"))
+ } finally { reader.releaseLock() }
+ }
+ const recallTransform = async (_input, output) => {
+ let timer, healthTimer
+ const controller = new AbortController()
+ try {
+ // These parts exist only in the outgoing conversion. Strip our prior parts even if another
+ // plugin cloned the message array, then ask the core again so off/forget/correct take effect.
+ for (const row of output.messages) row.parts = row.parts.filter(part => !recallParts.has(part.id))
+ const row = output.messages.findLast(row => row.info.role === "user")
+ if (!row || recallCompactions.delete(row.info.sessionID)) return
+ const sessionID = row.info.sessionID, turn = recallTurns.get(sessionID)
+ if (!turn?.query || turn.agent !== row.info.agent) return
+ const sameTurn = row.info.id === turn.id
+ const seed = row.parts.find(part => part.type === "text" && !part.ignored && (sameTurn
+ ? !part.synthetic : turn.continuation && part.synthetic && part.metadata?.compaction_continue === true))
+ if (!seed || !process.env.TMUX_PANE || !hookToken()) return
+ const result = await Promise.race([
+ (async () => {
+ if (!recallVersion) {
+ const health = await Promise.race([client._client.get({ url: "/global/health", signal: controller.signal }),
+ new Promise(resolve => { healthTimer = setTimeout(() => resolve(null), 400) })])
+ if (health?.data?.version) recallVersion = health.data.version
+ }
+ if (recallVersion !== "1.18.34") return null
+ return recallRequest("memory-context", sessionID, { cliVersion: recallVersion, prompt: turn.query }, controller.signal)
+ })(),
+ new Promise(resolve => { timer = setTimeout(() => { controller.abort(); resolve(null) }, 700) }),
+ ])
+ const context = result?.additionalContext
+ if (recallTurns.get(sessionID) !== turn || typeof context !== "string" || !context
+ || Buffer.byteLength(context) > 8000) return
+ const part = { id: seed.id + "_harness_memory", sessionID, messageID: row.info.id,
+ type: "text", text: context, synthetic: true }
+ recallParts.add(part.id)
+ if (recallParts.size > 256) recallParts.delete(recallParts.values().next().value)
+ row.parts.unshift(part)
+ if (typeof result.memoryReceiptId === "string" && /^[a-f0-9-]{36}$/.test(result.memoryReceiptId)) {
+ void recallRequest("memory-emitted", sessionID, { memoryReceiptId: result.memoryReceiptId }, AbortSignal.timeout(400)).catch(() => {})
+ }
+ } catch { /* Optional recall must never fail the user's request. */ }
+ finally { clearTimeout(timer); clearTimeout(healthTimer); controller.abort() }
+ }
+`
+}
diff --git a/cli/src/memory/__fixtures__/opencode-1.18.34-recall.json b/cli/src/memory/__fixtures__/opencode-1.18.34-recall.json
new file mode 100644
index 000000000..86befb93e
--- /dev/null
+++ b/cli/src/memory/__fixtures__/opencode-1.18.34-recall.json
@@ -0,0 +1,2313 @@
+{
+ "version": "1.18.34",
+ "requests": [
+ {
+ "phase": "on",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [
+ "user"
+ ],
+ "markers": 1,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "off",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "source-private",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "unavailable",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "other-session",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "compaction",
+ "agent": "compaction",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "auto-prime",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [
+ "user"
+ ],
+ "markers": 1,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "auto-prime",
+ "agent": "compaction",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "auto-prime",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [
+ "user"
+ ],
+ "markers": 1,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": false
+ },
+ {
+ "phase": "auto-compact",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [
+ "user"
+ ],
+ "markers": 1,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "corrected",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 1,
+ "hasCurrentRequest": true
+ },
+ {
+ "phase": "forgotten",
+ "agent": "memory_fixture",
+ "model": "model",
+ "roles": [],
+ "markers": 0,
+ "correctedMarkers": 0,
+ "hasCurrentRequest": true
+ }
+ ],
+ "result": {
+ "nativeModelRequestReceivedContext": true,
+ "persistedMemoryParts": 0,
+ "offReceivedContext": false,
+ "unavailableBlockedPrompt": false,
+ "otherSessionReceivedContext": false,
+ "compactionReceivedContext": false,
+ "automaticContinuationReceivedContext": true,
+ "correctedReceivedLatestRevision": true,
+ "forgottenReceivedContext": false,
+ "sourcePrivacyRespected": true,
+ "sourceEngine": "claude",
+ "receivingEngine": "opencode",
+ "learnOffRecallOn": true
+ },
+ "limitations": [
+ "Synthetic seeded Claude evidence/proposal; no real model extraction or semantic usefulness measurement.",
+ "Production plugin and shared runtime/store; fixture HTTP/process binding, not production ancestry resolution.",
+ "No interactive TUI, overflow replay or provider matrix certification."
+ ],
+ "observations": [
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909825904
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b43740014ep7cXDiUlDOIn"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909825904
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b43740014ep7cXDiUlDOIn",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909828457
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b4d69002TbrMuxtmqM78kH"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909825904
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b43740014ep7cXDiUlDOIn",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909826185,
+ "completed": 1790909828443
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4489001Mad4L9VpDTGpT9",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d52001Z5pFk4yUXvh1VZ",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4d54001eGFVGWX4T3W7Jk",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4d580016qlw8oHrXtcVjg",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828457
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d69002TbrMuxtmqM78kH",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4d8d001E4XqRQZS3OYB7c",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909828493
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4d8d001E4XqRQZS3OYB7c",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b4d8d002DJ5UvdLG8uDSLx"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909825904
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b43740014ep7cXDiUlDOIn",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909826185,
+ "completed": 1790909828443
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4489001Mad4L9VpDTGpT9",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d52001Z5pFk4yUXvh1VZ",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4d54001eGFVGWX4T3W7Jk",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4d580016qlw8oHrXtcVjg",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828457
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d69002TbrMuxtmqM78kH",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828461,
+ "completed": 1790909828482
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4d6d001gXpgPRpPK4MtcM",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d7c001aKM7ool8RzNCDf",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4d7e001vKe4IjNzBmU9X2",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4d80001mrwIZ4w1CS9u2B",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828493
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4d8d001E4XqRQZS3OYB7c",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d8d002DJ5UvdLG8uDSLx",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4db3001XPY3o0u6WN2fZE",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909828531
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4db3001XPY3o0u6WN2fZE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b4db4001mRglkleIVLsAXQ"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909825904
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b43740014ep7cXDiUlDOIn",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909826185,
+ "completed": 1790909828443
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4489001Mad4L9VpDTGpT9",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d52001Z5pFk4yUXvh1VZ",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4d54001eGFVGWX4T3W7Jk",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4d580016qlw8oHrXtcVjg",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828457
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d69002TbrMuxtmqM78kH",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828461,
+ "completed": 1790909828482
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4d6d001gXpgPRpPK4MtcM",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d7c001aKM7ool8RzNCDf",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4d7e001vKe4IjNzBmU9X2",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4d80001mrwIZ4w1CS9u2B",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828493
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4d8d001E4XqRQZS3OYB7c",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d8d002DJ5UvdLG8uDSLx",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4d8d001E4XqRQZS3OYB7c",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828498,
+ "completed": 1790909828521
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4d92001w8F6lkwySQnM3M",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4da4001eOD5pXPZ1ElzHS",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4da6001Esr6XhqdmsjvbL",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4da8001eXCLk8kFnoXmXY",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828531
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4db3001XPY3o0u6WN2fZE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4db4001mRglkleIVLsAXQ",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574b232ffeQh63HO55hz3aQN",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4dd1001zZc18fbVRhF9G4",
+ "role": "user",
+ "sessionID": "ses_f0574b232ffeQh63HO55hz3aQN",
+ "time": {
+ "created": 1790909828561
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4dd1001zZc18fbVRhF9G4",
+ "sessionID": "ses_f0574b232ffeQh63HO55hz3aQN",
+ "id": "prt_0fa8b4dd20018x5rvohS1qpF7J"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828561
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4dd1001zZc18fbVRhF9G4",
+ "sessionID": "ses_f0574b232ffeQh63HO55hz3aQN"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4dd20018x5rvohS1qpF7J",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574b232ffeQh63HO55hz3aQN"
+ },
+ {
+ "hook": "compacting",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ }
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909825904
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b43740014ep7cXDiUlDOIn",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b436f0012pUIfR1vOa9Rew",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909826185,
+ "completed": 1790909828443
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4489001Mad4L9VpDTGpT9",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d52001Z5pFk4yUXvh1VZ",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4d54001eGFVGWX4T3W7Jk",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4d580016qlw8oHrXtcVjg",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828457
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d69002TbrMuxtmqM78kH",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4d69001nU9Ny35zs1Q7oE",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828461,
+ "completed": 1790909828482
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4d6d001gXpgPRpPK4MtcM",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d7c001aKM7ool8RzNCDf",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4d7e001vKe4IjNzBmU9X2",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4d80001mrwIZ4w1CS9u2B",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828493
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4d8d001E4XqRQZS3OYB7c",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4d8d002DJ5UvdLG8uDSLx",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4d8d001E4XqRQZS3OYB7c",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828498,
+ "completed": 1790909828521
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4d92001w8F6lkwySQnM3M",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4da4001eOD5pXPZ1ElzHS",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4da6001Esr6XhqdmsjvbL",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4da8001eXCLk8kFnoXmXY",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828531
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4db3001XPY3o0u6WN2fZE",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4db4001mRglkleIVLsAXQ",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4db3001XPY3o0u6WN2fZE",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828536,
+ "completed": 1790909828547
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4db80017UiOrgnKn3jzem",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4dbe001s3eFYHasl3nJQr",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4dbf001YILOPA6XG8qwUK",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4dc1001BnxhzryyjJS9cq",
+ "type": "step-finish"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "compaction",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4e080010onbbTUtKU5igv",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909828616
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4e080010onbbTUtKU5igv",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b4e080021rF4dlKC0uKYvf"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "agent": "memory_fixture",
+ "time": {
+ "created": 1790909828587
+ },
+ "id": "msg_0fa8b4deb001a9D5pkOXj0YZz0",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4deb002NXNvRaT0sVERUw",
+ "type": "compaction",
+ "auto": false
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "assistant",
+ "parentID": "msg_0fa8b4deb001a9D5pkOXj0YZz0",
+ "mode": "compaction",
+ "agent": "compaction",
+ "summary": true,
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828597,
+ "completed": 1790909828605
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4df5001iZKyBcd3vLkdCt",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4df8001kS3X0hScnFrjgX",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4df90016KPnFYswoQaVBt",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4dfb001VXoPw3doASOnr9",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828616
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e080010onbbTUtKU5igv",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e080021rF4dlKC0uKYvf",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "compacting",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ }
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828616
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e080010onbbTUtKU5igv",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e080021rF4dlKC0uKYvf",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4e080010onbbTUtKU5igv",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 127002,
+ "input": 127000,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828620,
+ "completed": 1790909828634
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e0c001vv2RYtsIjCvqzx",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e15001rkLJaJ5n80hqYq",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e16001QkxoyxTnBHJ1sy",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e190015qDa0ot4rv3Lx6",
+ "type": "step-finish"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "compaction",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "autocontinue",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "message": {
+ "role": "user",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "agent": "memory_fixture",
+ "time": {
+ "created": 1790909828635
+ },
+ "id": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "overflow": false
+ }
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "agent": "memory_fixture",
+ "time": {
+ "created": 1790909828635
+ },
+ "id": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e1c001sTlVIfkp7KFAHJ",
+ "type": "compaction",
+ "auto": true,
+ "overflow": false
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "assistant",
+ "parentID": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "mode": "compaction",
+ "agent": "compaction",
+ "summary": true,
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828645,
+ "completed": 1790909828653
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e250013BQJwTklUxq9op",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e28001ziDG0ohF3fRQBU",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e2900196iuT8gW0JzBuC",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e2b001SyZzVKS8hQrGXV",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828655
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e2f00181bLiO3faRK39m",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e2f002B22OOSGtU5sK4h",
+ "type": "text",
+ "synthetic": true,
+ "metadata": {
+ "compaction_continue": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4e4d0018twN51XxyECAYf",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909828685
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4e4d0018twN51XxyECAYf",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b4e4d002r2iSH2kypa3B6d"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "agent": "memory_fixture",
+ "time": {
+ "created": 1790909828635
+ },
+ "id": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e1c001sTlVIfkp7KFAHJ",
+ "type": "compaction",
+ "auto": true,
+ "overflow": false
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "assistant",
+ "parentID": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "mode": "compaction",
+ "agent": "compaction",
+ "summary": true,
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828645,
+ "completed": 1790909828653
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e250013BQJwTklUxq9op",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e28001ziDG0ohF3fRQBU",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e2900196iuT8gW0JzBuC",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e2b001SyZzVKS8hQrGXV",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828655
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e2f00181bLiO3faRK39m",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e2f002B22OOSGtU5sK4h",
+ "type": "text",
+ "synthetic": true,
+ "metadata": {
+ "compaction_continue": true
+ }
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4e2f00181bLiO3faRK39m",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828657,
+ "completed": 1790909828674
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e310015lN34D3BH4ReN7",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e3e001AkiFIX12wWNX8C",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e3f001zc0GGKuK3kiw67",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e40001fsC8M6xyL1QXTW",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828685
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e4d0018twN51XxyECAYf",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e4d002r2iSH2kypa3B6d",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4e78001cMPQvS69S7cHRG",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909828728
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4e78001cMPQvS69S7cHRG",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b4e79001N1PbjU7NXMHjPv"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "agent": "memory_fixture",
+ "time": {
+ "created": 1790909828635
+ },
+ "id": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e1c001sTlVIfkp7KFAHJ",
+ "type": "compaction",
+ "auto": true,
+ "overflow": false
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "assistant",
+ "parentID": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "mode": "compaction",
+ "agent": "compaction",
+ "summary": true,
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828645,
+ "completed": 1790909828653
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e250013BQJwTklUxq9op",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e28001ziDG0ohF3fRQBU",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e2900196iuT8gW0JzBuC",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e2b001SyZzVKS8hQrGXV",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828655
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e2f00181bLiO3faRK39m",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e2f002B22OOSGtU5sK4h",
+ "type": "text",
+ "synthetic": true,
+ "metadata": {
+ "compaction_continue": true
+ }
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4e2f00181bLiO3faRK39m",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828657,
+ "completed": 1790909828674
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e310015lN34D3BH4ReN7",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e3e001AkiFIX12wWNX8C",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e3f001zc0GGKuK3kiw67",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e40001fsC8M6xyL1QXTW",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828685
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e4d0018twN51XxyECAYf",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e4d002r2iSH2kypa3B6d",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4e4d0018twN51XxyECAYf",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828689,
+ "completed": 1790909828709
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e51001lGeektUmcLqr8P",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e590011XN8VFoV96FJwz",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e5a001UJj6vsGbGM8oDF",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e5b001MxkDQ8cz5Qvbon",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828728
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e78001cMPQvS69S7cHRG",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e79001N1PbjU7NXMHjPv",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ {
+ "hook": "chat.message",
+ "input": {
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "message": {
+ "id": "msg_0fa8b4e9d001lIRso4l4B3wrKz",
+ "role": "user",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "time": {
+ "created": 1790909828765
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ }
+ },
+ "parts": [
+ {
+ "type": "text",
+ "text": "[synthetic prompt]",
+ "messageID": "msg_0fa8b4e9d001lIRso4l4B3wrKz",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8",
+ "id": "prt_0fa8b4e9e001693mFs4BtnVHIM"
+ }
+ ]
+ },
+ {
+ "hook": "messages.transform",
+ "messages": [
+ {
+ "info": {
+ "role": "user",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "agent": "memory_fixture",
+ "time": {
+ "created": 1790909828635
+ },
+ "id": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e1c001sTlVIfkp7KFAHJ",
+ "type": "compaction",
+ "auto": true,
+ "overflow": false
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "assistant",
+ "parentID": "msg_0fa8b4e1b001Rz87dQUMoeMeds",
+ "mode": "compaction",
+ "agent": "compaction",
+ "summary": true,
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828645,
+ "completed": 1790909828653
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e250013BQJwTklUxq9op",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e28001ziDG0ohF3fRQBU",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e2900196iuT8gW0JzBuC",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e2b001SyZzVKS8hQrGXV",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828655
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e2f00181bLiO3faRK39m",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e2f002B22OOSGtU5sK4h",
+ "type": "text",
+ "synthetic": true,
+ "metadata": {
+ "compaction_continue": true
+ }
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4e2f00181bLiO3faRK39m",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828657,
+ "completed": 1790909828674
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e310015lN34D3BH4ReN7",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e3e001AkiFIX12wWNX8C",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e3f001zc0GGKuK3kiw67",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e40001fsC8M6xyL1QXTW",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828685
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e4d0018twN51XxyECAYf",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e4d002r2iSH2kypa3B6d",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4e4d0018twN51XxyECAYf",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828689,
+ "completed": 1790909828709
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e51001lGeektUmcLqr8P",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e590011XN8VFoV96FJwz",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e5a001UJj6vsGbGM8oDF",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e5b001MxkDQ8cz5Qvbon",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828728
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e78001cMPQvS69S7cHRG",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e79001N1PbjU7NXMHjPv",
+ "type": "text"
+ }
+ ]
+ },
+ {
+ "info": {
+ "parentID": "msg_0fa8b4e78001cMPQvS69S7cHRG",
+ "role": "assistant",
+ "mode": "memory_fixture",
+ "agent": "memory_fixture",
+ "path": {
+ "cwd": "/fixture/work",
+ "root": "/fixture/work"
+ },
+ "cost": 0,
+ "tokens": {
+ "total": 102,
+ "input": 100,
+ "output": 2,
+ "reasoning": 0,
+ "cache": {
+ "write": 0,
+ "read": 0
+ }
+ },
+ "modelID": "model",
+ "providerID": "fixture",
+ "time": {
+ "created": 1790909828733,
+ "completed": 1790909828753
+ },
+ "finish": "stop",
+ "id": "msg_0fa8b4e7d00164euVDf1yU45X6",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e8c001LQ64WTQUiJBrH0",
+ "type": "step-start"
+ },
+ {
+ "id": "prt_0fa8b4e8d001ufTuuCBStii0T7",
+ "type": "text"
+ },
+ {
+ "id": "prt_0fa8b4e8f001MBYQ5FAU6Sgjyw",
+ "type": "step-finish"
+ }
+ ]
+ },
+ {
+ "info": {
+ "role": "user",
+ "time": {
+ "created": 1790909828765
+ },
+ "agent": "memory_fixture",
+ "model": {
+ "providerID": "fixture",
+ "modelID": "model"
+ },
+ "id": "msg_0fa8b4e9d001lIRso4l4B3wrKz",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ },
+ "parts": [
+ {
+ "id": "prt_0fa8b4e9e001693mFs4BtnVHIM",
+ "type": "text"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "hook": "chat.params",
+ "agent": "memory_fixture",
+ "sessionID": "ses_f0574bcb5ffeeHw0Qw4cvhudd8"
+ }
+ ],
+ "validationKind": "native transport with synthetic seeded memory; no semantic accuracy score",
+ "sourceDigests": {
+ "cli/src/lib/opencodeRecallPlugin.ts": "63476b1701d04f833277b264bf3aa3e89afa389cbcbc183f38973aa80a2c0986",
+ "cli/src/memory/runtime.ts": "23d34368b23bad39a6fedc95e8d0b6515a41cb18f07288b6621b1918ba9c351b",
+ "cli/scripts/memory-native-opencode-recall-probe.mjs": "84e61636c0894f8e19e7bd5ac56da32a4844ace4337afabed69134a7cb0dcb63"
+ }
+}
diff --git a/cli/src/memory/runtime.spec.ts b/cli/src/memory/runtime.spec.ts
index 0e551c765..90e2fb734 100644
--- a/cli/src/memory/runtime.spec.ts
+++ b/cli/src/memory/runtime.spec.ts
@@ -235,6 +235,44 @@ it.each(['0.159.0', '0.159.3'])('prepares Codex prompt memory for tested native
expect((await runtime.preparePromptRecall('agent', { query: 'coding changes' })).packet.status).toBe('unavailable')
})
+it('recalls a Claude lesson through a verified OpenCode adapter without changing ownership or requiring learning', async () => {
+ await learn()
+ sessions[0] = { ...sessions[0], engine: 'opencode', sessionId: 'opencode_native', cliVersion: null }
+ await runtime.configure({ learn: false, recall: true })
+ expect((await runtime.preparePromptRecall('agent', { query: 'coding changes' })).packet.status).toBe('unavailable')
+ const adapter = { engine: 'opencode', cliVersion: '1.18.34' }
+ const prepared = await runtime.preparePromptRecall('agent', { query: 'coding changes' }, adapter)
+ expect(prepared.packet.items[0]).toMatchObject({ claim: preference, sources: [{ engine: 'claude' }] })
+ expect(prepared.receipt?.delivery).toBe('unverified')
+ expect(await runtime.promptRecallEmitted('agent', prepared.receipt!.id)).toBe(true)
+ expect((await runtime.preparePromptRecall('agent', { query: 'coding' }, { engine: 'codex', cliVersion: '0.159.3' })).packet.status).toBe('unavailable')
+ await runtime.configure({ learn: false, recall: false })
+ expect((await runtime.preparePromptRecall('agent', { query: 'coding' }, adapter)).packet.status).toBe('off')
+ expect(sessions[0].cliVersion).toBeNull()
+})
+
+it('shares a correction and deletion across Codex and OpenCode without copying the memory', async () => {
+ await learn()
+ const first = (await runtime.recall('agent', { query: 'coding changes' })).items[0]
+ const store = stores.get('owner_a')!, access = { profileId: 'owner_a', projectIds: [first.scope.projectId!], includeProfile: true }
+ const { schemaVersion: _schema, id: _id, revision: _revision, state: _state, createdAt: _created, updatedAt: _updated,
+ evidence: _evidence, evidenceClass: _class, ...draft } = store.read(first.id, access)!
+ const corrected = store.correctFromUser(first.id, first.revision,
+ { ...draft, claim: 'Group related coding changes together.', futureAction: 'Group related coding changes together.' }, access)
+ for (const [engine, cliVersion] of [['codex', '0.159.3'], ['opencode', '1.18.34']] as const) {
+ sessions[0] = { ...sessions[0], engine, cliVersion, sessionId: `${engine}_native` }
+ const prepared = await runtime.preparePromptRecall('agent', { query: 'coding changes' })
+ expect(prepared.packet.items).toHaveLength(1)
+ expect(prepared.packet.items[0]).toMatchObject({ id: first.id, revision: corrected.revision, claim: corrected.claim })
+ }
+ expect(store.list(access)).toHaveLength(1)
+ store.forget(first.id, corrected.revision, access)
+ for (const [engine, cliVersion] of [['codex', '0.159.3'], ['opencode', '1.18.34']] as const) {
+ sessions[0] = { ...sessions[0], engine, cliVersion, sessionId: `${engine}_native` }
+ expect((await runtime.preparePromptRecall('agent', { query: 'coding changes' })).packet.items).toEqual([])
+ }
+})
+
it('withholds prepared context when privacy changes before the hook response', async () => {
await learn()
intercept = async operation => { if (operation === 'prepareRecall') stores.get('owner_a')!.setSessionIncluded('claude', 'native', false) }
diff --git a/cli/src/memory/runtime.ts b/cli/src/memory/runtime.ts
index 8dc4a15b1..6b951c25f 100644
--- a/cli/src/memory/runtime.ts
+++ b/cli/src/memory/runtime.ts
@@ -258,18 +258,24 @@ export class CodingMemoryRuntime {
receipt: result.receipt ? { id: result.receipt.id, delivery: result.receipt.delivery } : null }
}
- async preparePromptRecall(agentId: string, request: RecallRequest): Promise<PreparedRecall> {
+ async preparePromptRecall(agentId: string, request: RecallRequest,
+ adapter?: { engine: string; cliVersion: string }): Promise<PreparedRecall> {
const session = this.session(agentId)
+ // A process-verified plugin can observe its native version without publishing that observation
+ // into the registry. It cannot select a different framework, owner, session or project.
+ if (adapter && adapter.engine !== session?.engine) return { packet: empty('unavailable'), receipt: null }
+ const version = adapter?.cliVersion ?? session?.cliVersion
// These releases demonstrated additionalContext in an outgoing native model request.
// An extraction certificate or a successful stdout write does not certify hook delivery.
// Manual recall remains available; add native releases after the same isolated transport check.
- const tested = session?.engine === 'claude' ? session.cliVersion === '2.1.286'
- : session?.engine === 'codex' && ['0.159.0', '0.159.3'].includes(session.cliVersion ?? '')
+ const tested = session?.engine === 'claude' ? version === '2.1.286'
+ : session?.engine === 'codex' ? ['0.159.0', '0.159.3'].includes(version ?? '')
+ : session?.engine === 'opencode' && version === '1.18.34'
if (!tested) return { packet: empty('unavailable'), receipt: null }
return this.recallBound(agentId, request, 'prompt_hook')
}
- /** A host-verified hook acknowledges its stdout write; this is not model-context verification. */
+ /** A verified adapter handed context to the native prompt path; not proof of model consumption. */
async promptRecallEmitted(agentId: string, receiptId: string): Promise<boolean> {
try {
const active = this.requireActive()
diff --git a/docs/plans/2026-09-30-coding-memory-review-log.md b/docs/plans/2026-09-30-coding-memory-review-log.md
index 720b25323..41d9fcd86 100644
--- a/docs/plans/2026-09-30-coding-memory-review-log.md
+++ b/docs/plans/2026-09-30-coding-memory-review-log.md
@@ -691,3 +691,43 @@ Both complete tmux suites then passed all 36 checks with one worker. The require
tmux suite passed nine checks and skipped nine unavailable engine rows. No app, firmware or release
was installed by this increment. Real-user extraction quality remains unmeasured: the prepared
private sample is waiting for explicit approval of its selected external model destination.
+
+### Shared recall through a native OpenCode adapter
+
+The memory library remains owned by the Harness profile and project. The new authenticated
+`/api/hook/memory-context` endpoint accepts a query and an observed framework version; it resolves
+the live process and session before invoking the existing shared memory runtime. It does not accept
+caller-selected profile or project authority, and it never falls back to ownership inferred from a
+pane alone. Recall does not require a provider credential, an extraction-model binding or Learn
+being enabled. Existing experimental, Recall, source-privacy and project controls still apply.
+
+OpenCode 1.18.34's adapter inserts historical context into the outgoing user-message conversion,
+without writing it to native conversation storage. It revalidates recall for every request, removes
+its prior transient parts, bounds responses and abandons an optional lookup after 700 ms including
+native-version discovery and host transport. The core retains its 200 ms deadline. Neither deadline
+is a measurement of live-host latency. Receipt acknowledgement means the adapter handed over context;
+the product continues to label model delivery unverified.
+
+The native probe exposed a lifecycle distinction: `experimental.chat.messages.transform` also runs
+inside compaction. A preceding compaction hook now suppresses recall for that summary input. The
+recorded automatic-continuation hook and native synthetic-part marker allow the ordinary agent's
+next request to obtain freshly retrieved context for the last actual user request. A newly submitted
+request replaces that query, including when it contains only files. Unknown releases, missing host
+ownership, unavailable memory and late responses continue without added context.
+
+`cli/scripts/memory-native-opencode-recall-probe.mjs` exercised the production plugin and shared
+runtime/store with the real 1.18.34 binary and a localhost mock model. The seeded memory cites a
+synthetic Claude user source. The outgoing OpenCode request received it with Learn off and Recall
+on; turning Recall off, hiding the Claude source, using another session or returning an unavailable
+service withheld it. An explicit correction replaced the old revision on the next request, and
+forgetting removed it. Both manual and automatic compaction requests contained no injected memory;
+the automatic continuation received fresh context. SQLite contained zero saved injected parts after
+all phases. The complete sanitized hook shapes and results are in
+[`opencode-1.18.34-recall.json`](../../cli/src/memory/__fixtures__/opencode-1.18.34-recall.json).
+
+These are transport and state-transition checks with a seeded proposal, not semantic extraction or
+task-benefit results. The native probe uses a fixture HTTP/process binding; production endpoint
+authorization is tested separately. Interactive TUI delivery, overflow replay and the provider
+matrix are not certified by this recording. Cross-framework runtime tests additionally verify that
+Codex and OpenCode see the same corrected record ID/revision and the same deletion. No installed app,
+global plugin, live memory, provider setting, firmware or release was changed by this increment.