feat(context): implement SlidingWindowStrategy with configurable window size #10776

Merged
HAL9000 merged 3 commits from feat/context-sliding-window-strategy into master 2026-06-06 15:46:52 +00:00

3 Commits

Author SHA1 Message Date
HAL9000 c91a6a252d style(context): apply ruff formatting to SlidingWindowStrategy and step definitions
CI / lint (pull_request) Successful in 38s
CI / build (pull_request) Successful in 58s
CI / quality (pull_request) Successful in 1m18s
CI / typecheck (pull_request) Successful in 1m18s
CI / security (pull_request) Successful in 1m34s
CI / helm (pull_request) Successful in 54s
CI / push-validation (pull_request) Successful in 29s
CI / unit_tests (pull_request) Successful in 5m39s
CI / docker (pull_request) Successful in 1m37s
CI / integration_tests (pull_request) Successful in 9m40s
CI / coverage (pull_request) Successful in 12m19s
CI / status-check (pull_request) Successful in 4s
Applied ruff format to sliding_window_strategy.py and
sliding_window_strategy_steps.py to fix CI lint format check failure.

ISSUES CLOSED: #9995
2026-06-06 11:27:30 -04:00
HAL9000 e2d034c551 fix(context): export SlidingWindowStrategy from services __init__.py
The SlidingWindowStrategy class was implemented but not exported from the services package __init__.py, making it inaccessible to consumers. This fix adds the necessary import and lazy-load entry to make the strategy available for use in the ACMS pipeline.
2026-06-06 11:27:30 -04:00
HAL9000 79305dce63 feat(context): implement SlidingWindowStrategy with configurable window size
Implements SlidingWindowStrategy class that satisfies the ContextStrategy
protocol for the ACMS pipeline. The strategy limits token usage by keeping
only the most recent N messages or tokens in context, which is critical for
long-running agent sessions that would otherwise exceed LLM context limits.

Key features:
- Configurable window_size (int) and window_mode ('messages' | 'tokens')
- Messages mode: keeps the most recent window_size non-system fragments
- Tokens mode: keeps the most recent fragments within the token budget
- System prompt preservation: fragments with role='system' are always kept
- Registered in the plugin registry under key 'sliding_window'
- Input validation: window_size must be positive, window_mode must be valid
- Full BDD test coverage with 22 scenarios across all acceptance criteria

ISSUES CLOSED: #9995
2026-06-06 11:27:30 -04:00