[GH-ISSUE #6923] [Feature]: Macro variables improvement (history / state tracking) #3882

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

Originally created by @usagirei on GitHub (Oct 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6923

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Currently, macro variables are stored in the chat metadata table, inside a macroVariables field.

This makes it so that a new swipe or a deleted generation does not roll back the values and leaks state (there is no history).

If the user was using any of the variable macros - getvar, incvar, setvar, conditionals with if var.name, etc - and a message is deleted or regenerated, the value is not restored before generation, contrary to expectations.

Additionally, these values are not user accessible/visible. Already acessible in Chat settings

Proposed solution

  • Store macro variables in the same way as player stats, world custom fields, and other fields that keep snapshots per-message/turn.
    • If this is not possible in conversation mode for some reason, it should at least work like that when in Role play / Game modes.

Alternatives considered

When the custom tracker capability is available:

  • Enable a new set of dynamic variable macros that makes use of the custom tracker fields when in Roleplay mode.
  • Make the current macro variables make use of custom tracker as backing storage when in Roleplay mode, instead of using the chat metadata table

Additional context

Example:

The user set up in a constantly activated lorebook entry for something to happen when a variable reaches zero, or decrease it by one otherwise, and made it such that a setvar macro was used elsewhere.

Regenerating the message multiple times will keep decreasing the counter and trigger the condition, instead of decreasing it only once - as the previous value was never restored

Template check

Please uncheck (untick) 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 @usagirei on GitHub (Oct 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6923 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Currently, macro variables are stored in the chat metadata table, inside a macroVariables field. This makes it so that a new swipe or a deleted generation does not roll back the values and leaks state (there is no history). If the user was using any of the variable macros - getvar, incvar, setvar, conditionals with if var.name, etc - and a message is deleted or regenerated, the value is not restored before generation, contrary to expectations. ~~Additionally, these values are not user accessible/visible.~~ Already acessible in Chat settings <!-- Describe the pain point or gap this feature would address --> ## Proposed solution * Store macro variables in the same way as player stats, world custom fields, and other fields that keep snapshots per-message/turn. * If this is not possible in conversation mode for some reason, it should at least work like that when in Role play / Game modes. <!-- What would you like to see added or changed? --> ## Alternatives considered When the custom tracker capability is available: * Enable a *new* set of dynamic variable macros that makes use of the custom tracker fields when in Roleplay mode. * Make the *current* macro variables make use of custom tracker as backing storage when in Roleplay mode, instead of using the chat metadata table <!-- Any other approaches you thought about? --> ## Additional context Example: The user set up in a constantly activated lorebook entry for something to happen when a variable reaches zero, or decrease it by one otherwise, and made it such that a setvar macro was used elsewhere. Regenerating the message multiple times will keep decreasing the counter and trigger the condition, instead of decreasing it only *once* - as the previous value was never restored <!-- Optional: mockups, related issues, references, or examples --> ## Template check Please **uncheck (untick)** 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.
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#3882
No description provided.