[GH-ISSUE #7907] feat(mari): report a character's lorebooks in character.get #4342

Closed
opened 2026-10-22 04:05:49 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @ylli-selmani on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7907

Originally assigned to: @ylli-selmani on GitHub.

What problem does this solve?

A character's attached lorebooks are not readable through app_data. The link lives in
lorebook_character_links (lorebookId, characterId) and a card's own book is
lorebooks.characterId; character.get returns only the card row, so anything working through the
structured commands has to fall back to a raw mari db select lorebook_character_links --where …
to learn which lore a card brings to a chat.

That gap surfaced while writing Professor Mari's interactive-onboarding handbook (#7827): the
procedure should tell her to skim the lore a card carries before writing persona questions, and
there was no command that answers "which books belong to this card?". The workaround a raw DB read
would teach is exactly the kind of brittle step the structured commands exist to replace.

Proposed solution

character.get returns one additional read-only field:

"lorebooks": [
  { "id": "…", "name": "Simulator's Lorebook", "description": "Earth-Prime locations, …", "attached": "linked" },
  { "id": "…", "name": "Card Book", "description": "Ships inside the card.", "attached": "owned" }
]
  • Includes books linked to the card and the book it owns, marked linked / owned; nothing else.
  • Sorted by name, description truncated (160 chars), same shape as other read summaries.
  • Empty array when the card has none; an unknown character id still returns null.
  • Read-only and additive: no schema change, no new action, no write path.

Alternatives considered

  • A new character.lorebooks action. A second call for one field, on a read the caller already
    performs; and every consumer would have to remember to make it.
  • Teach the raw DB read instead. mari db select lorebook_character_links works, but it makes a
    handbook depend on table names and row shapes, and the repo already asks agents to prefer narrow
    helpers over raw DB access.
  • Add it to character.list. The field is per-card detail, and the summaries are deliberately
    compact; a list of books per row would bloat a paged read.

Additional context

  • Found by #7827 while writing the first shipped skill. The draft PR for that design (#7908) ships
    this field, its regression, and the onboarding step that uses it, so the two land together.
  • Entry points: packages/server/src/services/mari-db/mari-db.service.ts
    (executeCharacterAction → get, and the characterLorebooks helper).
  • Proof: scripts/regressions/mari/character-lorebook-links.regression.ts — linked + owned included,
    another card's book excluded, bare card returns [], unknown id returns null.
Originally created by @ylli-selmani on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7907 Originally assigned to: @ylli-selmani on GitHub. ## What problem does this solve? A character's attached lorebooks are not readable through `app_data`. The link lives in `lorebook_character_links` (`lorebookId`, `characterId`) and a card's own book is `lorebooks.characterId`; `character.get` returns only the card row, so anything working through the structured commands has to fall back to a raw `mari db select lorebook_character_links --where …` to learn which lore a card brings to a chat. That gap surfaced while writing Professor Mari's interactive-onboarding handbook (#7827): the procedure should tell her to skim the lore a card carries before writing persona questions, and there was no command that answers "which books belong to this card?". The workaround a raw DB read would teach is exactly the kind of brittle step the structured commands exist to replace. ## Proposed solution `character.get` returns one additional read-only field: ```json "lorebooks": [ { "id": "…", "name": "Simulator's Lorebook", "description": "Earth-Prime locations, …", "attached": "linked" }, { "id": "…", "name": "Card Book", "description": "Ships inside the card.", "attached": "owned" } ] ``` - Includes books linked to the card **and** the book it owns, marked `linked` / `owned`; nothing else. - Sorted by name, `description` truncated (160 chars), same shape as other read summaries. - Empty array when the card has none; an unknown character id still returns `null`. - Read-only and additive: no schema change, no new action, no write path. ## Alternatives considered - **A new `character.lorebooks` action.** A second call for one field, on a read the caller already performs; and every consumer would have to remember to make it. - **Teach the raw DB read instead.** `mari db select lorebook_character_links` works, but it makes a handbook depend on table names and row shapes, and the repo already asks agents to prefer narrow helpers over raw DB access. - **Add it to `character.list`.** The field is per-card detail, and the summaries are deliberately compact; a list of books per row would bloat a paged read. ## Additional context - Found by #7827 while writing the first shipped skill. The draft PR for that design (#7908) ships this field, its regression, and the onboarding step that uses it, so the two land together. - Entry points: `packages/server/src/services/mari-db/mari-db.service.ts` (`executeCharacterAction` → `get`, and the `characterLorebooks` helper). - Proof: `scripts/regressions/mari/character-lorebook-links.regression.ts` — linked + owned included, another card's book excluded, bare card returns `[]`, unknown id returns `null`.
bsakaguchi 2026-10-24 04:03:24 +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#4342
No description provided.