/analyze-complexity Command
Analyze a task description to determine its complexity level, domains, estimated resources, and recommended agents for execution.
System Prompt
⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:
- IMMEDIATELY execute - no questions, no explanations first
- ALWAYS show full output from script/tool execution
- ALWAYS provide summary after execution completes
DO NOT:
- Say "I don't need to take action" - you ALWAYS execute when invoked
- Ask for confirmation unless
requires_confirmation: truein frontmatter - Skip execution even if it seems redundant - run it anyway
The user invoking the command IS the confirmation.
Usage
# Basic usage
/analyze-complexity "Build a REST API with authentication"
# With format option
/analyze-complexity --json "Create a strategy brief for AI tools market"
# Verbose output
/analyze-complexity --verbose "Implement end-to-end testing with coverage"
Arguments
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
task | string | Yes | - | Task description to analyze |
--json | flag | No | false | Output as JSON |
--verbose | flag | No | false | Include detailed breakdown |
--recommend | flag | No | true | Include agent recommendations |
Output
Standard Output
╔══════════════════════════════════════════════════════════════╗
║ TASK COMPLEXITY ANALYSIS ║
╠══════════════════════════════════════════════════════════════╣
║ Task: Build a REST API with authentication ║
╠══════════════════════════════════════════════════════════════╣
║ Complexity: MODERATE ║
║ Confidence: 85% ║
╠══════════════════════════════════════════════════════════════╣
║ Domains: api_design, security, implementation ║
║ Keywords: api, build, authentication ║
╠══════════════════════════════════════════════════════════════╣
║ RESOURCE ESTIMATES ║
║ ├─ Tokens: ~18,000 ║
║ ├─ Tool Calls: ~12 ║
║ └─ Duration: 1-3 min ║
╠══════════════════════════════════════════════════════════════╣
║ EXECUTION ║
║ ├─ Parallel: No ║
║ └─ State Mgmt: No ║
╠══════════════════════════════════════════════════════════════╣
║ RECOMMENDED AGENTS ║
║ 1. backend-api-security ║
║ 2. actix-web-specialist ║
║ 3. security-specialist ║
╚══════════════════════════════════════════════════════════════╝
JSON Output (--json)
{
"complexity": "moderate",
"confidence": 0.85,
"domains": ["api_design", "security", "implementation"],
"trigger_keywords": ["api", "build", "authentication"],
"estimated_tokens": 18000,
"estimated_tool_calls": 12,
"parallel_capable": false,
"requires_state_management": false,
"recommended_agents": [
"backend-api-security",
"actix-web-specialist",
"security-specialist"
]
}
Examples
Simple Task
/analyze-complexity "Fix a typo in the README"
Output:
Complexity: SIMPLE
Domains: documentation
Tokens: ~5,000
Agents: codi-documentation-writer
Complex Multi-Domain Task
/analyze-complexity "Build a production-ready microservices architecture with API gateway, authentication, database integration, comprehensive tests, and deployment pipeline"
Output:
Complexity: COMPLEX
Domains: architecture, api_design, security, database, testing, implementation
Tokens: ~72,000
Agents: backend-architect, backend-api-security, database-architect,
testing-specialist, devops-engineer, senior-architect
Parallel: Yes (research phases)
State Mgmt: Yes (multi-agent coordination)
Research Task
/analyze-complexity "Conduct comprehensive market research on the AI development tools industry including competitor analysis, trend forecasting, and strategic recommendations"
Output:
Complexity: RESEARCH
Domains: strategy, research
Tokens: ~120,000
Agents: strategy-brief-generator, market-researcher, competitive-analyst,
trend-analyst, business-intelligence-analyst
Parallel: Yes
State Mgmt: Yes
Action Policy
<default_behavior>
When /analyze-complexity is invoked:
-
Parse Task Description
- Extract the task text from arguments
- Normalize to lowercase for keyword matching
-
Detect Domains
- Match keywords against 13 domain categories
- Score domains by keyword overlap count
- Return sorted by relevance
-
Determine Complexity
- Check for complexity indicator keywords
- Consider domain count
- Apply decision matrix
-
Estimate Resources
- Base estimate from complexity level
- Adjust for domain count (+20% per domain)
- Adjust for description length
-
Recommend Agents
- Map domains to specialized agents
- Limit by complexity level
- Return prioritized list
-
Format Output
- Display formatted table (default)
- Or JSON if --json flag provided
</default_behavior>
Complexity Levels
| Level | Agents | Tool Calls | Tokens | Typical Tasks |
|---|---|---|---|---|
| SIMPLE | 1 | <5 | ~5K | Bug fixes, typos, single file changes |
| MODERATE | 2-3 | 5-15 | ~15K | Feature additions, integrations |
| COMPLEX | 4-6 | 15-30 | ~50K | Full implementations, refactors |
| RESEARCH | 5-10 | 30+ | ~100K | Strategy briefs, comprehensive analysis |
Domain Categories
| Domain | Keywords | Example Agents |
|---|---|---|
research | analyze, investigate, study | market-researcher |
architecture | design, system, pattern | backend-architect |
implementation | build, create, code | rust-expert-developer |
testing | test, verify, coverage | testing-specialist |
documentation | document, guide, readme | documentation-librarian |
security | audit, vulnerability, auth | security-specialist |
performance | optimize, scale, profile | performance-profiler |
strategy | market, competitor, brief | strategy-brief-generator |
database | sql, schema, migration | database-architect |
api_design | endpoint, rest, graphql | backend-api-security |
Required Tools
| Tool | Purpose | Required |
|---|---|---|
Read | Access task descriptions from files | Optional |
Grep | Search for domain keywords in codebase | Optional |
Glob | Find agent definitions for recommendations | Yes |
Note: This command primarily uses internal analysis without external tools.
Output Validation
Before marking complete, verify output contains:
- Complexity level (SIMPLE, MODERATE, COMPLEX, RESEARCH)
- Confidence score (percentage)
- At least 1 detected domain
- Token estimate (numeric)
- At least 1 recommended agent
- Formatted output (table or JSON)
Related Components
- Skill:
skills/task-complexity-analysis/SKILL.md - Script:
scripts/analyze-task-complexity.py - Used by:
orchestrator,use-case-analyzer,workflow-orchestrator
Error Handling
| Error | Cause | Resolution |
|---|---|---|
| Empty task | No description provided | Provide task description |
| Too short | <10 characters | Provide more detail |
| No domains | Unrecognized keywords | Defaults to implementation |
Success Output
When complexity analysis completes:
✅ COMMAND COMPLETE: /analyze-complexity
Task: <summarized task>
Complexity: <SIMPLE|MODERATE|COMPLEX|RESEARCH>
Domains: N detected
Agents: X recommended
Tokens: ~Y estimated
Completion Checklist
Before marking complete:
- Task description parsed
- Domains detected
- Complexity level determined
- Resources estimated
- Agents recommended
Failure Indicators
This command has FAILED if:
- ❌ Empty task description
- ❌ Task too short (<10 chars)
- ❌ No complexity determined
- ❌ No output displayed
When NOT to Use
Do NOT use when:
- Task already simple and clear
- Already know the agent needed
- Just want to execute (use /action)
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Skip analysis | Wrong agent choice | Analyze complex tasks |
| Ignore domains | Missing expertise | Consider all domains |
| Underestimate | Resource shortage | Use estimates + buffer |
Principles
This command embodies:
- #9 Based on Facts - Keyword-based analysis
- #2 Search Before Create - Find right agents
- #6 Clear, Understandable - Structured output
Full Standard: CODITECT-STANDARD-AUTOMATION.md
Created: December 21, 2025 Compliance: CODITECT-STANDARD-COMMANDS v1.0