feat(mentor): pin prompt-end constraint ordering (#1)
CI / ci (push) Canceled after 0s
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:
1 parent
a1d1cd3d3c
commit
22bca36857
11 files changed
+332
-14
No files matched your search
@@ -0,0 +1,81 @@
|
||||
# Verify style constraints sit at prompt-end in the museion profile (#1)
|
||||
|
||||
> **Date:** 2026-10-30
|
||||
> **Type:** issue
|
||||
> **Reference:** git.babylondreams.de/AlexKucera/museion issue #1
|
||||
|
||||
## Goal
|
||||
|
||||
Confidence that the style constraints (banned vocab, anti-patterns, em-dash
|
||||
budget — all owned by `deslop`) are assembled at/near the END of the prompt the
|
||||
mentor actually receives (PRD line 145, prompt-end constraints). Audit the museion
|
||||
Hermes profile prompt assembly, fix the ordering if constraints land early,
|
||||
document the verified layout.
|
||||
|
||||
## What Was Done
|
||||
|
||||
- **Audited the real assembly** on the app's true path: an ACP probe
|
||||
(`initialize` → `session/new` → `session/prompt`, argv `hermes acp -p
|
||||
museion-pass1` — the exact `ACPEngineClient` sequence) against the provisioned
|
||||
profile (claude-sonnet-5-5, hermes 0.22.5+1726), then read the engine-owned
|
||||
`state.db` message log for true turn order. System prompt: stock Hermes SOUL +
|
||||
generic blocks + `## Skills` listing at 73–90 % depth (descriptions only —
|
||||
constraint bodies are NEVER in the system prompt; they enter mid-conversation as
|
||||
`skill_view` results).
|
||||
- **Baseline finding:** constraints did NOT land early — the ACP run read the piece
|
||||
(msg 19) before deslop (msg 23) — but by model choice, unpinned.
|
||||
- **Fix (engine-side, where methodology lives):** new verbatim-shared section
|
||||
`## Draft first, rules last` in both persona skills (pass-persona 1.5,
|
||||
session-persona 1.2): material into context first, rule skills after, rules
|
||||
fresher than the draft at compose time.
|
||||
- **`MuseionTests/PersonaLoadOrderTests.swift`** (RED→GREEN): pins the section's
|
||||
presence in both personas and its verbatim parity over the REAL bundled payload
|
||||
(`ProfileProvisioner.defaultPayloadRoot()`).
|
||||
- **Verify run:** real Pass 1 over the real Home — piece (40) → persona (41) →
|
||||
deslop (45) → verdict (54); 6 fix cards + 2 research candidates landed on the
|
||||
real rails end-to-end.
|
||||
- **Docs:** `docs/research/prompt-layout-factsheet.md` (verified layout, probe
|
||||
traps, propagation cost) + `docs/research/prompt-order-probe.py` (the probe
|
||||
script, in-repo). DOX: ref/writing skills/AGENTS.md (three→four shared
|
||||
sections), MuseionTests/AGENTS.md (test-file entry).
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| Fix lives in the persona skills, not the app stub | PassContext.stub is a pinned minimal constant; "the methodology lives engine-side and never travels through the app" (#24). Hermes owns assembly; the personas own work order. |
|
||||
| Pin load order instead of reordering | Baseline showed constraints weren't early — the conditional reorder never triggered. The gap was confidence: ordering was model choice. A doctrine pin converts observed-once into instructed-always. |
|
||||
| Hand-copy to master + chat-profile copies (stale v1.3 seed, byte-matched historical commit — no user edits) | Additive-only seeding (G3a) never overwrites; without the hand-copy this machine's profiles stay stale while the test stays green. Next provisioning pass migrates the copies to master symlinks via byte-match. |
|
||||
| One parity test over the bundle, not per-profile runtime checks | The bundle is the source of truth for fresh installs; per-machine drift is a seeding concern (factsheet §4 discloses it), not a test concern. |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| First CLI probe (`hermes -z`) loaded ZERO skills — persona-less critique | One-shot mode swaps the skills directive for "load only what you lack" (`agent/oneshot_footprint.py`) — `-z` is not the app's path and assembles a different prompt | Re-probed over ACP (the app's real wire); documented as a probe trap in the factsheet |
|
||||
| Fix cards rejected ("not a piece") in scratch-dir probes | `resolvePostURL` requires the Home layout `projects\|archive/…/post.md` — working as designed | Re-homed the probe piece to `~/Documents/Museion/projects/posts/prompt-order-probe/`; cards then landed (6) |
|
||||
| Full-suite `debounce flushes after idle…` failure (1/480) | Load flake: suite ran concurrently with gitnexus analyze + 2 review subagents (documented #30 pattern); 6 s hang vs 0.13 s isolated | Verified in isolation — passes; diff touches no app code |
|
||||
| `session/prompt` not found in probe | First probe draft used ACP method `prompt`; the wire method is `session/prompt` with content-block array | Mirrored `turnCore`'s exact params |
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `ref/writing skills/pass-persona/SKILL.md` | v1.5 — shared `## Draft first, rules last` section |
|
||||
| `ref/writing skills/session-persona/SKILL.md` | v1.2 — same section, verbatim |
|
||||
| `MuseionTests/PersonaLoadOrderTests.swift` | NEW — presence + verbatim-parity pins over the bundled payload |
|
||||
| `docs/research/prompt-layout-factsheet.md` | NEW — verified layout factsheet (AC1) |
|
||||
| `docs/research/prompt-order-probe.py` | NEW — the ACP probe script, in-repo |
|
||||
| `ref/writing skills/AGENTS.md` | shared-sections contract: three → four |
|
||||
| `MuseionTests/AGENTS.md` | test-file list entry |
|
||||
| `AGENTS.md` | gitnexus index counter refresh (analyze output) + session-log window |
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [ ] Trash the probe piece `~/Documents/Museion/projects/posts/prompt-order-probe/` (6 cards beside it) when done inspecting
|
||||
- [ ] If bundled-skill content updates become routine, a version-aware refresh of provisioned copies deserves its own issue (additive-only leaves existing machines stale)
|
||||
- [ ] Known ceiling (disclosed in factsheet): the pin is doctrine, not runtime enforcement — the test guards text presence + parity, not model obedience
|
||||
|
||||
---
|
||||
|
||||
*Log written by write-log skill*
|
||||
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 2026-10-30 | issue | [20261030-issue1-verify-style-constraints-prompt-end_log.md](20261030-issue1-verify-style-constraints-prompt-end_log.md) | #1 prompt-end constraints: ACP audit, draft-first-rules-last persona pin, layout factsheet, real-run verify |
|
||||
| 2026-10-28 | issue | [20261028-issue137-profiles-s4-engine-lifecycle-model-switch-ux_log.md](20261028-issue137-profiles-s4-engine-lifecycle-model-switch-ux_log.md) | Pass engines on-demand per profile, transient transcripts, chat restart deferred mid-turn, missing-key Run Pass — 2 race fixes |
|
||||
| 2026-10-27 | issue | [20261027-issue136-profiles-s3-settings-write-path-test-connection_log.md](20261027-issue136-profiles-s3-settings-write-path-test-connection_log.md) | Profiles S3: settings write path (config set + .env), Test Connection probe, three dogfood rounds, three-reviewer audit |
|
||||
| 2026-10-27 | issue | [20261027-issue135-profiles-s2-settings-page-ui_log.md](20261027-issue135-profiles-s2-settings-page-ui_log.md) | #135 Profiles S2: variant C Settings sidebar+detail over the SettingsWriting seam; NSComboBox stale-stringValue dogfood fix; 432 tests |
|
||||
|
||||
@@ -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.
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Issue #1 audit probe: speak ACP to hermes exactly like Museion's ACPEngineClient.
|
||||
|
||||
initialize (slim, pass flavor) -> session/new -> prompt(pass stub).
|
||||
Prints the sessionId + stopReason; the messages land in the profile's state.db
|
||||
where the layout audit reads them back.
|
||||
"""
|
||||
import json, subprocess, sys, threading, queue, time
|
||||
|
||||
PROFILE = sys.argv[1] if len(sys.argv) > 1 else "museion-pass1"
|
||||
STUB = open(sys.argv[2]).read() if len(sys.argv) > 2 else "hello"
|
||||
CWD = "/Users/alex/.hermes/cache/scratch/museion-issue1"
|
||||
|
||||
p = subprocess.Popen(
|
||||
["hermes", "acp", "-p", PROFILE],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
text=True, bufsize=1,
|
||||
)
|
||||
inq = queue.Queue()
|
||||
|
||||
def reader():
|
||||
for line in p.stdout:
|
||||
inq.put(line.strip())
|
||||
|
||||
threading.Thread(target=reader, daemon=True).start()
|
||||
stderr_lines = []
|
||||
threading.Thread(target=lambda: [stderr_lines.append(l) for l in p.stderr], daemon=True).start()
|
||||
|
||||
_next_id = [0]
|
||||
def request(method, params, timeout=600):
|
||||
_next_id[0] += 1
|
||||
rid = _next_id[0]
|
||||
msg = {"jsonrpc": "2.0", "id": rid, "method": method, "params": params}
|
||||
p.stdin.write(json.dumps(msg) + "\n"); p.stdin.flush()
|
||||
deadline = time.time() + timeout
|
||||
while time.time() < deadline:
|
||||
try:
|
||||
line = inq.get(timeout=1)
|
||||
except queue.Empty:
|
||||
continue
|
||||
try:
|
||||
d = json.loads(line)
|
||||
except json.JSONDecodeError:
|
||||
print("UNPARSED:", line[:200]); continue
|
||||
if d.get("id") == rid:
|
||||
if "error" in d:
|
||||
raise RuntimeError(f"{method}: {d['error']}")
|
||||
return d.get("result")
|
||||
# notifications — log tool traffic compactly for the live view
|
||||
if method_ := d.get("method"):
|
||||
up = (d.get("params") or {}).get("update") or {}
|
||||
kind = up.get("sessionUpdate")
|
||||
if kind == "tool_call":
|
||||
print(f" [tool_call] {up.get('toolCall',{}).get('title','')[:80]}")
|
||||
elif kind == "agent_message_chunk":
|
||||
pass
|
||||
raise TimeoutError(method)
|
||||
|
||||
r = request("initialize", {
|
||||
"protocolVersion": 1, "clientCapabilities": {},
|
||||
"clientInfo": {"name": "Museion", "title": "Museion", "version": "0.1"},
|
||||
})
|
||||
print("agentInfo:", json.dumps(r.get("agentInfo")))
|
||||
|
||||
r = request("session/new", {"cwd": CWD, "mcpServers": []})
|
||||
sid = r["sessionId"]
|
||||
print("sessionId:", sid)
|
||||
|
||||
r = request("session/prompt", {
|
||||
"sessionId": sid,
|
||||
"prompt": [{"type": "text", "text": STUB}],
|
||||
})
|
||||
print("stopReason:", r.get("stopReason"))
|
||||
print("lastChunk:", json.dumps(r.get("lastChunk"))[:200])
|
||||
p.stdin.close(); p.terminate()
|
||||
sys.exit(0)
|
||||
Reference in new issue
Block a user