flow-define
flow-define orchestrates multi-provider requirements scoping across Claude, Codex, and Gemini CLIs during the Double Diamond Define phase. Use this skill when transitioning from discovery to formalize technical requirements, business constraints, and project scope through structured consensus-building between different AI models, with mandatory cost transparency and state tracking before execution begins.
git clone --depth 1 https://github.com/nyldn/claude-octopus /tmp/flow-define && cp -r /tmp/flow-define/.claude/skills/flow-define ~/.claude/skills/flow-defineSKILL.md
{{PREAMBLE}}
## Pre-Definition: State Check
Before starting definition:
1. Read `.octo/STATE.md` to verify Discover phase complete
2. Update STATE.md:
- current_phase: 2
- phase_position: "Definition"
- status: "in_progress"
```bash
# Verify Discover phase is complete
if [[ -f ".octo/STATE.md" ]]; then
discover_status=$("${HOME}/.claude-octopus/plugin/scripts/octo-state.sh" get_phase_status 1)
if [[ "$discover_status" != "complete" ]]; then
echo "⚠️ Warning: Discover phase not marked complete. Consider running discovery first."
fi
fi
# Update state for Definition phase
"${HOME}/.claude-octopus/plugin/scripts/octo-state.sh" update_state \
--phase 2 \
--position "Definition" \
--status "in_progress"
```
---
## Execution Contract
This skill uses **ENFORCED execution mode**. You MUST follow this exact sequence.
### STEP 1: Display Visual Indicators
**MANDATORY: You MUST use the Bash tool to run this provider check BEFORE displaying the banner. Do NOT skip it. Do NOT assume availability.**
```bash
provider_check_output=$(bash "${HOME}/.claude-octopus/plugin/scripts/helpers/check-providers.sh")
provider_status_lines=$(printf '%s\n' "$provider_check_output" | awk '
/^PROVIDER_CHECK_START$/ { capture=1; next }
/^PROVIDER_CHECK_END$/ { capture=0 }
capture && /^[a-z0-9-]+:(available|missing|degraded)$/ { print }
')
if [[ -z "$provider_status_lines" ]]; then
echo "Provider availability check returned no usable status lines."
exit 1
fi
# Exclude providers intentionally disabled by environment, session, or global
# allowlist policy; show every allowed provider, including missing/degraded.
source "${HOME}/.claude-octopus/plugin/scripts/lib/provider-allowlist.sh"
provider_availability=""
available_provider_count=0
while IFS=: read -r provider status; do
octo_provider_allowed "$provider" || continue
case "$status" in
available)
provider_availability="${provider_availability}🟢 ${provider}: Available ✓"$'\n'
available_provider_count=$((available_provider_count + 1))
;;
degraded)
provider_availability="${provider_availability}🟠 ${provider}: Degraded ⚠"$'\n'
;;
missing)
provider_availability="${provider_availability}🔴 ${provider}: Missing/unavailable ✗"$'\n'
;;
esac
done <<< "$provider_status_lines"
if [[ "$available_provider_count" -eq 0 ]]; then
printf '%s' "$provider_availability"
echo "No external provider is available. Run /octo:setup and retry."
exit 1
fi
# Task status for the banner's Tasks line, if the session has one.
task_status=$("${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh" get-task-status 2>/dev/null || echo "")
```
List every provider the check reports, not only Claude. A banner showing one seat when several ran misrepresents what the user is paying for.
If `OCTO_ALLOWED_PROVIDERS` is set, treat it as the source of truth for which providers may participate. Providers filtered out by that allowlist are intentionally reported as unavailable; do not invoke or recommend them in the workflow.
**Display this banner BEFORE orchestrate.sh execution:**
```
🐙 **CLAUDE OCTOPUS ACTIVATED** - Multi-provider definition mode
🎯 Define Phase: [Brief description of what you're defining/scoping]
📋 Session: ${CLAUDE_SESSION_ID}
📝 Tasks: ${task_status}
Provider Availability:
${provider_availability}
🔵 Claude: Available ✓ - Consensus building and synthesis
💰 Estimated Cost: $0.01-0.05
⏱️ Estimated Time: 2-5 minutes
```
**DO NOT PROCEED TO STEP 2 until banner displayed.** The banner shows users which providers will run and what costs they'll incur — starting API calls without this visibility violates cost transparency.
---
### STEP 2: Read Prior State
**Before executing the workflow, read any prior context:**
```bash
# Initialize state if needed
"${HOME}/.claude-octopus/plugin/scripts/state-manager.sh" init_state
# Set current workflow
"${HOME}/.claude-octopus/plugin/scripts/state-manager.sh" set_current_workflow "flow-define" "define"
# Get prior decisions (if any)
prior_decisions=$("${HOME}/.claude-octopus/plugin/scripts/state-manager.sh" get_decisions "all")
# Get context from discover phase
discover_context=$("${HOME}/.claude-octopus/plugin/scripts/state-manager.sh" get_context "discover")
# Display what you found (if any)
if [[ "$discover_context" != "null" ]]; then
echo "📋 Building on discovery findings:"
echo " $discover_context"
fi
if [[ "$prior_decisions" != "[]" && "$prior_decisions" != "null" ]]; then
echo "📋 Respecting prior decisions:"
echo "$prior_decisions" | jq -r '.[] | " - \(.decision) (\(.phase)): \(.rationale)"'
fi
```
**This provides context from:**
- Discovery phase research (if completed)
- Prior architectural decisions
- User vision captured earlier
- If **claude-mem** is installed, its MCP tools (`search`, `timeline`, `get_observations`) are available — use them to find past decisions on similar topics
**DO NOT PROCEED TO STEP 3 until state read.**
---
### STEP 3: Phase Discussion — Capture User Vision
**Before executing expensive multi-AI orchestration, capture the user's vision to scope the work effectively.**
**Ask clarifying questions using AskUserQuestion:**
```
Use AskUserQuestion tool to ask:
1. **User Experience**
Question: "How should users interact with this feature?"
Header: "User Flow"
Options:
- label: "API-first (programmatic access)"
description: "Build API endpoints first, UI later"
- label: "UI-first (user-facing interface)"
description: "Build user interface first, API supports it"
- label: "Both simultaneously"
description: "Develop API and UI in parallel"
- label: "Not applicable"
description: "This feature doesn't have a user interaction"
2. **Implementation Approach**
Question: "What technical approach do you prefer?"
Header: "Approach"
Options:
- label: "Fastest to market"
description: "Prioritize speed, use existing libraries"
- label: "Backend architect. Delegate only when the user explicitly starts an Octopus workflow.
Cloud architect. Delegate only when the user explicitly starts an Octopus workflow.
Code reviewer. Delegate only when the user explicitly starts an Octopus workflow.
Database architect. Delegate only when the user explicitly starts an Octopus workflow.
Debugger. Delegate only when the user explicitly starts an Octopus workflow.
Documentation architect. Delegate only when the user explicitly starts an Octopus workflow.
Frontend developer. Delegate only when the user explicitly starts an Octopus workflow.
Performance engineer. Delegate only when the user explicitly starts an Octopus workflow.