mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #4796] [MERGED] feat(server): teach workspace Professor Mari to author well-parameterized lorebooks #6501
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#6501
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/4796
Author: @kolacheee
Created: 8/9/2026
Status: ✅ Merged
Merged: 8/9/2026
Merged by: @kolacheee
Base:
staging← Head:feat/4791-mari-lorebook-authoring📝 Commits (7)
619286bfeat(server): teach workspace Professor Mari to author well-parameterized lorebooksc280c59Merge branch 'staging' into feat/4791-mari-lorebook-authoringec206edfix(server): address CodeRabbit review on Mari lorebook authoring (#4796)b56fc5eMerge branch 'staging' into feat/4791-mari-lorebook-authoring25d96b6test(server): cover the no-headings and >40-headings docs_read miss branches9d67fc1fix(server): tighten docs heading parser + scope Mari embedding check to her connection74930d4fix(server): restrict docs heading fences to <=3-space indentation📊 Changes
6 files changed (+315 additions, -25 deletions)
View changed files
📝
package.json(+1 -1)📝
packages/server/src/services/mari-db/mari-db.service.ts(+34 -5)📝
packages/server/src/services/professor-mari/documentation-tools.ts(+53 -13)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+23 -5)📝
scripts/regressions/open-issues.regression.ts(+118 -0)📝
scripts/regressions/professor-mari-documentation.regression.ts(+86 -1)📄 Description
Linked issue
Closes #4791
Why this change
When a user asks the workspace Home assistant (Professor Mari) to build a lorebook — e.g. "make a lorebook for the setting Vlad the vampire lives in" — she produced near-skeletal entries: Name + Content + a couple of keys, and essentially nothing else. Two root causes, both fixed here:
lorebook.create/addEntry/updateEntrypaths silently hardcoded the advanced entry fields (selective,selectiveLogic,matchWholeWords,caseSensitive,useRegex), so even a perfect prompt could not get her to set them.The result was functional-but-shallow world info that under-used the engine's own capabilities. This teaches her to author good lorebooks and gives her the tools to actually do it.
What changed
Engine
selective,selectiveLogic,matchWholeWords,caseSensitive,useRegexon the workspacelorebook.create(entries array),addEntry, andupdateEntrypaths — previously hardcoded and ignored bybuildLorebookEntryCreateRow+assignLorebookEntryActionFields.selectiveLogicis validated against the stored enum (and/and_all/or/not/not_all); invalid input falls back to the default.embeddingModelConfiguredinto Mari's<workspace_context>(viaisMemoryRecallVectorizerAvailable, cached, guarded) so her semantic guidance stays conditional on an embedding model actually being configured.Prompt
matchWholeWordson an ambiguous name + filled descriptions).lorebook.createentry field list in the tool schema.Docs tool
docs_readheading miss now lists the file's available headings instead of a bare throw, so Mari can self-correct a wrong heading.professor-mari-documentationregression into CI.Tests
create,addEntry, andupdateEntry, plusselectiveLogicvalidation (invalid → default / ignored).Notes / follow-ups (surfaced by adversarial review)
useRegex). Scan-time regex is already guarded (isPatternSafe+ a 50 ms vm timeout with literal fallback), so the added ReDoS surface is bounded.embeddingModelConfiguredis computed against the default connection; if a user's default connection differs from the workspace connection it can misreport. Advisory-only signal.mariCLIlorebooks add-entry/update-entrystill hardcodes these fields (pre-existing; Mari is directed to useapp_data, not the CLI). Worth a small follow-up issue for CLI parity.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated (run locally, all green — boxes left unticked for the human to confirm):
pnpm check(tsc + eslint + client build) passes.open-issues,professor-mari-documentation,professor-mari-prompt-context,professor-mari-fetch-tiers,entity-embedding-store,professor-mari-fetch-integration,professor-mari-relevance-names.Still needs a real browser/app pass (NOT yet done):
constantpremise entry, keyed detail entries, and filleddescriptions — not Name/Content only.matchWholeWords).docs_readwith a wrong heading returns the available-headings hint.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No
docs/files change in this PR, so nodocs-i18nmirroring is required. The user-facing docs improvement (authoring strategy + non-skeletal examples) is tracked separately in #4792. No version bump.Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.