[GH-ISSUE #2185] [Issue]: Lorebook recursive scan cannot activate entries across active lorebooks #1088

Closed
opened 2026-10-21 05:26:32 +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/2185

Originally assigned to: @cha1latte on GitHub.

Summary

The lorebook runtime rescan found that recursive scanning now runs per lorebook instead of across the full relevant entry set. Entry content from one active lorebook cannot recursively activate entries in another active lorebook, even though legacy scanned across all relevant entries.

Expected behavior

Recursive scanning should preserve legacy behavior: scan initially active entries, use selected recursive content as the next frontier, and allow that frontier to activate any remaining relevant entry across the active lorebook set while respecting max recursion depth and preventRecursion.

Actual behavior

Refactor scans each lorebook independently in scanLorebookEntries. When recursive scanning is enabled for a lorebook, recursiveScan only receives that book's entries. Cross-lorebook recursive activation is therefore impossible.

Refactor also performs recursion before final chat-level budgeting, while legacy recursed from budget-selected entries. That can make recursive activation depend on entries that would later be excluded by budget.

Steps to reproduce

  1. Create lorebook A with an entry that activates from chat text and whose content contains a keyword for lorebook B.
  2. Create lorebook B with an entry keyed to that keyword.
  3. Enable recursive scanning on the relevant lorebook setup.
  4. Generate in refactor and compare against legacy main.
  5. Observe that B does not activate from A's content in refactor.

Impact area

  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • 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
  • Run mode: Tauri desktop / web shell / remote runtime, wherever prompt assembly uses the shared engine scanner
  • 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: not provider-specific

Logs, screenshots, or video

Static trace:

  • Refactor per-book recursion: src/engine/generation/active-lorebook-scanner.ts
  • Refactor recursive helper: src/engine/generation-core/lorebooks/keyword-scanner.ts
  • Legacy cross-book recursion: packages/server/src/services/lorebook/index.ts on main

Regression notes

Legacy main recursed across allEntries from all relevant lorebooks. Refactor recurses only within one book at a time.

Additional context

Parity row: 07-LB-RUNTIME-recursive-scan.

Classification from rescan: Confirmed regression.

Template check

  • 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/2185 Originally assigned to: @cha1latte on GitHub. ## Summary The lorebook runtime rescan found that recursive scanning now runs per lorebook instead of across the full relevant entry set. Entry content from one active lorebook cannot recursively activate entries in another active lorebook, even though legacy scanned across all relevant entries. ## Expected behavior Recursive scanning should preserve legacy behavior: scan initially active entries, use selected recursive content as the next frontier, and allow that frontier to activate any remaining relevant entry across the active lorebook set while respecting max recursion depth and `preventRecursion`. ## Actual behavior Refactor scans each lorebook independently in `scanLorebookEntries`. When recursive scanning is enabled for a lorebook, `recursiveScan` only receives that book's entries. Cross-lorebook recursive activation is therefore impossible. Refactor also performs recursion before final chat-level budgeting, while legacy recursed from budget-selected entries. That can make recursive activation depend on entries that would later be excluded by budget. ## Steps to reproduce 1. Create lorebook A with an entry that activates from chat text and whose content contains a keyword for lorebook B. 2. Create lorebook B with an entry keyed to that keyword. 3. Enable recursive scanning on the relevant lorebook setup. 4. Generate in refactor and compare against legacy `main`. 5. Observe that B does not activate from A's content in refactor. ## Impact area - [x] Catalog resources - [x] Chat mode - [x] Roleplay mode - [x] Game mode - [ ] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] 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` - Run mode: Tauri desktop / web shell / remote runtime, wherever prompt assembly uses the shared engine scanner - 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: not provider-specific ## Logs, screenshots, or video Static trace: - Refactor per-book recursion: `src/engine/generation/active-lorebook-scanner.ts` - Refactor recursive helper: `src/engine/generation-core/lorebooks/keyword-scanner.ts` - Legacy cross-book recursion: `packages/server/src/services/lorebook/index.ts` on `main` ## Regression notes Legacy `main` recursed across `allEntries` from all relevant lorebooks. Refactor recurses only within one book at a time. ## Additional context Parity row: `07-LB-RUNTIME-recursive-scan`. Classification from rescan: `Confirmed regression`. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:26:32 +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#1088
No description provided.