[GH-ISSUE #2039] [Issue]: Otome Hearth context management doesn't follow the Gacha Forge memory rules #1885

Closed
opened 2026-11-07 16:37:25 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @SpicyMarinara on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/2039

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

Otome Hearth's story memory is automatic and runs in the background. It uses the same forge-kit memory core as Gacha Forge: summaries, overview, recall ranking with the 3 + 3 caps, audience, first canon stays canon, and the knowledge boundary. Its context management doesn't follow the Gacha Forge design rules, though. A code audit on staging (Otome 0.6.16) found these gaps:

  1. Private canon is never summarized. Route, repair, date and Character Story chapters are the kit's chat kind, so they are stored word for word (sources/forge-kit/story-memory.mjs ~548-551). A prompt sees that love interest's newest private chapters in full, up to 12,000 tokens. Older ones come back only as recalled details, and only if a whole chapter fits the recall budget (10% of context + 2,000). A long route soon keeps only its last chapter or two plus its big choices. story/canon.ts:37-39 admits this.
  2. No context fitting like Gacha Forge's fitForgeMemoryPrompt.
    • Otome uses fixed 12,000-token caps: the latest chapter keeps its last 12k tokens and earlier canon gets 12k. That cuts text even when the prompt would fit. Gacha Forge sends the previous chapter in full.
    • It then relies on the Engine's generic fitContext. On overflow, that shrinks the reply first (down to 128 tokens), then cuts the end of the system message, which holds the writing rules and JSON shape, before it touches any memory.
    • The 8,192-token reply floor is not held, and there is no clear capacity error. A cut-off reply fails as bad-format after one repair turn.
  3. The "# Recent canon" summaries have no cap and never yield (story/canon.ts ~459-467). They grow when the overview keeps failing or no longer fits a smaller-context reader.
  4. Memory failures are invisible. Status and Retry live only in Settings → Debug. A broken compress model quietly leaves the story on the bounded fallback.
  5. Minor: the "Close and remember" phone memory runs in the run's serial queue, so it can wait behind a lookahead beat. Also, a stale comment in memory/memory.ts:108-109 says changed sources get re-summarized.

Expected (Gacha Forge rules)

  • Recall is the overview, up to 3 recalled chapter summaries (plus up to 3 side memories), the last chapter in full, and the current chapter.
  • Summaries run in the background and never block generation.
  • Prompts that already fit never change. On overflow, recalled details yield first. Then, at the 8,192 reply floor, older uncovered summaries yield, oldest first. The newest summary, the previous chapter, the current chapter and locked decisions are never dropped. If it still can't fit, the request reports a clear capacity error instead of being sent anyway.
  • Private canon stays private to its love interest and out of the shared overview, but is summarized so long routes keep their history.

Package

otome-forge (Otome Hearth)

Originally created by @SpicyMarinara on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/2039 Originally assigned to: @SpicyMarinara on GitHub. ### What's wrong Otome Hearth's story memory is automatic and runs in the background. It uses the same forge-kit memory core as Gacha Forge: summaries, overview, recall ranking with the 3 + 3 caps, audience, first canon stays canon, and the knowledge boundary. Its context management doesn't follow the Gacha Forge design rules, though. A code audit on staging (Otome 0.6.16) found these gaps: 1. **Private canon is never summarized.** Route, repair, date and Character Story chapters are the kit's `chat` kind, so they are stored word for word (`sources/forge-kit/story-memory.mjs` ~548-551). A prompt sees that love interest's newest private chapters in full, up to 12,000 tokens. Older ones come back only as recalled details, and only if a whole chapter fits the recall budget (10% of context + 2,000). A long route soon keeps only its last chapter or two plus its big choices. `story/canon.ts:37-39` admits this. 2. **No context fitting like Gacha Forge's `fitForgeMemoryPrompt`.** - Otome uses fixed 12,000-token caps: the latest chapter keeps its last 12k tokens and earlier canon gets 12k. That cuts text even when the prompt would fit. Gacha Forge sends the previous chapter in full. - It then relies on the Engine's generic `fitContext`. On overflow, that shrinks the reply first (down to 128 tokens), then cuts the end of the system message, which holds the writing rules and JSON shape, before it touches any memory. - The 8,192-token reply floor is not held, and there is no clear capacity error. A cut-off reply fails as `bad-format` after one repair turn. 3. **The "# Recent canon" summaries have no cap and never yield** (`story/canon.ts` ~459-467). They grow when the overview keeps failing or no longer fits a smaller-context reader. 4. **Memory failures are invisible.** Status and Retry live only in Settings → Debug. A broken compress model quietly leaves the story on the bounded fallback. 5. Minor: the "Close and remember" phone memory runs in the run's serial queue, so it can wait behind a lookahead beat. Also, a stale comment in `memory/memory.ts:108-109` says changed sources get re-summarized. ### Expected (Gacha Forge rules) - Recall is the overview, up to 3 recalled chapter summaries (plus up to 3 side memories), the last chapter in full, and the current chapter. - Summaries run in the background and never block generation. - Prompts that already fit never change. On overflow, recalled details yield first. Then, at the 8,192 reply floor, older uncovered summaries yield, oldest first. The newest summary, the previous chapter, the current chapter and locked decisions are never dropped. If it still can't fit, the request reports a clear capacity error instead of being sent anyway. - Private canon stays private to its love interest and out of the shared overview, but is summarized so long routes keep their history. ### Package otome-forge (Otome Hearth)
Author
Owner

@SpicyMarinara commented on GitHub (Nov 1, 2026):

The maintainer restated the target for Otome Hearth, which matches Gacha Forge (roleplay-mode memory):

  • A constant summary of the whole timeline and everything that has happened so far, always included.
  • Chapter summaries. Every chapter before the last is summarized, including route, repair, date and Character Story chapters.
  • Smaller recalls of the most relevant chapter summaries, instead of exact text.
  • The last chapter, always in full.

So route, repair, date and Character Story chapters will be handled like Gacha Forge's Character Stories:

  • they are summarized and folded into the constant overview;
  • detailed recall of them stays with that love interest;
  • the knowledge boundary keeps other love interests from claiming they were there.

Phone sessions, Snapshots, Read Him and Claw rounds stay private to their love interest, like Gacha Forge's chats.

<!-- gh-comment-id:6564916640 --> @SpicyMarinara commented on GitHub (Nov 1, 2026): The maintainer restated the target for Otome Hearth, which matches Gacha Forge (roleplay-mode memory): - **A constant summary** of the whole timeline and everything that has happened so far, always included. - **Chapter summaries.** Every chapter before the last is summarized, including route, repair, date and Character Story chapters. - **Smaller recalls** of the most relevant chapter summaries, instead of exact text. - **The last chapter, always in full.** So route, repair, date and Character Story chapters will be handled like Gacha Forge's Character Stories: - they are summarized and folded into the constant overview; - detailed recall of them stays with that love interest; - the knowledge boundary keeps other love interests from claiming they were there. Phone sessions, Snapshots, Read Him and Claw rounds stay private to their love interest, like Gacha Forge's chats.
Author
Owner

@SpicyMarinara commented on GitHub (Nov 1, 2026):

Two more points from the maintainer:

  • Smaller recalls are the side memories (Gacha Forge allows up to 3 on top of the 3 chapter recalls): what the love interest learned in Read Me and Read Him, stories played from banners, dates, phone sessions, Snapshots and Claw rounds. Read Me isn't a memory source today. It will be recalled from the live notebook, so an entry the player deletes never comes back.
  • The last chapter carries only the path that was played: the choices the player picked and their branches, never the alternative dialogue they didn't pick. The current code already works this way (canonicalSegments and the kit's forgeCanonicalSegments, the Confrontation rounds and the decisions block). A regression test will keep it that way.
<!-- gh-comment-id:6564974368 --> @SpicyMarinara commented on GitHub (Nov 1, 2026): Two more points from the maintainer: - **Smaller recalls** are the side memories (Gacha Forge allows up to 3 on top of the 3 chapter recalls): what the love interest learned in Read Me and Read Him, stories played from banners, dates, phone sessions, Snapshots and Claw rounds. Read Me isn't a memory source today. It will be recalled from the live notebook, so an entry the player deletes never comes back. - **The last chapter carries only the path that was played**: the choices the player picked and their branches, never the alternative dialogue they didn't pick. The current code already works this way (`canonicalSegments` and the kit's `forgeCanonicalSegments`, the Confrontation rounds and the decisions block). A regression test will keep it that way.
Author
Owner

@SpicyMarinara commented on GitHub (Nov 1, 2026):

One more requirement from the maintainer: the fix must also apply to stories already in progress. After updating, a run saved by 0.6.16 or earlier gets the full new behaviour with no player action:

  • private chapters stored word for word get their summaries in the background;
  • the overview is rebuilt to cover every chapter the new rules include;
  • Read Me learnings are recalled;
  • the new context fitting applies.

None of it blocks play. First canon stays canon: chapter text is never rewritten. Only the missing summaries are added and the overview is rebuilt. A regression test will load a memory document saved by 0.6.16 and prove it catches up. Follow-ups: #2040 (What happened so far… while forging) and #2041 (Who said what? while a scene loads).

<!-- gh-comment-id:6565069242 --> @SpicyMarinara commented on GitHub (Nov 1, 2026): One more requirement from the maintainer: the fix must also apply to **stories already in progress**. After updating, a run saved by 0.6.16 or earlier gets the full new behaviour with no player action: - private chapters stored word for word get their summaries in the background; - the overview is rebuilt to cover every chapter the new rules include; - Read Me learnings are recalled; - the new context fitting applies. None of it blocks play. First canon stays canon: chapter text is never rewritten. Only the missing summaries are added and the overview is rebuilt. A regression test will load a memory document saved by 0.6.16 and prove it catches up. Follow-ups: #2040 (What happened so far… while forging) and #2041 (Who said what? while a scene loads).
Author
Owner

@SpicyMarinara commented on GitHub (Nov 2, 2026):

Fixed by #2042 (Otome Hearth 0.6.17), merged into staging.

<!-- gh-comment-id:6568073980 --> @SpicyMarinara commented on GitHub (Nov 2, 2026): Fixed by #2042 (Otome Hearth 0.6.17), merged into staging.
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-Agents#1885
No description provided.