mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7908] [MERGED] feat(mari): prof Mari improvements, built-in skills, better toolcall errors, qol #8002
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#8002
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/7908
Author: @ylli-selmani
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @ylli-selmani
Base:
staging← Head:feat/mari-builtin-skills📝 Commits (10+)
d2d9f01feat(mari): built-in handbook skills, and tool errors a weak model can act onea8484dfix(mari): keep a leading sentinel and the NOT SAVED line around argument notesf8c41b2fix(mari): accepted calls skip the handbook gate, and six review findingscc424batest(mari): share the handbook setup and drop checks that pinned prosed056a7cfix(mari): Dottore's review, and a 12b's list sent as JSON text5dcee21Merge remote-tracking branch 'origin/staging' into feat/mari-builtin-skillsfe17cb3test(mari): pin the dry-run sentinel where it now livesd719348feat(mari): link a character and a lorebook through app_data0270ce9fix(mari): keep the clamp note on calls app_data does not wrapad5ab17fix(mari): Dottore's third pass, and offer to link a made-for book📊 Changes
67 files changed (+5253 additions, -508 deletions)
View changed files
📝
docs/home/professor-mari.md(+9 -0)📝
docs/settings/settings-overview.md(+1 -1)📝
packages/client/src/components/chat/HomeProfessorMariChat.tsx(+2 -2)📝
packages/client/src/components/chat/MariSkillsMenu.tsx(+158 -104)📝
packages/client/src/components/chat/mari/MariWindowHeader.tsx(+2 -9)📝
packages/client/src/components/chat/mari/MariWorkTimeline.tsx(+31 -14)📝
packages/client/src/components/chat/mari/mari-tool-presentation.ts(+11 -3)📝
packages/client/src/components/chat/mari/use-mari-skill-memory-actions.ts(+5 -2)📝
packages/client/src/components/layout/omnibar/OmnibarSettingsMenu.tsx(+44 -0)📝
packages/client/src/localization/locales/en.json(+6 -0)📝
packages/client/src/styles/mari.css(+17 -6)➕
packages/server/src/assets/mari-skills/characters.md(+87 -0)➕
packages/server/src/assets/mari-skills/decisions.md(+126 -0)➕
packages/server/src/assets/mari-skills/extensions.md(+86 -0)➕
packages/server/src/assets/mari-skills/home-widgets.md(+86 -0)➕
packages/server/src/assets/mari-skills/lorebook.md(+118 -0)➕
packages/server/src/assets/mari-skills/onboarding.md(+170 -0)➕
packages/server/src/assets/mari-skills/presets.md(+84 -0)➕
packages/server/src/assets/mari-skills/repair.md(+79 -0)➕
packages/server/src/assets/mari-skills/themes.md(+99 -0)...and 47 more files
📄 Description
Linked issue
Closes #7827
Closes #7907
Closes #7949
Closes #7995
Closes #7999
#7827 proposed shipping this in slices, one PR per handbook. At Ylli's direction the whole set ships in
one PR: the nine handbooks share one router block and one prompt ratchet, and split PRs would leave the
prompt in a half-migrated state between them. #7907 is the one piece of engine behaviour the onboarding
handbook needs (a card's lorebooks readable through
character.get), so it lands here rather than as aseparate patch.
Why this change
Professor Mari's authoring knowledge lived in her permanent prompt: every procedure for every surface,
paid for on every turn. Measured on
staging(51e6cace8),MARI_SYSTEM_PROMPTplusworkspaceCommandKnowledgePrompt()came to about 60k chars (~15k tokens) before any history, androughly 23k of that was procedure: lorebook authoring, onboarding, decisions, presets, themes,
extensions, Home widgets, reply repair.
That had two costs. Every guide was billed on turns that touch none of them, and a permanent guide has
to be a dense paragraph: no worked example, no error→fix table, no read-back check. The result was
visible in live runs, and it was not only about length. The tool surface was part of the problem:
skill.get), and calledskill.getwiththe id nested under
data, which the engine refused;character name is required: pass it as "name"), sothe model retried the same shape, and
character.updatesilently ignored alorebooksfield itdoes not own;
character.searchmissed a card whose name contains quotes, because it compared raw JSON (escaped\") as one substring, and a missed row turned into a hallucinated id;{{was saved as literal text, and the model then "explained" a broken preview;applywas a dry run that reported success, so a 12b "finished" five editsthat never saved (found in tool-call testing, see below);
applythe tool could not read (0,"dry-run") wrote on every create, and alimitof"ten"or
5000quietly became the default or the maximum page (#7999).So this PR is three connected things:
builtin-*skills carry the procedures. The prompt keeps onerouter line each, plus a gate that makes the first write on a covered surface start with its handbook.
the value goes. Unknown actions echo themselves and list what is valid. Not-found says what an id
looks like and which lookup returns it. Search matches the name a person types. A macro linter
refuses unbalanced braces and macros in fields that never resolve them. A write that did not save
can no longer read as one that did.
the work line wraps instead of clipping, the skills panel tells the two kinds of skills apart, and
a dry-run step is labelled "Previewed · not saved".
The goal is concrete: a 12b-class model should be able to author on any covered surface without the
prompt carrying every procedure. When it gets a call wrong, the error should be enough to fix it.
What changed
workspaceCommandKnowledgePromptShipped handbooks:
packages/server/src/assets/mari-skills/holdsonboarding.md,lorebook.md,presets.md,repair.md,extensions.md,decisions.md,characters.md,themes.mdandhome-widgets.md. Each has the field and argument shapes the caller cannot guess, its traps, a workedexample, and checkable completion criteria. They are protocol-neutral (
action, never a classicsay/stopenvelope), so the same text works under pi's native and textual modes and under classic.Prompt: in
packages/server/src/services/professor-mari/workspace-agent.service.tsthe knowledgeblock is now the nine router lines plus policy (voice, read-only intent, the approval /
apply/change-card contract, delete safety, the command catalog, memory policy, the bare-create question
bound). Each router line names its skill id and that surface's one silent-failure trap. The duplicate
Personal Extensions block and the old
MARI_DECISION_AUTHORING_PROMPTare gone; their facts live inextensions.mdanddecisions.mdnow.piRuntimePrompt()interpolates the same shared block.Protocol and fetchability fixes (2026-10-21). Four prompt defects surfaced in live 12b/31b runs,
all fixed here.
say", a classic-only field. A model withoutreasoning turns that into a literal
<say>/<suggestions>tag, which then renders raw and getsreplayed by the continuity block. It now says "the visible reply", and pi's mapping adds an explicit
"plain text, no tags" rule.
skill.getwas named without its argument shape, so a weak model passed the id insidedataandnever opened a handbook. Reads now say the id is top-level.
the first tool round, and that anything created, edited or activated on a built-in surface starts
with its handbook.
from the handbook instead of a second guess.
Skills mechanism: built-ins are a shipped source merged into the existing index. Their ids are
builtin-*. They are always on and read-only (no edit, delete, toggle orPUT/DELETE), they can neverbe shadowed by a user file (a collision is reported as a diagnostic), and an app update replaces their
text cleanly because
skills.jsonis never touched. The index is listed, never inlined; bodies are readonly on
skill.get.Client: the Skills panel separates shipped skills from the user's own (they are not part of the
"active / total" count), marks them read-only, and shows a "no custom skills yet" empty state for a
user who has not authored one. Search and Professor Mari settings gains Read the handbook before
the first write (on by default, see below).
Mari DB read (#7907):
character.getreturnslorebooks: [{ id, name, description, attached: "linked" | "owned" }], which is the books linked to the card plus the one it owns, sorted by name, withdescriptions truncated. It is read-only and additive.
onboarding.mduses it to skim a card's lorebefore writing persona questions.
Tool error messages (#7949): a failed structured call now says what was wrong, what arrived and where
the value goes (
character.create needs a non-empty "name" (none was sent) — pass it top-level, or inside "data"). An unknown action echoes itself, suggests the nearest valid name and lists that namespace'sactions. A lookup miss on every
getsaysNo character has the id "…". Character ids are generated, never a name or slug; find the record with character.search (or character.list) and send the "id" it returns.Before,character.getwith a name printednull. It is onemari-db/tool-error.tshelper,text-only, with no dispatch, validation or sandbox change. It is here because a small model's only repair
loop is reading the error.
Tool-call testing (runs 1–3, gemma-4 31b and 12b on pi)
Eight asks (folder move, memory, an AND lorebook entry, a lorebook link, a one-number description edit,
macros in a name, a quoted-name search, a two-step theme) were run against both models, three rounds,
each round's findings fixed before the next. Each fix below has a regression.
"apply": trueselectiveand nosecondaryKeys, then claimed AND--mari-window-*or invented tokens for an app accentthemes.mdsays which tokens repaint what, and that unknown names do nothingNOT SAVEDline, and a preview keeps only the changed fieldsmaricommand she could run herselfmaricommand skips the sandbox[object Object]keysrefuse object itemscharacter.updatewithoutapplyfive times; each was a successful dry run with a green "Updated"applyis refused and saves nothing.apply: falsestill previews; creates still write by default. The CLI's--applyis unchangedlinked_charactersfield)mariresult prints its error, not only the outputcharacter.getwith the name "Aldric" printednullcharacter.get,lorebook.getand the CLIlorebooks get/chats getThe handbook-first setting. The gate from round 2 costs a strong model one round it would have spent
reading the skill anyway. It is now a setting, Read the handbook before the first write, on by
default so a small or local model gets it without the user knowing it exists. It is read fresh per call
from
app_settings(mari-skill-gate; only"false"turns it off) and is behind the mari-db floor, soMari cannot switch it off herself.
One run-3 failure is not rule-fixable: a 12b read the lorebook handbook, then saved both words as primary
keys anyway. The entry is valid, so no notice fires. #8035 proposes an optional checker that asks a
second model whether a write fulfilled the request.
Unreadable arguments (#7999)
An argument the tool could not read used to be replaced without a word. Now:
app_datarefuses anapplythat is not a boolean or one of the strings it already reads(
true/false/yes/no/1/0/on/off/enabled/disabled), before any action runs:"apply" must be true or false (got 0), so nothing was saved.Before, that value wrote on all 14 create sites and previewed onevery update. Leaving
applyout keeps its documented meaning.limitandoffsetthat are not numbers are refused, naming the key. One that had to be moved intorange is still answered, with a note before the result:
"limit" 5000 is above this read's maximum, so 1000 was used: this may not be everything.The same rule covers the workspace tools (read,ls,find,grep,docs_*,bashtimeout) throughnumberArg.collectArgumentNotesinmari-db/tool-error.ts, anAsyncLocalStorage) and printed first, so output compaction cannot cut them off.Pinned by
mari/unreadable-arguments.regression.ts.Macro linter (#7995)
Models writing card text or lorebook entries drop braces, and an unclosed
{{used to reach theprompt as literal text. The model then explains the broken preview instead of fixing it. The linter
is deliberately narrow: it refuses only text whose braces cannot balance at all (an unclosed
{{, ora stray
}}), because{{always opens a macro in Marinara; unknown macro names and literal pairsstill pass. It is wired into
character.create|update,character.onboarding.updateand the threelorebook entry writes. The refusal names the field and the character offset, and says what to do. It is
a refusal, not a warning, because a broken brace in a saved card is already wrong. Slice 2 covers the
other half of the issue: a macro in a field that never interpolates (
name,tags, entrykeys) isrefused too, because it would be stored and shown literally forever.
Where the 4.6k lines go
The diff reads as 65 files, +4,641/−487. The testing rounds, #7999 and their regressions added about
1,100 lines; a later trim of the regressions took about 220 back. Most of it is text a
reviewer can skim:
packages/server/src/assets/mari-skills/*.md)scripts/regressions/)app-data-envelope-errors, #7999 inunreadable-arguments), the sharedmari/_handbook.tssetup, plus prompt and ratchet assertions. None of it ships.mari-db/tool-error.ts,macro-lint.ts, the precise refusals (unknown actions, missing fields, not-found, quote-safe search), the macro gate, the selective-keys notice, the setting's floor rule, and the #7999 argument checks and notes, and table-keyed not-found lookups.professor-mari/services and routeapplyrefusal,numberArgand the per-call notes, theGET/PUT /skill-gateroute, and accepted held calls skipping the gate. Most of the −158 is the constants the handbooks replaced.docs/home/professor-mari.mdanddocs/settings/settings-overview.md.Shipped product code is about 1,660 additions across 24 files. The rest is procedures, proof and docs.
Deferred, not in this PR
linkapp_data action. Attaching a lorebook to a card still goes through the CLI(
mari lorebooks link-character). A structured action is a follow-up PR.extensions.md:sourceis not adopted onupdate, andfull_page_accessis stored where the mapper strips it. They need their own change and tests.change card; the timeline labels
decision.recordas "Read"; an applied widget receipt reads "New appsetting" / "Changed value".
scripts/dev.mjsnever loads.env, sopnpm devon a non-default port health-checks the dailyinstall. Separate launcher branch.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent on
cc424ba52(the boxes above are Ylli's to tick). The branch's 48 working commits aresquashed into
d2d9f01ed, with the same tree as before;ea8484d82holds the CodeRabbit fixes,f8c41b20ethe independent-review fixes and
cc424ba52the regression trim.pnpm check: exit 0 (TypeScript in all four projects, ESLint, localization, format, client build).--filter mari74/74,professor-mari22/22,skill4/4,workspace3/3,lorebook25/26. The onelorebookfailure islorebook-images("symlinks do not exposeother files"), which this branch does not touch and which needs symlink rights on Windows. The full suite
(about half an hour locally) is left to the GitHub
complete-node-regressionsjob.coderabbit review --committed --base origin/staging --agent --fresh). The last,on
d2d9f01ed, found 9; six are fixed inea8484d82: argument notes no longer push a leading sentinel offline 1, the closing NOT SAVED line survives truncation, the lorebook handbook's
lorebook.getmiss iscorrected, and three regressions are tightened. Three declined, with reasons in the commit message: letting a
stray
}}through (#7995 refuses it on purpose) and two wording changes to text Ylli reviewed by hand.f8c41b20e, each with aregression: Accept replayed held calls through the handbook gate (half-applied changes); an argument note pushed
bash's
Command:header off line 1; the gate matched the raw action spelling (lorebooks.create,home-widget.create); macro lint refused nested CSS in Creator Notes;character.updaterefused the unchangedlorebookslist andlink-characterinserted duplicate links; two not-found errors named actions that do notexist.
cc424ba52moves the handbook setup intomari/_handbook.tsand drops checks that only pinned prose(about 330 test lines), keeping every example run, quoted error and behaviour claim.
Tool-call testing so far (raw results kept privately): round 1 on 31b and 12b, rounds 2 and 3 on 12b
for the asks that failed. The 12b re-test after round 3: T5 passed, recovering from the handbook gate and
the missing-
applyrefusal and then reading the card back. T3 still writes AND-logic entries as a plaintrigger, which looks like the limit of a 12b model. T4 refused the CLI link command the refusal handed it, which
is the case for the
app_datalink action listed under Deferred.Still to do by Ylli, in the app:
shipped rows cannot be edited, toggled or deleted.
first lorebook write is not refused.
skill.getchip forbuiltin-onboarding, the cardpatched in the same pass, and
{{bond}}resolving.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)docs/home/professor-mari.mdgains a Built-in skills subsection (what the shipped skills are, thatthey are read-only, the new setting) and a line on the "Previewed · not saved" step.
docs/settings/settings-overview.mdlists the setting. The translated pages ondocs-i18nneed thesame additions; that is tracked in #8058. The handbooks themselves are agent procedure, not user documentation, so they are not
translated.
UI evidence (if applicable)
Screenshots of the live runs (skills panel, a fetched handbook, the onboarding/character/theme/widget
flows, the testing rounds) are kept privately and will be attached before this is marked ready.
Pinned, not in this PR
character.searchrefused a querynested under
dataeven though the refusal promised "top-level, or inside data"; reads nowfall back to
data. The live step line clipped long labels ("Checking Characters andpersonas ag…"); it wraps to a second line now.
its output tokens mid-write; a character create lost its final message to a thought loop. The
reads and tool calls succeeded in both; the failure is model budget/looping, not the prompt.
@//is #7913 (its own change): letting a user hand Mari a character directly.Once it lands, the
app_datadatadescription should be reworded to match.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.