Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

Commit a46d32d

Browse files
committed
fix: replace ollama launch claude with direct env var approach
ollama launch claude requires a TTY, which breaks in non-interactive contexts (background processes, CI). Instead, point Claude Code directly at Ollama's Anthropic-compatible API using env vars: ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_BASE_URL=https://ollama.com
1 parent 08ed733 commit a46d32d

7 files changed

Lines changed: 52 additions & 51 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Review results are saved as JSON files containing raw model outputs, timestamps,
127127
| Grok | `grok-code-fast-1`, `grok-4-1-fast-*`, `grok-4-fast-*`, `grok-3`, `grok-3-mini` | [xAI API Models](https://docs.x.ai/docs/models) |
128128
| Ollama | Cloud (recommended): `minimax-m2.5:cloud`, `glm-5:cloud`, `kimi-k2.5:cloud`, or any model from library | [Ollama Library](https://ollama.com/library) |
129129

130-
> **Note:** Ollama cloud models (`:cloud` suffix) run via `ollama launch claude` with full agentic capabilities — tools, web search, and subagents. Requires `OLLAMA_API_KEY`. Get your API key at [ollama.com](https://ollama.com). Local models (e.g., `qwen2.5-coder:7b`) use `ollama run` (text-only), are slower, and require significant memory (~8GB+ RAM for 7B models).
130+
> **Note:** Ollama cloud models (`:cloud` suffix) run Claude Code pointed at Ollama's Anthropic-compatible API (`ANTHROPIC_BASE_URL=https://ollama.com`). This gives cloud models full agentic capabilities — tools, file access, and subagents. Requires `OLLAMA_API_KEY`. Get your API key at [ollama.com](https://ollama.com). Local models (e.g., `qwen2.5-coder:7b`) use `ollama run` (text-only), are slower, and require significant memory (~8GB+ RAM for 7B models).
131131
132132
> **Note:** Mistral and Grok use command-line argument passing (not stdin), which has a ~200KB limit on macOS. Very large diffs may cause these tools to fail while other tools succeed.
133133
@@ -152,7 +152,7 @@ Customize prompts for each command:
152152
| Qwen | `npm install -g @qwen-code/qwen-code` |
153153
| Mistral | `pipx install mistral-vibe` |
154154
| Grok | `bun add -g @vibe-kit/grok-cli`; `export GROK_API_KEY="key"` in `~/.zshrc` |
155-
| Ollama | [ollama.com/download](https://ollama.com/download); cloud (agentic): `export OLLAMA_API_KEY="key"` in `~/.zshrc`; local: `ollama pull <model>` |
155+
| Ollama | [ollama.com/download](https://ollama.com/download); cloud: `export OLLAMA_API_KEY="key"` in `~/.zshrc`; local: `ollama pull <model>` |
156156

157157
## Usage
158158

agents/multi-model-executor.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ For each tool in the config:
4343

4444
**Environment override for nested Claude Code**:
4545

46-
When running inside Claude Code, `CLAUDECODE=1` prevents spawning nested sessions. Prefix with `CLAUDECODE=0` for any tool whose command starts with `claude` or uses `ollama launch claude`:
46+
When running inside Claude Code, `CLAUDECODE=1` prevents spawning nested sessions. Prefix with `CLAUDECODE=0` for any tool whose command contains `claude`:
4747

4848
```bash
4949
# Claude tools
5050
cat /tmp/conclave-prompt.md | CLAUDECODE=0 claude --print 2>&1
5151

52-
# Ollama cloud tools (ollama launch claude wraps Claude Code)
53-
cat /tmp/conclave-prompt.md | CLAUDECODE=0 ollama launch claude --model minimax-m2.5:cloud -- --print 2>&1
52+
# Ollama cloud tools (runs Claude Code pointed at Ollama's API)
53+
cat /tmp/conclave-prompt.md | CLAUDECODE=0 ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print --model glm-5:cloud 2>&1
5454
```
5555

5656
**Stdin-based tools** (most):
@@ -83,19 +83,18 @@ Skip injection if command already contains a model flag.
8383

8484
Ollama has two command patterns depending on model type:
8585

86-
**Cloud models** (`:cloud` suffix) — use `ollama launch claude` (agentic, with tools/web search):
87-
- Command: `ollama launch claude -- --print`
88-
- Model injection: `--model` flag inserted before `--`
89-
- Requires `CLAUDECODE=0` prefix
90-
- Example: `cat /tmp/conclave-prompt.md | CLAUDECODE=0 ollama launch claude --model qwen3-coder:480b-cloud -- --print 2>&1`
86+
**Cloud models** (`:cloud` suffix) — run Claude Code pointed at Ollama's Anthropic-compatible API:
87+
- Command: `ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print`
88+
- Model injection: `--model` flag appended (same as regular Claude)
89+
- Requires `CLAUDECODE=0` prefix (since it runs `claude`)
90+
- Requires `OLLAMA_API_KEY` env var
91+
- Example: `cat /tmp/conclave-prompt.md | CLAUDECODE=0 ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print --model glm-5:cloud 2>&1`
9192

9293
**Local models** (no `:cloud` suffix) — use `ollama run` (text-only):
9394
- Command: `ollama run`
9495
- Model injection: Appended directly (no flag)
9596
- Example: `cat /tmp/conclave-prompt.md | ollama run qwen2.5-coder:7b 2>&1`
9697

97-
Detection: If the tool's `model` field ends with `:cloud`, use the cloud pattern.
98-
9998
### Step 3: Collect Results
10099

101100
Use TaskOutput for each background task to wait for completion.

commands/consult.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ PROMPT_EOF
125125

126126
**Step 5b - Run consultation commands in background** (run ALL in parallel with `run_in_background: true`):
127127

128-
**Environment override for nested Claude Code**: When running inside Claude Code, `CLAUDECODE=1` prevents spawning nested sessions. Prefix with `CLAUDECODE=0` for any tool whose command starts with `claude` or uses `ollama launch claude`:
128+
**Environment override for nested Claude Code**: When running inside Claude Code, `CLAUDECODE=1` prevents spawning nested sessions. Prefix with `CLAUDECODE=0` for any tool whose command contains `claude`:
129129

130130
```bash
131131
# Claude tools
132132
cat /tmp/conclave-consult-prompt.md | CLAUDECODE=0 claude --print --model opus 2>&1
133133

134-
# Ollama cloud tools
135-
cat /tmp/conclave-consult-prompt.md | CLAUDECODE=0 ollama launch claude --model minimax-m2.5:cloud -- --print 2>&1
134+
# Ollama cloud tools (runs Claude Code pointed at Ollama's API)
135+
cat /tmp/conclave-consult-prompt.md | CLAUDECODE=0 ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print --model glm-5:cloud 2>&1
136136
```
137137

138138
For stdin-based tools:
@@ -244,7 +244,7 @@ Same as `/review` - see `~/.config/conclave/tools.json` for enabled tools.
244244
| Mistral | `vibe --output text -p` | Config-based |
245245
| Grok | `grok -p` | `-m` (append) |
246246
| Ollama (local) | `ollama run` | Appended directly |
247-
| Ollama (cloud) | `ollama launch claude -- --print` | `--model` (before `--`) |
247+
| Ollama (cloud) | `ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print` | `--model` (append) |
248248

249249
## Error Handling
250250

commands/review.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ PROMPT_EOF
152152

153153
**Step 4b - Run review commands in background** (run ALL in parallel with `run_in_background: true`):
154154

155-
**Environment override for nested Claude Code**: When running inside Claude Code, `CLAUDECODE=1` prevents spawning nested sessions. Prefix with `CLAUDECODE=0` for any tool whose command starts with `claude` or uses `ollama launch claude`:
155+
**Environment override for nested Claude Code**: When running inside Claude Code, `CLAUDECODE=1` prevents spawning nested sessions. Prefix with `CLAUDECODE=0` for any tool whose command contains `claude`:
156156

157157
```bash
158158
# Claude tools
159159
cat /tmp/conclave-review-prompt.md | CLAUDECODE=0 claude --print --model opus 2>&1
160160

161-
# Ollama cloud tools
162-
cat /tmp/conclave-review-prompt.md | CLAUDECODE=0 ollama launch claude --model minimax-m2.5:cloud -- --print 2>&1
161+
# Ollama cloud tools (runs Claude Code pointed at Ollama's API)
162+
cat /tmp/conclave-review-prompt.md | CLAUDECODE=0 ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print --model glm-5:cloud 2>&1
163163
```
164164

165165
For most tools (stdin-based):
@@ -181,7 +181,8 @@ For Mistral Vibe and Grok (command substitution - do not accept stdin):
181181
| gemini | `-m` | Appended to command |
182182
| qwen | `-m` | Appended to command |
183183
| mistral | N/A | Model set via `~/.vibe/config.toml` |
184-
| ollama | varies | See Ollama examples below |
184+
| ollama (cloud) | `--model` | Appended (same as claude) |
185+
| ollama (local) | N/A | Appended directly |
185186
| grok | `-m` | Appended to command |
186187

187188
**Notes**:
@@ -222,10 +223,10 @@ grok -p -m grok-code-fast-1 "$(cat /tmp/conclave-review-prompt.md)"
222223
Original: ollama run
223224
With model: ollama run qwen2.5-coder:7b
224225
225-
# Ollama cloud (--model flag before --, requires CLAUDECODE=0)
226-
Original: ollama launch claude -- --print
227-
With model: ollama launch claude --model qwen3-coder:480b-cloud -- --print
228-
Final: cat /tmp/prompt.md | CLAUDECODE=0 ollama launch claude --model qwen3-coder:480b-cloud -- --print 2>&1
226+
# Ollama cloud (--model appended, env vars point Claude at Ollama API)
227+
Original: ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print
228+
With model: ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print --model glm-5:cloud
229+
Final: cat /tmp/prompt.md | CLAUDECODE=0 ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print --model glm-5:cloud 2>&1
229230
```
230231

231232
Use `timeout: 300000` (5 minutes) for each command since AI tools can be slow.
@@ -653,14 +654,14 @@ Most tools receive the prompt via stdin: `cat prompt.md | {command}`
653654
| Mistral | `vibe --output text -p` | Config-based | Uses command substitution: `vibe --output text -p "$(cat file)"` |
654655
| Grok | `grok -p` | `-m` (append) | Uses command substitution: `grok -p -m model "$(cat file)"` |
655656
| Ollama (local) | `ollama run` | Appended directly | Model appended without flag: `ollama run <model>` |
656-
| Ollama (cloud) | `ollama launch claude -- --print` | `--model` (before `--`) | Agentic mode with tools/web search. Requires `CLAUDECODE=0` |
657+
| Ollama (cloud) | `ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print` | `--model` (append) | Runs Claude Code against Ollama's API. Requires `CLAUDECODE=0` and `OLLAMA_API_KEY` |
657658

658659
**Notes**:
659660
- All tools read from the same prompt file (`/tmp/conclave-review-prompt.md`) written once in Step 4a.
660661
- Mistral Vibe does not accept stdin; prompt must be passed via `-p` flag using command substitution.
661662
- Mistral model selection is done via `~/.vibe/config.toml` (`active_model` setting), not CLI flags.
662663
- Grok CLI does not accept stdin; prompt must be passed via `-p` flag using command substitution (like Mistral).
663-
- Ollama cloud models (`:cloud` suffix) use `ollama launch claude` which runs a full agentic session. The model gets access to file read, grep, bash, web search, and subagents.
664+
- Ollama cloud models (`:cloud` suffix) run Claude Code pointed at Ollama's Anthropic-compatible API via env vars. The model gets access to file read, grep, bash, and other Claude Code tools.
664665
- **Limitation**: Mistral and Grok's command-line argument passing has a ~200KB limit (ARG_MAX). Very large diffs may fail.
665666

666667
---

config/tools.example.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,58 +54,58 @@
5454
"ollama-minimax": {
5555
"enabled": false,
5656
"scope": ["review", "consult"],
57-
"command": "ollama launch claude -- --print",
57+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
5858
"model": "minimax-m2.5:cloud",
59-
"description": "Ollama (MiniMax M2.5, agentic)"
59+
"description": "Ollama (MiniMax M2.5, cloud)"
6060
},
6161
"ollama-glm": {
6262
"enabled": false,
6363
"scope": ["review", "consult"],
64-
"command": "ollama launch claude -- --print",
64+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
6565
"model": "glm-5:cloud",
66-
"description": "Ollama (GLM-5, agentic)"
66+
"description": "Ollama (GLM-5, cloud)"
6767
},
6868
"ollama-kimi": {
6969
"enabled": false,
7070
"scope": ["review", "consult"],
71-
"command": "ollama launch claude -- --print",
71+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
7272
"model": "kimi-k2.5:cloud",
73-
"description": "Ollama (Kimi K2.5, agentic)"
73+
"description": "Ollama (Kimi K2.5, cloud)"
7474
},
7575
"ollama-qwen": {
7676
"enabled": false,
7777
"scope": ["review", "consult"],
78-
"command": "ollama launch claude -- --print",
78+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
7979
"model": "qwen3-coder:480b-cloud",
80-
"description": "Ollama (Qwen3 Coder 480B, agentic)"
80+
"description": "Ollama (Qwen3 Coder 480B, cloud)"
8181
},
8282
"ollama-devstral": {
8383
"enabled": false,
8484
"scope": ["review", "consult"],
85-
"command": "ollama launch claude -- --print",
85+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
8686
"model": "devstral-2:123b-cloud",
87-
"description": "Ollama (Devstral 2 123B, agentic)"
87+
"description": "Ollama (Devstral 2 123B, cloud)"
8888
},
8989
"ollama-deepseek": {
9090
"enabled": false,
9191
"scope": ["review", "consult"],
92-
"command": "ollama launch claude -- --print",
92+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
9393
"model": "deepseek-v3.2:cloud",
94-
"description": "Ollama (DeepSeek V3.2, agentic)"
94+
"description": "Ollama (DeepSeek V3.2, cloud)"
9595
},
9696
"ollama-rnj": {
9797
"enabled": false,
9898
"scope": ["review", "consult"],
99-
"command": "ollama launch claude -- --print",
99+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
100100
"model": "rnj-1:8b-cloud",
101-
"description": "Ollama (RNJ-1 8B, agentic)"
101+
"description": "Ollama (RNJ-1 8B, cloud)"
102102
},
103103
"ollama-devstral-small": {
104104
"enabled": false,
105105
"scope": ["review", "consult"],
106-
"command": "ollama launch claude -- --print",
106+
"command": "ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com claude --print",
107107
"model": "devstral-small-2:24b-cloud",
108-
"description": "Ollama (Devstral Small 2 24B, agentic)"
108+
"description": "Ollama (Devstral Small 2 24B, cloud)"
109109
},
110110
"ollama-local": {
111111
"enabled": false,

tests/cli-live.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# WARNING: This runs real API calls and incurs costs.
66
# Only run when you need to verify tools are working end-to-end.
77
#
8-
# NOTE: Ollama cloud models require OLLAMA_API_KEY and use `ollama launch claude` (agentic mode).
8+
# NOTE: Ollama cloud models require OLLAMA_API_KEY and run Claude Code via Ollama's API.
99
# NOTE: Grok requires GROK_API_KEY environment variable.
1010

1111
set -eo pipefail
@@ -100,14 +100,14 @@ else
100100
echo " ○ grok skipped (GROK_API_KEY not set)"
101101
((skipped++))
102102
fi
103-
# Ollama: cloud models use `ollama launch claude` (agentic), local uses `ollama run`
103+
# Ollama: cloud models run Claude Code via Ollama's API, local uses `ollama run`
104104
if [[ "$MODEL_OLLAMA" == *":cloud"* ]]; then
105105
if [[ -z "$OLLAMA_API_KEY" ]]; then
106106
echo "Testing ollama..."
107107
echo " ○ ollama skipped (cloud model requires OLLAMA_API_KEY)"
108108
((skipped++))
109109
else
110-
test_tool "ollama" "ollama launch claude --model $MODEL_OLLAMA -- --print" true "CLAUDECODE=0"
110+
test_tool "ollama" "claude --print --model $MODEL_OLLAMA" true "CLAUDECODE=0 ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com"
111111
fi
112112
else
113113
test_tool "ollama" "ollama run $MODEL_OLLAMA" true

tests/cli-models.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Only run when validating README model documentation is accurate.
77
#
88
# NOTE: Ollama cloud models (`:cloud` suffix) require OLLAMA_API_KEY environment variable
9-
# and use `ollama launch claude` (agentic mode with tools/web search).
9+
# and run Claude Code pointed at Ollama's Anthropic-compatible API.
1010
# Get your API key at https://ollama.com
1111
#
1212
# NOTE: Grok models require GROK_API_KEY environment variable.
@@ -141,13 +141,14 @@ fi
141141
echo ""
142142

143143
# Ollama models
144-
# Cloud models use `ollama launch claude` (agentic), local models use `ollama run`
144+
# Cloud models run Claude Code pointed at Ollama's API, local models use `ollama run`
145145
echo "--- Ollama ---"
146146
if [[ -n "$OLLAMA_API_KEY" ]]; then
147-
# Recommended cloud models (agentic via ollama launch claude)
148-
test_model "ollama" "minimax-m2.5:cloud" "ollama launch claude --model minimax-m2.5:cloud -- --print" true "CLAUDECODE=0"
149-
test_model "ollama" "glm-5:cloud" "ollama launch claude --model glm-5:cloud -- --print" true "CLAUDECODE=0"
150-
test_model "ollama" "kimi-k2.5:cloud" "ollama launch claude --model kimi-k2.5:cloud -- --print" true "CLAUDECODE=0"
147+
OLLAMA_ENV="CLAUDECODE=0 ANTHROPIC_AUTH_TOKEN=$OLLAMA_API_KEY ANTHROPIC_API_KEY= ANTHROPIC_BASE_URL=https://ollama.com"
148+
# Recommended cloud models (via Ollama's Anthropic-compatible API)
149+
test_model "ollama" "minimax-m2.5:cloud" "claude --print --model minimax-m2.5:cloud" true "$OLLAMA_ENV"
150+
test_model "ollama" "glm-5:cloud" "claude --print --model glm-5:cloud" true "$OLLAMA_ENV"
151+
test_model "ollama" "kimi-k2.5:cloud" "claude --print --model kimi-k2.5:cloud" true "$OLLAMA_ENV"
151152
else
152153
echo " ○ cloud models skipped (OLLAMA_API_KEY not set)"
153154
((skipped+=3))

0 commit comments

Comments
 (0)