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
75 lines
2.8 KiB
Swift
75 lines
2.8 KiB
Swift
//
|
|
// Pass.swift
|
|
// Museion
|
|
//
|
|
// #24 (S3.1): the pass substrate's shared vocabulary — PassKind (the app's
|
|
// own Pass 1 / Pass 2 names; the skill stack's vocabulary stays engine-side,
|
|
// CONTEXT.md) and PassContext, the minimal engine-facing prompt shape.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// One structured critique pass over a Piece (#24). Pass 1 = paragraph
|
|
/// level and up; Pass 2 = sentence level and below. App vocabulary only —
|
|
/// strictly 'Pass 1'/'Pass 2' (CONTEXT.md).
|
|
nonisolated enum PassKind: String, CaseIterable {
|
|
case pass1 = "Pass 1"
|
|
case pass2 = "Pass 2"
|
|
|
|
/// What the pass critiques (CONTEXT.md).
|
|
var level: String {
|
|
switch self {
|
|
case .pass1: "paragraph level and up"
|
|
case .pass2: "sentence level and below"
|
|
}
|
|
}
|
|
|
|
/// The fixed pre-pass snapshot filename in `<piece>/passes/` — latest
|
|
/// per pass type kept (a re-run overwrites in place).
|
|
var snapshotFileName: String {
|
|
switch self {
|
|
case .pass1: "pass-1.md"
|
|
case .pass2: "pass-2.md"
|
|
}
|
|
}
|
|
|
|
/// The Pass State a completed pass advances to.
|
|
var doneState: Post.PassState {
|
|
switch self {
|
|
case .pass1: .pass1Done
|
|
case .pass2: .pass2Done
|
|
}
|
|
}
|
|
}
|
|
|
|
/// The engine-facing pass context (#24, PRD G6): pass name, piece path,
|
|
/// tool reminders — the methodology itself lives engine-side and never
|
|
/// travels through the app.
|
|
nonisolated enum PassContext {
|
|
/// The minimal engine-facing prompt for one pass over one piece.
|
|
/// Pinned shape — keep it a small constant, not a template system.
|
|
/// Restored contract (#23, museion-tools rail): findings travel as
|
|
/// fix-card tool calls (submit_fix_cards) — the reply carries the
|
|
/// verdict, never the findings. #29: fact-checking research travels
|
|
/// as candidate source-note tool calls (submit_research_notes) —
|
|
/// engine-owned cargo in the session, never written by the engine.
|
|
static func stub(kind: PassKind, pieceURL: URL, hasResearch: Bool) -> String {
|
|
"Pass \(kind.rawValue) — \(kind.level).\nPiece: \(pieceURL.path)\n"
|
|
+ (hasResearch
|
|
? "Research notes: \(pieceURL.deletingLastPathComponent().appendingPathComponent("research").path)\n"
|
|
: "")
|
|
+ "Critique the piece for this pass. Fact-check claims where needed — research findings "
|
|
+ "travel as candidate source-note tool calls (submit_research_notes), never written to disk. "
|
|
+ "Deliver the verdict in your reply — "
|
|
+ "findings travel as fix-card tool calls (submit_fix_cards). Do not write to the piece folder."
|
|
}
|
|
|
|
/// Honest app-side token estimate BEFORE a pass runs (PRD: predictable,
|
|
/// shown before, never a deterrent).
|
|
static func estimateTokens(kind: PassKind, body: String, pieceURL: URL, hasResearch: Bool) -> Int {
|
|
// chars/4 — the standard ~4-characters-per-token approximation, rounded up.
|
|
let total = (stub(kind: kind, pieceURL: pieceURL, hasResearch: hasResearch) + body).count
|
|
return (total + 3) / 4
|
|
}
|
|
}
|