Shared scoring and routing engine for task complexity estimation
Project description
task-scorer
Shared scoring and routing engine for task complexity estimation.
Zero-dependency Python package that provides weighted multi-dimension keyword scoring with sigmoid confidence calibration. Consolidates scoring logic from BFAgent (TestRequirement, LLMRouter) and Orchestrator MCP (analyzer).
ADR: ADR-023 Shared Scoring and Routing Engine
Installation
# From git (recommended for Docker)
pip install "task-scorer @ git+ssh://git@github.com/achimdehnert/platform.git@main#subdirectory=packages/task_scorer"
# Local development
pip install -e ".[dev]"
Usage
from task_scorer import score_task, ScoringConfig, Tier
# With defaults
result = score_task("fix the authentication bug in the API")
print(result.top_type) # "security"
print(result.tier) # Tier.HIGH
print(result.confidence) # 0.87
print(result.signals) # ["security(auth)", "bug(fix)"]
print(result.is_ambiguous) # False
# With custom config (e.g. from DB lookup tables)
config = ScoringConfig(
keywords={"security": ["auth", "cve", "credential"]},
weights={"security": 2.0},
tier_boundaries=(0.5, 1.5),
)
result = score_task("check auth flow", config=config)
# With structured metadata
result = score_task(
"refactor the authentication module",
category="security",
acceptance_criteria_count=5,
files_affected=8,
)
API
score_task(description, config=None, category=None, acceptance_criteria_count=0, files_affected=0) -> ScoringResult
Main entry point. Scores a task description against all configured task types using weighted keyword matching.
ScoringResult
| Field | Type | Description |
|---|---|---|
scores |
dict[str, float] |
All type scores |
top_type |
str |
Highest scoring type |
tier |
Tier |
LOW / MEDIUM / HIGH |
confidence |
float |
Sigmoid confidence [0, 1] |
signals |
list[str] |
Debug signals |
is_ambiguous |
bool |
True if confidence < threshold |
raw_score |
float |
Winner's weighted score |
ScoringConfig
| Field | Type | Default | Description |
|---|---|---|---|
keywords |
dict[str, list[str]] |
10 types, 85 keywords | Task type keywords |
weights |
dict[str, float] |
0.5 - 1.5 | Type weight multipliers |
tier_boundaries |
tuple[float, float] |
(1.0, 4.0) | LOW/MEDIUM/HIGH boundaries |
confidence_steepness |
float |
8.0 | Sigmoid steepness |
confidence_threshold |
float |
0.65 | Ambiguity threshold |
Testing
cd packages/task_scorer
pip install -e ".[dev]"
python3 -m pytest tests/ -v
Architecture
src/task_scorer/
├── __init__.py # Public API exports
├── types.py # ScoringConfig, ScoringResult, Tier, DEFAULT_KEYWORDS
└── scorer.py # score_task, _score_all_types, _sigmoid_confidence
- Zero dependencies — stdlib only (math, dataclasses, enum)
- Frozen dataclasses — immutable config and results
- Config injection — defaults in code, DB-driven override via ScoringConfig
- Tenant-agnostic — pure function, no database access
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iil_task_scorer-0.1.0.tar.gz.
File metadata
- Download URL: iil_task_scorer-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a58348b8d44d5f32baab60a34addaf3b9131e59790467977bf42784eed90969a
|
|
| MD5 |
43d1c7d1dee5fce4b904de14404dff5a
|
|
| BLAKE2b-256 |
9cc098b8f8ade0d5b2ce0fdf791cae1a9273680cece5161edb945a7321a85da6
|
File details
Details for the file iil_task_scorer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iil_task_scorer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3eb48339c6dd497df51995a42d14210e9e37628d64cc513dbc7e921f968f165
|
|
| MD5 |
645a273cc5cfcb9081d2870d4d779264
|
|
| BLAKE2b-256 |
2b66f82e24ee2bb7cb2daa39ebd9d28a8936f432550fd4bc23e2eba3d52af476
|