diff --git a/PRD.md b/PRD.md index e3ade77..015f756 100644 --- a/PRD.md +++ b/PRD.md @@ -18,7 +18,7 @@ - **Provisioning (G3a):** first run creates the `museion` profile if missing, then seeds the writing skills bundled in the app (Serif stack, merged deslop, container personas, demonstrator doctrine, distilled craft canon, drill packs — spec: *The bundled skill set*) into `~/.hermes/profiles/museion/skills/`. Seeding is **additive only** — a bundled skill absent from the profile is copied; an existing one is never overwritten, because the mentor's self-improving skills live there. - **Profile backup (G4):** Museion snapshots `~/.hermes/profiles/museion/` to `~/Library/Application Support/Museion/Backups/` — timestamped, at most once per day on launch, keeping the last 7. Snapshot is a complete copy (credentials included) so restore is one Finder copy-back; backups stay user-local, never in the project or git. - **Content layout (G5, merged):** one Museion Home; a post is a folder `posts//` holding `post.md`, `research/`, `assets/` — created lazily on first write. Further writing types (`essays/`, `stories/`) get the same shape when they arrive; v1 ships `posts/` only. Post id = slug of the draft's first line, computed at first save; explicit Rename moves the folder (the file is always `post.md`); external markdown edits as-is, Import (copy, never move) makes it a Post. ADR-0004. -- **Writing tools (G6, merged; ADR-0008 + ADR-0006):** the Museion binary doubles as the stdio MCP server `museion-tools`, registered into the profile at provisioning — any MCP-capable engine registers it as a client (engine-swap seam — Hermes today, Pi the identified fallback, ADR-0007). Tool surface: `query_learnings`, `submit_fix_cards` — the fix-card tool's argument schema is the fix-card schema; anchors are quote-based (exact substring + occurrence + context), so edits between issue and accept degrade to a loud no-match, never a wrong-span patch. Research stays engine-native; draft stats are computed natively in Swift at capture time — not an agent tool. Pass prompts are Museion-sent minimal stubs (pass name, piece path, tool reminders) — all methodology lives in the profile's skills. The Serif methodology (SKILL.md files, agentskills.io-standard) stays the mentor's operating system. Fallbacks if ACP ever falls short: Hermes gateway JSON-RPC (every feature), HTTP+SSE API server. +- **Writing tools (G6, merged; ADR-0008 + ADR-0006):** the Museion binary doubles as the stdio MCP server `museion-tools`, registered into the profile via `hermes mcp add` once the mode exists (#23) — provisioning never writes `mcp_servers` (#44) — any MCP-capable engine registers it as a client (engine-swap seam — Hermes today, Pi the identified fallback, ADR-0007). Tool surface: `query_learnings`, `submit_fix_cards` — the fix-card tool's argument schema is the fix-card schema; anchors are quote-based (exact substring + occurrence + context), so edits between issue and accept degrade to a loud no-match, never a wrong-span patch. Research stays engine-native; draft stats are computed natively in Swift at capture time — not an agent tool. Pass prompts are Museion-sent minimal stubs (pass name, piece path, tool reminders) — all methodology lives in the profile's skills. The Serif methodology (SKILL.md files, agentskills.io-standard) stays the mentor's operating system. Fallbacks if ACP ever falls short: Hermes gateway JSON-RPC (every feature), HTTP+SSE API server. - **Critique memory home (ADR-0005):** writer learnings live in the Home's `learnings/` (no dot — hand-editable, git-diffable), scoped per content type (`learnings/posts/`, …), one markdown file per learning with decay state in frontmatter. The mentor's own automated memory stays in the profile; Museion never reads or writes it. Fresh start in v1 — verified: the hand-maintained MEMORY.md carries agent-tooling notes, no writing learnings to import. - **Model/provider:** user-managed by editing the `museion` profile's config (currently `zai/glm-5.3`); Museion never touches it. - **Publish (G2, resolved):** Micro.blog via Micropub. Media endpoint accepts PNG (also JPEG, GIF, WebP, SVG, JXL — verified) — ink-sketch illustrations upload as-is. @@ -89,7 +89,7 @@ From the 2026-08-28 sessions (Sudowrite/Muse learnings; issues #9, #10). None of - **S2.1 — First-run engine gate & provisioning.** As the writer, Museion tells me on first run whether Hermes is ready (`hermes acp --check`) and how to install it if not; it then provisions its engine. *AC:* explicit pass/fail, no silent failure — the check reruns on every launch, not just the first; the `museion` profile is created if missing; bundled writing skills are seeded additively — missing ones copied, existing ones never overwritten (G3a). - **S2.2 — The resident mind.** As the writer, the mentor runs as a resident I don't manage. *AC:* app spawns `hermes acp -p museion` (stdio JSON-RPC child); memory/skills/credentials load from `~/.hermes/profiles/museion/`; app quit tears down the child; child crash surfaces a restart prompt, never data loss. - **S2.3 — Session lifecycle.** As the writer, each session is a conversation with the standard affordances. *AC:* new/cancel/fork/resume/compact; every pass auto-creates its session; freeform sessions always allowed, free-floating or Piece-associated; sessions are engine-owned — Museion only UIs them (swap the engine, transcripts stay behind); cancel mid-pass stops the agent; streamed output renders live. -- **S2.4 — Writing tools, Museion-hosted.** As the mentor, I have purpose-built tools. *AC:* the Museion binary serves them over stdio MCP (`museion-tools`), registered into the `museion` profile at provisioning (ADR-0008); surface = `query_learnings` + `submit_fix_cards`, typed and quote-anchored (ADR-0006); callable mid-pass; outputs land in Museion's UI; passes are Museion-driven over ACP; research stays engine-native; draft stats are computed natively in Swift at capture time — not an agent tool; `query_learnings` returns only the visible set — Decay filtering happens inside `museion-tools`, the mentor never sees the mechanics. +- **S2.4 — Writing tools, Museion-hosted.** As the mentor, I have purpose-built tools. *AC:* the Museion binary serves them over stdio MCP (`museion-tools`), registered into the `museion` profile via `hermes mcp add` once the mode exists (#23); provisioning never writes `mcp_servers` (#44); surface = `query_learnings` + `submit_fix_cards`, typed and quote-anchored (ADR-0006); callable mid-pass; outputs land in Museion's UI; passes are Museion-driven over ACP; research stays engine-native; draft stats are computed natively in Swift at capture time — not an agent tool; `query_learnings` returns only the visible set — Decay filtering happens inside `museion-tools`, the mentor never sees the mechanics. - **S2.5 — Trust model.** As the writer, the mentor acts only within trust levels: auto-act / inform-after / ask-before / never-do. *AC:* trust level maps to UI (dimmed inline edits vs blocking asks); never-do actions never auto-apply. Defaults, not configurable in v1: research fetch = auto-act; candidate source-note = inform-after; apply any fix, promote, keep note, publish = ask-before; delete files, touch anything outside Home and profile, shell, git = never-do. - **S2.6 — The engine is backed up.** As the writer, the mentor's accumulated state (memory, skills, history) survives profile corruption or a bad update. *AC:* on launch, if the last snapshot is older than a day, Museion copies `~/.hermes/profiles/museion/` to a timestamped snapshot under `~/Library/Application Support/Museion/Backups/`, keeping the last 7 (G4); complete copy, credentials included; restore is manual copy-back in v1; snapshots never land in the project or git. - **S2.7 — Draft from session.** As the writer, a freeform session can birth a Post. *AC:* "New Post from Session" creates the piece folder, writes the draft, stamps `origin: ai` (immutable — never stats-eligible); brainstorming is a session started with a brainstorm prompt — no separate machinery; session↔Post association stays by name/convention. @@ -187,7 +187,7 @@ The mentor's mind ships as markdown skills inside the app, seeded additively int - **G4 — Profile backup (this session).** User decision: Museion keeps timestamped snapshots of the whole `museion` profile — the mentor's memory and improved skills are irreplaceable state, not reinstallable. Defaults: daily on launch, last 7 kept, complete copy including credentials (same-machine threat model), restore manual in v1. - **Build order → loop-first (this session).** M0 bridge spike before editor polish; differentiator (M3) before conveniences (M5–M6). - **G5 — Content layout → one Home, lazy post folders (merged from both grill sessions).** Museion Home (`~/Museion` default, Settings-editable, repoint-only — pi session) with the main session's shape: `posts//` holding `post.md`, `research/`, `assets/`, created lazily on first write; post id = slug of the first line at first save; explicit Rename moves the folder; external markdown edits as-is, Import (copy) makes it a Post. New content types copy the shape. ADR-0004. -- **G6 — Writing tools → in-app Swift MCP server, minimal surface (merged).** Host from the main session (ADR-0008): the binary doubles as `museion-tools`, registered at provisioning; surface from the pi session: `query_learnings` + `submit_fix_cards` only, typed and quote-anchored (ADR-0006); passes Museion-driven over ACP — the app sends a minimal stub prompt, methodology stays in the skills; stats native in Swift at capture; research engine-native. Model/provider user-managed in the profile config. +- **G6 — Writing tools → in-app Swift MCP server, minimal surface (merged).** Host from the main session (ADR-0008): the binary doubles as `museion-tools`, registered via `hermes mcp add` once the mode exists (#23) — provisioning never writes `mcp_servers` (#44); surface from the pi session: `query_learnings` + `submit_fix_cards` only, typed and quote-anchored (ADR-0006); passes Museion-driven over ACP — the app sends a minimal stub prompt, methodology stays in the skills; stats native in Swift at capture; research engine-native. Model/provider user-managed in the profile config. - **G7 — Learnings → the Home, per content type (merged).** `/learnings//`, one markdown file per learning with decay state in frontmatter (main session) — per-writer, portable, Museion-owned, fresh start with no legacy import (pi session; verified nothing to import). The engine owns nothing. ADR-0005. - **G8 — Decay → output clock (merged).** Resurface after 10 passes of that content type (pi session), doubling per re-dismiss; per-learning `resurface_after` frontmatter override (main session). - **G9 — Trust defaults (pi session).** Research fetch = auto-act; candidate source-note = inform-after; apply/promote/keep-note/publish = ask-before; delete files, anything outside Home+profile, shell, git = never-do. Not configurable in v1. diff --git a/docs/adr/0008-writing-tools-in-app-swift-mcp-server.md b/docs/adr/0008-writing-tools-in-app-swift-mcp-server.md index da312c2..b1441ad 100644 --- a/docs/adr/0008-writing-tools-in-app-swift-mcp-server.md +++ b/docs/adr/0008-writing-tools-in-app-swift-mcp-server.md @@ -1,3 +1,3 @@ # 0008 — Writing tools are an in-app Swift MCP server -Museion's writing tools (`query_learnings`, `submit_fix_cards`) ship inside the app binary, exposed as a stdio MCP server (`museion-tools`) and registered into the `museion` profile at provisioning (`hermes mcp add museion-tools --command …`). One signed artifact, native file access, and the fix-card tool exists from M0. Draft stats are computed natively in Swift at capture (not an agent tool) so the unaided-first-draft guarantee is enforced in code; research stays engine-native. Rejected: a separate Python server (second runtime to ship and sign) and skills-only (cards would need prose parsing — reversing later rewrites the card path). Model/provider stays user-managed in the profile's own config — Museion never touches it. +Museion's writing tools (`query_learnings`, `submit_fix_cards`) ship inside the app binary, exposed as a stdio MCP server (`museion-tools`) and registered into the `museion` profile via `hermes mcp add museion-tools --command …` once the mode exists (#23) — the provisioning pass itself never writes `mcp_servers` (#44). One signed artifact, native file access, and the fix-card tool exists from M0. Draft stats are computed natively in Swift at capture (not an agent tool) so the unaided-first-draft guarantee is enforced in code; research stays engine-native. Rejected: a separate Python server (second runtime to ship and sign) and skills-only (cards would need prose parsing — reversing later rewrites the card path). Model/provider stays user-managed in the profile's own config — Museion never touches it.