Commit Graph
9 Commits
Author SHA1 Message Date
AlexKucera 97e86cf62d feat(mentor): blind read A/B judgment (#122)
CI / ci (push) Canceled after 0s
A purposeful writer action on the open post — the "Blind Read" button
beside Run Pass — triggers a whole-document advisory judgment: the
current document against the Pass-start snapshot (the newest
passes/pass-N.md on disk), decided by a FRESH session of the same
museion profile over the existing one-shot ACP rail. Both versions
travel inline in one prompt under neutral A/B position labels with
randomized order — the judge never learns which is the rewrite — and
the A/B-to-origin reveal appends only after the verdict, so the mapping
cannot leak; cancelled, refused, and spawn-failed turns reveal nothing.

Advisory-only per decision #120: no Pass State advance, no cards, no
Learnings, the roster never grows — the verdict is display-only and
dies with the transient transcript. The writer stays judge of record;
demonstrator picks and Fix Card status are untouched. Honest refusals
for the degenerate states: no snapshot yet, an unchanged document, or
a busy rail (passes and reads refuse each other; the pass bar's one
Cancel ends either).

The pass engine's spawn/session/teardown block became one shared
runOneShot rail (failure rows speak the run's own name), the pass-bar
button gates on a derived openPieceHasSnapshot flag, the fake ACP
gained a prompt-log observable, and the GLOSSARY "Blind Read" term
landed with the issue.

Finish-audit (three reviewers): a refusal still ends .ended, so the
reveal now gates on the stopReason (flip-verified pin), plus the
Cancel-rail and pass/blind-read exclusivity pins. Suite 500; swiftformat
clean; swiftlint adds no violations over the HEAD baseline.

Closes #122
2026-10-30 17:31:00 +01:00
AlexKucera 1c697440d8 feat(mentor): per-surface engine lifecycle (#137)
CI / ci (push) Canceled after 0s
Profiles S4: passes run on their OWN one-shot engines —
`hermes acp -p museion-passN` spawns per pass run and tears down at
the verdict, so a model switch costs nothing (the next spawn reads
fresh config). The verdict streams into a TRANSIENT unrostered
transcript (#129's ruling: one Sessions surface over the chat
engine; a rostered pass session would be unresumable by the chat
engine). `beginPassSession` died with it — passes never mint
sessions; the #28 roster pins flipped to the transient posture.

The chat engine stays resident (adopted museion profile): a Chat
model change in Settings fires onChatSurfaceWrite after a
successful chat-surface write only, wired to requestRestart —
re-spawn in place when idle (resuming the pre-restart active
session), deferred to turn end while any turn streams (#129).

Missing-key posture (#132): refreshPassReadiness reads both pass
profiles' providers and their .env keys at pane entry; Run Pass
disables naming the provider with an Open Settings link, .unknown
never blocks, and the guard refuses before anything touches disk.

Finish-audit (ponytail/security/general fanout) applied: the
general reviewer's Medium — a session/new/load/fork completing
mid-pass stole the active surface and lost the Cancel to the wrong
engine — fixed with ONE claimActive gate across the post-await
activation writers, pinned deterministically via the fake's
loadReplayHold park + a mode-file flip (flip-verified: guard off
fails on the steal observables and the misrouted-cancel hang).
Also fixed: a spawn-window cancel loss in stopStreaming (keyed on
the transient entry, not the late-arriving wire id), and a
PRE-EXISTING rescan bug where a stale scan snapshot "vanished" a
just-opened piece and killed its session, cancelling the edit
debounce — the vanish-kill now re-checks disk and the watched
home. Ponytail cut ~59 lines of test duplication; the app target's
only force-unwrap is gone.

Suite 477 (was 472): EngineLifecycleTests new (own-engine
end-to-end, held-pass cancel, idle + deferred restart ordering,
readiness, steal pin), +3 Settings hook pins, one duplicate pin
deduplicated. swiftformat clean, swiftlint at HEAD baseline.

Closes #137
2026-10-28 17:26:40 +01:00
AlexKucera ae234350ef feat(sessions): new post from session & drills (S2.7-8) (#30)
CI / ci (push) Canceled after 0s
A freeform Session births a Post. "New Post" in the Sessions pane
opens an ask-before sheet prefilled with the session's last mentor
reply (editable, G9); ONE confirm materializes the piece under
projects/posts/ stamped origin: ai - immutable frontmatter, never
stats-eligible - and opens it in Posts; a failed write keeps the
sheet up with the reason inline and the draft intact. writeNew
gains an origin parameter (additive default .writer, every existing
caller compiles).

"New Brainstorm" is a session started with an opener prompt - no new
machinery (beginBrainstormSession over the normal new+prompt rails).
The freeform composer (input, liveness, Stop) moved from
MentorPaneView into the shared SessionTranscriptView: one
conversation surface, two panes - the Sessions pane stops being a
read-only transcript. Drill offers (S2.8) wire as one pass-persona
section (v1.4): the seeded micro-drill doctrine owns the motivation
moment, the two-minute bound, the single shelf, and the vanish -
session flavor, no machinery beyond S2.3.

Resume now speaks the real adapter wire. Live-probed against the
engine: 0.21.5 answers session/load with the id at
_meta.hermes.sessionProvenance.acpSessionId and NO top-level
sessionId - resumeSession accepts both shapes; every prior
real-engine resume misread as "engine does not know this session".
The fake ACP server answers load in the real shape (a
loadReplayLegacy knob pins the older contract), so the whole resume
suite guards the live wire.

New pins: draft-candidate extraction (last mentor row wins; thought/
card/research/raw lanes and refusal/connection rows never prefill),
ai-stamp write + immutability through overwrite, brainstorm roster +
labeled opener, legacy-shape resume. Finish-audit (three
reviewers, parallel) converged on the confirm() dismissal that
destroyed the edited draft on a failed write - fixed with
sheet-local error state (stale-refusal re-show dies with the
presentation) - and surfaced the missing brainstorm and legacy-shape
pins; the resume fix was flip-verified (removing the provenance
fallback fails the provenance pins). Full suite green (379 tests).

Closes #30
2026-10-22 17:04:12 +02:00
AlexKucera b02d36bb5d feat(mentor): research & library-light (S8) (#29)
CI / ci (push) Canceled after 0s
The mentor researches mid-pass and its findings arrive as candidate
source-notes with provenance inside their Session. A third museion-
tools tool, submit_research_notes, is the typed rail (ADR-0006
posture): decode-validate only, reply {"received": N}, write NOTHING
— the session is the holding area, and keeping is the writer's act.

Candidates ride the transcript as first-class rows (researchNote):
parsed from the tool call's rawInput by payload shape — the notes
array routes before the fix-card parse, titles are display text —
one row per note, all-or-nothing per batch, the wire's whitespace
rule mirrored so both boundaries agree. Resume re-materializes them
for free: replays re-run the same parse; dispositions reset honestly
(they were never persisted — engine-owned cargo, ADR-0007).

The writer curates in place (full cards in the shared transcript, no
palette — a handful curates where it lands): Keep opens the
ask-before sheet (G9; PromoteAskSheet posture — inline refusal,
buttons kept) and ONE confirm lands one plain markdown note with
provenance into the piece's research/ via writeResearchNote — the
one folder(of:) id lookup anchors it inside this Home, a symlinked
research/ refuses, collision -2; Reject vanishes, recording nothing.
The pass stub names the rail and forbids the engine writing
candidates itself; kept notes flip hasResearch, so every later pass
sees the research/ path (S8.3 at v1 depth).

Finish-audit (three reviewers) drove the whitespace-parity and
shape-routing fixes, the ResearchNoteContent dedup, and a poll-loop
fix for the debounce rig's sidecar half that the larger suite's load
had pushed past its fixed sleep — full suite green (373 tests).

Closes #29
2026-10-22 14:06:16 +02:00
AlexKucera 9895614b7e feat(sessions): session lifecycle UI (S2.3) (#28)
CI / ci (push) Canceled after 0s
Each Session is a conversation Museion UIs, never owns. The mentor
bridge hosts multiple engine-owned sessions: per-session transcripts
keyed by wire sessionId behind same-named proxies (every existing
caller compiles unchanged), a names-only roster at Application
Support/sessions.json (0600; id/name/pieceTitle/date — the words
stay engine-owned per ADR-0007), and the standard affordances over
the wire: session/new, session/load, session/fork, compact as the
/compress slash prompt, session/cancel as the Stop rail.

The Sessions pane replaces its placeholder: roster list (piece-
associated by name when Posts has an open piece), row-click resume
with the engine's full-history replay (user turns included), Fork ·
Compact, live streaming with Stop; every pass auto-creates its
rostered session and streams into it; the transcript renderer is
shared with the mentor pane. Notification hops ride the main queue
(FIFO with the continuation resume) so the adapter's replay-before-
response contract is guaranteed, not probabilistic.

Resume refusals are honest and entry-attributed (an engine-unknown
session never fabricates history); concurrent replays refuse instead
of interleaving; restart replays from the engine rather than trusting
a diverging local copy. Finish-audit (three reviewers) surfaced the
concurrent-resume race, the dead restart branch, the runPass guard
window, the 15 s session/load default, and the missing createSession
backstop — all fixed and pinned (12 lifecycle pins; 359 tests green).

Closes #28
2026-10-22 12:21:12 +02:00
AlexKucera 154bb8a114 test(mentor): cancel-ack fake + deferred teardown
CI / ci (push) Canceled after 0s
The fake ACP engine's hangOnPrompt mode slept oblivious to
session/cancel, so a cancelled turn was only observable through
teardown and the pass bar's Cancel rail was never individually
discriminated. hangOnPrompt now holds the turn reading: session/cancel
answers the hanging prompt with stopReason "cancelled" (the real
engine's contract); stdin EOF without a cancel answers end_turn so
the child exits.

New pin 'cancelling a held pass ends the turn cancelled with no
advance' (RED->GREEN; bounded polls, so an emptied cancelPass fails
the pin instead of hanging the suite). Every fake-spawning test (27
rigs across ACPClientTests + PassRunTests) tears down via defer at
rig creation — a cancelled or interrupted test cannot leak the child;
trailing happy-path teardowns removed, mechanism/bound teardowns kept
and commented. Harness docs updated to match; 316 tests green.

Closes #124
2026-10-20 19:35:17 +02:00
AlexKucera 683ddf8426 feat(mentor): museion-tools MCP server (#23)
CI / ci (push) Canceled after 0s
Headless --serve-mcp role in the app binary: NDJSON JSON-RPC on stdio
exposing query_learnings and submit_fix_cards (ADR-0006 cards,
anchor-validated; stale lands flagged, never rejected), registered
into the museion profile at provisioning. Cards persist per piece
under <piece>/cards/ and surface in a floating Fix Cards palette
with pass-stamped provenance.

Live dogfood drove the shape: session/prompt waits pass length (the
15 s request default abandoned working turns), a liveness row and a
persisted Debug checkbox (off) split writing sessions from debug
chatter, the verdict references findings by title only while the
cards carry the detail (persona v1.3 — tools work in silence), and
the #24 pass rails (pass bar, TurnOutcome seam, snapshots) ride in.

Three-reviewer audit round: piece-path shape guard closes the
JSON-drop and substring-oracle holes, nested submit rawInput parsing
(the flat parser never matched the live rail), missing stopReason
never advances a pass, 1 MB stdin cap, card scan off MainActor.
296 tests green; every behavioral fix flip-verified.

Closes #23
2026-10-20 12:20:54 +02:00
AlexKucera de76a50cc6 fix(acp): repair mentor bridge for adapter 0.21.5
Two bugs after the engine update, both found via a live NDJSON
repro against the real binary:

session/new now requires mcpServers in the ACP SDK schema
(NewSessionRequest). Museion sent only cwd, the engine answered
-32602, the handshake threw, and the pane showed "the mentor
engine stopped" — a validation rejection dressed as a crash. Send
the honest empty list; Museion ships no MCP servers (#44
invariant, now pinned on the wire by a strict fake in tests).

The advisory version-drift note compared raw strings: the gate
records the derived version from `acp --version`
(0.21.5+2177.g735e426) while initialize answers the base version
(agentInfo.version -> 0.21.5), fabricating drift on every launch.
Compare base versions (strip +build metadata); real drift still
fires.

Wire facts re-verified against adapter 0.21.5; docs updated.
2026-10-02 11:32:49 +02:00
AlexKuceraandClaude f21d3a6844 feat(acp): add M0 ACP bridge — engine child + mentor pane (fixes #14)
CI / ci (push) Canceled after 0s
Spawn hermes acp -p museion over NDJSON JSON-RPC stdio via a
hand-rolled thin client (no Swift SDK exists). The mentor debug
pane streams replies, renders fix-card tool calls as structured
cards (ADR-0006), cancels via session/cancel, tears down on quit
(willTerminate), and surfaces a restart prompt on engine crash —
never data loss. Version verify against state.json is advisory.

Fake ACP server test double (zsh speaking real NDJSON) covers
handshake, streaming + fix-card, drift, crash latch, cancel,
teardown. 36/36 tests green; finish-audit fixes included (wired
binaryPath, focus-loss teardown bug, double onCrash latch).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-16 18:57:41 +02:00