specgate/docs v1.8.0

Drive the harness from a tool#

An editor or a dashboard — specgate-studio's Build and Live views — starts specgate harness run and follows it without reading prose: the run's JSON, its stream, the stop command and the API. This page is that contract. For what the harness does, see The harness.

Stop after the requirement in progress#

bash
specgate harness stop --after-current

The run finishes the requirement it is on and starts no other. The rest are reported as not attempted, and --format json says why under stopped (by: request). Nothing is killed: the run reads the request between requirements, the same way on every platform. With no run working in the project, nothing is requested and the answer says so (harness_not_running).

specgate harness stop --now ends the run at once instead, with every command it started; the answer says stop.now: true, and the requirement in progress keeps its worktree for specgate harness run --resume (REQ-583).

Look before the next attempt#

specgate harness run --pause-between-attempts waits after a failed attempt: .harness/events/paused.json says where. specgate harness continue starts the next attempt; specgate harness continue --stop ends the requirement without it (REQ-591).

Build with uncommitted files#

The harness refuses a working tree that is not clean. With --allow-dirty it runs anyway: every branch is cut from the last commit, and your uncommitted and untracked files stay as they are, here, outside the run. The JSON lists them under dirty.leftOut. Not with --chain, which merges into this working copy.

Stream it as JSON#

bash
specgate harness run --format jsonl

Stdout carries one JSON object per line and nothing else; progress prose goes to stderr. The first line is run-start, the last is always run-end, a refused run's too. Every line has type and t (epoch seconds), and req and attempt when it is about a requirement:

typeWhen
run-startBefore the first requirement: queue, base, concurrency, maxAttempts, dirty.
attemptAn attempt starts (state: start) or ends (end, with result and the stage it failed at).
promptThe prompt an agent step was given: role, chars, lines.
agent-start, agent-endAround each agent step; agent-end has exit, timedOut and ms.
outputWhat the agent writes, as it writes it: stream (stdout, stderr) and text, 4000 characters at most a line.
gate-start, gateEach gate stage, and its result, ms and test counts.
step, message, agent, usageWhat the agent's adapter reports: tool calls, its words, its model, tokens and cost (final).
questionThe agent asked: text, and id, change and file once it is in the project.
merge--chain merged the requirement's branch.
resultA requirement's result, as in --format json. A later one for the same req replaces it.
run-endLast: report, the document --format json prints, or null and status when the run was refused.

The types are HarnessStreamEvent and HarnessRunReport in @rsaglobaltech/specgate/api. The events files keep what they always held; output, agent-start, agent-end, result and the run's own lines are on the stream only. With --concurrency above 1 each worker's lines reach the stream whole.

A question while it runs#

When the agent runs specgate ask, the harness writes the question into the project and commits it at once, and a question event with its id follows. The requirement ends as question, its result's waitingForAnswer naming the question and the command that answers it. The run does not wait for the answer: an answer is an assumption to review before the specification says it, and the gate must judge the scenario that says it. Once it is reviewed, run the requirement again with specgate harness run --req <REQ>.

Next#