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
Metadata
Release files for iil-task-scorer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| iil_task_scorer-0.1.0.tar.gz | 8.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iil_task_scorer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.8 kB
Release files / iil_task_scorer-0.1.0.tar.gz
| Download URL | iil_task_scorer-0.1.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a58348b8d44d5f32baab60a34addaf3b9131e59790467977bf42784eed90969a
|
|
BLAKE2b-256 checksum How to use checksums |
9cc098b8f8ade0d5b2ce0fdf791cae1a9273680cece5161edb945a7321a85da6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / iil_task_scorer-0.1.0-py3-none-any.whl
| Download URL | iil_task_scorer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3eb48339c6dd497df51995a42d14210e9e37628d64cc513dbc7e921f968f165
|
|
BLAKE2b-256 checksum How to use checksums |
2b66f82e24ee2bb7cb2daa39ebd9d28a8936f432550fd4bc23e2eba3d52af476
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for iil-task-scorer 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.