Agent commands

An agent runs these commands from anywhere in its sandbox. Each one talks to a server the runner starts on the loopback interface for that run. They work only inside a Spotlight run.

spotlight handover --next <where> [--note <text>] [--suggest done] [--attach <file>]...
spotlight reply --to <handle> [--body <text>] [--resolve]
spotlight trace --task <id> [--out <path>]
spotlight history --station <key> [--line <key>] [--fingerprint <fp>] [--outcome <word>] [--since <date>] [--last <n>] [--out <dir>]
spotlight recall "<words>" | <handle>
spotlight remember --kind <kind> --body <text> [--path <path>]... [--scope <scope>] [--supersedes <handle>]
spotlight forget <handle> --because <text>
spotlight hook post-tool-use
spotlight candidate --name <name> --hypothesis <text | @file> <station.json | ->
spotlight cause --task <task> --cause config|task|judge|check|infra --evidence <text | @file> [--suggestion <text | @file>]
spotlight maintenance check [--overlay <path>]... [--base <ref>] -- <command>...
spotlight tools
spotlight tools search "<words>" [--limit <n>]
spotlight tools describe <tool>
spotlight tools call <tool> [--<input> <value>...] [--json <object> | --json -]

In a search's agent run, reply, recall and remember are rejected with a search may not <reply to a review comment, recall what the team remembers or propose a memory>: it studies the station's history and proposes station configs, nothing more. forget is rejected in a search's run with a search may not propose to retire a memory: …, and in a replay with a replay may not forget: ….

The tools Spotlight itself adds are listed in Built-in tools and skills. Why agents talk back through a command line gives the reasons.

Environment

The runner sets these in the harness's environment. Every other SPOTLIGHT_ variable is removed from it.

VariableValue
SPOTLIGHT_AGENT_API_URLThe address of the run's loopback server, as http://127.0.0.1:<port>/.
SPOTLIGHT_AGENT_API_TOKENA random token for this run, sent as Authorization: Bearer.
SPOTLIGHT_STATE_DIRThe harness's state directory, /workspace/.spotlight/state.

Without SPOTLIGHT_AGENT_API_URL and SPOTLIGHT_AGENT_API_TOKEN, each command fails:

CommandMessage
handoverno run to hand over: spotlight runs inside a Spotlight workspace
replyno run to reply from: spotlight runs inside a Spotlight workspace
traceno run to read a trace from: spotlight runs inside a Spotlight workspace
historyno run to read history from: spotlight runs inside a Spotlight workspace
recallno run to recall from: spotlight runs inside a Spotlight workspace
rememberno run to remember from: spotlight runs inside a Spotlight workspace
forgetno run to forget from: spotlight runs inside a Spotlight workspace
hook post-tool-useNothing. It prints nothing and ends with success.
candidateno run to propose a candidate from: spotlight runs inside a Spotlight workspace
causeno run to record a cause from: spotlight runs inside a Spotlight workspace
tools, tools search, tools describeno run to get tools from: spotlight runs inside a Spotlight workspace
<tool>could not read this run's tools to find "<name>": no run to get tools from: spotlight runs inside a Spotlight workspace

Common behaviour

Value
Exit code on success0
Exit code on any error1, with the message on standard error
Request timeout2 minutes
An error from the serverPrinted as the server wrote it.
A token that does not matchnot this run's token
Spotlight unreachablereach Spotlight: <error>

Help

In a run, spotlight, spotlight --help and spotlight help list the agent commands by group. spotlight help --all also lists the commands for hosts, replays and the login.

Every command takes -h or --help, and spotlight help <command> prints the same text. The help gives the command's usage, its flags, examples and a link to its section on this page. It prints to standard output and exits 0. spotlight tools call <tool> --help prints what spotlight tools describe <tool> prints.

A usage error prints the command's usage line, then Run spotlight <command> --help for flags and examples.

A word that is not a command fails with spotlight: no command "<word>". and exits 1. A near command follows, as Did you mean spotlight handover?. When the word is an enabled tool, the line that follows names the call, as Tools are called with spotlight tools call, as in: spotlight tools call linear.comment.

spotlight handover

spotlight handover --next <where> [--note <text>] [--suggest done] [--attach <file>]...

Says where the task goes when the run ends. The run carries on until the agent's turn ends.

FlagRequiredDescription
--nextyesWhere the task goes. Matched without regard to case.
--notenoWhat the next station or person needs to know. Omitted, - or /dev/stdin: read from standard input to end of file, with surrounding whitespace trimmed.
--suggestnoWith --next review: done gives the person a Close button for the task. Matched without regard to case.
--attachnoA file to attach to the note, such as a screenshot. Repeat for more than one. At most 10 files, each at most 25 MB.

--next takes one of the values the run is offered: the keys of the stations a run at the current station may pass to, in line order, then review, then done where the current station ends the line. When each is offered, and what it does to the task, is in Handover.

--suggest done is for a run that finds nothing left to do at a station that does not end the line. The task is put to a person as with --next review. The person can answer, or close the task with one click. See Suggested close.

Each attached file goes on the note that the handover writes: the note to the next station, to the person, or that closes the task. The runner uploads the files when the command runs, so the command fails if a file cannot be uploaded. The file name is the name of the file on disk, and the content type comes from its extension, or from its first bytes when the extension is not known. A replay or a search run takes the files but does not attach them.

Running handover again replaces the earlier choice. The last accepted one counts.

OutputWhen
Passed to <next>.A station was named.
Put to a person. The task waits here until someone answers.--next review
Put to a person, with the choice to close the task. The task waits here until someone answers.--next review --suggest done
Closed at its current station.--next done
MessageCause
--next is requiredNo --next. The usage follows.
"<next>" is not one of: <options>--next names nothing on offer. The options are listed.
--suggest takes only "done", together with --next "review"--suggest names something other than done, or --next is not review.
unreadable handoverThe request body was not JSON.
read the note: <error>Standard input could not be read.
attach <file>: <error>The file is missing, is not a regular file, is larger than 25 MB, could not be read, or could not be uploaded.
attach at most 10 filesMore than 10 --attach flags.
spotlight handover --next code-review --note "Added retries to the webhook client."
spotlight handover --next review < question.md
spotlight handover --next review --suggest done --note "The retry already exists in webhook-client.ts."
spotlight handover --next review --note "Added the theme selector." --attach light.png --attach open.png

Without a handover

If the agent never runs handover, the runner reads /workspace/.spotlight/outcome.json when the harness exits:

{ "next": "code-review", "note": "Added retries to the webhook client." }

The file is ignored when it is missing, is not JSON, or has an empty next. Only next and note are read from it, so it cannot attach files. A file an earlier run left is removed when a run starts. With neither a handover nor the file, the runner reminds the agent once, and then the task goes to a person. See Turns without a handover.

spotlight reply

spotlight reply --to <handle> [--body <text>] [--resolve]

Replies to a review comment, on the pull request where the comment was made. The run's briefing lists the open review comments and their handles, such as c12.

FlagRequiredDescription
--toyesThe review comment's handle.
--bodyyesThe reply. Omitted, - or /dev/stdin: read from standard input.
--resolvenoResolves the thread as well.
OutputWhen
Replied to <handle>.Without --resolve.
Replied to <handle>, and resolved it.With --resolve.
MessageCause
--to is requiredNo --to.
--body is requiredNo body, and nothing on standard input.
name the review commentThe handle is blank.
write the replyThe body is blank.
unreadable replyThe request body was not JSON.
read the reply: <error>Standard input could not be read.
spotlight reply --to c12 --body "Renamed, thanks." --resolve
spotlight reply --to c14 < reply.md

spotlight trace

spotlight trace --task <id> [--out <path>]

Writes a task's trace to a file as indented JSON.

FlagRequiredDescription
--taskyesThe task whose trace to write.
--outnoThe file to write. Default: a new file spotlight-trace-*.json in the temporary directory.

On success it prints one line: Wrote the trace to <path>, the number of nodes, the number of errors, the time the trace spans, and advice to search the file rather than load it whole.

MessageCause
--task is requiredNo --task.
say which taskThe task id is blank.
open <path>: <error>--out could not be created.

spotlight history

spotlight history --station <key> [--line <key>] [--fingerprint <fp>] [--outcome <word>] [--since <date>] [--last <n>] [--out <dir>]

Writes a station's recent runs to files: the config each ran with, its journal, its outcome and its file changes. Only stations on the lines of the run's own team are read. Runs are the station's ended task runs, newest first.

FlagRequiredDescription
--stationyesThe station's key, matched exactly.
--linenoThe line's key. Needed when more than one of the team's lines has a station with that key.
--fingerprintnoOnly runs of this config: its full config fingerprint.
--outcomenoOnly runs whose outcome contains this word. See Outcome words.
--sincenoOnly runs queued at or after this date or time, such as 2026-09-01. A value that is not a date is ignored.
--lastnoHow many runs. Default: 30. At most 50; a larger number counts as 50, and 0 as the default.
--outnoThe folder to write into. Default: .spotlight/history in the current directory.

The runs are written to <out>/<station>/. Anything already in that folder is removed first.

FileContains
index.mdA table of the runs: each run, linked to its journal, then its task's title, config, ending, checks, the human action, the pull request state, the run number, cost, steps, duration and start. A run with no recorded outcome shows its state as its ending. A run whose usage is unknown shows unknown as its cost and steps. Then each config, oldest first: its fingerprint, its file, how many of the runs used it, what changed since the config before it, and the prompt's change as a diff.
configs/<fingerprint>.ymlOne config, as YAML: fingerprint, harness, model, effort, image, profile, repositories, skills, tools, decisions, memories, judge and prompt. judge contains rubricHash, or is null.
runs/<run>/journal.mdThe run's steps and spans: each step's text, a tool's input and output, and each file change as a diff. A run whose usage is unknown shows cost: unknown.
runs/<run>/outcome.jsonrunId, taskId, fingerprint and outcome, which is null for a run with no recorded outcome.
runs/<run>/diff.patchThe run's file changes as a unified diff. Written only for a run that changed files. Files are taken in the order they were first changed. A file whose text before and after is over 256,000 characters together, or does not fit in what is left of the run's 1,000,000 characters of changed-file text, is listed as Omitted <path>: too large to send whole.

index.md shows a fingerprint by its first 12 characters, and none for a run with no recorded config.

On success it prints three lines: Wrote the history to <folder>, the number of runs and configs, and a grep -r command to search the folder. In a search's run, a line before the last reads <n> candidates proposed so far, under <folder>/candidates.

In a search's run

In a search's agent run, only the searched station is read; any other is answered as a station no line has. The runs of the search's held-out tasks are left out, and every run of the searched tasks is written, beyond --last if need be. The folder also contains:

FileContains
current.jsonThe station block the search started from, the live config when it began.
index.mdAfter the runs and configs, a "Candidates" table: each candidate, linked to its score.json, its config, how many of its replay runs succeeded and were scored, its repeats, its rate, and its hypothesis. When a candidate replayed each run more than once, a line under the table says where its repeats are and how its rate is worked out.
candidates/<name>/block.jsonThe candidate's station block.
candidates/<name>/changes.diffHow block.json differs from current.json, as a unified diff. Left out when they are the same.
candidates/<name>/hypothesis.mdWhat the agent that proposed it expected it to improve.
candidates/<name>/score.jsonsucceeded and scored (replay runs, repeats included), repeats (repeats of each run), tasksScored (runs of the set with a scored repeat), rate (for each of those, the share of its scored repeats that succeeded, averaged; null while none was scored), failed (the tasks it failed, each once), verdicts (how many runs the judge passed and failed, as pass and fail), spent (per currency, every known cost of its replay runs: the agent harness and the models its tools called) and unpriced (model calls of its replay runs with no known cost: an unpriced harness session, a harness that reported use but no cost, or a metered tool call with no cost; a replay run with no usage recorded, or with usage that is unknown, counts as one).
candidates/<name>/runs/<original run>/journal.mdThe replay run's steps, as for a run. When the candidate replayed each run more than once, each repeat is under runs/<original run>/<repeat>/ instead, numbered from 1, and so are the two files below.
candidates/<name>/runs/<original run>/result.jsonrunId, original, repeat (which repeat, from 1), taskId, fingerprint, state, usage (known, the run's duration, steps, errors, context tokens, totalCost and currency, spentCosts (each amount and currency) and unpricedCalls, or null). known is false when Spotlight could not read what the run used, and reason says why: journal-unreadable, usage-entry-unreadable or recording-failed (see Spend). Then every other field of usage is null, and the run counts as one unpriced call. reason is null when known is true. Then come succeeded, reasons, verdict (pass, fail or null) and guidance. reasons contains each reason once, as <code>: <detail>. judged, judge-failed and check-failed are bare codes, without the judge's reasons or the check that failed. guidance is the judge's guidance field when verdict is fail, or The judge found the change falls short of what the task needed. when the judge gave none or Spotlight dropped it. Else it is null.
candidates/<name>/runs/<original run>/diff.patchThe replay run's file changes, when it changed files.

The candidate named seed is the live config the search started from, replayed on the searched tasks. A candidate's runs are its replay's runs on the searched tasks, one per task run of the set and repeat.

Outcome words

--outcome keeps a run when the word is one of these parts of its outcome. A run with no recorded outcome never matches. With --outcome, the latest 500 ended runs are searched, and --last of the matches are kept.

PartWords
Endingcompleted, failed, stopped, exhausted, cancelled, superseded. See Run endings.
Failure codeA failed or superseded run's code, such as exited. See Failure codes.
Human actionstarted, parked, accepted, answered, sent-back, held-as-wrong
Pull request stateopen, merged, closed
Checkschecks-passed, checks-failed, checks-skipped

Station outcomes says what each part means.

MessageCause
--station is requiredNo --station. The usage follows.
"<key>" is not a station key--station contains / or \, or is . or ...
--last counts runs, so it cannot be <n>--last is negative.
no line in this team has a station "<key>"No line of the run's team has the station.
line "<line>" has no station "<key>" in this teamThe named line has no such station, or is not the team's.
Several lines have a station by that key; name one with --line: <lines>More than one of the team's lines has the station, and no --line.
clear <folder>: <error>The earlier history could not be removed.
make <folder>: <error>A folder could not be made.
write <path>: <error>A file could not be written.
spotlight history --station implementation
spotlight history --line delivery --station implementation --outcome sent-back --last 10

spotlight recall

spotlight recall "<words>"
spotlight recall <handle>

Reads what the run's team remembers, beyond the memories its briefing lists. Only memories that are active in the run's own team are read, never proposed, rejected or retired ones, and never another team's.

Given words, it searches the bodies of the team's active memories and prints at most ten, the best match first. Words are matched by their English stem, so retry finds retries. Each is printed as:

M-12 · rejected approach · line, in acme/api at src/uploads
  Retrying uploads from a queue needs a worker we do not run.
  From a run on task <task id>, approved by Ada Lovelace on 2026-09-21

The last line says where the memory came from:

Last lineThe memory
From a run on task <task id>, approved by <name> on <date>Was drawn from a run of the task.
From notes by a person on task <task id>, approved by <name> on <date>Was drawn only from the notes that people wrote on the task, or was edited on the Memory page from one drawn from the task.
From a run on input from outside the team on task <task id>, approved by <name> on <date>Was drawn from a task that came from outside the team, or from a message that another tool wrote on the task.
Written by <name> on <date>Was written on the Memory page.

<name> is someone when the person is not known. With no match it prints The team remembers nothing about "<words>". Try other words.

Every memory a recall returns is recorded against the run, and shows under "Supplied to the agent" in "Memories" on its Run page; the recall itself is a spotlight.recall span in the task's trace.

Given a handle, such as M-12 or m-12, it prints that one memory in full: its kind, its status (active or retired), its body, where it applies, the steps and notes it cites, the spotlight trace command for its task, the memory it replaced, and, once retired, why and what replaced it.

MessageCause
say what to look forNo words. The usage follows.
Memory <handle> not found.No memory has that handle in the run's team.
A memory is recalled by at most 500 characters of words it contains, or by its handle, like M-12.The words are more than 500 characters.
spotlight recall upload retries
spotlight recall M-12

spotlight remember

spotlight remember --kind <kind> --body <text> [--path <path>]... [--scope <scope>] [--supersedes <handle>]

Proposes a memory from inside the run. It cites the step the agent ran the command from; where that step can't be found, it cites the last thing the agent said. It waits in the inbox beside the run, with anything drafted from the run, until a teammate approves, edits or rejects it, and is stored only once approved. A memory from a task that came from outside the team cannot be approved together with other memories. Proposing the same memory twice from one run keeps one.

FlagRequiredDescription
--kindyesrationale, rejected-approach, failure, environment, preference or correction.
--bodyyesWhat to remember, at most 1,000 characters. Omitted, - or /dev/stdin: read from standard input.
--pathnoA file or folder the memory is about, relative to the current directory or absolute. It must be inside one of the run's checkouts, and every --path in one repository. Within its repository, at most 500 characters. Repeat for more, up to 20 different paths.
--scopenoWhere it applies: team, line or station. Default: line. Choose the widest that is still true.
--supersedesnoThe handle of an active memory of the team that this one corrects. Approving it retires that one.

On success it prints Proposed <kind> for the <scope>: <body>, and that the memory waits for a person's approval.

MessageCause
--kind is requiredNo --kind. The usage follows.
--body is requiredNo body, and nothing on standard input.
put everything in flags, not "<word>"A word outside any flag.
A memory kind must be one of rationale, rejected-approach, failure, environment, preference, correction, not <kind>.--kind names no kind.
A memory scope must be one of team, line, station, not <scope>.--scope names no scope level.
<path> is outside the repositories this run checked out; name a path inside one of: <directories>A --path is outside every checkout.
A memory is about paths of one repository at a time.The paths are in different repositories.
A memory must be at most 1000 characters.The body is more than 1,000 characters.
A memory path must be at most 500 characters.A --path is more than 500 characters within its repository.
A memory can cover at most 20 paths.More than 20 different paths.
A memory supersedes only an active memory in the run's team, and <handle> is not one.--supersedes names a retired memory of the team.
Memory <handle> not found.--supersedes names no memory of the run's team.
A memory is remembered only from a task's run; in a chat, ask the person to write it on the team's Memory page.The run is a chat's.
spotlight remember --kind rationale --body "Uploads retry in the request, not from a queue." --path src/uploads
spotlight remember --kind correction --supersedes M-7 < correction.md

spotlight forget

spotlight forget <handle> --because <text>

Proposes to retire a memory that no longer applies, where no new memory replaces it. Where one does, use spotlight remember with --supersedes. The proposal cites the step the agent ran the command from. It waits in the inbox beside the run, like a proposed memory. The team keeps the memory until a teammate approves the proposal; approving it retires the memory with the reason.

FlagRequiredDescription
--becauseyesWhy the memory no longer applies, at most 500 characters. - reads it from standard input.

On success it prints Proposed to retire <handle>: <body>, and that the team keeps the memory until a person approves.

MessageCause
say which memory, like M-12No handle, or a handle that is not like M-12. The usage follows.
name one memory, not "<word>"A second word outside any flag.
--because is requiredNo reason, and nothing on standard input.
Memory <handle> not found.The handle names no memory of the run's team.
A memory retires only an active memory in the run's team, and <handle> is not one.The memory is already retired.
A memory is remembered only from a task's run; in a chat, ask the person to write it on the team's Memory page.The run is a chat's.
spotlight forget M-12 --because "The uploads queue was removed in October."

spotlight hook post-tool-use

spotlight hook post-tool-use < hook.json

The harness runs this command after each tool call; an agent does not run it. For Claude Code, Spotlight adds it as a PostToolUse hook for Read, Edit, MultiEdit, Write and NotebookEdit, with a timeout of 10 seconds.

It reads the hook input on standard input and takes the paths the tool used from file_path, path and notebook_path. Where a memory of the team is about one of those paths, or a folder above it, it prints the hook answer, which shows the agent:

The team remembers this about `api/src/uploads/retry.ts`, which you just used:
- **M-18** · rejected approach: Uploads retry in the request, not from a queue.

It shows each memory at most once in a run, and at most 5 at a time; the rest come at the agent's next prompt. It never shows a memory that the briefing lists, or one that was learned at another line or station. It counts each memory it shows as used by the run. On any error it prints nothing, so the tool call goes on.

Every other harness, Codex included, gets the same text at the start of its next prompt, from the tool calls it reported.

spotlight candidate

spotlight candidate --name <name> --hypothesis <text | @file> <station.json | ->

Proposes a station config from a search's agent run. The file contains the station block as JSON, in the shape of one entry of a line's stations; - reads it from standard input. Spotlight checks it, then replays it on the search's searched tasks. Only a search's runs may propose a candidate.

FlagRequiredDescription
--nameyesA slug unique in the search: lowercase letters, digits and hyphens, starting with a letter or digit, at most 63 characters. Not seed.
--hypothesisyesWhat the change should improve, and why, in 1 to 4,000 characters. @<file> reads it from a file.

The block may change only the station's prompt, harness, model, effort, profile, skills, tools, decisions, memories and description, from the block the search started from. Proposing the same name again from the same run answers with the candidate it proposed.

On success it prints:

Proposed <name> as candidate <id>.
Spotlight replays it as <replay id>; its results show in spotlight history once the replay ends.

A rejected block prints Spotlight rejected the candidate:, one line per problem as <path>: <message>, a warning marked (<severity>, not why it was rejected), and Fix the station block and propose it again. A rejected proposal does not count as one of the iteration's candidates, but an iteration may try at most three times as many as it may propose.

MessageCause
--name is requiredNo --name. The usage follows.
"<name>" cannot name a candidate: a name is a slug of lowercase letters, digits and hyphens, starting with a letter or digit, at most 63 characters--name is no slug.
--hypothesis is requiredNo --hypothesis.
name one file that contains the station block, or - to read it from stdinNo file, or more than one.
<path> is HCL; supply the station block as JSON, as the line resource contains a stationThe file ends in .tf or .hcl.
<path> contains no JSON object; it must contain the station block, as the line resource contains a stationThe file is not a JSON object.
<file> contains no hypothesis; say what you expect the change to do@<file> is empty.
this run cannot propose a candidate: only a search's runs doThe run is not a search's.
A search may change only the station's prompt, harness, model, effort, profile, skills, tools, decisions, memories, description; keep <field> as the search's starting config has itAt station.<field>: the block changes another field.
name cannot be reserved name seedAt name: the name is seed, which names the live config the search started from.
This search has a candidate named <name> already; name it otherwiseAnother iteration took the name.
This search iteration has proposed its <n> candidates, or tried to too often; end the runThe iteration may propose no more.
This search iteration looks into why the search stalled, so it proposes no candidates; record a cause for each failing task with spotlight causeThe run is a reflection's.
This run is no longer the active run of the searchThe search stopped, or moved on from this iteration.

Spotlight also checks the block as the line would be with the station replaced, by every rule of spotlight_line, and names each problem at its path under station, as in station.judge.claims. On top of those rules:

MessageCause
is a station block, as in a lineAt station: the block is not an object.
keeps the station's key, <key>At station.key: key names another station.
keeps the station on the line it is part ofAt station: the line would no longer contain the station.
names a harness a runner can startAt station.harness: the block runs no harness Spotlight can start.
spotlight candidate --name terse-prompt --hypothesis @why.md station.json

spotlight cause

spotlight cause --task <task> --cause config|task|judge|check|infra --evidence <text | @file> [--suggestion <text | @file>]

Records why a failing task failed, from the agent run of a search's reflection. Only the tasks its briefing lists take a cause. Recording a task's cause again replaces the one before.

FlagRequiredDescription
--taskyesThe task's id, as the briefing lists it.
--causeyesconfig, task, judge, check or infra. See Causes.
--evidenceyesWhat in the runs shows the cause, in 1 to 4,000 characters. @<file> reads it from a file.
--suggestionnoWhat a person, or the search's next iteration, should change, in at most 4,000 characters. @<file> reads it from a file.

On success it prints:

Recorded <cause> as the cause for task <task>, whose replay run <run> failed.
Recording another cause for the task replaces this one.
MessageCause
--task is requiredNo --task. The usage follows.
--cause is one of config, task, judge, check, infra--cause is missing or names no cause. The usage follows.
--evidence is requiredNo --evidence. The usage follows.
read the evidence: <error>@<file> for --evidence could not be read; read the suggestion for --suggestion.
<file> contains no evidence@<file> is empty; contains no suggestion for --suggestion.
this run cannot record a cause: only a search's runs doThe run is not a search's.
This search iteration proposes candidates; only an iteration that looks into why the search stalled records causesThe run's iteration is not a reflection.
No failing task <task> among the tasks this reflection looks into; record causes only for the tasks its briefing lists--task names a task the briefing does not list.
A cause's evidence says what in the runs shows the cause, in 1 to 4,000 charactersThe evidence is over 4,000 characters.
A cause's suggestion says what to fix in at most 4,000 charactersThe suggestion is over 4,000 characters.
This run is no longer the active run of the search, or The run <run> is no longer the active run of the search, so the search takes no more candidates from itThe search stopped, or moved on from this iteration.
spotlight cause --task a17c4e02-9b3d-4f61-8e5a-0c2d7b9f4a13 --cause judge --evidence @evidence.md --suggestion "Drop the claim that requires tests."

spotlight maintenance

Commands for a run on a maintenance task: a task that fixes the cause of a pattern of corrections. See Fix the mistakes people keep correcting.

spotlight maintenance check

spotlight maintenance check [--overlay <path>]... [--base <ref>] -- <command>...

Runs a command, such as a linter or a test, on the code before and after each fix that people made for the pattern, to show whether a new check catches the mistake, and records the result in Spotlight.

The command and its arguments come after --. spotlight maintenance alone prints its help, as spotlight help maintenance does.

FlagDefaultDescription
--overlay <path>The files the task branch changed since --base, and untracked files, except the files the corrections nameA file or folder of the new check to copy onto the code before and after each fix. Repeat it for more than one. Each must be inside a clone of a corrected repository.
--base <ref>The merge base with origin/HEAD, else origin/main, else origin/masterWhere the task branch began.
spotlight maintenance check -- npx oxlint src
spotlight maintenance check --overlay oxlint/no-swallowed-errors.js -- npx oxlint src

What it does

It reads the corrections behind the pattern that the run's task fixes, from the run's loopback server, which the runner passes to GET /api/runs/{runId}/maintenance/corrections. A correction with a repository and a commit before and after the fix, as from a person's push, is checked. Its corrected paths are the file it names, or else the files changed between the two commits.

For each such correction, and for each of the two commits:

  1. It checks out the commit as a git worktree of the repository's clone, and runs the repository's setup command there.
  2. It runs the command. The corrected paths that the output names, when the command fails, are the baseline: what the old checks report already.
  3. It copies the overlay onto the worktree, and runs the command again.
  4. A corrected path that the output now names, and that the baseline did not, is a new failure.

The output names a path when it prints the whole path, or the end of it from a folder down, as a tool that prints paths from its own package does. For packages/api/src/a.ts, the output may name src/a.ts, but the file name a.ts alone does not count. A shorter end counts only when no other file in the worktree ends the same way: when packages/web/src/a.ts also exists, only api/src/a.ts or the whole path names the file.

A correction with no pair of commits is not checked. A result names at most 100 paths: the first 100, in the order the check found them. A path of more than 1,000 characters is left out. The result counts the paths it left out, and the summary ends the list with and <n> more.

ResultShownWhen
caughtCaughtThe command newly fails on the code before the fix, and not after it.
too-wideToo wideThe command newly fails on the code after the fix.
missedMissedThe command newly fails on neither.
not-checkableNot checkableThe correction has no pair of commits.

It then records the results with POST /api/runs/{runId}/maintenance/checks, the same way. The pattern's card on the Patterns tab shows the totals under "History check", and each correction shows its result.

Output

It prints a summary in Markdown, for the pull request's description:

Checked 3 corrections with `npx oxlint src` for the pattern "Errors are swallowed in catch blocks":

- Caught in acme/api at src/jobs/retry.ts: Don't swallow the error here.
- Caught in acme/api at src/http/client.ts
- Not checkable: Please log the error before you return.

Caught 2, missed 0, too wide 0, not checkable 1.

Each line gives the result, the repository, the paths and the first line of the correction's text, as far as each is known. The totals come from Spotlight.

Exit codes

CodeMeaning
0It checked the corrections and recorded the results, whatever they were.
1It could not check or record them. The message says why.

Errors

MessageCause
put the command after --No -- in the arguments. The usage follows.
say which command to run after --Nothing after --. The usage follows.
put the command after --, not "<word>" before itAn argument that is not a flag comes before --.
no run to check from: spotlight runs inside a Spotlight workspaceSPOTLIGHT_AGENT_API_URL or SPOTLIGHT_AGENT_API_TOKEN is not set.
No run <runId> held by this runner, or it fixes no correction pattern.404. The run's task is not a maintenance task.
--overlay <path> is outside the clones of the corrected repositoriesAn overlay is not in a clone of a repository that a correction names.
find where the branch in <clone> began: none of origin/HEAD, origin/main, origin/master is there; name it with --baseNo default base is in the clone.
the setup of <repository> failed at <commit>: <error>The repository's setup failed in a worktree. The last 20 lines of its output follow.

spotlight tools

spotlight tools

Lists the tools enabled for the run, up to 30 of them. Each entry is the tool's signature, its description, and a line for each input that has a description. For a tool acme.comment with a required input issue and an optional stdin input body:

spotlight tools call acme.comment --issue <string> [--body <string> (or piped in)] [--json <object> | --json -]
  <description>
    --issue  <input description>
Signature partMeaning
--<input> <string>An input that takes text, or one of a list of values.
--<input> <number>An input that takes a number or a whole number.
--<input> <json>An input that takes a list, an object or anything else, written as JSON.
--<input>A boolean input, given as a bare flag.
(or piped in)The input may come from standard input.
[...]Optional, or has a default.
[--json <object> | --json -]Every input at once, as one JSON object. Shown for a tool with inputs.

A tool that requires approval lists [--intent <string>] after its own inputs, and its description ends with the reason a person approves it and Say what you want to do with --intent; the person reads it first.

A run with more than 30 tools enabled prints a summary instead: how many tools it has enabled, each integration's name with its number of tools, and the search and describe commands. Spotlight's own tools are counted under Spotlight, and catalog tools under the Spotlight catalog.

This run has 214 tools enabled, too many to list:
  Linear  195
  Petstore  19

Find one with: spotlight tools search "<words>"
Read one with: spotlight tools describe <tool>

A run with no tools enabled prints This run has no tools enabled.

MessageCause
spotlight: no command "tools <word>".A word after tools other than search, describe or call. A near command follows, if there is one.
spotlight tools search "<words>" [--limit <n>]

Ranks the run's tools by how well they match the words, and prints the best first. The search runs in the command over the run's tool list. Nothing is sent anywhere.

FlagDefaultDescription
--limit10How many tools to print at most. At least 1.

The words and every tool's name, integration and description are split into lower case words at spaces, punctuation and changes of case, so linear.issueCreate and linear.issue-create both read as linear issue create. Each word of the search scores against each of the three:

MatchPoints
A word of the field equals it10
A word of the field starts with it6
It starts with a word of the field of 3 letters or more4
A word of the field contains it2
The field contains it anywhere1

Only the best match in each field counts. Points in the name count three times, in the integration's name twice, and in the description once. Where the search has two words or more and they appear together, in order, in a field, that field adds 8 points, weighted the same way. A tool that matches every word of the search scores a quarter more. Tools that match nothing are left out. Equal scores rank the tool with fewer words in its name first, then by name. Words of one letter in the search are ignored.

Each result is the tool's signature, the first line of its description (cut at 160 characters), and Needs a person's approval. for a tool that requires approval. The last line names the describe command for the best match.

spotlight tools call linear.issue-create --title <string> --team-id <string> [--json <object> | --json -]
  Create an issue.

Read one with: spotlight tools describe linear.issue-create
MessageCause
No tool enabled for this run matches "<words>". Try other words, or run spotlight tools.No tool matches any word. Printed to standard output, with exit code 0.
say what the tool doesNo words were given. The usage follows.
--limit is how many tools to show, at least 1--limit is below 1. The usage follows.
spotlight tools search "create issue"
spotlight tools search pets by status --limit 3

spotlight tools describe

spotlight tools describe <tool>

Prints one tool enabled for the run, named as <integration>.<tool> or as two words, as in linear.issue-create or linear issue-create. In order, it prints:

PartContent
HeadingThe tool's name, and (from <integration>) for an integration's tool. Its description follows, with the reason a person approves it for a tool that requires approval.
Takes:The inputs as a TypeScript object type, or Takes nothing. for a tool without inputs.
Answers with (inferred from earlier calls, may be incomplete):The answer's shape as a TypeScript type, for a tool with an inferred output. Left out otherwise.
For example:One call to start from.

The type marks an optional input, or one with a default, with ?. Each description becomes a /** */ comment above its input. Names that are not JavaScript identifiers are quoted, as in "team-id"?: string.

SchemaTypeScript
string, number, integer, boolean, nullstring, number, boolean, null
enum, constA union of the literal values, as in "open" | "closed"
anyOf, oneOf, a list of typesA union, as in number | null
allOfAn intersection, as in A & B
array with itemsT[], or unknown[] without items
object with properties{ name: T; … }, with [key: string]: T for a schema in additionalProperties
object without propertiesRecord<string, unknown>
Anything else, or nested deeper than 6 levelsunknown

The example call gives every required input without a default, and --intent for a tool that requires approval. Each value is the schema's first examples entry, else its default, const or first enum value, else "…" for text, 0 for a number and true for a boolean. An object gives its required properties the same way, and a list has one item. Where every input given is text, a number or a boolean, the call uses flags. Otherwise it gives every input as one object with --json.

linear.issue-create (from Linear)
Create an issue. Needs a person's approval before it runs: It posts publicly under the team's name. Using it asks them and does nothing else, so hand over and wait for their answer. Say what you want to do with --intent; the person reads it first.

Takes:
{
  /** What it is about */
  title: string;
  "team-id": string;
  labels?: string[];
  intent?: string;
}

For example:
spotlight tools call linear.issue-create --title "…" --team-id "…" --intent "…"
MessageCause
say which toolNo tool was named. The usage follows.
this run has no tool "<name>" enabled; the nearest are <tools>No granted tool has that name. Up to three that match it best follow, by the search ranking.
this run has no tool "<name>" enabledNo granted tool has that name, and none matches it.
spotlight tools describe linear.issue-create
spotlight tools describe petstore find-pets-by-status

Inferred output

After a call to an integration's tool succeeds, Spotlight infers the shape of what it answered: field names and types, never values. It does this in the background, and never slows or fails the call. Each later successful call is merged into it. Every shape spotlight tools describe prints is inferred.

RuleValue
Depth5 levels. Deeper values are unknown.
Items of a listThe first 20.
Parts400 per answer. Past that, unknown.
Keyed by dataAn object with more than 40 keys, or with a key that is not a plain name (a letter, _ or $, then up to 63 letters, digits, _, $ or -) or that contains 3 digits or 8 hexadecimal characters in a row, is kept as [key: string]: T. Its keys are not stored.
Changing keysWhen a later answer brings an object whose keys are mostly new (more than half of them not seen before), the object is kept as [key: string]: T too, so keys that vary between calls, such as user names or labels, are not stored.
A field one answer leaves outOptional, marked ?.
Different kinds for one fieldA union, as in string | null. More than 4 kinds become unknown.
Answers with (inferred from earlier calls, may be incomplete):
{
  id: string;
  url?: string;
}
  • The shape is kept per team and per tool. It is read when a run starts, so it shows in runs that start after a successful call.
  • Updating or deleting the integration deletes it, and so does deleting the team.

spotlight tools call

spotlight tools call <tool> [--<input> <value>...] [--json <object> | --json -]

Calls a tool enabled for the run, by its full name. A tool of an integration has the integration's name first, as in spotlight tools call acme.comment. A built-in tool has its name alone, as in spotlight tools call pull-request. Its flags are its inputs, by the names the tool gives them, as in --team_id or --petId. See spotlight_integration for how an integration defines tools and their inputs.

InputHow it is given
Text or a number--<input> <value>. A number is written in decimal, so 0x10 is rejected.
boolean--<input>, present or absent, or --<input>=false
A list of text--<input> <value> once for each item, as in --attach a.png --attach b.png. One value may also be the whole list as JSON, as in --labels '["bug", "ui"]'.
A list, an object or anything else--<input> '<JSON>', as in --filter '{"team": "ENG"}'
Standard input--<input> <value>, or --<input> -, or --<input> /dev/stdin, or omitted with standard input not a terminal. Empty standard input counts as not given.

--json <object> gives every input at once as one JSON object, keyed by input name, with each value in its JSON type. --json - or --json /dev/stdin reads the object from standard input. A flag given beside --json replaces that field of the object. When --json reads standard input, no stdin input does: an input left out stays out, and naming one with - or /dev/stdin is rejected.

Spotlight checks the inputs against the tool's schemas before it calls the service, and rejects a call that does not fit, saying where, as in linear.issue-create takes input, and input.teamId is not text. See Input schemas.

For a tool that requires approval, --intent <phrase> says what the agent wants to do, completing "Spotlight would like to …". It is optional, shown to the person who decides, and never passed to the tool. See What the agent wants.

The tool's result is printed to standard output. When the tool returns {"output": ...}, only the output is printed, as indented JSON with a string included, as in "https://linear.app/acme/issue/ENG-12". Who the tool acted as is recorded on the run and not printed. Any other result is printed as it came. Built-in tools answer with an object, as in {"url": "…"} from pull-request.

MessageCause
say which toolNo tool after call. The usage follows.
this run has no tool "<name>" enabled; the nearest are <tools>No enabled tool has that name. Up to three near tools are named.
--<input> is requiredA required input without a default was not given. The tool's signature follows.
<command>: <flag error>A flag the tool does not take, or a missing value. The tool's signature follows.
<command>: "<value>" follows --<input>, which takes no value; write --<input>=<value>A value after a boolean flag, as in --notify false. The tool's signature follows.
<command>: "<argument>" is not a flagA word outside any flag. The tool's signature follows.
--json takes one JSON object, as --json '{"name": "value"}'The --json value, or what it read from standard input, is not a JSON object. The tool's signature follows.
read the --json piped in: <error>Standard input could not be read for --json -.
--<input> cannot be read from stdin when --json isA stdin input was named with - or /dev/stdin while --json read standard input. The tool's signature follows.
<tool> takes <input>, and <where> <why>An input does not fit its schema. See Input schemas.
this run has no tool "<name>" enabled; it has: <tools>The tool is not granted to the run.
unreadable input: hand the tool JSONThe input is over 8 MiB, or is not JSON.
could not read this run's tools to find "<name>": <error>The tool list could not be read.

Other failures are the tool's own error as Spotlight reports it.

spotlight tools call acme.comment --issue <issue> --body "Deployed to staging."
git diff | spotlight tools call acme.comment --issue <issue>
spotlight tools call petstore.find-pets-by-status --status sold
spotlight tools call linear.issue-create --input '{"teamId": "<team id>", "title": "Flaky upload test"}'
spotlight tools call linear.issue-create --json '{"input": {"teamId": "<team id>", "title": "Flaky upload test"}}'
spotlight tools call linear.issue-create --json - < issue.json
spotlight tools call acme.comment --issue <issue> --body "Deployed to staging." \
  --intent "post the staging deploy on the issue, publicly under the team's name"

On this page