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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
One meaning for updatedAt: when the conversation last moved (#386)
Dee0a7d3cd5702e
diff --git a/cli/src/backendSocket.spec.ts b/cli/src/backendSocket.spec.tsindex 34cc56471..89d0ddccc 100644--- a/cli/src/backendSocket.spec.ts+++ b/cli/src/backendSocket.spec.ts@@ -795,7 +795,7 @@ describe('BackendSocket outbound queue', () => {cliVersion: null,processIdentity: null,registeredAt: 1,- updatedAt: 1,+ touchedAt: 1,lastHookAt: 1,lastTranscriptAt: 1,}@@ -1054,7 +1054,7 @@ describe('BackendSocket outbound queue', () => {transcriptPath: null, projectDir: 'work', cwd: '/tmp/work',runtimes: [{ backend: 'tmux', paneId: '%9' }], primaryRuntimeKey: 'tmux/%9', tmuxPane: '%9',source: null, title: null, model: null, cliVersion: null, processIdentity: null,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}socket.onCreateAgent = async () => ({ ok: true, session: pending })@@ -1122,7 +1122,7 @@ describe('BackendSocket outbound queue', () => {transcriptPath: null, projectDir: 'work', cwd: '/tmp/work',runtimes: [{ backend: 'tmux', paneId: '%9' }], primaryRuntimeKey: 'tmux/%9', tmuxPane: '%9',source: null, title: null, model: null, cliVersion: null, processIdentity: null,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,})const create = vi.fn(async (input: { bypassPermission: boolean; permissionMode: string | null }) => ({ ok: true as const, session: pending(`b-${create.mock.calls.length}`) }))socket.onCreateAgent = create@@ -1164,7 +1164,7 @@ describe('BackendSocket outbound queue', () => {transcriptPath: null, projectDir: 'nqhieu84', cwd: homedir(),runtimes: [{ backend: 'tmux', paneId: '%9' }], primaryRuntimeKey: 'tmux/%9', tmuxPane: '%9',source: null, title: null, model: null, cliVersion: null, processIdentity: null,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}const create = vi.fn(async (_input: { engine: string; cwd: string }) => ({ ok: true as const, session: pending }))socket.onCreateAgent = create@@ -1201,7 +1201,7 @@ describe('BackendSocket outbound queue', () => {transcriptPath: null, projectDir: 'work', cwd: '/tmp/work',runtimes: [{ backend: 'tmux', paneId: '%receipt' }], primaryRuntimeKey: 'tmux/%receipt', tmuxPane: '%receipt',source: null, title: null, model: null, cliVersion: null, processIdentity: null,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}const lookup = vi.spyOn(registry, 'byAgent').mockReturnValue(pending)let finish!: () => void@@ -1716,7 +1716,7 @@ describe('agent_fork RPC', () => {forkedFrom: { agentId: 'agent-1', name: 'Agent one' },transcriptPath: null, projectDir: 'workspace', cwd: '/tmp/workspace', runtimes: [], primaryRuntimeKey: '',tmuxPane: '%2', source: null, title: null, model: null, cliVersion: null, processIdentity: null,- registeredAt: 2, updatedAt: 2, lastHookAt: 2, lastTranscriptAt: 2,+ registeredAt: 2, touchedAt: 2, lastHookAt: 2, lastTranscriptAt: 2,}function localSocket(): { socket: BackendSocket; frames: Array<Record<string, unknown>> } {@@ -1861,7 +1861,7 @@ describe('agent_restart RPC', () => {cliVersion: null,processIdentity: null,registeredAt: 1,- updatedAt: 1,+ touchedAt: 1,lastHookAt: 1,lastTranscriptAt: 1,}@@ -2269,7 +2269,7 @@ describe('agent_create with a prompt, a name and a named agent', () => {transcriptPath: null, projectDir: 'home', cwd: '/home/someone', defaultName: 'Local model',runtimes: [{ backend: 'tmux', paneId: '%11' }], primaryRuntimeKey: 'tmux/%11', tmuxPane: '%11',source: null, title: null, model: null, cliVersion: null, processIdentity: null,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}async function create(choices: Record<string, unknown>) {diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.tsindex 2202cfb8c..ffe617df0 100644--- a/cli/src/backendSocket.ts+++ b/cli/src/backendSocket.ts@@ -1776,7 +1776,7 @@ export class BackendSocket {const limit = typeof rawLimit === 'number' && rawLimit > 0 ? Math.min(Math.floor(rawLimit), 500) : undefinedconst before = typeof payload.before === 'string' ? payload.before : undefinedconst messages = await readDevinMessages(DEVIN_DB, sessionId)- const timestamp = new Date(s.updatedAt).toISOString()+ const timestamp = new Date(s.touchedAt).toISOString()if (!limit) {reply(type, requestId, { id: sessionId, title: projectDisplayName(s), events: devinMessagesToEvents(messages), timestamp, engine: s.engine })return@@ -1797,7 +1797,7 @@ export class BackendSocket {const limit = typeof rawLimit === 'number' && rawLimit > 0 ? Math.min(Math.floor(rawLimit), 500) : undefinedconst before = typeof payload.before === 'string' ? payload.before : undefinedconst messages = await readHermesMessages(await hermesDbForSession(s), sessionId)- const timestamp = new Date(s.updatedAt).toISOString()+ const timestamp = new Date(s.touchedAt).toISOString()if (!limit) {reply(type, requestId, { id: sessionId, title: projectDisplayName(s), events: hermesMessagesToEvents(messages), timestamp, engine: s.engine })return@@ -1818,7 +1818,7 @@ export class BackendSocket {const limit = typeof rawLimit === 'number' && rawLimit > 0 ? Math.min(Math.floor(rawLimit), 500) : undefinedconst before = typeof payload.before === 'string' ? payload.before : undefinedconst messages = await readOpencodeMessages(OPENCODE_DB, sessionId)- const timestamp = new Date(s.updatedAt).toISOString()+ const timestamp = new Date(s.touchedAt).toISOString()if (!limit) {reply(type, requestId, { id: sessionId, title: projectDisplayName(s), events: opencodeMessagesToEvents(messages), timestamp, engine: s.engine })return@@ -1843,7 +1843,7 @@ export class BackendSocket {const limit = typeof rawLimit === 'number' && rawLimit > 0 ? Math.min(Math.floor(rawLimit), 500) : undefinedconst before = typeof payload.before === 'string' ? payload.before : undefinedconst messages = await readKiloMessages(KILO_DB, sessionId)- const timestamp = new Date(s.updatedAt).toISOString()+ const timestamp = new Date(s.touchedAt).toISOString()if (!limit) {reply(type, requestId, { id: sessionId, title: projectDisplayName(s), events: kiloMessagesToEvents(messages), timestamp, engine: s.engine })return@@ -1863,7 +1863,7 @@ export class BackendSocket {id: sessionId,title: projectDisplayName(s),events: [],- timestamp: new Date(s.updatedAt).toISOString(),+ timestamp: new Date(s.touchedAt).toISOString(),engine: s.engine,hasMore: false,oldestCursor: null,diff --git a/cli/src/cli.ts b/cli/src/cli.tsindex 2f86b4f62..41b7df8db 100644--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@ -229,7 +229,7 @@ import {} from './engines/commandcode/normalizer.js'import { probeGatewayRuntime } from './lib/gatewayRuntime.js'import { probeGridAssignment, sameGridAssignment } from './lib/gridAssignment.js'-import { agentFrame, type AgentFrame } from './lib/agentFrame.js'+import { agentFrame, lastActivityAt, type AgentFrame } from './lib/agentFrame.js'import { agentTokenUsage } from './lib/agentTokenUsage.js'import { SessionInputController } from './lib/sessionInput.js'import { DeviceResultJournal } from './lib/autonomous-device/resultJournal.js'@@ -2832,9 +2832,8 @@ async function runForeground(session: AuthSession | null): Promise<void> {engine: s.engine,transcriptPath: s.transcriptPath || null,header: [projectDisplayName(s), s.title, folderWords(s.cwd)].filter(Boolean).join(' · '),- // Conversation stamps only (lib/agentFrame.ts lastActivityAt): the registry's own- // updatedAt moves on every discovery pass.- updatedAt: Math.max(s.lastTranscriptAt || 0, s.lastHookAt || 0) || s.boundAt || s.registeredAt || 0,+ // Conversation stamps only: the row's `touchedAt` moves on every discovery pass.+ changedAt: Math.max(s.lastTranscriptAt || 0, s.lastHookAt || 0) || s.boundAt || s.registeredAt || 0,readHistory,}]})@@ -2845,7 +2844,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {if (known.has(e.sessionId)) continuesources.push({agentId: '', sessionId: e.sessionId, engine: e.engine, transcriptPath: e.transcriptPath,- header: '', updatedAt: e.mtime, external: { cwd: e.cwd, origin: e.origin, title: e.title },+ header: '', changedAt: e.mtime, external: { cwd: e.cwd, origin: e.origin, title: e.title },})}return sources@@ -4023,7 +4022,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {onRemotePasswordStatus: () => ({ status: 200, body: backend.remotePasswordStatus() }),// Local dashboard (GET /api/status): adapter health + computer fingerprint + local pairings. It// deliberately does NOT expose chat/transcripts — those live in the cloud web (WEB_URL/commander).- onStatus: () => ({+ onStatus: async () => ({machineId: backend.machineId,computerId: computerId(),// Whether this daemon booted with an account. Read LIVE, not from the boot session: a login or@@ -4081,7 +4080,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {dataDir: tildify(env.ADAPTER_DATA_DIR),port: daemonPort(),},- sessions: registry.advertised().map((s) => ({+ sessions: await Promise.all(registry.advertised().map(async (s) => ({id: s.agentId,sessionId: s.sessionId,name: projectDisplayName(s),@@ -4089,8 +4088,9 @@ async function runForeground(session: AuthSession | null): Promise<void> {cwd: tildify(s.cwd ?? ''),tmuxPane: s.tmuxPane || null,terminal: { available: registry.terminalAvailable(s.agentId), primary: s.primaryRuntimeKey, runtimes: s.runtimes },- updatedAt: s.updatedAt,- })),+ // When the conversation last moved, as in every agent frame — not the row's `touchedAt`.+ updatedAt: await lastActivityAt(s),+ }))),pairs: backend.listPairs(),pending: backend.pendingPair(),}),diff --git a/cli/src/hookServer.spec.ts b/cli/src/hookServer.spec.tsindex de2335397..d8556c653 100644--- a/cli/src/hookServer.spec.ts+++ b/cli/src/hookServer.spec.ts@@ -355,6 +355,14 @@ describe('requests must name this server', () => {expect(onLogs).not.toHaveBeenCalled()})+ it('serves a status that has to read before it answers', async () => {+ // A harness's `updatedAt` is when its conversation last moved, which is read from its transcript.+ const { base } = await start({ onStatus: async () => ({ sessions: [{ id: 'a', updatedAt: 42 }] }) })+ const res = await fetch(`${base}/api/status`)+ expect(res.status).toBe(200)+ expect(await res.json()).toEqual({ sessions: [{ id: 'a', updatedAt: 42 }] })+ })+it('still serves loopback names, and the dashboard from its own origin', async () => {const { base } = await start({ onStatus: () => ({ ok: true }) })const port = new URL(base).portdiff --git a/cli/src/hookServer.ts b/cli/src/hookServer.tsindex 9cea48fbc..a74e79988 100644--- a/cli/src/hookServer.ts+++ b/cli/src/hookServer.ts@@ -111,7 +111,7 @@ export interface HookServerHandlers {/** `harness remote-password status` — whether one is set, and its fingerprint. */onRemotePasswordStatus?: () => PairOutcome/** Local dashboard status snapshot (GET /api/status). */- onStatus?: () => Record<string, unknown>+ onStatus?: () => Record<string, unknown> | Promise<Record<string, unknown>>/** Recent adapter log tail (GET /api/logs). */onLogs?: () => string/** Stop the adapter from the local dashboard (POST /api/stop). */@@ -446,7 +446,7 @@ export function startHookServer(res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); res.end(LOCAL_WEB_HTML); return}if (req.method === 'GET' && url === '/api/status') {- json(200, handlers.onStatus ? handlers.onStatus() : { supported: false }); return+ json(200, handlers.onStatus ? await handlers.onStatus() : { supported: false }); return}if (req.method === 'GET' && url === '/api/logs') {res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); res.end(handlers.onLogs ? handlers.onLogs() : ''); returndiff --git a/cli/src/lib/agentFrame.spec.ts b/cli/src/lib/agentFrame.spec.tsindex 4274a8558..a2533bdfe 100644--- a/cli/src/lib/agentFrame.spec.ts+++ b/cli/src/lib/agentFrame.spec.ts@@ -13,7 +13,7 @@ function session(grid: RegisteredSession['grid'], codexHome: RegisteredSession['projectDir: 'tmp', cwd: '/tmp', tmuxPane: '%1', source: null, title: null, model: null,runtimes: [{ backend: 'tmux', paneId: '%1' }], primaryRuntimeKey: 'tmux/%1',cliVersion: '2.1.212', processIdentity: null, gateway: null, grid, codexHome,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}}@@ -110,15 +110,15 @@ describe('agentFrame updatedAt', () => {const context = { selectedModel: null, terminalAvailable: true }const lastHook = Date.UTC(2026, 8, 17, 7)- // The regression: discovery rewrites the registry's `updatedAt` on every pass, so an agent with no+ // The regression: discovery rewrites the registry row's `touchedAt` on every pass, so an agent with no// readable transcript was stamped "now" forever and a phone sorting by recency put it on top.it('follows the last hook without a transcript, never the bookkeeping clock', async () => {- const row = { ...session(null), updatedAt: Date.now(), lastHookAt: lastHook }+ const row = { ...session(null), touchedAt: Date.now(), lastHookAt: lastHook }expect((await agentFrame(row, context)).updatedAt).toBe('2026-09-17T07:00:00.000Z')})it('an unreadable transcript falls back to the last hook too', async () => {- const row = { ...session(null), transcriptPath: '/nonexistent/agent-frame.jsonl', updatedAt: Date.now(), lastHookAt: lastHook }+ const row = { ...session(null), transcriptPath: '/nonexistent/agent-frame.jsonl', touchedAt: Date.now(), lastHookAt: lastHook }expect((await agentFrame(row, context)).updatedAt).toBe('2026-09-17T07:00:00.000Z')})@@ -128,7 +128,7 @@ describe('agentFrame updatedAt', () => {it('falls back to when the agent came into being, never to the epoch', async () => {const bound = Date.UTC(2026, 8, 20, 9)const created = Date.UTC(2026, 8, 19, 8)- const never = { ...session(null), updatedAt: Date.now(), lastHookAt: 0 }+ const never = { ...session(null), touchedAt: Date.now(), lastHookAt: 0 }expect((await agentFrame({ ...never, boundAt: bound, registeredAt: created }, context)).updatedAt).toBe('2026-09-20T09:00:00.000Z')expect((await agentFrame({ ...never, boundAt: null, registeredAt: created }, context)).updatedAt)diff --git a/cli/src/lib/agentFrame.ts b/cli/src/lib/agentFrame.tsindex 14291b228..59e0ef320 100644--- a/cli/src/lib/agentFrame.ts+++ b/cli/src/lib/agentFrame.ts@@ -133,7 +133,7 @@ export interface AgentFrameContext {* When the conversation last moved, in epoch ms: dated work in the transcript, else the last time the engine* reported in (a hook, or a session bind — the agent's creation at the latest).*- * ⚠️ Never the registry's `updatedAt`. That is bookkeeping: discovery rewrites it on every pass+ * ⚠️ Never the registry row's `touchedAt`. That is bookkeeping: discovery rewrites it on every pass* (`updateRuntimes`), so falling back to it stamped every agent without a readable transcript "now"* — and a client sorting by recency put exactly those agents above the ones just used. File mtime is* bookkeeping too: an idle transcript can be rewritten without a new conversation event.diff --git a/cli/src/lib/commandcodeModel.spec.ts b/cli/src/lib/commandcodeModel.spec.tsindex 23c2d0a11..ed9a25099 100644--- a/cli/src/lib/commandcodeModel.spec.ts+++ b/cli/src/lib/commandcodeModel.spec.ts@@ -39,7 +39,7 @@ const session = (): RegisteredSession => ({cliVersion: null,processIdentity: null,registeredAt: 1,- updatedAt: 1,+ touchedAt: 1,lastHookAt: 1,lastTranscriptAt: 1,})diff --git a/cli/src/lib/registry.spec.ts b/cli/src/lib/registry.spec.tsindex ec01fc296..e023afee0 100644--- a/cli/src/lib/registry.spec.ts+++ b/cli/src/lib/registry.spec.ts@@ -271,12 +271,17 @@ describe('registry remote display names', () => {tmuxPane: '%17',runtimes: [{ backend: 'tmux', paneId: '%17' }],schemaVersion: 2,+ // Saved as `updatedAt` before the row's bookkeeping time was named for what it is.+ touchedAt: 20,})- expect(JSON.parse(readFileSync(join(dataDir, 'registry.json'), 'utf8'))[0]).toMatchObject({+ const saved = JSON.parse(readFileSync(join(dataDir, 'registry.json'), 'utf8'))[0]+ expect(saved).toMatchObject({agentId: 'stable-agent',tmuxPane: '%17',runtimes: [{ backend: 'tmux', paneId: '%17' }],+ touchedAt: 20,})+ expect(saved).not.toHaveProperty('updatedAt')expect(JSON.parse(readFileSync(join(dataDir, 'registry.pre-v2.json'), 'utf8'))[0]).toMatchObject({agentId: 'stable-agent', sessionId: 'legacy-session', tmuxPane: '%17',})diff --git a/cli/src/lib/registry.ts b/cli/src/lib/registry.tsindex e8187801e..1702a2f82 100644--- a/cli/src/lib/registry.ts+++ b/cli/src/lib/registry.ts@@ -224,11 +224,21 @@ export interface RegisteredSession {cliVersion: string | nullprocessIdentity: ProcessIdentity | nullregisteredAt: number- updatedAt: number+ /**+ * When the daemon last changed this row: housekeeping (a reconcile pass, an attach, a rename),+ * never when the conversation moved. That is `lastActivityAt` (agentFrame.ts), which is what+ * clients get as `updatedAt`. Rows saved before 2026-09-27 call this `updatedAt` ([savedTouchedAt]).+ */+ touchedAt: numberlastHookAt: numberlastTranscriptAt: number}+/** A saved row's `touchedAt`, which rows saved before 2026-09-27 call `updatedAt`. */+function savedTouchedAt(row: { touchedAt?: unknown; updatedAt?: unknown }): number | null {+ return typeof row.touchedAt === 'number' ? row.touchedAt : typeof row.updatedAt === 'number' ? row.updatedAt : null+}+export interface RegisterInput {engine?: AgentEngine/** Accepted from old hook/plugin payloads for wire compatibility, but deliberately ignored. */@@ -515,7 +525,7 @@ export function strictPersistedRow(value: unknown): RegisteredSession | null {processIdentity: row.processIdentity ?? null,...(row.terminalHost === true || row.engine === 'terminal' ? { terminalHost: true } : {}),registeredAt: typeof row.registeredAt === 'number' ? row.registeredAt : Date.now(),- updatedAt: typeof row.updatedAt === 'number' ? row.updatedAt : Date.now(),+ touchedAt: savedTouchedAt(row) ?? Date.now(),lastHookAt: typeof row.lastHookAt === 'number' ? row.lastHookAt : Date.now(),lastTranscriptAt: typeof row.lastTranscriptAt === 'number' ? row.lastTranscriptAt : Date.now(),}@@ -941,9 +951,9 @@ class Registry {model: modelString(raw.model),processIdentity: !rebooted && validProcessIdentity(raw.processIdentity) ? raw.processIdentity : null,registeredAt: typeof raw.registeredAt === 'number' ? raw.registeredAt : now,- updatedAt: typeof raw.updatedAt === 'number' ? raw.updatedAt : now,- lastHookAt: typeof raw.lastHookAt === 'number' ? raw.lastHookAt : (raw.updatedAt ?? now),- lastTranscriptAt: typeof raw.lastTranscriptAt === 'number' ? raw.lastTranscriptAt : (raw.updatedAt ?? now),+ touchedAt: savedTouchedAt(raw) ?? now,+ lastHookAt: typeof raw.lastHookAt === 'number' ? raw.lastHookAt : (savedTouchedAt(raw) ?? now),+ lastTranscriptAt: typeof raw.lastTranscriptAt === 'number' ? raw.lastTranscriptAt : (savedTouchedAt(raw) ?? now),}if (raw.engine !== engine@@ -1083,7 +1093,7 @@ class Registry {if (input.codexHome && !existing.codexHome) existing.codexHome = input.codexHomeif (input.hermesHome && !existing.hermesHome) existing.hermesHome = input.hermesHomeif (input.dsh && !existing.dsh) existing.dsh = input.dsh- existing.updatedAt = Date.now()+ existing.touchedAt = Date.now()this.index(existing)this.terminalAvailableAgents.add(existing.agentId)this.save()@@ -1142,7 +1152,7 @@ class Registry {cliVersion: null,processIdentity,registeredAt: now,- updatedAt: now,+ touchedAt: now,lastHookAt: now,lastTranscriptAt: now,}@@ -1217,7 +1227,7 @@ class Registry {cliVersion: null,processIdentity: null,registeredAt: now,- updatedAt: now,+ touchedAt: now,lastHookAt: now,lastTranscriptAt: now,}@@ -1245,7 +1255,7 @@ class Registry {runtimes: routes,primaryRuntimeKey: selectedRuntimeKey(routes, ''),tmuxPane: tmuxProjection(routes),- updatedAt: Date.now(),+ touchedAt: Date.now(),}this.index(entry)this.terminalAvailableAgents.add(entry.agentId)@@ -1277,7 +1287,7 @@ class Registry {/*** Upsert a session. Idempotent — a re-register (e.g. from the UserPromptSubmit catch hook) just- * refreshes `updatedAt`. Deduped by tmux pane: one session per pane, so a `/clear` rotation+ * refreshes `touchedAt`. Deduped by tmux pane: one session per pane, so a `/clear` rotation* (SessionEnd of the old id → SessionStart of a new id, same pane) evicts the old one instead of* showing two tiles. Returns { entry, isNew, evicted } — isNew=false on a re-register (so callers* can skip re-announcing), evicted = the sessionId displaced from this pane (caller removes it).@@ -1476,7 +1486,7 @@ class Registry {...(existing?.terminalHost ? { terminalHost: true } : {}),processIdentity: validProcessIdentity(input.processIdentity) ? input.processIdentity : existing?.processIdentity ?? null,registeredAt: existing?.registeredAt ?? now,- updatedAt: now,+ touchedAt: now,lastHookAt: now,lastTranscriptAt: existing?.lastTranscriptAt ?? now,}@@ -1506,7 +1516,7 @@ class Registry {const entry = this.bySession(sessionId)if (!entry) return falsethis.releaseBinding(entry)- entry.updatedAt = Date.now()+ entry.touchedAt = Date.now()this.save()return true}@@ -1573,7 +1583,7 @@ class Registry {entry.launch = { state: 'ready' }entry.active = trueif (validProcessIdentity(processIdentity)) entry.processIdentity = processIdentity- entry.updatedAt = Date.now()+ entry.touchedAt = Date.now()this.index(entry)this.terminalAvailableAgents.add(entry.agentId)this.save()@@ -1619,7 +1629,7 @@ class Registry {entry.subscriptionModel = nullentry.model = nullentry.title = null- entry.updatedAt = Date.now()+ entry.touchedAt = Date.now()this.index(entry)this.terminalAvailableAgents.add(entry.agentId)this.save()@@ -1635,7 +1645,7 @@ class Registry {entry.tmuxPane = tmuxProjection(normalized)entry.primaryRuntimeKey = selectedRuntimeKey(normalized, primaryRuntimeKey)entry.active = true- entry.updatedAt = Date.now()+ entry.touchedAt = Date.now()this.index(entry)this.terminalAvailableAgents.add(entry.agentId)this.save()@@ -1646,7 +1656,7 @@ class Registry {const entry = this.agents.get(agentId)if (!entry || entry.active === active) return !!entryentry.active = active- entry.updatedAt = Date.now()+ entry.touchedAt = Date.now()this.save()return true}@@ -1673,7 +1683,7 @@ class Registry {const before = entry.launchentry.launch = normalizedLaunch(launch)entry.active = launch.state !== 'failed'- entry.updatedAt = Date.now()+ entry.touchedAt = Date.now()this.traceLaunch(agentId, before, entry.launch, `setLaunch${launch.state === 'failed' ? ` (${launch.error})` : ''}`)this.save()return entry@@ -1717,7 +1727,7 @@ class Registry {// The grid is read from the same environment and follows the same rule. It matters most right// after a retarget: the respawned pane is a new pid, and this is where its new grid lands.if (grid !== undefined) session.grid = grid- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.index(session)this.save()return true@@ -1730,7 +1740,7 @@ class Registry {if (!session.processIdentity) return truethis.drop(session)session.processIdentity = null- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.index(session)this.save()return true@@ -1742,7 +1752,7 @@ class Registry {if ((session.bypassPermission === true) === bypassPermission) return trueif (bypassPermission) session.bypassPermission = trueelse delete session.bypassPermission- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1756,7 +1766,7 @@ class Registry {if (!session || !permissionModeName(permissionMode)) return falseif (session.permissionMode) return session.permissionMode === permissionModesession.permissionMode = permissionMode- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1769,7 +1779,7 @@ class Registry {const session = this.agents.get(agentId)if (!session || session.cwd === cwd) return falsesession.cwd = cwd- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1778,7 +1788,7 @@ class Registry {const session = this.agents.get(agentId)if (!session || session.engine !== 'codex' || session.codexHome) return falsesession.codexHome = codexHome- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1790,7 +1800,7 @@ class Registry {const session = this.agents.get(agentId)if (!session || session.engine !== 'hermes' || session.hermesHome) return falsesession.hermesHome = hermesHome- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1801,7 +1811,7 @@ class Registry {const session = this.agents.get(agentId)if (!session || session.dsh || !DSH_ID_RE.test(dsh)) return falsesession.dsh = dsh- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1817,7 +1827,7 @@ class Registry {if (!session) return falsesession.gridLaunch = launch?.override ?? nullsession.gridWebSearch = launch?.webSearch ?? null- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1828,7 +1838,7 @@ class Registry {const session = this.agents.get(agentId)if (!session) return falsesession.subscriptionModel = model- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return true}@@ -1837,7 +1847,7 @@ class Registry {const session = this.bySession(sessionId)if (!session) return falsesession.lastTranscriptAt = at- session.updatedAt = Math.max(session.updatedAt, at)+ session.touchedAt = Math.max(session.touchedAt, at)this.save()return true}@@ -1849,7 +1859,7 @@ class Registry {const current = titleDisplayName(session.title)if (next === current) return sessionsession.title = next- session.updatedAt = Date.now()+ session.touchedAt = Date.now()this.save()return session}diff --git a/cli/src/lib/restoreAgents.spec.ts b/cli/src/lib/restoreAgents.spec.tsindex 654f59202..6829d7448 100644--- a/cli/src/lib/restoreAgents.spec.ts+++ b/cli/src/lib/restoreAgents.spec.ts@@ -34,7 +34,7 @@ function row(overrides: Partial<RegisteredSession> = {}): RegisteredSession {cliVersion: null,processIdentity: null,registeredAt: 1,- updatedAt: 1,+ touchedAt: 1,lastHookAt: 1,lastTranscriptAt: 1,...overrides,diff --git a/cli/src/lib/retainExitedSession.spec.ts b/cli/src/lib/retainExitedSession.spec.tsindex 6ab6b704b..c229fb67c 100644--- a/cli/src/lib/retainExitedSession.spec.ts+++ b/cli/src/lib/retainExitedSession.spec.ts@@ -8,7 +8,7 @@ const row = (over: Partial<RegisteredSession> = {}): RegisteredSession => ({defaultName: 'harness Desktop', transcriptPath: '/tmp/rollout.jsonl', projectDir: 'demo',cwd: '/tmp/demo', runtimes: [{ backend: 'tmux', paneId: '%7' }], primaryRuntimeKey: 'tmux\u0000%7',tmuxPane: '%7', source: null, title: null, model: null, cliVersion: null, codexHome: null,- dsh: null, agent: null, processIdentity: null, registeredAt: 1, updatedAt: 1, lastHookAt: 1,+ dsh: null, agent: null, processIdentity: null, registeredAt: 1, touchedAt: 1, lastHookAt: 1,lastTranscriptAt: 1, ...over,} as RegisteredSession)diff --git a/cli/src/lib/runtimeProfile.spec.ts b/cli/src/lib/runtimeProfile.spec.tsindex 9e524c40b..9324a60bc 100644--- a/cli/src/lib/runtimeProfile.spec.ts+++ b/cli/src/lib/runtimeProfile.spec.ts@@ -26,7 +26,7 @@ function session(engine: RegisteredSession['engine']): RegisteredSession {tmuxPane: '%1', source: null, title: null, model: null,runtimes: [{ backend: 'tmux', paneId: '%1' }], primaryRuntimeKey: 'tmux\u0000%1',cliVersion: engine === 'codex' ? '0.144.5' : engine === 'cursor' ? '2026.07.20-8cc9c0b' : '2.1.212', processIdentity: null,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}}diff --git a/cli/src/lib/runtimeProfileController.spec.ts b/cli/src/lib/runtimeProfileController.spec.tsindex ef5c32cac..6a3b8e473 100644--- a/cli/src/lib/runtimeProfileController.spec.ts+++ b/cli/src/lib/runtimeProfileController.spec.ts@@ -22,7 +22,7 @@ function session(engine: 'claude' | 'codex' | 'cursor' | 'opencode'): RegisteredtmuxPane: '%1', source: null, title: null, model: null,runtimes: [{ backend: 'tmux', paneId: '%1' }], primaryRuntimeKey: 'tmux\u0000%1',cliVersion: engine === 'codex' ? '0.144.5' : engine === 'cursor' ? '2026.07.20-8cc9c0b' : engine === 'opencode' ? '1.18.31' : '2.1.212', processIdentity: null,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}}diff --git a/cli/src/lib/sessionInput.spec.ts b/cli/src/lib/sessionInput.spec.tsindex ed808c98a..97a62d710 100644--- a/cli/src/lib/sessionInput.spec.ts+++ b/cli/src/lib/sessionInput.spec.ts@@ -10,7 +10,7 @@ function session(engine: 'claude' | 'codex' | 'cursor' | 'commandcode' = 'codex'sessionId: 's1', engine, launcherId: 'h1', agentId: 'h1', boundAt: 0, transcriptPath: '/tmp/s1.jsonl', projectDir: 'tmp', cwd: '/tmp',tmuxPane: '%1', source: null, title: null, model: null, cliVersion: null, processIdentity: null,runtimes: [{ backend: 'tmux', paneId: '%1' }], primaryRuntimeKey: 'tmux\u0000%1',- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}}diff --git a/cli/src/lib/sessionSearch/indexer.spec.ts b/cli/src/lib/sessionSearch/indexer.spec.tsindex bd7e01e53..37672a97a 100644--- a/cli/src/lib/sessionSearch/indexer.spec.ts+++ b/cli/src/lib/sessionSearch/indexer.spec.ts@@ -26,7 +26,7 @@ function setup(initial: string, agents?: () => string[]) {const path = join(dir, 's1.jsonl')writeFileSync(path, initial)const store = SessionSearchStore.open(':memory:')!- let sources: SearchSource[] = [{ agentId: 'agent-1', sessionId: 's1', engine: 'claude', transcriptPath: path, header: 'Dial firmware · harness', updatedAt: 1 }]+ let sources: SearchSource[] = [{ agentId: 'agent-1', sessionId: 's1', engine: 'claude', transcriptPath: path, header: 'Dial firmware · harness', changedAt: 1 }]const index = new SessionSearchIndex({ store, sources: () => sources, agents, touchDelayMs: 5 })cleanups.push(() => { index.stop(); store.close() })const found = (query: string) => index.search(query).hits.map((hit) => hit.sessionId)@@ -77,7 +77,7 @@ describe('SessionSearchIndex', () => {expect(store.session('s1')!.size).toBe(store.session('s1')!.resumeOffset)write.mockRestore()- const resumed = new SessionSearchIndex({ store, sources: () => [{ agentId: 'agent-1', sessionId: 's1', engine: 'claude', transcriptPath: store.session('s1')!.path, header: 'Dial firmware · harness', updatedAt: 1 }] })+ const resumed = new SessionSearchIndex({ store, sources: () => [{ agentId: 'agent-1', sessionId: 's1', engine: 'claude', transcriptPath: store.session('s1')!.path, header: 'Dial firmware · harness', changedAt: 1 }] })cleanups.push(() => resumed.stop())resumed.sweep()await vi.waitFor(() => { expect((resumed as unknown as { running: boolean }).running).toBe(false) })@@ -111,8 +111,8 @@ describe('SessionSearchIndex', () => {const store = SessionSearchStore.open(':memory:')!const open = new Map([['e1', 'terminal' as const]])let sources: SearchSource[] = [- { agentId: '', sessionId: 'e1', engine: 'claude', transcriptPath: claudeFile, header: '', updatedAt: 2, external: { cwd: '/work/dial', origin: 'terminal', title: '' } },- { agentId: '', sessionId: 'e2', engine: 'claude', transcriptPath: untitledFile, header: '', updatedAt: 1, external: { cwd: '/work/cohorts', origin: 'claude-app', title: '' } },+ { agentId: '', sessionId: 'e1', engine: 'claude', transcriptPath: claudeFile, header: '', changedAt: 2, external: { cwd: '/work/dial', origin: 'terminal', title: '' } },+ { agentId: '', sessionId: 'e2', engine: 'claude', transcriptPath: untitledFile, header: '', changedAt: 1, external: { cwd: '/work/cohorts', origin: 'claude-app', title: '' } },]const index = new SessionSearchIndex({store, sources: () => sources, agents: () => [],@@ -153,14 +153,14 @@ describe('SessionSearchIndex', () => {it('updates the name without rereading the transcript, and forgets sessions of deleted agents', async () => {const { store, found, settle, setSources, path } = setup(prompt('flash it', 0))await settle()- setSources([{ agentId: 'agent-1', sessionId: 's1', engine: 'claude', transcriptPath: path, header: 'Keyboard firmware', updatedAt: 2 }])+ setSources([{ agentId: 'agent-1', sessionId: 's1', engine: 'claude', transcriptPath: path, header: 'Keyboard firmware', changedAt: 2 }])await settle()expect(found('keyboard')).toEqual(['s1'])expect(found('dial')).toEqual([])expect(store.session('s1')!.turns).toBe(1)// An agent's earlier session (before a /clear) stays while the agent does…- setSources([{ agentId: 'agent-1', sessionId: 's2', engine: 'terminal', transcriptPath: null, header: 'Keyboard firmware', updatedAt: 3 }])+ setSources([{ agentId: 'agent-1', sessionId: 's2', engine: 'terminal', transcriptPath: null, header: 'Keyboard firmware', changedAt: 3 }])await settle()expect(found('flash')).toEqual(['s1'])// …and goes with it.@@ -189,7 +189,7 @@ describe('SessionSearchIndex', () => {]let source: SearchSource = {agentId: 'agent-oc', sessionId: 'ses_1', engine: 'opencode', transcriptPath: null, header: 'OpenCode harness',- updatedAt: 100, readHistory: async () => { reads++; return history },+ changedAt: 100, readHistory: async () => { reads++; return history },}const index = new SessionSearchIndex({ store, sources: () => [source], touchDelayMs: 5 })cleanups.push(() => { index.stop(); store.close() })@@ -225,7 +225,7 @@ describe('SessionSearchIndex', () => {// A turn whose event was lost (the daemon restarted first): its activity stamp moved, so the// next sweep reads it, and dates it by that stamp.history = [...history, { type: 'user_message', payload: { content: 'archive the old builds' } }]- source = { ...source, updatedAt: 5_000 }+ source = { ...source, changedAt: 5_000 }const restarted = new SessionSearchIndex({ store, sources: () => [source] })cleanups.push(() => restarted.stop())restarted.sweep()diff --git a/cli/src/lib/sessionSearch/indexer.ts b/cli/src/lib/sessionSearch/indexer.tsindex eb6d90791..e5f5587df 100644--- a/cli/src/lib/sessionSearch/indexer.ts+++ b/cli/src/lib/sessionSearch/indexer.ts@@ -31,7 +31,7 @@ export interface SearchSource {* registry's bookkeeping time. Newest sessions are indexed first, and a database-backed history* is read again when this moves.*/- updatedAt: number+ changedAt: number/*** The whole history, for an engine that keeps it in a database rather than a transcript file* (OpenCode, Kilo, Hermes, Devin). Read in full when the session changed: there is no offset to@@ -201,7 +201,7 @@ export class SessionSearchIndex {const indexed = this.opts.store.session(sessionId)if (indexed && !agents.has(indexed.agentId) && !this.sources.has(sessionId)) this.opts.store.removeSession(sessionId)}- const newest = [...this.sources.values()].sort((a, b) => b.updatedAt - a.updatedAt)+ const newest = [...this.sources.values()].sort((a, b) => b.changedAt - a.changedAt)for (const source of newest) this.queue.add(source.sessionId)void this.drain()}@@ -305,7 +305,7 @@ export class SessionSearchIndex {if (!source.sessionId) continueconst known = next.get(source.sessionId)// One session can be listed live and stopped at once: the fresher record wins.- if (!known || source.updatedAt > known.updatedAt) next.set(source.sessionId, source)+ if (!known || source.changedAt > known.changedAt) next.set(source.sessionId, source)}this.sources = nextthis.sourcesReadAt = Date.now()@@ -329,7 +329,7 @@ export class SessionSearchIndex {path: existing?.path ?? source.transcriptPath ?? '', header,size: existing?.size ?? 0, mtime: existing?.mtime ?? 0,resumeOffset: existing?.resumeOffset ?? 0, resumeTurn: existing?.resumeTurn ?? 0,- lastAt: existing?.lastAt ?? (source.updatedAt || null), turns: 0,+ lastAt: existing?.lastAt ?? (source.changedAt || null), turns: 0,...externalFields(source, knownTitle),}, NO_TURN_DELETE, [])return@@ -402,7 +402,7 @@ export class SessionSearchIndex {*/private async historyPass(source: SearchSource, existing: IndexedSession | undefined, dirty: boolean): Promise<void> {const store = this.opts.store- const stamp = source.updatedAt+ const stamp = source.changedAtif (existing && !dirty && existing.mtime === stamp) {if (existing.header !== source.header || existing.agentId !== source.agentId) {store.writeSession({ ...existing, header: source.header, agentId: source.agentId }, NO_TURN_DELETE, [])diff --git a/cli/src/lib/stoppedAgents.spec.ts b/cli/src/lib/stoppedAgents.spec.tsindex b743f4481..fd38e5ab6 100644--- a/cli/src/lib/stoppedAgents.spec.ts+++ b/cli/src/lib/stoppedAgents.spec.ts@@ -47,7 +47,7 @@ describe('stopped harness persistence', () => {expect(store.patch(saved.agentId, { cwd: '/tmp/work-repaired' })).toBe(true)const after = store.get(saved.agentId)!expect(after).toEqual({ ...before, cwd: '/tmp/work-repaired' })- expect(after.updatedAt).toBe(before.updatedAt)+ expect(after.touchedAt).toBe(before.touchedAt)expect(after.defaultName).toBe('harness Desktop')expect(store.patch('never-saved', { cwd: '/tmp' })).toBe(false)})diff --git a/cli/src/lib/stoppedAgents.ts b/cli/src/lib/stoppedAgents.tsindex 2f62ea23c..c209ddb62 100644--- a/cli/src/lib/stoppedAgents.ts+++ b/cli/src/lib/stoppedAgents.ts@@ -66,7 +66,7 @@ export class StoppedAgentStore {active: false,launch: { state: 'ready' },defaultName: projectDisplayName(session),- updatedAt: Date.now(),+ touchedAt: Date.now(),}// Herdr-only snapshots omit the legacy alias just like registry persistence.if (!snapshot.tmuxPane) delete (snapshot as Partial<RegisteredSession>).tmuxPane@@ -74,7 +74,7 @@ export class StoppedAgentStore {}/** Correct one field of an archive in place — the folder a Claude row drifted out of (cwdRepair.ts).- * Not `save`: that recomputes the name and stamps `updatedAt`, and a repair must not reorder the+ * Not `save`: that recomputes the name and stamps `touchedAt`, and a repair must not reorder the* catalog or rename anything. Nothing else on the row changes. */patch(agentId: string, patch: Partial<Pick<RegisteredSession, 'cwd'>>): boolean {const saved = this.get(agentId)diff --git a/cli/src/lib/terminalAgentReconciler.spec.ts b/cli/src/lib/terminalAgentReconciler.spec.tsindex 51c878840..4c63134c0 100644--- a/cli/src/lib/terminalAgentReconciler.spec.ts+++ b/cli/src/lib/terminalAgentReconciler.spec.ts@@ -18,7 +18,7 @@ function session(runtimes: TerminalRuntimeRef[] = [tmux]): RegisteredSession {transcriptPath: null, projectDir: 'work', cwd: '/work', runtimes,primaryRuntimeKey: terminalRouteKey(runtimes[0]), tmuxPane: runtimes.find((runtime) => runtime.backend === 'tmux')?.paneId ?? '',source: null, title: null, model: null, cliVersion: null, processIdentity: identity,- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}}diff --git a/cli/src/lib/terminalBackendCoordinator.spec.ts b/cli/src/lib/terminalBackendCoordinator.spec.tsindex ee124b203..cb09ecf71 100644--- a/cli/src/lib/terminalBackendCoordinator.spec.ts+++ b/cli/src/lib/terminalBackendCoordinator.spec.ts@@ -16,7 +16,7 @@ function session(): RegisteredSession {projectDir: 'work', cwd: '/work', runtimes: [tmux, herdr], primaryRuntimeKey: terminalRouteKey(tmux), tmuxPane: '%1',source: null, title: null, model: null, cliVersion: null,processIdentity: { pid: 42, executable: 'claude', startMarker: 'Sat Aug 15 10:00:00 2026' },- registeredAt: 1, updatedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1,}}diff --git a/cli/src/lib/terminalStreamManager.spec.ts b/cli/src/lib/terminalStreamManager.spec.tsindex 509cb7089..0ad98da38 100644--- a/cli/src/lib/terminalStreamManager.spec.ts+++ b/cli/src/lib/terminalStreamManager.spec.ts@@ -59,7 +59,7 @@ class FakeStream implements TerminalStreamHandle {function session(engine: string = 'codex', agentId = 'agent-1'): RegisteredSession {return {agentId, sessionId: `session-${agentId}`, engine, active: true,- registeredAt: Date.now(), updatedAt: Date.now(), runtimes: [{ backend: 'tmux', paneId: '%1' }],+ registeredAt: Date.now(), touchedAt: Date.now(), runtimes: [{ backend: 'tmux', paneId: '%1' }],primaryRuntimeKey: 'tmux:default:%1',} as unknown as RegisteredSession}diff --git a/cli/src/lib/tmuxAgentDiscovery.spec.ts b/cli/src/lib/tmuxAgentDiscovery.spec.tsindex 5441bae17..30cb34688 100644--- a/cli/src/lib/tmuxAgentDiscovery.spec.ts+++ b/cli/src/lib/tmuxAgentDiscovery.spec.ts@@ -340,7 +340,7 @@ function registered(agent: DiscoveredTmuxAgent, agentId = 'agent-1'): RegisteredcliVersion: null,processIdentity: agent.processIdentity,registeredAt: 1,- updatedAt: 1,+ touchedAt: 1,lastHookAt: 1,lastTranscriptAt: 1,}diff --git a/cli/src/lib/tmuxStream.real.spec.ts b/cli/src/lib/tmuxStream.real.spec.tsindex dfbb0b691..f929a2df9 100644--- a/cli/src/lib/tmuxStream.real.spec.ts+++ b/cli/src/lib/tmuxStream.real.spec.ts@@ -172,7 +172,7 @@ run('TmuxControlStream real tmux', () => {engine,active: true,registeredAt: Date.now(),- updatedAt: Date.now(),+ touchedAt: Date.now(),runtimes: [{ backend: 'tmux', paneId }],primaryRuntimeKey: `tmux:default:${paneId}`,} as unknown as RegisteredSession