[GH-ISSUE #8375] [Feature]: Professor Mari: smaller write results and a cache-stable system prompt #8300

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

Originally created by @ylli-selmani on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8375

Originally assigned to: @ylli-selmani on GitHub.

What problem does this solve?

On a small-context model (12b, 16k), Professor Mari runs out of room partway through a task. The permanent prompt is large (~55k chars, ~13.8k tokens), but the faster drain is how much each tool turn adds. In one measured run (Gemma 4 31b), each turn added about 12k chars:

  • Write results echo unchanged data. changedFieldsOnly (workspace-agent.service.ts) compares fields only one level deep, so a description-only character.update returns the whole data.extensions object (where onboarding lives) whenever anything inside it changed. Mari hit the 32,000-char result cut this way. A create's result also echoes the card she just wrote.
  • Every new chat misses the prompt cache. The system message carries currentTime (to the millisecond), the connection line and the decisionAuthoring JSON in its environment block, before the skill index. Prompt caches match from the start, so everything after the first changing line is paid again on every new chat.

Proposed solution

  1. Make changedFieldsOnly diff nested objects all the way down (arrays compared whole), and check that readBack carries status and the changed fields, not whole rows.
  2. Move the changing lines (currentTime, connection, decisionAuthoring) to the very end of the system message, with decisionAuthoring described in words instead of raw JSON. The full time stays.
  3. Regressions pin both: a nested change returns only what changed, and the changing lines come last.

Alternatives considered

  • Cut the prompt text first. That's planned as a separate follow-up (about 4,400 chars of duplicated wording). It saves less per turn than the growth above and touches policy wording, so it gets its own PR and review.
  • Round currentTime to the date. That would be slightly more cache-stable, but she'd lose time-of-day awareness. Moving the line to the end is enough.

Additional context

The measurements come from captured request logs on an older staging head. A fresh static count on current staging goes into the PR. A live before/after on Gemma 31b and a 12b follows once the implementation is in.

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 @ylli-selmani on GitHub (Oct 26, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8375 Originally assigned to: @ylli-selmani on GitHub. ## What problem does this solve? On a small-context model (12b, 16k), Professor Mari runs out of room partway through a task. The permanent prompt is large (~55k chars, ~13.8k tokens), but the faster drain is how much each tool turn adds. In one measured run (Gemma 4 31b), each turn added about 12k chars: - **Write results echo unchanged data.** `changedFieldsOnly` (`workspace-agent.service.ts`) compares fields only one level deep, so a description-only `character.update` returns the whole `data.extensions` object (where onboarding lives) whenever anything inside it changed. Mari hit the 32,000-char result cut this way. A create's result also echoes the card she just wrote. - **Every new chat misses the prompt cache.** The system message carries `currentTime` (to the millisecond), the connection line and the `decisionAuthoring` JSON in its environment block, *before* the skill index. Prompt caches match from the start, so everything after the first changing line is paid again on every new chat. ## Proposed solution 1. Make `changedFieldsOnly` diff nested objects all the way down (arrays compared whole), and check that `readBack` carries status and the changed fields, not whole rows. 2. Move the changing lines (`currentTime`, connection, `decisionAuthoring`) to the very end of the system message, with `decisionAuthoring` described in words instead of raw JSON. The full time stays. 3. Regressions pin both: a nested change returns only what changed, and the changing lines come last. ## Alternatives considered - **Cut the prompt text first.** That's planned as a separate follow-up (about 4,400 chars of duplicated wording). It saves less per turn than the growth above and touches policy wording, so it gets its own PR and review. - **Round `currentTime` to the date.** That would be slightly more cache-stable, but she'd lose time-of-day awareness. Moving the line to the end is enough. ## Additional context The measurements come from captured request logs on an older staging head. A fresh static count on current staging goes into the PR. A live before/after on Gemma 31b and a 12b follows once the implementation is in. ## 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.
bsakaguchi 2026-11-07 16:42:16 +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#8300
No description provided.