# Sessions: New Post from Session & drill offers (S2.7–S2.8)
> **Date:** 2026-10-22
> **Type:** issue
> **Reference:** [Gitea #30](https://git.babylondreams.de/AlexKucera/museion/issues/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 \
" / "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*