[GH-ISSUE #1512] [Issue]: Long-Term Memory: extraction requests repeat the link rules and ask the model for values the server sets #1499

Closed
opened 2026-10-22 04:02:43 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1512

Originally assigned to: @Promansis on GitHub.

Summary

Every extraction request repeats itself and asks the model for values the server sets anyway:

  • The link rules go out three times verbatim: in the system prompt, in the user validationRules, and again inside targetNoteRules. The mode prompts restate them on top of that.
  • Every prompt asks the model to copy sourceHash and the source evidence, which the server then overwrites or fills in.
  • The request carries keys no rule reads, including the scope's chat, character and persona ids.

Removing this makes each request about 3,100 characters (about 775 tokens) shorter. In a live test with Claude Haiku 5.5 it also cut the answer by about a fifth per unit (233 to 184 visible tokens, mean of five and six runs). Today 17–19% of Haiku's answer text is copied sourceHash and evidence, and 3–8 of 15 answers (6 on average) run past the 8,192-token default output cap. After the change, 2–3 do.

On Claude Sonnet 5.5 the change passed the quality rule set in advance. On Haiku the final wording first missed that rule narrowly, judged against only two runs of today's code. A re-check with three fresh runs of each, under a rule written before it ran, passed. One signal is left for the PR. Haiku drops more units for an unknown character (29 against 24 per run on average), and the harness can't check names against the Engine's character list (see the open questions).

It also fixes three contract problems:

  • An empty evidence list, a blank title or a null optional field drops the whole unit (F6).
  • A model that cannot use the JSON schema never sees the link object shape or the full relation list (F5 g).
  • The "changed because of" rule does not say that the event must be in the same answer (EX-I11). No live run hit this, but the vault's earlier drafts lost six units to it.

A broader world-note line was also measured on top of this change. It failed its pre-set rule on both models, so it is not part of this issue, and EX-I10 stays the path for world-note splitting (see "Broader world-note wording" below).

Affected package

long-term-memory 1.4.55 (upstream/staging 8b72729f1). Line references are at that commit.

S = packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory
SH = packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory

Expected behavior

  • Each server-enforced link rule appears once in the request.
  • The request does not ask for values the server owns (sourceHash, evidence), and it does not send keys no rule uses, or scope ids.
  • A unit whose only defect is an empty or null optional field (evidence: [], title: "", dimensions: null) is kept.
  • A request without response_format still tells the model the link object shape and the allowed relations.

Actual behavior

  • Three copies of the link rules. serverEnforcedLinkPrompt puts them in the system message (S/extraction/evidence-unit-extraction.ts:1193). They come back in the user JSON as validationRules (:1274), and a third time inside targetNoteRules (:1294). The roleplay prompt restates them again (SH/constants.ts:79-81), and so do the core rules (:49).
  • Values the server owns. Every mode prompt tells the model to copy sourceHash and the source evidence (SH/constants.ts:71, :158, :163, :211, :217). The user JSON sends both too, as unitFields.evidence, sourceNote.evidence, sourceNote.sourceHash and requiredEvidence (:1243, :1280-1284). normalizedEvidenceUnitRecord then overwrites sourceHash (:669) and fills in evidence when it is missing (:670).
  • Keys no rule reads. These are allowedStatuses, allowedImportance, streamAllowedStatuses, streamScanOrder and modes. The scope also goes out twice, as sourceNote.scope and scope, which carry chat, group, character and persona ids.
  • No link shape without a schema. allowedTimelineRelations (:1262) names 9 of the 12 relations and leaves out extracted_from, which every event needs. A provider that ignores response_format sees no link object shape anywhere. Among the Engine's providers, only openai, google and the local sidecar send the schema.
  • F6. The provider schema rejects the whole unit for evidence: [] (minimum 1), for title: "", and for null in any optional field.

Measurement

Method:

  • Pipeline. All 15 sources of a private vault copy (14 roleplay, 1 conversation) ran through the real preparation path, prepareLongTermMemorySource. That covers the catalog, recall window, provider call, parse, identity, reconciliation and compile. Nothing was applied, and package-default extraction settings were used.
  • Models. claude-haiku-5-5 and claude-sonnet-5-5 through claude -p, effort low, with no response schema, like the Engine's Anthropic providers.
  • Runs. Today's code ran twice per model to show the run-to-run spread. A Haiku re-check added three fresh runs of today's code and three of the fix.
  • Pass rule. It was written before any call: no more errors or rejections than the worse of today's two runs, kept units at least 90% of the lower one, and no more link-caused drops.
  • Data shared. Only aggregate counts are shared.

Request size (deterministic): the proposed request is 2,862–3,466 characters shorter per source (mean 3,097, about 775 tokens). That is 15–25% of the text that is not the source, and 9–15% of the whole request. Each link rule appears once, and sourceHash and requiredEvidence are gone.

Haiku (claude-haiku-5-5), 15 sources per run. reduced was fixed in advance; reduced2 and reduced3 were shaped after seeing results (exploratory). reduced3 is the fix proposed below.

today a today b reduced reduced2 a reduced2 b reduced3 a reduced3 b reduced3 c
Answers that could not be used 0 0 2 0 0 0 1 0
Parser rejections 0 0 46 0 40 0 0 0
Validation rejections 28 30 22 29 33 34 26 31
… of which untrusted subject (no roster in the harness) 24 23 20 25 19 28 22 27
Kept units 506 518 353 513 481 512 485 496
Link-caused drops 4 7 2 4 14 6 4 4
Units missing sectionKey 0 0 23 0 40 0 0 0
Visible output tokens per unit 229 238 214 174 177 179 197 180
Answers over 8,192 visible tokens 6 6 2 2 2 3 3 2
Answer text spent on sourceHash / evidence 17% 19% 0% 0% 0% 0% 0% 0%

Sonnet (claude-sonnet-5-5), 15 sources per run:

today a today b reduced reduced2 reduced3
Answers that could not be used 0 0 0 0 0
Parser rejections 0 0 0 0 0
Validation rejections 29 31 31 31 30
Kept units 460 501 486 491 486
Link-caused drops 4 5 5 2 4
Visible output tokens per unit 217 184 178 174 186
Answers over 8,192 visible tokens 4 3 3 3 3
Answer text spent on sourceHash / evidence 12% 3% 0% 0% 0%

What the variants taught:

  • reduced (fixed in advance) passes on Sonnet and fails on Haiku.
    • Its return line said "Return only the JSON object described by responseContract and unitFields". Haiku twice wrapped the whole answer in {"responseContract": …}, and one of those also lacked its closing brace.
    • One answer sent null for optional fields on 17 units.
    • One answer left out sectionKey on whole streams.
  • reduced2 names the top-level keys instead and treats null as absent. Run a passes, but run b lost sectionKey on whole streams in two answers. Each time, these were the streams that the new "omit subjectNames" wording told to drop the field next to sectionKey; today's wording (all other streams: []) never lost it in 1,005 Haiku units.
  • reduced3 keeps today's subjectNames wording. No unit lost sectionKey and no answer was wrapped in 45 Haiku and 15 Sonnet answers. It passes on Sonnet. On Haiku it misses the strict rule narrowly in all three runs:
    • Runs a and c have 34 and 31 rejections against a limit of 30. The whole excess is untrusted-subject drops (28 and 27 against 24 and 23 today). The harness inflates that count because it cannot read the Engine roster, and two runs of today's code give only a narrow band.
    • Run b had one unusable answer, from a stray quote in the JSON (…],"},{…). Today's code had none in 45 Haiku answers.

Kept units and link-caused drops are inside the rule in all three Haiku runs.

Haiku re-check. Three fresh runs of today's code against three of reduced3. The rule was written before the runs (private pass-rules file, "Haiku re-check"): no more than one extra unusable answer in total, and on average no more rejections or link-caused drops than the worst run of today's code, with kept units at least 90% of its lowest run. Unknown-character drops are counted separately, because the harness has no character list. It passes every rule.

today r1 today r2 today r3 reduced3 r1 reduced3 r2 reduced3 r3
Answers that could not be used 0 0 0 0 0 0
Parser rejections 1 0 0 1 1 0
Validation rejections, not counting unknown characters 5 6 1 3 4 3
Unknown-character drops (not scored) 23 29 22 33 40 22
Kept units 515 513 494 489 511 502
Link-caused drops 5 6 1 3 4 3
Units missing sectionKey 0 0 0 0 0 0
Visible output tokens per unit 235 245 219 181 183 184
Answers over 8,192 visible tokens 7 8 3 3 2 3

Across all runs of the same prompt (five of today's code, six of reduced3), Haiku drops 24.2 units per run for an unknown character with today's code and 28.7 with the fix. The spread is wide (22–40 with the fix, 22–29 today). The harness can't tell whether those names would resolve against a real install's characters.

Limits:

  • These are Claude models only, not every provider people use.
  • claude -p adds about 640 tokens of Claude Code preamble, and it cannot set temperature or an output cap. The table counts visible tokens against the cap.
  • The schema path (openai, google, local sidecar) was not exercised. One conversation source, no game sources.
  • These are re-extractions of sources the vault already holds.

Steps to reproduce

  1. Turn on debug logging and extract any chat summary source in Roleplay mode.
  2. Read the logged evidence_unit_request prompt. "Every link target must resolve" appears three times, and both requiredEvidence and sourceNote.evidence are present with the same list.
  3. Feed parseEvidenceUnitPayload a unit with evidence: [] or title: "". It is dropped as invalid_format.

Minimal fix

One PR, patch bump. This is the reduced3 variant measured above, except where noted.

S/extraction/evidence-unit-extraction.ts

  • serverEnforcedLinkRules (:85-100): this stays the only place the link rules are stated. The system prompt carries them through serverEnforcedLinkPrompt (:1193). For EX-I11, rule 2 (:88) becomes: 'Every non-timeline unit with claimKind "change" must link to a timeline_event unit in this same response; if that event is not in the response yet, add it. Static units …'. The rest of the line stays.
  • evidenceUnitMessages (:1164), user JSON:
    • Remove validationRules (:1274) and ...validationRules inside targetNoteRules (:1294). These are the second and third copies of the link rules.
    • Remove allowedStatuses (:1255), allowedImportance (:1256; the importance values are already listed in unitFields.importance), streamAllowedStatuses and streamScanOrder (:1258-1261).
    • Replace allowedTimelineRelations (:1262-1272) with allowedLinkRelations: LTM_EXTRACTION_LINK_RELATIONS (:57). The response schema already allows all twelve relations at :500. The old list named nine of them and left out extracted_from, which every event must use.
    • Trim sourceNote to id and title. Remove its status, tags, scope, evidence and sourceHash (:1278-1282), and the top-level requiredEvidence, scope and modes (:1284-1286). The chat, character and persona ids no longer go to the provider.
    • In unitFields:
      • remove evidence (:1243);
      • keep subjectNames (:1234) as it is (all other streams: []). Telling Haiku to omit the field made it drop the neighbouring sectionKey for whole streams in 3 of 45 answers (63 units);
      • status (:1246) becomes '"active"; only thread units may use "resolved", when the open loop is closed';
      • links (:1248) becomes 'array of {"target": note id, "relation": one allowedLinkRelations value}; real links only, otherwise []'. This gives providers without response_format the link shape (F5 g).
    • Delete filteredScanOrder (:1166) and LTM_EXTRACTION_BUCKET_SCAN_ORDER (:46). Nothing else uses them.
  • evidenceUnitResponseFormat (:426-528): remove the evidence property (:475) and the two link descriptions that restate the rule (:487, :498). Keep subjectNames in required (:460). The live test never exercised the schema path, so the token saving there is not worth an untested risk to character facts (see open questions).
  • normalizedEvidenceUnitRecord (:617) (F6):
    • At :624, build record without null-valued keys. No field in ltmEvidenceUnitSchema is nullable, so a null only ever turns an optional field into a rejection.
    • Return title: undefined for a blank title.
    • At :670, set evidence to the trusted list whenever one exists, instead of only when the field is missing. The harness merged trusted and provider strings, but no measured answer sent evidence, so the simpler rule behaves the same here. It also stops a provider from adding evidence strings the source never supplied.

SH/constants.ts

  • Roleplay :56: "Return only one JSON object with the top-level keys summary and units. Do not output markdown, explanations, analysis, or thinking tags." Do not name responseContract here. The first reduced wording did, and Haiku wrapped the whole answer in it twice.
  • Remove :71 (evidence and sourceHash), :158 and :211 (evidence), and :163 and :217 (sourceHash).
  • Replace :79-81 with '- Every timeline_event uses sectionKey "event".' and "- A relationship change uses claimKind change. If its concrete cause is supported but has no event unit, emit one compact timeline_event for that cause." The link rules themselves now live only in the server block.
  • Conversation :160 stays as it is, for the same reason as subjectNames above.
  • Core rules: remove :49, which repeats server rule 3.

CHANGELOG under ## Unreleased: one bullet. "Extraction requests no longer repeat the link rules or send values the server sets itself, so each one is about 3,100 characters shorter. A unit with an empty evidence list, a blank title or a null optional field is no longer dropped."

Not included

  • Unwrapping an answer nested under another key in parseEvidenceUnitPayload. The wording change removes the cause.
  • Shortening the mode prompts or the subject catalog. These make up most of the remaining request.
  • The 8,192 default output cap. It is a separate setting (see open questions).

Regression proof

  • tests/long-term-memory-extraction-graph.regression.ts:1280-1292: today this pins extractionPrompt.validationRules (the #1362 same-response caused_by rule) and allowedTimelineRelations (planted_in, paid_off_in for #1138). Move both assertions to the system message: the same-response rule appears exactly once, and allowedLinkRelations includes planted_in, paid_off_in and extracted_from.
  • Same file, new case: for each mode, build the messages with evidenceUnitMessages. Assert that every server link rule string occurs exactly once across system and user content (a copy in the user JSON counted in its escaped form), and that sourceHash, requiredEvidence, scope and modes are absent.
  • Parser fixture: parseEvidenceUnitPayload keeps a unit with evidence: [], one with title: "" and one with dimensions: null, and each kept unit carries the trusted evidence.
  • :1703 (required.includes("subjectNames")) stays as is. tests/long-term-memory-routes.regression.ts:4505-4508 builds the fixture unit's evidence from requiredEvidence ?? source_note:<id>; delete it and the unit's evidence line, since the server sets evidence.
  • Routes, found while building the patch. The same fixture model picks its cross-scope sources by three summary entry ids (:4500-4502), which reached the request only through the evidence lists. Key them on each summary's text instead. The backup check's rejected-suggestion count (:5728) drops from 11 to 4: the fixture answers every source with source_note:source_route_extract evidence, so 8 units from four other sources were rejected as missing_source_note_evidence. With server-owned evidence, 7 are kept and 1 is rejected for an unknown link instead. For the same reason the imports scenario's imported summary (:4179) is now current instead of extraction_incomplete when the scenario runs on its own; the full run still drops one unit for an ambiguous Mara, and asserts that code (ambiguous_subject_identity).
  • Rerun the T6 harness (private; aggregate numbers only) against the PR head as a manual live check. It is not a CI test.

Environment

  • Marinara Engine version: 2.5.0 line (shared test host at 2039583ca)
  • Package version: long-term-memory 1.4.55 (upstream/staging 8b72729f1)
  • Install type: source (live measurement on a private vault copy)
  • OS + version: Linux, Node 24.15.0
  • Browser or app shell: n/a (server)

Logs, screenshots, or video

None. Only aggregate counts from a private harness are shared.

Additional context

Tracker items EX-I5 (extraction stages audit F5, F6), RT-7 (the live before/after check that #1417 never ran) and EX-I11 (F7 part 2, decided to be handled here and measured).

EX-I11 asked for two counts per variant and model:

  • units dropped for a missing or unknown link target;
  • "changed because of" (caused_by) links that point at an event the same answer never created.
Run Change units caused_by to a missing event Unknown-target drops (target not in the answer) Closure drops
today haiku a / b 87 / 96 0 / 0 2 (2) / 4 (2) 2 / 3
today sonnet a / b 66 / 70 0 / 0 3 (3) / 3 (3) 1 / 2
pre-#1417 haiku / sonnet 101 / 73 0 / 0 2 (2) / 2 (2) 2 / 0
reduced haiku / sonnet 84 / 74 0 / 0 0 (0) / 4 (4) 1 / 1
reduced2 haiku a / b 93 / 95 0 / 0 2 (2) / 11 (2) 2 / 3
reduced2 sonnet 78 0 2 (2) 0
reduced3 haiku a / b / c 91 / 94 / 96 0 / 0 / 0 4 (1) / 3 (3) / 3 (3) 2 / 1 / 1
reduced3 sonnet 73 0 3 (3) 1
re-check: today haiku r1 / r2 / r3 108 / 91 / 105 0 / 0 / 0 3 (3) / 3 (3) / 0 (0) 2 / 3 / 1
re-check: reduced3 haiku r1 / r2 / r3 92 / 96 / 92 0 / 0 / 0 2 (2) / 1 (1) / 2 (2) 1 / 3 / 1
  • No caused_by link pointed at a missing event in any run, the re-check included.
  • Change units without an event link. In every run except two of the reduced3 re-check, every non-timeline change unit linked to an event in its own answer. r2 has one thread change unit that links only to the source note (kept, nothing dropped). r3 has 4 change units whose 7 caused_by links name an event of the same answer by its bare subjectId instead of the timeline_… id.
  • Invented timeline_event_… form. No run of today's code used it, nor reduced3 a–c, r1 or r2. reduced3 r3 used it 9 times and reduced3-world Haiku b 11 times. Every one of those links named an event in the same answer, and none was dropped as an unknown target.
  • The vault's six recorded losses did not reproduce with these two models. Those losses were caused_by links to events that exist nowhere, two of them through timeline_event_… ids. They probably came from another provider, or from older prompt text. The rule-2 wording in the fix ("add it if it is not in the response yet") is cheap insurance, but this run cannot show that it helps.
  • Where today's unknown-target drops come from.
    • Most never appear in the model's answer. The server adds character facts from the source's structured summary and turns a cause written in words into an event id that no unit creates (S/extraction/structured-summary-normalizer.ts:1258). The same drops occur in every variant, so this is a separate server-side issue, not a prompt one. Drafted separately as the structured-summary backfill issue (EX-I11a). Separately, 6 drops across the ten reduced2/reduced3 runs came from the server putting timeline_ in front of a model link to the source note's bare id; that is the bare source note link issue (OT-7), not the backfill.
    • The rest (2 today, 3 in reduced3 run a) are anchors whose planted_in link names an event that the summary declares (event_id: …) but the answer left out. That is the case decision D covers: a link to an event the model didn't write. Rule 1 (:87) already forbids it. The vault happens to hold those events from an earlier extraction of the same source, under the per-source suffix (…_e6e62f372f, normalizeSourceEventGraph, structured-summary-normalizer.ts:300). Adding that suffix on the server would save 1 of these 5 drops. The other events are outside the notes the extraction loads, and finding them is the rejected option B. No separate issue. Moving the "add it if it is not in the response yet" clause from rule 2 to rule 1 would cover anchors too, but that wording was not measured.
    • The 9 in reduced2.haiku.b are a knock-on effect: the events they linked to were rejected for a missing sectionKey.
  • Closure drops (source_event_graph_open) run 0–3 per run in every variant, including today's code. Not traced further.

World notes per source (for PL-1 / EX-I10)

PL-1 found that both models split one source into 4–11 small world notes instead of adding to the broad existing one.
The full per-source table is in the private T6 report. The summary is below. "Created" means a new world note, and "extended" means an existing world note that received a section or link.

Run World notes created Existing world notes extended Sources with 4+ new world notes Most new in one source
today haiku a / b 68 / 58 16 / 17 10 / 10 11 / 8
today sonnet a / b 55 / 63 15 / 18 9 / 9 8 / 10
pre-#1417 haiku / sonnet 64 / 61 20 / 13 10 / 8 8 / 10
reduced haiku / sonnet 41 / 60 11 / 17 6 / 7 8 / 10
reduced2 haiku a / b / sonnet 62 / 57 / 65 19 / 11 / 18 10 / 9 / 10 9 / 9 / 10
reduced3 haiku a / b / c / sonnet 62 / 58 / 62 / 62 17 / 18 / 17 / 19 9 / 8 / 9 / 8 8 / 10 / 11 / 10
re-check: today haiku r1 / r2 / r3 68 / 59 / 62 17 / 18 / 17 9 / 10 / 10 9 / 8 / 8
re-check: reduced3 haiku r1 / r2 / r3 65 / 62 / 62 17 / 18 / 18 9 / 9 / 10 10 / 9 / 8
reduced3-world haiku a / b 58 / 57 18 / 19 8 / 9 8 / 8
reduced3-world sonnet a / b 54 / 57 19 / 19 9 / 9 8 / 8

The EX-I5 changes leave this unchanged: the prompt cleanup does not touch what a world note is. Under every variant, 7–10 of 15 sources produce 4 or more new world notes (6 in the reduced Haiku run, which lost two answers), and the largest is 8–11. The re-extraction also shows the split directly. One source already has 2 world notes in the vault, yet a re-run creates 7–11 more. Another has 5, yet a re-run creates 5 new ones and adds to none. A broader world line was measured and failed (below), so granularity stays with EX-I10.

Broader world-note wording (measured, not proposed)

Before deciding EX-I10, one prompt line was measured. Variant reduced3-world is reduced3 plus one sentence at the end of the three world lines in SH/constants.ts (roleplay :106, conversation :152, game :204): "Add details about an existing place to that place's memory (reuse its subjectId); make a new world memory only for a new place, group or important object." The "(reuse its subjectId)" part was added to the agreed wording, because a model can add to a note only by giving the same subjectId.

The rule was written before any run (private pass-rules file). To pass, the median number of new world notes per source had to fall to half of reduced3's or less, and more existing world notes had to be extended. Errors, parser rejections, parser and validation drops other than unknown characters, and link drops each had to stay within the baseline limit. Kept units had to stay at 90% or more of the lowest baseline run. World-fact coverage could fall no more than 0.05 below the run-to-run figure. Each model ran 15 sources twice. The baseline is the six reduced3 Haiku runs and the one reduced3 Sonnet run.

Measure Haiku: reduced3 → world Sonnet: reduced3 → world
Median new world notes per source 5.0 → 4.0 4.0 → 4.0
New world notes per run 61.8 → 57.5 62 → 55.5
Existing world notes extended per run 17.5 → 18.5 19 → 19
Kept units per run 499 → 497 486 → 482
World facts still covered (run to run) 0.97 (0.96) 1.00 (0.95)
Parser rejections, world runs (limit) 0 / 24 (1) 0 / 0 (0)
Parser and validation drops other than unknown characters (limit) 5 / 30 (6) 3 / 3 (5)
Link drops (limit) 5 / 6 (6) 3 / 3 (5)
Verdict FAIL FAIL
  • The line changes little. On Sonnet, 10 of 15 sources make the same number of new world notes, and on Haiku most move by less than one. In one source, Sonnet now adds two parts of a place to that place's note instead of giving each part its own note. Haiku already did that without the line. A few sources drop by 2–3 new notes (two on Haiku, three on Sonnet), and one Sonnet source rises by 1.5. Judging by their ids, most of the remaining new world notes are running jokes, nicknames, quoted lines, people and one-off objects, not places. The line doesn't stop those. The prompts already have an anchor stream for recurring motifs and inside jokes, yet both models file many of them as world facts.

  • Haiku's two limit misses come from one conversation answer. It left out sectionKey on a whole stream (24 units) and lost 4 more units to links into that stream. The same failure appeared once in reduced2.

  • About a fifth of the "new" world notes in every run (9–14) are copies, not new subjects. The bench re-extracts sources the vault already holds. The model gave the subjectId of a world note from the earlier extraction, but that note was saved with a scope that also names a character. Today a chat summary writes with a chat-only scope (resolveChatLtmWriteScope, S/identity/chat-scope.ts:74), so the existing note can't be updated (canUpdateLtmScopedTarget, S/extraction/scoped-targets.ts:33-44), and the server writes a copy with a scope suffix. In one source, every world note in every run is such a copy, under today's code and every variant. No prompt line changes this. It is not traced further, and it's an input for EX-I10. The report counts these copies but doesn't score them.

  • PL-1 world pairs (private PL-1 recall-floor harness with the reduced3-world code, 4 pairs × 2 models × 2 runs; results in a private report). PL-1's baseline is today's code, not reduced3, so this also includes the rest of the EX-I5 change.

    World rows at commit Matched Duplicate Absent Failed
    Baseline (today's code), Haiku / Sonnet 3 / 0 0 / 3 5 / 3 0 / 2
    reduced3-world, Haiku / Sonnet 3 / 1 0 / 0 5 / 7 0 / 0
    All 3 of 14 → 4 of 16 3 → 0 8 → 12 2 → 0

    Haiku is unchanged. On Sonnet, one pair moves to matched, the three duplicates become absent, and the two baseline failures (the whole extraction failed on EX-I12) now run and come out absent. Both models still put a source's details into 4–13 new small notes instead of the broad place notes PL-1 expects. The PL-1 report header names commit 40ff75368 because the patched copy isn't a git checkout, so git log read the enclosing checkout. The code under test is the bench source (b1873710f) with the reduced3-world patches, and the prompt hashes differ from the baseline cache.

Not proposed. The wording failed on both models, so it is not part of this fix, and EX-I10 stays the path. The request never shows the model the existing world notes. It lists only trusted character names (trustedLtmSubjectPromptCatalog, S/identity/subject-identity.ts:703). A model therefore reuses a world id only when it happens to pick the same name, so a prompt line alone can't route new details into the existing places.

Open questions

  1. Unknown characters on Haiku. The Haiku re-check passed, but Haiku with the fix drops about 4.5 more units per run for a character the harness doesn't know. The harness has no Engine character list, so it can't tell real unknowns from names a real install would resolve. Before the PR is marked ready, extract two or three roleplay sources on a real install with a Haiku-class model and compare the dropped names with today's code. No naming line is removed: roleplay :72-73, the subjectNames field text and the two subject-name target rules are unchanged. What the model no longer sees is the scope ids, the source note's tags and evidence, and the link-rule copies that sat in targetNoteRules next to the subject rules.
  2. Output cap. Today, 3–8 of 15 Haiku answers (6 on average) are longer than the 8,192-token default, even without counting thinking. If a provider enforces that cap, those sources stop with "truncated output" and stay retryable. After this change, 2–3 still do. Raising the default, or splitting large sources, is a separate decision.
  3. Schema path. The fix keeps subjectNames required in the response schema, the safe choice. Dropping it would save tokens on openai, google and local sidecar models, but it needs a live check on one of them first.
  4. Server-side link losses found on the way. Facts the server adds from a structured summary link to events no unit creates. That is drafted separately as the structured-summary backfill issue (EX-I11a); landing it first takes up to 3 server-made drops per run out of this issue's live comparison. Anchors that link to a summary event the answer left out are the model miss decision D targets, not a server issue (see EX-I11 above). A third kind will rise with this issue's shorter link wording: the model citing the source note by its bare id with an event relation such as evidenced_by, which the server turns into timeline_source_… and validation drops (tracker OT-7, the bare source note link issue, left out of EX-I11a). Count those separately in the live comparison, or land OT-7 first.

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 @Promansis on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1512 Originally assigned to: @Promansis on GitHub. ## Summary Every extraction request repeats itself and asks the model for values the server sets anyway: - The link rules go out three times verbatim: in the system prompt, in the user `validationRules`, and again inside `targetNoteRules`. The mode prompts restate them on top of that. - Every prompt asks the model to copy `sourceHash` and the source evidence, which the server then overwrites or fills in. - The request carries keys no rule reads, including the scope's chat, character and persona ids. Removing this makes each request about 3,100 characters (about 775 tokens) shorter. In a live test with Claude Haiku 5.5 it also cut the answer by about a fifth per unit (233 to 184 visible tokens, mean of five and six runs). Today 17–19% of Haiku's answer text is copied `sourceHash` and evidence, and 3–8 of 15 answers (6 on average) run past the 8,192-token default output cap. After the change, 2–3 do. On Claude Sonnet 5.5 the change passed the quality rule set in advance. On Haiku the final wording first missed that rule narrowly, judged against only two runs of today's code. A re-check with three fresh runs of each, under a rule written before it ran, passed. One signal is left for the PR. Haiku drops more units for an unknown character (29 against 24 per run on average), and the harness can't check names against the Engine's character list (see the open questions). It also fixes three contract problems: - An empty `evidence` list, a blank `title` or a `null` optional field drops the whole unit (F6). - A model that cannot use the JSON schema never sees the link object shape or the full relation list (F5 g). - The "changed because of" rule does not say that the event must be in the same answer (EX-I11). No live run hit this, but the vault's earlier drafts lost six units to it. A broader world-note line was also measured on top of this change. It failed its pre-set rule on both models, so it is not part of this issue, and EX-I10 stays the path for world-note splitting (see "Broader world-note wording" below). ## Affected package `long-term-memory` 1.4.55 (`upstream/staging` 8b72729f1). Line references are at that commit. `S` = `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory` `SH` = `packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory` ## Expected behavior - Each server-enforced link rule appears once in the request. - The request does not ask for values the server owns (`sourceHash`, `evidence`), and it does not send keys no rule uses, or scope ids. - A unit whose only defect is an empty or null optional field (`evidence: []`, `title: ""`, `dimensions: null`) is kept. - A request without `response_format` still tells the model the link object shape and the allowed relations. ## Actual behavior - **Three copies of the link rules.** `serverEnforcedLinkPrompt` puts them in the system message (`S/extraction/evidence-unit-extraction.ts:1193`). They come back in the user JSON as `validationRules` (`:1274`), and a third time inside `targetNoteRules` (`:1294`). The roleplay prompt restates them again (`SH/constants.ts:79-81`), and so do the core rules (`:49`). - **Values the server owns.** Every mode prompt tells the model to copy `sourceHash` and the source evidence (`SH/constants.ts:71`, `:158`, `:163`, `:211`, `:217`). The user JSON sends both too, as `unitFields.evidence`, `sourceNote.evidence`, `sourceNote.sourceHash` and `requiredEvidence` (`:1243`, `:1280-1284`). `normalizedEvidenceUnitRecord` then overwrites `sourceHash` (`:669`) and fills in `evidence` when it is missing (`:670`). - **Keys no rule reads.** These are `allowedStatuses`, `allowedImportance`, `streamAllowedStatuses`, `streamScanOrder` and `modes`. The scope also goes out twice, as `sourceNote.scope` and `scope`, which carry chat, group, character and persona ids. - **No link shape without a schema.** `allowedTimelineRelations` (`:1262`) names 9 of the 12 relations and leaves out `extracted_from`, which every event needs. A provider that ignores `response_format` sees no link object shape anywhere. Among the Engine's providers, only openai, google and the local sidecar send the schema. - **F6.** The provider schema rejects the whole unit for `evidence: []` (minimum 1), for `title: ""`, and for `null` in any optional field. ### Measurement Method: - **Pipeline.** All 15 sources of a private vault copy (14 roleplay, 1 conversation) ran through the real preparation path, `prepareLongTermMemorySource`. That covers the catalog, recall window, provider call, parse, identity, reconciliation and compile. Nothing was applied, and package-default extraction settings were used. - **Models.** `claude-haiku-5-5` and `claude-sonnet-5-5` through `claude -p`, effort low, with no response schema, like the Engine's Anthropic providers. - **Runs.** Today's code ran twice per model to show the run-to-run spread. A Haiku re-check added three fresh runs of today's code and three of the fix. - **Pass rule.** It was written before any call: no more errors or rejections than the worse of today's two runs, kept units at least 90% of the lower one, and no more link-caused drops. - **Data shared.** Only aggregate counts are shared. Request size (deterministic): the proposed request is 2,862–3,466 characters shorter per source (mean 3,097, about 775 tokens). That is 15–25% of the text that is not the source, and 9–15% of the whole request. Each link rule appears once, and `sourceHash` and `requiredEvidence` are gone. **Haiku** (`claude-haiku-5-5`), 15 sources per run. `reduced` was fixed in advance; `reduced2` and `reduced3` were shaped after seeing results (exploratory). `reduced3` is the fix proposed below. | | today a | today b | reduced | reduced2 a | reduced2 b | reduced3 a | reduced3 b | reduced3 c | |---|---:|---:|---:|---:|---:|---:|---:|---:| | Answers that could not be used | 0 | 0 | 2 | 0 | 0 | 0 | 1 | 0 | | Parser rejections | 0 | 0 | 46 | 0 | 40 | 0 | 0 | 0 | | Validation rejections | 28 | 30 | 22 | 29 | 33 | 34 | 26 | 31 | | … of which untrusted subject (no roster in the harness) | 24 | 23 | 20 | 25 | 19 | 28 | 22 | 27 | | Kept units | 506 | 518 | 353 | 513 | 481 | 512 | 485 | 496 | | Link-caused drops | 4 | 7 | 2 | 4 | 14 | 6 | 4 | 4 | | Units missing `sectionKey` | 0 | 0 | 23 | 0 | 40 | 0 | 0 | 0 | | Visible output tokens per unit | 229 | 238 | 214 | 174 | 177 | 179 | 197 | 180 | | Answers over 8,192 visible tokens | 6 | 6 | 2 | 2 | 2 | 3 | 3 | 2 | | Answer text spent on `sourceHash` / `evidence` | 17% | 19% | 0% | 0% | 0% | 0% | 0% | 0% | **Sonnet** (`claude-sonnet-5-5`), 15 sources per run: | | today a | today b | reduced | reduced2 | reduced3 | |---|---:|---:|---:|---:|---:| | Answers that could not be used | 0 | 0 | 0 | 0 | 0 | | Parser rejections | 0 | 0 | 0 | 0 | 0 | | Validation rejections | 29 | 31 | 31 | 31 | 30 | | Kept units | 460 | 501 | 486 | 491 | 486 | | Link-caused drops | 4 | 5 | 5 | 2 | 4 | | Visible output tokens per unit | 217 | 184 | 178 | 174 | 186 | | Answers over 8,192 visible tokens | 4 | 3 | 3 | 3 | 3 | | Answer text spent on `sourceHash` / `evidence` | 12% | 3% | 0% | 0% | 0% | What the variants taught: - **`reduced`** (fixed in advance) passes on Sonnet and fails on Haiku. - Its return line said "Return only the JSON object described by responseContract and unitFields". Haiku twice wrapped the whole answer in `{"responseContract": …}`, and one of those also lacked its closing brace. - One answer sent `null` for optional fields on 17 units. - One answer left out `sectionKey` on whole streams. - **`reduced2`** names the top-level keys instead and treats `null` as absent. Run a passes, but run b lost `sectionKey` on whole streams in two answers. Each time, these were the streams that the new "omit subjectNames" wording told to drop the field next to `sectionKey`; today's wording (`all other streams: []`) never lost it in 1,005 Haiku units. - **`reduced3`** keeps today's `subjectNames` wording. No unit lost `sectionKey` and no answer was wrapped in 45 Haiku and 15 Sonnet answers. It passes on Sonnet. On Haiku it misses the strict rule narrowly in all three runs: - Runs a and c have 34 and 31 rejections against a limit of 30. The whole excess is untrusted-subject drops (28 and 27 against 24 and 23 today). The harness inflates that count because it cannot read the Engine roster, and two runs of today's code give only a narrow band. - Run b had one unusable answer, from a stray quote in the JSON (`…],"},{…`). Today's code had none in 45 Haiku answers. Kept units and link-caused drops are inside the rule in all three Haiku runs. **Haiku re-check.** Three fresh runs of today's code against three of `reduced3`. The rule was written before the runs (private pass-rules file, "Haiku re-check"): no more than one extra unusable answer in total, and on average no more rejections or link-caused drops than the worst run of today's code, with kept units at least 90% of its lowest run. Unknown-character drops are counted separately, because the harness has no character list. **It passes every rule.** | | today r1 | today r2 | today r3 | reduced3 r1 | reduced3 r2 | reduced3 r3 | |---|---:|---:|---:|---:|---:|---:| | Answers that could not be used | 0 | 0 | 0 | 0 | 0 | 0 | | Parser rejections | 1 | 0 | 0 | 1 | 1 | 0 | | Validation rejections, not counting unknown characters | 5 | 6 | 1 | 3 | 4 | 3 | | Unknown-character drops (not scored) | 23 | 29 | 22 | 33 | 40 | 22 | | Kept units | 515 | 513 | 494 | 489 | 511 | 502 | | Link-caused drops | 5 | 6 | 1 | 3 | 4 | 3 | | Units missing `sectionKey` | 0 | 0 | 0 | 0 | 0 | 0 | | Visible output tokens per unit | 235 | 245 | 219 | 181 | 183 | 184 | | Answers over 8,192 visible tokens | 7 | 8 | 3 | 3 | 2 | 3 | Across all runs of the same prompt (five of today's code, six of `reduced3`), Haiku drops 24.2 units per run for an unknown character with today's code and 28.7 with the fix. The spread is wide (22–40 with the fix, 22–29 today). The harness can't tell whether those names would resolve against a real install's characters. Limits: - These are Claude models only, not every provider people use. - `claude -p` adds about 640 tokens of Claude Code preamble, and it cannot set temperature or an output cap. The table counts visible tokens against the cap. - The schema path (openai, google, local sidecar) was not exercised. One conversation source, no game sources. - These are re-extractions of sources the vault already holds. ## Steps to reproduce 1. Turn on debug logging and extract any chat summary source in Roleplay mode. 2. Read the logged `evidence_unit_request` prompt. "Every link target must resolve" appears three times, and both `requiredEvidence` and `sourceNote.evidence` are present with the same list. 3. Feed `parseEvidenceUnitPayload` a unit with `evidence: []` or `title: ""`. It is dropped as `invalid_format`. ## Minimal fix One PR, patch bump. This is the `reduced3` variant measured above, except where noted. **`S/extraction/evidence-unit-extraction.ts`** - **`serverEnforcedLinkRules` (`:85-100`)**: this stays the only place the link rules are stated. The system prompt carries them through `serverEnforcedLinkPrompt` (`:1193`). For EX-I11, rule 2 (`:88`) becomes: `'Every non-timeline unit with claimKind "change" must link to a timeline_event unit in this same response; if that event is not in the response yet, add it. Static units …'`. The rest of the line stays. - **`evidenceUnitMessages` (`:1164`), user JSON**: - Remove `validationRules` (`:1274`) and `...validationRules` inside `targetNoteRules` (`:1294`). These are the second and third copies of the link rules. - Remove `allowedStatuses` (`:1255`), `allowedImportance` (`:1256`; the importance values are already listed in `unitFields.importance`), `streamAllowedStatuses` and `streamScanOrder` (`:1258-1261`). - Replace `allowedTimelineRelations` (`:1262-1272`) with `allowedLinkRelations: LTM_EXTRACTION_LINK_RELATIONS` (`:57`). The response schema already allows all twelve relations at `:500`. The old list named nine of them and left out `extracted_from`, which every event must use. - Trim `sourceNote` to `id` and `title`. Remove its `status`, `tags`, `scope`, `evidence` and `sourceHash` (`:1278-1282`), and the top-level `requiredEvidence`, `scope` and `modes` (`:1284-1286`). The chat, character and persona ids no longer go to the provider. - In `unitFields`: - remove `evidence` (`:1243`); - keep `subjectNames` (`:1234`) as it is (`all other streams: []`). Telling Haiku to omit the field made it drop the neighbouring `sectionKey` for whole streams in 3 of 45 answers (63 units); - `status` (`:1246`) becomes `'"active"; only thread units may use "resolved", when the open loop is closed'`; - `links` (`:1248`) becomes `'array of {"target": note id, "relation": one allowedLinkRelations value}; real links only, otherwise []'`. This gives providers without `response_format` the link shape (F5 g). - Delete `filteredScanOrder` (`:1166`) and `LTM_EXTRACTION_BUCKET_SCAN_ORDER` (`:46`). Nothing else uses them. - **`evidenceUnitResponseFormat` (`:426-528`)**: remove the `evidence` property (`:475`) and the two link descriptions that restate the rule (`:487`, `:498`). Keep `subjectNames` in `required` (`:460`). The live test never exercised the schema path, so the token saving there is not worth an untested risk to character facts (see open questions). - **`normalizedEvidenceUnitRecord` (`:617`)** (F6): - At `:624`, build `record` without null-valued keys. No field in `ltmEvidenceUnitSchema` is nullable, so a null only ever turns an optional field into a rejection. - Return `title: undefined` for a blank title. - At `:670`, set `evidence` to the trusted list whenever one exists, instead of only when the field is missing. The harness merged trusted and provider strings, but no measured answer sent evidence, so the simpler rule behaves the same here. It also stops a provider from adding evidence strings the source never supplied. **`SH/constants.ts`** - Roleplay `:56`: "Return only one JSON object with the top-level keys summary and units. Do not output markdown, explanations, analysis, or thinking tags." Do not name `responseContract` here. The first reduced wording did, and Haiku wrapped the whole answer in it twice. - Remove `:71` (evidence and sourceHash), `:158` and `:211` (evidence), and `:163` and `:217` (sourceHash). - Replace `:79-81` with `'- Every timeline_event uses sectionKey "event".'` and "- A relationship change uses claimKind change. If its concrete cause is supported but has no event unit, emit one compact timeline_event for that cause." The link rules themselves now live only in the server block. - Conversation `:160` stays as it is, for the same reason as `subjectNames` above. - Core rules: remove `:49`, which repeats server rule 3. **CHANGELOG under `## Unreleased`**: one bullet. "Extraction requests no longer repeat the link rules or send values the server sets itself, so each one is about 3,100 characters shorter. A unit with an empty evidence list, a blank title or a null optional field is no longer dropped." **Not included** - Unwrapping an answer nested under another key in `parseEvidenceUnitPayload`. The wording change removes the cause. - Shortening the mode prompts or the subject catalog. These make up most of the remaining request. - The 8,192 default output cap. It is a separate setting (see open questions). ## Regression proof - **`tests/long-term-memory-extraction-graph.regression.ts:1280-1292`**: today this pins `extractionPrompt.validationRules` (the #1362 same-response caused_by rule) and `allowedTimelineRelations` (`planted_in`, `paid_off_in` for #1138). Move both assertions to the system message: the same-response rule appears exactly once, and `allowedLinkRelations` includes `planted_in`, `paid_off_in` and `extracted_from`. - **Same file, new case**: for each mode, build the messages with `evidenceUnitMessages`. Assert that every server link rule string occurs exactly once across system and user content (a copy in the user JSON counted in its escaped form), and that `sourceHash`, `requiredEvidence`, `scope` and `modes` are absent. - **Parser fixture**: `parseEvidenceUnitPayload` keeps a unit with `evidence: []`, one with `title: ""` and one with `dimensions: null`, and each kept unit carries the trusted evidence. - **`:1703`** (`required.includes("subjectNames")`) stays as is. **`tests/long-term-memory-routes.regression.ts:4505-4508`** builds the fixture unit's evidence from `requiredEvidence ?? source_note:<id>`; delete it and the unit's `evidence` line, since the server sets evidence. - **Routes, found while building the patch.** The same fixture model picks its cross-scope sources by three summary entry ids (`:4500-4502`), which reached the request only through the evidence lists. Key them on each summary's text instead. The backup check's rejected-suggestion count (`:5728`) drops from 11 to 4: the fixture answers every source with `source_note:source_route_extract` evidence, so 8 units from four other sources were rejected as `missing_source_note_evidence`. With server-owned evidence, 7 are kept and 1 is rejected for an unknown link instead. For the same reason the imports scenario's imported summary (`:4179`) is now `current` instead of `extraction_incomplete` when the scenario runs on its own; the full run still drops one unit for an ambiguous Mara, and asserts that code (`ambiguous_subject_identity`). - Rerun the T6 harness (private; aggregate numbers only) against the PR head as a manual live check. It is not a CI test. ## Environment - Marinara Engine version: 2.5.0 line (shared test host at 2039583ca) - Package version: long-term-memory 1.4.55 (`upstream/staging` 8b72729f1) - Install type: source (live measurement on a private vault copy) - OS + version: Linux, Node 24.15.0 - Browser or app shell: n/a (server) ## Logs, screenshots, or video None. Only aggregate counts from a private harness are shared. ## Additional context Tracker items EX-I5 (extraction stages audit F5, F6), RT-7 (the live before/after check that #1417 never ran) and EX-I11 (F7 part 2, decided to be handled here and measured). ### EX-I11: link losses per variant and model EX-I11 asked for two counts per variant and model: - units dropped for a missing or unknown link target; - "changed because of" (`caused_by`) links that point at an event the same answer never created. | Run | Change units | `caused_by` to a missing event | Unknown-target drops (target not in the answer) | Closure drops | |---|---:|---:|---:|---:| | today haiku a / b | 87 / 96 | 0 / 0 | 2 (2) / 4 (2) | 2 / 3 | | today sonnet a / b | 66 / 70 | 0 / 0 | 3 (3) / 3 (3) | 1 / 2 | | pre-#1417 haiku / sonnet | 101 / 73 | 0 / 0 | 2 (2) / 2 (2) | 2 / 0 | | reduced haiku / sonnet | 84 / 74 | 0 / 0 | 0 (0) / 4 (4) | 1 / 1 | | reduced2 haiku a / b | 93 / 95 | 0 / 0 | 2 (2) / 11 (2) | 2 / 3 | | reduced2 sonnet | 78 | 0 | 2 (2) | 0 | | reduced3 haiku a / b / c | 91 / 94 / 96 | 0 / 0 / 0 | 4 (1) / 3 (3) / 3 (3) | 2 / 1 / 1 | | reduced3 sonnet | 73 | 0 | 3 (3) | 1 | | re-check: today haiku r1 / r2 / r3 | 108 / 91 / 105 | 0 / 0 / 0 | 3 (3) / 3 (3) / 0 (0) | 2 / 3 / 1 | | re-check: reduced3 haiku r1 / r2 / r3 | 92 / 96 / 92 | 0 / 0 / 0 | 2 (2) / 1 (1) / 2 (2) | 1 / 3 / 1 | - **No `caused_by` link pointed at a missing event in any run**, the re-check included. - **Change units without an event link.** In every run except two of the `reduced3` re-check, every non-timeline change unit linked to an event in its own answer. r2 has one thread change unit that links only to the source note (kept, nothing dropped). r3 has 4 change units whose 7 `caused_by` links name an event of the same answer by its bare subjectId instead of the `timeline_…` id. - **Invented `timeline_event_…` form.** No run of today's code used it, nor `reduced3` a–c, r1 or r2. `reduced3` r3 used it 9 times and `reduced3-world` Haiku b 11 times. Every one of those links named an event in the same answer, and none was dropped as an unknown target. - **The vault's six recorded losses did not reproduce with these two models.** Those losses were `caused_by` links to events that exist nowhere, two of them through `timeline_event_…` ids. They probably came from another provider, or from older prompt text. The rule-2 wording in the fix ("add it if it is not in the response yet") is cheap insurance, but this run cannot show that it helps. - **Where today's unknown-target drops come from.** - Most never appear in the model's answer. The server adds character facts from the source's structured summary and turns a cause written in words into an event id that no unit creates (`S/extraction/structured-summary-normalizer.ts:1258`). The same drops occur in every variant, so this is a separate server-side issue, not a prompt one. Drafted separately as the structured-summary backfill issue (EX-I11a). Separately, 6 drops across the ten `reduced2`/`reduced3` runs came from the server putting `timeline_` in front of a model link to the source note's bare id; that is the bare source note link issue (OT-7), not the backfill. - The rest (2 today, 3 in `reduced3` run a) are anchors whose `planted_in` link names an event that the summary declares (`event_id: …`) but the answer left out. That is the case decision D covers: a link to an event the model didn't write. Rule 1 (`:87`) already forbids it. The vault happens to hold those events from an earlier extraction of the same source, under the per-source suffix (`…_e6e62f372f`, `normalizeSourceEventGraph`, `structured-summary-normalizer.ts:300`). Adding that suffix on the server would save 1 of these 5 drops. The other events are outside the notes the extraction loads, and finding them is the rejected option B. No separate issue. Moving the "add it if it is not in the response yet" clause from rule 2 to rule 1 would cover anchors too, but that wording was not measured. - The 9 in `reduced2.haiku.b` are a knock-on effect: the events they linked to were rejected for a missing `sectionKey`. - **Closure drops (`source_event_graph_open`)** run 0–3 per run in every variant, including today's code. Not traced further. ### World notes per source (for PL-1 / EX-I10) PL-1 found that both models split one source into 4–11 small world notes instead of adding to the broad existing one. The full per-source table is in the private T6 report. The summary is below. "Created" means a new world note, and "extended" means an existing world note that received a section or link. | Run | World notes created | Existing world notes extended | Sources with 4+ new world notes | Most new in one source | |---|---:|---:|---:|---:| | today haiku a / b | 68 / 58 | 16 / 17 | 10 / 10 | 11 / 8 | | today sonnet a / b | 55 / 63 | 15 / 18 | 9 / 9 | 8 / 10 | | pre-#1417 haiku / sonnet | 64 / 61 | 20 / 13 | 10 / 8 | 8 / 10 | | reduced haiku / sonnet | 41 / 60 | 11 / 17 | 6 / 7 | 8 / 10 | | reduced2 haiku a / b / sonnet | 62 / 57 / 65 | 19 / 11 / 18 | 10 / 9 / 10 | 9 / 9 / 10 | | reduced3 haiku a / b / c / sonnet | 62 / 58 / 62 / 62 | 17 / 18 / 17 / 19 | 9 / 8 / 9 / 8 | 8 / 10 / 11 / 10 | | re-check: today haiku r1 / r2 / r3 | 68 / 59 / 62 | 17 / 18 / 17 | 9 / 10 / 10 | 9 / 8 / 8 | | re-check: reduced3 haiku r1 / r2 / r3 | 65 / 62 / 62 | 17 / 18 / 18 | 9 / 9 / 10 | 10 / 9 / 8 | | reduced3-world haiku a / b | 58 / 57 | 18 / 19 | 8 / 9 | 8 / 8 | | reduced3-world sonnet a / b | 54 / 57 | 19 / 19 | 9 / 9 | 8 / 8 | The EX-I5 changes leave this unchanged: the prompt cleanup does not touch what a world note is. Under every variant, 7–10 of 15 sources produce 4 or more new world notes (6 in the `reduced` Haiku run, which lost two answers), and the largest is 8–11. The re-extraction also shows the split directly. One source already has 2 world notes in the vault, yet a re-run creates 7–11 more. Another has 5, yet a re-run creates 5 new ones and adds to none. A broader world line was measured and failed (below), so granularity stays with EX-I10. #### Broader world-note wording (measured, not proposed) Before deciding EX-I10, one prompt line was measured. Variant `reduced3-world` is `reduced3` plus one sentence at the end of the three world lines in `SH/constants.ts` (roleplay `:106`, conversation `:152`, game `:204`): "Add details about an existing place to that place's memory (reuse its subjectId); make a new world memory only for a new place, group or important object." The "(reuse its subjectId)" part was added to the agreed wording, because a model can add to a note only by giving the same subjectId. The rule was written before any run (private pass-rules file). To pass, the median number of new world notes per source had to fall to half of `reduced3`'s or less, and more existing world notes had to be extended. Errors, parser rejections, parser and validation drops other than unknown characters, and link drops each had to stay within the baseline limit. Kept units had to stay at 90% or more of the lowest baseline run. World-fact coverage could fall no more than 0.05 below the run-to-run figure. Each model ran 15 sources twice. The baseline is the six `reduced3` Haiku runs and the one `reduced3` Sonnet run. | Measure | Haiku: reduced3 → world | Sonnet: reduced3 → world | |---|---|---| | Median new world notes per source | 5.0 → 4.0 | 4.0 → 4.0 | | New world notes per run | 61.8 → 57.5 | 62 → 55.5 | | Existing world notes extended per run | 17.5 → 18.5 | 19 → 19 | | Kept units per run | 499 → 497 | 486 → 482 | | World facts still covered (run to run) | 0.97 (0.96) | 1.00 (0.95) | | Parser rejections, world runs (limit) | 0 / 24 (1) | 0 / 0 (0) | | Parser and validation drops other than unknown characters (limit) | 5 / 30 (6) | 3 / 3 (5) | | Link drops (limit) | 5 / 6 (6) | 3 / 3 (5) | | **Verdict** | **FAIL** | **FAIL** | - **The line changes little.** On Sonnet, 10 of 15 sources make the same number of new world notes, and on Haiku most move by less than one. In one source, Sonnet now adds two parts of a place to that place's note instead of giving each part its own note. Haiku already did that without the line. A few sources drop by 2–3 new notes (two on Haiku, three on Sonnet), and one Sonnet source rises by 1.5. Judging by their ids, most of the remaining new world notes are running jokes, nicknames, quoted lines, people and one-off objects, not places. The line doesn't stop those. The prompts already have an `anchor` stream for recurring motifs and inside jokes, yet both models file many of them as world facts. - **Haiku's two limit misses come from one conversation answer.** It left out `sectionKey` on a whole stream (24 units) and lost 4 more units to links into that stream. The same failure appeared once in `reduced2`. - **About a fifth of the "new" world notes in every run (9–14) are copies, not new subjects.** The bench re-extracts sources the vault already holds. The model gave the subjectId of a world note from the earlier extraction, but that note was saved with a scope that also names a character. Today a chat summary writes with a chat-only scope (`resolveChatLtmWriteScope`, `S/identity/chat-scope.ts:74`), so the existing note can't be updated (`canUpdateLtmScopedTarget`, `S/extraction/scoped-targets.ts:33-44`), and the server writes a copy with a scope suffix. In one source, every world note in every run is such a copy, under today's code and every variant. No prompt line changes this. It is not traced further, and it's an input for EX-I10. The report counts these copies but doesn't score them. - **PL-1 world pairs** (private PL-1 recall-floor harness with the `reduced3-world` code, 4 pairs × 2 models × 2 runs; results in a private report). PL-1's baseline is today's code, not `reduced3`, so this also includes the rest of the EX-I5 change. | World rows at commit | Matched | Duplicate | Absent | Failed | |---|---:|---:|---:|---:| | Baseline (today's code), Haiku / Sonnet | 3 / 0 | 0 / 3 | 5 / 3 | 0 / 2 | | `reduced3-world`, Haiku / Sonnet | 3 / 1 | 0 / 0 | 5 / 7 | 0 / 0 | | All | 3 of 14 → 4 of 16 | 3 → 0 | 8 → 12 | 2 → 0 | Haiku is unchanged. On Sonnet, one pair moves to matched, the three duplicates become absent, and the two baseline failures (the whole extraction failed on EX-I12) now run and come out absent. Both models still put a source's details into 4–13 new small notes instead of the broad place notes PL-1 expects. The PL-1 report header names commit 40ff75368 because the patched copy isn't a git checkout, so `git log` read the enclosing checkout. The code under test is the bench source (b1873710f) with the `reduced3-world` patches, and the prompt hashes differ from the baseline cache. **Not proposed.** The wording failed on both models, so it is not part of this fix, and EX-I10 stays the path. The request never shows the model the existing world notes. It lists only trusted character names (`trustedLtmSubjectPromptCatalog`, `S/identity/subject-identity.ts:703`). A model therefore reuses a world id only when it happens to pick the same name, so a prompt line alone can't route new details into the existing places. ### Open questions 1. **Unknown characters on Haiku.** The Haiku re-check passed, but Haiku with the fix drops about 4.5 more units per run for a character the harness doesn't know. The harness has no Engine character list, so it can't tell real unknowns from names a real install would resolve. Before the PR is marked ready, extract two or three roleplay sources on a real install with a Haiku-class model and compare the dropped names with today's code. No naming line is removed: roleplay `:72-73`, the `subjectNames` field text and the two subject-name target rules are unchanged. What the model no longer sees is the scope ids, the source note's tags and evidence, and the link-rule copies that sat in `targetNoteRules` next to the subject rules. 2. **Output cap.** Today, 3–8 of 15 Haiku answers (6 on average) are longer than the 8,192-token default, even without counting thinking. If a provider enforces that cap, those sources stop with "truncated output" and stay retryable. After this change, 2–3 still do. Raising the default, or splitting large sources, is a separate decision. 3. **Schema path.** The fix keeps `subjectNames` required in the response schema, the safe choice. Dropping it would save tokens on openai, google and local sidecar models, but it needs a live check on one of them first. 4. **Server-side link losses found on the way.** Facts the server adds from a structured summary link to events no unit creates. That is drafted separately as the structured-summary backfill issue (EX-I11a); landing it first takes up to 3 server-made drops per run out of this issue's live comparison. Anchors that link to a summary event the answer left out are the model miss decision D targets, not a server issue (see EX-I11 above). A third kind will rise with this issue's shorter link wording: the model citing the source note by its bare id with an event relation such as `evidenced_by`, which the server turns into `timeline_source_…` and validation drops (tracker OT-7, the bare source note link issue, left out of EX-I11a). Count those separately in the live comparison, or land OT-7 first. ## 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-10-22 04:02:43 +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#1499
No description provided.