[PR #1798] [MERGED] feature(long-term-memory): chat pieces see the previous piece's tail, events and threads (1.5.5) #1971

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1798
Author: @Promansis
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @Promansis

Base: staging ← Head: feature(long-term-memory)/chat-piece-context-tail


📝 Commits (6)

  • 50e5147 feature(long-term-memory): give each chat piece the previous piece's tail, events and threads (#1782)
  • 566da4a Merge upstream/staging into feature(long-term-memory)/chat-piece-context-tail; release long-term-memory 1.5.5
  • be2010b fix(long-term-memory): list a continued thread's whole text to the model (#1782)
  • 88e9512 Merge branch 'staging' into feature(long-term-memory)/chat-piece-context-tail
  • 63f6458 Merge remote-tracking branch 'origin/feature(long-term-memory)/chat-piece-context-tail' into feature(long-term-memory)/chat-piece-context-tail
  • 7ac46f6 Merge branch 'staging' into feature(long-term-memory)/chat-piece-context-tail

📊 Changes

16 files changed (+548 additions, -233 deletions)

View changed files

➕ artifacts/long-term-memory-1.5.5.zip (+0 -0)
📝 catalog/catalog.json (+6 -6)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+6 -6)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+6 -6)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+4 -0)
📝 packages/long-term-memory/manifest.json (+3 -3)
📝 packages/long-term-memory/server.mjs (+48 -47)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-extraction.ts (+35 -4)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/source-extraction.ts (+15 -1)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/source-processing.ts (+217 -138)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/sources/interop.ts (+12 -0)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-chat-transcript-import.regression.ts (+177 -3)

📄 Description

Pull request

Linked issue

Closes #1782

Why this change

  • A long chat imported from Chat Messages is cut into pieces, and each piece was extracted blind: the model never saw where the previous piece ended, so a cause or an open thread that crossed a cut was lost or duplicated.
  • From the second piece of a chat on, the extraction prompt now carries the end of the previous piece, its timeline events and its open threads, as context only.

What changed

Affected package: long-term-memory 1.5.4 → 1.5.5 (rebuilt server.mjs, manifest, artifact zip, catalog lanes).

processLongTermMemorySourceBatch
  prepare: one chain per chat, pieces in order; chats still run in parallel
    previousPieceContext(previous piece)      # new: tail ~3,000 chars, events {id,title}, threads {id,subjectId,title,text}
    extractEvidenceUnits(... previousPiece)   # listed event ids accepted as caused_by/triggered_by; listed thread subjectId updates that thread
  commit: unchanged (ordered, one vault lock, shared overlay)
  • First piece of a chat and every non-chat source keep a byte-identical prompt; links to unlisted ids are still rejected.
  • Auto-apply leaves a draft for review instead of failing the piece when a continued thread is rewritten beside other changes, or when it names a note only the previous piece's unapplied draft creates.
  • Regression: tests/long-term-memory-chat-transcript-import.regression.ts covers the listing, a link to a listed event, a rejected unlisted link, and a continued thread.
  • Known limit (ponytail: comments): listed events and threads are uncapped; the relation limit is stated in the prompt only.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none; manifest range unchanged
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none. Stored note ids, fingerprints and sourceNoteId are unchanged, so re-imports behave as before.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

Merge Danger

Door: two-way. Revert and reland; no stored format changes.

Blast Radius: chat-messages import only. Pieces of one chat now prepare one after another, so a long chat imports more slowly than before; chats still run side by side.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/1798 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `feature(long-term-memory)/chat-piece-context-tail` --- ### 📝 Commits (6) - [`50e5147`](https://github.com/Pasta-Devs/Marinara-Agents/commit/50e5147fc2fd1cef55ed564ac1307d91870e9ef3) feature(long-term-memory): give each chat piece the previous piece's tail, events and threads (#1782) - [`566da4a`](https://github.com/Pasta-Devs/Marinara-Agents/commit/566da4a8babad826e71035e0038f69b0b915a930) Merge upstream/staging into feature(long-term-memory)/chat-piece-context-tail; release long-term-memory 1.5.5 - [`be2010b`](https://github.com/Pasta-Devs/Marinara-Agents/commit/be2010b14ec7d3cf6fa5cac19b31ace68fb0a41a) fix(long-term-memory): list a continued thread's whole text to the model (#1782) - [`88e9512`](https://github.com/Pasta-Devs/Marinara-Agents/commit/88e95123817cc290d5429d839889b15eb6bed540) Merge branch 'staging' into feature(long-term-memory)/chat-piece-context-tail - [`63f6458`](https://github.com/Pasta-Devs/Marinara-Agents/commit/63f6458bd7910024af89a0e76703f8ae895113cb) Merge remote-tracking branch 'origin/feature(long-term-memory)/chat-piece-context-tail' into feature(long-term-memory)/chat-piece-context-tail - [`7ac46f6`](https://github.com/Pasta-Devs/Marinara-Agents/commit/7ac46f676958b817f040e7101e45dcb072921bcb) Merge branch 'staging' into feature(long-term-memory)/chat-piece-context-tail ### 📊 Changes **16 files changed** (+548 additions, -233 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.5.5.zip` (+0 -0) 📝 `catalog/catalog.json` (+6 -6) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+6 -6) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+6 -6) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+4 -0) 📝 `packages/long-term-memory/manifest.json` (+3 -3) 📝 `packages/long-term-memory/server.mjs` (+48 -47) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/evidence-unit-extraction.ts` (+35 -4) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/source-extraction.ts` (+15 -1) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/source-processing.ts` (+217 -138) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/sources/interop.ts` (+12 -0) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-chat-transcript-import.regression.ts` (+177 -3) </details> ### 📄 Description # Pull request ## Linked issue Closes #1782 ## Why this change - A long chat imported from Chat Messages is cut into pieces, and each piece was extracted blind: the model never saw where the previous piece ended, so a cause or an open thread that crossed a cut was lost or duplicated. - From the second piece of a chat on, the extraction prompt now carries the end of the previous piece, its timeline events and its open threads, as context only. ## What changed Affected package: `long-term-memory` 1.5.4 → 1.5.5 (rebuilt `server.mjs`, manifest, artifact zip, catalog lanes). ```text processLongTermMemorySourceBatch prepare: one chain per chat, pieces in order; chats still run in parallel previousPieceContext(previous piece) # new: tail ~3,000 chars, events {id,title}, threads {id,subjectId,title,text} extractEvidenceUnits(... previousPiece) # listed event ids accepted as caused_by/triggered_by; listed thread subjectId updates that thread commit: unchanged (ordered, one vault lock, shared overlay) ``` - First piece of a chat and every non-chat source keep a byte-identical prompt; links to unlisted ids are still rejected. - Auto-apply leaves a draft for review instead of failing the piece when a continued thread is rewritten beside other changes, or when it names a note only the previous piece's unapplied draft creates. - Regression: `tests/long-term-memory-chat-transcript-import.regression.ts` covers the listing, a link to a listed event, a rejected unlisted link, and a continued thread. - Known limit (`ponytail:` comments): listed events and threads are uncapped; the relation limit is stated in the prompt only. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none; manifest range unchanged - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none. Stored note ids, fingerprints and `sourceNoteId` are unchanged, so re-imports behave as before. ## Validation - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - ## Merge Danger **Door:** two-way. Revert and reland; no stored format changes. **Blast Radius:** chat-messages import only. Pieces of one chat now prepare one after another, so a long chat imports more slowly than before; chats still run side by side. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:38:25 +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-Agents#1971
No description provided.