# North-orchestration cost ledger (REAL mined data)

Mined 2026-06-25 from live transcripts + ccr proxy logs. **Raw token counts only — no dollar costs, no sonnet comparison computed (owner does that).**

## Scope & method (read before trusting numbers)

- **Two physically separate ledgers.** PAID = the opus/haiku Claude-Code orchestrator + opus-gate subagents (`message.usage` in the platform session JSONLs). FREE = `cohere/north-mini-code:free` call volume from ccr proxy logs. **Never sum them** — north is free; the money question is the paid orchestrator only.
- **Output unit by RUN, not by session file** (sessions do not map 1:1 to runs).
- **Token sums** = `sum(message.usage.{input,output,cache_read,cache_creation}_input_tokens)` over assistant turns, broken by `message.model`. jq/node shown at bottom.
- **CCR clock reconciled:** ccr log filenames are local-TZ (`20260624…` = UTC+7); the internal `time` epoch-ms field is UTC and spans **2026-06-24 12:29Z → 2026-06-25 05:38Z**. This DOES cover all north runs. ⚠️ ccr has **no coverage before 06-24 12:29Z**, so any north call earlier than that is invisible (none of the 3 real runs are earlier).

## Session → run map (4 sessions carried north markers; only 2 are real north runs)

| session | verdict | why |
|---|---|---|
| `3914784b` (+`211aea5a` plan) | **RUN A — orders-react + reviews-react** | 281/693 marker lines; whole-session = north flow. No fractional attribution needed. |
| `aba2b5d7` | **RUN B — mod-cms DO-alarm Wave3** (thin slice 05:10–05:35Z) | 3-day cursor/theme session; north is a 25-min slice at the very end. 2 launches + 2 opus gates. |
| `84984580` | **EXCLUDED — not north** | 0 north launches; 43 `ca.sh` cursor calls (mod-cms cursor build). 3 "taskNorth" hits were my regex matching "**cohere**nt/**cohere**nce" inside opus prompts — false positives. |
| `211aea5a` | folded into RUN A | the `/bs-north` planning session for orders-react; no dispatches. |

---

## RUN A — orders-react + reviews-react (session 3914784b + 211aea5a plan + 4 subagents)

**(a) What was built**
- `@platform-modules/commerce-orders-react` — **19 ts/tsx files, 916 LOC** (PR #13). Branch diff vs main: 25 files, +946/−455.
- `@platform-modules/commerce-reviews-react` — **8 ts/tsx files, 360 LOC** (worktree `/tmp/wt-reviews-react`); only spec+plan committed (`4859e93`, +644 docs); **build verification IN-FLIGHT at transcript tail** (05:42:13Z, fixing a 1-char typo + running typecheck).

**(b) North dispatches** — 4 total Bash launches:
| # | time (Z) | target | outcome |
|---|---|---|---|
| 1 | 04:16:47 | orders-react full pkg | **FAIL** — phantom-tree: only `package.json` landed, `src/` empty (claimed success) |
| 2 | 04:24:56 | orders-react re-dispatch | **FAIL** — nested-path confusion (`packages/…/packages/…`), 0 `.ts` persisted |
| — | 05:10:58 | discriminator probe (`probe.txt` to scratch) | **PASS** (health check, NOT a build — rig confirmed alive; failure = long-absolute-path mode) |
| 3 | 05:35:01 | reviews-react foundation waves | **WRITE-OK / build in-flight** (short path `/tmp/wt-reviews-react`; files persisted) |

→ orders-react: **2 build dispatches, both FAILED.** reviews-react: **1 dispatch, files landed, unverified.**

**(c) Retry / failure-recovery overhead (orchestrator turns, opus, main session)**
- north double-fail diagnosis + cursor fallback authoring window 04:16:47→04:36:14: **44 turns**, in 3,712 / out 46,871 / cacheRead 5,924,865 / cacheCreate 94,515 — **grand 6,069,963 tok**.
- discriminator-probe investigation 05:10:46→05:12:11: **10 turns**, grand **1,013,946 tok**.

**(d) cursor-agent fixer/fallback** — **2 ca.sh/cursor calls** (04:00:02 recon; 04:30:24 cleanup) + the composer **full fallback build** that authored all 19 orders-react files after north failed twice. cursor's OWN token burn is **NOT recoverable** (separate tool, not in ccr or session usage) — flagged, not zeroed.

**(e) Opus code-review gate** — 4 subagents: 2× opus-4-8 (`a73536a5` seam-reviewer L=180; `ac3d4c22` security-guard L=40) + 2× haiku-4-5 read-only surveys.

**(f) ORCHESTRATOR token burn — whole session 3914784b + 211aea5a + 4 subagents, by model:**
| model | turns | input | output | cache_read | cache_create |
|---|---|---|---|---|---|
| claude-opus-4-8 | 467 | 576,251 | 518,294 | 45,922,701 | 3,332,576 |
| claude-haiku-4-5 | 27 | 135 | 10,668 | 975,709 | 185,306 |
| **TOTAL** | **494** | **576,386** | **528,962** | **46,898,410** | **3,517,882** |

**RUN A grand total: 51,521,640 tokens** (96% is opus cache_read+cache_create — the standing-context tax of a long agentic session).

---

## RUN B — mod-cms scheduled-publish DO-alarm Wave 3 (aba2b5d7 slice 05:10–05:35Z + 2 opus gates)

**(a) What was built** — DO-alarm cron-arm feature, north-authored:
- `bd892d9` /__cron/arm endpoint (CSRF-exempt) — 2 files, +38
- `ede0602` post-build DO bundle + wrangler patch + auto-arm-on-deploy — 3 files, +78/−2
- `b936e31` fixer: arm route env via `cloudflare:workers` import — 1 file, +2/−2
- **Net delivered: ~6 files, +116/−4 (north) + 1 fixer file.**

**(b) North dispatches** — 2 launches, **BOTH SUCCEEDED** (short worktree path `feat-mod-cms-do-alarm`):
| # | time (Z) | target | outcome |
|---|---|---|---|
| 1 | 05:14:29 | Task 3 (arm endpoint) | **SUCCESS** → commit `bd892d9` (rc=0, 2 files) |
| 2 | 05:17:50 | Task 4 (build/deploy wiring) | **SUCCESS** → commit `ede0602` |

This is the **control case**: short path → phantom-tree failure did NOT recur, confirming the orders-react diagnosis.

**(c) Failure-recovery overhead** — Gate-0 went RED on one type error (app-wide `cloudflare:workers` convention; north used `locals.runtime`). Fix window 05:24:59→05:28:04: **11 turns**, in 151 / out 21,960 / cacheRead 1,170,159 / cacheCreate 669,126 — **grand 1,861,396 tok**. (Not a north-rig failure — a code-convention miss caught by the gate.)

**(d) cursor-agent fixer** — **1 composer fix** → commit `b936e31` (Gate-0-RED → GREEN). cursor token burn NOT recoverable.

**(e) Opus code-review gate** — 2 subagents: `aca845c2` (opus-4-8 code-gate Wave 3) + `a768da18` (opus-4-8 security review). Both converged: no P0/P1.

**(f) ORCHESTRATOR token burn — windowed main 05:10–05:35Z + 2 opus gates:**
| model | turns | input | output | cache_read | cache_create |
|---|---|---|---|---|---|
| claude-opus-4-8 | 135 | 205,798 | 128,195 | 12,804,517 | 2,651,098 |
| **TOTAL** | **135** | **205,798** | **128,195** | **12,804,517** | **2,651,098** |

**RUN B grand total: 15,789,608 tokens.**
⚠️ **Attribution confidence: MEDIUM.** Window-sliced out of a 3-day mixed session; cache_read is inherently fuzzy under range-attribution (cache accumulates over the whole session context). The mod-cms-scheduled-publish run ALSO has planning text in session `84984580` @05:20 (overlapping wall-clock) — that contribution is ambiguous-and-small and is NOT added here. Treat RUN B's defensible core as the aba2b5d7 launches+gates only.

---

## TOTALS across all north runs

### PAID orchestrator tokens (RUN A + RUN B)
| | input | output | cache_read | cache_create | grand |
|---|---|---|---|---|---|
| RUN A | 576,386 | 528,962 | 46,898,410 | 3,517,882 | 51,521,640 |
| RUN B | 205,798 | 128,195 | 12,804,517 | 2,651,098 | 15,789,608 |
| **TOTAL** | **782,184** | **657,157** | **59,702,927** | **6,168,980** | **67,311,248** |

By model (both runs): opus-4-8 = 602 turns / ~67.0M tok; haiku-4-5 = 27 turns / ~1.17M tok.

### North dispatches (FREE — call volume only, do NOT add to paid)
- **Authoritative (from transcripts) — orchestrator-level build dispatches:** orders-react **2 (both FAIL)** + reviews-react **1 (write-ok, build in-flight)** + mod-cms **2 (both SUCCESS)** = **5 build dispatches** (+1 discriminator health-probe). This is the count the money question turns on.
- **CCR-log corroboration (call-volume only):** 517 distinct `cohere/north-mini-code` requests over the proxy window; **491 responded, 26 with no clean response.** The 517 ≫ 5 because each orchestrator "dispatch" is an agentic north sub-session making many model calls (tool loops). ⚠️ **This 517 spans the WHOLE proxy window (06-24 14:10Z → 06-25 05:38Z) and is GLOBAL/ALL-PROJECTS — it is NOT scoped to these 3 runs.** Use it only as order-of-magnitude call-volume, not a per-run number.
- ⚠️ **North free-side TOKEN volume is NOT reported** — VERIFIED unreliable. ccr logs the real completion usage only in OpenRouter's final SSE chunk; the figures a naive parse yields (~16M in / ~158k out) come from the near-zero Anthropic `message_start` events and badly undercount (158k out ≈ 322 tok/call is implausible for 360–916 LOC of TS). Free-side tokens were not a required deliverable; demoted rather than published wrong.
- **No reliable API-error split.** The "26 no-clean-response" is from missing/short responses; the real `level:50 provider_response_error` lines live in `o.err`/`o.msg` (not parsed), so a "0 API errors" reading would be an artifact, not a finding — omitted. NOTE: a 0-API-error / writes-didn't-land pattern is *consistent* with phantom-tree — north's API returned `end_turn` (no error), the filesystem just never received the files.
- CCR stream also carried 16 OTHER free models (qwen 89, gpt-oss-120b 77, gemma, nemotron, …) — the proxy is a shared multi-model rig; only north reqs counted above.

### cursor-agent fixer/fallback dispatches
- RUN A: 2 ca.sh calls + 1 full composer fallback build (authored 19 files after north 2× fail).
- RUN B: 1 composer fix (Gate-0 fix).
- **= 3 cursor dispatches** (1 full fallback build + 1 fix + recon/cleanup). **cursor token burn UNRECOVERABLE** — not in ccr logs or session usage (separate `cursor-agent`/composer-2.5 tool). Flagged, not silently zeroed.

### Tokens BURNED ON FAILURES (pure waste a clean run wouldn't have)
| waste item | run | turns | grand tokens |
|---|---|---|---|
| north 2× phantom-fail diagnosis + cursor-fallback handoff (04:16:47–04:36:14) | A | 44 | 6,069,963 |
| discriminator-probe investigation (05:10:46–05:12:11) | A | 10 | 1,013,946 |
| Gate-0-RED convention-fix loop (05:24:59–05:28:04) | B | 11 | 1,861,396 |
| **TOTAL FAILURE BURN (orchestrator opus)** | | **65** | **8,945,305** |

≈ **8.95M paid orchestrator tokens (~13.3% of the 67.3M paid total)** spent on north's write-failures + rig-diagnosis + gate-fix loops. ⚠️ **This is an UPPER BOUND on north-specific waste:** window 1 (6.07M) includes orchestrator supervision of the *cursor fallback authoring* that produced the real deliverable — that supervision is waste vs a clean north run, but NOT vs sonnet-straight (you'd supervise authoring either way). The strictly north-attributable waste (phantom-fail diagnosis + discriminator probe + Gate-0 convention loop, excluding fallback-authoring supervision) is the lower portion. Also excludes the unrecoverable cursor fallback-build cost (additional real spend).

### Delivered work product (for sonnet-straight modeling)
| run | package | files | LOC | committed? |
|---|---|---|---|---|
| A | commerce-orders-react | 19 ts/tsx | 916 | yes, PR #13 (cursor-authored, not north) |
| A | commerce-reviews-react | 8 ts/tsx | 360 | spec/plan only; source in-flight |
| B | mod-cms DO-alarm | ~6 changed | +116/−4 | yes (north-authored, cursor-fixed) |
| **TOTAL** | | **~33 files** | **~1,392 LOC** | |

## Key flags
- **Of the 5 north build dispatches, only 2 (mod-cms, short-path) cleanly succeeded.** orders-react — the headline run — was 2/2 FAILURES; the delivered 916 LOC were authored by **cursor fallback, not north.** north's free output on RUN A was effectively zero usable code.
- The decisive variable is **worktree path length**: long absolute paths → phantom-tree write failure; short paths (`/tmp/wt-…`, `feat-…`) → success.
- **RUN B token attribution is MEDIUM-confidence** (windowed from a mixed session); RUN A is HIGH-confidence (whole dedicated session).
- **cursor fallback token/$ cost is unrecoverable** from these sources — the paid total above is a LOWER BOUND on true spend.

## jq/node for the token sums (audit trail)
Per-session, per-model usage sum (node, run over each `*.jsonl`):
```js
// assistant turns only; usage object carries the 4 token fields
for (const ln of fs.readFileSync(p,'utf8').split('\n')) {
  const o = JSON.parse(ln); if (o.type!=='assistant') continue;
  const u = o.message?.usage; if (!u) continue;
  const m = o.message.model;            // break by model
  agg[m].in += u.input_tokens||0;  agg[m].out += u.output_tokens||0;
  agg[m].cr += u.cache_read_input_tokens||0;  agg[m].cc += u.cache_creation_input_tokens||0;
}
```
Equivalent jq (one session, opus input-token sum):
```
jq -rs '[.[]|select(.type=="assistant" and .message.model=="claude-opus-4-8...")
         |.message.usage.input_tokens]|add' session.jsonl
```
CCR north call count (streamed SSE parse, group by file|pid|reqId):
```js
// group lines by file|pid|reqId; north = data.model ~ /north-mini/;
// "responded" = saw any response chunk; "no clean response" = none.
// (free-side token volume NOT trusted — real usage is in OpenRouter's final
//  SSE chunk, which a max(output_tokens) scan over message_start events misses.)
```

---

# PHASE 2 — clean fresh-subagent A/B (2026-06-27). Resolves the RESULT-13 dispute.

**Question retested:** RESULT-13 measured ~$261 / 51.5M tok for north and read as "never worth it." Owner's
challenge: that was the **long-session cache-read tax**, not north — run the full north flow inside a small
**fresh-context subagent** and the tax vanishes. Tested directly, plus the cursor-cost the old ledger called
"unrecoverable."

## Method (no strawman; advisor-reviewed design)
- **Same task, two arms, each a FRESH `Agent` subagent** (sequential → clean JSONL attribution). Task =
  net-new `parseDuration(string)→ms` TS module + `node:test` suite, hermetic Gate-0 (`tsc` + `node --test`,
  zero npm install). Identical clean-spec base commit handed to both arms.
- Arm cost mined from `…/<session>/subagents/agent-<id>.jsonl` (`message.usage` by model). The fresh-subagent
  context is the whole point — it is what keeps cache_read small.

## Result — ANTHROPIC orchestration, SAME task, fresh subagents
| arm | total tok | cache_read | turns | fix rounds | Gate-0 first | opus review |
|---|---|---|---|---|---|---|
| **NORTH** (free coder) | **688,442** | 597,101 (87%) | 24 | 1 | GREEN *but hollow* | caught 2 SPEC violations |
| **CURSOR** (composer-2.5 coder) | **328,702** | 266,709 (81%) | 13 | 0 | GREEN clean | CLEAN |

- **RESULT-13 dispute RESOLVED in owner's favor.** Fresh-subagent north flow = **688K tok**, vs **15.8M**
  (RUN B) / **51.5M** (RUN A) on the contaminated long sessions — **23×–75× less**. Absolute cache_read fell
  12.8M/46.9M → **597K**. The cache tax *was* a session-length artifact; in a small fresh subagent it is tiny.
  cache_read is still 87% *of the arm* — that fraction is inherent to agentic loops; the **absolute** magnitude
  is what moves, and it tracks context length, not the tool.
- **But north orchestration = 2.09× cursor orchestration on the same task** (Δ ≈ **360K** extra anthropic):
  north needs ccr-up + dispatch supervision + Gate-0 + a cursor fix round + opus review of its violations;
  cursor cleared first-pass.

## Result — CURSOR token side (the capped/scarce resource) — usage RECOVERED
- The old "cursor cost UNRECOVERABLE" flag was **wrong for the June-25 logs**: cursor's stream-json `result`
  event carries native `usage{inputTokens,outputTokens,cacheReadTokens}`. ⚠️ **Today's cursor-agent dropped
  it** — the 2026-06-27 schema emits `thought`/`text` deltas + `end`, no usage. So native cursor numbers come
  from the June-25 logs; Phase-2 same-task cursor tokens are not natively measurable.
- **C_full** (orders-react full build, 916 LOC) = in 83,290 + out 15,426 = **98,716** real-work (1.67M w/ cacheRead).
- **C_fix** (mod-cms Gate-0 fix) = in 35,554 + out 781 = **36,335** real-work (243K w/ cacheRead).
- C_fix/C_full = 0.15–0.37 across cache-weightings → north saves **63–85% of cursor tokens** *per task* — **but
  this is a cross-task upper bound** (916-LOC build vs a +2-line fix). The asymmetry only exists when build ≫ fix.

## Quality signal (decisive, not a cost number)
North's first draft **passed deterministic Gate-0 GREEN while carrying 2 SPEC violations** — it wrote a *hollow
self-certifying test* (throwing-case asserts swallowed by the catch) that masked an internal-space accept bug.
**Only the inline opus review caught it.** Composer-2.5 (cursor arm) was spec-correct first pass, 0 fixes.
→ North **mandates** the opus gate and frequently a cursor fix; the deterministic gate alone would have shipped
a spec-violating, self-green result. North's free coding is not free of supervision.

## VERDICT (a trade, not a binary)
- **For SMALL tasks: north LOSES.** No build≫fix asymmetry (a fix dispatch ≈ a build dispatch), so ~zero cursor
  quota saved, +2× anthropic orchestration, + quality risk + free-tier latency (north dispatch 111s here).
- **For LARGE mechanical builds where cursor quota is the binding constraint: north can WIN** — exactly the task
  class the skill already targets ("mechanical multi-file refactor: strong"). North converts scarce capped
  cursor-build quota into free north tokens + ~360K/task extra (uncapped) anthropic orchestration. Worth it iff
  the freed cursor headroom outvalues that anthropic spend — owner's call, since cursor is "flat plan, often
  capped" (cap meters tokens).
- **The $261 figure is dead as a per-task number** — it was 96% long-session cache tax + phantom-tree-failure
  waste, both removable. Clean per-task north flow ≈ 0.69M tok.

Deliverables committed: north arm `744ece6` (/tmp/wt-p2-north), cursor arm `ed954a2` (/tmp/wt-p2-cursor).

## ARM 3 — composer-2.5 as the ORCHESTRATOR of north (owner idea: 6× cheaper orchestration)
Same task, fresh `cursor-agent` session DRIVING the loop (ccr-up → dispatch north → Gate-0 → fix → commit),
opus kept only for one judgment gate. Commit `eeea147` (/tmp/wt-p2-cursorN).

**Mechanically feasible — it worked.** Composer ran the tested ccr-up.sh, dispatched north via the rig, ran
Gate-0, fixed, committed. Non-hollow test confirmed by sabotage (it used `assert.throws`, the correct idiom).

**But three findings kill the naive win:**
1. **North added NEGATIVE value on this task.** North **timed out at 360s (rc=124)**, wrote only a *broken*
   parser (`"2h30m"`→`["2","h30","m"]`), no test. Composer discarded it and wrote everything itself. So the run
   was really "composer builds it, after wasting 360s on a dead north draft" — strictly worse than cursor-alone
   (Arm 2: one dispatch, 0 fixes, green). Stacking two weak models compounds their failure modes.
2. **Composer's quality catch was CHECKLIST-BOUND, not judgment.** It caught the internal-space SPEC violation
   **only because STEP 4 hand-enumerated the exact probes** ("does `2h 30m` throw?"). The opus gate (Arm 1)
   caught north's hollow test via *open-ended* judgment with no such hint. Composer executes a checklist you
   pre-write; it does not replace opus for correctness you cannot fully enumerate in advance — exactly the
   skills' standing rule (composer never holds the spec-judgment seat).
3. **Cost unmeasurable today.** The "6× cheaper" claim cannot be confirmed from logs: the 2026-06-27 cursor-agent
   schema has **no `usage` field**, so the composer-orchestrator's own token spend is not natively recoverable.

**Verdict on the idea:** the cheap-mechanical-orchestrator is sound *as a pattern* (composer runs the
dispatch/Gate-0/fix loop, opus does ONE judgment gate) and could cut orchestration cost on **large mechanical
batches** — but only there, only with the opus gate retained, and NOT stacked on north for small tasks where
north's timeout/garbage-draft overhead makes it worse than composer-alone. Not a free "super saving."
