Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xNyk Council of high intelligence Dispatch Methods

From Leeroopedia
Knowledge Sources
Domains AI, CLI_Integration, Multi_Model_Systems
Last Updated 2026-10-20 00:00 GMT

Overview

Concrete dispatch interface for sending prompts to six different LLM provider types (subagent, codex_exec, gemini_cli, ollama_run, cursor_cli, openai_compatible_api) provided by the Council of High Intelligence skill.

Description

The Dispatch Methods are the six execution channels defined in `SKILL.md` STEP 2 that the coordinator uses to send prompts to council members routed to different providers. Each method has a specific command template, timeout, and security pattern. All external methods use a quoted heredoc pattern to inject the prompt — never inlining prompt text in the command string, which would break on shell metacharacters or allow injection.

The dispatch contract is shared across all rounds (Round 1, Round 2, Round 3, enforcement re-prompts). If a provider fails in an earlier round, the fallback provider is used for all remaining rounds. This is a Pattern Doc: the coordinator constructs these commands at runtime based on the routing table.

Usage

Use these dispatch methods when:

  • A member is routed to a non-Anthropic provider (codex, gemini, ollama, cursor, NIM)
  • The coordinator needs to send a prompt to an external CLI or API
  • Anthropic members use the `subagent` method (native Claude Code subagent dispatch)

Code Reference

Source Location

Signature

# Six dispatch methods, each with a command template:

subagent:           Claude Code subagent (native, no Bash)
codex_exec:          codex exec -c model="{model}" -c auto_approve=true "$(cat $PROMPT_FILE)"
gemini_cli:          gemini -m {model} -p "$(cat $PROMPT_FILE)"
ollama_run:          ollama run {model} "$(cat $PROMPT_FILE)"
cursor_cli:          cursor-agent -p --mode ask --model {model} --output-format text "$(cat $PROMPT_FILE)"
openai_compatible:  curl -sS -X POST "{base_url}/chat/completions" with process-substitution auth

Timeouts:
  codex_exec:          60s
  gemini_cli:          60s
  ollama_run:          120s (local models slower)
  cursor_cli:          90s
  openai_compatible:   90s
  subagent:            host-dependent

Fallback: On failure/timeout → re-run as anthropic subagent, skip failed provider

Import

No import — these are command templates the coordinator constructs via the Bash tool:

# All external methods use the quoted heredoc pattern:
PROMPT_FILE="$(mktemp)"
cat > "$PROMPT_FILE" <<'COUNCIL_PROMPT_EOF'
{full prompt}
COUNCIL_PROMPT_EOF
{provider command} "$(cat "$PROMPT_FILE")" 2>/dev/null
rm -f "$PROMPT_FILE"

I/O Contract

Inputs

Name Type Required Description
exec_method str Yes One of: subagent, codex_exec, gemini_cli, ollama_run, cursor_cli, openai_compatible_api
model str Yes Model ID for the provider (e.g., gpt-5.4, gemini-3-pro, deepseek-ai/deepseek-v4-pro)
prompt str Yes Full prompt text (identity preamble + problem + context)
base_url str openai_compatible only API endpoint URL (e.g., https://integrate.api.nvidia.com/v1)
api_key_env str openai_compatible only Env var name holding the API key (e.g., NVIDIA_API_KEY)
subagent_type str subagent only Agent name matching council member (e.g., council-socrates)

Outputs

Name Type Description
stdout str Member's response text (captured as output)
exit_code int 0 = success, non-zero = failure (triggers fallback)

Usage Examples

Codex Exec (OpenAI)

PROMPT_FILE="$(mktemp)"
cat > "$PROMPT_FILE" <<'COUNCIL_PROMPT_EOF'
You are operating as a council member in a structured deliberation.
[Identity + Grounding Protocol + Output Format sections inlined]

The problem under deliberation:
Should we use a monorepo or polyrepo?

Reason via your designated method: first-principles-analysis.
Produce your independent analysis. Limit: 400 words maximum.
COUNCIL_PROMPT_EOF
codex exec -c model="gpt-5.4" -c auto_approve=true "$(cat "$PROMPT_FILE")" 2>/dev/null
rm -f "$PROMPT_FILE"

OpenAI-Compatible API (NVIDIA NIM)

# API key via process substitution — never in argv (visible via ps)
curl -sS -X POST "https://integrate.api.nvidia.com/v1/chat/completions" \
  -H @<(printf 'Authorization: Bearer %s\n' "${NVIDIA_API_KEY}") \
  -H "Content-Type: application/json" \
  -d "$(jq -nc \
       --arg model "deepseek-ai/deepseek-v4-pro" \
       --arg prompt "$(cat "$PROMPT_FILE")" \
       --arg system "You are operating as a council member in a structured deliberation." \
       '{model: $model, messages: [{role:"system",content:$system},{role:"user",content:$prompt}], temperature: 0.7, max_tokens: 1200}')" \
  2>/dev/null | jq -r '.choices[0].message.content // empty'

Cursor CLI

# Headless, read-only mode (--mode ask prevents filesystem access)
cursor-agent -p --mode ask --model "gpt-5.4-high" --output-format text "$(cat "$PROMPT_FILE")" 2>/dev/null

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment