[GH-ISSUE #6582] [Issue]: Decision statements that cannot affect the turn use up the per-turn limit, and statements in preset choice options always read as no #3690

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

Originally created by @kolacheee on GitHub (Sep 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6582

Originally assigned to: @kolacheee on GitHub.

What happens

Decision statements per turn (32 by default) caps how many decision statements are asked each turn. Past it, the rest read as no. The planner that fills those slots scans every stored text that could hold a statement, not the prompt the turn will actually build. So statements that cannot affect the turn take slots from ones that can.

Confirmed by running collectTurnDecisionTexts and planPromptDecisions (packages/server/src/services/decision/prompt-decisions.ts) with a limit of 2:

  1. Disabled preset sections and groups still count. A statement in a disabled section took a slot and pushed out a live one. The prompt builder already skips disabled sections (assembler.ts); the planner does not.
  2. Every choice block option counts, not just the selected ones.
  3. Every enabled entry in the chat's active lorebooks counts, before the scan decides which entries activate. A large lorebook with many {{#if decision}} blocks can use up the limit on entries that never appear.
  4. Statements behind conditions that are already false still count. For example, in {{#if char == "Dottore" && decision:"..."}}, the statement is asked while the character is Mira.

Bug: a statement inside a preset choice option always reads as no

Choice options are stored as JSON text, and the planner walks that raw text. A statement inside an option is therefore planned under a mangled key:

planned from the stored row: ["\"Mira is angry in the latest message\""]
key the prompt looks up:     ["Mira is angry in the latest message"]

The assembler runs choice option text through the macro engine with the clean key (assembler.ts, where preset variables are resolved), so the answer is never found. The block reads as no every turn, and the mangled statement still takes a slot.

What we want

  • Plan only the statements the turn can actually reach: enabled sections and groups, the selected choice options (with the right key), lorebook entries that activate this turn, and blocks whose other conditions do not already rule them out.
  • Peek Prompt lists statements that were dropped for the limit, not just ones without an answer, so authors can see what the limit cost them.
  • Docs: advise preset creators to be very careful and purposeful with decision blocks near the top of a preset. A branch that changes turn to turn above the chat history changes the system prompt, and a caching provider then bills the whole prompt as new. This goes in docs/prompts/presets.md and docs/prompts/preset-variables.md, with the Conditional Prompts caching note strengthened to match.

Sticky and cooldown for decision statements

Authors can hold a statement's answer instead of asking it every turn, written after the statement:

{{#if decision:"The latest message starts a fight" sticky:3 cooldown:5}}
Keep combat pacing rules in effect.
{{/if}}
  • sticky:N: after a yes, the statement stays yes for the next N turns without being asked, so what it gates stays in the prompt.
  • cooldown:N: starts when sticky ends (or right after the yes without sticky). For N turns the statement reads as no and is not asked.
  • A turn is each new message the Decision model reads. Regenerations and swipes do not count.
  • A statement held by sticky or cooldown does not use up Decision statements per turn.
  • For decision_choice:, sticky keeps the chosen option and cooldown reads every comparison as no.
  • Lorebook entries' Decision field needs nothing new: the entry's own Sticky and Cooldown already keep a decision-activated entry in without asking, and keep an entry on cooldown from being asked.

Not in this issue

Author-set priority and timing (checked every N turns) for decision statements are a follow-up.

Originally created by @kolacheee on GitHub (Sep 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6582 Originally assigned to: @kolacheee on GitHub. ## What happens **Decision statements per turn** (32 by default) caps how many decision statements are asked each turn. Past it, the rest read as no. The planner that fills those slots scans every stored text that could hold a statement, not the prompt the turn will actually build. So statements that cannot affect the turn take slots from ones that can. Confirmed by running `collectTurnDecisionTexts` and `planPromptDecisions` (`packages/server/src/services/decision/prompt-decisions.ts`) with a limit of 2: 1. **Disabled preset sections and groups still count.** A statement in a disabled section took a slot and pushed out a live one. The prompt builder already skips disabled sections (`assembler.ts`); the planner does not. 2. **Every choice block option counts**, not just the selected ones. 3. **Every enabled entry in the chat's active lorebooks counts**, before the scan decides which entries activate. A large lorebook with many `{{#if decision}}` blocks can use up the limit on entries that never appear. 4. **Statements behind conditions that are already false still count.** For example, in `{{#if char == "Dottore" && decision:"..."}}`, the statement is asked while the character is Mira. ## Bug: a statement inside a preset choice option always reads as no Choice options are stored as JSON text, and the planner walks that raw text. A statement inside an option is therefore planned under a mangled key: ``` planned from the stored row: ["\"Mira is angry in the latest message\""] key the prompt looks up: ["Mira is angry in the latest message"] ``` The assembler runs choice option text through the macro engine with the clean key (`assembler.ts`, where preset variables are resolved), so the answer is never found. The block reads as no every turn, and the mangled statement still takes a slot. ## What we want - Plan only the statements the turn can actually reach: enabled sections and groups, the selected choice options (with the right key), lorebook entries that activate this turn, and blocks whose other conditions do not already rule them out. - Peek Prompt lists statements that were dropped for the limit, not just ones without an answer, so authors can see what the limit cost them. - Docs: advise preset creators to be very careful and purposeful with decision blocks near the top of a preset. A branch that changes turn to turn above the chat history changes the system prompt, and a caching provider then bills the whole prompt as new. This goes in `docs/prompts/presets.md` and `docs/prompts/preset-variables.md`, with the Conditional Prompts caching note strengthened to match. ## Sticky and cooldown for decision statements Authors can hold a statement's answer instead of asking it every turn, written after the statement: ``` {{#if decision:"The latest message starts a fight" sticky:3 cooldown:5}} Keep combat pacing rules in effect. {{/if}} ``` - **sticky:N**: after a yes, the statement stays yes for the next N turns without being asked, so what it gates stays in the prompt. - **cooldown:N**: starts when sticky ends (or right after the yes without sticky). For N turns the statement reads as no and is not asked. - A turn is each new message the Decision model reads. Regenerations and swipes do not count. - A statement held by sticky or cooldown does not use up **Decision statements per turn**. - For `decision_choice:`, sticky keeps the chosen option and cooldown reads every comparison as no. - Lorebook entries' **Decision** field needs nothing new: the entry's own Sticky and Cooldown already keep a decision-activated entry in without asking, and keep an entry on cooldown from being asked. ## Not in this issue Author-set priority and timing (checked every N turns) for decision statements are a follow-up.
bsakaguchi 2026-10-21 06:06:10 +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#3690
No description provided.