feat(agent-core): add session handover context and context-usage self-awareness - #452
Merged
WinterYukky merged 1 commit intoAug 24, 2026
Conversation
…-awareness - handover-context: extract work state (branches, PRs, repos, commits) from recent conversation and build a successor seed message + title for session handover. - auto-handover: build a per-turn context-window usage environment block so the model can decide to hand over to a fresh successor before the window fills. Both modules are pure and side-effect-free (no AWS SDK), unit-tested in isolation (32 tests).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add two pure, side-effect-free helpers that support model-driven session
handover: work-state/handover-context extraction, and a per-turn context-window
usage self-awareness block.
Motivation
When a session hands over to a successor, the successor needs a concise seed of
the prior work (branches, PRs, repos, commits, recent conversation) so it can
continue without manual archaeology. Separately, surfacing the current
context-window utilisation back to the model lets it decide to hand over
before the window fills, rather than hitting truncation/overflow.
Changes
conversation/tool activity and build the successor seed message + title.
environment block (soft ~80% guideline; the model decides, no forced auto-fire).
Testing
passing (tsc + prettier + vitest).
Notes
the other Batch 2 PRs (no shared files).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.