ask
The ask command queries multiple AI agents (Gemini, OpenAI, Grok, Perplexity) to gather diverse perspectives on complex technical decisions. Use it when choosing between competing approaches like databases or frameworks, stuck after multiple failed debugging attempts, evaluating build-versus-buy decisions, or weighing security, performance, and maintainability tradeoffs. Do not use for straightforward implementation tasks or questions with clear single answers.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/hex/claude-council/HEAD/commands/ask.md -o ~/.claude/commands/ask.mdask.md
Query the council of AI coding agents to gather diverse perspectives.
## Progress Tracking
Create a task at the start to show progress throughout the query:
```
TaskCreate:
subject: "Query council"
description: "Querying AI providers for diverse perspectives"
activeForm: "Preparing council query..."
TaskUpdate: status → in_progress
```
Update `activeForm` as you progress through phases:
- `"Gathering context..."` - during auto-context detection
- `"Querying council providers..."` - during query-council.sh execution
- `"Formatting responses..."` - during format-output.sh execution
- `"Synthesizing recommendations..."` - during synthesis generation
Mark `status → completed` when finished.
## Step 0: Local Mode & Provider Availability
Decide up front whether this is a local (Claude-only) council run, before asking
any provider questions:
1. **If `--local` is in $ARGUMENTS → local mode.** Skip the provider and agent
questions and go straight to "If Local Mode is Active" in Step 2. Local mode
honors `--roles`, `--file`, `--verbosity`, `--quiet`, and auto-context; it
ignores `--providers`, `--debate`, `--agents`, and `--async`. When `--roles`
is not passed, the local-council skill asks the user how many members to
convene before spawning them.
2. **Otherwise, check what providers are configured:**
```bash
bash ${CLAUDE_PLUGIN_ROOT}/scripts/query-council.sh --list-default 2>&1 | head -1
```
- If this lists one or more providers → continue with the normal flow below.
- If it is empty or reports `No providers configured` → do NOT hard-fail.
Offer the local council:
```
AskUserQuestion:
Question: "No AI providers are configured. Run a local council instead? It's several Claude subagents, each playing a different role — independent angles, but same-model, not cross-vendor."
Header: "No providers"
Options:
- "Run local council (Recommended) - independent Claude perspectives, no API keys needed"
- "How to add a provider - show what to configure for a real cross-vendor council"
- "Cancel"
```
- "Run local council" → local mode (Step 2).
- "How to add a provider" → show the setup hint (set an API key, or install
the `codex` / `gemini` CLI; `/claude-council:status` shows what's
available) and stop.
- "Cancel" → stop.
**Never pass `--local` to query-council.sh or run-council.sh** — it is a
command-layer flag with no meaning to those scripts. Strip it from $ARGUMENTS
before constructing any script invocation.
## Pre-Query Interaction
Before querying, use AskUserQuestion in these scenarios:
### 1. Provider Selection + Verbosity (if --providers and --verbosity not specified)
First, discover the providers that would be queried by default (post CLI-prefers-API policy — `--list-default` is the right flag here, NOT `--list-available`, which includes shadowed API siblings that won't run by default):
```bash
bash ${CLAUDE_PLUGIN_ROOT}/scripts/query-council.sh --list-default 2>&1 | head -1
```
**Only show default-queried providers in the question.** If only 1 provider is available, skip the provider question and use it directly. If the user wants a shadowed API provider (e.g., `openai` when codex is installed), they can pass `--providers=openai` explicitly.
**The first option of the providers question must be "All providers" (Recommended)** — this is the most common choice and saves the user from clicking each provider individually. If the user picks it, treat it as selecting every available provider.
**Combine providers + verbosity into a single AskUserQuestion call** (it supports multiple questions per call) so the user resolves both decisions in one screen instead of two:
```
Question 1: "Which AI providers should I consult?"
Header: "Providers"
multiSelect: true
Options:
- All providers (Recommended) - query every configured provider in parallel
- Gemini (gemini-3.1-pro-preview) - Google's reasoning model
- OpenAI (gpt-5.5-pro) - OpenAI's reasoning model
- Grok (grok-4.20-reasoning) - xAI's reasoning model
- Perplexity (sonar-reasoning-pro) - search-augmented reasoning
Question 2: "How verbose should the responses be?"
Header: "Verbosity"
multiSelect: false
Options:
- Standard (Recommended) - balanced thoroughness
- Brief - 3-5 sentences, bullets only, no code unless asked
- Detailed - thorough analysis with code examples and trade-offs
```
When the providers list exceeds 4 options ("All" + N providers), AskUserQuestion's 4-option limit forces a different shape — collapse to "All / Fast subset / Custom" presets.
**Skip the verbosity question if `--verbosity` was passed** explicitly. Skip the providers question if `--providers` was passed. Resolve both via flags when both are present.
Map the verbosity selection to the `--verbosity` flag passed to query-council.sh:
- "Standard" → omit the flag (default)
- "Brief" → `--verbosity=brief`
- "Detailed" → `--verbosity=detailed`
### 2. Clarify Ambiguous Questions
If the question is vague or could be interpreted multiple ways, ask for clarification.
**Skip these interactions if:**
- User provided `--providers` flag
- Question is specific and clear
- Context from conversation already clarifies intent
## Step 1: Auto-Context Detection
Unless `--no-auto-context` or `--file=` is in $ARGUMENTS, detect and include relevant files:
1. Extract keywords from the question (function names, domain terms, file patterns)
2. Search with Glob and Grep for matching files (max 5 files, ~10,000 tokens)
3. If relevant files found, show: `Auto-included context (N files): [list]`
4. Append file contents to the prompt sent to providers
Skip auto-context if:
- `--no-auto-context` is specified
- `--file=` is specified (explicit context)
- Question doesn't reference code concepts
## Step 1.5: Agent Mode Detection
Determine if agent-enhanced mode should be used:
### Explicit trigger
If `--agents` is in $ARGUMENTS, usUse this agent when the user is facing architectural decisions, design choices, or has been stuck debugging a problem after multiple failed attempts. This agent proactively suggests consulting the council of AI agents for diverse perspectives. Examples:
One independent member of a local (provider-less) council. Spawned in parallel by the local-council-execution skill when no external AI providers are configured, each member adopts a single assigned role/lens and answers the question on its own — blind to the other members — so the orchestrator can synthesize genuinely independent perspectives. Not invoked directly by users.
Fetch, list, or cancel background council jobs started with --async
Check connectivity and configuration status of all council providers
Executes council queries by running the query pipeline across selected AI providers (Gemini, OpenAI, Grok, Perplexity), displaying formatted responses verbatim, and generating a synthesis of consensus, divergence, and recommendations. Invoked by the ask command during standard (non-agent) council queries.
Executes agent-enhanced council queries by spawning parallel Claude subagents that each query a provider, evaluate response quality, ask follow-up questions, and return structured insights with confidence ratings and blind spot analysis. Invoked when the --agents flag is used or when complex architectural decisions are detected.
Runs a local council when no external AI providers are configured. Spawns N independent Claude subagents (one per role, blind to each other) that each answer the question from a single assigned lens, then synthesizes their perspectives. Invoked by the ask command via --local, or when the user accepts the local-council offer after no providers are found. This is a same-model (Claude-only) panel, not a cross-vendor council.
Adds new AI providers to claude-council, configures provider API settings, troubleshoots provider connections, and documents the provider script interface. Covers creating provider shell scripts, setting API keys, and validating connectivity. Triggers on "add provider", "new AI agent", "provider not working", "API configuration", or "extend council".