@azure-id/orc 1.8.1 → 1.8.2

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 (46) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/README-id.md +90 -71
  3. package/README.md +77 -31
  4. package/bin/cli.js +45460 -44867
  5. package/bin/graph-extract.js +2409 -120
  6. package/bin/graph-gain.js +404 -0
  7. package/bin/graph-map.js +232 -0
  8. package/bin/graph-notes.js +49 -8
  9. package/bin/graph-query.js +1770 -808
  10. package/bin/graph-resolve.js +93 -16
  11. package/bin/graph-shard.js +325 -0
  12. package/bin/graph.js +658 -605
  13. package/bin/verify-contracts.js +140 -0
  14. package/bin/verify-package.js +14 -0
  15. package/bin/webui/api.js +6 -0
  16. package/bin/webui/fixtures/index.js +6 -1
  17. package/bin/webui/fixtures/knowledge.js +41 -1
  18. package/bin/webui/fixtures/stats.js +107 -104
  19. package/bin/webui/i18n/en/knowledge.json +16 -1
  20. package/bin/webui/i18n/id/knowledge.json +16 -1
  21. package/bin/webui/js/panels/knowledge.js +68 -3
  22. package/package.json +1 -1
  23. package/templates/agents/orc-executor-haiku-4-5.md +8 -13
  24. package/templates/agents/orc-executor-opus-4-7-high.md +8 -13
  25. package/templates/agents/orc-executor-opus-4-7-med.md +8 -13
  26. package/templates/agents/orc-executor-opus-4-8-high.md +8 -13
  27. package/templates/agents/orc-executor-opus-5-high.md +8 -13
  28. package/templates/agents/orc-executor-opus-5-low.md +8 -13
  29. package/templates/agents/orc-executor-opus-5-med.md +8 -13
  30. package/templates/agents/orc-executor-sonnet-4-6-high.md +8 -13
  31. package/templates/agents/orc-executor-sonnet-4-6-med.md +8 -13
  32. package/templates/agents/orc-executor-sonnet-5-high.md +8 -13
  33. package/templates/agents/orc-graph-noter-sonnet-4-6-med.md +15 -12
  34. package/templates/hooks/README.md +13 -3
  35. package/templates/hooks/orc-graph-hook.js +148 -13
  36. package/templates/skills/_shared/code-graph.md +148 -20
  37. package/templates/skills/_shared/phases/execution.md +13 -11
  38. package/templates/skills/_shared/phases/planning.md +8 -1
  39. package/templates/skills/_shared/phases/ship.md +5 -1
  40. package/templates/skills/_shared/phases/trace.md +2 -0
  41. package/templates/skills/_shared/phases/wiki-consult.md +1 -1
  42. package/templates/skills/_shared/read-ladder.md +10 -2
  43. package/templates/skills/orc/SKILL.md +1 -1
  44. package/templates/skills/orc-analyze/SKILL.md +13 -13
  45. package/templates/skills/orc-diy/references/flow-schema.md +1 -1
  46. package/templates/skills/orc-wiki/references/staleness.md +1 -1
@@ -2722,6 +2722,144 @@ const CONTRACTS = [
2722
2722
  "skills/orc-mini/SKILL.md",
2723
2723
  ],
2724
2724
  },
2725
+ // ── v1.8.2 W3 — the delivery flags (D1 · D2 · D3 · D5) ────────────────
2726
+ {
2727
+ // The slice call. A rename must reach the contract, the phase file that
2728
+ // makes the call, the hook that dedupes against what it delivered, and the
2729
+ // CLI that answers it.
2730
+ name: "graph slice view (v1.8.2 — ctx --for-slice, the OUTSIDE view of a declared file)",
2731
+ token: "--for-slice",
2732
+ files: ["hooks/orc-graph-hook.js", "skills/_shared/code-graph.md", "skills/_shared/phases/execution.md"],
2733
+ binFiles: ["bin/cli.js", "bin/graph-query.js"],
2734
+ },
2735
+ {
2736
+ // The card and the range in one call. Pinned WITH its argument, because a
2737
+ // bare `--source` is also `orc doc`'s own flag.
2738
+ name: "graph source block (v1.8.2 — ctx --source [N], charged to the same budget)",
2739
+ token: "--source [N]",
2740
+ files: ["skills/_shared/code-graph.md", "skills/_shared/read-ladder.md"],
2741
+ binFiles: ["bin/cli.js"],
2742
+ },
2743
+ {
2744
+ // One call at a wave close. The two-call form still works; the lane text
2745
+ // uses this one, so the flag has to exist wherever the text says it does.
2746
+ name: "graph one-call update (v1.8.2 — update --notes-pending)",
2747
+ token: "--notes-pending",
2748
+ files: ["skills/_shared/code-graph.md", "skills/_shared/phases/execution.md"],
2749
+ binFiles: ["bin/cli.js"],
2750
+ },
2751
+ {
2752
+ // The fourth value of `code_graph_hooks`. It arms the whole-file READ hint
2753
+ // and nothing else, and it is off until somebody types it.
2754
+ name: "graph read hint (v1.8.2 — code_graph_hooks: on,read)",
2755
+ token: "on,read",
2756
+ files: ["hooks/orc-graph-hook.js", "hooks/README.md", "skills/_shared/code-graph.md"],
2757
+ binFiles: ["bin/cli.js"],
2758
+ },
2759
+ // ── v1.8.2 W4 — the paid layer, paid less (N1 · N2) ──────────────────
2760
+ {
2761
+ // The noter's ONE call. The flag lives in the agent that makes it and in
2762
+ // the contract that describes it; the CLI has to answer it.
2763
+ name: "graph noter source (v1.8.2 — notes pending --with-source, so the noter reads nothing)",
2764
+ token: "--with-source",
2765
+ files: ["agents/orc-graph-noter-sonnet-4-6-med.md", "skills/_shared/code-graph.md"],
2766
+ binFiles: ["bin/cli.js", "bin/graph-notes.js"],
2767
+ },
2768
+ {
2769
+ // The doc note, at 0 model tokens. It is a note, not a fact, so it sits
2770
+ // beside graph notes in the precedence line everywhere that line appears.
2771
+ name: "doc notes precedence (v1.8.2 — graph notes AND doc notes, below a stale wiki)",
2772
+ token: "graph notes and doc notes",
2773
+ files: [
2774
+ "skills/_shared/code-graph.md",
2775
+ "skills/_shared/phases/wiki-consult.md",
2776
+ "skills/_shared/read-ladder.md",
2777
+ "skills/orc-wiki/references/staleness.md",
2778
+ ],
2779
+ binFiles: ["bin/graph-notes.js"],
2780
+ },
2781
+ // ── v1.8.2 W5 — the five new languages (G6) ──────────────────────────
2782
+ {
2783
+ // A language the contract claims and the engine cannot read is a promise
2784
+ // the card breaks in silence. The claim and `LANG_BY_EXT` move together.
2785
+ name: "graph languages (v1.8.2 — Ruby, Rust, Kotlin, plus SFC and C/C++)",
2786
+ token: "Ruby, Rust, Kotlin",
2787
+ files: ["skills/_shared/code-graph.md"],
2788
+ binFiles: ["bin/graph.js"],
2789
+ },
2790
+ // ── v1.8.2 W6 — the borrowed toolchains (G7) ─────────────────────────
2791
+ {
2792
+ // The escape hatch. If the contract names it and the engine stops reading
2793
+ // it, a project with a misbehaving toolchain has no way out.
2794
+ name: "graph borrow escape (v1.8.2 — ORC_GRAPH_NO_BORROW forces the heuristic)",
2795
+ token: "ORC_GRAPH_NO_BORROW",
2796
+ files: ["skills/_shared/code-graph.md"],
2797
+ binFiles: ["bin/graph-extract.js"],
2798
+ },
2799
+ // ── v1.8.2 W8 — the sharded read path (S1) ────────────
2800
+ {
2801
+ // The shards are a DERIVED store, and the contract's promise about every
2802
+ // derived store is the one that keeps them safe: generation-pinned, and a
2803
+ // missing one costs time and no answer. If the engine stops writing them,
2804
+ // the sentence that tells a reader they exist has to go with it.
2805
+ name: "graph shards (v1.8.2 — the resolved/ shards a one-symbol ctx reads)",
2806
+ token: "resolved/<ab>.json",
2807
+ files: ["skills/_shared/code-graph.md"],
2808
+ binFiles: ["bin/graph-shard.js"],
2809
+ },
2810
+ // ── v1.8.2 W7 — the ranked map (D4) ──────────────────
2811
+ {
2812
+ // The command itself. Three lanes are told to run it at the START of
2813
+ // planning; if the CLI stops offering it, every one of them opens a run
2814
+ // with a call that does not exist.
2815
+ name: "graph map (v1.8.2 — the ranked repository map, the orientation call)",
2816
+ token: "orc graph map",
2817
+ files: [
2818
+ "skills/_shared/code-graph.md",
2819
+ "skills/_shared/phases/planning.md",
2820
+ "skills/_shared/phases/trace.md",
2821
+ "skills/orc/SKILL.md",
2822
+ "skills/orc-diy/references/flow-schema.md",
2823
+ ],
2824
+ binFiles: ["bin/cli.js", "bin/graph-map.js"],
2825
+ },
2826
+ {
2827
+ // The trace verb. A lane that emits a verb the trace table does not hold
2828
+ // writes a line `/orc-retro` cannot aggregate.
2829
+ name: "graph map trace (v1.8.2 — GRAPH-MAP, one line at the start of planning)",
2830
+ token: "GRAPH-MAP",
2831
+ files: [
2832
+ "skills/_shared/phases/trace.md",
2833
+ "skills/_shared/phases/planning.md",
2834
+ ],
2835
+ binFiles: ["bin/cli.js"],
2836
+ },
2837
+ {
2838
+ // The claim that keeps the map safe to read. It is the map's whole
2839
+ // equivalent of "the graph is a LOCATOR": a rank is where to look first,
2840
+ // never proof that a file matters to this change.
2841
+ name: "graph map rank is a hint (v1.8.2 — never proof a file matters)",
2842
+ token: "a HINT about where to look first",
2843
+ files: ["skills/_shared/code-graph.md", "skills/_shared/phases/planning.md"],
2844
+ binFiles: ["bin/graph-query.js"],
2845
+ },
2846
+ // ── v1.8.2 W4b — the gain meter (K) ─────────────────────────────
2847
+ {
2848
+ // The one line a run prints about what the graph cost and probably saved.
2849
+ // The verb lives in the trace table and in the phase that emits it.
2850
+ name: "graph gain line (v1.8.2 — GRAPH-GAIN, one line at ship, copied verbatim)",
2851
+ token: "GRAPH-GAIN",
2852
+ files: ["skills/_shared/phases/ship.md", "skills/_shared/phases/trace.md"],
2853
+ binFiles: ["bin/cli.js"],
2854
+ },
2855
+ {
2856
+ // `avoided` is a COUNTERFACTUAL. The word has to survive every rewrite of
2857
+ // the contract and of the panel, because it is the claim.
2858
+ name: "graph gain estimate (v1.8.2 — avoided is an estimate, never a bill)",
2859
+ token: "AN ESTIMATE",
2860
+ files: ["skills/_shared/code-graph.md"],
2861
+ binFiles: ["bin/graph-gain.js"],
2862
+ },
2725
2863
  {
2726
2864
  // The only notes writer, dispatched BY NAME. An unnamed dispatch cannot
2727
2865
  // enforce the Sonnet 4.6 pin and is invisible to the trace hook.
@@ -3919,6 +4057,8 @@ for (const b of BUDGETS) {
3919
4057
  // as `statusline_custom` is. Neither can have a lane, and that is an ANSWER.
3920
4058
  "code_graph_heal_ms",
3921
4059
  "code_graph_hooks",
4060
+ // v1.8.2 W2 — the ignore globs, read by the CLI behind the same calls.
4061
+ "code_graph_ignore",
3922
4062
  ]);
3923
4063
  for (const e of metaEntries) {
3924
4064
  if (!e.lanes) {
@@ -185,6 +185,20 @@ const required = [
185
185
  "bin/graph-resolve.js",
186
186
  "bin/graph-signals.js",
187
187
  "bin/graph-notes.js",
188
+
189
+ // v1.8.2 W4b — the gain meter. Dropping it breaks `orc graph gain` AND the
190
+ // one ledger line every read appends, so the map would go on working and
191
+ // quietly stop recording what it cost.
192
+ "bin/graph-gain.js",
193
+ // v1.8.2 W7 — the ranked map (D4). Dropping it breaks `orc graph map` AND the
194
+ // `map.json` every update writes, so planning would silently go back to the
195
+ // Glob-and-read sweep the map exists to replace.
196
+ "bin/graph-map.js",
197
+ // v1.8.2 W8 — the sharded read path (S1). Dropping it does not break a card:
198
+ // every read falls back to the full model. It breaks the SPEED, silently, on
199
+ // the one call every lane makes — which is the worst kind of missing file.
200
+ "bin/graph-shard.js",
201
+
188
202
  // The two DATED data files (v0.50.0). Both ship inside the package and both
189
203
  // are load-bearing on absence rather than on content: without the catalog
190
204
  // `orc extra providers` is a packaging bug it reports as one, and without the
package/bin/webui/api.js CHANGED
@@ -224,6 +224,12 @@ const READS = {
224
224
  // v1.8.0 — the code graph. A READ whose exit code is DATA (0 fresh · 1 none ·
225
225
  // 2 drifted · 3 off), exactly like `wiki status` above.
226
226
  "/api/graph": () => ["graph", "status"],
227
+ // v1.8.2 W4b — the gain meter. Two READS, both with exit codes that are DATA
228
+ // (0 rows · 1 no ledger or no rows · 3 off). `--measured` is its OWN route
229
+ // because it reads Claude Code's transcripts and takes longer; the panel
230
+ // asks for it on a button, never on load.
231
+ "/api/graph/gain": () => ["graph", "gain"],
232
+ "/api/graph/gain/measured": () => ["graph", "gain", "--measured"],
227
233
  "/api/wiki/impact": () => ["wiki", "impact"],
228
234
  // v0.46.0. Every one is a READ with an exit-code contract, so the exit code is
229
235
  // DATA here exactly like `pattern status` and `wiki impact` above: pact 0/1/2/3,
@@ -21,7 +21,7 @@
21
21
  // case here; it is never an edit to a 1 700-line module.
22
22
  const { PROJECT, doctor, where } = require("./shell.js");
23
23
  const { config } = require("./settings.js");
24
- const { wiki, wikiDocs, wikiShow, wikiCoverage, wikiCoverageFull, wikiUnregistered, wikiPlan, wikiDebt, wikiUsage, patterns, patternShow, gotchas, gotchasArchived, gotchaPrunePreview, wikiImpact, graph } = require("./knowledge.js");
24
+ const { wiki, wikiDocs, wikiShow, wikiCoverage, wikiCoverageFull, wikiUnregistered, wikiPlan, wikiDebt, wikiUsage, patterns, patternShow, gotchas, gotchasArchived, gotchaPrunePreview, wikiImpact, graph, graphGain, graphGainMeasured } = require("./knowledge.js");
25
25
  const { runs, runDetail, runDetailClosed, aftermath } = require("./runs.js");
26
26
  const { stats, budgetForecast, budgetRates } = require("./stats.js");
27
27
  const { pact } = require("./pact.js");
@@ -309,6 +309,11 @@ module.exports.get = function get(route, q) {
309
309
  // v1.8.0 — the code graph, DRIFTED (the state the card must be designed for).
310
310
  case "/api/graph":
311
311
  return graph;
312
+ // v1.8.2 W4b — the gain meter, and the A/B behind its second button.
313
+ case "/api/graph/gain":
314
+ return graphGain;
315
+ case "/api/graph/gain/measured":
316
+ return graphGainMeasured;
312
317
  case "/api/patterns":
313
318
  return patterns;
314
319
  case "/api/gotchas":
@@ -313,4 +313,44 @@ const graph = {
313
313
  trace: "GRAPH-CONSULT drifted :: files=1920 symbols=5896 gen=42",
314
314
  };
315
315
 
316
- module.exports = { wiki, wikiDocs, wikiShow, wikiCoverage, wikiCoverageFull, wikiUnregistered, wikiPlan, wikiDebt, wikiUsage, patterns, patternShow, gotchas, gotchasArchived, gotchaPrunePreview, wikiImpact, graph };
316
+ // v1.8.2 W4b — `orc graph gain --json`. The fixture carries the ESTIMATE word
317
+ // and a RANGE, because those are the two things the card must never lose.
318
+ const graphGain = {
319
+ ok: true,
320
+ state: "rows",
321
+ scope: "project",
322
+ run: null,
323
+ since: null,
324
+ calls_recorded: 41,
325
+ runs: 6,
326
+ generation_range: [38, 42],
327
+ paid: { card: 4120, source: 610, hints: 182, total: 4912 },
328
+ avoided: { low: 18900, high: 71400 },
329
+ calls: { low: 58, high: 113 },
330
+ net: { low: 13988, high: 66488 },
331
+ by_command: { ctx: 29, impact: 6, changes: 4, "for-slice": 2 },
332
+ hints: { injected: 11, read_notes: 3, updates: 9 },
333
+ estimate: true,
334
+ carry_note:
335
+ "a card is re-sent on every later turn of the agent that received it — and so is the read it replaced. Both halves carry the same multiplier, so these are FIRST-ENTRY tokens on both sides (eval/graph-replay.js).",
336
+ };
337
+
338
+ // The A/B, with enough runs in both groups to print a comparison.
339
+ const graphGainMeasured = {
340
+ ok: true,
341
+ state: "compared",
342
+ min_runs: 3,
343
+ corpus: { dir: "~/.claude/projects/-home-dev-shop", ok: true },
344
+ runs: { on: 6, off: 4 },
345
+ rows: { on: [], off: [] },
346
+ compare: {
347
+ exec_retrieval_calls: { on: { n: 6, median: 19, min: 12, max: 27 }, off: { n: 4, median: 31, min: 24, max: 39 }, delta_pct: -39, off_spread_pct: 48 },
348
+ exec_bash_searches: { on: { n: 6, median: 2, min: 0, max: 5 }, off: { n: 4, median: 3, min: 1, max: 6 }, delta_pct: -33, off_spread_pct: 167 },
349
+ exec_result_tokens: { on: { n: 6, median: 27900, min: 18200, max: 41800 }, off: { n: 4, median: 41200, min: 29100, max: 60300 }, delta_pct: -32, off_spread_pct: 76 },
350
+ session_result_tokens: { on: { n: 6, median: 188000, min: 141000, max: 244000 }, off: { n: 4, median: 187000, min: 132000, max: 251000 }, delta_pct: 1, off_spread_pct: 64 },
351
+ },
352
+ note:
353
+ "executor windows and session totals are kept apart: the main session is 74–80% of a run and the graph never touches it. Every delta is printed beside the OFF group's own spread — a delta smaller than that spread is noise, not a result.",
354
+ };
355
+
356
+ module.exports = { wiki, wikiDocs, wikiShow, wikiCoverage, wikiCoverageFull, wikiUnregistered, wikiPlan, wikiDebt, wikiUsage, patterns, patternShow, gotchas, gotchasArchived, gotchaPrunePreview, wikiImpact, graph, graphGain, graphGainMeasured };
@@ -1,104 +1,107 @@
1
- "use strict";
2
- /* fixtures/stats.js — canned data for `orc ui --fixtures`.
3
- Usage, the cost forecast and the dated rate table. The forecast is a RANGE
4
- with a sample count, and cache-read is its own segment.
5
-
6
- THE RULE FOR EVERY FILE IN HERE: carry ONE OF EVERY STATE, including the
7
- ugly ones. You cannot DESIGN a STALE chip on a fresh wiki, and a state
8
- with no fixture is a state nobody has ever looked at. A per-state count
9
- test asserts this, so a new state cannot ship without one.
10
-
11
- Shapes MUST match what `bin/cli.js --json` really emits — a drifted
12
- fixture is worse than no fixture. */
13
-
14
- const { PROJECT } = require("./shell.js");
15
-
16
- const stats = {
17
- log_dir: PROJECT + "/.claude/orc/logs",
18
- runs: 61,
19
- from: "2026-04-11",
20
- to: "2026-08-08",
21
- lanes: { orc: 22, quick: 17, mini: 9, wiki: 6, fast: 4, ultra: 2, grill: 1 },
22
- agents: { "orc-executor": 88, "orc-system-analyst": 21, "orc-planner": 21, "orc-reviewer": 18, "orc-verifier": 18, "orc-scout": 12, "orc-wiki-scanner": 9, "orc-trace-writer": 61 },
23
- dispatches: 248,
24
- downgrades: 3,
25
- unfinished: 2,
26
- unknown_lane: 1,
27
- };
28
-
29
- /* ============================================================ v0.46.0 ====== */
30
- /* Same rule as everything above: ONE OF EVERY STATE, including the ugly ones.
31
- You cannot design a BROKEN promise card on a ledger where everything holds,
32
- a REFUSE checklist on a repo with no refusals, or an empty-debt Knowledge
33
- panel on a wiki that owes four docs. test/webui.test.js asserts the count per
34
- state, so a new state cannot ship without a fixture. */
35
-
36
- const budgetForecast = {
37
- ok: true,
38
- plan: PROJECT + "/.claude/orc/run/store-credit/plan.md",
39
- tasks: 14,
40
- waves: 5,
41
- tokens: {
42
- p50: { input: 53400, cache_write: 362800, cache_read: 733800, output: 75100 },
43
- p90: { input: 81000, cache_write: 548000, cache_read: 1140000, output: 118000 },
44
- },
45
- raw: { p50: 1225100, p90: 1887000 },
46
- weighted: { p50: 564680, p90: 861000 },
47
- usd: { p50: 6.76, p90: 10.5 },
48
- price_table: { as_of: "2026-08-01", age_days: 9, stale: false, path: "bin/pricing.json" },
49
- quota: { available: true, plan: "max20", label: "Max 20x", window_pct: 18.2, weekly_pct: 4.1 },
50
- // A task at CONTEXT RISK — the state that cannot be designed on a small plan.
51
- context_risk: [{ task: "T12", agent: "orc-executor-opus-5-med", peak: 189000, window: 200000, pct: 95 }],
52
- bands: [
53
- { band: "[0,30)", agent: "orc-executor-haiku-4-5", count: 2, tasks: ["T01", "T02"], samples: 9, p50: { input: 1200, cache_write: 6400, cache_read: 11800, output: 900 }, p90: { input: 1800, cache_write: 9200, cache_read: 17000, output: 1400 } },
54
- { band: "[40,55)", agent: "orc-executor-sonnet-4-6-high", count: 3, tasks: ["T03", "T05", "T07"], samples: 12, p50: { input: 7800, cache_write: 52100, cache_read: 104000, output: 8400 }, p90: { input: 11000, cache_write: 75000, cache_read: 150000, output: 12000 } },
55
- { band: "[65,90)", agent: "orc-executor-opus-5-low", count: 1, tasks: ["T04"], samples: 6, p50: { input: 5700, cache_write: 40200, cache_read: 81000, output: 9300 }, p90: { input: 8100, cache_write: 58000, cache_read: 117000, output: 13400 } },
56
- // A band with insufficient history — the low-confidence warning is not
57
- // optional chrome, so the fixture has to be able to trigger it.
58
- { band: "[90,100]", agent: "orc-executor-opus-5-med", count: 1, tasks: ["T12"], samples: 2, p50: { input: 9100, cache_write: 61000, cache_read: 128000, output: 17000 }, p90: { input: 14000, cache_write: 94000, cache_read: 198000, output: 26000 } },
59
- ],
60
- fixed_roles: [
61
- { role: "orc-system-analyst-opus-5-high", samples: 11, p50: { input: 6100, cache_write: 41000, cache_read: 82000, output: 9000 }, p90: { input: 8600, cache_write: 58000, cache_read: 116000, output: 13000 } },
62
- { role: "orc-planner-opus-5-med", samples: 11, p50: { input: 5000, cache_write: 33000, cache_read: 68000, output: 7400 }, p90: { input: 7100, cache_write: 47000, cache_read: 96000, output: 10500 } },
63
- { role: "orc-trace-writer-haiku-4-5", samples: 41, p50: { input: 900, cache_write: 3000, cache_read: 5400, output: 700 }, p90: { input: 1300, cache_write: 4400, cache_read: 7800, output: 1000 } },
64
- ],
65
- low_confidence_bands: 1,
66
- min_samples: 5,
67
- // Non-zero on purpose: `unattributed` is shown whenever it is above 0, and a
68
- // fixture where it is always 0 makes that branch undesignable.
69
- unattributed: { blocks: 12, tokens: { input: 900, cache_write: 12000, cache_read: 24000, output: 1100 } },
70
- transcripts_readable: true,
71
- lanes: [
72
- { lane: "ultra", cmd: "/orc-ultra", raw: 2410000, weighted: 1090000, usd: 14.2, low_confidence_bands: 1, low_confidence_roles: 0 },
73
- { lane: "orc", cmd: "/orc", raw: 1225100, weighted: 564680, usd: 6.76, low_confidence_bands: 1, low_confidence_roles: 0 },
74
- { lane: "mini", cmd: "/orc-mini", raw: 410000, weighted: 188000, usd: 2.1, low_confidence_bands: 0, low_confidence_roles: 0 },
75
- { lane: "fast", cmd: "/orc-fast", raw: 0, weighted: 0, usd: null, low_confidence_bands: 1, low_confidence_roles: 1 },
76
- ],
77
- view: "auto",
78
- };
79
-
80
- const budgetRates = {
81
- ok: true,
82
- version: 1,
83
- calibrated_at: "10-08-2026 09:40:11",
84
- transcript_dir: "/home/you/.claude/projects/-example-project",
85
- transcripts_readable: true,
86
- transcript_files: 31,
87
- traces_read: 42,
88
- dispatches_joined: 96,
89
- price_table_as_of: "2026-08-01",
90
- bands: {
91
- "[0,30)": { samples: 9, p50: { input: 1200, cache_write: 6400, cache_read: 11800, output: 900 }, p90: { input: 1800, cache_write: 9200, cache_read: 17000, output: 1400 }, peak_p50: 24000, peak_p90: 38000 },
92
- "[40,55)": { samples: 12, p50: { input: 7800, cache_write: 52100, cache_read: 104000, output: 8400 }, p90: { input: 11000, cache_write: 75000, cache_read: 150000, output: 12000 }, peak_p50: 78000, peak_p90: 121000 },
93
- "[70,80)": { samples: 6, p50: { input: 5700, cache_write: 40200, cache_read: 81000, output: 9300 }, p90: { input: 8100, cache_write: 58000, cache_read: 117000, output: 13400 }, peak_p50: 96000, peak_p90: 142000 },
94
- "[90,100]": { samples: 2, p50: { input: 9100, cache_write: 61000, cache_read: 128000, output: 17000 }, p90: { input: 14000, cache_write: 94000, cache_read: 198000, output: 26000 }, peak_p50: 151000, peak_p90: 189000 },
95
- },
96
- roles: {
97
- "orc-system-analyst-opus-5-high": { samples: 11, p50: { input: 6100, cache_write: 41000, cache_read: 82000, output: 9000 }, p90: { input: 8600, cache_write: 58000, cache_read: 116000, output: 13000 }, peak_p50: 88000, peak_p90: 131000 },
98
- "orc-trace-writer-haiku-4-5": { samples: 41, p50: { input: 900, cache_write: 3000, cache_read: 5400, output: 700 }, p90: { input: 1300, cache_write: 4400, cache_read: 7800, output: 1000 }, peak_p50: 9000, peak_p90: 14000 },
99
- },
100
- lanes: {},
101
- unattributed: { blocks: 12, tokens: { input: 900, cache_write: 12000, cache_read: 24000, output: 1100 } },
102
- };
103
-
104
- module.exports = { stats, budgetForecast, budgetRates };
1
+ "use strict";
2
+ /* fixtures/stats.js — canned data for `orc ui --fixtures`.
3
+ Usage, the cost forecast and the dated rate table. The forecast is a RANGE
4
+ with a sample count, and cache-read is its own segment.
5
+
6
+ THE RULE FOR EVERY FILE IN HERE: carry ONE OF EVERY STATE, including the
7
+ ugly ones. You cannot DESIGN a STALE chip on a fresh wiki, and a state
8
+ with no fixture is a state nobody has ever looked at. A per-state count
9
+ test asserts this, so a new state cannot ship without one.
10
+
11
+ Shapes MUST match what `bin/cli.js --json` really emits — a drifted
12
+ fixture is worse than no fixture. */
13
+
14
+ const { PROJECT } = require("./shell.js");
15
+
16
+ const stats = {
17
+ log_dir: PROJECT + "/.claude/orc/logs",
18
+ runs: 61,
19
+ from: "2026-04-11",
20
+ to: "2026-08-08",
21
+ lanes: { orc: 22, quick: 17, mini: 9, wiki: 6, fast: 4, ultra: 2, grill: 1 },
22
+ agents: { "orc-executor": 88, "orc-system-analyst": 21, "orc-planner": 21, "orc-reviewer": 18, "orc-verifier": 18, "orc-scout": 12, "orc-wiki-scanner": 9, "orc-trace-writer": 61 },
23
+ dispatches: 248,
24
+ downgrades: 3,
25
+ unfinished: 2,
26
+ unknown_lane: 1,
27
+ // v1.8.2 W4b — the code-graph row. `paid` is exact; the avoided pair is an
28
+ // ESTIMATE and always a RANGE, which is why the panel never shows one number.
29
+ graph: { calls: 41, runs: 6, paid: 4912, avoided_low: 18900, avoided_high: 71400, estimate: true },
30
+ };
31
+
32
+ /* ============================================================ v0.46.0 ====== */
33
+ /* Same rule as everything above: ONE OF EVERY STATE, including the ugly ones.
34
+ You cannot design a BROKEN promise card on a ledger where everything holds,
35
+ a REFUSE checklist on a repo with no refusals, or an empty-debt Knowledge
36
+ panel on a wiki that owes four docs. test/webui.test.js asserts the count per
37
+ state, so a new state cannot ship without a fixture. */
38
+
39
+ const budgetForecast = {
40
+ ok: true,
41
+ plan: PROJECT + "/.claude/orc/run/store-credit/plan.md",
42
+ tasks: 14,
43
+ waves: 5,
44
+ tokens: {
45
+ p50: { input: 53400, cache_write: 362800, cache_read: 733800, output: 75100 },
46
+ p90: { input: 81000, cache_write: 548000, cache_read: 1140000, output: 118000 },
47
+ },
48
+ raw: { p50: 1225100, p90: 1887000 },
49
+ weighted: { p50: 564680, p90: 861000 },
50
+ usd: { p50: 6.76, p90: 10.5 },
51
+ price_table: { as_of: "2026-08-01", age_days: 9, stale: false, path: "bin/pricing.json" },
52
+ quota: { available: true, plan: "max20", label: "Max 20x", window_pct: 18.2, weekly_pct: 4.1 },
53
+ // A task at CONTEXT RISK — the state that cannot be designed on a small plan.
54
+ context_risk: [{ task: "T12", agent: "orc-executor-opus-5-med", peak: 189000, window: 200000, pct: 95 }],
55
+ bands: [
56
+ { band: "[0,30)", agent: "orc-executor-haiku-4-5", count: 2, tasks: ["T01", "T02"], samples: 9, p50: { input: 1200, cache_write: 6400, cache_read: 11800, output: 900 }, p90: { input: 1800, cache_write: 9200, cache_read: 17000, output: 1400 } },
57
+ { band: "[40,55)", agent: "orc-executor-sonnet-4-6-high", count: 3, tasks: ["T03", "T05", "T07"], samples: 12, p50: { input: 7800, cache_write: 52100, cache_read: 104000, output: 8400 }, p90: { input: 11000, cache_write: 75000, cache_read: 150000, output: 12000 } },
58
+ { band: "[65,90)", agent: "orc-executor-opus-5-low", count: 1, tasks: ["T04"], samples: 6, p50: { input: 5700, cache_write: 40200, cache_read: 81000, output: 9300 }, p90: { input: 8100, cache_write: 58000, cache_read: 117000, output: 13400 } },
59
+ // A band with insufficient history — the low-confidence warning is not
60
+ // optional chrome, so the fixture has to be able to trigger it.
61
+ { band: "[90,100]", agent: "orc-executor-opus-5-med", count: 1, tasks: ["T12"], samples: 2, p50: { input: 9100, cache_write: 61000, cache_read: 128000, output: 17000 }, p90: { input: 14000, cache_write: 94000, cache_read: 198000, output: 26000 } },
62
+ ],
63
+ fixed_roles: [
64
+ { role: "orc-system-analyst-opus-5-high", samples: 11, p50: { input: 6100, cache_write: 41000, cache_read: 82000, output: 9000 }, p90: { input: 8600, cache_write: 58000, cache_read: 116000, output: 13000 } },
65
+ { role: "orc-planner-opus-5-med", samples: 11, p50: { input: 5000, cache_write: 33000, cache_read: 68000, output: 7400 }, p90: { input: 7100, cache_write: 47000, cache_read: 96000, output: 10500 } },
66
+ { role: "orc-trace-writer-haiku-4-5", samples: 41, p50: { input: 900, cache_write: 3000, cache_read: 5400, output: 700 }, p90: { input: 1300, cache_write: 4400, cache_read: 7800, output: 1000 } },
67
+ ],
68
+ low_confidence_bands: 1,
69
+ min_samples: 5,
70
+ // Non-zero on purpose: `unattributed` is shown whenever it is above 0, and a
71
+ // fixture where it is always 0 makes that branch undesignable.
72
+ unattributed: { blocks: 12, tokens: { input: 900, cache_write: 12000, cache_read: 24000, output: 1100 } },
73
+ transcripts_readable: true,
74
+ lanes: [
75
+ { lane: "ultra", cmd: "/orc-ultra", raw: 2410000, weighted: 1090000, usd: 14.2, low_confidence_bands: 1, low_confidence_roles: 0 },
76
+ { lane: "orc", cmd: "/orc", raw: 1225100, weighted: 564680, usd: 6.76, low_confidence_bands: 1, low_confidence_roles: 0 },
77
+ { lane: "mini", cmd: "/orc-mini", raw: 410000, weighted: 188000, usd: 2.1, low_confidence_bands: 0, low_confidence_roles: 0 },
78
+ { lane: "fast", cmd: "/orc-fast", raw: 0, weighted: 0, usd: null, low_confidence_bands: 1, low_confidence_roles: 1 },
79
+ ],
80
+ view: "auto",
81
+ };
82
+
83
+ const budgetRates = {
84
+ ok: true,
85
+ version: 1,
86
+ calibrated_at: "10-08-2026 09:40:11",
87
+ transcript_dir: "/home/you/.claude/projects/-example-project",
88
+ transcripts_readable: true,
89
+ transcript_files: 31,
90
+ traces_read: 42,
91
+ dispatches_joined: 96,
92
+ price_table_as_of: "2026-08-01",
93
+ bands: {
94
+ "[0,30)": { samples: 9, p50: { input: 1200, cache_write: 6400, cache_read: 11800, output: 900 }, p90: { input: 1800, cache_write: 9200, cache_read: 17000, output: 1400 }, peak_p50: 24000, peak_p90: 38000 },
95
+ "[40,55)": { samples: 12, p50: { input: 7800, cache_write: 52100, cache_read: 104000, output: 8400 }, p90: { input: 11000, cache_write: 75000, cache_read: 150000, output: 12000 }, peak_p50: 78000, peak_p90: 121000 },
96
+ "[70,80)": { samples: 6, p50: { input: 5700, cache_write: 40200, cache_read: 81000, output: 9300 }, p90: { input: 8100, cache_write: 58000, cache_read: 117000, output: 13400 }, peak_p50: 96000, peak_p90: 142000 },
97
+ "[90,100]": { samples: 2, p50: { input: 9100, cache_write: 61000, cache_read: 128000, output: 17000 }, p90: { input: 14000, cache_write: 94000, cache_read: 198000, output: 26000 }, peak_p50: 151000, peak_p90: 189000 },
98
+ },
99
+ roles: {
100
+ "orc-system-analyst-opus-5-high": { samples: 11, p50: { input: 6100, cache_write: 41000, cache_read: 82000, output: 9000 }, p90: { input: 8600, cache_write: 58000, cache_read: 116000, output: 13000 }, peak_p50: 88000, peak_p90: 131000 },
101
+ "orc-trace-writer-haiku-4-5": { samples: 41, p50: { input: 900, cache_write: 3000, cache_read: 5400, output: 700 }, p90: { input: 1300, cache_write: 4400, cache_read: 7800, output: 1000 }, peak_p50: 9000, peak_p90: 14000 },
102
+ },
103
+ lanes: {},
104
+ unattributed: { blocks: 12, tokens: { input: 900, cache_write: 12000, cache_read: 24000, output: 1100 } },
105
+ };
106
+
107
+ module.exports = { stats, budgetForecast, budgetRates };
@@ -163,5 +163,20 @@
163
163
  "knowledge.wiki.unregistered": "The wiki is {state} — nothing can read it until it is registered.",
164
164
  "knowledge.wiki.why": "why: {reason}",
165
165
  "knowledge.graph.generation": "Generation",
166
- "knowledge.graph.selfheal": "It keeps itself current: a read repairs the files it is about to answer for, and the installed hook updates the map when a worker finishes. Nothing runs on a timer."
166
+ "knowledge.graph.selfheal": "It keeps itself current: a read repairs the files it is about to answer for, and the installed hook updates the map when a worker finishes. Nothing runs on a timer.",
167
+ "knowledge.gain.none": "No graph reads recorded yet. The first `orc graph ctx` starts the ledger.",
168
+ "knowledge.gain.strip": "paid {paid} · avoided ~{low}–{high} (estimate) · {calls} calls",
169
+ "knowledge.gain.paid": "Tokens put in (cards · source · hints)",
170
+ "knowledge.gain.avoided": "Retrieval probably kept out (estimate)",
171
+ "knowledge.gain.net": "Net tokens · net tool calls",
172
+ "knowledge.gain.byCommand": "By command",
173
+ "knowledge.gain.hints": "Hints (injected · read notes · updates)",
174
+ "knowledge.gain.measure": "Compare my ON and OFF runs",
175
+ "knowledge.gain.estimate": "`avoided` is an estimate of the retrieval a read ladder would have paid for, never a bill. `paid` is exact.",
176
+ "knowledge.gain.measuredHead": "{on} runs with the graph on vs {off} with it off",
177
+ "knowledge.gain.measuredFew": "Too few runs to compare. Three runs in each group are needed; the rows are recorded and the comparison waits.",
178
+ "knowledge.gain.execCalls": "worker retrieval",
179
+ "knowledge.gain.execTokens": "worker tool results",
180
+ "knowledge.gain.sessionTokens": "session tool results",
181
+ "knowledge.gain.noise": "a change smaller than the spread beside it is noise, not a result"
167
182
  }
@@ -163,5 +163,20 @@
163
163
  "knowledge.wiki.unregistered": "Wiki berstatus {state} — tidak ada yang bisa membacanya sampai terdaftar.",
164
164
  "knowledge.wiki.why": "sebab: {reason}",
165
165
  "knowledge.graph.generation": "Generasi",
166
- "knowledge.graph.selfheal": "Peta ini memperbarui dirinya: satu pembacaan memperbaiki berkas yang akan dijawabnya, dan hook yang terpasang memperbarui peta saat satu pekerja selesai. Tidak ada yang berjalan dengan pewaktu."
166
+ "knowledge.graph.selfheal": "Peta ini memperbarui dirinya: satu pembacaan memperbaiki berkas yang akan dijawabnya, dan hook yang terpasang memperbarui peta saat satu pekerja selesai. Tidak ada yang berjalan dengan pewaktu.",
167
+ "knowledge.gain.none": "Belum ada pembacaan grafik yang tercatat. `orc graph ctx` pertama memulai catatannya.",
168
+ "knowledge.gain.strip": "dibayar {paid} · dihindari ~{low}–{high} (perkiraan) · {calls} panggilan",
169
+ "knowledge.gain.paid": "Token yang dimasukkan (kartu · sumber · petunjuk)",
170
+ "knowledge.gain.avoided": "Pembacaan yang mungkin dihindari (perkiraan)",
171
+ "knowledge.gain.net": "Token bersih · panggilan alat bersih",
172
+ "knowledge.gain.byCommand": "Menurut perintah",
173
+ "knowledge.gain.hints": "Petunjuk (dikirim · catatan baca · pembaruan)",
174
+ "knowledge.gain.measure": "Bandingkan proses ON dan OFF saya",
175
+ "knowledge.gain.estimate": "`dihindari` adalah perkiraan pembacaan yang akan dibayar tangga baca, bukan tagihan. `dibayar` adalah angka pasti.",
176
+ "knowledge.gain.measuredHead": "{on} proses dengan grafik hidup vs {off} dengan grafik mati",
177
+ "knowledge.gain.measuredFew": "Terlalu sedikit proses untuk dibandingkan. Perlu tiga proses di tiap kelompok; barisnya tercatat dan perbandingannya menunggu.",
178
+ "knowledge.gain.execCalls": "pembacaan pekerja",
179
+ "knowledge.gain.execTokens": "hasil alat pekerja",
180
+ "knowledge.gain.sessionTokens": "hasil alat sesi",
181
+ "knowledge.gain.noise": "perubahan yang lebih kecil dari sebarannya adalah derau, bukan hasil"
167
182
  }