Skip to content

API Reference parrot.flows.dev_loop.sdd_coder.complexity

github-actions[bot] edited this page Nov 5, 2026 · 4 revisions

parrot.flows.dev_loop.sdd_coder.complexity

View source

Deterministic complexity evaluation for SDD tasks (spec §2-§4).

Parses task contracts and evaluates deterministic complexity without invoking external tools or filesystem operations. Pure functions only; no I/O, no side effects.

Alias ComplexityAssessment

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityAssessment.

Alias ComplexityContract

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityContract.

Class ComplexityContractError

Raised when a task's complexity contract is invalid or malformed.

Parameter Type Default Description
message str
code str 'complexity_contract_invalid'
details Optional[Dict[str, object]] None

Attributes:

Attribute Type Description
code Error code identifying the specific contract violation.
details Additional diagnostic information about the error.

Alias ComplexityEvidence

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityEvidence.

Alias ComplexityPolicy

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityPolicy.

Alias ComplexityTarget

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.ComplexityTarget.

Alias MetricEvidence

Re-exported from parrot.flows.dev_loop.sdd_coder.complexity_models.MetricEvidence.

Function evaluate_complexity

Evaluate task complexity based on collected evidence and policy.

Uses only the six metric keys fixed by TASK-3286. Inclusive bands are 11/21, 10/30, 4/8, 2/3, 5/8, 2/5; hard triggers 21 cyclomatic, 30 blast, 5 descendants. Sum ≥5 is complex.

evaluate_complexity(evidence: ComplexityEvidence, policy: ComplexityPolicy) -> ComplexityAssessment

Parameter Type Default Description
evidence ComplexityEvidence Collected evidence for the task.
policy ComplexityPolicy Complexity policy to apply.

Returns: ComplexityAssessment — Complexity assessment with classification and scoring details.

Function parse_complexity_contract

Parse the complexity contract from a task's markdown text.

A task with NO '## Complexity Contract' section is a legacy task, not an invalid one (spec §2: "Legacy tasks without this section remain parseable but yield unknown symbol coverage and therefore require the complex-task route until upgraded" -- AC12). Its targets are read from the '## Files to Create / Modify' table every task already has, and contract_symbols is None (the explicit legacy/unknown-coverage marker, distinct from an empty list meaning "declared zero symbols").

parse_complexity_contract(task_text: str) -> ComplexityContract

Parameter Type Default Description
task_text str The full task markdown text.

Returns: ComplexityContract — The parsed ComplexityContract.

Raises:

  • ComplexityContractError — If a present Complexity Contract section is malformed.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally