What the harness has cost#
specgate harness report tells you whether running requirements through
the harness is paying off: how often the agent's first attempt
passes the gate, and how much time each delivered requirement costs.
You need: at least one specgate harness run in this project. Each run
records itself in .harness/runs/<timestamp>.json, and the report reads those
files. It never runs an agent, git or the network.
specgate harness report # every recorded run
specgate harness report --last 5 # the five most recent runs
specgate harness report --json # the same summary, for a script
specgate harness report --capability orders # only the requirements of one capability--capability <name> keeps the results of the requirements that capability
states: those in docs/specs/capabilities/<name>/spec.md, and those an open
change adds under specs/<name>/. --json then names it as
report.capability. A capability the project does not have exits 2 with
capability_unknown, and the fix lists the ones it has.
A report over two runs looks like this:
◆ specgate · harness report 2 run(s)
████████████░░░░░░░░ 3 of 5 requirements passed
requirements attempted 5
passed 3
failed 1
blocked 1
first attempt worked 67% (2 of 3 passes)
cost per delivered REQ 9m 40s wall-clock, failed attempts included
Where attempts ended ───────────────────────────────────
3 gate rejected the work [gate]
3 passed [pass]
1 agent timed out [agent-timeout]
Spent every attempt, delivered nothing ─────────────────
REQ-004 15m 0s 3 attempt(s)
Runs over time ─────────────────────────────────────────
██ 2026-10-14 → 2026-10-16
failures that were real — nothing recorded can tell a real failure from a gate that was
wrong — mark one: specgate harness report
--mark-false-failure REQ-NNN --reason "..."
Slowest ────────────────────────────────────────────────
REQ-004 15m 0s 3 attempt(s), fail
REQ-002 7m 0s 2 attempt(s), pass
REQ-003 4m 0s 1 attempt(s), pass
REQ-001 3m 0s 1 attempt(s), passThe two numbers that matter#
- First attempt worked says whether retries are buying anything. A low rate means the agent keeps making the same mistake; a different agent per attempt may help (A different agent per attempt).
- Cost per delivered requirement divides all the time spent, including attempts that failed, by the requirements that actually passed. That is what delivery costs.
The cost is wall-clock time first: an agent is any shell command, and only
the agent knows what it spent. If a profile declares a cost_per_run_hint,
the report adds an estimated spend and labels it declared by profile, not
measured.
Measured cost#
When an agent's stream reports its tokens — Claude Code through
specgate harness events --from claude does — the run records them for each
agent step, with the profile that ran it. A profile that declares its prices
per token is then priced from those tokens:
profiles:
fast:
agent: "claude -p --output-format stream-json --verbose < {prompt_file} | specgate harness events --from claude"
price_per_input_token: 0.000003
price_per_output_token: 0.000015
# optional; both default to the input price
price_per_cache_read_token: 0.0000003
price_per_cache_write_token: 0.00000375The report adds a measured spend line, and --json gives measuredCost
(total, the steps measured as covered, the others as uncovered; null
when none was) and costByProfile, one entry per profile:
| Field | What it holds |
|---|---|
profile | The profile, or agent for a command given as is |
attempts | The agent steps it ran |
measuredAttempts | Of those, the ones whose tokens were recorded |
tokens | input, output, cacheRead, cacheWrite; null with none |
estimated | cost_per_run_hint × its steps; null without a hint |
measured | Its tokens × its prices; null without tokens or prices |
basis | measured, estimated, or null when neither could be given |
--profile and agent_profile: record the profile's name, so its hint and its
prices apply to the runs of its agent.
Was the gate wrong?#
A rejected attempt looks the same whether the work was bad or the gate was. Only a person can tell, so the report shows "failures that were real" as unknown until someone records a false failure:
specgate harness report --mark-false-failure REQ-004 --reason "the test relied on the local time zone"The marks are kept in .harness/false-failures.jsonl.
Where the gap was#
A requirement that needed rework fell into one of two gaps:
| Gap | What happened | What to strengthen |
|---|---|---|
| spec → implementation | The spec was clear and the code diverged | The validation: the check that caught it |
| intent → spec | The spec missed part of the use case | The elicitation: the module's questions, asked earlier |
The report suggests one for each requirement from what it recorded. A
rejection the agent fixed on a later attempt reads as spec → implementation,
naming the stage that rejected it (pmd, test command). A requirement that
changed after review reads as intent → spec: a question that blocked it was
answered, a review note names it, a change modifies it, or the gate failed on
the specification itself. When both apply, intent → spec wins.
A person's word wins over any suggestion:
specgate harness report --classify REQ-010 --gap intent-spec --reason "the brief never said a truck can carry two drivers"The section shows each gap's share of the requirements in the ledger, per
module when there is more than one, and what to strengthen: the stage that
caught most spec → implementation gaps, and the module with most intent →
spec gaps. Classifications are kept in .harness/gaps.jsonl; --json carries
the section as gaps, and the studio's report shows both shares.
The records stay on your machine#
.harness/runs/ contains its own .gitignore that ignores every file in the
folder, so git never sees the records. There are two reasons. The harness
refuses to start on a working tree with uncommitted changes, so records git
could see would make the second run refuse to start. And a file every run
rewrites would be a merge conflict on every branch.
The agent command is never recorded, because it can carry an API key.
The quality of what was delivered#
When quality checks run, each passing requirement's run record
keeps them — stage, verdict, findings, and the diff coverage and mutation
score of the lines it changed — and the report adds a section with the means
and how often each check ran. --json carries it as quality.
Before it starts#
specgate plan --json estimates each pending requirement under estimates: its
time in milliseconds and, when a profile declares cost_per_run_hint, its
cost. Each number says its basis, from the strongest:
basis | Taken from |
|---|---|
history | The mean of this requirement's own recorded runs. |
size | Its scenario steps, at the time delivered requirements took per step. |
average | The time per delivered requirement, failed attempts included. |
none | Nothing recorded supports a number: it is null. |
samples says how many runs or requirements it rests on. Like the spend
above, a cost is a declared price, not a measured one.
In your tracing tool#
With OTEL_EXPORTER_OTLP_ENDPOINT set (or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT),
each finished run is sent as an OpenTelemetry trace: the run, each requirement,
each attempt with the stage it failed at, and each agent session, with tokens
and cost. OTEL_EXPORTER_OTLP_HEADERS and OTEL_SERVICE_NAME are read; a
collector that cannot be reached is a warning, never a failed run (REQ-590).