Skip to content

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

4.7 KB
Raw Blame

Eager Muse and Pi repair

Muse discovery and Pi's lookup at Close were the remaining optional-engine imports in lib/sessionRepair.ts. Native conversation identity must be available before interpretation loads. The new declarations name the record fields, run marker, header limits and folder encoding; the eager kit reads them. Pi's optional search provider delegates to the same header parser while retaining its own read-failure evidence and unsettled-header memo semantics.

The former-code golden was recorded from main d81fea66b526bee3ab2e7612d7c407ed55e1bd66 in separate commit 38717f6c0. Its 47 observations include scheduled Muse runs with no prompt, task/reminder rejection, subagents, ambiguous conversations, custom Pi header IDs, incomplete headers, wrong first entries, lossy folder collisions, duplicate exact IDs and the refusal that keeps an unreadable Pi conversation open. Linux, UTC, clock, file times and disposable homes are pinned. It invokes no host engine binary. The golden fixture remains unchanged after the move.

Muse formerly read an entire transcript on each repair. It now reads 64 KiB, expanding to 4 MiB only when necessary. If a relevant file exceeds the bound without establishing its identity, discovery holds with the reason; it never assumes that the file is absent and selects a competing session. A file known to belong to another workspace cannot hold this lookup. Native I/O failures also preserve uncertainty. The discovery boundary contains these refusals so that another agent and daemon readiness can proceed; Stop/Close still receive the refusal before destructive work. Independent review identified that boundary requirement, and the regression drives the real reconciler through a held Muse process followed by a bindable process.

The older Claude/Codex session-store golden had a separate fixture defect: its second platform pass used a later real clock against the files created for the first pass. Under load, those files aged past the five-second process-start slack. The unchanged main test passed alone. Its fixture clock and stat birth/mtime are now pinned; its recorded JSON is unchanged.

A local cost comparison used the same Node 22.23.2 toolchain on macOS x64, one synthetic transcript of about 64 MiB, its workspace header and run marker first, and 4,096 output records afterward. Ten sequential findLiveSession calls were measured after importing the module, in fresh Node processes with disposable homes. Before the move: 913.3 ms elapsed, 993.2 ms CPU, 752.4 MiB process peak RSS. After: 9.8 ms elapsed, 10.7 ms CPU, 90.5 MiB peak RSS. Peak RSS includes the whole process; this is one controlled workload, not a startup benchmark or a new performance gate.

Private-daemon acceptance removes or stalls the Muse/Pi optional chunks. It covers a scheduled Muse run binding, Pi's preallocated ID closing before a first reply, an incomplete Pi file keeping its process active, and a written Pi conversation closing and resuming with its exact ID. There is no vendor login or synthetic input to an owner's daemon. Mutation checks break the declarations, reader independence, read bound and discovery containment; only assertion failures count.

That acceptance exposed a persistence bug masked by reader attachment: Stop captured and saved Pi's native path, then final retirement saved the still-pathless live row over it. Close succeeded but Resume refused the lost path. A hook could make the same destructive save while Stop awaited its checkpoint. Saved native paths now survive pathless observations only for the same agent, engine, registration, conversation, profile homes and exact process identity. A new known path still replaces the old one; changed identities inherit nothing. Regression tests combine the real Stop, forget and stopped-record store at both save boundaries, with process termination mocked. Additional mutations check that preservation cannot be removed or carried across a different conversation or process.

Two existing Pi compatibility limits are separate from this move. Process-argument discovery accepts a narrower ID syntax than Pi's header reader; broadening it changes the argv golden and search-owner claims. Also, a preallocated ID with no native file can Close with its screen saved, but the resume guard still requires a native conversation file. The acceptance uses ordinary generated IDs and resumes a written conversation. These behaviors need explicit compatibility work rather than silently changing the extraction's golden.

The broader native tree scan and remaining whole-file sidecar/process reads still need bounds and an ambiguity audit. Eager OpenCode launch, Stop/turn-closing facts, Cursor task cleanup and submission declarations also remain. This change completes the eager repair imports, not the full session-control audit.