Skip to content

feat(agent-core): add session handover context and context-usage self-awareness - #452

Merged
WinterYukky merged 1 commit into
aws-samples:mainfrom
WinterYukky:feature/session-handover-context-1787551584
Aug 24, 2026
Merged

feat(agent-core): add session handover context and context-usage self-awareness#452
WinterYukky merged 1 commit into
aws-samples:mainfrom
WinterYukky:feature/session-handover-context-1787551584

Conversation

@WinterYukky

Copy link
Copy Markdown
Contributor

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

  • packages/agent-core/src/lib/handover-context.ts: extract work state from recent
    conversation/tool activity and build the successor seed message + title.
  • packages/agent-core/src/lib/auto-handover.ts: build the per-turn context-usage
    environment block (soft ~80% guideline; the model decides, no forced auto-fire).
  • matching handover-context.test.ts / auto-handover.test.ts.

Testing

  • agent-core unit tests: handover-context 26 + auto-handover 6 = 32 tests, all
    passing (tsc + prettier + vitest).

Notes

  • Self-contained, pure (no AWS SDK), unit-testable in isolation. Independent of
    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.

…-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).
@WinterYukky
WinterYukky merged commit 71c3497 into aws-samples:main Aug 24, 2026
8 checks passed
@remote-swe
remote-swe Bot deleted the feature/session-handover-context-1787551584 branch August 25, 2026 06:54
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