docs: fold design-grill decisions into PRD

Record the twelve build-time decisions from the grill session so
M0 starts with no open questions:

- PRD: project layout, tools host, learnings home/scope, trust
  defaults, decay numbers, post-id naming, token storage (G5-G7
  plus seven stories patched)
- CONTEXT.md: project glossary (17 terms)
- ADR-0004 critique memory lives in the project, not the profile
- ADR-0005 fix cards travel as typed MCP tool calls
- ADR-0006 writing tools ship as in-app Swift MCP server
This commit is contained in:
AlexKucera committed 2026-08-26 21:49:58 +02:00
1 parent 92cd748d00
commit 4616dd80df
7 files changed
+86 -8

No files matched your search

+1
View File
@@ -108,3 +108,4 @@ When the user requests a durable behavior change, record it here or in the relev
| `MuseionTests/AGENTS.md` | Swift Testing unit suite (hosted in the app) |
| `MuseionUITests/` | XCUITest smoke test — single file, no child doc yet |
| `docs/AGENTS.md` | Durable documentation — ADRs and their conventions |
| `CONTEXT.md` | Binding project glossary — shared vocabulary for app, mentor, and docs |
+61
View File
@@ -0,0 +1,61 @@
# Museion
The Agentic Writing Environment: a native macOS shell where a writer's project, a resident AI mentor, and the writer's own critique memory work together. This glossary is the shared language of the app, the mentor, and the docs.
## Language
### The workspace
**Project**:
The folder a writer opens in Museion; the whole body of work. Plain files on disk, no proprietary store.
_Avoid_: vault, workspace, library (for the project itself)
**Post Type**:
A kind of work, giving the project's top-level folders — `posts/` first; `essays/`, `stories/` later, same shape.
_Avoid_: category, document class
**Post**:
One piece of writing: a folder (`posts/<post id>/`) holding `post.md`, its `research/`, and its `assets/`.
_Avoid_: document, note, file (the file is `post.md`)
**Post ID**:
The post folder's name — the post's durable identity.
**Research Note**:
A kept source-finding with provenance, living in its post's `research/`. Candidates wait until kept; rejected ones vanish.
_Avoid_: source card, clip
**Assets**:
The per-post illustration files, checked against the style guides before the post may publish.
**Learning**:
A writer's recurring weakness, deliberately promoted from an accepted fix card. On-purpose writer memory — distinct from the mentor's own automated memory, which Museion never touches. Lives in the project's `learnings/`, scoped per writing type (`learnings/posts/`, later `learnings/stories/`, …).
_Avoid_: critique entry, memory (ambiguous with the mentor's), MEMORY.md (the pre-Museion ancestor)
### The loop
**Mentor**:
The resident AI agent — a fierce editor and teacher, not a ghostwriter. A Hermes agent under the Museion profile; the writer never manages its process.
_Avoid_: assistant, copilot, bot
**Engine**:
Hermes Agent, user-installed. Museion is the shell; Hermes is the mind.
**Museion Profile**:
The isolated Hermes profile (`museion`) the mentor always runs under: its config, skills, credentials, automated memory. Holds *how* to critique, never *what* was learned.
_Avoid_: the mentor's memory (conflates profile with learnings)
**Pass**:
A structured mentor run over a draft: Pass 1 (compose) or Pass 2 (line-level hunt).
_Avoid_: review, edit (too generic)
**Fix Card**:
One critique finding — problem, diagnostic question, fix — anchored to a text span. The unit of mentor output, writer acceptance, and learning promotion; travels as a structured tool call, never as prose to parse.
_Avoid_: suggestion, comment, annotation
**Unaided First Draft**:
A draft's state before any mentor output has touched it — the only text whose stats measure the writer.
_Avoid_: raw draft
**Trust Level**:
How the mentor may act: auto-act, inform-after, ask-before, never-do — set per action type.
+14 -7
View File
@@ -17,6 +17,10 @@
- **Profile isolation (G3, this session):** Museion always runs Hermes under the dedicated `museion` profile (`~/.hermes/profiles/museion/` — isolated config, memory, skills, credentials, chat history). Coding learnings and writing learnings never mix. Not configurable in v1.
- **Provisioning (G3a):** first run creates the `museion` profile if missing, then seeds the writing skills bundled in the app (Serif stack) 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.
- **Project layout (G5):** the opened folder is the project; a post is a folder `posts/<post id>/` 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.
- **Writing tools host (G6, ADR-0006):** the Museion binary doubles as the stdio MCP server `museion-tools`, registered into the profile at provisioning. Fix cards travel as its typed tool calls (ADR-0005) — the 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.
- **Critique memory home (ADR-0004):** writer learnings live in the project's `learnings/` (no dot — hand-editable, git-diffable), scoped per writing 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.
- **Model/provider:** user-managed by editing the `museion` profile's config (currently `zai/glm-5.3`); Museion never touches it.
- **Writing tools register Hermes-side as MCP tools** (ACP carries the editor↔agent channel; MCP carries the agent's tools): edit-pass runner, critique-memory query/promote, draft stats, research. 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.
- **Publish (G2, resolved):** Micro.blog via Micropub. Media endpoint accepts PNG (also JPEG, GIF, WebP, SVG, JXL — verified) — ink-sketch illustrations upload as-is.
- **Build order:** loop-first — bridge spike (M0) before editor polish; the differentiator (critique memory) lands in M3, not last.
@@ -65,7 +69,7 @@ M0–M3 is the ~3-month differentiator core; M4–M7 are sheddable in that order
### Editor surface (M1)
- **S1.1 — Open a project.** As the writer, I open a folder and see my posts and drafts listed, so the folder is the project. *AC:* the list mirrors disk; new/rename/delete round-trip to `.md` files.
- **S1.1 — Open a project.** As the writer, I open a folder and see my posts and drafts listed, so the folder is the project. *AC:* the list mirrors disk (`posts/<id>/post.md`; folders created lazily on first write); new/rename/delete round-trip to the file system; a new post's folder is named from its first line's slug at first save.
- **S1.2 — Write in calm.** As the writer, I edit in a distraction-free focus mode, so the tool disappears. *AC:* centered focus mode; autosave to disk; no proprietary store — every state survives closing the app.
### Mentor agent over the bridge (M0, M2)
@@ -73,8 +77,8 @@ M0–M3 is the ~3-month differentiator core; M4–M7 are sheddable in that order
- **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 `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 work session is a conversation I control. *AC:* new/cancel/fork per session; cancel mid-pass stops the agent; streamed output renders live.
- **S2.4 — Writing tools, Hermes-side.** As the mentor, I have purpose-built tools: edit-pass runner, critique-memory query/promote, draft stats, research. *AC:* registered as MCP tools in the `museion` profile; callable mid-pass; outputs land in Museion's UI.
- **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.
- **S2.4 — Writing tools, Hermes-side.** As the mentor, I have purpose-built tools: edit-pass runner, critique-memory query/promote, draft stats, research. *AC:* served by the Museion binary itself over stdio MCP (`museion-tools`), registered into the `museion` profile at provisioning (ADR-0006); callable mid-pass; outputs land in Museion's UI.
- **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: file mutation outside card apply = ask-before; card apply = per-card accept; publish = ask-before; everything else = inform-after. No settings UI in v1.
- **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.
### Structured edit passes → fix cards (M2)
@@ -86,9 +90,9 @@ M0–M3 is the ~3-month differentiator core; M4–M7 are sheddable in that order
### Persistent critique memory — the load-bearing feature (M3)
- **S4.1 — Promote by confirmation.** As the writer, only my explicit confirmation promotes a fix card into persistent critique memory — never a raw repetition counter. *AC:* one confirm = one entry, carrying the fix-card fields plus provenance.
- **S4.2 — Dismiss with decay.** As the writer, dismissed patterns fade instead of haunting me. *AC:* dismissed entries resurface at most after a decay interval; repeated dismissal buries further; decay is configurable.
- **S4.3 — The mentor remembers.** As the writer, every future pass consults my critique memory, so recurring weaknesses surface as fix cards. *AC:* stored as plain markdown (formalized `.learnings/`), human-readable and git-diffable.
- **S4.4 — Mine alone.** As the writer, my memory is per-writer and portable. *AC:* lives under the project/profile as plain files; importable from today's hand-maintained MEMORY.md.
- **S4.2 — Dismiss with decay.** As the writer, dismissed patterns fade instead of haunting me. *AC:* a dismissed learning resurfaces after 3 posts of its writing type; each further dismissal doubles the interval (3 → 6 → 12 …); per-learning `resurface_after` frontmatter overrides.
- **S4.3 — The mentor remembers.** As the writer, every future pass consults my critique memory, so recurring weaknesses surface as fix cards. *AC:* stored as plain markdown in the project's `learnings/<writing type>/` (ADR-0004) — one file per learning, human-readable and git-diffable.
- **S4.4 — Mine alone.** As the writer, my memory is per-writer and portable. *AC:* lives in the project as plain files; importable from today's hand-maintained MEMORY.md.
### Measurable improvement (M4)
@@ -101,7 +105,7 @@ M0–M3 is the ~3-month differentiator core; M4–M7 are sheddable in that order
### Publish path (M7)
- **S7.1 — Draft then publish.** As the writer, I send a post to Micro.blog as a draft first, then publish. *AC:* `POST /micropub` with `h=entry`, markdown `content`, `name` for the title, `post-status=draft` → publish; Bearer app-token auth.
- **S7.1 — Draft then publish.** As the writer, I send a post to Micro.blog as a draft first, then publish. *AC:* `POST /micropub` with `h=entry`, markdown `content`, `name` for the title, `post-status=draft` → publish; Bearer app-token auth — token in Keychain, entered once; no OAuth in v1.
- **S7.2 — Illustrations travel with it.** As the writer, illustrations upload and attach with alt text. *AC:* `q=config` → media-endpoint → multipart PNG upload → `202` + `Location` URL → attached as `photo` with `mp-photo-alt`.
### Research & library-light (M5)
@@ -151,6 +155,9 @@ M0–M3 is the ~3-month differentiator core; M4–M7 are sheddable in that order
- **G3a — Provisioning + skill seeding (this session).** User decision: Museion creates the `museion` profile if missing and copies its bundled writing skills (Serif stack, shipped as app resources) into the profile. Seeding is additive-only so it never clobbers the mentor's self-improved skills — a later Museion version adds new skills, never overwrites old ones.
- **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–M7).
- **G5 — Project layout → lazy post-folder convention (this session).** `posts/<post id>/` holding `post.md`, `research/`, `assets/`, created on first write; new writing types copy the shape. Post id = slug of the first line at first save.
- **G6 — Writing tools → in-app Swift MCP server (this session, ADR-0006).** One artifact serves the tools and the UI; fix cards travel as typed tool calls (ADR-0005) with quote-based anchors. Trust defaults fixed (S2.5); model/provider user-managed in the profile config.
- **G7 — Learnings scope → global per writing type (this session).** `learnings/posts/` etc., one file per learning; decay = resurface after 3 posts, doubling per dismissal, per-learning override. Micropub token → Keychain, no OAuth in v1.
## Stress-test verdict № 1 (2026-08-26 — carried from MISSION.md)
+1 -1
View File
@@ -10,7 +10,7 @@ Owned by the root AGENTS.md contract.
## Local Contracts
- ADRs live in `docs/adr/`, sequentially numbered `NNNNN-slug.md` (currently `0001`–`0003`: stack, license, forge/CI).
- ADRs live in `docs/adr/`, sequentially numbered `NNNNN-slug.md` (currently `0001`–`0006`: stack, license, forge/CI, critique-memory home, fix-card transport, writing-tools host).
- ADR format follows the domain-modeling skill's `ADR-FORMAT.md`: short title + 1–3 sentences; optional Considered Options / Consequences only when they earn their place.
## Work Guidance
@@ -0,0 +1,3 @@
# Critique memory lives in the project, not the Hermes profile
Museion keeps two memory systems deliberately separate. The mentor's own automated memory lives inside the `museion` Hermes profile, is owned by Hermes, and is never read or written by Museion. The writer's deliberate learnings are plain markdown in the project's `learnings/` folder — git-diffable, portable with the body of work, importable from the hand-maintained MEMORY.md. The profile holds *how* to critique (skills, config); the project holds *what* was learned. Consequence: G4 profile snapshots do not back up learnings — git does; moving machines takes both.
@@ -0,0 +1,3 @@
# Fix cards travel as structured MCP tool calls
Mentor findings reach the app as typed tool calls from a Hermes-side MCP writing tool — the fix-card schema is the tool's argument schema — rendered from ACP tool-call events, never parsed out of streamed prose. One schema serves the card UI, the apply-write, and learning promotion; M0's round-trip test exercises exactly this rail. Rejected: prose parsing (fragile, untyped) and file-watching spools (cards are conversation events, not artifacts).
@@ -0,0 +1,3 @@
# Writing tools are an in-app Swift MCP server
Museion's writing tools (fix-card submit, edit-pass runner, critique-memory query/promote, draft stats) ship inside the app binary, exposed as a stdio MCP server and registered into the `museion` profile at provisioning (`hermes mcp add museion-tools --command …`). One signed artifact, native file access, stats logic shared with the M4 UI, and the fix-card tool exists from M0. Rejected: a separate Python server (second runtime to ship and sign) and skills-only (Q: 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.