From f5ac0b3e4fb4b463f84563e2aac76243dfb84d3e Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 30 Jul 2026 01:10:13 +0200 Subject: [PATCH 1/2] fix: resolve quoted relative claim times --- decisions.md | 2 ++ src/rememberstack/workers/e1.py | 23 +++++++++--------- src/rememberstack/workers/e2.py | 27 ++++++++++++++-------- src/tests/workers/test_claim_valid_time.py | 6 +++++ 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/decisions.md b/decisions.md index f742c5be..09feddf0 100644 --- a/decisions.md +++ b/decisions.md @@ -985,6 +985,8 @@ exists only in the structured valid-time fields. If the document has no absolute fields empty rather than guessing. D32's text-membership gate remains unchanged: it checks added claim text, not these structured fields. Evidence payloads, including `claims_verbatim` and `explain`, now surface `claim_valid_from` and `claim_valid_until`, so an answer agent can use the extracted time. +The same rule applies when the relative expression is inside a preserved direct quotation or +attributed claim. --- diff --git a/src/rememberstack/workers/e1.py b/src/rememberstack/workers/e1.py index 8ec63b70..0d430e25 100644 --- a/src/rememberstack/workers/e1.py +++ b/src/rememberstack/workers/e1.py @@ -57,18 +57,19 @@ 07b pins temperature=0.0 — generation parameters are part of provenance. 07c adds D79's bounded current-generation section-summary orientation.""" -E2_EXTRACTOR_VERSION: Final = f"e2-extract-2026.07i:token-union-grounding-1:temporal-anchor-1:{SECTION_ORIENTATION_VERSION}" +E2_EXTRACTOR_VERSION: Final = f"e2-extract-2026.07j:token-union-grounding-1:temporal-anchor-2:{SECTION_ORIENTATION_VERSION}" """The extractor generation baked into extraction_input_hash (D56); the E2 -stage (WP-1.3) binds its handler to this same constant. 07i makes D32 layer-2 -union grounding token-tolerant for closed functional scaffolding while keeping -every content and numeric token source-bound; 07h requires relative temporal -expressions to resolve against an in-document absolute anchor into structured -D41 valid-time while claim text keeps the source wording (#158); 07g makes D32 -layer-2 grounding union-based across source-derived bundle texts with advisory -source tags; 07f adds D79 summary orientation to the bundle without making -summaries hash or grounding inputs; 07e ledgers Claimify omissions and -grounding-gate rejections on the D33 transcript (#161); 07d pinned -temperature=0.0 on the Selection call (Claimify already carried it).""" +stage (WP-1.3) binds its handler to this same constant. 07j extends the temporal +rule to quoted and attributed claim forms (#158 follow-up); 07i makes D32 +layer-2 union grounding token-tolerant for closed functional scaffolding while +keeping every content and numeric token source-bound; 07h requires relative +temporal expressions to resolve against an in-document absolute anchor into +structured D41 valid-time while claim text keeps the source wording (#158); +07g makes D32 layer-2 grounding union-based across source-derived bundle texts +with advisory source tags; 07f adds D79 summary orientation to the bundle +without making summaries hash or grounding inputs; 07e ledgers Claimify +omissions and grounding-gate rejections on the D33 transcript (#161); 07d +pinned temperature=0.0 on the Selection call (Claimify already carried it).""" _PREFIX_PROMPT_TEMPLATE: Final = ( "In one sentence, state where this passage sits in the document — " diff --git a/src/rememberstack/workers/e2.py b/src/rememberstack/workers/e2.py index a9a5967a..2ab52bd2 100644 --- a/src/rememberstack/workers/e2.py +++ b/src/rememberstack/workers/e2.py @@ -162,14 +162,19 @@ return entailment_self_verdict (does chunk+bundle entail the claim) and is_attributed. -TEMPORAL RESOLUTION IS REQUIRED. Whenever the source utterance contains a -relative temporal expression ("yesterday", "last Saturday", "last year", -"this morning", "a few weeks ago", and similar) AND the DOCUMENT HEADER -provides an absolute date or timestamp, you MUST resolve the expression against -that anchor and emit valid_kind, valid_from_iso, valid_until_iso, and -valid_precision. Put the computed absolute time ONLY in those structured -valid-time fields. The claim_text MUST stay faithful to the source: keep the -relative phrase as spoken and never replace it with the computed date. +TEMPORAL RESOLUTION IS REQUIRED regardless of claim form. This applies equally +when claim_text preserves a direct quotation or attributed speech: +a relative expression inside quoted or attributed text is never exempt. +Whenever the source utterance contains a relative temporal expression +("yesterday", "last Saturday", "last year", "this morning", "a few weeks ago", +and similar) AND the DOCUMENT HEADER provides an absolute date or timestamp, +you MUST resolve the expression against that anchor and emit valid_kind, +valid_from_iso, valid_until_iso, and valid_precision. +Put the computed absolute time ONLY in those structured valid-time fields. The +claim_text MUST stay faithful to the source: keep the relative phrase as spoken +and never replace it with the computed date. When claim_text preserves a direct +quotation, the quoted text itself stays verbatim; its resolution goes only to +the valid-time fields. Use ISO-8601 dates (YYYY-MM-DD) or datetimes WITH an explicit offset or Z; never emit a datetime without an offset. Calendar-day expressions use @@ -186,10 +191,12 @@ invent an anchor or a date. Examples (DOCUMENT HEADER date → structured output): -- date 2023-05-08; "went to the support group yesterday" → - claim_text="went to the support group yesterday", +- date 2023-05-08; + claim_text="Caroline said: I went to a support group yesterday" → valid_kind=event_time, valid_from_iso=2023-05-07, valid_until_iso=2023-05-07, valid_precision=day. + Note the quote form: the relative word stays inside the quoted claim_text; + the resolution goes only to the valid_* fields. - date 2023-05-08; "painted a lake sunrise last year" → claim_text="painted a lake sunrise last year", valid_kind=event_time, valid_from_iso=2022-01-01, valid_until_iso=2022-12-31, diff --git a/src/tests/workers/test_claim_valid_time.py b/src/tests/workers/test_claim_valid_time.py index 0c8c42c9..31261a66 100644 --- a/src/tests/workers/test_claim_valid_time.py +++ b/src/tests/workers/test_claim_valid_time.py @@ -29,9 +29,15 @@ def test_rendered_claimify_prompt_requires_anchored_temporal_resolution() -> Non ) assert "TEMPORAL RESOLUTION IS REQUIRED" in rendered + assert "regardless of claim form" in rendered + assert "relative expression inside quoted or attributed text" in rendered assert "you MUST resolve the expression" in rendered assert "computed absolute time ONLY in those structured" in rendered assert "valid-time fields" in rendered + assert ( + 'claim_text="Caroline said: I went to a support group yesterday"' in rendered + ) + assert "the relative word stays inside the quoted claim_text" in rendered assert 'claim_text="painted a lake sunrise last year"' in rendered assert "valid_from_iso=2022-01-01" in rendered assert "valid_until_iso=2022-12-31" in rendered From cd61c0f07e37a33e3540c24e35a3d561b1c07509 Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 30 Jul 2026 02:08:58 +0200 Subject: [PATCH 2/2] style: ruff format test_claim_valid_time.py --- src/tests/workers/test_claim_valid_time.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tests/workers/test_claim_valid_time.py b/src/tests/workers/test_claim_valid_time.py index 31261a66..da587038 100644 --- a/src/tests/workers/test_claim_valid_time.py +++ b/src/tests/workers/test_claim_valid_time.py @@ -34,9 +34,7 @@ def test_rendered_claimify_prompt_requires_anchored_temporal_resolution() -> Non assert "you MUST resolve the expression" in rendered assert "computed absolute time ONLY in those structured" in rendered assert "valid-time fields" in rendered - assert ( - 'claim_text="Caroline said: I went to a support group yesterday"' in rendered - ) + assert 'claim_text="Caroline said: I went to a support group yesterday"' in rendered assert "the relative word stays inside the quoted claim_text" in rendered assert 'claim_text="painted a lake sunrise last year"' in rendered assert "valid_from_iso=2022-01-01" in rendered