Skip to the content.

Task 44 — Сложность и стоимость

Phase: 4 Initiative: 17 Status: done Owner: — Slug: complexity-router

Goal

Дешёвое детерминированное правило или маленький классификатор выбирает: direct skill / small model / large model / one peer / fan-out. Решения измеримы и конфигурируемы.

Acceptance criteria

Sub-tasks

Implementation notes

2026-08-13

src/agent/Mesh/Router/ComplexityLevel.cs — ComplexityLevel enum: Simple = 0, Moderate = 1, Complex = 2.

src/agent/Mesh/Router/ComplexityRoutingDecision.cs — ExecutionPath enum (6 values: LocalDirect through Blocked) and ComplexityRoutingDecision record with all decision metadata.

src/agent/Mesh/Router/ComplexityIntentAnalysis.cs — analysis model with keywords, safety flags, complexity score.

src/agent/Mesh/Router/ComplexityClassifier.cs — rule-based classifier:

src/agent/Mesh/Router/ComplexityRouter.cs — IComplexityRouter + ComplexityRouter implementation:

src/agent/Mesh/Router/ComplexityRouterOptions.cs — full config with cost thresholds, fan-out limits, retry counts.

Config/AppConfig.cs — MeshConfig.ComplexityRouter { get; set; } = new().

MeshServiceExtensions.cs — DI: IComplexityClassifier → ComplexityClassifier, IComplexityRouter → ComplexityRouter.

tests/Phase4Tests/ComplexityRouterTests.cs — 23 unit tests covering: classifier scoring, threshold mapping, fast classification, complexity routing decisions, peer routing with registered peers, fan-out limits, disabled router, blocked budget, retry counts.

Validation:

Scope / Likely files

src/agent/Mesh/Router/ComplexityRouter.cs

Dependencies

Risks / Rollback

Сложность ML-классификатора; версия на rules + опциональный ML.