[PR #5178] [MERGED] feat(macros): support Persona cards by ID #6659

Closed
opened 2026-10-23 04:12:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5178
Author: @SpicyMarinara
Created: 8/17/2026
Status: ✅ Merged
Merged: 8/17/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/persona-card-id-macro


📝 Commits (4)

  • 014be8d feat(macros): reference Persona cards by ID
  • 272d3ea fix(macros): preserve discovered persona references
  • fe67c68 fix(macros): retain scoped persona references
  • 28c3d7d Merge remote-tracking branch 'origin/staging' into agent/persona-card-id-macro

📊 Changes

7 files changed (+405 additions, -50 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/prompts/macros.md (+3 -0)
📝 packages/server/src/services/prompt/assembler.ts (+94 -39)
📝 packages/server/src/services/prompt/macro-context.ts (+167 -11)
📝 packages/shared/src/utils/macro-engine.ts (+14 -0)
📝 scripts/regressions/open-issues.regression.ts (+95 -0)
📝 scripts/regressions/prompt.regression.ts (+31 -0)

📄 Description

Why

Users can reference an arbitrary Character card by copied ID, but not an arbitrary Persona card. That forces Persona text used outside the active card to be duplicated and manually kept in sync.

What changed

  • Adds {{persona-<21-character-ID>}} for arbitrary Persona cards.
  • Resolves the macro to the Persona name and injects authored card fields through ID Macro Cards.
  • Applies normal activation rules to lorebooks attached to the referenced Persona.
  • Documents the syntax and adds direct plus assembled-prompt regression coverage.

Closes #5171

Validation

  • pnpm --filter @marinara-engine/shared build
  • pnpm --filter @marinara-engine/server lint
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/prompt.regression.ts
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/open-issues.regression.ts

Manual verification

  • Copy a Persona ID and verify {{persona-<ID>}} resolves in Peek Prompt.
  • Verify a qualifying attached Persona lorebook entry appears through ID Macro Cards.

Summary by CodeRabbit

  • New Features

    • Added support for referencing persona cards by ID in prompts.
    • Referenced personas now resolve their names and authored card fields.
    • Eligible attached lorebook content can be included while preserving normal activation rules.
    • Persona references can be discovered from profile content, messages, and lorebook entries.
    • Unknown or invalid persona IDs remain unchanged.
  • Documentation

    • Added usage guidance for persona card ID macros.
  • Tests

    • Added regression coverage for persona references, card details, and lorebook content.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5178 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/17/2026 **Status:** ✅ Merged **Merged:** 8/17/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/persona-card-id-macro` --- ### 📝 Commits (4) - [`014be8d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/014be8ddfb61c07e47ff23cd178ff4a95a204e84) feat(macros): reference Persona cards by ID - [`272d3ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/272d3ea96f185595db4f8c2ef945fefae5e345b1) fix(macros): preserve discovered persona references - [`fe67c68`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fe67c68c99389373d4132e746a33ada3d417ef2c) fix(macros): retain scoped persona references - [`28c3d7d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/28c3d7df184746e90badf8a3d8257c1d6b853819) Merge remote-tracking branch 'origin/staging' into agent/persona-card-id-macro ### 📊 Changes **7 files changed** (+405 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/prompts/macros.md` (+3 -0) 📝 `packages/server/src/services/prompt/assembler.ts` (+94 -39) 📝 `packages/server/src/services/prompt/macro-context.ts` (+167 -11) 📝 `packages/shared/src/utils/macro-engine.ts` (+14 -0) 📝 `scripts/regressions/open-issues.regression.ts` (+95 -0) 📝 `scripts/regressions/prompt.regression.ts` (+31 -0) </details> ### 📄 Description ## Why Users can reference an arbitrary Character card by copied ID, but not an arbitrary Persona card. That forces Persona text used outside the active card to be duplicated and manually kept in sync. ## What changed - Adds `{{persona-<21-character-ID>}}` for arbitrary Persona cards. - Resolves the macro to the Persona name and injects authored card fields through ID Macro Cards. - Applies normal activation rules to lorebooks attached to the referenced Persona. - Documents the syntax and adds direct plus assembled-prompt regression coverage. Closes #5171 ## Validation - `pnpm --filter @marinara-engine/shared build` - `pnpm --filter @marinara-engine/server lint` - `node ./scripts/run-regressions.mjs --filter scripts/regressions/prompt.regression.ts` - `node ./scripts/run-regressions.mjs --filter scripts/regressions/open-issues.regression.ts` ## Manual verification - [ ] Copy a Persona ID and verify `{{persona-<ID>}}` resolves in Peek Prompt. - [ ] Verify a qualifying attached Persona lorebook entry appears through ID Macro Cards. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for referencing persona cards by ID in prompts. * Referenced personas now resolve their names and authored card fields. * Eligible attached lorebook content can be included while preserving normal activation rules. * Persona references can be discovered from profile content, messages, and lorebook entries. * Unknown or invalid persona IDs remain unchanged. * **Documentation** * Added usage guidance for persona card ID macros. * **Tests** * Added regression coverage for persona references, card details, and lorebook content. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:12:29 +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#6659
No description provided.