Skip to content

Instantly share code, notes, and snippets.

@raine
Created April 24, 2026 13:46
Show Gist options
  • Select an option

  • Save raine/8672bc6d45ad1382a2050cbd4aef65c4 to your computer and use it in GitHub Desktop.

Select an option

Save raine/8672bc6d45ad1382a2050cbd4aef65c4 to your computer and use it in GitHub Desktop.
name consult-llm
description How to invoke the consult-llm CLI. Canonical reference for the invocation contract, flags, stdin/stdout format, and multi-turn. Load this before calling consult-llm from any workflow skill (/consult, /collab, /debate, /collab-vs, /debate-vs).
allowed-tools Bash

Reference for invoking the consult-llm CLI. Workflow skills delegate here for mechanics; they focus on orchestration.

Invocation

Run consult-llm with the prompt on stdin, using a quoted heredoc.

cat <<'EOF' | consult-llm -m gemini -f src/foo.rs -f src/bar.rs
<prompt body>
EOF

Rules:

  • ALWAYS use <<'EOF' (quoted). The quotes prevent the shell from expanding $var, backticks, or escapes inside the prompt. Unquoted heredocs corrupt prompts.
  • Fallback to --prompt-file <path> if the prompt contains the heredoc terminator, or on Windows/PowerShell. Write the prompt to a temp file, then consult-llm --prompt-file /tmp/prompt.txt ….
  • Stdout layout. First line is [model:<id>] [thread_id:<id>], then a blank line, then the response body. In --web mode the prefix is just [model:<id>] (no thread).
  • Multi-turn. Read [thread_id:xxx] from line 1 and pass it back with -t <id> on the next call. Thread IDs are opaque strings — don't modify them. Not portable across backends.
  • Stderr carries progress/spinner output. Ignore it.
  • Exit codes. 0 success, 1 backend/network error (includes thread-not-found), 2 usage error, 3 configuration error (missing API key, unsupported backend).

Models

Selectors and allowed models resolvable in this environment (availability depends on which API keys are configured):

!`consult-llm models`

Pass a selector or an exact model ID to -m. Selectors with -> - have no configured API key and will fail.

Flags

Flag Purpose
-m, --model <selector|id> See "Models" above
-f, --file <path> Repeatable. File context
-t, --thread-id <id> Resume a multi-turn conversation
--task <mode> general (default), review, debug, plan, create
--web Copy formatted prompt to clipboard, exit 0
--prompt-file <path> Read prompt from file instead of stdin
--diff-files <path> Repeatable. Include git diff for this file
--diff-base <ref> Base ref for diff (default HEAD)
--diff-repo <path> Repo path (default cwd)

Run consult-llm --help for the authoritative flag list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment