Skip to content

ARIA: smart truncation for Recent days/weeks summaries#353

Open
holoduke wants to merge 1 commit into
mainfrom
aria/smart-truncate-temporal-summaries
Open

ARIA: smart truncation for Recent days/weeks summaries#353
holoduke wants to merge 1 commit into
mainfrom
aria/smart-truncate-temporal-summaries

Conversation

@holoduke

@holoduke holoduke commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • updateDailySummary and compileWeeklySummary in backend/memory/working-memory.ts previously truncated with a hard .slice(0, N), often cutting mid-word.
  • Add a small smartTruncate(text, maxLen) helper that prefers the last sentence terminator (., !, ?) within the budget, falls back to the last whitespace, then to a hard cap.
  • A 60% floor on the boundary position prevents pathological cuts where a stray early period would otherwise drop most of the content.
  • Char budgets (200 daily / 300 weekly) unchanged — only the cutoff is smarter.

Why

Reflect/think ticks render these summaries via brain-prompt.ts (Recent days: / Recent weeks:). Mid-word cutoffs like …Ilse oudjes DM door Gillis (trail-off) cost a beat of parse-effort every tick and occasionally hide the actually-relevant trailing clause.

Test plan

  • npx tsc --noEmit passes
  • Observe next reflect tick: Recent days: entries should end on ./!/? or a word boundary, not mid-word

Daily and weekly summaries in working-memory previously cut off at a hard
char count, often mid-word. Replace with smartTruncate(): prefer the last
sentence boundary (. ! ?) within the budget, fall back to last whitespace,
then hard cap. Boundary must lie within 60% of the budget to avoid losing
most of the content to a stray early period.

Same char budgets (200 daily / 300 weekly) — just smarter cutoff.

Intent-summary: Recent-days/Recent-weeks summaries truncated mid-word, costing parse-effort on every reflect tick.
Intent-tokens: truncation, midword, summary, boundary, readability, temporal

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant