Skip to main content

/when - Contextual Timing

Understand WHEN to use specific components and WHEN to choose alternatives.

System Prompt

EXECUTION DIRECTIVE: When /when is invoked, you MUST:

  1. IMMEDIATELY analyze the context and provide timing guidance
  2. Compare alternatives - never just say "use X", explain vs alternatives
  3. Detect gaps - if no clear answer, suggest how to close the gap
  4. Log unknowns - new use cases should be tracked for system evolution

Separation of Concerns

CommandResponsibility/when's Role
/whatWHAT exists/when: WHEN to look it up
/whichWHO for task/when: WHEN to use which
/howHOW to do/when: WHEN this approach fits
/whenTIMING/CONTEXTPrimary: contextual decisions

Usage

# When to use
/when use orchestrator # When is orchestrator appropriate?
/when use haiku vs sonnet # Model selection timing
/when use /agent vs Task() # CODITECT vs Claude Code

# When to avoid
/when avoid force-push # Anti-patterns and timing
/when avoid monolith agents # When NOT to do something

# Comparisons
/when orchestrator vs senior-architect # Compare two agents
/when /classify vs manual frontmatter # Compare approaches

Response Format

For /when use <component>

┌─────────────────────────────────────────────────────────────┐
│ WHEN TO USE: orchestrator │
├─────────────────────────────────────────────────────────────┤
│ USE WHEN │
│ ──────── │
│ ✅ Task requires multiple agents with dependencies │
│ ✅ Complex workflow with 3+ sequential steps │
│ ✅ Need progress tracking across subtasks │
│ ✅ Task spans multiple domains (dev + devops + security) │
│ │
│ AVOID WHEN │
│ ────────── │
│ ❌ Single-domain task (use specialized agent directly) │
│ ❌ Simple query or lookup (overhead not worth it) │
│ ❌ Real-time interaction needed (orchestration adds delay) │
│ │
│ ALTERNATIVES │
│ ──────────── │
│ • Single task → /which <task> (direct agent) │
│ • 2 sequential tasks → chain: /agent A then /agent B │
│ • Parallel independent → multiple Task() calls │
├─────────────────────────────────────────────────────────────┤
│ DECISION TREE │
│ ───────────── │
│ Task complexity? │
│ ├── Single domain → Use specialized agent │
│ ├── 2 domains, independent → Parallel agents │
│ ├── 2 domains, dependent → Sequential agents │
│ └── 3+ domains OR complex deps → orchestrator │
└─────────────────────────────────────────────────────────────┘

For /when <A> vs <B>

┌─────────────────────────────────────────────────────────────┐
│ WHEN: haiku vs sonnet │
├─────────────────────────────────────────────────────────────┤
│ USE HAIKU WHEN │
│ ────────────── │
│ ✅ Quick, straightforward tasks │
│ ✅ Simple code generation or edits │
│ ✅ High-volume, cost-sensitive operations │
│ ✅ Latency-critical interactions │
│ │
│ USE SONNET WHEN │
│ ─────────────── │
│ ✅ Complex reasoning required │
│ ✅ Multi-step problem solving │
│ ✅ Code review and analysis │
│ ✅ Architecture decisions │
│ │
│ USE OPUS WHEN │
│ ───────────── │
│ ✅ Most complex tasks │
│ ✅ Novel problem domains │
│ ✅ Critical decisions requiring highest accuracy │
├─────────────────────────────────────────────────────────────┤
│ QUICK REFERENCE │
│ ─────────────── │
│ Simple lookup/edit → haiku │
│ Standard development → sonnet │
│ Architecture/research → opus │
└─────────────────────────────────────────────────────────────┘

Gap Detection

When no clear answer exists:

┌─────────────────────────────────────────────────────────────┐
│ GAP DETECTED: /when use <unknown-scenario> │
├─────────────────────────────────────────────────────────────┤
│ No existing guidance found for this scenario. │
│ │
│ SUGGESTIONS TO CLOSE GAP │
│ ──────────────────────── │
│ 1. Check if similar scenario exists: │
│ /what --search "<keywords>" │
│ │
│ 2. Try general recommendation: │
│ /which <your task description> │
│ │
│ 3. Research best practices: │
│ /how best <topic> │
│ │
│ 4. If truly new use case, consider: │
│ • Document the scenario │
│ • Create ADR if architectural │
│ • Update /when guidance for future │
│ │
│ EVOLUTION TRACKING │
│ ───────────────── │
│ This gap has been logged for system evolution. │
│ File: context-storage/gap-tracking.jsonl │
└─────────────────────────────────────────────────────────────┘

Common When Questions

QuestionCommand
When haiku vs sonnet?/when haiku vs sonnet
When to use orchestrator?/when use orchestrator
When /agent vs Task()?/when /agent vs Task
When to avoid force-push?/when avoid force-push
When MoE vs manual?/when /classify vs manual

CommandPurpose
/whatWhat exists, capabilities
/whichBest tool for task
/howHow to accomplish
/whereLocation of components
/whyRationale and reasoning

Success Output

When timing guidance completes:

✅ COMMAND COMPLETE: /when
Query: <use|avoid|compare>
Component(s): <component-name(s)>
Guidance: USE WHEN / AVOID WHEN / ALTERNATIVES

Completion Checklist

Before marking complete:

  • Context analyzed
  • Use cases identified
  • Alternatives compared
  • Decision tree provided

Failure Indicators

This command has FAILED if:

  • ❌ Component not found
  • ❌ No timing guidance available
  • ❌ Gap not logged
  • ❌ No alternatives suggested

When NOT to Use

Do NOT use when:

  • Need component inventory (use /what)
  • Need task-to-agent matching (use /which)
  • Need how-to guidance (use /how)

Anti-Patterns (Avoid)

Anti-PatternProblemSolution
Ask without contextVague answerProvide specific scenario
Ignore alternativesMiss better optionsReview all timing guidance
Skip gap loggingLost learningLog unknown scenarios

Principles

This command embodies:

  • #3 Keep It Simple - Provides simplest decision path
  • #5 Eliminate Ambiguity - Clear timing guidance, no guesswork

Full Standard: CODITECT-STANDARD-AUTOMATION.md


Version: 1.0.0 | Created: 2026-01-03 | Author: CODITECT Team