[PR #7830] [CLOSED] feat(mari): ship built-in skills for her authoring procedures #7955

Closed
opened 2026-10-24 04:09:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7830
Author: @ylli-selmani
Created: 10/19/2026
Status: ❌ Closed

Base: staging ← Head: feat/mari-builtin-skills


📝 Commits (1)

  • 43eba93 feat(mari): ship read-only built-in skills, starting with onboarding

📊 Changes

14 files changed (+607 additions, -75 deletions)

View changed files

📝 packages/client/src/components/chat/MariSkillsMenu.tsx (+57 -35)
📝 packages/client/src/components/chat/mari/use-mari-skill-memory-actions.ts (+5 -2)
📝 packages/client/src/localization/locales/en.json (+2 -0)
➕ packages/server/src/assets/mari-skills/onboarding.md (+141 -0)
📝 packages/server/src/routes/professor-mari-workspace.routes.ts (+9 -0)
➕ packages/server/src/services/professor-mari/builtin-skills.ts (+103 -0)
📝 packages/server/src/services/professor-mari/mari-skills-prompt.ts (+19 -4)
➕ packages/server/src/services/professor-mari/skill-frontmatter.ts (+32 -0)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+2 -5)
📝 packages/server/src/services/professor-mari/workspace-skills.service.ts (+47 -24)
📝 packages/shared/src/types/professor-mari-workspace.ts (+5 -0)
📝 scripts/regressions/professor-mari-onboarding-guidance.regression.ts (+20 -5)
➕ scripts/regressions/professor-mari/builtin-skills.regression.ts (+164 -0)
📝 scripts/regressions/professor-mari/skills-prompt.regression.ts (+1 -0)

📄 Description

Note

Draft. Implementation, local checks and the local CodeRabbit pass are complete. The live matrix
(A/B against staging + the gemma model ladder, on pi) is still running, so this is not ready for
review yet.

Linked issue

Closes #7827
Closes #7907

#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 a
separate patch.

Why this change

Professor Mari's permanent prompt carried every authoring procedure inline, on every turn. Measured on
staging (51e6cace8): MARI_SYSTEM_PROMPT 37,941 chars plus workspaceCommandKnowledgePrompt()
22,456 — about 60k chars (~15k tokens) before any history, and roughly 23k of that is procedure:
lorebook authoring, decision authoring, onboarding, reply repair, extensions, presets, themes and Home
widgets.

Two consequences, both visible in live runs:

  1. Clutter. Every guide is paid for on every turn, including the many turns that touch none of them,
    and the policy that always matters competes with procedure that usually does not.
  2. Compression. A permanent guide has to be a dense paragraph — no worked example, no
    validation-error → fix table, no read-back verification. Onboarding was the clearest case: Mari
    sometimes read character.onboarding.* implementation code to get a write right, because the
    paragraph could not carry the procedure.

This PR moves procedure into nine shipped, read-only handbooks she fetches on demand with skill.get,
and leaves one router line per handbook in the prompt.

What changed

Before After
Knowledge block workspaceCommandKnowledgePrompt 29,217 chars 13,621
Shipped handbooks 0 9 (10.6–16.9k chars, indexed, never inlined)
Handbook regressions 0 8
Prompt ratchet 15,700 13,700

Shipped handbooks — packages/server/src/assets/mari-skills/: onboarding.md, lorebook.md,
presets.md, repair.md, extensions.md, decisions.md, characters.md, themes.md,
home-widgets.md. Each has the field/argument shapes the caller cannot guess, its traps, a worked
example, and checkable completion criteria. They are protocol-neutral (action, never a classic
say/stop envelope), so the same text works under pi's native and textual modes and under classic.

Prompt — packages/server/src/services/professor-mari/workspace-agent.service.ts: the knowledge
block 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_PROMPT are gone — their facts live in
extensions.md / decisions.md now. piRuntimePrompt() interpolates the same shared block.

Skills mechanism — built-ins are a shipped source merged into the existing index: ids are
builtin-*, they are always on and read-only (no edit, delete, toggle or PUT/DELETE), they can
never be shadowed by a user file (a collision is reported as a diagnostic), and an app update replaces
their text cleanly because skills.json is never touched. The index is listed, never inlined; bodies
are read only 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.

Mari DB read (#7907) — character.get returns lorebooks: [{ id, name, description, attached: "linked" | "owned" }]: books linked to the card plus the one it owns, sorted by name, description
truncated. Read-only and additive; onboarding.md uses it to skim a card's lore before writing persona
questions.

Regressions — professor-mari/builtin-skills.regression.ts (index, ids, read-on-demand contract,
ratchet) and one per handbook (mari/*-handbook.regression.ts, 8 of 9 execute their own worked example
against a temporary database), plus mari/character-lorebook-links.regression.ts for #7907 and the
updated mari-ask-latch / professor-mari-onboarding-guidance assertions.

Deferred, not in this PR

  • Two extension defects found while writing extensions.md: source is not adopted on update, and
    full_page_access is stored where the mapper strips it. They need their own change and tests.
  • App polish observed while testing: a stale "That attempt failed" banner under a later successful
    change card; the timeline labels decision.record as "Read"; an applied widget receipt reads "New app
    setting" / "Changed value".
  • scripts/dev.mjs never loads .env, so pnpm dev on a non-default port health-checks the daily
    install. Separate launcher branch.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Run by the agent, on 8689e6bfe (after the CodeRabbit fixes; the boxes above are Ylli's to tick):

  • pnpm check — exit 0 (TypeScript in all four projects, ESLint, localization, format, client build).
  • node scripts/run-regressions.mjs --filter mari — 66/67. The one failure is pre-existing and
    Windows-only: mari-appearance-pack.regression.mjs builds a /C:/… path from import.meta.url
    instead of fileURLToPath; the asset it looks for is present and valid.
  • coderabbit review --committed --base origin/staging --agent --fresh — 3 minor findings, all fixed in
    8689e6bfe (lorebook position trap understated; dead "no custom skills yet" empty state; a lost
    permanent-prompt assertion).

Still to do by Ylli, in the app:

  • Skills panel: with no custom skills, the "no custom skills yet" note appears above the shipped group;
    shipped rows cannot be edited, toggled or deleted.
  • Ask "write onboarding for Edric" — expect a skill.get chip for builtin-onboarding, the card
    patched in the same pass, and {{bond}} resolving.
  • Ask "make me a grumpy lighthouse keeper" — one full create, then 2–4 follow-up chips.
  • Ask "make me a dusk theme with warm accents" — created and activated, with a read-back.
  • Ask "why does the lighthouse entry fire on almost every message?" — testScan with the matched keys.
  • A Home-widget create — held behind the Accept action, applied only after accepting.
  • All of the above on the default pi runtime; the model ladder (gemma 31b / 12b / e4b) runs the same
    asks against staging for comparison.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No docs/ files change in this PR. The Skills panel is discoverable in-app; a short user-docs page
("what the shipped skills are, and that they are read-only") would be worth a follow-up. 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) are kept privately and will be attached before this is marked ready.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7830 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `feat/mari-builtin-skills` --- ### 📝 Commits (1) - [`43eba93`](https://github.com/Pasta-Devs/Marinara-Engine/commit/43eba939d9b3828a8fb33029f52b9b2af7a8d6e3) feat(mari): ship read-only built-in skills, starting with onboarding ### 📊 Changes **14 files changed** (+607 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/MariSkillsMenu.tsx` (+57 -35) 📝 `packages/client/src/components/chat/mari/use-mari-skill-memory-actions.ts` (+5 -2) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) ➕ `packages/server/src/assets/mari-skills/onboarding.md` (+141 -0) 📝 `packages/server/src/routes/professor-mari-workspace.routes.ts` (+9 -0) ➕ `packages/server/src/services/professor-mari/builtin-skills.ts` (+103 -0) 📝 `packages/server/src/services/professor-mari/mari-skills-prompt.ts` (+19 -4) ➕ `packages/server/src/services/professor-mari/skill-frontmatter.ts` (+32 -0) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+2 -5) 📝 `packages/server/src/services/professor-mari/workspace-skills.service.ts` (+47 -24) 📝 `packages/shared/src/types/professor-mari-workspace.ts` (+5 -0) 📝 `scripts/regressions/professor-mari-onboarding-guidance.regression.ts` (+20 -5) ➕ `scripts/regressions/professor-mari/builtin-skills.regression.ts` (+164 -0) 📝 `scripts/regressions/professor-mari/skills-prompt.regression.ts` (+1 -0) </details> ### 📄 Description > [!NOTE] > **Draft.** Implementation, local checks and the local CodeRabbit pass are complete. The live matrix > (A/B against `staging` + the gemma model ladder, on pi) is still running, so this is not ready for > review yet. ## Linked issue Closes #7827 Closes #7907 #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 a separate patch. ## Why this change Professor Mari's permanent prompt carried every authoring procedure inline, on every turn. Measured on `staging` (`51e6cace8`): `MARI_SYSTEM_PROMPT` 37,941 chars plus `workspaceCommandKnowledgePrompt()` 22,456 — about 60k chars (~15k tokens) before any history, and roughly 23k of that is *procedure*: lorebook authoring, decision authoring, onboarding, reply repair, extensions, presets, themes and Home widgets. Two consequences, both visible in live runs: 1. **Clutter.** Every guide is paid for on every turn, including the many turns that touch none of them, and the policy that always matters competes with procedure that usually does not. 2. **Compression.** A permanent guide has to be a dense paragraph — no worked example, no validation-error → fix table, no read-back verification. Onboarding was the clearest case: Mari sometimes read `character.onboarding.*` implementation code to get a write right, because the paragraph could not carry the procedure. This PR moves procedure into nine shipped, read-only handbooks she fetches on demand with `skill.get`, and leaves one router line per handbook in the prompt. ## What changed | | Before | After | | --- | --- | --- | | Knowledge block `workspaceCommandKnowledgePrompt` | 29,217 chars | **13,621** | | Shipped handbooks | 0 | **9** (10.6–16.9k chars, indexed, never inlined) | | Handbook regressions | 0 | **8** | | Prompt ratchet | 15,700 | **13,700** | **Shipped handbooks** — `packages/server/src/assets/mari-skills/`: `onboarding.md`, `lorebook.md`, `presets.md`, `repair.md`, `extensions.md`, `decisions.md`, `characters.md`, `themes.md`, `home-widgets.md`. Each has the field/argument shapes the caller cannot guess, its traps, a worked example, and checkable completion criteria. They are protocol-neutral (`action`, never a classic `say`/`stop` envelope), so the same text works under pi's native and textual modes and under classic. **Prompt** — `packages/server/src/services/professor-mari/workspace-agent.service.ts`: the knowledge block 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_PROMPT` are gone — their facts live in `extensions.md` / `decisions.md` now. `piRuntimePrompt()` interpolates the same shared block. **Skills mechanism** — built-ins are a shipped source merged into the existing index: ids are `builtin-*`, they are always on and read-only (no edit, delete, toggle or `PUT`/`DELETE`), they can never be shadowed by a user file (a collision is reported as a diagnostic), and an app update replaces their text cleanly because `skills.json` is never touched. The index is listed, never inlined; bodies are read only 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. **Mari DB read (#7907)** — `character.get` returns `lorebooks: [{ id, name, description, attached: "linked" | "owned" }]`: books linked to the card plus the one it owns, sorted by name, description truncated. Read-only and additive; `onboarding.md` uses it to skim a card's lore before writing persona questions. **Regressions** — `professor-mari/builtin-skills.regression.ts` (index, ids, read-on-demand contract, ratchet) and one per handbook (`mari/*-handbook.regression.ts`, 8 of 9 execute their own worked example against a temporary database), plus `mari/character-lorebook-links.regression.ts` for #7907 and the updated `mari-ask-latch` / `professor-mari-onboarding-guidance` assertions. ### Deferred, not in this PR - Two extension defects found while writing `extensions.md`: `source` is not adopted on `update`, and `full_page_access` is stored where the mapper strips it. They need their own change and tests. - App polish observed while testing: a stale "That attempt failed" banner under a later successful change card; the timeline labels `decision.record` as "Read"; an applied widget receipt reads "New app setting" / "Changed value". - `scripts/dev.mjs` never loads `.env`, so `pnpm dev` on a non-default port health-checks the daily install. Separate launcher branch. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Run by the agent, on `8689e6bfe` (after the CodeRabbit fixes; the boxes above are Ylli's to tick): - `pnpm check` — exit 0 (TypeScript in all four projects, ESLint, localization, format, client build). - `node scripts/run-regressions.mjs --filter mari` — 66/67. The one failure is pre-existing and Windows-only: `mari-appearance-pack.regression.mjs` builds a `/C:/…` path from `import.meta.url` instead of `fileURLToPath`; the asset it looks for is present and valid. - `coderabbit review --committed --base origin/staging --agent --fresh` — 3 minor findings, all fixed in `8689e6bfe` (lorebook `position` trap understated; dead "no custom skills yet" empty state; a lost permanent-prompt assertion). Still to do by Ylli, in the app: - Skills panel: with no custom skills, the "no custom skills yet" note appears above the shipped group; shipped rows cannot be edited, toggled or deleted. - Ask "write onboarding for Edric" — expect a `skill.get` chip for `builtin-onboarding`, the card patched in the same pass, and `{{bond}}` resolving. - Ask "make me a grumpy lighthouse keeper" — one full create, then 2–4 follow-up chips. - Ask "make me a dusk theme with warm accents" — created and activated, with a read-back. - Ask "why does the lighthouse entry fire on almost every message?" — `testScan` with the matched keys. - A Home-widget create — held behind the Accept action, applied only after accepting. - All of the above on the default **pi** runtime; the model ladder (gemma 31b / 12b / e4b) runs the same asks against `staging` for comparison. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No `docs/` files change in this PR. The Skills panel is discoverable in-app; a short user-docs page ("what the shipped skills are, and that they are read-only") would be worth a follow-up. 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) are kept privately and will be attached before this is marked ready. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:08 +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#7955
No description provided.