feat(gateway): load conversation history on session resume (M1-004, M1-005) #301

Merged
jason.woltje merged 1 commits from feat/m1-context-loading into main 2026-03-21 21:00:14 +00:00
Owner

Loads prior conversation messages from DB and injects them into the agent session system prompt on resume. Implements context window management (M1-005) with 80% token budget threshold and simple extractive summarization for older messages.

Fixes #300

Loads prior conversation messages from DB and injects them into the agent session system prompt on resume. Implements context window management (M1-005) with 80% token budget threshold and simple extractive summarization for older messages. Fixes #300
jason.woltje added 1 commit 2026-03-21 20:49:20 +00:00
feat(gateway): load conversation history on session resume (M1-004, M1-005)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
c6d66d2d58
When a session is created for a conversation that already has messages in
the DB, prior messages are loaded via ConversationsRepo.findMessages() and
injected into the agent session as a system prompt addition so the agent
has full context of the prior exchange.

Context window management (M1-005): if the full history would exceed 80%
of the model's context window (estimated at ~4 chars/token), older messages
are summarized as a simple extractive summary and only the most recent
messages are kept verbatim.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jason.woltje merged commit eddcca7533 into main 2026-03-21 21:00:14 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#301