Skip to main content

/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:

  1. IMMEDIATELY execute - no questions, no explanations first
  2. ALWAYS show full output from script/tool execution
  3. 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: true in 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

ArgumentTypeRequiredDefaultDescription
taskstringYes-Task description to analyze
--jsonflagNofalseOutput as JSON
--verboseflagNofalseInclude detailed breakdown
--recommendflagNotrueInclude 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:

  1. Parse Task Description

    • Extract the task text from arguments
    • Normalize to lowercase for keyword matching
  2. Detect Domains

    • Match keywords against 13 domain categories
    • Score domains by keyword overlap count
    • Return sorted by relevance
  3. Determine Complexity

    • Check for complexity indicator keywords
    • Consider domain count
    • Apply decision matrix
  4. Estimate Resources

    • Base estimate from complexity level
    • Adjust for domain count (+20% per domain)
    • Adjust for description length
  5. Recommend Agents

    • Map domains to specialized agents
    • Limit by complexity level
    • Return prioritized list
  6. Format Output

    • Display formatted table (default)
    • Or JSON if --json flag provided

</default_behavior>


Complexity Levels

LevelAgentsTool CallsTokensTypical Tasks
SIMPLE1<5~5KBug fixes, typos, single file changes
MODERATE2-35-15~15KFeature additions, integrations
COMPLEX4-615-30~50KFull implementations, refactors
RESEARCH5-1030+~100KStrategy briefs, comprehensive analysis

Domain Categories

DomainKeywordsExample Agents
researchanalyze, investigate, studymarket-researcher
architecturedesign, system, patternbackend-architect
implementationbuild, create, coderust-expert-developer
testingtest, verify, coveragetesting-specialist
documentationdocument, guide, readmedocumentation-librarian
securityaudit, vulnerability, authsecurity-specialist
performanceoptimize, scale, profileperformance-profiler
strategymarket, competitor, briefstrategy-brief-generator
databasesql, schema, migrationdatabase-architect
api_designendpoint, rest, graphqlbackend-api-security

Required Tools

ToolPurposeRequired
ReadAccess task descriptions from filesOptional
GrepSearch for domain keywords in codebaseOptional
GlobFind agent definitions for recommendationsYes

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)
  • Skill: skills/task-complexity-analysis/SKILL.md
  • Script: scripts/analyze-task-complexity.py
  • Used by: orchestrator, use-case-analyzer, workflow-orchestrator

Error Handling

ErrorCauseResolution
Empty taskNo description providedProvide task description
Too short<10 charactersProvide more detail
No domainsUnrecognized keywordsDefaults 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-PatternProblemSolution
Skip analysisWrong agent choiceAnalyze complex tasks
Ignore domainsMissing expertiseConsider all domains
UnderestimateResource shortageUse 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