# Per-harness native behavior

Read this before relying on behavior that differs by harness: model choice,
provider selection, live-session controls, Claude write sandbox limits, the
Claude configuration directory, native approvals and input requests, Cursor
trust and effort, Antigravity results, and OpenCode's free tier and event
stream. The flag table and support matrix are in
[reference.md](reference.md).

## Claude models

Before selecting a newer Claude model, check `hcn inspect claude --json`:
`vocabulary.models` lists explicit IDs, and `vocabulary.aliases` shows each
alias's current target. An alias can move between generations; use a listed
explicit ID to retain an older generation. Native CLI version and account
access still determine whether the provider accepts that model.

## Claude configuration directory

Claude's configuration directory defaults to `~/.claude`. Setting
`CLAUDE_CONFIG_DIR` selects the directory for settings, session history,
plugins and project transcripts. It also moves `.claude.json` from the home
directory into the selected directory and, on macOS, selects a Keychain
entry scoped to that directory. Even making the default path explicit can
select a different login context. See Claude's
[credential management](https://code.claude.com/docs/en/authentication#credential-management)
and [configuration directory](https://code.claude.com/docs/en/claude-directory)
documentation. hcn preserves an inherited empty value as a caller choice.

To persist that choice for automated callers, set `claudeConfigDir` in
`~/.config/hcn/config.json` to a non-empty absolute path (no shell
expansion). hcn then supplies the variable as a fallback on `hcn run
claude` and `hcn session claude`, fresh and resumed, and prints
`provenance: claudeConfigDir = "<path>" (user-config)` on stderr when it
applies. The same setting reaches argv/runtime previews and `inspect --context`.
A per-run `--env CLAUDE_CONFIG_DIR` entry (the empty delete
included) and an inherited variable (an inherited empty value included)
both outrank the setting; with no setting hcn adds no variable, other
harnesses never receive one, and the project config cannot set the key.
Sessions refuse `--env`; choose another session context through the inherited
variable. `hcn transcript` and `hcn interactive` still use the native environment
variable rather than this launch setting. Upgrade older hcn callers sharing this
user config before adding the key, which those versions reject.
hcn does no auth preflight and never reads, refreshes or stores credentials.
Claude owns everything under the directory.

## Claude write access

On builds advertising strict Claude write access in `hcn run --help`,
`hcn run claude --access write` renders `--permission-mode acceptEdits` and
one owned `--settings` object with these sandbox fields:

```json
{
  "sandbox": {
    "enabled": true,
    "autoAllowBashIfSandboxed": true,
    "allowUnsandboxedCommands": false,
    "failIfUnavailable": true,
    "filesystem": { "disabled": false }
  }
}
```

Claude auto-approves sandboxed Bash, forbids unsandboxed retry and is asked to
fail startup if the sandbox is unavailable. Native tool permissions, Bash checks
and network policy still apply. The OS sandbox covers Bash, not file or web tools.
This is not a promise that every platform or command works unattended.

Unless managed policy overrides strict mode, Claude ignores project settings
that loosen sandbox restrictions, including project domain allowlists and extra
write paths. Trusted user, CLI or managed policy may be needed for installs or
tests. hcn adds no network allowlist and does not change native policy sources.
`--autonomy` changes native permission mode but retains this explicit write
sandbox. It can allow network hosts outside the allowlist unless `strictAllowlist`,
`allowManagedDomainsOnly`, or native denied-domain policy blocks them. Claude documents that
decision matrix for an interactive terminal session. hcn has not verified it in a headless run,
and the 2.1.296 qualification included no network-plus-autonomy probe. The matrix governs only
traffic that goes through Claude's own sandbox proxy. When native `httpProxyPort` or
`socksProxyPort` applies, that custom proxy filters the traffic sent to it, and Claude's
`allowedDomains`, `deniedDomains`, `strictAllowlist`, approval prompts and local-address check
stop applying to that traffic. Preserved filesystem isolation does not prove network
confinement. See Claude's
[network approval rules](https://code.claude.com/docs/en/sandboxing#hosts-outside-your-allowed-domains)
and [custom proxy configuration](https://code.claude.com/docs/en/sandboxing#custom-proxy-configuration).
Autonomy without explicit write access does not add the sandbox.

Selected skills share the same owned settings object. This preserves selection
fields, not a promise that skills load under every native mode: Claude safe mode
disables skills. Caller-provided settings and passthrough remain untouched.
On Claude 2.1.296, a later CLI `--settings` object replaces the earlier object.
hcn does not merge caller JSON or settings files. Inspect the intended argv and
native policy before relying on added settings.

## Pi provider

Pi 1.0 requires a model when a provider is supplied: use
`--provider <provider> --model <model>`, or a provider/model selector.
A provider-only invocation remains a native failure.

## Session tool limits

Claude and Pi session permission options use the run renderers at spawn. Repeat
the explicit controls on resume. Claude grants the selected tools and denies
the complement of its known built-ins. New native tools outside that inventory
can remain available; Claude 2.1.316 exposed `SendToProject` and
`SendToProjectContext` in the session probe. This is not a closed inventory
guarantee on newer versions. It also does not deny every configured MCP tool;
Claude's `--access read` preset explicitly denies `mcp__*` as well.

Pi 1.4.0's plain `--tools` list replaces built-in and extension declarations,
but does not remove registered MCP tools. They are undeclared unless selected,
and a granted proxy such as `codemode` or `tool_search` can reach them. A
canonical allowlist containing only ordinary built-ins grants neither proxy.
An extension can change tools or run code with the process's permissions;
these selections do not sandbox extension code, the OS, or the network.
`--no-autonomy` adds no native flag, so native saved permission settings still
apply. See Pi's [tools](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/cli.md#tools)
and [MCP exposure](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/mcp.md#control-tool-exposure).

## Live-session controls

Before choosing a delivery mode or interrupting, check the latest
`identity.capabilities.sessionControls`, or the session packet's `controls`
until the first `identity` arrives. Claude `queue` selects native priority `later`; `steer` selects
`next` and can merge into the current result. Omitted busy input can also merge.
A merged input creates no additional hcn turn, and native background output has
no caller id. Claude `interrupt` writes the native interrupt control request
once the process advertises `interrupt_receipt_v1`; until then, or when it
does not, the request is rejected `unsupported` with nothing written. The
native success response only acknowledges it: an `aborted_streaming` or
`aborted_tools` result confirms `interrupted`, and that turn ends clean.
The receipt belongs to the turn live when the request was written; a later
turn's result never settles it. Claude keeps its queued messages; hcn never cancels or resends them.

Pi `queue` and `steer` use the prompt's native `streamingBehavior`, so the
harness decides atomically whether to start or deliver into ongoing work.
Pi sends are written one at a time, each only after the previous send's
native response, so back-to-back sends cannot race inside the harness.
`interrupt` requests native abort and waits for an aborted settlement before
reporting `interrupted`. Pi keeps its queued messages through abort. Send any
replacement after the terminal interruption receipt; the same conversation
continues. A `handled` input does not start a model run. Pi has no native
background jobs and no native stop; `stop-background` rejects `unsupported`.

Claude's task records (a `run_in_background` Bash call, an Agent call,
inline or background) surface as `background` events, and a subagent's own
tool, tool-result and message events carry `parentCallId`. `backgrounded`
tells the agent forms apart: `false` is an inline (foreground) agent,
`true` a background job. hcn forwards a boolean `is_backgrounded` only on
the event whose own record carried it (`task_started` today); later
events for the job carry no flag - remember it by job id if you need it
on every event. The call's `run_in_background` input is unreliable
because Claude may background a call that omits it. A job's end can
arrive after `result`, between turns. When no published turn owns it,
it stands alone on the wire as a bare `background` line and opens no turn,
including while a send awaits acknowledgment. Stopping one is
`stop-background`, which writes claude's native `stop_task` control request:
the `background-stop` receipt says the request was accepted, and the job's
end arrives on the stream as its own `background` event.

Codex advertises `steer`: native `turn/start` while idle, `turn/steer` while
busy under `expectedTurnId`. Other modes remain unsupported. Cancellation is
best effort and does not undo actions or guarantee every tool process stops.
See the [receipt protocol](reference.md#delivery-and-interruption).

## Native approvals and input requests

When a turn reports that a native approval, input, or control request
cannot be handled headlessly, report the failure and let the human decide
before retrying. Do not add `--autonomy` on your own and do not
automatically retry to clear it: `--autonomy` grants unattended approvals,
which is the human's call.

Builds with interaction detection stop Claude control requests and Pi RPC
dialogs; Muse uses its read-only pending-request API because exec can omit
requests from stdout. A muse approval whose command asked to run outside
the muse sandbox (a sandbox escalation) ends the turn on the first sample;
its failure names `-- --sandbox-network enabled` first - that passthrough
keeps approvals and the filesystem sandbox - before answering in muse or
`--autonomy`. Codex exec rejects unsupported requests itself, and
Pi print mode returns noninteractive dialog defaults. A completed tool
denial is not a pending approval. Only terminal native outcomes establish
turn failure; informational notices remain notices.

For permission-preserving headless continuation or answering a live native
approval, read [native approvals](native-approvals.md).

## Cursor

Cursor runs behind a workspace-trust gate: an untrusted directory fails
the turn with failure class `trust-refused` (retryable - route the work
elsewhere or to a trusted directory). Trust a directory by running
`agent` there once outside hcn; `--autonomy` renders `--force`, which
bypasses the gate per run without persisting trust. hcn never passes
`--trust`. Cursor's captured locked-keychain failure printed `Your macOS
login keychain is locked.` on stderr and exited 1. hcn reports it as `auth`
with `authKind: credential-access`, retaining the diagnostic line and following
stderr in the message and the exit code in `nativeExitCode`. The owner must
restore cursor credential access in the context the run executed in. Never
unlock a keychain or enter a password on the run's behalf. An unlock from
another shell or SSH session may not reach that context. Effort on cursor resolves into the
`--model` slug through per-family ladders (`--model gpt-5.2 --effort high`
runs `gpt-5.2-high`); a bare family stem without `--effort` refuses, and
only arg-tier `--effort` enforces. `--access read` selects native ask mode
(`--mode ask --sandbox enabled`). `--access write` renders `--force`,
which grants unconfined commands and bypasses workspace trust: use it only
with the human's authorization for that access. Even native
`--force --sandbox enabled` allowed writes outside the workspace in
qualification. The normalized `--sandbox` option therefore still refuses.
`--autonomy` independently adds `--force` even with `--access read`; precedence
against ask mode is unverified. Use `--no-autonomy` for the qualified read preset,
including when configuration enables autonomy.
Denied tool calls arrive as `tool-result` with `isError: true` and
non-terminal `error` events carrying
a structured `denial` field (`tool`, `reason`) with exit 0.

## Antigravity

Antigravity uses `agy --print <prompt> --output-format stream-json` and
maps `--sandbox workspace-write` to its boolean native `--sandbox` flag.
Its model vocabulary is extensible. The listed models were captured on a
free Individual plan and do not claim paid-plan eligibility. Native
non-success `result.status` values fail the turn even when the process
exits 0. Structured `tool_info.error` permission failures emit
non-terminal `error` events with `denial`; model prose never establishes
a denial. HCN caller cancellation outranks Antigravity's shutdown
`context canceled` result, and an HCN wall-clock timeout remains a timeout.
Quota error records remain unqualified because qualification did not
deliberately exhaust the free allowance.

## OpenCode

OpenCode runs one-shot turns as `opencode run --format json` and writes one
JSON object per line: `step_start`, `tool_use`, `text`, `step_finish`,
`reasoning` (only with `--thinking`) and `error`. A `tool_use` line carries
the tool and its settled state together, so it is one tool event and one
tool result; a `text` line carries the whole text part, so the stream is
message-granular, not token-granular. Every line carries the harness-minted
`sessionID`, so the first line announces the session even when that line is
the failure.

The model vocabulary is open: OpenCode's free roster rotates, so hcn curates
no model list and `--model provider/model` passes through. A free model needs
no account and no API key. The data terms differ per free model (some retain
prompts or train on them); hcn does not choose the model.

`run` auto-rejects every permission request, so a turn that needs one is
denied by OpenCode itself. `--autonomy` renders the native
`--dangerously-skip-permissions` flag, which approves those requests once.
`run` takes a variadic positional message and joins trailing text into it,
so a passthrough tail after `--` refuses before spawn instead of rewriting
the prompt. An unknown session id is a refusal (exit 1, `Session not found`),
not a fresh session; an unknown model arrives as an opaque `UnknownError`.
The free tier's own wall names `FreeUsageLimitError` in the provider's
response body and the Go plan's names `GoUsageLimitError`; both classify as a
usage limit. OpenCode retries such a wall up to five times before it reports
it, waiting as long as the provider's `retry-after` asks, and prints nothing
while it waits, so a limited turn can go silent before it fails. Bound it
with `--timeout`.

For private code, pick a free model whose provider keeps no data, such as
`opencode/glm-5.3-flash-free` (OpenCode's Zen docs, 2026-11-10); `big-pickle`
and several others may retain prompts or train on them.

A prompt that starts with `-` reaches `opencode run` as a flag and fails
natively. hcn's default question preamble hides this; with `--questions none`,
start the prompt with another character.

Only the one-shot turn is supported. There is no persistent session mode, no
transcript reading (OpenCode files its sessions in a SQLite store under the
XDG data root), no context inspection, no compaction claim, no tool selection
and no access preset.
