Files
museion/docs/devlog/20261022-issue30-sessions-new-post-from-session-drill-offers_log.md
T
AlexKucera ae234350ef
CI / ci (push) Canceled after 0s
feat(sessions): new post from session & drills (S2.7-8) (#30)
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

6.8 KiB
Raw Blame History

Sessions: New Post from Session & drill offers (S2.7–S2.8)

Date: 2026-10-22 Type: issue Reference: Gitea #30 (PRD S2.7, S2.8; blocked-by #24/#28 both closed)

Goal

A freeform Session can birth a Post (New Post from Session: piece folder, draft, immutable origin: ai — never stats-eligible); drill offers ride the pass finding's motivation moment as pure session flavor; brainstorming is a session started with a brainstorm prompt.

What Was Done

  • PostStore.writeNew gains origin: Post.Origin = .writer (additive default — every existing caller compiles); the session-born path passes .ai via PostsModel.newPostFromSession (write + select + rescan).
  • MentorSessionModel.beginBrainstormSession(pieceTitle:) — a "Brainstorm" rostered session whose first turn is brainstormPrompt over the normal prompt rail; the Sessions pane's New Session control became one Menu ("New Session" / "New Session on <title>" / "New Brainstorm").
  • NewPostFromSessionSheet (pane-local, PromoteAskSheet posture): editable draft candidate prefilled by MentorSessionModel.draftCandidateText (the last "Mentor: " text row, prefix stripped; refusal/connection-shaped rows excluded — ponytail-marked until SessionRow carries speaker identity). Sheet-local error state via create: () -> String? — a failed write keeps the sheet up with the edited draft intact.
  • The shared SessionTranscriptView now carries the freeform composer + liveness + Stop (moved out of MentorPaneView's private extension) — one conversation surface, two panes; MentorPaneView keeps crash card + debug toggle.
  • Sessions actions row: New Post · Fork · Compact — Fork/Compact gated on canStartSession, New Post never engine-gated (it reads in-memory transcript rows).
  • Resume wire fix (#30 dogfood): the real adapter 0.21.5 answers session/load with NO top-level sessionId — the id rides _meta.hermes.sessionProvenance.acpSessionId. resumeSession accepts both shapes; empty-everywhere alone is the unknown-refusal. Live-probed against the real engine binary (create → kill -9 → fresh engine → load) before fixing; the fake ACP server now answers load in the real shape (+ a loadReplayLegacy knob pinning the older contract's acceptance).
  • Pass persona v1.4: "One drill may ride the strongest finding" — the trigger for the seeded micro-drill doctrine (the offer itself is engine-side by design: session flavor, no machinery beyond S2.3).
  • Finish-audit (three reviewers, parallel): the triple-converged confirm() dismissal bug (failed write destroyed the edited draft), stale-error-on-reopen, zero brainstorm pins, untested legacy resume branch — all fixed with pins.

Decisions & Rationale

Decision Rationale
Draft = last mentor text row, edited in an ask-before sheet before anything writes G9 ask-before; the writer curates — no auto-extraction of "the draft" from a transcript that mixes verdicts, drills, and debriefs
Draft candidate extraction string-matches "Mentor: " with a ponytail ceiling Speaker identity in SessionRow is an enum reshape with renderer/replay blast radius — its own ticket; one guarded extraction point covers the class
New Post lands in default project posts, title = first body line Sessions pane has no selected-project context; house slug/title conventions cover the rest
Drill wiring = one persona section, zero app code PRD S2.8: "session flavor, no machinery beyond S2.3" — the seeded micro-drill skill owns the doctrine (motivation moment, ≤2 min, single shelf, the vanish)
Composer lives in SessionTranscriptView The Sessions pane shipped #28 as a read-only transcript; a brainstorm that asks questions with no way to answer is a dead end — one composer, two panes, duplicate deleted
Resume reads both load-response shapes Live-probed: the real wire carries the id in provenance only; the fake's top-level shape stays accepted as the older contract — each branch has its own pin
Brainstorm opener outcome discarded (_ = await sendPrompt) Exact compactActiveSession posture — failures surface as transcript rows

Gotchas & Fixes

Problem Root Cause Fix
"Unable to switch sessions" + "The engine does not know 'Brainstorm'" #28's resume read only the top-level sessionId the real adapter never sends — every real-engine resume misread as engine-unknown Provenance fallback in resumeSession; fake corrected to the real shape so the whole resume suite guards the live wire
Two consecutive single-test failures in full-suite runs (cancelling a held pass, runPass snapshots) Real-Process fake-ACP tests are load-sensitive; concurrent builds/analyzes stressed them Verified each passes in isolation; the definitive full-suite run was made on an idle machine
First confirm() fix incomplete — the sheet still dismissed on failure The pane kept the draft but the sheet's unconditional dismiss() niled it via the binding Triple-converged audit finding: dismiss() deleted; sheet-local error state; flip-cycle verified on the resume pins

Files Changed

File Change Summary
Museion/PostStore.swift writeNew origin param (additive, default .writer)
Museion/PostsModel.swift newPostFromSession(body:home:) — write origin: ai + select + rescan
Museion/MentorSessionModel.swift beginBrainstormSession, brainstormPrompt, draftCandidateText, resume provenance fallback
Museion/SessionTranscriptView.swift Shared composer + liveness + Stop (moved from MentorPaneView)
Museion/SessionsPaneView.swift New Post action + ask sheet, unified New Session menu, engine-free New Post gate
Museion/MentorPaneView.swift Duplicate composer deleted; crash card kept
MuseionTests/ACPClientTests.swift Fake load answers the real provenance shape; loadReplayLegacy knob
MuseionTests/PostStoreTests.swift ai-stamp pin, additive-default pin, ai-immutability-through-overwrite pin
MuseionTests/SessionLifecycleTests.swift Draft-candidate pins, brainstorm pin, legacy-resume pin
Museion/AGENTS.md, MuseionTests/AGENTS.md, AGENTS.md DOX passes (root = analyze stats churn)
ref/writing skills/pass-persona/SKILL.md v1.4 drill-trigger section

Open Items & Next Steps

  • SessionRow speaker identity (enum reshape) — retires the draftCandidateText string-shape ceiling
  • lastError double-routing vs the createProject precedent — lands with the speaker-identity pass
  • Stats capture (S5.1, M4) keys on origin: writer — the ai stamp is the exclusion marker, machinery not yet built
  • Drill offers need a real-engine pass to observe end-to-end (the persona trigger + seeded doctrine are engine-side)

Log written by write-log skill