feat(context): register PriorityContextStrategy as built-in + update CHANGELOG
CI / push-validation (pull_request) Successful in 30s
CI / quality (pull_request) Successful in 58s
CI / helm (pull_request) Successful in 53s
CI / lint (pull_request) Successful in 1m0s
CI / build (pull_request) Successful in 55s
CI / typecheck (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m15s
CI / unit_tests (pull_request) Successful in 5m57s
CI / docker (pull_request) Successful in 1m44s
CI / integration_tests (pull_request) Successful in 8m58s
CI / coverage (pull_request) Successful in 9m58s
CI / status-check (pull_request) Successful in 4s

Registers PriorityContextStrategy in ACMSPipeline via the same lazy-import
pattern used for SemanticChunkingStrategy (issue #9996), resolving acceptance
criterion #5 from issue #9997: "Strategy is registered in the plugin registry
under key 'priority_context'".

Adds a lazy getter _get_priority_context_strategy_class() that avoids circular
imports, and registers the strategy inside ACMSPipeline.__init__ after the
semantic_chunking registration. The strategy is now available by default
without requiring a manual register_strategy() call.

Also adds the required CHANGELOG.md entry under [Unreleased].

ISSUES CLOSED: #9997
This commit is contained in:
2026-06-14 22:29:39 -04:00
parent 813a3ca2e6
commit eefa246195
2 changed files with 21 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ Changed `wf10_batch.robot` to be less likely to create files, and
`plan_generation_graph.robot` to give more test answers.
## [Unreleased]
- **feat(context): PriorityContextStrategy** (#9997 / PR #10772): Implements a priority-based context strategy that ranks context fragments by configurable priority scores — default role-based rules (system > tool > user > assistant), exponential recency decay (7-day half-life), and explicit priority tag boost. Supports custom scoring function injection and custom PriorityRule list injection. Registered in the ACMS pipeline under key `priority_context`. `PriorityRule` uses Pydantic `BaseModel` for architecture conformance. Includes 18 BDD scenarios covering all acceptance criteria.
- **fix(cli/plan): plan correct JSON output envelope fix and BDD test coverage** (#8584 / PR #8662): Restructured `agents plan correct --format json` output to nest correction fields under `data.correction` (e.g., `data.correction.mode`) and populate the spec-required CLI envelope with `command="plan correct"`, `status`, `exit_code`, `timing`, and `messages` fields. Added three BDD scenarios in `features/tdd_plan_correct_json_output.feature` validating the envelope structure for both revert and append modes.
- **fix(cli): add --url flag to resource add for git resource type** (#6322): Added support for the `--url` flag on `agents resource add git` command, allowing users to specify a remote URL for git resources. The flag is validated to only apply to git resource types. Includes Behave BDD tests in `features/resource_cli_git_url_flag.feature` and Robot Framework integration tests verifying correct URL validation and CLI behavior.
- **Session create JSON envelope** (#6441): Fixed `agents session create --format json` returning a flat `data` dict instead of the spec-required nested structure with `data.session`, `data.settings`, and `data.actor_details` sub-objects. The `command` field is now populated correctly. Extended JSON envelope coverage to `agents session list`, `show`, `delete --format json`, `export --output-format json`, and `import --format json` so all session commands emit a structured `messages[].text` field (`"0 sessions listed"`, `"Session details loaded"`, `"Session deleted"`, `"Export completed"`, `"Import completed"`).
@@ -74,6 +74,22 @@ def _get_semantic_chunking_strategy_class() -> type:
return _SemanticChunkingStrategy
# Lazy import helper for PriorityContextStrategy (issue #9997).
_PriorityContextStrategy: type | None = None
def _get_priority_context_strategy_class() -> type:
"""Return the :class:`PriorityContextStrategy` class, importing lazily."""
global _PriorityContextStrategy
if _PriorityContextStrategy is None:
from cleveragents.application.services.priority_context_strategy import (
PriorityContextStrategy,
)
_PriorityContextStrategy = PriorityContextStrategy
return _PriorityContextStrategy
_SPEC_BUILTIN_STRATEGIES: dict[str, Any] | None = None
@@ -815,6 +831,10 @@ class ACMSPipeline:
if "semantic_chunking" not in self._strategies:
_sc_cls = _get_semantic_chunking_strategy_class()
self._strategies["semantic_chunking"] = cast(ContextStrategy, _sc_cls())
# Register PriorityContextStrategy (issue #9997).
if "priority_context" not in self._strategies:
_pc_cls = _get_priority_context_strategy_class()
self._strategies["priority_context"] = cast(ContextStrategy, _pc_cls())
# Register the 6 spec-required built-in strategies via adapters.
# These strategies implement the domain-model ContextStrategy protocol
# (strategy_stubs.py) and are wrapped in SpecStrategyAdapter instances