[GH-ISSUE #8391] [Feature]: Professor Mari: keep a read handbook in context while she works on its surface #8339

Closed
opened 2026-11-07 16:42:19 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @ylli-selmani on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8391

Originally assigned to: @ylli-selmani on GitHub.

What problem does this solve?

When Professor Mari reads a built-in handbook (skill.get), its text is dropped from her history once the turn ends (#7827: a handbook is 10–18k chars). Later turns only see "call skill.get again before you follow it". But the read-first gate (skillsSeenBySession in workspace-commands.ts) counts a handbook as read for the whole chat, so from the second turn on she can write on that surface from memory. Small models (Gemma 4 12b) are the most likely to do that and break a handbook rule.

Proposed solution

  1. Keep the handbook in context while she works on it. Each assistant turn records which built-in handbooks it read and which handbook surfaces it touched. The next turn carries the active handbooks' full text in an <active_handbooks> prompt block, placed before <workspace_context> so it stays in the cached prompt prefix.
  2. Drop it when she moves on. A handbook drops after 3 user turns in a row without a successful read or write on its surface. At most 2 are kept; reading a third drops the oldest.
  3. Re-arm the gate when it drops. At the start of each turn the gate's "seen" set is the active handbooks, so a write on a dropped surface needs a fresh read.
  4. Regressions for the active-set rules, the block's position, and the gate re-arm.

Alternatives considered

  • Carry a capped section (~4k chars) instead of the whole handbook. Cheaper, but the engine would have to guess which section matters, and a wrong guess hides the rule she needed.
  • Only make the gate per turn. It enforces the re-read, but costs a tool round plus the whole handbook again on every turn of a back-and-forth.
  • A pin tool for Mari. Flexible, but small models manage their own context badly, and teaching the tool costs prompt on every turn.

Additional context

Built-in handbooks only, the same set the gate covers. User skills are unchanged.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @ylli-selmani on GitHub (Oct 26, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8391 Originally assigned to: @ylli-selmani on GitHub. ## What problem does this solve? When Professor Mari reads a built-in handbook (`skill.get`), its text is dropped from her history once the turn ends (#7827: a handbook is 10–18k chars). Later turns only see "call skill.get again before you follow it". But the read-first gate (`skillsSeenBySession` in `workspace-commands.ts`) counts a handbook as read for the whole chat, so from the second turn on she can write on that surface from memory. Small models (Gemma 4 12b) are the most likely to do that and break a handbook rule. ## Proposed solution 1. **Keep the handbook in context while she works on it.** Each assistant turn records which built-in handbooks it read and which handbook surfaces it touched. The next turn carries the active handbooks' full text in an `<active_handbooks>` prompt block, placed before `<workspace_context>` so it stays in the cached prompt prefix. 2. **Drop it when she moves on.** A handbook drops after 3 user turns in a row without a successful read or write on its surface. At most 2 are kept; reading a third drops the oldest. 3. **Re-arm the gate when it drops.** At the start of each turn the gate's "seen" set is the active handbooks, so a write on a dropped surface needs a fresh read. 4. Regressions for the active-set rules, the block's position, and the gate re-arm. ## Alternatives considered - **Carry a capped section (~4k chars) instead of the whole handbook.** Cheaper, but the engine would have to guess which section matters, and a wrong guess hides the rule she needed. - **Only make the gate per turn.** It enforces the re-read, but costs a tool round plus the whole handbook again on every turn of a back-and-forth. - **A pin tool for Mari.** Flexible, but small models manage their own context badly, and teaching the tool costs prompt on every turn. ## Additional context Built-in handbooks only, the same set the gate covers. User skills are unchanged. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-11-07 16:42:19 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8339
No description provided.