feat(acms): context analysis produces meaningful summaries #1159
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveragents-core!1159
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/m5-context-analysis"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
M5 requires context analysis to produce meaningful, phase-aware summaries that explain what is included in assembled context and how budget/scoping decisions shape output. Existing checks validated policy wiring but did not provide actionable per-phase diagnostics.
Approach
This change adds a dedicated phase-analysis utility and integrates it into project-context inspect/simulate flows. It computes per-phase summaries from resolved policy views and scoped fragments, applies include/exclude and budget constraints, and reports strategize->execute->apply narrowing checks.
What Changed
analyze_phase_summaries(...)insrc/cleveragents/application/services/context_phase_analysis.py.fragment_count,resource_count,total_bytes,total_tokens,budget_used_ratio).resource_or_scope,path_rules,max_file_size,max_total_size).tokens_non_increasing,bytes_non_increasing,fragments_non_increasing,overall).agents project context inspectinsrc/cleveragents/cli/commands/project_context.py.phase_analysispayload.agents project context simulateinsrc/cleveragents/cli/commands/project_context.py.phase_analysispayload.robot/helper_m5_e2e_verification.py.features/project_context_phase_analysis.featurefeatures/steps/project_context_phase_analysis_steps.pyCHANGELOG.md(Unreleased) with #849 entry.Validation
Targeted scenarios:
python -m behave features/project_context_phase_analysis.featurepython -m behave features/project_context_cli.featurepython -m robot --test "ACMS Scoped Context Output Per Phase" robot/m5_e2e_verification.robotRequired nox sessions:
nox -e lintnox -e typechecknox -e unit_testsnox -e integration_testsnox -e coverage_reportnox -e e2e_testsCoverage remains above target (97.64%).
Closes #849
ca3291ad9a235f159fb1235f159fb1397548cb15397548cb15e258c212bbe258c212bbff1ba6f482Review: feat(acms): context analysis produces meaningful summaries
Approved with minor suggestions.
Suggestions
1. Weak assertion chains (Low)
Some assertions are too permissive:
This matches almost any output containing common English words. Consider asserting on structured output (e.g.,
--format json).2. Missing negative test (Low)
No scenario tests
context addwith a non-existent path (patch.object(Path, "exists", return_value=True)always returns true).What's Good
_mock_containerhelper factored for reuse across all steps.get_container— correct DI interception point.CliRunnerfrom typer for CLI invocation — standard pattern.Review: APPROVED
Clean 165-line module — good modular design. Phase-aware summaries with monotonic narrowing verification is well-implemented. Robot helper type annotation fixes are tangential but minor.
Good BDD coverage with 4 scenarios covering empty, single, multiple, and budget-constrained contexts.
New commits pushed, approval review dismissed automatically according to repository settings
Addressed the remaining review suggestions on this PR.
agents context showsmoke assertion to verify the exact summary header, file count, total size, and usage hint instead of matching broad keywords.agents context addand asserted that the CLI reports the missing path without calling the context service.88b5e293.Validation run:
TEST_PROCESSES=9 nox -e lintTEST_PROCESSES=9 nox -e typecheckTEST_PROCESSES=9 nox -e unit_tests -- features/m5_acms_smoke.featureTEST_PROCESSES=9 nox -e unit_testsTEST_PROCESSES=9 nox -e integration_testsTEST_PROCESSES=9 nox -e coverage_reportTEST_PROCESSES=9 nox -e e2e_testsstill reports unrelated existing failures in the M1/M2 acceptance suites (CleverAgents command failed with rc=1); the M5 acceptance suite passed.88b5e2939cef8f9640faFixed all the minor suggestions, already approved, merging it now