Skip to content

feat(agent): history window and compaction for long-lived sessions - #153

Merged
hung12ct merged 2 commits into
mainfrom
feat/history-window
Nov 2, 2026
Merged

hung12ct merged 2 commits into
mainfrom
feat/history-window

Conversation

@hung12ct

@hung12ct hung12ct commented Nov 2, 2026

Copy link
Copy Markdown
Owner
  • WithHistoryWindow(n): requests carry the system block plus ~the last n messages, cut in n/2 steps at user boundaries so the prefix stays prompt-cache stable. Request-only; stored history is untouched.
  • WithCompactor: folds dropped turns into an incremental summary stored as a position-based compaction record (history.Message.Compaction) and carried in the head system message. Bounded input, never fails a turn, reported on CompactedEvent.
  • Breaking: EventVisitor gains VisitCompacted. Docs in docs/context.md.

Requests carry the system block plus ~the last n messages, cut in n/2 steps at user boundaries; stored history is untouched.
WithCompactor folds turns the history window drops into an incremental summary, stored as a position-based compaction record and carried in the system prompt.
@hung12ct
hung12ct merged commit 54e04a6 into main Nov 2, 2026
2 checks passed
@hung12ct
hung12ct deleted the feat/history-window branch November 2, 2026 11:31
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