The agent
thespider-agent is a small local binary. It logs you in, claims work, runs your model CLI in the checkout, and posts the output. Prompts, parsing, and findings live on the server.
Install the skill (optional)
npx skills add https://thespider.xyz -g
Then ask a coding agent "Get me started with TheSpider." or "What's the next TheSpider step in this repo?" On-prem, pass your instance origin.
The skill is for the coding agent you work with. It does not reach audits: a built-in agent's audit runs with agent isolation, which leaves out globally installed skills such as this one.
Commands
thespider-agent setup [--model <lab/model>] [--agent grok|claude|codex|opencode|<any>] [--command TPL]
[--effort LEVEL] [--profile security|bugs|hygiene|pipeline] [--project org/slug]
thespider-agent check-models [--json]
thespider-agent status [--json]
thespider-agent progress [--campaign <id>] [--json]
thespider-agent login | init | logout | models | run | gate
thespider-agent campaigns cancel <id> [--reason TEXT] [--dry-run] [--yes] [--json] # alias: campaign
thespider-agent daemon [--interval SECS] [--workdir DIR] [--models a,b] [--profile P] [--redact]
thespider-agent findings list|show|triage|link|unlink|packet|copy
thespider-agent log list|show|path|clean
thespider-agent lease list [--campaign <id>] | lease release <lease-id>... [--dry-run] [--yes]
thespider-agent wait --campaign <id>
thespider-agent refine [--max-iterations N] [--min-severity SEV] [--list]
thespider-agent update
--model names the model (models.dev code). --agent names the local CLI. --code / --harness are deprecated aliases. --model claude does not select the Claude CLI; use --agent claude.
Setup and a first run
cd /path/to/repository
thespider-agent setup --project acme/payments-api --profile bugs
# Uses the models and efforts selected for Bugs in the web UI.
# --profile takes security, bugs, hygiene or pipeline (hygiene and pipeline need thespider-agent 0.7.0 or later).
# On a new project, hygiene or pipeline keeps security as the default (the PR gate profile).
# Without a project argument or config, omit --model on a terminal to search models.dev.
thespider-agent run --once --max-slices 1
| Flag | Default | Meaning |
|---|---|---|
--model | project selection; interactive search without a project | Choose one models.dev code explicitly, e.g. xai/grok-4.6 |
--agent | matching native agent or OpenCode for the project selection; otherwise auto-detect | grok, claude, codex, opencode, or any other name with --command |
--command | none | Required for an agent TheSpider does not know. {prompt_path} is the slice prompt. |
--model-id | derived from --model | Override only if the agent CLI names the model differently, e.g. through a reseller |
--effort | none (the CLI's default) | Reasoning effort, and the participant the binding claims as: Grok --reasoning-effort, Claude --effort, Codex model_reasoning_effort, OpenCode --variant (OpenCode 1) or --model provider/model#<effort> (OpenCode 2). With --command it is recorded but not added to the command. |
--variant | none | OpenCode spelling of --effort; must match --effort if both are given |
--skip-model-check | off | OpenCode only: bind the model id without checking it against opencode models |
--refresh | off | Re-download the models.dev catalog |
--agent and --model are independent: --agent codex --model anthropic/claude-opus-5 is fine.
Reasoning effort
thespider-agent setup --model anthropic/claude-opus-5-5 --agent claude --effort xhigh
Setup enables anthropic/claude-opus-5-5 at xhigh for the project and writes effort = "xhigh" on the [[model]] block. It applies to audits and to refine's fix runs.
| Agent | Accepted values |
|---|---|
claude | low, medium, high, xhigh, max |
grok | none, minimal, low, medium, high, xhigh, max |
codex | Any value. Setup and check-models warn outside none to max; Codex sends it to the API as-is. |
opencode | The provider's variant names. OpenCode 1 gets --variant <effort>; OpenCode 2, which has no --variant, gets --model provider/model#<effort>. The agent picks the form from opencode --version. |
A Claude or Grok typo is refused at setup and when the config loads, because Claude would silently run at its default effort. Every value is at most 64 characters from A-Z a-z 0-9 . _ / : - and doesn't start with -.
Compare efforts of one model
An effort is a participant: the server plans, claims and reports per (model, effort) pair. To compare Opus at low and at xhigh effort on identical prompts, bind it once per effort and run:
thespider-agent setup --model anthropic/claude-opus-5-5 --agent claude --effort low
thespider-agent setup --model anthropic/claude-opus-5-5 --agent claude --effort xhigh
thespider-agent run
Each setup enables its own pair and writes its own block. A model already bound at another effort, or with none, keeps its block. Setup rewrites nothing; it only adds a block when that exact pair isn't bound yet. The campaign then plans one slice per pass, bucket and pair. Each slice goes only to a binding at its own effort, and never to another effort of the same model. Terminal output names a pair anthropic/claude-opus-5-5@xhigh. The project's models dashboard, progress and finding reports show the two efforts side by side.
A block with no effort is the model's default-effort participant. TheSpider records the effort the runner declares and doesn't check what the provider actually ran. Beside a command, effort is declared. It is the label the block claims under, the command runs as written, and the command must run at that effort itself. check-models shows effort xhigh (declared; command not checked) for such a block.
Effort participants need a server with the model_effort capability (see server_capabilities on /v1/me). Against an older server, setup --effort and models enable|disable --effort stop before any write. run and daemon claim only the bindings without an effort, with one warning naming the ones they skip. Upgrade every agent that shares a config to 0.8.0 or later before you bind a second effort of one model: older agents reject two blocks with the same code. A lone effort key is ignored by older agents, which then claim only that model's default-effort slices.
Model aliases and reseller listings
A lab's own alias is a code of its own (configuration). Bind it like any model:
thespider-agent setup --model deepseek/deepseek-flash --agent opencode
Model: deepseek/deepseek-flash (DeepSeek V4.1 Flash, 1M context; models.dev alias of deepseek/deepseek-v4.1-flash)
The model id comes from the alias code the same way it does for any code: OpenCode runs deepseek/deepseek-flash, and Grok, Claude and Codex would run deepseek-flash. Its reports are recorded under deepseek/deepseek-flash. models.dev maps it to deepseek/deepseek-v4.1-flash, but TheSpider can't verify which model the vendor routes it to, and the setup summary says so. check-models also names the target when this machine has a cached catalog, without a network call.
--model-id is for a different case: the model is the same, and only the provider that serves it differs. A reseller listing such as azure/gpt-5.6-sol is not a code. Setup refuses it (from the cached catalog, or else the server does) and names the model it lists. Bind that model and pass the id your agent uses for the provider:
thespider-agent setup --model openai/gpt-5.6-sol --agent opencode --model-id azure/gpt-5.6-sol
Don't bind an alias under its target's code (--model deepseek/deepseek-v4.1-flash --model-id deepseek/deepseek-flash). That files the alias's reports under a model TheSpider never verified ran.
OpenCode model ids
OpenCode names models by the provider that serves them, not by the lab that made them, so zhipuai/glm-5.3 may be installed as zai-coding-plan/glm-5.3. Before writing an OpenCode binding, setup runs opencode models and checks the id against it. If exactly one local id matches the model name, setup uses it. If several match, it lists them and asks for --model-id. Nothing is written until the id checks out.
opencode models loads every configured provider before it prints, which can take 10 to 20 seconds. Setup waits up to 60 seconds. On a slower machine, raise the limit:
THESPIDER_OPENCODE_MODELS_TIMEOUT=180 thespider-agent setup --model zhipuai/glm-5.3 --agent opencode
The value is whole seconds, from 1 to 3600. check-models uses the same limit. Setup and check-models each run opencode models at most once, and only when an OpenCode binding needs checking.
If you already know the id and the catalog is slow or unreachable, skip the check with --skip-model-check. Setup then writes --model-id, or the code itself, exactly as given, so pass --model-id whenever the local id differs from the code (--model zhipuai/glm-5.3 --model-id zai-coding-plan/glm-5.3). check-models checks it later. The flag is refused for other agents, which have no model check.
While it waits, setup prints one line to stderr naming the command and the limit, so a long pause is not mistaken for a hang.
An agent TheSpider does not know:
thespider-agent setup \
--model alibaba/qwen3.8-max \
--agent pi \
--command 'pi run --model qwen3.8-max {prompt_path}'
New projects have no default model. In the web UI, project creation has a dedicated Select your models step. After choosing them, run:
thespider-agent setup --project acme/payments-api --profile security
Setup binds the models and reasoning efforts already enabled for that profile without changing the server selection. It chooses the matching installed native agent or OpenCode. You can pass --agent opencode to run the selection through OpenCode instead. If no models are selected, setup links to project settings. If an agent is missing, no bindings are written. init --project acme/payments-api --profile security writes only a scaffold; use setup to bind the selected models.
Explicit setup --model <code> still adds and enables one model. For older projects, it can retire an untouched legacy starter that nobody chose or ran. Setup will not overwrite an existing freeform command on that code. With several org memberships it asks which org. It only auto-picks a project on an exact remote match or an explicit --project.
Check local CLIs
thespider-agent check-models
Offline and free: no server call, no model call. It probes the four built-in CLIs (version and login status, 10-second timeout each), lists whether each project binding's command is on PATH, and shows the agent isolation an audit of each binding requests from the installed CLI (agent isolation: under the binding). When a binding uses OpenCode without a custom command, it also checks the model id against opencode models (60-second limit, THESPIDER_OPENCODE_MODELS_TIMEOUT to change it). Exit 1 only when a built-in agent a binding uses is missing or logged out, or an OpenCode model id cannot be confirmed. Grok cannot answer an auth probe, so that line is "unsupported", not a blocker. A probe that fails for a reason TheSpider cannot classify is auth unknown and never blocks; the CLI's own reason is shown, secret-masked, with a cause: line naming the failure class and file when its output names them. A block that sets both agent and command is shown as a custom command whose agent is probed only for install and login, and its model id is not checked, because the command never receives it. --json emits the versioned envelope.
thespider-agent models is different: it compares local bindings with the models the server has enabled.
What an audit loads
A built-in agent (grok, claude, codex, opencode) runs on your machine, so by default its CLI would also load your own setup: skills, plugins, hooks, MCP servers, custom agents and commands. When TheSpider itself runs inside a coding-agent session, the CLI would also inherit that session's injected configuration. OpenCode's OPENCODE_CONFIG_CONTENT, for example, can carry a session token. An audit should see only the checkout, the prompt and what it needs to reach the model. That is agent isolation, and it is on by default.
Two parts:
- Parent-session variables are always removed. Session ids, messaging sockets and tokens, injected config and permission modes set by an OpenCode, Claude Code, Codex or Grok parent session are removed from every built-in agent run and from every probe, whichever CLI it is. Your credentials and the paths a CLI needs to find its login (
HOME,XDG_*,CODEX_HOME,GROK_HOME,*_API_KEY, proxies, CA bundles) are never removed. - Your own extensions are switched off (
agent_isolation = "on", the default). Each CLI is asked to skip them with the switches it has:
| Agent | Left out | Still loaded (no switch) |
|---|---|---|
claude | --safe-mode (user and project CLAUDE.md, skills, plugins, hooks, MCP, custom commands and agents), --disable-slash-commands, --strict-mcp-config, --no-session-persistence. Audits also pin --permission-mode default, so a defaultMode in your settings can't let an audit edit files. | Nothing, on Claude Code 2.1.169 or later. Older versions get only the other three switches: they still load the hooks and plugins in your user settings and your ~/.claude/CLAUDE.md. TheSpider does not use --setting-sources project there, because it would also drop the provider env, apiKeyHelper and model in your user settings.json. |
codex | --ignore-rules, -c features.hooks=false -c features.plugins=false -c features.apps=false, and -c mcp_servers.<name>.enabled=false for each server codex mcp list shows in the directory the audit runs in | Skills, and ~/.codex/AGENTS.md |
opencode 2 | --standalone (a private server, so the shared background server's state can't leak in) with OPENCODE_DISABLE_CLAUDE_CODE=1 (no ~/.claude compatibility source) and TheSpider's own OPENCODE_CONFIG_CONTENT: user plugins disabled (plugins: ["-*", "opencode.*"]), skills denied, and the plan agent an audit runs as reset to its built-in prompt, read-only, and limited to the built-in explore and general subagents, so a user override of plan or a user subagent doesn't apply | MCP servers from your OpenCode config, ~/.config/opencode/AGENTS.md, the ~/.agents compatibility directory (its skills are denied), and sampling settings (temperature, top_p, steps, options) a user config puts on plan |
opencode 1 | --pure, OPENCODE_DISABLE_EXTERNAL_SKILLS=1, OPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1, skills denied, and the same plan reset (subagents through the task permission) | MCP servers, ~/.config/opencode/AGENTS.md, and sampling settings a user config puts on plan |
grok | The Claude Code and Cursor compatibility loaders (GROK_CLAUDE_*_ENABLED=false, GROK_CURSOR_*_ENABLED=false), --no-memory, --no-subagents | Skills in ~/.agents/skills, ~/.grok/AGENTS.md, and MCP servers added with grok mcp |
Your provider and model configuration and your login stay. refine's fix step runs OpenCode's build agent with the same reset, except that it may edit. User commands stay defined, but an audit's fixed message runs none of them.
A CLI flag is added only when the installed CLI lists it, so an older CLI keeps working and the missing switch is reported as a gap. Before run, daemon or refine creates a campaign or claims a slice, the agent probes each CLI it is about to use (--version and --help, plus opencode models --help, 10 seconds each). A probe is reused for 10 minutes while the executable on PATH stays the same, so the daemon re-reads an upgraded CLI without probing it on every poll. If a probe fails or exits non-zero, the run stops there, before anything is billed. With agent_isolation = "off", a Claude, Codex or Grok binding needs no probe: when it fails, the run goes ahead without isolation flags and the CLI version is recorded as unknown. OpenCode is always probed, because OpenCode 1 and 2 need different commands.
Preflight runs in the prepared runner directory (the audited worktree with --isolated). Codex MCP servers are re-listed at every campaign preflight, not reused from the executable cache. The validated commands are frozen for that campaign's execution, so cache expiry cannot trigger a required probe after a slice has been claimed and billed. Restart the run to pick up CLI or configuration changes made during a campaign.
Two OpenCode setups are refused before anything is claimed, whatever agent_isolation says about extensions:
- OpenCode 2 without
run --standalone. The run would go to the shared background server, which ignores the environment TheSpider sets and can hold a parent session's injected configuration. Upgrade OpenCode. - OpenCode 1 with
keep_plugins. OpenCode 1 can only drop every plugin (--pure) or none, so it can't keep only the listed ones. Upgrade to OpenCode 2, or setagent_isolation = "off"for that binding.
Every level is what TheSpider requested. A CLI silently ignores an environment variable or a codex -c key it doesn't know, so TheSpider can't verify what the CLI honoured. check-models shows each binding's level for the installed CLI: full, partial (with what still loads), off, or none. run, daemon and refine print one warning per binding when the level is not full, and each lease log's meta.json records it under agent_isolation (requested level, CLI version, gaps).
A command runs as written, so its level is none. That includes the old env -u CLAUDECODE claude --model sonnet --print < {prompt_path} line an older setup wrote. Replace it with agent = "claude" to get isolation. To isolate a custom runner, see custom runners.
When a model needs a user plugin
Some OpenCode providers come from a user plugin, for example an auth plugin that provides anthropic/*. An isolated OpenCode run drops it, and the model is then not found. setup and check-models compare the isolated and unisolated opencode models listings and say when a model is provided only by a plugin. Keep just that plugin:
[[model]]
code = "anthropic/claude-opus-5"
agent = "opencode"
keep_plugins = ["cortexkit-anthropic-auth"]
keep_plugins needs OpenCode 2. OpenCode 1 can only drop every plugin or none, so a binding with keep_plugins is refused on OpenCode 1 before anything is claimed.
When setup refuses a model for this reason, the block isn't written yet. Rerun with --skip-model-check to write it, then add keep_plugins (or agent_isolation = "off") to it. Or set THESPIDER_AGENT_ISOLATION=off:<code> on this machine, which setup takes into account. On a re-run over an existing block, setup checks the model against that block's own keep_plugins and agent_isolation.
Turning isolation off
[[model]]
code = "openai/gpt-5.6-sol"
agent = "codex"
agent_isolation = "off"
off loads your own skills, plugins, hooks, MCP servers and rules again. Parent-session variables are still removed, and Claude audits keep --permission-mode default. The project file is shared, so off there applies to every machine. For one machine, set THESPIDER_AGENT_ISOLATION instead. It wins over the file:
| Value | Effect |
|---|---|
off / on | Every built-in binding on this machine |
off:<code>[,<code>…] / on:<code>[,…] | Only those codes, at every effort. <code>@<effort> names one participant. |
THESPIDER_AGENT_ISOLATION=off:anthropic/claude-opus-5 thespider-agent run
refine uses the same isolation for its fix and retest runs.
Turn a model off
setup --model enables a model for the project. models disable is the way back, so a terminal-only, scripted or agent-driven setup never needs the web UI:
thespider-agent models disable xai/grok-4.6 --dry-run # what would change; writes nothing
thespider-agent models disable xai/grok-4.6 --yes # do it (off a terminal, --yes is required)
thespider-agent models enable xai/grok-4.6 # the reverse
thespider-agent models disable anthropic/claude-opus-5-5 --effort low --yes # one effort only
Without --effort, enable and disable act on the model's default-effort participant only. Other efforts of the same model stay enabled, keep planning slices and keep billing their claims; turn each one off with its own --effort <level>. After a disable (and in --dry-run), the CLI lists the efforts of that model that are still enabled, with the --effort command for each.
Disabling a participant does three things in one step: the server stops offering that pair, its unfinished slices are skipped (pending ones, failed ones with retries left, and ones whose lease already expired), and the [[model]] block for that pair is removed from .thespider/config.toml. Slices running on a live lease are left to finish; the command reports how many. Findings the model already reported stay, with their attribution.
Skipping is what unblocks a campaign planned with a model nobody binds: it can finish, and wait and the PR gate reach a verdict. A campaign that finishes with skipped slices reads degraded (wait and gate exit 4), never a clean pass, because that coverage was never audited. A new finding still outranks it.
| Flag | Effect |
|---|---|
--effort LEVEL | Act on that effort participant only (default: the model's default-effort participant). Disabling one effort skips only its slices and removes only its [[model]] block. Needs a server with the model_effort capability; an older one gets exit 6 before any request that writes. |
--dry-run | Print the profiles, skipped slices and config edit; change nothing on the server or in the file. |
--yes, -y | Consent without prompting. Off a terminal it is required (exit 5 without it). |
--profile security|bugs|hygiene|pipeline | Disable for one profile only (default: all). The local [[model]] block is kept, because the model may still be enabled for the other profiles. |
--project org/slug | Act on another project. This checkout's config is not edited. |
--keep-local | Leave the [[model]] block in the file. |
--json | Emit the versioned envelope. |
Disabling an already-disabled model exits 0, and still skips anything an earlier disable (for example one made in the web UI before slices were skipped) left behind. It needs an organization owner or admin; anyone else gets an error that names the role. Exit codes: 0 ok, 1 the server does not know that model code, 5 usage (bad argument, or confirmation needed or declined), 6 operational.
enable needs no confirmation: naming the code is the consent, as with setup --model. It does not add a local binding (setup --model <code> --agent <agent> does). Slices skipped by an earlier disable return to pending the next time run creates or reuses that campaign.
thespider-agent status covers both plus the work that is actually waiting:
readiness: ready — full plan for profile security: 18 slices (6 buckets x 3 passes x 1 enabled model); `run` plans only the models it claims
runnable here: openai/gpt-5.6-sol (agent codex)
(runnable here = whether this checkout can run the model; campaign claimability is below)
campaign: #24 full on main @ abc1234 (running): 13 of 24 slices completed — its own allocation
model total claimable leased completed failed skipped here
openai/gpt-5.6-sol 8 7 0 1 0 0 runnable
xai/grok-4.6 8 0 0 8 0 0 not bound
zhipuai/glm-5.3 8 0 0 8 0 0 not bound
7 claimable now by models runnable here: openai/gpt-5.6-sol (7) — `thespider-agent run --campaign 24 --models openai/gpt-5.6-sol`
The two numbers are two denominators. readiness: is the profile's full plan from today's
methodology and enablement; a campaign's own total is fixed by what it was created with, and run
plans a campaign only for the models it claims, so the two can differ. runnable here is purely
local (a [[model]] binding, the model enabled for the profile, and its command on PATH) — it
says nothing about whether the campaign still has work for that model.
The campaign: block is the same one thespider-agent progress prints. It shows the newest
campaign on the profile that still has outstanding work (pending, running, or failed with attempts
left), else the newest campaign; each model's row says what is left for it and whether this checkout
can run it (runnable, bound (command missing), bound (disabled), not bound). Below the table
each kind of remainder gets its action: claimable by a model nobody here runs, held by a live lease,
out of attempts (repair), skipped (model disabled), a model disabled with work outstanding, and
invalid coverage.
Its token: line says whether the stored credential was verified, and if not, why: not logged in,
rejected by the server, server unreachable (with the DNS / connect / TLS / timeout cause), or
verification failed. Only the first two are fixed by login — see
troubleshooting. status
exits 0 when the credential was verified and every read succeeded (or when there is no project
config to check), and 1 otherwise; --json carries the same state as auth.state. Offline it can
take a while: one retry cycle against the server, then the agent CLI probes (up to 10 seconds each).
Progress
thespider-agent progress [--campaign <id>] [--profile security|bugs|hygiene|pipeline] [--json]
One campaign's per-model allocation, read-only. Without --campaign it picks the campaign the way
status does; with it, that campaign's own profile wins. claimable is exactly what a claim would
hand out now (a model disabled for the profile is never claimable), leased is held by a live lease,
and the two never overlap: an expired lease is claimable again if its participant is enabled, or failed on its last attempt.
failed includes slices out of attempts. --json emits the
versioned envelope.
Run
thespider-agent run [--campaign <id>] [--profile security|bugs|hygiene|pipeline] [--once] [--max-slices N] [--models a,b] [--redact] [--target-path DIR] [--isolated]
Without --campaign, this creates a full campaign from local git metadata, planned only for the bound models it will claim (another agent binding a different model on the same commit adds its slices to that campaign), claims slices for those models, runs each with sh -c, and posts stdout. --once --max-slices 1 is the bounded first-run.
| Flag | Semantics |
|---|---|
| (none) | Drains the campaign: claim a batch, run it, repeat until nothing unattempted is claimable for this invocation. An older server without claim_exclude permits one batch per invocation. |
--campaign ID | Works that campaign instead of creating one. Its profile and target commit win; a contradicting --profile is a usage error, never a silent override. |
--once | Stops after one claim batch (concurrency × 4, capped at 25). The batch is smaller when fewer slices are claimable at that moment, and the run still stops after it. |
--max-slices N | A budget: keeps claiming batches until N slices have been claimed or nothing claimable is left. |
--models a,b | Narrows the claim to a subset of your [[model]] bindings. It can never add a model — a code with no local binding is unclaimable with or without it. |
--target-path DIR | The runner working directory and the project-config discovery root. |
--once and --max-slices combine only as --once --max-slices 1: a one-slice budget is always a single batch, so the two bounds cannot disagree. With any larger N they can (a batch that comes back short would stop the run below N), so --once --max-slices N is a usage error (exit 2) that prints your command with --once removed. Use --max-slices N alone to run N slices.
A bounded run states its bound before it claims, and every run that reaches the claim loop prints one stopped: line, right after run summary:, saying why it stopped:
bound: at most 3 slices (--max-slices 3)
…
run summary: leases=3 accepted=3 reports=11 failed=0
stopped: --max-slices 3 reached (3 of 3 slices claimed)
campaign #42: 9 of 24 completed; 15 remain (running)
continue: thespider-agent run --max-slices 15 --campaign 42 --profile security --target-path /src/app --isolated
stopped: line | Meaning |
|---|---|
--max-slices N reached | The budget was spent. |
--once: one claim batch done (K of K …) | The one batch came back full. |
--once: one claim batch done; the claim returned K of the M slices requested … | The batch came back short. The server returns fewer slices than asked for when fewer are claimable for those models at that moment. |
nothing more claimable … after K of the N slices | The campaign ran out of claimable work for those models before the budget was spent. thespider-agent status splits what remains by model. |
nothing claimable … | The first claim came back empty; the lines above name the models the remainder belongs to. |
no unattempted work is claimable … | No unattempted slice is claimable for these models. This invocation excludes slices it already tried; fix a failed binding before deliberately retrying them. |
this server lacks claim_exclude … | One batch was processed. Upgrade the server to drain safely, or resume manually with --once. |
drained the claimable work … in one batch or …; no claimable work remains … | Progress confirms no selected work is currently claimable. No resume command is printed; the run exits 0 unless a slice failed. Protocol warnings remain visible. |
reached the 10000-slice exclusion limit … | The runner stopped before another claim. Other work may remain; resume with another invocation. |
the server returned attempted slices despite exclusions … | Every returned lease was processed. Finish upgrading the server before resuming. |
the server returned more leases than requested … | Every returned lease was processed. Check the server version before claiming remaining work. |
A server advertising claim_exclude filters out every slice this invocation already attempted
before issuing another lease, so a failed low-id slice cannot hide untouched work or spend an
attempt without a model call. The exclusion set is limited to 10,000 public slice ids. The runner
stops before another claim at that limit and explains how to resume; it never silently truncates
the set. Against an older server it executes one batch, then checks progress. Every returned lease
is processed. If no selected work remains claimable, it reports that the drain finished without
upgrade or resume advice.
If a safety stop leaves selected work claimable, or the server's progress cannot establish its
eligibility, the run prints continuation guidance and exits 4 (degraded), including for an
unbounded invocation. These stops include unsupported exclusions, the exclusion limit, ignored
exclusions and oversized answers. When progress confirms no selected work is claimable, the run
exits 0 without a resume command. A slice failure still takes precedence with exit 1. Completing a requested
--once batch or --max-slices budget keeps its ordinary success exit. A daemon warns once about
an older server, then continues with safe batches on subsequent polls.
A bounded run ends with the campaign headline (campaign #24: 13 of 24 completed; 11 remain (running)) and, when there is something this checkout can claim, a continue: line reproducing this invocation, so resuming never silently drops --isolated or --target-path. Its --max-slices is what the selected models can claim now, not the campaign's whole remainder, and a note says how many more are held by a live lease or belong to other models. If the selection is spent but another model runnable here still has work, the line names that model with --models. If nothing this checkout can run will drain the remainder, there is no continue: line: the run says why (nothing this checkout can run will drain the remaining 11: …) and what would help.
Because a slice belongs to exactly one model, a run can stop with no claimable slices while the campaign still reports work. It then gives each selected model's reason — all its slices completed, held by a live lease, out of attempts, skipped, disabled for the profile, or not in the campaign at all — and names the models the remainder does belong to, and whether they are bound here. When the selected models' slices are held by a live lease, it lists those leases (see Leases). See troubleshooting. A campaign holding invalid coverage also prints the repair --dry-run command on the way out.
Before the first claim, the agent prints the resolved project file, target path, project selector, and profile — so which .thespider/config.toml won is never a guess.
If the target has gitignored .env*, key, or database files, the agent warns. Those files are not uploaded to TheSpider, but a local model agent can still read them and send tool output to its provider. --isolated runs the model in a detached worktree of the audited commit so those ignored files are not in the tree.
Cancelling a campaign under a run
When someone cancels the campaign while run is working it, the agent learns it from its next successful heartbeat (or from a claim that answers 409 campaign_cancelled). It then:
- kills the models still running, including slices still waiting in its queue, and stops claiming;
- prints
campaign #N was cancelled by <actor> at <time>: <reason>, then how to start fresh; - does not count the stopped slices as failures.
run summary:gains acancelled=Nsuffix, shown only when N is above zero; - exits
4(degraded), or1if another slice really failed.
Detection waits for a heartbeat that gets through, so a model can run for up to about two heartbeat intervals after the cancel (an interval is a third of the model timeout, between 15 and 60 seconds). run --campaign N on an already-cancelled campaign prints the same message and exits 4 before it claims anything, rather than saying "no claimable slices". thespider-agent repair on a cancelled campaign changes nothing, says so and exits 4. A late result from a killed run is stored as provenance only.
Daemon
For team / PR CI: one long-lived process on a box that has model credentials and git access. CI never runs a model. See PR gate.
thespider-agent daemon [--interval 30] [--workdir DIR] [--models a,b] [--profile P] [--redact]
It polls claimable campaigns, clones the exact commit into a managed checkout, then claims and runs like run. Cancelled campaigns are never offered. If one is cancelled while the daemon works it, the daemon announces it, kills its models, counts no failure (daemon summary: gains cancelled=N only when N is above zero) and moves on to the next claimable campaign. SIGINT / SIGTERM finish the in-flight campaign and stop; the in-flight work keeps renewing its leases until it is done. Git auth is whatever that OS user already uses (ssh-agent or an HTTPS helper).
Leases
Every claimed slice is held by a lease. While the agent works on a slice it renews the lease
with a heartbeat; when the model finishes, the result is posted and the lease ends. If the runner is
killed, nothing renews the lease, and the slice stays running until the lease expires.
With attempts left, an expired lease is reported as stalled, inside the pending count, and can
be claimed again if its participant is enabled. If that participant was disabled while the lease
was still live, re-enable it or repeat the disable operation to skip the remaining slices.
Stalled work is no longer counted as running. The campaign and Slices views show its expiry
and a resume path. On the last attempt an expired lease is failed coverage instead.
On a current server the agent asks for a 5-minute lease and renews it at least every 60 seconds (more often for short model timeouts), including while slices wait in the queue for a free worker and while the result is being uploaded. A killed runner's slice is claimable again within about five minutes, provided its participant remains enabled. Against a server that does not advertise the new lease handling, the agent keeps the old lease (the model timeout plus 5 minutes, at least an hour).
The short lease has costs:
- A runner that cannot reach the server for more than about five minutes (network outage, a laptop going to sleep, server downtime) can lose its slice to another runner. Its next heartbeat says the slice was superseded, and it stops the model. The model call is spent twice, but the result is never ingested twice.
- If nobody else claimed the slice meanwhile, the next heartbeat that gets through renews the expired lease and the runner carries on.
- Every reclaim spends one of the slice's attempts (3 by default). A slice on its last attempt
whose lease expires is retired to
failed, even if its runner later delivers a result the server accepts; the runner is told its lease ended but nobody else holds the slice, keeps going, andthespider-agent repairgives the slice a fresh attempt.
The alternative, an hour-long lease plus a manual release, would leave every crashed runner's slices stuck for an hour unless someone intervened.
When nothing was claimable because the selected models' slices are held, run names the leases:
no claimable slices for models [anthropic/claude-sonnet-5-5]
anthropic/claude-sonnet-5-5: nothing claimable — 1 of 12 completed, 2 held by a live lease
2 slice(s) are held by a live lease:
slice #213 lease #90 anthropic/claude-sonnet-5-5 claimed 28m ago, last renewed 27m ago, expires in 32m [this token] attempt 1 of 3
local log: no process with pid 48121 on this host
slice #221 lease #94 anthropic/claude-sonnet-5-5 claimed 3m ago, last renewed 30s ago, expires in 4m [another token] attempt 1 of 3
(a local pid observation does not show whether the runner is alive elsewhere — see #27)
they return to the queue when the lease expires (unless it is the last attempt)
if you know their runner is gone: thespider-agent lease release 90 --dry-run
Ages come from the server's clock. [this token] means the token this agent uses claimed the lease.
A lease on its last attempt reads expires in Xm, then fails (last attempt — repair gives it a fresh one). The local log: line appears only when this machine has a lease log for that exact lease. It
reports what this host can see about the writer's process id, which says nothing about a runner on
another machine or in a container, and a reused pid can look alive. It never decides anything.
thespider-agent lease list [--campaign <id>] [--profile security|bugs|hygiene|pipeline]
thespider-agent lease release <lease-id>... [--dry-run] [--yes]
lease list prints the same block for every current lease of a campaign, whatever its model, plus
leases that expired and have not been reclaimed (they no longer hold their slice). The default campaign
is the one progress picks.
lease release frees a lease early. It shows the server's verdict for each lease first, and
--dry-run stops there. The server allows a release only when:
- the token this agent uses claimed the lease. Tokens are shared by every runner that uses them, so this limits who can release, not which runner it was;
- the lease is still the slice's current lease;
- it has been renewed at least once and then went 180 seconds without a renewal. A lease that was never renewed proves nothing by being quiet (an MCP host agent or an external agent may still be working on it), so it waits for its expiry.
Leases held by another token, or by a deleted token, cannot be released; they free themselves when
they expire. A lease that no longer holds its slice (finished, or a stale row under a newer lease) is
reported as not needing a release, whoever claimed it; a stale row this token left active is
retired by a real release without touching the slice. If the slice is busy (a result is being
ingested) the lease is reported with an error and nothing is released — run it again. With a 5-minute lease a release saves at most about two minutes. It matters mostly for
the hour-long leases of older agents. The agent asks for confirmation on a terminal and needs --yes
without one. Lease ids are always explicit, and the local pid observation never selects one.
When a second shutdown signal interrupts an in-flight model in daemon or refine, the agent stops the model and its heartbeat without submitting partial results. It does not attempt release: the server refuses never-renewed or recently renewed leases, even for their owner. The interrupted lease expires on its own.
On Unix, model process groups contain ordinary descendants, but a descendant that starts its own session can escape group signals. Linux parent-death signaling protects only the direct shell. If the parent ends between spawning the shell and registering its group, descendants the shell already forked can also survive. Inherited ignored signals stay ignored, so a nohup-started agent and its model survive SIGHUP.
Exit codes for lease release: 0 every named lease no longer holds its slice (released, or already
not holding it), 1 any lease was not found or refused, 5 usage (including confirmation needed or
declined), 6 operational (including a busy slice, a failure on any one lease — the others are still
processed — and a server that cannot release leases). lease has no --json.
Logs
thespider-agent log list [--slice N] [--limit N] [--all-servers] [--project org/slug] [--all-projects] [--json]
thespider-agent repair --campaign ID [--dry-run]
thespider-agent log show <slice-id> [--lease N] [--stream stdout|stderr|both] [--follow] [--timeout SECS]
thespider-agent log path <slice-id> [--lease N]
thespider-agent log clean (--older-than-days N | --all) [--all-servers] [--include-running] [--dry-run]
Every lease attempt writes its own directory on the machine that ran the model: <data dir>/thespider/logs/<server id>/<slice id>-<lease id>/, holding meta.json, stdout.log, stderr.log, and a terminal result.json. Payload files append the model's bytes without rewriting them; missing bytes are described below. Nothing here is uploaded, needs auth, or talks to the server, and a read never creates a directory.
The positional argument is a slice id, as printed by run and daemon. A leading # is accepted, because that is how log list prints it (slice #88 lease #12) — log show 88 and log show '#88' are the same command, and both take the newest attempt; --lease N pins one. Show and path read only the current project config's server and name that namespace on stderr. To read another server's row from an all-server listing, run in that server's configured project. log path 88 prints just the directory to stdout for your own tail -f. Show sanitises model output, stripping C0 controls except \n, \t, and \r, C1 bytes, and ESC-introduced escape sequences. The files under log path are the byte-faithful route.
--follow exits 0 after a parsed terminal record and the final payload drain. Its 1800-second default timeout covers both waiting for creation and following, as one budget. If a result-less writer PID is confirmed gone, list shows interrupted; follow drains buffered output, prints an interruption note, and exits 7 without creating result.json. Unverified probes remain conservatively running and are labelled liveness unverified. Plain show only dumps bytes: exit 0 does not certify completion. A downstream closed pipe, such as | head or quitting less, ends show/follow with 0; consume the full output when relying on exit 7.
Exit codes: 0 ok, 1 no log for that selector, 3 follow timed out, 5 usage, 6 operational, 7 followed writer interrupted. Operational errors include an unreadable root or namespace, an entry-inspection or walk I/O failure, a selected lease that cannot be removed, an unreadable terminal during follow, or a log directory removed during follow. An incomplete list prints available rows but exits 6. A missing store is 1, not 6. A corrupt meta.json is skipped with a warning; after inspection, log clean --all --include-running can reclaim it. Add --all-servers to recover another namespace.
Retention is manual and local: nothing sweeps these directories, each stream is capped at 32 MiB, and log clean --older-than-days 14 (or --all) is the only collector. log list defaults to the project in the active .thespider/config.toml. --all-projects widens that; --project org/slug pins one. Rows that span projects include the project selector. A row from an agent older than 0.5.0 has no stored selector. When another attempt of the same slice (same server, slice id and prompt hash) recorded one, the row shows it as org/slug (from lease #N) and is filtered by that project; otherwise it shows (project not recorded) and is shown under any project filter rather than hidden, and log list says on stderr how many were resolved and which agent version wrote the rest. --json emits the versioned envelope, with project_source per row. Clean defaults to the current repo's server namespace. Add --all-servers to sweep every local namespace without resolving the current server first. This flag only widens scope, so it still needs --older-than-days N or --all. The sweep only enters 16-character lowercase hexadecimal server namespaces, continues after a namespace failure, reports an aggregate, and exits 6 if incomplete. Unrelated directories under an operator-supplied log root are untouched. Without --include-running, all result-less leases are kept, including writers shown as interrupted. This applies to both selectors and every server scope.
A present but unreadable or malformed result.json is reported as terminal record unreadable; it is not classified from PID liveness and default cleanup keeps it. Missing or unreadable metadata is tallied separately and requires --include-running. Control files must be regular, non-symlink files of at most 1 MiB.
All listing scopes only read real canonical <slice>-<lease> directories, not lease symlinks. Filename IDs and both metadata server identities must match for listing and ordinary deletion. All-server list and clean also require real 16-character lowercase hexadecimal namespace directories, never namespace symlinks. Explicit --all --include-running recovery can delete canonical leaves with missing or unreadable metadata, but never overrides readable mismatched identities. Clean covers all projects with no row limit in the selected server scope, unlike list's project filter and default 50-row limit. Use clean's --dry-run as the deletion preview.
The default app-created log root is private. A custom root must not be writable by untrusted users: cleanup revalidates namespaces and leaves before traversal and removal, but these checks are not atomic against hostile mutation. PID probing is local to the writer's machine and PID namespace. Shared roots across hosts or containers can make a live writer look gone in list/follow; keep logs machine-local for meaningful classification. Default cleanup never uses PID liveness as permission to delete a result-less lease. PID reuse can make interrupted leases appear running and delay follow until timeout. After verifying the writer has stopped, --include-running permits reclamation. Logging is best-effort: if terminal persistence and its Drop retry both fail, the result-less log is indistinguishable from an interrupted run. Default cleanup retains both.
thespider-agent repair --campaign ID requeues completed slices whose winning result was not valid coverage (nonzero exit, missing marker, bad JSON). Valid empty arrays are left alone. --dry-run only prints the valid / invalid / unverified counts. THESPIDER_LOG_DIR moves the root; THESPIDER_NO_LOGS=1 turns lease logging off. On Windows, %APPDATA% roams — point THESPIDER_LOG_DIR somewhere local.
Lease logs and --redact
The agent keeps a per-lease run log on your machine under its data directory: the model's stdout and stderr, plus a small metadata and result record. Nothing is uploaded; this is separate from the artifact the server already stores.
--redact masks secret-shaped strings in stdout (and caps stdout at 1 MiB) and in stderr before upload. It leaves file paths and other long runs that read as words alone, so app/code/Mage/Adminhtml/controllers/Permissions/UserController.php arrives intact. Masking uses the same rules as the server's scrubber. The flag governs the local copy by exactly the same rule, so it means one thing everywhere. Both streams follow the flag:
- stdout follows
--redacton both sides. Without the flag, the log holds the model's raw stdout, streamed as it arrives — that is what makeslog show --followlive. With the flag, the log holds the same masked, 1 MiB-capped buffer that is uploaded. - stderr follows
--redacton both sides. Without the flag, the log holds the raw stderr stream and the upload carries its raw last 4000 bytes. With the flag, both hold the masked stream (the upload carries the last 4000 bytes of the masked stream).
Under --redact the payload is not live: nothing reaches the disk while the model runs, and both files are written once, when the model exits, so log show --follow reports the lease's state and liveness during the run and delivers the output at the end. That is a deliberate trade, and --redact is off by default.
The local stderr.log holds the model's complete stderr, while the upload carries only its last 4000 bytes — the local copy is the bigger exposure of the two, not the smaller. Both local streams are capped at 32 MiB each; past that the agent stops appending and records the truncation in the result record.
result.json tells apart the two ways a payload file can fall short. stdout_truncated with stdout_dropped_bytes: 0 is the cap — the file is a prefix of the stream. A non-zero stdout_dropped_bytes means the log filesystem could not keep up — it stalled for two full seconds, or cost the model's pipe thirty seconds of backpressure over the run — so the agent stopped teeing that stream rather than hold up the model, and bytes are missing. log_errors names the stream and a warning goes to stderr during the run. Only the local copy is ever affected — the artifact uploaded to the server is complete either way.
Read stdout_dropped_bytes and stderr_dropped_bytes to find out: they are authoritative and always correct. The file may also carry an in-band [lease log: N bytes dropped here] line where the bytes stop, but the thread that writes it is the one that was falling behind, so it lands only if the filesystem recovered before the lease ended. The absence of a marker is not evidence that the file is whole.
On Unix the log directory is 0700 and its files are 0600; on Windows they inherit the parent ACL, and note that %APPDATA% roams — set THESPIDER_LOG_DIR to keep multi-megabyte transcripts out of a roaming profile. Treat these files exactly as you would treat the raw artifact on the server. Nothing sweeps them: thespider-agent log clean is the collector, and THESPIDER_NO_LOGS=1 turns lease logging off entirely.
The server-side scrubber is a separate layer: it always runs on parsed findings and the stderr artifact, never on raw stdout artifacts, and never on anything the agent keeps locally. More: Data handling.
Findings
thespider-agent findings list --open --severity critical,high --json
thespider-agent findings list --since <campaign-id> # discovered AFTER that campaign
thespider-agent findings list --since 2026-09-01 # discovered on or after that date (UTC)
thespider-agent findings show 501 --json
thespider-agent findings packet 501
thespider-agent findings triage 501 --status accepted --reason "risk accepted"
thespider-agent findings link 501 502 --mr 128 # after opening merge request !128 for them
thespider-agent findings list --actionable --unlinked # what still has no merge request
--since is incremental triage: "what did that run add". A bare integer is a campaign id and
selects findings discovered after it (by creation order of the campaigns, never by comparing id values), so the
campaign you name is the one you already reviewed;
anything else is an ISO date or RFC 3339 timestamp, compared against when the finding was first
discovered (never against a later triage edit). --campaign <id> is the different question — findings
sighted in that campaign, including ones it re-confirmed.
Filters run on the server before pagination. --json prints one JSON document on stdout, including on failure. Envelope and exit codes: Agent CLI contracts.
Cancel a campaign
thespider-agent campaigns cancel 18 --dry-run # the preview; writes nothing
thespider-agent campaigns cancel 18 --reason "broken runner env" # confirm on a terminal
thespider-agent campaigns cancel 18 --yes --json # scripted
campaigns cancel <ID> ends a new or running campaign for good (alias campaign). It is modelled on models disable: it reads the server's preview (slices that will be cancelled, live leases with model, holder and age, finished slices, claims already billed), prints it, asks for confirmation on a terminal, and then writes. Off a terminal --yes is required. --dry-run stops after the preview. It needs the member role or higher. What cancel does, and does not do (no refund, findings kept, how to start fresh), is on Campaigns.
| Flag | Effect |
|---|---|
--reason TEXT | Recorded with who and when, shown to everyone who opens the campaign. At most 500 characters. |
--dry-run | Print the preview; change nothing. |
--yes, -y | Consent without prompting. Required off a terminal (exit 5 without it). |
--json | Emit the versioned envelope; narration goes to stderr. |
Exit codes: 0 ok, including a dry run and "already cancelled" (nothing is written, the original actor, time and reason stay); 5 usage (unknown campaign, a completed campaign, a reason over 500 characters, confirmation needed or declined); 6 operational, including a server that does not advertise campaign_cancel (nothing is sent), and a role below member. Agents older than this command have no campaigns subcommand; cancel from the web UI.
Wait vs gate
thespider-agent wait --campaign <campaign-id> --timeout 1800 --fail-on critical,high --json
thespider-agent gate --campaign <campaign-id>
They are different tools. wait blocks until the campaign is idle, then fails on actionable findings. gate is a single poll for CI (0 pass / 1 fail / 2 pending / 4 degraded). Do not mix their exit codes. Details: PR gate.
On a cancelled campaign both answer at once and neither says "clean": wait exits 4 (or 1 when a finding matches --fail-on), and gate reads degraded (exit 4) with reason: "campaign_cancelled", or fail (exit 1) on a new finding. gate prints the reason, who cancelled and why.
Refine
refine is the fix-and-verify half of the loop. It picks actionable findings, has a local model write a fix, records the commits as a proposed fix (needs_retest), then runs a retest. Only a finished retest concludes fixed or still_vulnerable.
Retests run as deliberate bounded batches, so a transient slice failure can be retried within the server's attempt budget. Each batch excludes work it has already attempted before claiming more; the retest loop can then start the next batch on purpose. A provider refusal cooldown or another deliberate block ends the retest attempt without waiting out the full retest timeout.
thespider-agent refine --min-severity high --max-iterations 2
Full flags, worktree, and threat model: Refine.
--redact masks secret-shaped stdout and stderr and caps stdout before upload. The server also scrubs parsed findings and the stderr artifact. Raw stdout artifacts store whatever was uploaded unless you pass --redact. It governs the agent's own lease log the same way — masked stdout, masked stderr. See Logs.