Task — engineering-spec@1

Cost and cycle telemetry - make the loop's economics visible

doneTASK-IMP-114
module improvement · class product · priority p3 · created 2026-07-17 · shipped null
depends on none · blocks none

TASK-IMP-114: Cost and cycle telemetry

Summary

routed_back_count is the only cycle metric and it is never aggregated; there is no wall-time or token accounting anywhere. Add a per-batch economics row to the status page - tasks shipped, route-backs, gate re-asks, wall time, and tokens where the harness exposes them - so "is this loop worth running" has a number.

Problem

This run's real numbers are exactly the data that would have helped before it hurt: two API spend-limit cutoffs, one batch losing three of four swarm agents mid-flight, and five batches whose relative cost nobody can compare. The articles are blunt that the loop depends on this measurement, and we have none of it.

Proposed Solution

Emit a per-batch row: batch id, tasks shipped, total route-backs, gate re-asks, wall time from first phase commit to final acceptance, and tokens when the harness reports them. Render it on the status page beside the corpus counts. Everything derives from artefacts that already exist except tokens, which is harness-dependent and therefore optional by construction - a metric that requires a specific host is a metric that expires.

Alternatives Considered

Success Metrics

Scope

In scope: the economics row, its derivation from existing artefacts, the status-page render, suite arms.

Out of scope / Non-Goals

Dependencies

None logically. Derives from phase commits, gate logs, and frontmatter.

Serialisation note: touches render-status-hub.mjs (shared with TASK-IMP-108) and ship-tasks.md (shared with 108, 109, 113, 115). Parent-serialised per §11a; never concurrent swarm members.

AI Authorship Disclosure

1. Description (normative)

2. Acceptance criteria

3. Edge cases

Audit

§1 - Verdict summary

Spec is 70 lines, 6 §1 clauses, 5 ACs, 6 edge cases. Makes the loop's economics visible from artefacts that already exist. Passes after 7 findings - one a real interaction with a shipped task.

§2 - Findings (all resolved)

ISS-001 - A varying rendered field would break TASK-IMP-082's byte-stability

The status page is byte-stable by design (the fp- corpus fingerprint). A token count reported by one harness and not another makes two renders of one corpus differ - re-introducing exactly the churn 082 removed, in the same file 082 fixed. Resolved: new §1 #1.6 requires every RENDERED field to derive deterministically from committed artefacts; a non-deterministic value lives in the artefact, never the row. AC 5 asserts an unchanged corpus re-renders byte-identical; §3 carries the edge case.

ISS-002 - An incomplete batch has no wall time

Computing a duration to now for a cut batch invents a fact - this run was cut twice. Resolved: §3 requires marking it incomplete rather than fabricating a number.

ISS-003 - Zeroed tokens would assert an unmeasured fact

A zero is a claim. Resolved: §1 #1.2 requires omission, not zeroing; AC 2 asserts the row degrades rather than lying.

ISS-004 - Dollar estimates were tempting and expire

Prices change and harnesses differ. Resolved: Alternatives rejects them; Non-Goals forbids them.

ISS-005 - A metric row is one step from a budget gate

A number on a page invites a threshold on the number. Resolved: §1 #1.5 forbids gating; AC 4 verifies the negative structurally.

ISS-006 - A new writer on the phase path would widen the blast radius

Collecting economics could have meant instrumenting every step. Resolved: §1 #1.3 requires derivation from existing artefacts only.

ISS-007 - Shared-file conflicts with 108 and four siblings were unrecorded

render-status-hub and ship-tasks are both contended. Resolved: Dependencies carries the §11a serialisation note.

§3 - Resolution

All 7 concerns addressed. The machine floor (task-lint) ran FIRST and was clean before any judgment family was applied, per TASK-IMP-084. Score = 10/10.


End of TASK-IMP-114 audit.