feat(mentor): pin prompt-end constraint ordering (#1)
CI / ci (push) Canceled after 0s

Both personas gain the verbatim-shared "Draft first, rules last"
section (pass 1.5, session 1.2): the writer's material enters
context before the rule skills, so the deslop constraint tables sit
after the draft, nearest the writing they govern — the PRD's
prompt-end rule. A real ACP audit (the app's exact wire — never
-z: one-shot mode swaps the skills directive and loads nothing)
showed the baseline already read the piece before deslop, but by
model choice; the pin converts observed-once into instructed-
always, and PersonaLoadOrderTests guards presence + verbatim
parity over the bundled payload.

Verified layout, probe traps, and the additive-only propagation
cost are documented in docs/research/prompt-layout-factsheet.md
with the probe script in-repo; real-run verify: piece → persona →
deslop → verdict, 6 fix cards + 2 research candidates landed on
the real rails. Suite 479 + 1 load-flake cleared in isolation.

Closes #1
This commit is contained in:
AlexKucera committed 2026-10-30 11:20:01 +01:00
1 parent a1d1cd3d3c
commit 22bca36857
11 files changed
+332 -14

No files matched your search

+98
View File
@@ -0,0 +1,98 @@
# Museion profile prompt-layout factsheet — where constraints land
Research artifact for #1, verifying the PRD's cross-cutting rule (*prompt-end
constraints*: style constraints sit at/near the end of the assembled pass prompt —
Claude/GLM are recency-biased followers; constraints that land early decay by the
time the draft and verdict arrive).
Method: live probes run **2026-10-30** against the real provisioned profiles
(`museion-pass1`, claude-sonnet-5-5, hermes-agent 0.22.5+1726), speaking the app's
own ACP wire (`initialize` → `session/new` → `session/prompt`, argv
`hermes acp -p museion-pass1` — the exact `ACPEngineClient` sequence), then reading
the engine-owned `state.db` message log for the true turn order. Probe script:
`docs/research/prompt-order-probe.py`; probe piece
`projects/posts/prompt-order-probe/` in the real Home (fix-card rail needs the
`projects/…/post.md` layout — a scratch path is honestly rejected as *not a piece*).
---
## 1. The system prompt (turn 0, fixed by Hermes)
The profiles carry the stock Hermes assembly (10,375 chars measured, ACP session):
1. SOUL.md — the **stock Hermes persona** (`hermes profile create` default; the
provisioner never writes a Museion SOUL — the mentor's manner lives in the
persona skills, not the profile).
2. Generic Hermes blocks: finishing-the-job, parallel tool calls, memory note,
coding-agent block, mid-turn steering, platform.
3. **`## Skills` block at ~73–90 % depth** — the strong directive
("MUST load … err on the side of loading") + `<available_skills>` listing
(name + description only; deslop's line sits at ~84 % depth).
4. Profile line + runtime environment (the actual prompt tail).
So the *listing* is already near the prompt end, and constraint **bodies are never
in the system prompt** — they enter mid-conversation as `skill_view` tool results.
## 2. In-pass layout (what the model orders itself)
The stub (`PassContext.stub`) carries only pass name, piece path, and the tool
contract — the draft enters context when the mentor `read_file`s the piece. Load
order is therefore the mentor's choice, governed by the persona skills.
**Baseline (pre-fix, 2026-10-30):** piece landed before deslop (msg 19 < 23) — but
by model choice, unpinned; nothing in the skill stack demanded it.
**Fix (#1): both personas gained the verbatim-shared section
`## Draft first, rules last`** (pass-persona 1.5, session-persona 1.2): read the
material first, then load deslop and the method; the rules behind you must be
fresher than the draft. Guarded mechanically by
`MuseionTests/PersonaLoadOrderTests.swift`.
**Verify run (post-fix, 2026-10-30):** piece (40) → pass-persona (41) → learnings
(44) → **deslop (45)** → serif-writing (46) → research (48–50) → card submit (53) →
verdict (54). Constraints after the draft, near the tail; 6 fix cards + 2 research
candidates landed on the real rails. The `state.db` message order of the run:
```
38 user Pass 1 stub
40 tool read_file(piece) ← the draft lands
41 tool skill_view(pass-persona)
44 tool query_learnings
45 tool skill_view(deslop) ← constraints land, after the draft
46 tool skill_view(serif-writing)
48 tool web_search
50 tool submit_research_notes (received 2)
53 tool submit_fix_cards (6 cards written)
54 assistant the verdict
```
Honesty notes: the constraints sit **mid-tail, not at the very end** — research
results and the card submit follow them before the verdict; that is inherent to a
fact-checking pass and satisfies the PRD's at/near-the-end rule. And the pin is a
doctrine the model is told to follow, not a runtime guarantee — the test guards the
text's presence and the personas' parity, not the model's obedience. Re-verify any
time with the probe script above.
## 3. Probe traps (recorded so the next audit doesn't misread them)
- **`hermes -z` (one-shot) is NOT the app's path.** One-shot mode swaps the skills
directive for a "load only what you lack" footprint
(`agent/oneshot_footprint.py`) — a `-z` probe run loaded **zero** skills and
produced a persona-less critique. The app is ACP-only; audit through ACP.
- **`-z` and ACP assemble different prompts** (9,161 vs 10,375 chars measured) —
never cite a one-shot dump as the pass surface's layout.
- The card rail rejects pieces outside `projects/|archive/…/post.md` by design —
probe with a piece in the real Home layout.
## 4. Propagation (the additive-only cost)
Seeding is additive-only (G3a): a content edit to a bundled skill never overwrites
an existing master/profile copy. On this machine the 1.5/1.2 personas were hand-
copied to the master (`~/Library/Application Support/Museion/skills/`) and the chat
profile's copy-era dirs (which byte-matched historical seed v1.3 — no user edits);
the next provisioning pass migrates those copies to master symlinks via the
byte-match path. Fresh installs get the new bytes from the bundle. If skill-content
updates become routine, version-aware refresh deserves its own issue.
`PersonaLoadOrderTests` therefore guards the bundled source of truth (what fresh
installs receive) — a provisioned machine that skipped the hand-copy above would
still carry stale personas with the test green.