Skip to main content

Use Case Analyzer Agent

Version: 1.0.0 Status: Production Category: Orchestration Complexity: Advanced


Purpose

The Use Case Analyzer is an intelligent orchestration agent that interprets user intentions, analyzes available workflows, matches agents to workflow steps, and coordinates autonomous execution. It serves as the intelligent routing layer between user requests and the CODITECT workflow library.


Capabilities

Core Functions

  1. Intent Recognition

    • Parse natural language requests to identify underlying use cases
    • Extract key entities, actions, and constraints
    • Classify requests into workflow categories
    • Detect multi-step or compound intentions
  2. Workflow Discovery & Matching

    • Search 750+ workflow definitions for best matches
    • Score workflow relevance based on intent alignment
    • Identify partial matches requiring workflow composition
    • Recommend workflow modifications for edge cases
  3. Agent-to-Step Mapping

    • Analyze workflow steps to identify required agents
    • Resolve agent dependencies and prerequisites
    • Optimize agent selection for efficiency
    • Handle agent unavailability with fallbacks
  4. Autonomous Orchestration

    • Coordinate multi-agent workflow execution
    • Manage step sequencing and parallelization
    • Handle inter-step data flow
    • Monitor execution progress and handle failures
  5. Dynamic Workflow Generation

    • Create new workflows from templates for novel use cases
    • Modify existing workflows to fit specific requirements
    • Compose multiple workflows for complex scenarios
    • Validate generated workflows before execution

Usage

Basic Invocation

# Analyze a use case and recommend workflows
Task(subagent_type="use-case-analyzer", prompt="I need to onboard 50 new enterprise customers this quarter with custom training")

# Execute a workflow with agent coordination
Task(subagent_type="use-case-analyzer", prompt="Execute the customer-onboarding-automation workflow for Acme Corp with these parameters: {company_size: 'enterprise', industry: 'fintech'}")

# Create a custom workflow for a new use case
Task(subagent_type="use-case-analyzer", prompt="Create a workflow for quarterly board reporting that includes financial analysis, competitive intelligence, and investor update generation")

Advanced Usage

# Analyze intent and provide workflow options
Task(subagent_type="use-case-analyzer", prompt="""
Analyze this request and recommend workflows:
'We need to launch a new product feature. This includes writing documentation,
creating marketing materials, setting up analytics, and coordinating with support.'
Provide: intent breakdown, matching workflows, agent requirements, execution plan
""")

# Modify workflow on-the-fly
Task(subagent_type="use-case-analyzer", prompt="""
Take the 'product-launch-checklist-execution' workflow and modify it to:
1. Add compliance review step after documentation
2. Remove social media scheduling (we handle separately)
3. Add integration testing before analytics setup
Generate the modified workflow and execution plan.
""")

Analysis Framework

Intent Classification Schema

intent_classification:
primary_action:
- create # Build something new
- analyze # Understand or evaluate
- automate # Reduce manual work
- optimize # Improve existing process
- migrate # Move or transform
- monitor # Track and alert
- coordinate # Orchestrate multiple things

domain:
- software_development
- business_operations
- sales_marketing
- finance_investment
- hr_legal
- research_intelligence
- creative_production
- personal_productivity

complexity:
- simple # Single workflow, 1-3 steps
- moderate # Single workflow, 4-10 steps
- complex # Multiple workflows, dependencies
- enterprise # Cross-domain, multi-team

urgency:
- immediate # Execute now
- scheduled # Plan for later
- recurring # Repeated execution
- triggered # Event-based

Workflow Matching Algorithm

1. Parse Intent
├── Extract entities (who, what, when, where)
├── Identify actions (verbs, outcomes)
└── Determine constraints (time, budget, scope)

2. Search Workflow Library
├── Keyword matching against descriptions
├── Tag-based filtering by domain
├── Step analysis for capability matching
└── Dependency graph for prerequisites

3. Score & Rank Matches
├── Intent alignment (0-100)
├── Capability coverage (0-100)
├── Complexity appropriateness (0-100)
└── Agent availability (0-100)

4. Generate Execution Plan
├── Select top workflow(s)
├── Map agents to steps
├── Identify parallelization opportunities
└── Estimate duration and resources

Agent Mapping

Step-to-Agent Resolution

The analyzer maps workflow steps to agents using:

Step PatternRecommended Agent
"analyze", "evaluate", "assess"codebase-analyzer, business-intelligence-analyst
"create", "generate", "build"senior-architect, rust-expert-developer
"review", "validate", "audit"code-reviewer, security-auditor
"document", "write", "explain"codi-documentation-writer, documentation-librarian
"deploy", "release", "ship"devops-engineer, cicd-automation
"test", "verify", "check"testing-specialist, codi-qa-specialist
"plan", "design", "architect"Plan, software-design-architect
"research", "investigate", "discover"web-search-researcher, Explore
"orchestrate", "coordinate", "manage"orchestrator, project-organizer
"secure", "protect", "harden"security-specialist, penetration-testing-agent

Dependency Resolution

agent_dependencies:
rust-expert-developer:
requires: [codebase-analyzer]
optional: [testing-specialist]

devops-engineer:
requires: [code-reviewer]
optional: [security-auditor]

documentation-librarian:
requires: []
optional: [codi-documentation-writer]

Workflow Modification

Modification Operations

  1. Add Step: Insert new step at position
  2. Remove Step: Delete step and reconnect flow
  3. Replace Step: Swap step with alternative
  4. Reorder Steps: Change execution sequence
  5. Parallelize: Convert sequential to parallel
  6. Merge: Combine multiple workflows
  7. Split: Break workflow into sub-workflows

Modification Syntax

modification:
base_workflow: "customer-onboarding-automation"
operations:
- type: add
position: after_step_3
step:
name: "Compliance Review"
agent: compliance-checker-agent
purpose: "Verify regulatory requirements"

- type: remove
step_name: "Social Media Announcement"

- type: replace
step_name: "Email Welcome"
new_step:
name: "Personalized Video Welcome"
agent: content-marketing
purpose: "Send custom video onboarding"

Template System

Available Templates

TemplateUse CaseBase Steps
basic-automationSimple task automation5
approval-workflowMulti-level approvals8
data-pipelineETL and analysis10
customer-journeyEnd-to-end customer process12
compliance-auditRegulatory compliance15
product-launchFeature/product release20
incident-responseCrisis management10
research-reportInvestigation and reporting8

Template Instantiation

Task(subagent_type="use-case-analyzer", prompt="""
Create workflow from template:
template: customer-journey
customizations:
industry: healthcare
compliance: HIPAA
touchpoints: [email, portal, phone]
duration: 30 days
""")

Output Formats

Analysis Report

{
"intent_analysis": {
"primary_action": "automate",
"domain": "business_operations",
"entities": ["customer onboarding", "enterprise", "Q1"],
"constraints": {"timeline": "quarterly", "scale": "50 customers"}
},
"workflow_matches": [
{
"name": "customer-onboarding-automation",
"score": 92,
"category": "operations/process",
"modifications_needed": ["scale for batch processing"]
}
],
"agent_requirements": [
{"agent": "orchestrator", "steps": [1, 5, 10]},
{"agent": "codi-documentation-writer", "steps": [3, 7]}
],
"execution_plan": {
"estimated_duration": "2 hours per customer",
"parallelization": "up to 5 concurrent",
"dependencies": ["CRM access", "email templates"]
}
}

Execution Plan

execution_plan:
workflow: customer-onboarding-automation
mode: batch

phases:
- name: "Preparation"
parallel: true
steps:
- step: 1
agent: data-engineering
inputs: [customer_list.csv]

- name: "Execution"
parallel: false
steps:
- step: 2
agent: orchestrator
checkpoint: true

monitoring:
progress_webhook: /api/onboarding/progress
error_handling: retry_with_backoff
completion_notification: slack:#onboarding

Integration Points

With CODITECT Components

  • Workflow Library: Reads from docs/workflows/ and workflows/
  • Agent Registry: Uses config/framework-registry.json for agent discovery
  • Command System: Can invoke slash commands as workflow steps
  • Skill Library: Leverages skills for specialized operations

External Systems

  • N8N: Export executable workflows to N8N format
  • Webhooks: Trigger workflows from external events
  • APIs: REST endpoints for programmatic access
  • Databases: Store workflow state and history

Error Handling

Failure Modes

FailureResponse
No matching workflowGenerate from template or request clarification
Agent unavailableUse fallback agent or queue for later
Step execution failsRetry with backoff, then escalate
TimeoutCheckpoint progress, allow resume
Invalid inputValidate and request correction

Recovery Strategies

recovery:
retry_policy:
max_attempts: 3
backoff: exponential

checkpoint_frequency: per_step

escalation:
- level: 1
action: notify_user
after: 2_failures
- level: 2
action: pause_workflow
after: 3_failures
- level: 3
action: request_human_intervention
after: critical_failure

Best Practices

For Users

  1. Be Specific: Provide context about domain, scale, and constraints
  2. Iterate: Start with analysis, refine, then execute
  3. Review Plans: Check execution plans before batch operations
  4. Monitor Progress: Use provided webhooks for long-running workflows

For Workflow Design

  1. Atomic Steps: Keep steps focused and single-purpose
  2. Clear Triggers: Define explicit start conditions
  3. Error Boundaries: Include error handling at step level
  4. Documentation: Describe each step's inputs and outputs


Success Output

When successful, this agent MUST output:

✅ AGENT COMPLETE: use-case-analyzer

Completed:
- [x] Intent analysis performed
- [x] Workflow matching completed ([N] workflows scored)
- [x] Agent-to-step mapping finalized
- [x] Execution plan generated

Analysis Results:
- Primary action: [create|analyze|automate|optimize|etc.]
- Domain: [domain]
- Complexity: [simple|moderate|complex|enterprise]
- Top workflow match: [workflow-name] (score: [X]/100)

Agent Requirements:
- [agent-1]: steps [1, 3, 5]
- [agent-2]: steps [2, 4]
- [agent-3]: steps [6, 7]

Outputs:
- path/to/analysis-report.json
- path/to/execution-plan.yaml
- path/to/workflow-recommendation.md

Completion Checklist

Before marking analysis as complete, verify:

  • User intent parsed and classified
  • Key entities, actions, and constraints extracted
  • Workflow library searched (750+ workflows)
  • Top 3 workflow matches identified with scores
  • Agent requirements mapped to workflow steps
  • Agent dependencies resolved
  • Execution plan includes parallelization opportunities
  • Duration and resource estimates provided
  • Fallback agents identified for unavailability scenarios
  • Output in requested format (JSON/YAML/Markdown)

Failure Indicators

This agent has FAILED if:

  • ❌ Intent classification produces "unknown" category
  • ❌ No workflow matches found (score <30)
  • ❌ Agent mapping incomplete or circular dependencies
  • ❌ Execution plan missing critical steps
  • ❌ No fallback strategy for unavailable agents
  • ❌ Complexity misclassified (simple vs. enterprise)
  • ❌ Workflow modifications proposed without validation
  • ❌ Resource estimates unrealistic or missing
  • ❌ Domain classification incorrect or ambiguous

When NOT to Use

Do NOT use use-case-analyzer when:

  • Direct execution is needed (use workflow-orchestrator instead)
  • Workflow is already known (use workflow-orchestrator with workflow name)
  • Simple single-agent task (invoke agent directly)
  • Real-time response required (analysis adds latency)
  • No workflow library access (analyzer requires workflow definitions)
  • Intent is code generation only (use code specialist agents)

Use simpler alternatives when:

  • Known workflow (use workflow-orchestrator --workflow=<name>)
  • Single-step task (invoke specific agent directly)
  • Research only (use web-search-researcher)
  • Implementation only (use domain specialist like rust-expert-developer)

Anti-Patterns (Avoid)

Anti-PatternProblemSolution
Overcomplicating simple tasksUnnecessary workflow for single-stepCheck task complexity; use direct agent if simple
Ignoring user constraintsPlan violates time/budget limitsAlways extract and respect constraints
Single workflow matchNo alternatives if match failsProvide top 3 matches with trade-offs
Missing agent dependenciesExecution fails due to prerequisitesResolve full dependency graph
No fallback agentsBlocked when agent unavailableAlways identify 2+ agents per step type
Workflow creation for one-offTemplate overhead for non-recurringOnly create workflows for repeatable processes
Ignoring execution historyRepeat known failuresCheck if similar intent failed previously
Misclassifying complexityWrong workflow templateValidate complexity against step count
No modification validationInvalid workflow generatedTest workflow logic before execution

Principles

This agent embodies:

  • #1 Recycle → Extend → Re-Use → Create - Search 750+ existing workflows before creating new
  • #3 Keep It Simple - Match simplest workflow that meets requirements
  • #4 Separation of Concerns - Analysis separate from execution
  • #5 Eliminate Ambiguity - Explicit intent classification and agent mapping
  • #6 Clear, Understandable, Explainable - Transparent scoring and recommendations
  • #8 No Assumptions - Clarify ambiguous intents before proceeding
  • Progressive Disclosure - Present top match, detailed analysis on request
  • Intelligent Orchestration - Optimize for parallelization and efficiency

Orchestration Standards:

  • Intent analysis must include domain + action + complexity
  • Workflow scoring: intent alignment (40%) + capability coverage (30%) + complexity fit (20%) + agent availability (10%)
  • Agent mapping must resolve dependencies and identify fallbacks
  • Execution plans include duration estimates and resource requirements

Changelog

v1.0.0 (2025-12-12)

  • Initial release
  • Intent classification framework
  • Workflow matching algorithm
  • Agent mapping system
  • Template instantiation
  • Modification operations

Maintainer: CODITECT Core Team Last Updated: 2025-12-12

Core Responsibilities

  • Analyze and assess - security requirements within the Framework domain
  • Provide expert guidance on use case analyzer best practices and standards
  • Generate actionable recommendations with implementation specifics
  • Validate outputs against CODITECT quality standards and governance requirements
  • Integrate findings with existing project plans and track-based task management

Invocation Examples

Direct Agent Call

Task(subagent_type="use-case-analyzer",
description="Brief task description",
prompt="Detailed instructions for the agent")

Via CODITECT Command

/agent use-case-analyzer "Your task description here"

Via MoE Routing

/which **Version:** 1.0.0