mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1543] [Issue]: Long-Term Memory: a name starting with Char, or a relationship slug starting with rel_, gets a second memory #1515
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1515
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1543
Originally assigned to: @Promansis on GitHub.
Summary
A character whose name starts with "Char", such as "Char Aznable", gets the memory id
char_char_aznablefrom identity, because the id is alwayschar_plus the name. Identity then hands the extracted fact a subject id with the prefix removed once,char_aznable, and turning that back into a note id keeps it aschar_aznable, because it already starts withchar_. So the fact is saved tochar_aznable, a different memory from the one identity chose. Relationships whose first name starts with "Rel" go the same way (rel_rel_varga_sayla_massbecomesrel_varga_sayla_mass).What users see:
char_char_aznable, which the draft never creates.Affected package
long-term-memory1.4.72 (upstream/stagingbcaebd07d) with the #1534 fix (PR #1540, 1.4.73). Line numbers below are on that tree (refreshed 2026-10-21; first checked on8b72729f1).S=packages/long-term-memory/src/engine/packages/server/src/services/long-term-memoryExpected behavior
Facts about a character or relationship are saved to the memory identity chose for it, whatever the name's first word. Events about it keep their link.
Actual behavior
canonicalNoteIdForEntries(S/identity/subject-identity.ts:2542-2553) builds${prefix}_${slugs}, so "Char Aznable" ischar_char_aznable.subjectIdForTarget(:2555-2558) removeschar_orrel_once:char_aznable. It is called for every resolved unit (:1433) and for source-backed characters (:1356).noteIdForEvidenceUnit→prefixed()(S/extraction/evidence-unit-validation.ts:748-756,:767-769) keeps a subject id that already starts with the prefix, so the unit's note ischar_aznable.stripUnitSubjectPrefix,S/extraction/structured-summary-normalizer.ts:1774-1777, called at:328,:541,:566), so a value that survived identity still loses the word there.resolveIdentityLinkTarget(S/identity/subject-identity.ts:2496-2515) resolves anaffects_characterlink to the chosen memory, or tocanonicalNoteIdForEntrieswhen there is none yet (:2514):char_char_aznable.linkTargetDiagnostics(S/extraction/evidence-unit-validation.ts:676-697) then drops the event withunknown_link_targetanddetails.linkTarget: "char_char_aznable".subject_identity_normalizedwithoriginalNoteId: "char_aznable"andtargetNoteId: "char_char_aznable", while the draft createschar_aznable.char_char_marabound to Mara (for example from an import) gets its facts split into a newchar_mara; a boundrel_rel_ana_bogets a newrel_ana_bo.char_maraeither way.Steps to reproduce
char_aznableand an event linked to it withaffects_character.char_aznable, notchar_char_aznable, and the event is dropped asunknown_link_targetwithlinkTarget: "char_char_aznable".char_char_aznablealready in the vault and bound to Char Aznable, the same extraction proposes a new memorychar_aznableinstead of appending to it.Minimal fix
One PR, patch bump. Three source files, no new file.
unprefixedSubjectId(prefix, id)besideprefixed()inS/extraction/evidence-unit-validation.ts: remove the prefix, unless what is left starts with the prefix again, soprefixed()maps the result back to the same note.subjectIdForTarget, and in the normalizer's branches that handle identity's output, for units withsubjects: the character branch (:328,:566) and the relationship branch (:541). The relationship branch keeps looking summary hints up with the id stripped once, so a summary's relationship dimensions still apply.char_char_maranow receives Mara's facts instead of a newchar_mara. That is an improvement, but it changes identity behaviour on existing vaults. For every other chosen id the helper returns what the one-time strip returned, so those ids do not change.## Unreleased: "Extraction now saves facts about a character whose name starts with "Char", such as "Char Aznable", or a relationship whose first name starts with "Rel", to the memory chosen for them."Not included
stripNotePrefix,subjectSlugFromNote): they pair withcanonicalNoteIdForEntriesand choose the same memory today; ids are never written from them.aznable), so it adds a copy of the fact that identity drops as untrusted. That is the same before and after; separate issue if wanted.character: Char Aznable/section: profilehint asaznable. Today it only matches because the fact goes to the wrong memorychar_aznable; with the fix the fact goes tochar_char_aznableand takes its section from the text instead. Same follow-up as the line above.Regression proof
In
tests/long-term-memory-extraction-graph.regression.ts, before the event-shaped review case: runprocessLongTermMemorySourcewith a roster of Char Aznable, Rel Varga, Sayla Mass and Mara and fixture model units (char_aznable,rel_varga_sayla_mass,mara, and an event linked tochar_aznablewithaffects_character).char_char_aznable,char_maraandrel_rel_varga_sayla_mass, nothing is dropped, and the event links tochar_char_aznable. It fails today:char_aznableandrel_varga_sayla_mass.char_char_aznableandrel_rel_varga_sayla_mass, structured summary whose relationship section carriesrelationship_id: rel_varga_sayla_massanddimensions: trust 80, and no relationship unit from the model (the summary line supplies it): onlychar_marais created, the two existing memories are updated, and the relationship update carriestrust: 80.Environment
staging87d1ccadc)upstream/stagingbcaebd07dwith the #1534 fix, PR #1540)processLongTermMemorySource)Logs, screenshots, or video
None. The reproduction uses fixture names, not user data.
Additional context
Tracker item OT-4. Found while fixing the recovery subjectId issue (#1534), which has landed.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: