Overview
TaskComplexity is a three-variant enum used by the pipeline to decide which blueprint to run. The classification happens in classify_task() using keyword matching and (for ambiguous cases) a Claude LLM call.
Defined in crates/magpie-core/src/pipeline.rs:94-102.
Enum Definition
Variants
Use Case: Documentation changes, typo fixes, renames, trivial edits.Blueprint:
build_main_blueprint() — single agent call with no CI integration inside the blueprint.Keywords: fix typo, update readme, fix docs, update changelog, rename, fix comment, fix spelling, fix whitespace, fix formatting, update licenseExample Tasks:- “Fix typo in README”
- “Update docs for new API”
- “Rename
old_functiontonew_function”
Use Case: New features, refactors, integrations, anything that needs tests.Blueprint:
build_tdd_blueprint() — structured TDD flow:- Scan repo
- Plan approach
- Write tests (expect fail)
- Verify tests fail (red phase)
- Implement feature
- Run tests (green phase)
- Lint check
add, implement, create, build, refactor, migrate, integrate, introduce, design, architect, extract, replace, rewrite, optimize, convertExample Tasks:- “Add health check endpoint”
- “Implement OAuth2 login”
- “Refactor database layer”
- “Integrate Stripe payments”
Use Case: Fixing bugs, crashes, errors, regressions, investigating broken behavior.Blueprint:
build_diagnostic_blueprint() — investigative flow:- Scan repo
- Investigate root cause (no file modifications)
- Plan targeted fix
- Write regression test (expect fail)
- Verify test fails
- Implement fix
- Run tests (expect pass)
- Lint check
fix bug, fix crash, fix error, fix panic, broken, not working, regression, debug, investigate, root cause, diagnoseExample Tasks:- “Fix crash when user uploads empty file”
- “Fix broken authentication after last deploy”
- “Investigate why CI is failing on main”
- “Fix panic in parser”
Classification Logic
Fromcrates/magpie-core/src/pipeline.rs:170-230:
Keyword Priority
- Simple keywords are checked first (“fix typo” → Simple, not BugFix)
- BugFix keywords next
- Standard keywords last
- If no match, call Claude (Tier 1) for classification
Claude Prompt (Tier 1)
For ambiguous tasks:Standard.
Blueprint Mapping
| Complexity | Blueprint | Key Characteristics |
|---|---|---|
| Simple | build_main_blueprint | Single agent call, no structured phases |
| Standard | build_tdd_blueprint | Plan → Write Tests → Verify Fail → Implement → Test → Lint |
| BugFix | build_diagnostic_blueprint | Investigate (read-only) → Plan → Test → Verify Fail → Fix → Test → Lint |
Usage Example
Manual Classification
Using Classification in Pipeline
Testing with Dry Run
Keyword Reference
SIMPLE_KEYWORDS
BUGFIX_KEYWORDS
STANDARD_KEYWORDS
Design Rationale
Why “Simple” First?
“Fix typo” contains “fix”, which is a BugFix keyword. But typo fixes are trivial docs changes, not bugs. By checking Simple keywords first, we ensure “fix typo” → Simple, not BugFix.Why Default to Standard?
When Claude fails to classify or returns an unexpected response, we default toStandard (TDD flow). This is the safest choice:
- Standard includes test writing, which catches regressions
- BugFix flow assumes broken behavior exists (may not be true)
- Simple flow has no safety net (no tests)
Why Three Tiers?
Magpie uses a two-tier LLM architecture:- Tier 1 (Claude CLI): Fast single-response text generation (classification, branch names, commit messages)
- Tier 2 (Goose agent): Full streaming + tool use for all coding work
Notes
- Case Insensitive: Keywords are matched against
task.to_lowercase(). - Substring Match:
"fix typo in README"matches because it contains"fix typo". - Serialization:
TaskComplexityderivesSerialize/Deserializefor logging and telemetry. - Thread Safe:
Copytrait means no allocation, safe to pass by value.
See Also
- Blueprint — The orchestration structure selected based on complexity
- PipelineConfig — Pipeline configuration (includes
dry_runflag) - PipelineResult — Output from the pipeline after blueprint execution