mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8392] [MERGED] feat(mari): keep a read handbook in context while she works on its surface #8572
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#8572
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8392
Author: @ylli-selmani
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ylli-selmani
Base:
staging← Head:feat/mari-sticky-handbook📝 Commits (3)
de317fbfeat(mari): keep a read handbook in context while she works on its surface5153d08fix(mari): a dropped handbook can't come back through a touch48b832efix(mari): held proposals keep a handbook; the limit drops the idlest📊 Changes
7 files changed (+326 additions, -12 deletions)
View changed files
📝
packages/server/src/services/professor-mari/mari-skills-prompt.ts(+2 -2)➕
packages/server/src/services/professor-mari/sticky-handbooks.ts(+103 -0)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+29 -6)📝
packages/server/src/services/professor-mari/workspace-commands.ts(+24 -3)📝
packages/server/src/services/professor-mari/workspace-message-store.ts(+3 -0)📝
scripts/regressions/mari/app-data-envelope-errors.regression.ts(+1 -1)➕
scripts/regressions/mari/sticky-handbooks.regression.ts(+164 -0)📄 Description
Linked issue
Part of #8391
Why this change
#7827 drops a handbook's text from Professor Mari's history once a turn ends (a handbook is 11–18k chars). But the read-first gate counted it as read for the whole chat. So from turn 2 on ("now shorten her greeting", "add a quirk") she wrote from memory of a handbook she no longer had. Now a handbook she read stays in her prompt, in full, while she keeps working on its surface. It drops when she stops using it, and the gate asks for it again.
What changed
Rules (new
sticky-handbooks.ts, pure)extra.mariHandbooks = { read, touched }, built from its successfulapp_datacalls.readholds the built-in skills fetched withskill.get.touchedholds the handbooks the turn's other calls route to.Prompt (
workspace-agent.service.ts)<active_handbooks>block, after the permissions-mode block. #8375 still puts<workspace_context>last. The block changes only when a handbook comes or goes, so it doesn't break the cache on every turn.buildSkillsPromptnow also returns the skill list, so the block costs no second read.skill.getnow points at the block: "while you keep working on its surface it stays in <active_handbooks>; if it is not there, call skill.get again".Gate (
workspace-commands.ts)armSkillGatestarts each turn's gate from the handbooks in that turn's block, so a dropped one is refused once again. The refusal now says "once per turn", not "once per chat".handbooksForActionis exported next to the gate's table, so a call counts toward the same handbooks the gate accepts for it:character.updatecounts for characters and onboarding, a link counts for both lorebook and characters, and decision content counts for decisions.Cost: while active, up to two whole handbooks (about 9k tokens at worst) sit in the prompt, against a
skill.getround on every turn before. That was a deliberate call, made instead of carrying ~4k sections.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Agent-run checks:
pnpm checkexits 0.scripts/regressions/mari/sticky-handbooks.regression.ts. It pins:WorkspaceCommands.node scripts/run-regressions.mjs --filterpasses forprofessor-mari(23/23),mari-(18/18),skill(4/4),app-data(2/2),pi-runtime(1/1) andsticky-handbooks(1/1). The full suite is left to CI.Live canary on Gemma 4 12b: pending (Ylli).
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
No UI changes.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.