# COST-002 evidence pack — lifecycle cost economics and release evidence

> **Status: repository-complete / closed.** The V1 economics boundary computes
> complete-lifecycle unit costs and an immutable cost/quality/latency Pareto
> view from measured COST-001 receipts, corrections, and durable artifact state.
> It fails closed on provisional, missing, unallocated, or mixed-currency cost.
> This status does not claim live provider reconciliation, production financial
> outcomes, or human release decisions.

## Work-package charter

- **Task ID:** `COST-002`
- **Owner:** Oshun creative-orchestration, autonomy, and BFF maintainers;
  implementation owner: Elikem Agudogo
- **Accountable product:** V1 autonomous content execution plane
- **Priority:** P0
- **Target milestone:** 2026-07-15 SOTA gap-closure program
- **Risk tier:** Critical unit-economics, quality-gate, and release-evidence
  risk
- **Audit finding:** cost-per-success and Pareto reports could exclude retries,
  failed/unreleased work, hidden overhead, provisional bills, or weaker-gate
  candidates and thereby make cheap failure look economically optimal
- **Dependencies:** `COST-001`, `AUTH-002`, `AUTH-003`, canonical RUN protocol,
  durable artifact/review state, exact release authority, quality evidence, and
  provider correction/reconciliation records
- **Affected schemas and content slots:** lifecycle population, allocation,
  final-cost status, provider correction, price-version, Pareto candidate,
  release-evidence eligibility, and operator economics response records for
  `veritas.story-explainer`, `nyx.sky-event-brief`, `nisaba.study-passage`, and
  `tara.seasonal-ritual`. No rendered UI or database migration changed in this
  refresh.
- **Linked task IDs:** `COST-001`, `COST-002`, `EVAL-004`, `EVAL-005`,
  `LEARN-001`, `REL-002`, `PROOF-001`, and `OBS-001`
- **Rollout strategy:** additive lifecycle/correction records and an
  operator-only read boundary over the measured receipt ledger. Incomplete
  economics remain visible and ineligible rather than being projected as zero.
- **Rollback strategy:** revert the lifecycle economics source, correction
  semantics, and BFF route together. Partial rollback can leave persisted
  corrections or current consumers with incompatible eligibility meanings.
- **Evidence-pack location:** this file

## Closure matrix

| Ledger requirement                         | Repository closure proof                                                                                                                                                                                                                                                                                                                |
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Six lifecycle unit costs                   | The report computes cost per attempted, completed, hard-gate-passing, accepted, released, and outcome-successful artifact. Every metric uses complete portfolio spend as numerator and its named durable population as denominator. Empty populations remain explicit instead of becoming zero-cost success.                            |
| Include all hidden and failed work         | Direct generation, structured-output retries, failed candidates, unreleased media, and release receipts allocate through item/variant/run aliases. Planner, judge-panel, hidden-tool, and other cycle/global overhead distributes deterministically. Anything unallocated remains visible and blocks final evidence.                    |
| Pareto without gate weakening              | The frontier minimizes measured cost and latency while maximizing quality. A candidate is eligible only when its recorded hard gate passes, its quality clears its recorded bar, that bar is at least the immutable economics floor, and cost evidence is complete. Cheaper candidates cannot enter by lowering or failing a hard gate. |
| Cap races and known-zero denials           | Independent accountants sharing one ledger serialize reservation. Pre-dispatch cap denials are auditable known-zero attempts because no dispatch occurred; dispatched missing/final-unknown usage is never treated as zero.                                                                                                             |
| Provider corrections and price truth       | Corrections are append-only, preserve the original receipt/raw payload, update every cap scope and reconciliation view, can finalize provisional receipts, and survive snapshot restore. Mixed price-table versions remain identified; non-USD tables/corrections are rejected.                                                         |
| Missing or unknown final cost fails closed | Missing successful-response usage, dispatched failure with unknown bill, or settlement overrun creates a conservative `provisional-maximum` receipt at the reservation maximum. Provisional, missing, unallocated, or unknown cost keeps `releaseEvidenceEligible` false.                                                               |

## Authoritative economics boundary

`buildCostEconomicsReport` joins the durable COST-001 receipt ledger, immutable
provider corrections, pre-dispatch decisions, and retained artifact lifecycle
records. The operator-only `GET /v1/agentic/autonomy/economics` route exposes
schema `oshun-cost-economics.v1`; it returns 503 rather than presenting partial
economics when measured accounting is not configured.

The report computes portfolio cost per attempted, completed, hard-gate-passing,
accepted, released, and outcome-successful artifact. Each metric uses complete
portfolio spend and its named lifecycle population. Failed and unreleased work
therefore remains in downstream unit economics. Empty populations are explicit,
not fabricated zero-cost success.

Every produced item retains start/finish time, attempted run IDs, and item/
variant attribution aliases. Direct generator, retry, failed-candidate, media,
and release receipts allocate through those identities. Planner, judge-panel,
hidden-tool, and cycle/global overhead distributes deterministically across the
cycle's artifacts. Unallocatable spend remains visible and blocks final
release-evidence eligibility.

## Final cost, corrections, and pricing truth

Successful responses with missing usage, dispatched failures whose final bill is
unknown, and settlement overruns create conservative `provisional-maximum`
receipts charged at the reserved maximum. They are never rewritten to zero.
`releaseEvidenceEligible` remains false while provisional, missing, unknown, or
unallocated cost exists.

Provider corrections are append-only. A correction changes every affected cap
scope and invoice-reconciliation view while preserving the original receipt and
raw correction payload. Restore preserves corrections and migrates older
receipts to explicit final status and scope charges. A correction can finalize a
provisional receipt, and reconciliation reports the correction identities it
applied.

Pricing is USD-only and versioned. Mixed price-table versions are surfaced
rather than silently blended; non-USD tables/corrections are rejected.
Pre-dispatch cap denials are known-zero attempts because dispatch did not occur.
Separate accountant instances sharing a ledger serialize reservations so
simultaneous workers cannot race through a cap.

## Quality, latency, and outcome semantics

The Pareto view minimizes measured cost and latency while maximizing quality. A
candidate is eligible only when it passes its recorded hard gate, meets its
recorded quality bar, that bar is at least the immutable economics floor, and
its cost evidence is complete. A cheaper candidate cannot enter the frontier by
lowering or failing a hard gate.

Acceptance and release derive from durable review-queue state. Outcome success
requires a published item whose aggregate post-release customer rating has mean
at least 4 on the existing 1–5 scale. Preference-learning snapshots persist and
validate per-run rating totals/counts so outcome economics survive restart.
Later exact-proof, human-quality, restart, and scoped-authority hardening
changes the surrounding admission state without weakening these economics
meanings.

## Adversarial fixture matrix

| Fixture                                     | Result                                                                    |
| ------------------------------------------- | ------------------------------------------------------------------------- |
| Retry or failed candidate consumes spend    | Spend remains in complete portfolio numerator                             |
| Judge/tool overhead lacks item identity     | Deterministically allocated or retained as blocking unallocated cost      |
| Candidate lowers/fails a hard gate          | Excluded from Pareto frontier even when cheaper                           |
| Two workers reserve against one cap         | Shared ledger serializes reservation; aggregate overspend is denied       |
| Cap denies before dispatch                  | Auditable known-zero attempt                                              |
| Successful response omits usage             | Conservative provisional maximum; final evidence ineligible               |
| Dispatched failure has unknown final bill   | Conservative provisional maximum, never zero                              |
| Provider correction arrives                 | Original receipt remains; scopes/reconciliation apply correction identity |
| Price-table versions differ                 | Versions remain explicit in report                                        |
| Currency is not USD                         | Price table or correction rejected                                        |
| Cost is unallocated or final status unknown | Release-evidence eligibility fails closed                                 |

## Automated verification

### Current admitted value ledger

The full owning packages were rerun sequentially with `VITEST_MAX_WORKERS=1`;
the exact four-file BFF economics slice was rerun after COST-001 publication.

| UTC interval                                      |  Files |      Result | Surface                                                       |
| ------------------------------------------------- | -----: | ----------: | ------------------------------------------------------------- |
| 2026-07-29T14:57:29.722Z–2026-07-29T14:57:33.275Z |     13 | **138/138** | full creative-orchestrator package                            |
| 2026-07-29T14:57:37.483Z–2026-07-29T14:58:05.593Z |     19 | **289/289** | full creative-autonomy package, including lifecycle economics |
| 2026-07-29T15:12:32.258Z–2026-07-29T15:12:47.252Z |      4 |   **61/61** | BFF accounting, economics route, and plane integration        |
| **Unique total**                                  | **36** | **488/488** | no full-package or focused assertion is counted twice         |

The former **441/441** total accurately described the smaller historical suite
set. The historical **53/53** post-merge subset was a recheck, not an additional
unique value row.

Representative commands:

```text
VITEST_MAX_WORKERS=1 pnpm --dir libs/oshun/creative-orchestrator exec vitest run
VITEST_MAX_WORKERS=1 pnpm --dir libs/oshun/creative-autonomy exec vitest run
VITEST_MAX_WORKERS=1 pnpm exec vitest run --config apps/oshun/bff/vitest.config.ts <four COST-002 BFF files>
pnpm exec tsc -p libs/oshun/creative-orchestrator/tsconfig.json --noEmit
pnpm exec tsc -p libs/oshun/creative-autonomy/tsconfig.json --noEmit
node tools/typecheck/ratchet.mjs --app apps/oshun/bff --tsconfig tsconfig.typecheck.json
node scripts/build.mjs                                  # apps/oshun/bff
```

### Type, lint, build, and compatibility gates

- current creative-orchestrator and creative-autonomy TypeScript configurations
  passed;
- the BFF baseline ratchet passed twice during the shared COST refresh with **0
  known** and **0 new** app-owned errors;
- the direct BFF Node ESM production bundle passed;
- official package lint targets passed with zero errors and current warning
  backlogs of 8 in creative-orchestrator and 79 in creative-autonomy;
- exact ESLint over the eleven listed source/config artifacts passed; Prettier
  over the ten TypeScript artifacts and `git diff --check` passed.

The first Prettier command included `.env.example`, for which Prettier inferred
no parser and exited before checking the TypeScript files. That command-shape
error is not represented as a content pass; the supported TypeScript inputs were
rerun successfully. The environment template's current hash is recorded below.

The full BFF lint target was not rerun because its unrelated app-wide baseline
is outside this evidence-only refresh; all listed BFF artifacts have zero lint
errors. The Nx BFF build target would fan into hundreds of dependencies, so the
target's direct production build command was used. No full-workspace sweep or
AUD-003's separate 54-config refresh was attempted or claimed.

## Artifact identity

These hashes were recomputed from current published source.

| Artifact                         | SHA-256                                                            |
| -------------------------------- | ------------------------------------------------------------------ |
| Environment composition template | `54097d7a5a064c2a2880420292871893770728cc51662572f3fef78b6d2f1ab1` |
| Production accounting boundary   | `e33ede124baae843f7588d175fc8d532b5b8fcd3e30c401a4963dc751be743d3` |
| Accounting fixtures              | `422fd3c62cffc29cd90831d40549304803ebc1cc1596a8fe4a74ff67098e5b5e` |
| Lifecycle economics boundary     | `17191beede3382171888f3e04acb6665d8998c35ffd3931c3e38dcb67b4d988a` |
| Lifecycle economics fixtures     | `3eb6c66d0d3c7724c1c346d3b9d48a3232718de0651d50884e8721935d46e752` |
| Autonomy director                | `07ad37afd64d60a268cbc3a0272383a88ebabe4ac0093ca9d67bf1e4c3456256` |
| Outcome-learning boundary        | `1a1154c947899bcd7546652e5ffa9499383623c12244e8c7ccdbc783f8b69b3f` |
| BFF economics route              | `b41043449647890bb29704f1ee7ed11f153cf7bf3f7ea812e4d21976f0ec7fb2` |
| BFF economics route fixtures     | `8a7a2752101c0bdce6337731238f72bde64c8a3db70d0c330519df88ebae9a07` |
| V1 plane integration fixture     | `72c4f8423b3b74cfdd71966cc958169a335584ab795ca4dd0cb64ca362da2f4e` |
| BFF accounting composition       | `35bf417eed9acd04f9f3d806037907885fa3af5f4815050b324a29c9f48a67e1` |
| Workspace dependency lock        | `08b055786e9b8a6104d5313601d7eef3205dedcf395066fd9a8264c9859d690f` |

## Human authority and external deployment boundary

Repository publication of deterministic lifecycle economics and fixtures
requires no fabricated human signoff, and none is claimed.

- provider-correction and invoice inputs are scripted boundary data; no live
  invoice, provider credential, currency conversion, or production
  reconciliation is claimed;
- durable customer-rating fixtures prove outcome aggregation and restart
  behavior, not a live customer KPI or population outcome;
- the operator route's authorization is repository behavior, not proof that a
  production operator reviewed or released an artifact;
- current transfer tables, quality floors, and policy configuration are
  versioned inputs, not production business-unit economics;
- estimates, provisional maxima, and raw governance signals do not substitute
  for final cost or exact release proof;
- no production economics report, financial outcome, human decision, or
  deployment is claimed.

## Resource-safe verification and UI scope

The refresh host was `app-dev-server`, Ubuntu 24.04.4 LTS, Linux
`6.8.0-134-generic` x86_64, with 15 GiB RAM, 31 GiB swap, and 16 GiB free disk.
The toolchain was Node.js `v24.15.0`, pnpm `10.25.0`, TypeScript `6.0.3`, and
Vitest `4.1.7`.

An unrelated checkout's long-running Vitest worker and this checkout's Nx daemon
were active. Tests, typechecks, lint, and the direct bundle ran sequentially
except for the repository hook's bounded two-project typecheck. The BFF ratchet
remained above the 2 GiB available-memory stop threshold. No full workspace gate
was started.

This refresh changes evidence only. It does not change customer/admin/PWA/
mobile/Unreal UI, so the frontend skill, Playwright, mobile automation,
screenshots, and Unreal verification are inapplicable.

## Publication identity

- **Original source commit on the current graph:**
  `fce8641f0487b82bebd8052c7886efef8658bc2b`
- **Historical equivalent source identity (identical tree):**
  `38d76affd28e0bd5e178cc86f82f9f3bd6bdf086`
- **Historical evidence-pack commit on the current graph:**
  `4501b1fd7885ffc59f0a5666f39c4d1e012d911c`
- **Historical equivalent evidence identity (identical tree):**
  `f338a1fdb6ca222674f5fb255cc0b571d5e9136b`
- **Historical ledger closure commit:**
  `0845e9fe95b19157b8a40cd3caba2afb988d1b98`
- **Non-substitutable release-proof hardening:**
  `526d2b7d3abf6c1ab84345e9163e8f74488ca62a`
- **Human-quality launch hardening:** `2a8aea8f2107616e6bf0a87ac879dd3051db61de`
- **Durable reservation/receipt hardening:**
  `42dac7a43ac9362213e15f08d0843e991930f3c2`
- **Restart-safe publication hardening:**
  `c5aa83ecd11a5dfc7611258cd3777027f1543a13`
- **Scoped release-authority hardening:**
  `e3480d2eb708ebdb9374045908a68efc48ed819d`
- **Current admitted verification tip:**
  `4f019ffe4856d094b7e71ac84a88943cd9f5166f`
- **Current evidence-refresh commit:** recorded by the task-scoped commit that
  contains this file.
