Run pipeline stages on Claude Code (harness=claude)

A model stage with harness=claude, provider=anthropic and a Claude model id
runs one claude -p process per visit with the server user's Claude sign-in.
Only the declared tools exist (--tools) and nothing else is approved
(--permission-mode dontAsk); edits are approved only below the run directory
and the stage's artifacts directory. A permissions block, run write paths,
delivery=true and reasoning_effort none/minimal are refused, not widened.

Usage comes from the CLI's final result and counts toward budgets. Failures
are fixed text; billing, quota and rate-limit refusals map to
ErrProviderQuota. The redacted stream is the session export and evidence.
provider-check --harness claude and model overrides are covered.
This commit is contained in:
2026-11-11 10:30:37 +00:00
parent 16643b9f1b
commit bd07abcde8
19 changed files with 1448 additions and 16 deletions
+4 -3
View File
@@ -100,8 +100,8 @@ How the stage service behaves:
- `pipelines debug` is unchanged: it opens a fresh interactive harness
conversation, not the stage session.
Claude Code and Codex are chat-only harnesses (stages accept only
`harness=opencode` or `harness=pi`), so they need no stage limit. Their chats
Codex is a chat-only harness and Claude Code stages (`harness=claude`) run the
CLI's own print mode, so neither has a stage limit here. Their chats
keep their own defaults. Claude Code has `BASH_MAX_OUTPUT_LENGTH` and
`MAX_MCP_OUTPUT_TOKENS` (environment or `--settings`). Codex has
`tool_output_token_limit` (config override `-c`). Pi stages keep Pi's built-in
@@ -176,7 +176,8 @@ instead of being silently redirected or downgraded to plaintext. `provider-check
on a Docker-linked profile runs in-container and preserves the caller's output
mode (`--json` only when requested) with exact stdout/exit propagation.
Put `harness=pi` in a model stage's configs to select Pi. nvim edits definitions
Put `harness=pi` in a model stage's configs to select Pi, or `harness=claude`
with `provider=anthropic` for Claude Code ([harnesses](harnesses.md#claude-code-stages)). nvim edits definitions
or displays debug evidence; it does not execute model stages.
For bounded review loops, add a fenced `limits` JSON object to the reviewer:
+46 -4
View File
@@ -8,10 +8,10 @@ harness's own login, which `pipelines harness setup <name>` opens for you.
| --- | --- | --- | --- | --- |
| OpenCode | yes (default) | yes (default) | queued until the turn ends | yes |
| Pi | yes (`harness=pi`) | no | n/a | yes |
| Claude Code | no | yes | yes, delivered into the running turn | no |
| Claude Code | yes (`harness=claude`) | yes | yes, delivered into the running turn | no |
| Codex | no | yes | yes, via `turn/steer` | no |
Stage configs accept only `harness=opencode` or `harness=pi`.
Stage configs accept `harness=opencode`, `harness=pi` or `harness=claude`.
## Set up harnesses
@@ -77,6 +77,19 @@ reasoning_effort=high
[harnesses and control](harnesses-and-control.md). Use the exact IDs your
harness lists (`opencode models`, `pi --list-models`).
A stage on Claude Code uses the server user's Claude sign-in and a Claude model
ID, for example a cheaper model for a small change:
````markdown
```configs
harness=claude
provider=anthropic
model=claude-haiku-5-5
```
````
See [Claude Code stages](#claude-code-stages) for what such a stage can do.
**Per run**, without changing the definition:
```sh
@@ -114,6 +127,7 @@ its own catalog.
pipelines doctor # health + OpenCode API discovery, no inference
pipelines provider-check --model P/M # one tiny tool-free generation (may cost)
pipelines provider-check --harness pi --model P/M
pipelines provider-check --harness claude --model anthropic/claude-haiku-5-5
python3 scripts/check-pi-rpc.py # Pi RPC and policy, no inference
```
@@ -173,7 +187,7 @@ return to model selection.
## Claude Code
**Used for:** chat only.
**Used for:** chat, and pipeline stages with `harness=claude` (see [Claude Code stages](#claude-code-stages)).
**Found by:** `PIPELINES_CLAUDE`, then `PATH`, then `~/.local/bin/claude`,
`/opt/homebrew/bin/claude`, `/usr/local/bin/claude`. The server checks again
@@ -211,9 +225,37 @@ for the next turn.
**Mid-turn messages:** yes. The message is written to the running CLI's stdin
and read at its next step. Model changes apply from the next turn.
### Claude Code stages
A model stage with `harness=claude`, `provider=anthropic` and
`model=<Claude model ID>` runs one `claude -p` process per visit in the run
directory, signed in as the server user (the same sign-in the chats use; a run
directory that chooses its own account keeps it).
- **Tools.** Only the tools in the stage's `tools` block exist for the session
(`read`, `glob`, `grep`, `edit`, `shell`, `webfetch`, `websearch`). Nothing
else is approved: the CLI runs with `--permission-mode dontAsk`, and file
edits are approved only below the run directory and the stage's artifacts
directory. An undeclared tool or an edit elsewhere is refused by the CLI.
- **Not supported; the stage or run is refused, never widened:** a
`permissions` block, a run launched with `--write-path`, `delivery=true`
(landing stays on OpenCode), and `reasoning_effort` `none` or `minimal`.
- **Isolation.** User, project and local Claude Code settings, hooks, MCP
servers, plugins and slash commands are not loaded. A `CLAUDE.md` in the run
directory is still read by the CLI.
- **Usage.** Cost and tokens come from the CLI's final result and count toward
stage and run budgets; a result without usage fails a budgeted stage.
- **Failures.** Diagnostics are fixed text. A billing, quota or rate-limit
refusal stops the run without retries; a missing sign-in says so. The CLI's
redacted stream is kept as the session export and evidence.
- **Recovery.** A server restart during a Claude Code stage stops that process
and fails the visit; it is not reattached.
- **Overrides.** `--model` and `--stage-model` must give an
`anthropic/<model>` for these stages; the launch is refused otherwise.
## Codex
**Used for:** chat only.
**Used for:** chat, and pipeline stages with `harness=claude` (see [Claude Code stages](#claude-code-stages)).
**Found by:** the Codex App Server control socket at
`$CODEX_HOME/app-server-control/app-server-control.sock` (default