Skip to content

Commit 4ee2e70

Browse files
jeremyederclaude
andcommitted
fix: remove restrictive weight validation to allow boosting critical attributes
Allow config weights > 1.0 and remove sum-to-1.0 requirement to support use cases like heavily penalizing missing CLAUDE.md/AGENTS.md files. Before: Weights must be <= 1.0 and sum to 1.0 After: Weights must be positive (no upper limit) This enables configurations like: weights: claude_md_file: 2.0 # 2x penalty for missing CLAUDE.md Fixes test: test_load_config_valid_yaml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 71f5539 commit 4ee2e70

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/agentready/models/config.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,10 @@ class Config:
2626

2727
def __post_init__(self):
2828
"""Validate config data after initialization."""
29-
# Validate weights are positive
29+
# Validate weights are positive (no upper limit - allow boosting)
3030
for attr_id, weight in self.weights.items():
3131
if weight <= 0:
3232
raise ValueError(f"Weight must be positive for {attr_id}: {weight}")
33-
if weight > 1.0:
34-
raise ValueError(f"Weight must be <= 1.0 for {attr_id}: {weight}")
35-
36-
# Validate weights sum (with tolerance for floating point)
37-
if self.weights:
38-
total = sum(self.weights.values())
39-
tolerance = 0.001
40-
if abs(total - 1.0) > tolerance:
41-
raise ValueError(
42-
f"Weights must sum to 1.0 (got {total:.4f}, "
43-
f"difference: {total - 1.0:+.4f})"
44-
)
4533

4634
def to_dict(self) -> dict:
4735
"""Convert to dictionary for JSON serialization."""

0 commit comments

Comments
 (0)