mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
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#6494
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/4778
Author: @kolacheee
Created: 8/8/2026
Status: ✅ Merged
Merged: 8/9/2026
Merged by: @kolacheee
Base:
staging← Head:feat/4768-semantic-discovery📝 Commits (8)
0cc499efeat(mari): tiered entity resolution module for [fetch:] (#4768)7496529feat(db): add nullable embedding columns for entity semantic search (#4768)4393e42feat(mari): persisted embedding store with content-hash invalidation (#4768)e1fec9bfeat(mari): tiered fetch resolution + candidate disambiguation (#4768)04af212fix(mari): address adversarial review of the #4768 semantic feature312d12bfeat(mari): disambiguate same-named entities by id (#4768)0934f1fMerge branch 'staging' into feat/4768-semantic-discovery084a7ccfix(mari): address CodeRabbit review of the #4768 semantic PR📊 Changes
15 files changed (+1117 additions, -20 deletions)
View changed files
📝
package.json(+1 -1)📝
packages/server/src/db/schema/characters.ts(+4 -0)📝
packages/server/src/db/schema/chats.ts(+2 -0)📝
packages/server/src/db/schema/lorebooks.ts(+2 -0)📝
packages/server/src/db/schema/prompts.ts(+2 -0)📝
packages/server/src/db/seed-mari.ts(+6 -1)📝
packages/server/src/routes/generate.routes.ts(+2 -0)➕
packages/server/src/services/entity-embedding-store.ts(+259 -0)➕
packages/server/src/services/entity-semantic-search.ts(+282 -0)📝
packages/server/src/services/generation/professor-mari-command-runtime.ts(+111 -18)📝
packages/server/src/services/storage/lorebooks.storage.ts(+4 -0)➕
scripts/regressions/entity-embedding-store.regression.ts(+121 -0)➕
scripts/regressions/helpers/bow-stub-embedder.ts(+36 -0)➕
scripts/regressions/professor-mari-fetch-integration.regression.ts(+164 -0)➕
scripts/regressions/professor-mari-fetch-tiers.regression.ts(+121 -0)📄 Description
Linked issue
Part of #4768 (phase 2 — the discovery half; see the roadmap comment on the issue).
Why this change
Phase 1 (#4771) fixed the cost of Mari's name lists but not discovery: conversation-mode Mari resolved a
[fetch:]by exact normalized name only. So a character buried past the injected-list cap ("Zander", when there are hundreds), or any fuzzy reference ("my chat with the vampire guy"), failed — and a wrong guess setfetchSucceeded=false, which meant the follow-up never fired and Mari went silent. A capped name list can never solve this; it needs search.What changed
Mari's
[fetch:]now resolves in tiers, entirely server-side (the[fetch:]grammar is unchanged — the existingnameis treated as a query):On a single confident hit it opens the item as before. On a weak/ambiguous match it returns a ranked candidate list ("Several character matches for 'vampire' — ask which one, do not guess") instead of guessing. Both ride the existing
mariContextslot — which #4771 moved into the volatile tail, so a candidate list causes no cache-prefix churn — and both trigger the existing fetch follow-up so Mari speaks to what she pulled.Semantic search reuses the engine's existing embed→cosine pipeline (the same one powering lorebook-entry matching), extended to all five entity types:
embeddingcolumns (characters, personas, chats, prompt_presets, lorebook books). Backward-compatible and layout-neutral — nomigrate, noSTORAGE_VERSION/storage-format bump (the file-native store derives column metadata from the schema; these tables aren't sharded).{hash(embedText), source, vector}, and a read whose hash/source no longer matches is treated as absent → re-embedded. This needs zero invalidation hooks in any entity's write path and is structurally immune to the drift bug it replaces (which I also fixed in passing: the lorebook invalidation predicate omitteddescription).updatedAtbump — so background vectorization never churns recency order or the chat sidebar. Embedding compute is bounded per fetch; the substring tier covers the common case with no embeddings at all, and semantic warms lazily.The seed
<data_access>prompt teaches the flexible resolution and the disambiguation protocol.Deliberate choices / tradeoffs (flagged for your read):
data_candidatesaction but there's no toast yet; Mari presents the list in her follow-up text (server-first MVP, per our discussion).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated checks already run by the author (green) — not a substitute for the human pass below:
pnpm check(TypeScript + ESLint + build) green.regression:issuesand green:professor-mari-fetch-tiers(every tier + the auto-open-vs-disambiguate boundary, via a deterministic collision-free stub embedder — no ONNX),entity-embedding-store(content-hash + source staleness, no-updatedAt-bump, flat-column table via the realdb.updatepath, Mari self-exclusion),professor-mari-fetch-integration(end-to-endhandleProfessorMariCommand: exact, fuzzy auto-open, ambiguous→candidates, miss, options-eviction).regression:issues+regression:prompt+professor-marilanes green.Still needs a human pass in the app with a real embedder + LLM connection (behavior isn't observable without live generation):
[fetch:]a buried one by exact name, by a partial/approximate name, and by a description ("the vampire guy") — confirm each resolves.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)The changed prompt text is model-facing, not user docs. If the Mari/assistant user docs describe fetch behavior, a short mention that fetch now resolves fuzzily could be worth a follow-up — flagging for your call.
Summary by CodeRabbit
New Features
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.