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
Fix engine store paths and restore desktop test coverage (#399)
Dee56651674170a
diff --git a/cli/hook/notify.mjs b/cli/hook/notify.mjsindex 3c4a1904a..284712df0 100644--- a/cli/hook/notify.mjs+++ b/cli/hook/notify.mjs@@ -111,7 +111,7 @@ function paths() {const claudeProjectsDir = argValue('--claude-projects-dir', process.env.CLAUDE_PROJECTS_DIR || join(homedir(), '.claude', 'projects'))const codexHome = argValue('--codex-home', process.env.CODEX_HOME || join(homedir(), '.codex'))const grokHome = argValue('--grok-home', process.env.GROK_HOME || join(homedir(), '.grok'))- const cursorHome = argValue('--cursor-home', process.env.CURSOR_HOME || join(homedir(), '.cursor'))+ const cursorHome = process.env.CURSOR_DATA_DIR?.trim() || argValue('--cursor-home', process.env.CURSOR_HOME || join(homedir(), '.cursor'))const hermesHome = argValue('--hermes-home', process.env.HERMES_HOME || join(homedir(), '.hermes'))const commandcodeHome = argValue('--commandcode-home', process.env.COMMANDCODE_HOME || join(homedir(), '.commandcode'))const devinHome = argValue('--devin-home', process.env.DEVIN_HOME || join(homedir(), '.local', 'share', 'devin', 'cli'))@@ -803,7 +803,7 @@ async function hermesTopLevelSession(dbPath, sessionId) {const rows = JSON.parse(raw.trim() || '[]')if (!Array.isArray(rows) || rows.length === 0) continueconst source = typeof rows[0]?.source === 'string' ? rows[0].source : ''- return (source === '' || source === 'cli') ? db : false+ return (source === '' || source === 'cli' || source === 'tui') ? db : false} catch {return false}diff --git a/cli/package-lock.json b/cli/package-lock.jsonindex 069a5855b..e9379644d 100644--- a/cli/package-lock.json+++ b/cli/package-lock.json@@ -12,6 +12,7 @@"@noble/ciphers": "^1.3.0","@noble/curves": "^1.9.7","@noble/hashes": "^1.8.0",+ "@sindresorhus/slugify": "2.2.1","bonjour-service": "^1.4.4","chokidar": "^4.0.0","dotenv": "^17.2.3",@@ -1159,6 +1160,37 @@"node": ">=6"}},+ "node_modules/@sindresorhus/slugify": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz",+ "integrity": "sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==",+ "license": "MIT",+ "dependencies": {+ "@sindresorhus/transliterate": "^1.0.0",+ "escape-string-regexp": "^5.0.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/@sindresorhus/transliterate": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-1.6.0.tgz",+ "integrity": "sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==",+ "license": "MIT",+ "dependencies": {+ "escape-string-regexp": "^5.0.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/@standard-schema/spec": {"version": "1.1.0","resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",@@ -1603,6 +1635,18 @@"@esbuild/win32-x64": "0.27.7"}},+ "node_modules/escape-string-regexp": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",+ "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/estree-walker": {"version": "3.0.3","resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",diff --git a/cli/package.json b/cli/package.jsonindex d05090cec..a47e3398f 100644--- a/cli/package.json+++ b/cli/package.json@@ -29,6 +29,7 @@"@noble/ciphers": "^1.3.0","@noble/curves": "^1.9.7","@noble/hashes": "^1.8.0",+ "@sindresorhus/slugify": "2.2.1","bonjour-service": "^1.4.4","chokidar": "^4.0.0","dotenv": "^17.2.3",diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.tsindex a7a79ab1a..0b0f3c85a 100644--- a/cli/src/backendSocket.ts+++ b/cli/src/backendSocket.ts@@ -79,6 +79,7 @@ import { codexMessagesToEvents, windowCodexLines } from './engines/codex/normaliimport { codexSubagentResolverFor } from './engines/codex/subagent.js'import { parseHostTheme, type HostTheme } from './lib/hostTheme.js'import { cursorMessagesToEvents, windowCursorLines } from './engines/cursor/normalizer.js'+import { cursorConfigDir, cursorDataDir } from './engines/cursor/home.js'import { loadCursorReplayTaskLinks } from './engines/cursor/subagent.js'import { opencodeMessagesToEvents, windowOpencodeMessages } from './engines/opencode/normalizer.js'import { kiloMessagesToEvents, windowKiloMessages } from './engines/kilo/normalizer.js'@@ -1887,7 +1888,7 @@ export class BackendSocket {const fullEvents = s.engine === 'codex'? codexMessagesToEvents(lines, codexSubagentResolverFor(s.codexHome)): s.engine === 'cursor'- ? cursorMessagesToEvents(lines, sessionId, await loadCursorReplayTaskLinks(env.CURSOR_HOME, sessionId))+ ? cursorMessagesToEvents(lines, sessionId, await loadCursorReplayTaskLinks(cursorConfigDir(), sessionId, cursorDataDir())): s.engine === 'muse'? museMessagesToEvents(lines): s.engine === 'amp'@@ -1963,7 +1964,7 @@ export class BackendSocket {? cursorMessagesToEvents(w.window,sessionId,- await loadCursorReplayTaskLinks(env.CURSOR_HOME, sessionId),+ await loadCursorReplayTaskLinks(cursorConfigDir(), sessionId, cursorDataDir()),'startIndex' in w && typeof w.startIndex === 'number' ? w.startIndex : 0,'initialTodos' in w && Array.isArray(w.initialTodos) ? w.initialTodos : [],)diff --git a/cli/src/cli.ts b/cli/src/cli.tsindex 7218a5e79..71f7a660b 100644--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@ -200,6 +200,7 @@ import { CodexNormalizer, codexTaskError, lastCodexTurnText } from './engines/coimport { codexSubagentResolverFor } from './engines/codex/subagent.js'import { CursorNormalizer, lastCursorTurnText } from './engines/cursor/normalizer.js'import { CursorTranscriptDiscovery, findCursorTranscript } from './engines/cursor/discovery.js'+import { cursorConfigDir, cursorDataDir } from './engines/cursor/home.js'import { CursorSubagentManager } from './engines/cursor/subagent.js'import { CursorTaskHookQueue } from './engines/cursor/taskHookQueue.js'import { loadCursorPendingTasks, removeCursorPendingTasks } from './engines/cursor/pendingTasks.js'@@ -2214,7 +2215,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {payload: { kind: 'error', text: deviceErrorText(deviceMessage, engine) },})}- const cursorDiscovery = new CursorTranscriptDiscovery(env.CURSOR_HOME, (sessionId, transcriptPath) => {+ const cursorDiscovery = new CursorTranscriptDiscovery(cursorDataDir(), (sessionId, transcriptPath) => {const existing = registry.bySession(sessionId)if (!existing || existing.engine !== 'cursor' || existing.transcriptPath === transcriptPath) returnconst result = registry.register({@@ -3028,7 +3029,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {if (!opts?.replay) autonomousDeviceService?.stream(agentIdFor(sessionId), events)}for (const queued of queuedSessionEvents.splice(0)) emitSessionEvents(queued.sessionId, queued.events, queued.opts)- const cursorSubagents = new CursorSubagentManager(env.CURSOR_HOME, emitSessionEvents)+ const cursorSubagents = new CursorSubagentManager(cursorConfigDir(), emitSessionEvents, cursorDataDir())const cursorTaskHooks = new CursorTaskHookQueue({drainTranscript: (sessionId) => watcher.pollSession(sessionId),emit: emitSessionEvents,@@ -3312,7 +3313,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {if (Number.isFinite(ownerStarted) && (!Number.isFinite(observedStarted) || observedStarted <= ownerStarted)) return}transcriptPath = observed.engine === 'cursor'- ? await findCursorTranscript(env.CURSOR_HOME, sessionId) ?? undefined+ ? await findCursorTranscript(cursorDataDir(), sessionId) ?? undefined: observed.engine === 'grok'? await findGrokTranscript(env.GROK_HOME, observed.cwd, sessionId) ?? undefined: observed.engine === 'agy'diff --git a/cli/src/config/env.ts b/cli/src/config/env.tsindex f73fd84b7..1f0673ce6 100644--- a/cli/src/config/env.ts+++ b/cli/src/config/env.ts@@ -156,8 +156,8 @@ const envSchema = z.object({// <COPILOT_HOME>/session-state/<sessionId>/events.jsonl, and hooks are read from// <COPILOT_HOME>/hooks/*.json — a directory, so Harness drops in its own file.COPILOT_HOME: z.string().default(join(homedir(), '.copilot')),- // Cursor state root. Interactive transcripts live below <CURSOR_HOME>/projects and local- // subagent linkage metadata lives below <CURSOR_HOME>/chats.+ // Legacy Cursor fallback. cursor/home.ts resolves its distinct config (chats/hooks) and data+ // (projects/transcripts) roots using CURSOR_CONFIG_DIR, XDG_CONFIG_HOME and CURSOR_DATA_DIR.CURSOR_HOME: z.string().default(join(homedir(), '.cursor')),// OpenCode state root — the SQLite store lives at <OPENCODE_DATA_DIR>/opencode.db (honors// XDG_DATA_HOME). Sessions are polled from that DB (no per-session transcript file).diff --git a/cli/src/engines/commandcode/transcript.spec.ts b/cli/src/engines/commandcode/transcript.spec.tsindex 4c2ec8087..0e24f97a7 100644--- a/cli/src/engines/commandcode/transcript.spec.ts+++ b/cli/src/engines/commandcode/transcript.spec.ts@@ -28,6 +28,15 @@ describe('the Command Code transcript layout', () => {expect(commandcodeTranscriptPath('', 'abc')).toBeNull()expect(commandcodeTranscriptPath(null, 'abc')).toBeNull()expect(commandcodeTranscriptPath('/Users/me/Work/App', '')).toBeNull()- expect(commandcodeTranscriptPath('///', 'abc')).toBeNull() // slug collapses to nothing+ })++ it.each([+ ['/Users/me/myProject/HTTPServer', 'users-me-my-project-http-server'],+ ['/Users/José/Über Café', 'users-jose-ueber-cafe'],+ ['/work/R&D', 'work-r-and-d'],+ ['/', 'root'],+ ])('matches the vendor slug for %s', (cwd, expected) => {+ expect(commandcodeProjectSlug(cwd)).toBe(expected)+ expect(commandcodeTranscriptPath(cwd, 'session-1')).toContain(`/projects/${expected}/session-1.jsonl`)})})diff --git a/cli/src/engines/commandcode/transcript.ts b/cli/src/engines/commandcode/transcript.tsindex 9c4470e63..66e882ecc 100644--- a/cli/src/engines/commandcode/transcript.ts+++ b/cli/src/engines/commandcode/transcript.ts@@ -1,4 +1,5 @@import { join } from 'path'+import slugify from '@sindresorhus/slugify'import { env } from '../../config/env.js'/**@@ -6,9 +7,8 @@ import { env } from '../../config/env.js'** <COMMANDCODE_HOME>/projects/<cwd slug>/<sessionId>.jsonl*- * where the slug is the working directory lowercased with every run of non-alphanumerics collapsed to a- * dash ("/Users/me/Working/Tmux/Agent-6" → "users-me-working-tmux-agent-6", and "/Users/me/.harness/cli"- * → "users-me-machine-cli").+ * Command Code 1.66.0 uses @sindresorhus/slugify with its defaults and falls back to "root". This+ * splits camelCase and acronyms and transliterates Unicode; simply replacing punctuation loses paths.** Deriving it matters because the CLI fires SessionStart BEFORE the file exists, and a path that is not on* disk fails the registry's realpath check — so the path used to arrive only with the first Stop hook, i.e.@@ -17,7 +17,7 @@ import { env } from '../../config/env.js'* accept this message" and produced no recap.*/export function commandcodeProjectSlug(cwd: string): string {- return cwd.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '')+ return slugify(cwd) || 'root'}/** null when there is not enough to build a path, or when either part could escape the projects root. */diff --git a/cli/src/engines/cursor/home.spec.ts b/cli/src/engines/cursor/home.spec.tsnew file mode 100644index 000000000..aa0ee3718--- /dev/null+++ b/cli/src/engines/cursor/home.spec.ts@@ -0,0 +1,89 @@+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { cursorConfigDir, cursorDataDir } from './home.js'+import { CursorTranscriptDiscovery } from './discovery.js'+import { loadCursorReplayTaskLinks } from './subagent.js'+import { cleanupCursorOneShotSession } from '../../lib/oneshot.js'+import { builtinSqlite } from '../../lib/sqliteRead.js'++const parent = 'aaaaaaaa-1111-4222-8333-444444444444'+const child = 'bbbbbbbb-1111-4222-8333-444444444444'+let root = ''+let config = ''+let data = ''++beforeEach(() => {+ root = mkdtempSync(join(tmpdir(), 'cursor-split-'))+ config = join(root, 'config')+ data = join(root, 'data')+ vi.stubEnv('CURSOR_CONFIG_DIR', config)+ vi.stubEnv('CURSOR_DATA_DIR', data)+})+afterEach(() => {+ vi.unstubAllEnvs()+ rmSync(root, { recursive: true, force: true })+})++function transcript(id: string): string {+ const dir = join(data, 'projects', 'project', 'agent-transcripts', id)+ mkdirSync(dir, { recursive: true })+ const file = join(dir, `${id}.jsonl`)+ writeFileSync(file, [+ { role: 'user', message: { content: [{ type: 'text', text: 'Find the bug' }] } },+ { role: 'assistant', message: { content: [{ type: 'text', text: 'Found it' }] } },+ { type: 'turn_ended', status: 'success' },+ ].map((line) => JSON.stringify(line)).join('\n'))+ return file+}++describe('Cursor with separate config and data directories', () => {+ it('honors explicit config first, then XDG, independently of the transcript root', () => {+ expect(cursorConfigDir({ CURSOR_CONFIG_DIR: ' /explicit ', XDG_CONFIG_HOME: '/xdg' })).toBe('/explicit')+ expect(cursorConfigDir({ CURSOR_CONFIG_DIR: ' ', XDG_CONFIG_HOME: '/xdg' })).toBe('/xdg/cursor')+ expect(cursorDataDir()).toBe(data)+ })++ it('discovers and validates a transcript under the data root', async () => {+ const file = transcript(child)+ const found = vi.fn()+ const discovery = new CursorTranscriptDiscovery(cursorDataDir(), found)+ await discovery.start()+ try {+ await discovery.add(child)+ expect(found).toHaveBeenCalledWith(child, file)+ } finally { await discovery.stop() }+ })++ it.skipIf(!builtinSqlite())('joins subagent metadata in config to the completed transcript in data', async () => {+ for (const id of [parent, child]) {+ const dir = join(config, 'chats', 'workspace', id)+ mkdirSync(dir, { recursive: true })+ const meta = Buffer.from(JSON.stringify({ agentId: id,+ subagentInfo: { parentAgentId: parent, toolCallId: 'task-1' },+ })).toString('hex')+ const db = new (builtinSqlite()!)(join(dir, 'store.db'), { readOnly: false })+ try {+ db.exec(`CREATE TABLE meta(key TEXT, value TEXT); INSERT INTO meta VALUES('0','${meta}');`)+ } finally { db.close() }+ }+ transcript(child)+ const links = await loadCursorReplayTaskLinks(cursorConfigDir(), parent, cursorDataDir())+ expect(links).toMatchObject([{ agentId: child, toolUseId: 'task-1', prompt: 'Find the bug', output: 'Found it' }])+ })++ it('cleans the recap in both roots and preserves another conversation', async () => {+ const recap = transcript(child)+ const other = transcript(parent)+ const chat = join(config, 'chats', 'workspace', child)+ const otherChat = join(config, 'chats', 'workspace', parent)+ mkdirSync(chat, { recursive: true })+ mkdirSync(otherChat, { recursive: true })+ await cleanupCursorOneShotSession(child)+ expect(existsSync(recap)).toBe(false)+ expect(existsSync(chat)).toBe(false)+ expect(existsSync(other)).toBe(true)+ expect(existsSync(otherChat)).toBe(true)+ })+})diff --git a/cli/src/engines/cursor/home.ts b/cli/src/engines/cursor/home.tsnew file mode 100644index 000000000..dda2c02e2--- /dev/null+++ b/cli/src/engines/cursor/home.ts@@ -0,0 +1,13 @@+import { join } from 'node:path'+import { env } from '../../config/env.js'++/** Cursor's hooks and chat databases follow its config root, which can differ from its data root. */+export function cursorConfigDir(vars: NodeJS.ProcessEnv = process.env): string {+ return vars.CURSOR_CONFIG_DIR?.trim()+ || (vars.XDG_CONFIG_HOME?.trim() ? join(vars.XDG_CONFIG_HOME.trim(), 'cursor') : env.CURSOR_HOME)+}++/** Agent transcripts live under projects in Cursor's data root. */+export function cursorDataDir(vars: NodeJS.ProcessEnv = process.env): string {+ return vars.CURSOR_DATA_DIR?.trim() || env.CURSOR_HOME+}diff --git a/cli/src/engines/cursor/subagent.ts b/cli/src/engines/cursor/subagent.tsindex 3f457b051..9467ad0ba 100644--- a/cli/src/engines/cursor/subagent.ts+++ b/cli/src/engines/cursor/subagent.ts@@ -199,12 +199,13 @@ async function childCompletion(}export async function loadCursorReplayTaskLinks(- cursorHome: string,+ configDir: string,parentId: string,+ dataDir: string = configDir,): Promise<CursorReplayTaskLink[]> {const links: CursorReplayTaskLink[] = []- for (const meta of await childMetas(cursorHome, parentId)) {- const completion = await childCompletion(cursorHome, meta)+ for (const meta of await childMetas(configDir, parentId)) {+ const completion = await childCompletion(dataDir, meta)if (!completion) continuelinks.push({...completion,@@ -219,8 +220,9 @@ export class CursorSubagentManager {private readonly pending = new Map<string, PendingTask>()constructor(- private readonly cursorHome: string,+ private readonly configDir: string,private readonly emit: (parentId: string, events: LiveEvent[]) => void,+ private readonly dataDir: string = configDir,) {}register(parentId: string, hook: CursorTaskHook, normalizer: CursorNormalizer): void {@@ -265,10 +267,10 @@ export class CursorSubagentManager {if (this.pending.get(task.hook.toolUseId) !== task) returntask.attempts++try {- const meta = (await childMetas(this.cursorHome, task.parentId))+ const meta = (await childMetas(this.configDir, task.parentId)).find((candidate) => candidate.subagentInfo.toolCallId === task.hook.toolUseId)if (meta) {- const completion = await childCompletion(this.cursorHome, meta, Date.now() - task.startedAt)+ const completion = await childCompletion(this.dataDir, meta, Date.now() - task.startedAt)if (completion) {this.clear(task)this.emit(task.parentId, task.normalizer.completeTask(task.launcherId, completion))diff --git a/cli/src/engines/hermes/delegation.spec.ts b/cli/src/engines/hermes/delegation.spec.tsindex c0ae0238d..1e6890f5b 100644--- a/cli/src/engines/hermes/delegation.spec.ts+++ b/cli/src/engines/hermes/delegation.spec.ts@@ -106,10 +106,12 @@ describe('hermes sub-agent sessions are not agents of their own', () => {'CREATE TABLE sessions (id TEXT PRIMARY KEY, source TEXT NOT NULL);' +"INSERT INTO sessions VALUES ('20260805_111618_8e3027','subagent');" +"INSERT INTO sessions VALUES ('20260805_110520_3e0e44','tool');" +- "INSERT INTO sessions VALUES ('20260731_161017_999143','cli');"])+ "INSERT INTO sessions VALUES ('20260731_161017_999143','cli');" ++ "INSERT INTO sessions VALUES ('20260731_161017_999144','tui');"])expect(await isHermesSubagentSession(db, '20260805_111618_8e3027')).toBe(true)expect(await isHermesSubagentSession(db, '20260805_110520_3e0e44')).toBe(true)expect(await isHermesSubagentSession(db, '20260731_161017_999143')).toBe(false)+ expect(await isHermesSubagentSession(db, '20260731_161017_999144')).toBe(false)expect(await isHermesSubagentSession(db, '20260101_000000_abcdef')).toBe(false) // unknown id → not a child// …but the caller can tell "no row YET" from "row says cli" — that distinction is what closes the// 110ms window in which a child's hook arrives before hermes has written its own sessions row.diff --git a/cli/src/engines/hermes/reader.ts b/cli/src/engines/hermes/reader.tsindex a7f969098..ad9fcdb99 100644--- a/cli/src/engines/hermes/reader.ts+++ b/cli/src/engines/hermes/reader.ts@@ -81,13 +81,17 @@ export async function readHermesMessages(* itself to the adapter from the parent's pane. Measured live: dispatching two sub-agents fired* `on_session_start` for `20260805_111618_8e3027` / `…_0777bc` 0.2s after the parent's rows appeared, the* pane re-bound to them, and the parent was `forgotten` mid-turn — taking its delegation bookkeeping and- * its sub-agent list with it. `sessions.source` separates them: 'cli' for the real one, 'subagent'/'tool'+ * its sub-agent list with it. `sessions.source` separates them: 'cli'/'tui' for the real one, 'subagent'/'tool'* for the children (`cwd` also points into `/tmp`, but source is the explicit marker).**/+export function isHermesInteractiveSource(source: string): boolean {+ return source === '' || source === 'cli' || source === 'tui'+}+export async function isHermesSubagentSession(dbPath: string, sessionId: string): Promise<boolean> {const source = await hermesSessionSource(dbPath, sessionId)- return source !== null && source !== '' && source !== 'cli'+ return source !== null && !isHermesInteractiveSource(source)}/**diff --git a/cli/src/hookNotify.spec.ts b/cli/src/hookNotify.spec.tsindex c7e833cd8..690ea4de4 100644--- a/cli/src/hookNotify.spec.ts+++ b/cli/src/hookNotify.spec.ts@@ -49,7 +49,7 @@ interface RunHookOpts {cursorHome?: stringhermesHome?: string/** Fake Hermes SQLite source; null means the session row has not appeared. */- hermesSource?: 'cli' | 'subagent' | null+ hermesSource?: 'cli' | 'tui' | 'subagent' | null/** How long Hermes' store takes to answer: a loaded machine. */hermesDelaySeconds?: numbergrokHome?: string@@ -686,7 +686,7 @@ describe('hook notify terminal scope', () => {expect(() => readFileSync(join(dataDir, 'registry.json'), 'utf8')).toThrow()})- it('offline Hermes fallback binds only source=cli and rejects delegation children or unknown rows', async () => {+ it.each(['cli', 'tui'] as const)('offline Hermes fallback binds source=%s and rejects delegation children or unknown rows', async (interactiveSource) => {const dir = mkdtempSync(join(tmpdir(), 'adapter-hook-hermes-source-'))tmpDirs.push(dir)const hermesHome = join(dir, 'hermes')@@ -704,7 +704,7 @@ describe('hook notify terminal scope', () => {await runHook({...common,dataDir: cliData,- hermesSource: 'cli',+ hermesSource: interactiveSource,input: { hook_event_name: 'on_session_start', session_id: '20260810_120000_a1b2c3' },})expect(JSON.parse(readFileSync(join(cliData, 'registry.json'), 'utf8'))).toMatchObject([{diff --git a/cli/src/hookServer.ts b/cli/src/hookServer.tsindex b083a81ec..dc91e0483 100644--- a/cli/src/hookServer.ts+++ b/cli/src/hookServer.ts@@ -9,7 +9,7 @@ import { basename, join } from 'node:path'import http from 'node:http'import type { AddressInfo } from 'node:net'import { readCodexRolloutMeta } from './engines/codex/rollout.js'-import { hermesSessionSource } from './engines/hermes/reader.js'+import { hermesSessionSource, isHermesInteractiveSource } from './engines/hermes/reader.js'import { hermesDbPath, listHermesHomes } from './engines/hermes/home.js'import { isRecentlyDeleted } from './lib/deletedSessions.js'import { registry, type RegisterInput, type RegisteredSession } from './lib/registry.js'@@ -359,7 +359,7 @@ async function awaitHermesKind(body: RegisterInput, handlers: HookServerHandlersbreak}if (source === null) continue- if (source !== '' && source !== 'cli') {+ if (!isHermesInteractiveSource(source)) {console.log(`[hooks] ${sid(body.sessionId ?? '?')} ${body.hookEvent ?? 'session-start'} ignored · hermes_subagent`)return}diff --git a/cli/src/lib/hooks.spec.ts b/cli/src/lib/hooks.spec.tsindex 717e7ee58..6e299a86c 100644--- a/cli/src/lib/hooks.spec.ts+++ b/cli/src/lib/hooks.spec.ts@@ -117,6 +117,20 @@ describe('Codex hook installation', () => {installCursorHooks(19473)expect(readFileSync(file, 'utf8')).toBe(first)})++ it('installs Cursor hooks in config with the separate transcript root baked in', async () => {+ const config = join(cursorHome, 'config')+ const data = join(cursorHome, 'data')+ vi.stubEnv('CURSOR_CONFIG_DIR', config)+ vi.stubEnv('CURSOR_DATA_DIR', data)+ try {+ const { installCursorHooks } = await loadHooks()+ installCursorHooks(19473)+ const hooks = JSON.parse(readFileSync(join(config, 'hooks.json'), 'utf8'))+ expect(hooks.hooks.sessionStart[0].command).toContain(`--cursor-home '${data}'`)+ expect(existsSync(join(data, 'hooks.json'))).toBe(false)+ } finally { vi.unstubAllEnvs() }+ })})describe('Grok hook installation', () => {@@ -582,4 +596,3 @@ describe('Hermes hook allowlist', () => {expect(new Set(ours.map((a) => a.event)).size).toBe(ours.length)})})-diff --git a/cli/src/lib/hooks.ts b/cli/src/lib/hooks.tsindex 54d668cb2..8edb462c6 100644--- a/cli/src/lib/hooks.ts+++ b/cli/src/lib/hooks.ts@@ -9,6 +9,7 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync, renameSync } from 'import { basename, join, dirname } from 'path'import { homedir } from 'os'import { fileURLToPath } from 'url'+import { cursorConfigDir, cursorDataDir } from '../engines/cursor/home.js'import { env } from '../config/env.js'import { VERSION } from '../version.js'import { hermesConfigHomes } from '../engines/hermes/home.js'@@ -16,7 +17,7 @@ import { managedNodePath } from './nodeRuntime.js'const SETTINGS_PATH = join(homedir(), '.claude', 'settings.json')const GROK_HOOKS_PATH = join(env.GROK_HOME, 'hooks', 'harness.json')-const CURSOR_HOOKS_PATH = join(process.env.CURSOR_HOME || join(homedir(), '.cursor'), 'hooks.json')+const CURSOR_HOOKS_PATH = join(cursorConfigDir(), 'hooks.json')// agy reads hooks from its SHARED customization root (~/.gemini/config), not from its own state dir —// the CLI's changelog records the move, "ensuring hooks remain synchronized between the TUI and the// backend". Verified live: a hooks.json placed there fires for `agy` in a pane.@@ -80,7 +81,7 @@ function command('--claude-projects-dir', shellQuote(env.CLAUDE_PROJECTS_DIR),'--codex-home', shellQuote(codexHome),'--grok-home', shellQuote(env.GROK_HOME),- '--cursor-home', shellQuote(env.CURSOR_HOME),+ '--cursor-home', shellQuote(cursorDataDir()),'--hermes-home', shellQuote(hermesHome),'--commandcode-home', shellQuote(env.COMMANDCODE_HOME),'--devin-home', shellQuote(env.DEVIN_HOME),diff --git a/cli/src/lib/oneshot.ts b/cli/src/lib/oneshot.tsindex 5cc3edd3b..7d7abbce5 100644--- a/cli/src/lib/oneshot.ts+++ b/cli/src/lib/oneshot.ts@@ -8,6 +8,7 @@ import { randomUUID } from 'crypto'import { homedir, tmpdir, userInfo } from 'os'import { env } from '../config/env.js'import { findCursorTranscript } from '../engines/cursor/discovery.js'+import { cursorConfigDir, cursorDataDir } from '../engines/cursor/home.js'import { cursorRuntimeBin, opencodeBin } from './engineBin.js'import {DisposableOneShotPool,@@ -101,10 +102,10 @@ function killGroup(child: ChildProcess, signal: NodeJS.Signals = 'SIGKILL'): voi}export async function cleanupCursorOneShotSession(sessionId: string): Promise<void> {- const transcript = await findCursorTranscript(env.CURSOR_HOME, sessionId)+ const transcript = await findCursorTranscript(cursorDataDir(), sessionId)if (transcript) await rm(dirname(transcript), { recursive: true, force: true }).catch(() => {})- const chatsRoot = join(env.CURSOR_HOME, 'chats')+ const chatsRoot = join(cursorConfigDir(), 'chats')const workspaces = await readdir(chatsRoot, { withFileTypes: true }).catch(() => [])await Promise.all(workspaces.filter((entry) => entry.isDirectory())@@ -475,10 +476,20 @@ class CursorWorker extends ProcessWorker {}-// Recap runs in an isolated OpenCode data dir so ephemeral summary sessions never land in the user's-// real opencode.db, while still reading their ~/.config/opencode provider/model config.+// Isolate session storage while retaining the user's provider config and auth.json location.const OPENCODE_RECAP_DATA_DIR = join(env.ADAPTER_DATA_DIR, 'opencode-recap')+export function opencodeOneShotSpawn(model: string | undefined, parentEnv: NodeJS.ProcessEnv, dataDir: string) {+ const childEnv = scrubTerminalContext({ ...parentEnv })+ // OpenCode ignores OPENCODE_DATA_DIR. Its absolute OPENCODE_DB override selects the real store.+ childEnv.OPENCODE_DB = join(dataDir, 'opencode.db')+ childEnv.PWD = dataDir+ return {+ args: ['run', '--pure', '--format', 'json', ...(model ? ['--model', model] : [])],+ env: childEnv,+ }+}+class OpencodeWorker extends ProcessWorker {readonly engine = 'opencode' as constprivate buffer = ''@@ -497,9 +508,7 @@ class OpencodeWorker extends ProcessWorker {// the prompt later. `--pure` skips external plugins (so the machine discovery plugin never// self-registers this ephemeral recap session). `--format json` streams `{type:'text',part:{text}}`.mkdirSync(OPENCODE_RECAP_DATA_DIR, { recursive: true, mode: 0o700 })- const args = ['run', '--pure', '--format', 'json', ...(model ? ['--model', model] : [])]- const processEnv = scrubTerminalContext({ ...oneShotParentEnv() })- processEnv.OPENCODE_DATA_DIR = OPENCODE_RECAP_DATA_DIR+ const { args, env: processEnv } = opencodeOneShotSpawn(model, oneShotParentEnv(), OPENCODE_RECAP_DATA_DIR)const child = spawn(opencodeBin(), args, {cwd: OPENCODE_RECAP_DATA_DIR, env: processEnv, detached: true, stdio: ['pipe', 'pipe', 'pipe'],})@@ -582,8 +591,8 @@ function kiloBin(): string {* Recap runs in an isolated Kilo data dir so ephemeral summary sessions never land in the user's real* kilo.db, while still reading their ~/.config/kilo provider/model config.*- * The isolation mechanism is where kilo parts company with the opencode it forked. Opencode honours- * `OPENCODE_DATA_DIR`; kilo has no equivalent — measured with `kilo debug paths`, it ignores both+ * The isolation mechanism is where kilo parts company with the opencode it forked. OpenCode honours+ * `OPENCODE_DB`; this Kilo worker uses an isolated data root — measured with `kilo debug paths`, it ignores both* `KILO_DATA_DIR` and `OPENCODE_DATA_DIR` and moves its store only for `XDG_DATA_HOME`. So the child is* given that instead, and because kilo appends its own name, the store lands at `<dir>/kilo/kilo.db`.*diff --git a/cli/src/lib/opencodeOneShot.spec.ts b/cli/src/lib/opencodeOneShot.spec.tsnew file mode 100644index 000000000..5356f38ee--- /dev/null+++ b/cli/src/lib/opencodeOneShot.spec.ts@@ -0,0 +1,21 @@+import { describe, expect, it } from 'vitest'+import { opencodeOneShotSpawn } from './oneshot.js'++describe('OpenCode recap isolation', () => {+ it('overrides the session database and workspace while keeping provider credentials available', () => {+ const parent = {+ OPENCODE_DB: '/real/custom.db', PWD: '/real/repository',+ XDG_DATA_HOME: '/user/data', XDG_CONFIG_HOME: '/user/config',+ TMUX: '/real/socket', TMUX_PANE: '%4',+ }+ const child = opencodeOneShotSpawn('provider/model', parent, '/scratch/recap')+ expect(child.env).toMatchObject({+ OPENCODE_DB: '/scratch/recap/opencode.db', PWD: '/scratch/recap',+ XDG_DATA_HOME: '/user/data', XDG_CONFIG_HOME: '/user/config',+ })+ expect(child.env.TMUX).toBeUndefined()+ expect(child.env.TMUX_PANE).toBeUndefined()+ expect(child.args).toEqual(['run', '--pure', '--format', 'json', '--model', 'provider/model'])+ expect(parent.OPENCODE_DB).toBe('/real/custom.db')+ })+})diff --git a/cli/src/lib/registry.ts b/cli/src/lib/registry.tsindex 152fa1e1a..d2efa08d6 100644--- a/cli/src/lib/registry.ts+++ b/cli/src/lib/registry.ts@@ -38,6 +38,7 @@ import {import { randomUUID } from 'crypto'import { join, basename, dirname, relative } from 'path'import { hostname, uptime } from 'os'+import { cursorDataDir } from '../engines/cursor/home.js'import { env } from '../config/env.js'import { readCodexRolloutMeta, resolveCodexRollout } from '../engines/codex/rollout.js'import { ENGINES, isTerminalEngine, type AgentEngine } from '../engines/types.js'@@ -666,7 +667,7 @@ const TRANSCRIPT_ROOT: Readonly<Record<AgentEngine, ((codexHome?: string) => strgrok: () => join(env.GROK_HOME, 'sessions'),agy: () => join(env.AGY_HOME, 'brain'),copilot: () => join(env.COPILOT_HOME, 'session-state'),- cursor: () => join(env.CURSOR_HOME, 'projects'),+ cursor: () => join(cursorDataDir(), 'projects'),pi: () => join(env.PI_HOME, 'agent', 'sessions'),commandcode: () => join(env.COMMANDCODE_HOME, 'projects'),claude: () => env.CLAUDE_PROJECTS_DIR,diff --git a/cli/src/lib/sessionSearch/externals/index.ts b/cli/src/lib/sessionSearch/externals/index.tsindex b7b7a45d9..4b4136538 100644--- a/cli/src/lib/sessionSearch/externals/index.ts+++ b/cli/src/lib/sessionSearch/externals/index.ts@@ -5,6 +5,7 @@import { isAbsolute, join } from 'node:path'+import { cursorConfigDir, cursorDataDir } from '../../../engines/cursor/home.js'import { env } from '../../../config/env.js'import { agyProvider } from './agy.js'import { claudeProvider } from './claude.js'@@ -52,8 +53,8 @@ export function externalPaths(vars: NodeJS.ProcessEnv = process.env): ExternalPaclaudeProjectsDir: env.CLAUDE_PROJECTS_DIR,codexHome: env.CODEX_HOME,// Cursor ignores these when blank, as it ignores them unset.- cursorConfigDir: vars.CURSOR_CONFIG_DIR?.trim() || (vars.XDG_CONFIG_HOME?.trim() ? join(vars.XDG_CONFIG_HOME, 'cursor') : env.CURSOR_HOME),- cursorDataDir: vars.CURSOR_DATA_DIR?.trim() || env.CURSOR_HOME,+ cursorConfigDir: cursorConfigDir(vars),+ cursorDataDir: cursorDataDir(vars),grokHome: env.GROK_HOME,copilotHome: env.COPILOT_HOME,opencodeDb: databasePath(vars.OPENCODE_DB, env.OPENCODE_DATA_DIR, 'opencode.db'),diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex e5701228c..efd3c1ab6 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -3413,12 +3413,12 @@ class AppNotifier extends ChangeNotifier {'You were signed out on this computer. This computer\'s agents keep ''running; sign in again to reach your other machines.';- /// The session went away while the app was already running — send the user to [LoginScreen] with a- /// reason, and stop the background work that can only fail from here.- ///- /// Cold start already handles this: [bootstrap] asks the CLI whether it is signed in. The hole this- /// fills is the app that was ALREADY authenticated when the session disappeared underneath it,- /// where nothing re-checked and the daemon supervisor simply respawned `harness start` forever.+ /// Inject the same account-expiry event the connection pool reports, without a real daemon.+ @visibleForTesting+ void expireSessionForTest(String message) => _signedOutAtRuntime(message);++ /// A running session lost its account. Viewers return to login; desktop windows+ /// keep this computer available as guests and explain how to reconnect remotely.void _signedOutAtRuntime(String message) {if (status == AppStatus.unauthenticated || isGuest) {return; // idempotent: several sources can race herediff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dartindex 14a18d5a0..168b32812 100644--- a/desktop/test/boot_flow_widget_test.dart+++ b/desktop/test/boot_flow_widget_test.dart@@ -1,3 +1,4 @@+import 'support/resource_picker.dart';import 'support/workspace_tools.dart';import 'swarm_interactions_test.dart' show chord;@@ -910,17 +911,16 @@ void main() {await tester.sendKeyEvent(LogicalKeyboardKey.enter);await chord(tester, LogicalKeyboardKey.keyN);await tester.pumpAndSettle();- // With no machine to open an agent on, the start page's New goes to- // the Machines panel, with desktop and server instructions one click away.- expect(find.byKey(const ValueKey('machines-panel')), findsOneWidget);- await tester.tap(find.text('Add a second machine'));+ // With no machine to open an agent on, New opens machine setup in the shared picker.+ expect(resourceScope('@'), findsOneWidget);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pumpAndSettle();- expect(- find.text('1. Open Harness on your other computer.'),- findsOneWidget,- );- expect(find.text('Set up a server…'), findsOneWidget);- await tester.tap(find.byTooltip('Close Machines'));+ expect(find.text('Add machine · App'), findsOneWidget);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pumpAndSettle();expect(app.panes, isEmpty);await tester.pumpWidget(const SizedBox());@@ -1122,7 +1122,7 @@ void main() {// The panel and its password field receive focus after the first frame.await tester.pumpAndSettle();- expect(find.byKey(const ValueKey('machines-panel')), findsOneWidget);+ expect(resourceScope('@'), findsOneWidget);expect(find.byWidgetPredicate((widget) =>@@ -1131,13 +1131,8 @@ void main() {),findsNothing,);- expect(- find.byWidgetPredicate(- (widget) =>- widget is Icon && widget.semanticLabel == 'remote-mac: Offline',- ),- findsOneWidget,- );+ expect(resourceSearch(tester).selected!.machineId, machine.machineId);+ expect(find.text('Offline'), findsWidgets);expect(find.text('Harness is offline'), findsNothing);expect(find.text('harness start'), findsNothing);await tester.pumpWidget(const SizedBox());@@ -1188,20 +1183,21 @@ void main() {await openWorkspaceManagement(tester, 'machines');await tester.pumpAndSettle();- await tester.ensureVisible(find.text('link-mac'));+ await selectResource(+ tester,+ resourceSearch(tester).rows+ .firstWhere((row) => row.machineId == 'link-machine')+ .id,+ );await tester.tap(- find.byKey(const ValueKey('connect-machine-link-machine')),+ find.byKey(const ValueKey('resource-action:picker.resource_connect')),);// Same popup-transition reasoning as above.await tester.pumpAndSettle();- expect(find.byKey(const ValueKey('machines-panel')), findsOneWidget);+ expect(resourceScope('@'), findsOneWidget);expect(- find.byWidgetPredicate(- (widget) =>- widget is TextField &&- widget.decoration?.hintText == 'Harness password',- ),+ find.byKey(const ValueKey('remote-password-connect-field')),findsOneWidget,);await tester.pumpWidget(const SizedBox());@@ -1272,13 +1268,18 @@ void main() {await openWorkspaceManagement(tester, 'machines');await tester.pumpAndSettle();- await tester.ensureVisible(find.text('link-mac'));+ await selectResource(+ tester,+ resourceSearch(tester).rows+ .firstWhere((row) => row.machineId == 'link-machine')+ .id,+ );await tester.tap(- find.byKey(const ValueKey('connect-machine-link-machine')),+ find.byKey(const ValueKey('resource-action:picker.resource_connect')),);await tester.pumpAndSettle();- expect(find.byKey(const ValueKey('machines-panel')), findsOneWidget);+ expect(resourceScope('@'), findsOneWidget);// No second pane was opened for the popup — just the one terminal pane that was// already there.expect(app.allPanes, hasLength(1));diff --git a/desktop/test/desk_sync_test.dart b/desktop/test/desk_sync_test.dartindex b5e88c9c1..3cea574c0 100644--- a/desktop/test/desk_sync_test.dart+++ b/desktop/test/desk_sync_test.dart@@ -680,7 +680,7 @@ void main() {app.setPreset(2, PanePreset.rows);await Future<void>.delayed(Duration.zero);- final onDesk = () =>+ DeskLayout? onDesk() =>api.doc!.tabs.singleWhere((t) => t.id == work.id).layout;expect(onDesk()?.presets, {'2': 'rows'});expect(diff --git a/desktop/test/environment_recheck_timer_test.dart b/desktop/test/environment_recheck_timer_test.dartindex cf9fcb53d..adb1a576a 100644--- a/desktop/test/environment_recheck_timer_test.dart+++ b/desktop/test/environment_recheck_timer_test.dart@@ -7,6 +7,8 @@ import 'package:harness/core/local_key_value_store.dart';import 'package:harness/settings/config_store.dart';import 'package:harness/state/app_state.dart';+import 'support/guest_app.dart';+class _FakeCliLogin extends CliLogin {@overrideFuture<CliAuthStatus> checkStatus() async =>@@ -97,7 +99,7 @@ void main() {),);final provisioner = _ScriptedProvisioner([review, waiting, failed]);- final app = AppNotifier(+ final app = GuestTestApp(config: AppConfig.dev,authSession: AuthSession(),configStore: null,@@ -140,7 +142,7 @@ void main() {mode: EnvironmentSetupMode.automatic,);final provisioner = _ScriptedProvisioner([review, waiting, ready]);- final app = AppNotifier(+ final app = GuestTestApp(config: AppConfig.dev,authSession: AuthSession(),configStore: ConfigStore(storage: _FakeKeyValueStore()),@@ -160,7 +162,8 @@ void main() {expect(provisioner.installCalls, [false, true, false]);expect(app.environmentReadiness.isReady, isTrue);expect(app.environmentRecheckPending, isFalse);- expect(app.status, AppStatus.unauthenticated);+ expect(app.status, AppStatus.authenticated);+ expect(app.isGuest, isTrue);app.dispose();});}diff --git a/desktop/test/environment_setup_screen_test.dart b/desktop/test/environment_setup_screen_test.dartindex 248efac1f..5c083362c 100644--- a/desktop/test/environment_setup_screen_test.dart+++ b/desktop/test/environment_setup_screen_test.dart@@ -11,6 +11,8 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/app_state.dart';import 'package:harness/widgets/environment_setup_screen.dart';+import 'support/guest_app.dart';+const setupReview = EnvironmentReadiness(steps: {EnvironmentStep.clipboard: EnvironmentStepStatus.notApplicable,@@ -84,8 +86,8 @@ Future<void> _mount(),home: ListenableBuilder(listenable: app,- builder: (_, _) => app.status == AppStatus.unauthenticated- ? const Scaffold(body: Text('Sign-in reached'))+ builder: (_, _) => app.status == AppStatus.authenticated+ ? const Scaffold(body: Text('Guest workspace reached')): EnvironmentSetupScreen(notifier: app),),),@@ -94,7 +96,7 @@ Future<void> _mount(}AppNotifier _app(SetupProvisioner provisioner) =>- AppNotifier(+ GuestTestApp(config: AppConfig.dev,authSession: AuthSession(),configStore: null,@@ -353,52 +355,53 @@ void main() {});}- testWidgets('Enter installs and retries once before reaching sign-in', (- tester,- ) async {- final provisioner = SetupProvisioner();- final app = _app(provisioner);- await _mount(tester, app);- expect(provisioner.attempts, isEmpty);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(provisioner.attempts, hasLength(1));- expect(provisioner.attempts.single.install, isTrue);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(provisioner.attempts, hasLength(1));- provisioner.attempts.single.finish(- setupReview.copyWith(- phase: EnvironmentSetupPhase.failed,- failure: const EnvironmentFailure(- title: 'Could not install Harness',- detail: 'Check your connection, then retry setup.',+ testWidgets(+ 'Enter installs and retries once before reaching the guest workspace',+ (tester) async {+ final provisioner = SetupProvisioner();+ final app = _app(provisioner);+ await _mount(tester, app);+ expect(provisioner.attempts, isEmpty);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(provisioner.attempts, hasLength(1));+ expect(provisioner.attempts.single.install, isTrue);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(provisioner.attempts, hasLength(1));+ provisioner.attempts.single.finish(+ setupReview.copyWith(+ phase: EnvironmentSetupPhase.failed,+ failure: const EnvironmentFailure(+ title: 'Could not install Harness',+ detail: 'Check your connection, then retry setup.',+ ),),- ),- );- await tester.pump();- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(provisioner.attempts, hasLength(2));- provisioner.attempts.last.finish(- const EnvironmentReadiness(- steps: {- EnvironmentStep.clipboard: EnvironmentStepStatus.notApplicable,- EnvironmentStep.tmux: EnvironmentStepStatus.ready,- EnvironmentStep.harness: EnvironmentStepStatus.ready,- },- phase: EnvironmentSetupPhase.ready,- ),- );- await tester.pump();- await tester.pump();- expect(find.text('Sign-in reached'), findsOneWidget);- expect(provisioner.attempts.map((attempt) => attempt.install), [- true,- true,- ]);- await tester.pumpWidget(const SizedBox());- app.dispose();- });+ );+ await tester.pump();+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(provisioner.attempts, hasLength(2));+ provisioner.attempts.last.finish(+ const EnvironmentReadiness(+ steps: {+ EnvironmentStep.clipboard: EnvironmentStepStatus.notApplicable,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ EnvironmentStep.harness: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.ready,+ ),+ );+ await tester.pump();+ await tester.pump();+ expect(find.text('Guest workspace reached'), findsOneWidget);+ expect(provisioner.attempts.map((attempt) => attempt.install), [+ true,+ true,+ ]);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );}diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dartindex 7c4d2ff08..031329b87 100644--- a/desktop/test/first_workspace_test.dart+++ b/desktop/test/first_workspace_test.dart@@ -529,7 +529,7 @@ void main() {find.byKey(const ValueKey('swarm-new-pane-button')),findsNothing,);- expect(find.byTooltip('Harnesses'), findsOneWidget);+ expect(find.byTooltip('Harnesses'), findsNothing);expect(find.byKey(const ValueKey('swarm-new-harness-button')),findsNothing,diff --git a/desktop/test/grid_model_picker_test.dart b/desktop/test/grid_model_picker_test.dartindex abe8f42e7..471fe3615 100644--- a/desktop/test/grid_model_picker_test.dart+++ b/desktop/test/grid_model_picker_test.dart@@ -296,14 +296,14 @@ void main() {of: control,matching: find.byType(ColoredBox),);- expect(fill, findsOneWidget);- expect(tester.getSize(fill).height, 28);expect(- tester.widget<ColoredBox>(fill).color,- tester- .widget<WorkspaceBarControl>(control)- .selection- .withValues(alpha: .5),+ fill,+ findsNothing,+ reason: 'hover emphasizes text without filling the model control',+ );+ expect(+ tester.widget<Text>(find.text('GPT-6 Astra')).style!.fontWeight,+ FontWeight.bold,);await hover.moveTo(Offset.zero);await tester.pumpAndSettle();diff --git a/desktop/test/local_cli_discovery_test.dart b/desktop/test/local_cli_discovery_test.dartindex a4c46d862..1e1029967 100644--- a/desktop/test/local_cli_discovery_test.dart+++ b/desktop/test/local_cli_discovery_test.dart@@ -767,11 +767,8 @@ void main() {expect(spawnCount, lessThan(6));});- // The bug this closes: a daemon that signed ITSELF out (its machine was deleted from another- // machine) exits, and the supervisor respawned it forever — every replacement starting without a- // session and exiting again, silently, for the app's whole lifetime.test(- 'startSupervising stops respawning once the CLI reports it is signed out',+ 'startSupervising keeps the local guest daemon running after sign-out',() async {const computerId = '0123456789abcdef0123456789abcdef';final identityFile = File('${scratch.path}/computer-id')@@ -808,11 +805,15 @@ void main() {expect(spawnCount,- 0,- reason: 'a signed-out daemon must never be respawned',+ greaterThan(0),+ reason: 'guest mode still needs the local daemon',);- expect(signedOutCalls, 1, reason: 'the caller is told exactly once');- expect(timer.isActive, isFalse, reason: 'supervision stops for good');+ expect(+ signedOutCalls,+ spawnCount,+ reason: 'auth is checked at each backed-off spawn',+ );+ expect(timer.isActive, isTrue);},);diff --git a/desktop/test/machines_manager_test.dart b/desktop/test/machines_manager_test.dartindex 593620a81..62b348e91 100644--- a/desktop/test/machines_manager_test.dart+++ b/desktop/test/machines_manager_test.dart@@ -105,7 +105,7 @@ void main() {await openWorkspaceManagement(tester, 'machines');await tester.pumpAndSettle();expect(find.byType(HarnessSessionManager), findsNothing);- expect(find.byKey(const ValueKey('machines-panel')), findsOneWidget);+ expect(resourceScope('@'), findsOneWidget);await openWorkspaceManagement(tester, 'models');await tester.pumpAndSettle();expect(find.byKey(const ValueKey('machines-panel')), findsNothing);@@ -414,8 +414,8 @@ void main() {await tester.pumpAndSettle();}- expect(find.byKey(const ValueKey('machines-panel')), findsOneWidget);- expect(find.text('Add a second machine'), findsOneWidget);+ expect(resourceScope('@'), findsOneWidget);+ expect(find.text('Add machine'), findsOneWidget);expect(app.activeSwarm, same(tab));expect(app.panes, isEmpty);expect(tester.takeException(), isNull);diff --git a/desktop/test/notification_parity_test.dart b/desktop/test/notification_parity_test.dartindex 37daf4143..a7f6d7897 100644--- a/desktop/test/notification_parity_test.dart+++ b/desktop/test/notification_parity_test.dart@@ -56,7 +56,7 @@ void main() {app.handleEventForTest('m', {'type': 'turn_ended','agentId': agentId,- if (subagent != null) 'subagent': subagent,+ 'subagent': ?subagent,'payload': <String, dynamic>{},});diff --git a/desktop/test/open_picker_rendering_test.dart b/desktop/test/open_picker_rendering_test.dartindex 62642c24a..61da76402 100644--- a/desktop/test/open_picker_rendering_test.dart+++ b/desktop/test/open_picker_rendering_test.dart@@ -296,7 +296,7 @@ void main() {},);- testWidgets('Open Harness builds a small window and Tab reaches later rows', (+ testWidgets('Open Harness builds a small window and arrow keys reach later rows', (tester,) async {final app = createApp();@@ -359,7 +359,7 @@ void main() {expect(rows.evaluate().length, lessThan(search.rows.length));final visited = <String>{};for (var step = 0; step < 35; step++) {- await key(tester, LogicalKeyboardKey.tab);+ await key(tester, LogicalKeyboardKey.arrowDown);await tester.pumpAndSettle();final selected = search.selected;if (selected != null) {diff --git a/desktop/test/orchestrator_test.dart b/desktop/test/orchestrator_test.dartindex ba0521c6a..e583c860c 100644--- a/desktop/test/orchestrator_test.dart+++ b/desktop/test/orchestrator_test.dart@@ -119,11 +119,11 @@ void main() {);}- test('Cmd-P opens a pane and the orchestrator remains a palette command', () {+ test('Cmd-O opens projects and the orchestrator remains a palette command', () {final shortcut = appShortcuts().singleWhere((s) => s.action == ShortcutAction.addAgent).activator;- expect(shortcut.trigger, LogicalKeyboardKey.keyP);+ expect(shortcut.trigger, LogicalKeyboardKey.keyO);expect(shortcut.meta, isTrue);expect(shortcut.shift, isFalse);expect(diff --git a/desktop/test/pending_question_test.dart b/desktop/test/pending_question_test.dartindex 65ad0be91..1f0f75112 100644--- a/desktop/test/pending_question_test.dart+++ b/desktop/test/pending_question_test.dart@@ -11,7 +11,6 @@ import 'package:harness/core/config.dart';import 'package:harness/core/models.dart';import 'package:harness/state/app_state.dart';import 'package:harness/ws/ws_conn.dart';-import 'package:harness/state/terminal_pane.dart';import 'package:harness/terminal/terminal_session.dart';import 'package:harness/core/local_key_value_store.dart';import 'package:harness/notify/agent_alerts.dart';diff --git a/desktop/test/session_search_daemon_e2e_test.dart b/desktop/test/session_search_daemon_e2e_test.dartindex 88b476795..bd9daaed1 100644--- a/desktop/test/session_search_daemon_e2e_test.dart+++ b/desktop/test/session_search_daemon_e2e_test.dart@@ -1,4 +1,3 @@-import 'dart:async';import 'dart:io';import 'package:flutter_test/flutter_test.dart';diff --git a/desktop/test/signout_recovery_test.dart b/desktop/test/signout_recovery_test.dartindex 022e1f37a..a73cd8b76 100644--- a/desktop/test/signout_recovery_test.dart+++ b/desktop/test/signout_recovery_test.dart@@ -16,6 +16,7 @@ import 'package:harness/terminal/terminal_session.dart';import 'support/real_fonts.dart';import 'swarm_state_test.dart' show MemoryStore;+import 'support/guest_app.dart';class SignOutFixture extends CliLogin {final attempts = <Completer<void>>[];@@ -58,20 +59,21 @@ Widget signOutHost();}-AppNotifier signOutApp(SignOutFixture cli, {bool local = false}) => AppNotifier(- config: AppConfig.dev,- configStore: null,- authSession: AuthSession(storage: MemoryStore()),- cliLogin: cli,- localManualFixture: local- ? const LocalManualFixture(- apiBaseUrl: 'http://127.0.0.1:1',- apiKey: 'fixture',- machineId: 'fixture',- machineName: 'Fixture',- )- : null,-)..status = AppStatus.authenticated;+AppNotifier signOutApp(SignOutFixture cli, {bool local = false}) =>+ GuestTestApp(+ config: AppConfig.dev,+ configStore: null,+ authSession: AuthSession(storage: MemoryStore()),+ cliLogin: cli,+ localManualFixture: local+ ? const LocalManualFixture(+ apiBaseUrl: 'http://127.0.0.1:1',+ apiKey: 'fixture',+ machineId: 'fixture',+ machineName: 'Fixture',+ )+ : null,+ )..status = AppStatus.authenticated;void main() {setUpAll(() async {@@ -97,7 +99,8 @@ void main() {cli.attempts.single.complete();await first;await second;- expect(app.status, AppStatus.unauthenticated);+ expect(app.status, AppStatus.authenticated);+ expect(app.isGuest, isTrue);await app.login();expect(cli.logins, 1);},@@ -111,7 +114,8 @@ void main() {addTearDown(app.dispose);await app.logout();expect(cli.attempts, isEmpty);- expect(app.status, AppStatus.unauthenticated);+ expect(app.status, AppStatus.authenticated);+ expect(app.isGuest, isTrue);},);diff --git a/desktop/test/support/guest_app.dart b/desktop/test/support/guest_app.dartnew file mode 100644index 000000000..41e693b24--- /dev/null+++ b/desktop/test/support/guest_app.dart@@ -0,0 +1,19 @@+import 'package:harness/state/app_state.dart';++/// Exercises guest boot and sign-out without starting or querying a real daemon.+class GuestTestApp extends AppNotifier {+ GuestTestApp({+ required super.config,+ required super.authSession,+ super.configStore,+ super.cliLogin,+ super.environmentProvisioner,+ super.localManualFixture,+ });++ @override+ Future<void> ensureCliDaemonReady() async {}++ @override+ Future<bool> refreshMachines() async => true;+}diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dartindex 7820eb5eb..2c2f8b9f5 100644--- a/desktop/test/terminal_panel_presentation_test.dart+++ b/desktop/test/terminal_panel_presentation_test.dart@@ -49,7 +49,7 @@ void main() {await tester.pump();revision.value = 1;await tester.pump();- for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {+ for (final label in ['Zoom Pane', 'Stop Harness']) {expect(find.byTooltip(label), findsNothing);}expect(closed, isEmpty);@@ -198,7 +198,7 @@ void main() {);for (final local in [true, false]) {testWidgets(- '${local ? 'local' : 'remote'} compact model selectors stay visible without moving the title or terminal',+ '${local ? 'local' : 'remote'} compact pane controls stay visible without moving the title or terminal',(tester) async {final app = createApp();app.stateOf('m')!.localOnly = local;@@ -259,8 +259,9 @@ void main() {.length,0,);- expect(find.text('OpenAI').hitTestable(), findsOneWidget);- for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {+ expect(find.byType(GridModelPicker), findsNothing);+ expect(find.byTooltip('Close Pane').hitTestable(), findsNothing);+ for (final label in ['Zoom Pane', 'Stop Harness']) {expect(find.byTooltip(label).hitTestable(), findsNothing);}final controlsBounds = tester.getRect(controls);@@ -268,14 +269,15 @@ void main() {await mouse.addPointer(location: const Offset(1, 100));await mouse.moveTo(tester.getCenter(title));await tester.pump();- for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {+ expect(find.byTooltip('Close Pane').hitTestable(), findsOneWidget);+ for (final label in ['Zoom Pane', 'Stop Harness']) {expect(find.byTooltip(label), findsNothing);}expect(tester.getRect(title), titleBounds);expect(tester.getRect(controls), controlsBounds);await mouse.moveTo(tester.getCenter(find.byType(TerminalView)));await tester.pump();- for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {+ for (final label in ['Zoom Pane', 'Stop Harness']) {expect(find.byTooltip(label).hitTestable(), findsNothing);}expect(find.byTooltip('Share harness'), findsNothing);@@ -297,7 +299,7 @@ void main() {);}testWidgets(- 'narrow headers preserve identity and model selection at large text',+ 'narrow compact headers preserve identity and close controls at large text',(tester) async {final app = createApp();final session = terminal('a0', []);@@ -345,7 +347,13 @@ void main() {expect(tester.takeException(), isNull);final titleBefore = tester.getRect(title);final picker = find.byType(GridModelPicker);- expect(picker.hitTestable(), findsOneWidget);+ expect(picker, findsNothing);+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);+ await mouse.addPointer(location: Offset.zero);+ await mouse.moveTo(tester.getCenter(title));+ await tester.pump();+ expect(find.byTooltip('Close Pane').hitTestable(), findsOneWidget);+ await mouse.removePointer();expect(find.byTooltip('Stop Harness'), findsNothing);expect(find.byTooltip('Zoom Pane'), findsNothing);expect(tester.getRect(title), titleBefore);diff --git a/desktop/test/workspace_account_lifecycle_test.dart b/desktop/test/workspace_account_lifecycle_test.dartindex 66e73b2df..f5709cc27 100644--- a/desktop/test/workspace_account_lifecycle_test.dart+++ b/desktop/test/workspace_account_lifecycle_test.dart@@ -11,7 +11,7 @@ import 'package:harness/state/app_state.dart';import 'package:harness/state/pane_layout_store.dart';import 'package:harness/state/pane_preset.dart';import 'package:harness/terminal/terminal_session.dart';-import 'package:harness/ws/local_cli_discovery.dart';+import 'package:harness/viewer/viewer_services.dart';import 'swarm_screen_test.dart' show terminal;import 'swarm_state_test.dart' show MemoryStore;@@ -30,20 +30,6 @@ class WorkspaceAccountLogin extends CliLogin {const CliAuthStatus(loggedIn: false);}-class _Discovery extends LocalCliDiscovery {- _Discovery() : super(config: AppConfig.dev);- @override- Future<LocalCliProbe> ensureRunning({- Duration timeout = const Duration(seconds: 15),- Duration readyTimeout = LocalCliDiscovery.defaultReadyTimeout,- }) async => const LocalCliProbe.down('fixture signed out');- @override- Future<String?> computerId() async => null;- @override- Future<LocalCliEndpoint?> discover({String? expectedComputerId}) async =>- null;-}-class _Api extends ApiClient {_Api(): super(@@ -68,7 +54,10 @@ class WorkspaceAccountFixture extends AppNotifier {config: AppConfig.dev,authSession: AuthSession(storage: MemoryStore()),cliLogin: cli,- localCliDiscovery: _Discovery(),+ viewer: ViewerServices(+ config: AppConfig.dev,+ session: AuthSession(storage: MemoryStore()),+ ),paneLayoutStore: PaneLayoutStore(storage: storage),) {api = _Api();@@ -76,16 +65,10 @@ class WorkspaceAccountFixture extends AppNotifier {}final WorkspaceAccountLogin cli;int get inventoryRequests => (api as _Api).inventoryRequests;- var expired = false;- @override- Future<void> ensureCliDaemonReady() async {- if (expired) await super.ensureCliDaemonReady();- }-+ // These account-wide teardown guarantees belong to a viewer. Desktop windows+ // keep serving this computer as guests; guest_window_test covers that desk.Future<void> expire() async {- expired = true;- await ensureCliDaemonReady();- expired = false;+ expireSessionForTest('You were signed out. Sign in again to reconnect.');}}diff --git a/docs/research/2026-09-27-external-engines-completion.md b/docs/research/2026-09-27-external-engines-completion.mdnew file mode 100644index 000000000..e8ab8da8a--- /dev/null+++ b/docs/research/2026-09-27-external-engines-completion.md@@ -0,0 +1,93 @@+# External engines: completion and commit audit++The original `external-engines` branch is preserved at `40f12db0`; its `dapper-otter`+worktree is clean. The continuation used a separate branch and worktree.++## Original commits confirmed++`git range-diff 244cfe71..40f12db0 93f148d6..c6871968` reports `=` for every commit:++| Original | Rebased | Work |+| --- | --- | --- |+| `adc7f2e1` | `015668e8` | External-provider framework |+| `0b8d7f36` | `c4993f85` | Framework tests, search filters, desktop engine names |+| `5c52bad8` | `46b2ce60` | OpenCode, Kilo, Hermes, Devin, Pi, Command Code, Muse, Antigravity |+| `7f97678f` | `a54fb579` | Cursor, Grok, Copilot; stale-lock and timestamp handling |+| `c07a20b2` | `7768a453` | Review fixes |+| `40f12db0` | `c6871968` | Research and handoff |++The rebase includes #391 and #392. The continuation added `930c7ba4` to refresh+cached immutable SQLite readers after a complete write/checkpoint/close cycle and+rebuild older search indexes. [PR #396](https://github.com/autonomous-ai/openharness/pull/396)+merged as `aae13041`. `git diff 930c7ba4 aae13041` is empty: the merged tree is the+tested tree.++## What users gain++- Search and resume local conversations from 13 engines: Claude Code, Codex,+ Cursor, OpenCode, Kilo, Hermes, Devin, Pi, Command Code, Muse, Grok, Antigravity,+ and Copilot. Amp remains outside local discovery because its threads live remotely.+- Ownership checks distinguish terminal, app, Harness, and uncertain ownership.+ Only verified ownership can authorize takeover; an argument-only guess cannot+ stop a process. Busy conversations can wait for an idle turn.+- Engine-specific filtering removes child/internal streams and handles timestamps,+ stale locks, profiles, overridden store locations, and resumable session IDs.+- Idle SQLite stores stay read-only, without new WAL/SHM files; completed write+ cycles now invalidate a cached snapshot so search sees subsequent conversations.++## Outstanding work resolved++[PR #388](https://github.com/autonomous-ai/openharness/pull/388) merged as `8e814775`.+Codex file, browser, and editor context no longer replaces the person's actual ask+in search. Its schema was reconciled to **11**, with rebuild tests for 0, 8, 9, and+10. All 350 session-search tests passed before merging.++[PR #390](https://github.com/autonomous-ai/openharness/pull/390) merged as `c9577b42`.+Hermes's offline hook can wait three seconds for its store, matching the process+scan budget. The delayed-store regression and all 32 hook tests passed before merging.++The four existing engine bugs recorded by Claude are fixed in the follow-up:++- Cursor now resolves config and data roots independently for hook installation,+ transcript validation/discovery, subagent replay/live completion, and recap cleanup.+ Tests use separate physical roots and verify that another conversation survives cleanup.+- OpenCode recap processes set an absolute `OPENCODE_DB` and their own `PWD` while+ preserving provider configuration and the authentication-file location.+ OpenCode 1.18.32 was run in an isolated home: `db path` named the recap database,+ a real session-table query succeeded, and the default database path remained absent.+- Hermes accepts `tui` alongside `cli` in both online and offline hook classification;+ delegation children and unknown offline rows remain excluded.+- Command Code uses the same pinned `@sindresorhus/slugify` 2.2.1 implementation as+ the published Command Code 1.66.0 package, including camel case, acronym and Unicode+ handling and the `root` fallback. The package was inspected without installing or+ executing Command Code.++The desktop timer failure was confirmed on the original base and main, then fixed+as a stale test expectation: a signed-out desktop now opens a guest workspace.+The other baseline failures were stale shortcut, picker, hover, or sign-out+expectations. Guest fixtures avoid real CLI/daemon calls, and account-wide teardown+tests explicitly exercise viewers. The shared toolbar owns compact-pane model+selection; pane close becomes clickable on header hover.++## Validation++- CLI typecheck and production build pass. Full suite: **5,266 passed, 63 skipped**,+ 312 passing test files. Focused engine regressions: **154 passed, one optional+ real-engine test skipped**. The final Cursor fixture also passes using built-in+ SQLite, without requiring a separate sqlite3 executable.+- The original external-provider implementation had **100% statement, branch,+ function, and line coverage** at #396, across `external.ts` and `externals/*.ts`.+- Complete desktop suite: **3,778 passed, 12 skipped, zero failures**. All 33+ baseline failures recorded at handoff are resolved, including the test-file load error.+- Desktop analyzer: no errors or warnings with `--no-fatal-infos`; 13 existing+ informational diagnostics remain in `third_party/xterm`. The compile error and+ all application/test analyzer diagnostics from the handoff are resolved.+- Real tmux validation in the continuation passed nine cases and skipped nine+ unavailable engine rows. All fixtures used an isolated home and explicit socket.+- The historical Herdr suite requires 0.8.x/protocol 19; the installed binary is+ 0.9.1/protocol 22. Herdr is retired from active backend selection (see+ `cli/README.md`), so this is not evidence for a supported release backend.++Release through `make release-cli`, followed by `make release-desktop`, from the+merged, tested commit. The GitHub releases and public manifests record the final+versions and artifact checksums.diff --git a/docs/research/2026-09-27-external-engines-handoff.md b/docs/research/2026-09-27-external-engines-handoff.mdindex 45fc41f11..619dc519e 100644--- a/docs/research/2026-09-27-external-engines-handoff.md+++ b/docs/research/2026-09-27-external-engines-handoff.md@@ -1,5 +1,7 @@# Handoff: external sessions for every engine+**Completed in the continuation:** see [the commit audit and completion report](2026-09-27-external-engines-completion.md). The sections below preserve the state at the original handoff.+Continued from `external-engines` at `40f12db0` on branch `codex/external-engines`.Rebased onto `93f148d6` (`origin/main`, including #391 and #392) without conflicts.The original branch and worktree are preserved.@@ -101,14 +103,13 @@ The 33 desktop failures shared with main are in these files:timestamps must apply to conversations indexed before this branch. Reader and rebuild testscover schemas 8 and 9 as well as an older schema.-## Left to do+## Handoff checklist — resolved-1. Review the PR against `main` and the baseline desktop failures above.-2. Reconcile merge order with #388, which changes `turns.ts` and reserves schema 9. If #388 lands- first, keep schema 10 here after rebasing. If this branch lands first, #388 must use **11** when- it lands, so an index already written by schema 10 rebuilds for its context filtering too.-3. The owner merges and releases (`make release-cli`, then the desktop release); never merge or- release without their explicit go-ahead.+1. Rebased and merged the tested feature in #396; the six original patches are unchanged.+2. Reconciled #388 with schema 11 and merged it; merged the separate Hermes timeout fix #390.+3. Resolved the baseline desktop failures and all four engine bugs listed below.+4. The owner authorized merging and releasing in the continuation. See the completion report+ and the corresponding CLI/desktop GitHub releases for the final verification.## Sandbox end-to-end recipe@@ -126,7 +127,7 @@ Never run a test daemon or tmux against the person's real ones:- Afterwards, stop the sandbox daemon and kill both tmux servers. Check that no pane on the realserver sits in the sandbox folder, and that no new `-wal`/`-shm` appeared in the engines' folders.-## Found in Harness's own code, not changed here+## Existing bugs recorded at handoff — fixed in the follow-up- Cursor's config and data folders are one `CURSOR_HOME` in `discovery.ts`, `subagent.ts` and`oneshot.ts`.