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(cli): bind Muse panes again: skip Muse's tool-outputs folder (#1357)
0xdiego25ca5a32e86ec3
diff --git a/cli/src/lib/sessionRepair.bounds.spec.ts b/cli/src/lib/sessionRepair.bounds.spec.tsindex ff46e7b9e..a602b86f3 100644--- a/cli/src/lib/sessionRepair.bounds.spec.ts+++ b/cli/src/lib/sessionRepair.bounds.spec.ts@@ -105,6 +105,21 @@ describe('complete bounded evidence before choosing a conversation', () => {await expect(scan()).resolves.toEqual({ sessionId: SID, transcriptPath: path })})+ it('binds a Muse session whose folder also holds its tool outputs', async () => {+ // Muse Code 1.4 writes `tool-outputs/` beside `session.jsonl`, one level below the 4 the tree allows:+ // walked into, it held every Muse pane on "the transcript depth limit was reached".+ const work = join(root, 'work')+ mkdirSync(work)+ const folder = join(root, 'muse', 'sessions', '2026', '10', '09', SID)+ const path = file(join(folder, 'session.jsonl'), [+ JSON.stringify({ payload: { record: { workspace_root: work } } }),+ JSON.stringify({ payload: { kind: 'run', event: { kind: 'started', prompt: 'hi' } } }),+ ].join('\n') + '\n', START + 5_000)+ file(join(folder, 'tool-outputs', 'call_1.txt'), 'output')+ file(join(folder, 'subagent', 'child', 'session.jsonl'), 'x')+ await expect(repair.findLiveSession('muse', work, START)).resolves.toEqual({ sessionId: SID, transcriptPath: path })+ })+it('holds on an unreadable subtree and recovers on a later complete scan', async () => {const path = transcript()const hidden = join(root, 'claude', 'projects', 'unknown'); mkdirSync(hidden)diff --git a/cli/src/lib/sessionRepair.ts b/cli/src/lib/sessionRepair.tsindex 25702dfdc..c1b27fd94 100644--- a/cli/src/lib/sessionRepair.ts+++ b/cli/src/lib/sessionRepair.ts@@ -70,14 +70,18 @@ export interface RepairedSession {hermesHome?: string}+/** The folders beside a Muse `session.jsonl` that are not conversations: skipped, not walked into (and so+ * never counted against MAX_DEPTH). */+const MUSE_NON_TRANSCRIPT_FOLDERS = ['subagent', 'tool-outputs'] as const+interface TranscriptFile { path: string; mtimeMs: number; birthMs: number }/** Collect a complete bounded pool. Truncation must never make two conversations look like one. */-async function transcripts(root: string, budget: { remaining: number }, out: TranscriptFile[], excluded?: string, depth = 0): Promise<void> {+async function transcripts(root: string, budget: { remaining: number }, out: TranscriptFile[], excluded: readonly string[] = [], depth = 0): Promise<void> {for await (const entry of identityEntries(root, budget, depth === 0)) {const full = join(root, entry.name)if (entry.isDirectory()) {- if (entry.name === excluded) continue+ if (excluded.includes(entry.name)) continueif (depth >= MAX_DEPTH) throw new IdentityReadUnavailable('the transcript depth limit was reached')await transcripts(full, budget, out, excluded, depth + 1)continue@@ -222,7 +226,7 @@ async function fileEngineSession(cwd: string,startedAtMs: number,readMeta: (path: string) => Promise<TranscriptMeta | null>,- opts?: { bornOnly?: boolean; excludedDirectory?: string; excludedSessionId?: string },+ opts?: { bornOnly?: boolean; excludedDirectories?: readonly string[]; excludedSessionId?: string },): Promise<RepairedSession | null> {const since = startedAtMs - START_SLACK_MSconst born: RepairedSession[] = []@@ -231,7 +235,7 @@ async function fileEngineSession(const files: TranscriptFile[] = []const budget = identityScanBudget()for (const directory of typeof root === 'string' ? [root] : root) {- await transcripts(directory, budget, files, opts?.excludedDirectory)+ await transcripts(directory, budget, files, opts?.excludedDirectories)}files.sort((a, b) => b.mtimeMs - a.mtimeMs || (a.path < b.path ? -1 : a.path > b.path ? 1 : 0))for (const file of files) {@@ -343,7 +347,7 @@ async function storeSession(? await openFileSessionOf(engine, opts.pid, sessions, cwd,{ expected: opts.expectedProcess, budget: opts.nativeBudget, excludedSessionId: opts.excludedSessionId }): await fileEngineSession(sessions, cwd, startedAtMs, scan,- { ...opts, ...(store.scan.from === 'head' ? { excludedDirectory: store.scan.childFolder } : {}) })+ { ...opts, ...(store.scan.from === 'head' ? { excludedDirectories: [store.scan.childFolder] } : {}) })// The login shell may adopt another home during any native read. Its unseen candidates// invalidate this pool; an explicit profile remains independent of unrelated homes.if (repairRoots(engine, opts?.codexHome).join('\0') !== sessions.join('\0')) {@@ -379,7 +383,8 @@ export async function findLiveSession(// Muse's hooks never fire, so this scan is the ONLY way a muse pane is ever bound. The tree is// `sessions/YYYY/MM/DD/<session-uuid>/session.jsonl` (4 levels — exactly MAX_DEPTH) and nothing in// the path names the project: `workspace_root` in the first record is the only link. Sub-agent- // files live one level deeper under `subagent/`, and must never be adopted as agents of their own.+ // files live one level deeper under `subagent/`, and must never be adopted as agents of their own;+ // `tool-outputs/` (Muse Code 1.4) sits there too and holds no conversation.return fileEngineSession(join(env.MUSE_HOME, 'sessions'), cwd, startedAtMs, async (path) => {if (path.includes(`${sep}subagent${sep}`)) return null// Muse opens sessions of its OWN under the same workspace_root — memory reminders@@ -390,7 +395,7 @@ export async function findLiveSession(// being conversed in has opened a RUN.const identity = await museSessionIdentity(path, root => sameDir(root, cwd))return identity ? { ...identity, sessionId: basename(dirname(path)) } : null- }, { ...opts, excludedDirectory: 'subagent' })+ }, { ...opts, excludedDirectories: MUSE_NON_TRANSCRIPT_FOLDERS })}case 'amp':// The transcripts scanned here are the adapter's own — Amp keeps no conversation on disk, so its