From e05a5770903430826f876fa30a61459e31a63b63 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Sun, 5 Apr 2026 08:22:36 +0000 Subject: [PATCH] fix(acms): align DEFAULT_SKELETON_RATIO default value with spec Align all DEFAULT_SKELETON_RATIO / _DEFAULT_SKELETON_RATIO constants to the spec-required value of 0.15 (docs/specification.md line 35294). Previously three modules used divergent defaults: - skeleton_compressor.py: 0.3 (2x the spec value) - depth_breadth_projection.py: 0.2 (33% above spec) - project_context.py: 0.2 (33% above spec) This caused child plans to receive 2-3x more skeleton context than intended, and produced inconsistent behaviour depending on whether skeleton compression was invoked via the CLI or the service layer. Changes: - Set DEFAULT_SKELETON_RATIO = 0.15 in skeleton_compressor.py - Set DEFAULT_SKELETON_RATIO = 0.15 in depth_breadth_projection.py - Set _DEFAULT_SKELETON_RATIO = 0.15 in project_context.py - Update Behave feature tests to assert the 0.15 default value - Add new scenario to project_context_cov3.feature asserting _DEFAULT_SKELETON_RATIO == 0.15 in _default_acms_config() ISSUES CLOSED: #2909 --- features/depth_breadth_projection.feature | 2 +- features/project_context_cov3.feature | 5 +++++ features/skeleton_compressor.feature | 2 +- features/steps/project_context_cov3_steps.py | 12 ++++++++++++ .../application/services/depth_breadth_projection.py | 2 +- .../application/services/skeleton_compressor.py | 2 +- src/cleveragents/cli/commands/project_context.py | 2 +- 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/features/depth_breadth_projection.feature b/features/depth_breadth_projection.feature index 114ea5c79..9b75e8825 100644 --- a/features/depth_breadth_projection.feature +++ b/features/depth_breadth_projection.feature @@ -250,7 +250,7 @@ Feature: Depth/Breadth Projection System and Skeleton Context Propagation Scenario: PlanContextInheritance config uses default skeleton_ratio Given the depth/breadth projection modules are available When I create an InheritanceConfig with defaults - Then the inheritance config skeleton_ratio should be 0.2 + Then the inheritance config skeleton_ratio should be 0.15 @inheritance @skeleton Scenario: PlanContextInheritance extract_child_focus returns parent decisions diff --git a/features/project_context_cov3.feature b/features/project_context_cov3.feature index 8eac7b0de..62946960a 100644 --- a/features/project_context_cov3.feature +++ b/features/project_context_cov3.feature @@ -62,3 +62,8 @@ Feature: Project context coverage round 3 (pccov3) Then the pccov3 command should succeed And the pccov3 output should contain "Execution Environment" And the pccov3 output should contain "fallback" + + # --- _DEFAULT_SKELETON_RATIO spec alignment --- + Scenario: Default ACMS config skeleton_ratio matches spec value of 0.15 + When I pccov3 read the ACMS config for "local/pccov3-app" + Then the pccov3 ACMS config skeleton_ratio should be 0.15 diff --git a/features/skeleton_compressor.feature b/features/skeleton_compressor.feature index 793ad86aa..ba3df65f6 100644 --- a/features/skeleton_compressor.feature +++ b/features/skeleton_compressor.feature @@ -38,7 +38,7 @@ Feature: Skeleton compressor Scenario: Default ratio applied when None Given context fragments with total tokens 1000 When I compress with skeleton_ratio not specified - Then the metadata ratio should equal the default 0.3 + Then the metadata ratio should equal the default 0.15 # --- stable ordering -------------------------------------------------- diff --git a/features/steps/project_context_cov3_steps.py b/features/steps/project_context_cov3_steps.py index efbfc71a6..bdcc42274 100644 --- a/features/steps/project_context_cov3_steps.py +++ b/features/steps/project_context_cov3_steps.py @@ -438,3 +438,15 @@ def step_pccov3_assert_output_contains(context: Any, text: str) -> None: assert text in context.pccov3_output, ( f"Expected '{text}' in output, got: {context.pccov3_output!r}" ) + + +@then("the pccov3 ACMS config skeleton_ratio should be {expected:g}") +def step_pccov3_assert_skeleton_ratio(context: Any, expected: float) -> None: + from cleveragents.cli.commands.project_context import _DEFAULT_SKELETON_RATIO + + assert context.pccov3_acms["skeleton_ratio"] == expected, ( + f"Expected skeleton_ratio {expected}, got {context.pccov3_acms['skeleton_ratio']}" + ) + assert expected == _DEFAULT_SKELETON_RATIO, ( + f"_DEFAULT_SKELETON_RATIO is {_DEFAULT_SKELETON_RATIO}, expected {expected}" + ) diff --git a/src/cleveragents/application/services/depth_breadth_projection.py b/src/cleveragents/application/services/depth_breadth_projection.py index e7d271af6..f9c7abd14 100644 --- a/src/cleveragents/application/services/depth_breadth_projection.py +++ b/src/cleveragents/application/services/depth_breadth_projection.py @@ -48,7 +48,7 @@ logger = structlog.get_logger() # Constants # --------------------------------------------------------------------------- -DEFAULT_SKELETON_RATIO: float = 0.2 +DEFAULT_SKELETON_RATIO: float = 0.15 """Default fraction of child's token budget reserved for parent skeleton.""" EDGE_RELATIONS: tuple[str, ...] = ( diff --git a/src/cleveragents/application/services/skeleton_compressor.py b/src/cleveragents/application/services/skeleton_compressor.py index 8867e4873..07ce9cdc8 100644 --- a/src/cleveragents/application/services/skeleton_compressor.py +++ b/src/cleveragents/application/services/skeleton_compressor.py @@ -47,7 +47,7 @@ class CompressionResult: # --------------------------------------------------------------------------- # Default skeleton_ratio when the caller does not specify one. -DEFAULT_SKELETON_RATIO: float = 0.3 +DEFAULT_SKELETON_RATIO: float = 0.15 class SkeletonCompressorService: diff --git a/src/cleveragents/cli/commands/project_context.py b/src/cleveragents/cli/commands/project_context.py index 5df06680b..6f4204755 100644 --- a/src/cleveragents/cli/commands/project_context.py +++ b/src/cleveragents/cli/commands/project_context.py @@ -65,7 +65,7 @@ _DEFAULT_WARM_MAX_DECISIONS = 500 _DEFAULT_COLD_MAX_DECISIONS = 5000 _DEFAULT_BREADTH = 2 _DEFAULT_DEPTH = 3 -_DEFAULT_SKELETON_RATIO = 0.2 +_DEFAULT_SKELETON_RATIO = 0.15 _DEFAULT_BUDGET_TOKENS = 8000 -- 2.52.0