feat(journal): _build_transcript caps content and message window

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 14:33:27 -04:00
parent e17fc088b2
commit 2576be9e49
4 changed files with 43 additions and 2 deletions
@@ -26,3 +26,15 @@ def _filter_messages(messages):
continue
kept.append(m)
return kept
_TRANSCRIPT_WINDOW = 20
_CONTENT_CAP = 500
def _build_transcript(messages) -> str:
"""Format the last 20 messages as `ROLE: content[:500]` lines."""
tail = list(messages)[-_TRANSCRIPT_WINDOW:]
return "\n".join(
f"{m.role.upper()}: {m.content[:_CONTENT_CAP]}" for m in tail
)