[GH-ISSUE #585] [Feature]: Add /hide and /unhide slash commands for bulk AI context control #270

Closed
opened 2026-10-20 17:27:00 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kevin-ho on GitHub (May 9, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/585

What problem does this solve?

Users in long roleplay conversations (200+ messages) often want to exclude large stretches of messages from the AI's context window — e.g., hiding old plot arcs, out-of-character exchanges, or redundant messages — to free up token budget for what matters. Currently, the hiddenFromAI flag can only be toggled one message at a time via the UI eye icon, making it impractical to manage context at scale.

Proposed solution

Add two client-side slash commands — /hide and /unhide — that set or clear the hiddenFromAI flag on multiple messages in a single operation.

Syntax: Supports single indices, ranges, comma-separated lists, and any combination:

  • /hide 5 — hide message 5
  • /hide 3-8 — hide messages 3 through 8
  • /hide 2,5,9 — hide messages 2, 5, and 9
  • /hide 2-5,8,12-14 — mixed ranges and singles

Implementation:

  • Client: Parse index expressions, collect message IDs, call a single bulk endpoint
  • Server: New PATCH /:chatId/messages/bulk-hidden endpoint that loops the existing updateMessageExtra() per message (same proven code path as the single-message UI toggle, including swipe sync)
  • No new database columns or migrations required — reuses the existing hiddenFromAI flag in the message extra JSON

Alternatives considered

  • Individual PATCH per message from the client (chunked in parallel): works but creates 200+ HTTP requests for long conversations, slow and noisy
  • Raw SQL json_set() with IN clause: avoids the per-message loop but bypasses the withPatchQueue serialization guard and the swipe-sync logic in updateMessageExtra; the loop approach is simpler and functionally identical to what the UI already does

Additional context

The feature leverages existing infrastructure:

  • hiddenFromAI flag already exists in message extra metadata
  • PATCH /chats/:chatId/messages/:messageId/extra already handles single-message toggle with swipe sync
  • isMessageHiddenFromAI() already filters hidden messages during prompt assembly in generate.routes.ts

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 @kevin-ho on GitHub (May 9, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/585 ## What problem does this solve? Users in long roleplay conversations (200+ messages) often want to exclude large stretches of messages from the AI's context window — e.g., hiding old plot arcs, out-of-character exchanges, or redundant messages — to free up token budget for what matters. Currently, the `hiddenFromAI` flag can only be toggled one message at a time via the UI eye icon, making it impractical to manage context at scale. ## Proposed solution Add two client-side slash commands — `/hide` and `/unhide` — that set or clear the `hiddenFromAI` flag on multiple messages in a single operation. **Syntax:** Supports single indices, ranges, comma-separated lists, and any combination: - `/hide 5` — hide message 5 - `/hide 3-8` — hide messages 3 through 8 - `/hide 2,5,9` — hide messages 2, 5, and 9 - `/hide 2-5,8,12-14` — mixed ranges and singles **Implementation:** - Client: Parse index expressions, collect message IDs, call a single bulk endpoint - Server: New `PATCH /:chatId/messages/bulk-hidden` endpoint that loops the existing `updateMessageExtra()` per message (same proven code path as the single-message UI toggle, including swipe sync) - No new database columns or migrations required — reuses the existing `hiddenFromAI` flag in the message `extra` JSON ## Alternatives considered - Individual PATCH per message from the client (chunked in parallel): works but creates 200+ HTTP requests for long conversations, slow and noisy - Raw SQL `json_set()` with `IN` clause: avoids the per-message loop but bypasses the `withPatchQueue` serialization guard and the swipe-sync logic in `updateMessageExtra`; the loop approach is simpler and functionally identical to what the UI already does ## Additional context The feature leverages existing infrastructure: - `hiddenFromAI` flag already exists in message `extra` metadata - `PATCH /chats/:chatId/messages/:messageId/extra` already handles single-message toggle with swipe sync - `isMessageHiddenFromAI()` already filters hidden messages during prompt assembly in `generate.routes.ts` ## 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#270
No description provided.