[GH-ISSUE #2197] [Issue]: search_lorebook no longer matches lorebook entry keys #1095

Closed
opened 2026-10-21 05:26:37 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2197

Originally assigned to: @Promansis on GitHub.

Summary

The Batch 7 lorebook parityscan found that refactor search_lorebook no longer searches lorebook entry keys. Legacy main matched entry name, content, and primary keys for the built-in tool; refactor scores only name, tag, and content.

Expected behavior

The built-in search_lorebook tool should find relevant scoped lorebook entries when the query matches entry keys, not only entry name/tag/content. Results should preserve enough key/category context for agents and tool-enabled generations to understand why an entry matched.

Actual behavior

Refactor loads scoped stored lorebook entries and activated entries, but searchLorebookTool builds its search haystack from name, tag, and content only. A query that exists only in an entry key can return no results even though legacy would return the entry.

Steps to reproduce

  1. Create or import a scoped lorebook entry whose keys include a unique term that does not appear in the entry name, tag, or content.
  2. Enable/use a built-in agent or tool-enabled generation path that can call search_lorebook.
  3. Call search_lorebook with that unique key term.
  4. Observe that refactor can miss the entry because keys are not included in the scoring haystack.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor / 577de008
  • Run mode: Tauri desktop / web shell / remote runtime, wherever shared engine tool execution is used
  • OS + version: not OS-specific
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: tool-enabled generation or built-in agents using search_lorebook

Logs, screenshots, or video

Static trace:

  • Refactor built-in tool definition still exposes search_lorebook: src/engine/contracts/types/agent.ts.
  • Refactor search implementation builds the haystack from entry.name, entry.tag, and entry.content only: src/engine/generation/tools-runtime.ts.
  • Legacy main searched e.name, e.content, and e.keys: packages/server/src/routes/generate.routes.ts.

Regression notes

Legacy main supported key-only matches for the search_lorebook tool. Refactor preserved the tool but dropped key matching from the search implementation.

Additional context

Parity target: #2181

Parity row: 07-LB-API-search-tool

Classification from Batch 7 scan: Confirmed regression.

Suggested fix: include primary keys, and likely secondary keys if product wants parity with authoring data, in the search haystack and result context.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2197 Originally assigned to: @Promansis on GitHub. ## Summary The Batch 7 lorebook parityscan found that refactor `search_lorebook` no longer searches lorebook entry keys. Legacy `main` matched entry name, content, and primary keys for the built-in tool; refactor scores only name, tag, and content. ## Expected behavior The built-in `search_lorebook` tool should find relevant scoped lorebook entries when the query matches entry keys, not only entry name/tag/content. Results should preserve enough key/category context for agents and tool-enabled generations to understand why an entry matched. ## Actual behavior Refactor loads scoped stored lorebook entries and activated entries, but `searchLorebookTool` builds its search haystack from `name`, `tag`, and `content` only. A query that exists only in an entry key can return no results even though legacy would return the entry. ## Steps to reproduce 1. Create or import a scoped lorebook entry whose `keys` include a unique term that does not appear in the entry name, tag, or content. 2. Enable/use a built-in agent or tool-enabled generation path that can call `search_lorebook`. 3. Call `search_lorebook` with that unique key term. 4. Observe that refactor can miss the entry because keys are not included in the scoring haystack. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [x] Chat mode - [x] Roleplay mode - [x] Game mode - [ ] Shared mode UI - [ ] Professor Mari or shell tools - [x] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` / `577de008` - Run mode: Tauri desktop / web shell / remote runtime, wherever shared engine tool execution is used - OS + version: not OS-specific - Node + pnpm versions: not relevant - Rust version, if relevant: not relevant - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: tool-enabled generation or built-in agents using `search_lorebook` ## Logs, screenshots, or video Static trace: - Refactor built-in tool definition still exposes `search_lorebook`: `src/engine/contracts/types/agent.ts`. - Refactor search implementation builds the haystack from `entry.name`, `entry.tag`, and `entry.content` only: `src/engine/generation/tools-runtime.ts`. - Legacy `main` searched `e.name`, `e.content`, and `e.keys`: `packages/server/src/routes/generate.routes.ts`. ## Regression notes Legacy `main` supported key-only matches for the `search_lorebook` tool. Refactor preserved the tool but dropped key matching from the search implementation. ## Additional context Parity target: #2181 Parity row: `07-LB-API-search-tool` Classification from Batch 7 scan: `Confirmed regression`. Suggested fix: include primary keys, and likely secondary keys if product wants parity with authoring data, in the search haystack and result context. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:26:37 +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#1095
No description provided.