[GH-ISSUE #968] [Feature]: Option to exclude past reasoning from prompts/context #471

Closed
opened 2026-10-20 17:29:13 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @thedarkness000 on GitHub (May 18, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/968

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

The most direct benefit to enabling this option would be a reduction in context length, resulting in faster processing (if running a local model) or reduced costs (if accessing a metered API endpoint). I propose this as an option for the end-user to select, since I can anticipate some users not caring about speed/cost if they perceive better quality/consistency by including all of the model's past reasoning in the prompt.

A secondary benefit would be to reduce distractions to the model from past thoughts that may have been disregarded in its final output, or which are otherwise no longer valid. This one may be an artifact of the particular model I'm using (Gemma 4 26B A4B, running locally), but on a few occasions during RPs, the model has generated seemingly confusing or contradictory responses which can (at least based on my observations) be explained by it giving undue weight to its past reasoning content. That reasoning may no longer be valid due to events that have transpired in the RP since, or due to edits I've made to the model's response that invalidate said reasoning.

Proposed solution

Add a toggle to the Chat Settings (possibly under Advanced Parameters) to exclude past reasoning from prompts (or have the toggle be to include past reasoning in prompts and have it enabled by default--whichever you think is better UX).

(I did my best to search all the places in the app I could think of and could not find such an option, but freely admit that I could just be blind.)

I don't have strong feelings on where this option ultimately ends up, so you can put it wherever you think it makes the most sense within the app. (I personally only care about being able to use this option in Roleplay mode, but I don't see why it couldn't also apply to a Conversation, for example.)

Alternatives considered

I attempted to achieve this through the use of a regex script with the pattern , "reasoning_content": ".+?"(?=}) (based on the raw input I was seeing in KoboldCPP's terminal window). While it successfully stripped the reasoning content from the raw input I pasted into the Live Test box, it didn't seem to modify the actual input being sent to the model. I suspect this is because the regex scripts only operate on actual chat content, and not the raw prompt.

regex script workaround attempt

(It was because of this workaround attempt that I discovered the bug in #965.)

Additional context

I'm going to use this space to give a few different ideas for where this toggle could be placed within the app.

1. Chat Settings > Advanced Parameters

a possible location for this option below Reasoning Effort within Advanced Parameters

This would be intuitive in a way, since it's near the related Reasoning Effort setting, but could be unintuitive since it's not really a model parameter in the same way that everything else in that section is.

2. Chat Settings > Context Limit

I mocked this one up a little nicer, since I could just duplicate the existing toggle's HTML.
a mock up of a second toggle under Context Limit called Exclude Past Reasoning

This location might make more sense, since it is also, in a way, limiting the type of context being sent to the model.

3. Presets > Sections > Chat History

the Chat History section of the Preset editor

This option probably makes the most sense from a system design perspective (this is where you would otherwise change how the prompt is composed), but is also the least discoverable (and most complicated for the user to change).

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 @thedarkness000 on GitHub (May 18, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/968 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? The most direct benefit to enabling this option would be a reduction in context length, resulting in faster processing (if running a local model) or reduced costs (if accessing a metered API endpoint). I propose this as an option for the end-user to select, since I can anticipate some users not caring about speed/cost if they perceive better quality/consistency by including all of the model's past reasoning in the prompt. A secondary benefit would be to reduce distractions to the model from past thoughts that may have been disregarded in its final output, or which are otherwise no longer valid. This one may be an artifact of the particular model I'm using (Gemma 4 26B A4B, running locally), but on a few occasions during RPs, the model has generated seemingly confusing or contradictory responses which can (at least based on my observations) be explained by it giving undue weight to its past reasoning content. That reasoning may no longer be valid due to events that have transpired in the RP since, or due to edits I've made to the model's response that invalidate said reasoning. ## Proposed solution Add a toggle to the **Chat Settings** (possibly under **Advanced Parameters**) to exclude past reasoning from prompts (or have the toggle be to _include_ past reasoning in prompts and have it enabled by default--whichever you think is better UX). (I did my best to search all the places in the app I could think of and could not find such an option, but freely admit that I could just be blind.) I don't have strong feelings on where this option ultimately ends up, so you can put it wherever you think it makes the most sense within the app. (I personally only care about being able to use this option in Roleplay mode, but I don't see why it couldn't also apply to a Conversation, for example.) ## Alternatives considered I attempted to achieve this through the use of a regex script with the pattern `, "reasoning_content": ".+?"(?=})` (based on the raw input I was seeing in KoboldCPP's terminal window). While it successfully stripped the reasoning content from the raw input I pasted into the Live Test box, it didn't seem to modify the actual input being sent to the model. I suspect this is because the regex scripts only operate on actual chat content, and not the raw prompt. <img width="728" alt="regex script workaround attempt" src="https://github.com/user-attachments/assets/1f5c2c1a-ff53-4121-87b5-5584cb3757c0" /> (It was because of this workaround attempt that I discovered the bug in #965.) ## Additional context I'm going to use this space to give a few different ideas for where this toggle could be placed within the app. ### 1. **Chat Settings** > **Advanced Parameters** <img height="362" alt="a possible location for this option below Reasoning Effort within Advanced Parameters" src="https://github.com/user-attachments/assets/2bf87884-2d88-4c3a-be4e-1a5a0b50c9f9" /> This would be intuitive in a way, since it's near the related **Reasoning Effort** setting, but could be unintuitive since it's not *really* a model parameter in the same way that everything else in that section is. ### 2. **Chat Settings** > **Context Limit** *I mocked this one up a little nicer, since I could just duplicate the existing toggle's HTML.* <img width="255" alt="a mock up of a second toggle under Context Limit called Exclude Past Reasoning" src="https://github.com/user-attachments/assets/972297af-ce8f-439a-b9b2-7628f962e911" /> This location might make more sense, since it is also, in a way, limiting the type of context being sent to the model. ### 3. **Presets** > **Sections** > **Chat History** <img height="384" alt="the Chat History section of the Preset editor" src="https://github.com/user-attachments/assets/1de52e88-4bb8-49d1-a295-ca15b14536fb" /> This option probably makes the most sense from a system design perspective (this is where you would otherwise change how the prompt is composed), but is also the least discoverable (and most complicated for the user to change). ## 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.
Author
Owner

@cha1latte commented on GitHub (May 18, 2026):

Triage note: labeling this as scope-risk because the request is aligned with prompt/context controls but the placement and ownership could cross chat settings, presets, and prompt assembly behavior.

The least risky next step is to decide where this control belongs before implementation, then build a narrow first slice around that surface.

<!-- gh-comment-id:4480647919 --> @cha1latte commented on GitHub (May 18, 2026): Triage note: labeling this as `scope-risk` because the request is aligned with prompt/context controls but the placement and ownership could cross chat settings, presets, and prompt assembly behavior. The least risky next step is to decide where this control belongs before implementation, then build a narrow first slice around that surface.
Author
Owner

@SpicyMarinara commented on GitHub (May 23, 2026):

We should naturally remove all past reasoning, so I'll add a general regex to do the cleanup.

<!-- gh-comment-id:4524786435 --> @SpicyMarinara commented on GitHub (May 23, 2026): We should naturally remove all past reasoning, so I'll add a general regex to do the cleanup.
Author
Owner

@SpicyMarinara commented on GitHub (May 23, 2026):

Implemented in the local fix pass.

What changed:

  • Added an Exclude Past Reasoning Chat Settings toggle under Context Limit.
  • The toggle is enabled by default so stored provider reasoning metadata, Gemini thought-signature parts, Chat Completions reasoning fields, and OpenAI Responses encrypted reasoning replay are not sent into future prompts unless the user opts back in.
  • Prompt preview/dry-run now mirrors the exclusion behavior.
  • CHANGELOG.md was updated.

Validation run:

  • pnpm --filter @marinara-engine/shared lint
  • pnpm --filter @marinara-engine/server lint
  • pnpm --filter @marinara-engine/client lint
<!-- gh-comment-id:4524873582 --> @SpicyMarinara commented on GitHub (May 23, 2026): Implemented in the local fix pass. What changed: - Added an `Exclude Past Reasoning` Chat Settings toggle under Context Limit. - The toggle is enabled by default so stored provider reasoning metadata, Gemini thought-signature parts, Chat Completions reasoning fields, and OpenAI Responses encrypted reasoning replay are not sent into future prompts unless the user opts back in. - Prompt preview/dry-run now mirrors the exclusion behavior. - CHANGELOG.md was updated. Validation run: - `pnpm --filter @marinara-engine/shared lint` - `pnpm --filter @marinara-engine/server lint` - `pnpm --filter @marinara-engine/client lint`
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#471
No description provided.