crysk 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +28 -22
  2. package/dist/SKILL-1q3658n0.md +74 -0
  3. package/dist/SKILL-25j4q9b8.md +143 -0
  4. package/dist/SKILL-32cmme3j.md +143 -0
  5. package/dist/SKILL-4747bhne.md +143 -0
  6. package/dist/SKILL-4jc3sv23.md +74 -0
  7. package/dist/SKILL-c0492rch.md +540 -0
  8. package/dist/SKILL-d1nzkhhr.md +74 -0
  9. package/dist/SKILL-f8p7kvx0.md +143 -0
  10. package/dist/SKILL-gxd45g38.md +553 -0
  11. package/dist/SKILL-rec41991.md +66 -0
  12. package/dist/SKILL-zze8zj5g.md +536 -0
  13. package/dist/adjudicator-eckqh14e.md +78 -0
  14. package/dist/ci-admission-qn797a6c.md +128 -0
  15. package/dist/cli.js +18608 -18523
  16. package/dist/consolidate-4xw1pkg7.md +24 -0
  17. package/dist/deep-review-logic-dgr112y1.md +196 -0
  18. package/dist/deep-review-logic-fck5z4xe.md +197 -0
  19. package/dist/deep-review-logic-h1fpamfh.md +192 -0
  20. package/dist/deep-review-logic-m4vk5683.md +196 -0
  21. package/dist/deep-review-logic-z63kmgmc.md +157 -0
  22. package/dist/deep-review-parity-7x7s5d81.md +148 -0
  23. package/dist/deep-review-parity-9wxmynsc.md +115 -0
  24. package/dist/deep-review-parity-bwwe7cx6.md +152 -0
  25. package/dist/deep-review-parity-e50pw3pk.md +117 -0
  26. package/dist/deep-review-parity-ennmm9m1.md +151 -0
  27. package/{prompts/default/deep-review-parity.md → dist/deep-review-parity-h7y6y2he.md} +14 -16
  28. package/dist/deep-review-parity-xg6wy69c.md +151 -0
  29. package/dist/deep-review-reliability-6h3c4gmw.md +125 -0
  30. package/dist/deep-review-reliability-dcjab69x.md +122 -0
  31. package/dist/deep-review-reliability-ec7b5pbk.md +159 -0
  32. package/dist/deep-review-reliability-hvasvmt9.md +153 -0
  33. package/dist/deep-review-reliability-mjnayxmt.md +158 -0
  34. package/dist/deep-review-reliability-mm7fnayf.md +124 -0
  35. package/dist/deep-review-reliability-xk4xvc2w.md +158 -0
  36. package/dist/deep-review-resilience-0esd5qeh.md +148 -0
  37. package/dist/deep-review-resilience-envgcmpy.md +115 -0
  38. package/dist/deep-review-resilience-fgx8ythf.md +151 -0
  39. package/dist/deep-review-resilience-mq5qa6ad.md +152 -0
  40. package/dist/deep-review-resilience-pwh1gawp.md +151 -0
  41. package/dist/deep-review-resilience-s9n21dkx.md +117 -0
  42. package/dist/deep-review-resilience-vz4qskea.md +119 -0
  43. package/dist/deep-review-security-1vwjdc9q.md +205 -0
  44. package/dist/deep-review-security-x1cc1z00.md +205 -0
  45. package/dist/index.js +590 -485
  46. package/dist/opencode-ci-jc8mf4wn.md +106 -0
  47. package/dist/opencode-ci-qrcv7a99.md +106 -0
  48. package/dist/opencode-ci-rdpcc7xc.md +106 -0
  49. package/dist/opencode-ci-yt0k74t0.md +106 -0
  50. package/dist/review-refuter-7qffwtzz.md +77 -0
  51. package/dist/verifier-tyh8r45v.md +40 -0
  52. package/dist/verifier-xf4xj701.md +40 -0
  53. package/dist/workflow-andv2dvm.yml +158 -0
  54. package/package.json +1 -1
  55. package/prompts/consolidate.md +1 -1
  56. package/prompts/default/PROVENANCE.md +6 -0
  57. package/prompts/default/deep-review-logic.md +56 -15
  58. package/prompts/default/deep-review-reliability.md +64 -30
  59. package/prompts/default/deep-review-resilience.md +71 -37
  60. package/prompts/default/deep-review-security.md +205 -0
  61. package/prompts/default/review-refuter.md +1 -1
  62. package/prompts/verifier.md +40 -0
  63. package/skills/crysk/SKILL.md +6 -6
  64. package/skills/crysk-ci-setup/SKILL.md +32 -33
  65. package/skills/crysk-ci-setup/assets/workflow.yml +5 -10
  66. package/skills/crysk-ci-setup/references/ci-admission.md +5 -5
  67. package/skills/crysk-ci-setup/references/opencode-ci.md +6 -6
  68. package/skills/crysk-loop/SKILL.md +37 -54
  69. package/skills/crysk-loop/adjudicator.md +10 -18
  70. package/skills/crysk-pr/SKILL.md +1 -1
  71. package/src/asset-manifest.ts +6 -6
  72. package/src/assets.ts +4 -4
  73. package/src/brand.ts +20 -30
  74. package/src/ci/gates.ts +155 -192
  75. package/src/ci/outcome.ts +4 -31
  76. package/src/ci/platform-limits.ts +135 -0
  77. package/src/ci/platform-report.ts +212 -126
  78. package/src/ci/platform.ts +28 -26
  79. package/src/ci/reporter.ts +25 -26
  80. package/src/ci/review-admission.ts +1 -2
  81. package/src/ci/review-levels.ts +12 -53
  82. package/src/ci/setup.ts +96 -66
  83. package/src/ci/trace-bundle.ts +11 -27
  84. package/src/ci/trace-transcripts.ts +4 -6
  85. package/src/ci/trigger.ts +3 -5
  86. package/src/cli.ts +6 -5
  87. package/src/commands/ci-setup-questions.ts +2 -55
  88. package/src/commands/ci-setup.ts +2 -26
  89. package/src/commands/triage.ts +131 -38
  90. package/src/commands/usage.ts +0 -1
  91. package/src/compare/compare.ts +3 -3
  92. package/src/compare/floor-test.ts +30 -201
  93. package/src/compare/hunter-exam.ts +631 -0
  94. package/src/config/config.ts +6 -30
  95. package/src/diversity/accounting.ts +0 -26
  96. package/src/diversity/benchmark.ts +1 -17
  97. package/src/diversity/identity.ts +0 -14
  98. package/src/diversity/pipeline-integration.ts +0 -29
  99. package/src/doctor.ts +3 -6
  100. package/src/execution/claude-session-trace.ts +7 -2
  101. package/src/execution/contracts.ts +15 -9
  102. package/src/execution/harness.ts +165 -187
  103. package/src/execution/spend-limiter.ts +39 -131
  104. package/src/execution/usage-facts.ts +397 -0
  105. package/src/execution/usage-normalized.ts +33 -86
  106. package/src/harness/materiality-judge.ts +0 -5
  107. package/src/harness/pipeline-plan.ts +0 -3
  108. package/src/harness/replay-rows.ts +0 -5
  109. package/src/harness/route-runner.ts +2 -2
  110. package/src/harness/single-step.ts +3 -9
  111. package/src/index.ts +1 -1
  112. package/src/mcp/preflight.ts +2 -2
  113. package/src/model/catalog.ts +1 -3
  114. package/src/model/free-discovery.ts +11 -78
  115. package/src/model/model-name.ts +16 -5
  116. package/src/model/profiles/claude.ts +1 -2
  117. package/src/model/profiles/openai.ts +1 -2
  118. package/src/model/profiles.ts +2 -3
  119. package/src/model/provider-capabilities.ts +16 -55
  120. package/src/model/routing.ts +39 -36
  121. package/src/pr/admission.ts +6 -6
  122. package/src/pr/answered-findings.ts +8 -4
  123. package/src/pr/ci-publish.ts +0 -2
  124. package/src/pr/discovery.ts +4 -25
  125. package/src/pr/plan.ts +40 -121
  126. package/src/pr/pr-status.ts +14 -2
  127. package/src/pr/pr.ts +1 -1
  128. package/src/pr/preflight.ts +44 -15
  129. package/src/pr/publish-outcome.ts +1 -19
  130. package/src/pr/review-pr.ts +15 -47
  131. package/src/pr/target.ts +76 -82
  132. package/src/production-runtime.ts +52 -114
  133. package/src/progress.ts +0 -54
  134. package/src/rereview/prepare.ts +4 -1
  135. package/src/rereview/state.ts +1 -1
  136. package/src/rereview/verify.ts +15 -9
  137. package/src/review/boundary.ts +5 -8
  138. package/src/review/drafts.ts +3 -3
  139. package/src/review/findings-conformance.ts +1 -1
  140. package/src/review/findings.ts +0 -4
  141. package/src/review/pipeline.ts +194 -407
  142. package/src/review/preflight.ts +175 -201
  143. package/src/review/prompt-set.ts +1 -2
  144. package/src/review/report.ts +2 -162
  145. package/src/review/review.ts +25 -74
  146. package/src/review/route-preflight.ts +19 -35
  147. package/src/review/run.ts +37 -73
  148. package/src/review/size-gate.ts +3 -3
  149. package/src/review/spec.ts +6 -11
  150. package/src/review/step-runner.ts +4 -4
  151. package/src/runner-authority.ts +10 -9
  152. package/src/security/credential-broker.ts +5 -6
  153. package/src/server/preflight.ts +0 -1
  154. package/src/server/server.ts +17 -6
  155. package/src/store/activity.ts +1 -2
  156. package/src/store/backfill-preflight.ts +0 -3
  157. package/src/store/backfill.ts +0 -1
  158. package/src/store/metrics-preflight.ts +4 -14
  159. package/src/store/metrics.ts +5 -5
  160. package/src/store/preflight.ts +0 -13
  161. package/src/store/store.ts +11 -12
  162. package/src/transport-registry.ts +6 -30
  163. package/src/transports/claude-code-cli.ts +149 -215
  164. package/src/transports/opencode-client.ts +4 -24
  165. package/src/transports/opencode-sdk.ts +17 -112
  166. package/src/triage/plain-reply.ts +37 -0
  167. package/src/ui/activity.ts +1 -6
  168. package/src/ui/config-edit.ts +14 -67
  169. package/src/ui/config.ts +3 -8
  170. package/src/ui/plan.ts +11 -198
  171. package/src/ui/progress.ts +3 -49
  172. package/src/ui/result.ts +18 -77
  173. package/src/ui/review-menu.ts +3 -12
  174. package/src/ui/select.ts +9 -79
  175. package/src/updater.ts +1 -1
  176. package/src/usage.ts +1 -7
  177. package/prompts/scout.md +0 -140
  178. package/src/ci/platform-estimate.ts +0 -111
  179. package/src/review/scout.ts +0 -323
@@ -382,16 +382,12 @@ class FrozenRuntimeBinding implements RuntimeBinding {
382
382
  !report.issues.some(
383
383
  (issue) => issue.code === "real_sdk_adapter_deferred_to_d1_11",
384
384
  );
385
- // #133. ONE effective billing mode, computed once and fed to all THREE
386
- // readers below (`pricingApplicable`, `billingMode`,
387
- // `cashCostAccountingValid`). They used to read `report.billing.mode`
388
- // independently, and that is precisely the trap: upgrading only
389
- // `billingMode` would leave `pricingApplicability` at "not_applicable",
390
- // the pricing gate would never fire, and a metered route would be
391
- // admitted as priced-not-required — executing on real spend while
392
- // reporting `cashCostUsd: 0`. Under-reporting is the failure this whole
393
- // issue exists to prevent, so the correction has to be applied ONCE,
394
- // upstream of every consumer, not per-expression.
385
+ // #133. ONE effective billing mode, computed once and fed to BOTH readers
386
+ // below (`billingMode`, `modeKnown`). They used to read
387
+ // `report.billing.mode` independently, and that is precisely the trap:
388
+ // upgrading only one would leave the other reporting a metered route as
389
+ // something it is not. The correction has to be applied ONCE, upstream of
390
+ // every consumer, not per-expression.
395
391
  //
396
392
  // The legacy backend-wide report cannot know this: it is produced before
397
393
  // any route resolves, so it cannot see the provider. The credential KIND
@@ -412,63 +408,23 @@ class FrozenRuntimeBinding implements RuntimeBinding {
412
408
  credentialKindBillsMetered(this.credential.kind)
413
409
  ? "metered"
414
410
  : report.billing.mode;
415
- const pricingApplicable =
416
- effectiveBillingMode === "metered" ? "required" : "not_applicable";
417
411
  // The legacy report carries THREE billing modes (subscription | metered |
418
412
  // unknown) and the exact contract carries two, so `unknown` narrows into
419
413
  // "subscription" here. WHY that narrowing is not a lie: it is sound ONLY
420
- // because `cashCostAccountingValid` below reads the three-state
421
- // `effectiveBillingMode` and independently blocks `unknown` — the design
422
- // doc makes `billingMode: "unknown"` a blocking preflight result
423
- // (docs/multi-runtime-model-diversity-design.md:461), and the pricing
424
- // gate cannot enforce it because `unknown` is not `metered`, leaving
425
- // pricingApplicability at "not_applicable". Delete or weaken the
426
- // cash-cost derivation and this narrowing silently starts claiming that
427
- // an unknown-billing route bills like a subscription.
414
+ // because `modeKnown` below reads the three-state `effectiveBillingMode`
415
+ // and independently blocks `unknown` — the design doc makes
416
+ // `billingMode: "unknown"` a blocking preflight result
417
+ // (docs/multi-runtime-model-diversity-design.md:461): the platform prices
418
+ // a run by the credential class the engine reports, and an unknown class
419
+ // cannot be reported. Delete or weaken that derivation and this narrowing
420
+ // silently starts claiming that an unknown-billing route bills like a
421
+ // subscription.
428
422
  //
429
423
  // #133 keeps that intact: the effective mode only ever REPLACES `unknown`
430
- // with `metered`, and a metered route is caught by the pricing gate
431
- // instead. Nothing reaches "subscription" that did not already.
424
+ // with `metered`. Nothing reaches "subscription" that did not already.
432
425
  const billingMode: ExactBindingCapabilityReport["billing"]["mode"] =
433
426
  effectiveBillingMode === "metered" ? "metered" : "subscription";
434
- // #197. ONE source, and it is the transport's own claim. This used to be
435
- // a disjunction — the transport's `pricingReady` OR a bundled per-model
436
- // rate table selected by `this.route.provider` — and the table half is
437
- // deleted, along with the loader, the 90-day freshness window and the
438
- // `config/models/*-pricing.json` files behind it.
439
- //
440
- // WHY the table lost, given the design line (§8 line 461) names "provider
441
- // cost or a versioned rate table": our table was a hand-transcribed
442
- // snapshot of the same published LIST prices the transports report, and
443
- // it aged on our release cadence rather than the tool's. It expired after
444
- // 90 days and REFUSED the route it was meant to enable, it covered only
445
- // what someone remembered to transcribe (the zai table priced 11 of the
446
- // 16 models `opencode models` reports, five days after it landed), and a
447
- // new model was absent until noticed. The transports report a live figure
448
- // for whatever they actually ran.
449
- //
450
- // Both backends now answer for themselves: OpenCode reads a non-optional
451
- // `cost` off every assistant message, and the Claude CLI reports
452
- // `total_cost_usd` (#197 flipped that flag). A transport that reports NO
453
- // cost is refused — which is the gate's whole purpose, unchanged: refuse
454
- // to bill an unknown amount. What moved is where the unknown is answered.
455
- // A missing figure is now caught at SETTLEMENT, where the answer is
456
- // actually known (`settlementFromUsage`, spend-limiter.ts: complete usage
457
- // with no cash cost settles `unresolved`, never 0), instead of being
458
- // guessed at admission from a table that might be stale.
459
- const tokenPricingAvailable = report.billing.pricingReady;
460
- // Spec (same design line): subscription OAuth may truthfully report
461
- // `cashCostUsd: 0`; metered routes require a cost source; unknown is
462
- // blocking. Read off `tokenPricingAvailable` rather than the raw flag so
463
- // the two cannot drift — a metered report claiming
464
- // priced-but-not-accountable is self-contradictory and would strand the
465
- // route in a gate that no longer has a reason to refuse it.
466
- const cashCostAccountingValid =
467
- effectiveBillingMode === "subscription"
468
- ? true
469
- : effectiveBillingMode === "metered"
470
- ? tokenPricingAvailable
471
- : false;
427
+ const modeKnown = effectiveBillingMode !== "unknown";
472
428
  return {
473
429
  routeKey: this.key,
474
430
  backend: this.route.backend,
@@ -513,9 +469,7 @@ class FrozenRuntimeBinding implements RuntimeBinding {
513
469
  usage: { normalized: true },
514
470
  billing: {
515
471
  mode: billingMode,
516
- pricingApplicability: pricingApplicable,
517
- tokenPricingAvailable,
518
- cashCostAccountingValid,
472
+ modeKnown,
519
473
  },
520
474
  };
521
475
  }
@@ -548,9 +502,8 @@ class FrozenRuntimeBinding implements RuntimeBinding {
548
502
  // that supplies no registry — so the public `createProductionRuntime`,
549
503
  // which accepts an arbitrary `options.registry`, bypassed it entirely
550
504
  // and the factory silently fell back to "subscription" on a metered
551
- // route. That stamp is what `settlementFromUsage`'s metered-zero rule
552
- // keys on, so the fallback made the rule DEAD: an unaccountable
553
- // provider $0 settled as a truthful cost instead of fencing the bucket.
505
+ // route. That stamp is the credential class the platform prices the run
506
+ // by, so the fallback filed a metered route's usage as subscription.
554
507
  // (`collectDoctorExactBindingReports` supplies its own kind-less
555
508
  // registry too, but it only ever calls `capabilities()` — no attempt,
556
509
  // so no usage record, so nothing there could observe the divergence.
@@ -647,7 +600,7 @@ function bindingBucketId(
647
600
  // this binding otherwise authenticates with — those are two different
648
601
  // credentials that happen to share one route. Fencing the subscription
649
602
  // bucket here would block the next NON-degraded subscription attempt on
650
- // this same route over dollars the OAuth credential never spent (and would
603
+ // this same route over usage the OAuth credential never made (and would
651
604
  // widen the harness's own reservesSpend=false invariant: "a subscription
652
605
  // binding reserves nothing" — production-runtime.test.ts). Fencing this
653
606
  // mirrored bucket instead lands on the SAME identity a real metered
@@ -1038,9 +991,6 @@ export function d1_11EvidenceFromExactBinding(
1038
991
  credentialAuthority:
1039
992
  report.auth.projectionReady || report.auth.probe === "passed",
1040
993
  workspaceBroker: report.isolation.workspaceReadBroker,
1041
- pricingReady:
1042
- report.billing.pricingApplicability !== "required" ||
1043
- report.billing.tokenPricingAvailable,
1044
994
  };
1045
995
  }
1046
996
 
@@ -1185,7 +1135,7 @@ async function openCodeFreeVerdicts(
1185
1135
  // send, fallbacks included, is checked against the variants OpenCode lists for
1186
1136
  // that model before the run starts, and refused by name: an unknown variant,
1187
1137
  // a model with no variants, and a listing that could not be read all stop the
1188
- // review here, before the cost confirmation. A plan sending no variant (no
1138
+ // review here, before the plan confirmation. A plan sending no variant (no
1189
1139
  // OpenCode entry sets an effort, D1) checks nothing and spawns nothing.
1190
1140
  //
1191
1141
  // The listing is `opencode models <provider> --verbose --refresh`, the same
@@ -1561,7 +1511,7 @@ export async function prepareProductionAdmissionContext(input: {
1561
1511
  return { error: credentialRefusal.message, credentialRefusal };
1562
1512
  }
1563
1513
  }
1564
- // S7: after the credential check, before the bindings and the cost
1514
+ // S7: after the credential check, before the bindings and the plan
1565
1515
  // confirmation. The probe is built only when a route sends a variant, so a plan
1566
1516
  // without one spawns nothing new.
1567
1517
  const sendsVariant = planRoutes(input.plan).some(
@@ -1686,7 +1636,6 @@ export async function prepareProductionAdmissionContext(input: {
1686
1636
  credentialAuthority:
1687
1637
  combined.credentialAuthority && next.credentialAuthority,
1688
1638
  workspaceBroker: combined.workspaceBroker && next.workspaceBroker,
1689
- pricingReady: combined.pricingReady && next.pricingReady,
1690
1639
  };
1691
1640
  }
1692
1641
  if (combined !== undefined) evidence.set("opencode", combined);
@@ -1962,49 +1911,47 @@ export class MultiProviderRunner implements StepRunner {
1962
1911
  // 2026-09-02. WHICH steps reserve into the run's ledger: metered ones
1963
1912
  // only, read off the report the gate above just admitted rather than
1964
1913
  // re-derived from `binding.credential.kind`. One derivation of one fact —
1965
- // the same `effectiveBillingMode` #133 computes once and feeds to all
1966
- // three billing readers — so the fact that decided admission is the fact
1967
- // that decides reservation.
1914
+ // the same `effectiveBillingMode` #133 computes once and feeds to both
1915
+ // billing readers — so the fact that decided admission is the fact that
1916
+ // decides reservation.
1968
1917
  //
1969
1918
  // WHY not every step. The ledger's guarantee is "an unresolved bucket
1970
1919
  // blocks the next paid attempt", and `finalizeReservation` reaches it on
1971
- // more than the metered-zero rule: partial usage, unavailable usage (an
1920
+ // usage the engine could not confirm: partial usage, unavailable usage (an
1972
1921
  // OpenCode attempt where no usage event ever arrived, and ANY backend's
1973
1922
  // harness watchdog timeout, which normalizes to unavailable), and an
1974
1923
  // attempt that comes back `cancelled`. Any one of those fences the bucket
1975
1924
  // for the rest of the ledger's life.
1976
1925
  //
1977
- // On a metered bucket that is exactly right and fail-closed: we do not
1978
- // know what we spent, so we stop spending. On a SUBSCRIPTION bucket it
1979
- // would refuse later steps over dollars that cannot be spent — and it
1980
- // would do so against a pipeline built to survive exactly this. Hunters
1981
- // run under `Promise.allSettled` and `runPipeline` tolerates a lost
1982
- // hunter (`hunterFailures`, failing the run only when ALL of them fail),
1983
- // so one hunter whose stdout would not parse would fence the credential
1984
- // and take the refuter down with it. That trades a degraded run for a
1985
- // dead one, buying nothing, on the one backend that demonstrably works
1986
- // today.
1926
+ // On a metered bucket that is exactly right and fail-closed: the engine
1927
+ // cannot report what the attempt used, so it stops using that credential.
1928
+ // On a SUBSCRIPTION bucket it would refuse later steps over usage that
1929
+ // cannot be charged — and it would do so against a pipeline built to
1930
+ // survive exactly this. Hunters run under `Promise.allSettled` and
1931
+ // `runPipeline` tolerates a lost hunter (`hunterFailures`, failing the run
1932
+ // only when ALL of them fail), so one hunter whose stdout would not parse
1933
+ // would fence the credential and take the refuter down with it. That
1934
+ // trades a degraded run for a dead one, buying nothing, on the one backend
1935
+ // that demonstrably works today.
1987
1936
  //
1988
1937
  // Same reasoning keeps `ClaudeCodeRunner` (step-runner.ts) ledger-free:
1989
1938
  // claude-code resolves to `claude_subscription_oauth` for every provider
1990
- // (`credentialKindForRoute`), so the metered-zero rule structurally cannot
1991
- // fire there. A ledger on that path is a state machine with no guarantee
1992
- // to enforce. The known limitation, deliberately not addressed here: a
1993
- // claude-code run under a real `ANTHROPIC_API_KEY` does spend money, but
1994
- // the engine models that backend as subscription on purpose — ci/gates.ts
1995
- // documents why deriving it instead is an ADMISSION hazard, and
1996
- // `resolveCiBudgetCeiling` is where that case is handled.
1939
+ // (`credentialKindForRoute`). A ledger on that path is a state machine
1940
+ // with no guarantee to enforce. The known limitation, deliberately not
1941
+ // addressed here: a claude-code run under a real `ANTHROPIC_API_KEY` is
1942
+ // billed per token, but the engine models that backend as subscription on
1943
+ // purpose — ci/gates.ts documents why deriving it instead is an ADMISSION
1944
+ // hazard.
1997
1945
  //
1998
1946
  // 2026-09-02, #177: one clause of that paragraph is no longer true and the
1999
1947
  // correction matters. Its usage RECORDS are no longer "truthfully
2000
1948
  // subscription" on every route — the Claude CLI transport now stamps
2001
1949
  // `metered` when the projected child env carries ANTHROPIC_API_KEY or
2002
- // ANTHROPIC_AUTH_TOKEN, so the run's real spend reaches `cashCostUsd`
2003
- // instead of being filed as an uncharged list price. This line is
2004
- // deliberately unchanged: it reads the CAPABILITY REPORT, not the usage
2005
- // record, so no reservation is opened, nothing is fenced, and no API-key
2006
- // route loses admission. The record is honest; the gate stays where #161
2007
- // must move it.
1950
+ // ANTHROPIC_AUTH_TOKEN, so the platform sees that run as a per-token
1951
+ // credential. This line is deliberately unchanged: it reads the CAPABILITY
1952
+ // REPORT, not the usage record, so no reservation is opened, nothing is
1953
+ // fenced, and no API-key route loses admission. The record is honest; the
1954
+ // gate stays where #161 must move it.
2008
1955
  //
2009
1956
  // A claude-only run therefore records no reservations at all, and the
2010
1957
  // absent `reservations` key on those steps is the truthful signal — not a
@@ -2012,14 +1959,11 @@ export class MultiProviderRunner implements StepRunner {
2012
1959
  //
2013
1960
  // #182 follow-up: free OpenCode bindings reserve too — read off the
2014
1961
  // credential KIND, not the report (which still says subscription for free
2015
- // routes: capability `BillingMode` stays binary on purpose). Without a
2016
- // reservation `finalizeReservation` never runs, the free-nonzero rule
2017
- // (spend-limiter.ts) would be dead in production, and a flipped model
2018
- // would keep spending attempts instead of fencing the bucket and failing
2019
- // closed. A free step that stays free settles 0 and never fences, so the
2020
- // subscription reasoning above ("refusing later steps over dollars that
2021
- // cannot be spent") does not apply: only a priced flip, partial usage, or
2022
- // unavailable usage fences a free bucket.
1962
+ // routes: capability `BillingMode` stays binary on purpose). A free route
1963
+ // whose usage the engine could not confirm is not provably still free, so
1964
+ // it fences the bucket like a metered one instead of spending further
1965
+ // attempts on it. A free step whose usage is complete settles and never
1966
+ // fences.
2023
1967
  const reservesSpend =
2024
1968
  capabilityReport.billing.mode === "metered" ||
2025
1969
  binding.credential.kind === "provider_free";
@@ -2061,12 +2005,6 @@ export class MultiProviderRunner implements StepRunner {
2061
2005
  // fence lands on the credential that could not account for its spend
2062
2006
  // and leaves every other route admissible.
2063
2007
  //
2064
- // `reservedUsdPerAttempt` is deliberately left at the harness default
2065
- // of 0 rather than given an invented number: `reservedUsd` is
2066
- // RECORDED on the reservation and read by no gate anywhere — the
2067
- // fence keys on `fencedBuckets`, never on an amount — so a figure
2068
- // here would be a budget nobody has decided, dressed as one that was.
2069
- //
2070
2008
  // #279: `spendLedger` is now handed to EVERY binding — see the WHY
2071
2009
  // just above `isolation` — with `reservesSpend` carrying the
2072
2010
  // per-binding decision the conditional spread used to encode. A
package/src/progress.ts CHANGED
@@ -53,18 +53,6 @@ interface PanelHunter {
53
53
  failureReason?: string;
54
54
  }
55
55
 
56
- // The scout is the one stage with a real STARTED event, because it is the one
57
- // that runs alone: it is awaited before the hunters spawn, and M4 measured it
58
- // at 86-600s. Without a row of its own the panel shows four hunters "waiting"
59
- // for up to ten minutes and explains nothing — the silence that once cost a
60
- // paid run to a reasonable Ctrl-C.
61
- interface PanelScout {
62
- status: "running" | "done" | "failed";
63
- durationMs?: number;
64
- model?: string;
65
- leads?: number;
66
- }
67
-
68
56
  interface PanelSummarizer {
69
57
  // The summarizer starts with the pipeline, but it has no separate started
70
58
  // event. Seeding it as running keeps the first frame truthful.
@@ -94,10 +82,6 @@ export interface PanelState {
94
82
  // own elapsed, not the panel's.
95
83
  huntersStartedAtMs?: number;
96
84
  hunters: PanelHunter[];
97
- // Absent until the scout-started event arrives — unlike the summarizer,
98
- // which is seeded, because a run with no scout must show no scout row and
99
- // the caller's flag is not the panel's business.
100
- scout?: PanelScout;
101
85
  // Cosmetic only: the pipeline owns summary semantics and run status.
102
86
  // Absent means the summary step was disabled for this run.
103
87
  summarizer?: PanelSummarizer;
@@ -207,20 +191,6 @@ export function applyProgressEvent(
207
191
  case "verify-started":
208
192
  case "verify-step-finished":
209
193
  return;
210
- case "scout-started": {
211
- state.scout = { status: "running", model: event.model };
212
- return;
213
- }
214
- case "scout-finished": {
215
- // Tolerant of a finish with no start: the construction-failure path
216
- // emits only the finish, and a panel that threw there would take the
217
- // run down with it.
218
- state.scout ??= { status: "running" };
219
- state.scout.status = event.ok ? "done" : "failed";
220
- state.scout.durationMs = event.durationMs;
221
- if (event.leads !== undefined) state.scout.leads = event.leads;
222
- return;
223
- }
224
194
  case "summarizer-finished": {
225
195
  if (!state.summarizer) return;
226
196
  state.summarizer.status = event.ok ? "done" : "failed";
@@ -374,26 +344,6 @@ function refuterNode(
374
344
  };
375
345
  }
376
346
 
377
- function scoutNode(
378
- scout: PanelScout,
379
- state: PanelState,
380
- nowMs: number,
381
- labelWidth: number,
382
- ): TreeNode {
383
- const detail =
384
- scout.status === "running"
385
- ? `reading the diff — ${formatElapsed(nowMs - state.startedAtMs)}`
386
- : scout.status === "done"
387
- ? `${scout.leads ?? 0} lead${scout.leads === 1 ? "" : "s"} — ` +
388
- formatElapsed(scout.durationMs ?? 0)
389
- : "failed — the hunters run unled";
390
- return {
391
- label: pad("scout", labelWidth),
392
- status: scout.status,
393
- detail,
394
- };
395
- }
396
-
397
347
  function summarizerNode(
398
348
  summarizer: PanelSummarizer,
399
349
  state: PanelState,
@@ -447,16 +397,12 @@ export function renderPanelLines(
447
397
  "dedupe".length,
448
398
  "refuter".length,
449
399
  state.summarizer === undefined ? 0 : "summarizer".length,
450
- state.scout === undefined ? 0 : "scout".length,
451
400
  );
452
401
  const modelWidth = Math.max(
453
402
  0,
454
403
  ...state.hunters.map((h) => h.model?.length ?? 0),
455
404
  );
456
- // FIRST, above the hunters: it ran before them, and a row below rows that
457
- // are waiting on it reads as the wrong order.
458
405
  const nodes: TreeNode[] = [];
459
- if (state.scout) nodes.push(scoutNode(state.scout, state, nowMs, labelWidth));
460
406
  nodes.push(
461
407
  ...state.hunters.map((hunter) =>
462
408
  hunterNode(hunter, state, nowMs, labelWidth, modelWidth),
@@ -13,6 +13,7 @@ import {
13
13
  parseAdjudicationMarker,
14
14
  trustedAdjudicator,
15
15
  } from "#triage/adjudication";
16
+ import { withPlainAppliedReplies } from "#triage/plain-reply";
16
17
  import { parseTriageMarker } from "#triage/triage";
17
18
  import {
18
19
  classifyPrior,
@@ -985,10 +986,12 @@ export function enrichPriorsFromThreads(input: {
985
986
  platformActor?: string;
986
987
  }): PriorRecord[] {
987
988
  const bound = bindPriorsToPosted(input.priors, input.posted);
989
+ // triage-without-skill S1: a plain `applied` reply is the triage it implies (triage/plain-reply.ts).
990
+ const replies = withPlainAppliedReplies(input.replies);
988
991
  return input.priors.map((prior) => {
989
992
  const parent = bound.get(prior.id);
990
993
  if (parent === undefined) return prior;
991
- const thread = input.replies.filter(
994
+ const thread = replies.filter(
992
995
  (reply) => reply.in_reply_to_id === parent.id,
993
996
  );
994
997
  let triage: PriorTriage | null = prior.triage;
@@ -511,7 +511,7 @@ export function assembleLive(input: {
511
511
  // matching is a 5-line window, so a different issue can sit there, and the
512
512
  // gate fails closed.
513
513
  // A real fix leaves the count when the re-review VERIFIES it gone, and
514
- // `/pr-hero override` covers a team that accepts the finding.
514
+ // `/crysk override` covers a team that accepts the finding.
515
515
  // A self-asserted triage tag never leaves the count (S7). `misclassified`
516
516
  // lands as `re-tiered` (classifyPrior), and its tier is the author's claim,
517
517
  // not the pipeline's, so it is not evidence. A dismissal the adjudicator upheld
@@ -43,12 +43,20 @@ export interface VerifySubject extends VerifyQueueEntry {
43
43
  vId: string;
44
44
  }
45
45
 
46
+ // Three verdicts, each named once in the request. The parse still accepts
47
+ // `downgraded-latent` because it shares the refuter's validator, and
48
+ // mapVerifyVerdict keeps such a finding open; the request does not offer it,
49
+ // because "a real defect nothing can execute yet" is an answer to the
50
+ // refuter's question, not to "is it still present".
46
51
  export const VERIFY_OUTPUT_CONTRACT = [
47
52
  "Your final message must be exactly one JSON object — no prose, no code",
48
- 'fences — of the shape {"results":[{"finding_id":"...","outcome":',
49
- '"corroborated|refuted|downgraded-latent|inconclusive","proof_refs":',
50
- '["..."]}]} with exactly one verdict per submitted V### id — never',
51
- "implied, never extra.",
53
+ 'fences — of the shape {"results":[{"finding_id":"...","outcome":"...",',
54
+ '"proof_refs":["..."]}]} with exactly one verdict per submitted V### id —',
55
+ "never implied, never extra. `outcome` is one of:",
56
+ "- `refuted`: the defect is no longer present in the checkout, and",
57
+ " `proof_refs` cites the lines that show it.",
58
+ "- `corroborated`: the defect is still present.",
59
+ "- `inconclusive`: you could not tell.",
52
60
  ].join("\n");
53
61
 
54
62
  export function verifySubjectId(index: number): string {
@@ -222,7 +230,9 @@ export function composeVerifyPrompt(
222
230
  ];
223
231
  if (blocks.some((block) => blockForgesNonce(block, nonce))) return null;
224
232
  return [
225
- "Is this specific defect still present at these locations, at H?",
233
+ "Is the defect this earlier finding describes still present in the code",
234
+ "checked out in your working directory? That checkout is the pull request",
235
+ "at its current head.",
226
236
  "",
227
237
  wrapBlock("previous_finding", nonce, previousFinding),
228
238
  wrapBlock("patch", nonce, subject.deltaHunks),
@@ -230,10 +240,6 @@ export function composeVerifyPrompt(
230
240
  wrapBlock("comment_body", nonce, subject.commentBody),
231
241
  wrapBlock("triage_tag", nonce, subject.triageTag),
232
242
  "",
233
- "`refuted` means the code at H positively contradicts the claim — cite",
234
- "the contradicting lines. Absence of a hunter re-finding it is not",
235
- "disproof. `inconclusive` means you could not tell.",
236
- "",
237
243
  VERIFY_OUTPUT_CONTRACT,
238
244
  ]
239
245
  .filter((line) => line !== "")
@@ -22,7 +22,6 @@
22
22
  // untrusted block cannot be wrapped under an invented tag name.
23
23
  export type BoundaryTag =
24
24
  | "patch"
25
- | "scout_leads"
26
25
  | "finding"
27
26
  | "findings"
28
27
  | "gotchas"
@@ -32,6 +31,7 @@ export type BoundaryTag =
32
31
  | "comment_body"
33
32
  | "triage_tag"
34
33
  | "pr_title"
34
+ | "pr_description"
35
35
  | "review_comment"
36
36
  | "code_window"
37
37
  | "review_instructions";
@@ -81,16 +81,13 @@ export function selectBoundaryNonce(
81
81
  );
82
82
  }
83
83
 
84
- // EMPTY CONTENT RENDERS TO THE EMPTY STRING, never to an empty tag pair. This
85
- // is load-bearing twice over: `renderLeadsBlock` already returns "" so a scout
86
- // that found nothing produces the control arm's byte-identical hunter prompt
87
- // (`review/scout.ts`'s note on M6), and an empty priors list must likewise leave no
88
- // trace in a system prompt. A `<scout_leads nonce></scout_leads nonce>` pair
89
- // would break both.
84
+ // EMPTY CONTENT RENDERS TO THE EMPTY STRING, never to an empty tag pair: an
85
+ // empty priors list must leave no trace in a system prompt, and a
86
+ // `<priors nonce></priors nonce>` pair would be one.
90
87
  //
91
88
  // Throwing on a forged nonce is the last line of defence, not the first: every
92
89
  // block whose content can arrive after the nonce was committed is guarded by
93
- // the driver before it reaches here (see `runScout` and `runRefuter`), because
90
+ // the driver before it reaches here (see `runRefuter`), because
94
91
  // a throw at prompt-composition time would kill a paid run. A throw that does
95
92
  // escape means a block reached composition unguarded — which is a defect to
96
93
  // see, not one to paper over by shipping a forgeable boundary.
@@ -41,11 +41,11 @@ export interface HunterDraft {
41
41
  // not invent a failure, and must not invent a pass by stamping a 0 it did
42
42
  // not see. OpenCode stamps the count (including 0). Claude Code derives it from
43
43
  // the CLI result's `num_turns` (#299) and omits it when that is not a valid
44
- // integer. Scout is out of this rule because the engine forces `tools: []`.
44
+ // integer.
45
45
  //
46
46
  // Only a parsed `{ findings: [...] }` can trip it. The refuter and verifier
47
- // emit `results`, the summarizer `prose`/`score`, and the scout a bare lead
48
- // list; none of them has a `findings` array, so none of them is reached.
47
+ // emit `results` and the summarizer `prose`/`score`; none has a `findings`
48
+ // array, so none of them is reached.
49
49
  export function isVacuousHunt(input: {
50
50
  readonly tools: readonly string[];
51
51
  readonly toolInvocations: number | undefined;
@@ -21,7 +21,7 @@ const FINDING_V11_BAD_HUNTER =
21
21
  '{"id":"F001","category":1,"path":"src/a.ts","line":1,"severity":"BLOCKER","evidence_class":"deterministic","refuter_verdict":"not_submitted","causal_disposition":"introduced","claim":"x","proof_refs":[],"hunter":"Security","tier":"blocking","hops_used":0,"hop_trail":[],"dedupe_key":"k"}';
22
22
 
23
23
  const TELEMETRY =
24
- '{"index_ms":1,"index_mode":"fresh","index_disk_mb":1,"wall_ms":1,"tokens_in":1,"tokens_out":1,"tokens_total":2,"cost_usd_est":0.1}';
24
+ '{"index_ms":1,"index_mode":"fresh","index_disk_mb":1,"wall_ms":1,"tokens_in":1,"tokens_out":1,"tokens_total":2}';
25
25
 
26
26
  function envelope(
27
27
  schemaVersion: string,
@@ -112,10 +112,6 @@ export interface Telemetry {
112
112
  tokens_in: number;
113
113
  tokens_out: number;
114
114
  tokens_total: number;
115
- cost_usd_est: number;
116
- // True when at least one spend reservation ended unresolved_remote — the
117
- // reported cost is a floor of known spend, not a closed total.
118
- cost_usd_est_is_floor?: boolean;
119
115
  // Engine v2 populates this per step (it runs one session per agent). The
120
116
  // original best-effort caveat (reconciliation R3) still applies to v1
121
117
  // documents: absence must never fail validation.