mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #453] [Feature]: Add a Token-Based Context Limit alongside the existing Message Limit #201
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#201
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Navgner on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/453
What problem does this solve?
Currently, Marinara Engine relies on a fixed "Message Limit" to manage how much context is sent to the model. However, since message lengths vary wildly during a roleplay, this approach is highly unpredictable. Sometimes a limit of X messages underutilizes my available context window, while other times it completely overflows it, causing my local LLM to bug out or truncate unexpectedly.
Describe the solution you'd like
I would love to see a "Context Limit in Tokens" option, ideally placed right below the Message Limit setting.
Instead of pulling a fixed number of messages, the engine would pull messages dynamically until it hits this user-defined token ceiling.
Why is this important? (Use Case)
If I am running a local model with a strict 16,000 token context window, I need precise control. I want to be able to set a token limit of, say, 14,500 tokens. This acts as a strict ceiling, leaving a guaranteed safe "buffer" of 1,500 tokens for the AI's generation. This ensures the engine maximizes the context without ever risking an overflow/crash on local hardware. Otherwise when the limit is hit, I notice the AI forgetting much more to do the thinking before generating a message.
Additional context
I am unsure if the lack of this feature is an intentional design choice due to the way context injection is coded, but having a token-based knapsack approach (filling up to a token threshold rather than a message count) would be a massive quality-of-life improvement for local users who need to manage VRAM strictly.
@cha1latte commented on GitHub (May 6, 2026):
Triage note: labeling this as
scope-riskbecause a token-based context limit is strongly aligned with local-model reliability, but it changes prompt assembly from message-count selection to token-budget selection.Least risky next step is to define token counting, fallback behavior, and how this setting interacts with the existing message limit before implementation.
@SpicyMarinara commented on GitHub (May 10, 2026):
We already have that in Connections.