@giamme/forge 0.22.0 → 0.23.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 (153) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +19 -12
  3. package/SKILL.md +137 -216
  4. package/VERSION +1 -1
  5. package/docs/README.md +2 -3
  6. package/docs/add-ons.md +5 -3
  7. package/docs/artifacts.md +17 -2
  8. package/docs/commands.md +85 -63
  9. package/docs/decomposed-runs.md +195 -21
  10. package/docs/development.md +11 -9
  11. package/docs/forge-ui.md +33 -4
  12. package/docs/install.md +37 -5
  13. package/docs/memory.md +6 -1
  14. package/docs/models.md +36 -10
  15. package/docs/reviews.md +44 -25
  16. package/docs/safety.md +27 -2
  17. package/docs/troubleshooting.md +7 -10
  18. package/forge +25 -4
  19. package/package.json +2 -1
  20. package/references/dataset.md +10 -9
  21. package/references/decompose-integration.md +337 -0
  22. package/references/decompose-opt-in.md +527 -0
  23. package/references/decompose-recovery.md +569 -0
  24. package/references/decompose-review.md +256 -0
  25. package/references/decompose.md +99 -1606
  26. package/references/findings.md +68 -0
  27. package/references/harnesses.md +7 -12
  28. package/references/memory.md +13 -2
  29. package/references/planning.md +48 -18
  30. package/references/ripwire.md +38 -13
  31. package/references/runtime.md +22 -33
  32. package/references/setup.md +90 -0
  33. package/references/solo.md +13 -42
  34. package/references/ui.md +12 -5
  35. package/registry.tsv +40 -22
  36. package/scripts/forge-artifact.sh +143 -12
  37. package/scripts/forge-compare.py +5 -15
  38. package/scripts/forge-config.py +14 -1
  39. package/scripts/forge-contract.py +216 -53
  40. package/scripts/forge-control.py +777 -54
  41. package/scripts/forge-dispatch.sh +95 -12
  42. package/scripts/forge-du.py +13 -3
  43. package/scripts/forge-handoff.py +221 -39
  44. package/scripts/forge-install-ripwire.sh +100 -24
  45. package/scripts/forge-install.sh +18 -32
  46. package/scripts/forge-issues.py +6 -4
  47. package/scripts/forge-jev-options.sh +3 -5
  48. package/scripts/forge-lib-adopt.sh +169 -5
  49. package/scripts/forge-lib-attribute.sh +10 -3
  50. package/scripts/forge-lib-decompose.sh +454 -0
  51. package/scripts/forge-lib-env.sh +21 -0
  52. package/scripts/forge-lib-group.sh +4 -1
  53. package/scripts/forge-lib-plans.sh +30 -18
  54. package/scripts/forge-lib-review.sh +28 -8
  55. package/scripts/forge-lib-task.sh +225 -56
  56. package/scripts/forge-lib-verify.sh +59 -10
  57. package/scripts/forge-memory.sh +81 -4
  58. package/scripts/forge-metrics.sh +4 -2
  59. package/scripts/forge-parallel-options.sh +23 -4
  60. package/scripts/forge-parallel.sh +447 -175
  61. package/scripts/forge-plan-check.py +71 -8
  62. package/scripts/forge-planner.py +303 -17
  63. package/scripts/forge-pr.py +9 -1
  64. package/scripts/forge-prompt.py +2 -2
  65. package/scripts/forge-review-links.py +248 -0
  66. package/scripts/forge-ripwire.py +234 -16
  67. package/scripts/forge-route.py +19 -27
  68. package/scripts/forge-runs-rm.py +92 -21
  69. package/scripts/forge-runs.py +46 -5
  70. package/scripts/forge-runtime.py +37 -12
  71. package/scripts/forge-schedule.py +124 -33
  72. package/scripts/forge-setup-stale.py +236 -0
  73. package/scripts/forge-setup.py +804 -0
  74. package/scripts/forge-shadow.py +2 -20
  75. package/scripts/forge-solo-lock.py +46 -0
  76. package/scripts/forge-solo.sh +33 -56
  77. package/scripts/forge-sweep.py +2 -1
  78. package/scripts/forge-ui.py +8 -1
  79. package/scripts/forge-update.sh +2 -2
  80. package/scripts/forge-verify.py +16 -1
  81. package/scripts/forge-version.py +13 -1
  82. package/scripts/forge-watch.py +7 -2
  83. package/scripts/forge_dataset/__init__.py +1 -1
  84. package/scripts/forge_dataset/capture.py +0 -34
  85. package/scripts/forge_dataset/checks.py +0 -1
  86. package/scripts/forge_dataset/cli.py +5 -1
  87. package/scripts/forge_dataset/export.py +28 -6
  88. package/scripts/forge_dataset/facts.py +1 -2
  89. package/scripts/forge_dataset/forecast.py +1 -1
  90. package/scripts/forge_dataset/harvest.py +107 -7
  91. package/scripts/forge_dataset/importer.py +3 -2
  92. package/scripts/forge_dataset/pairs.py +3 -3
  93. package/scripts/forge_dataset/reviewers.py +4 -3
  94. package/scripts/forge_dataset/routing.py +6 -3
  95. package/scripts/forge_dataset/tiers.py +1 -1
  96. package/scripts/forge_decide/__init__.py +1 -1
  97. package/scripts/forge_decide/profiles.py +11 -14
  98. package/scripts/forge_decompose.py +987 -0
  99. package/scripts/forge_groups/review.py +6 -1
  100. package/scripts/forge_jev/__init__.py +1 -1
  101. package/scripts/forge_jev/cli.py +10 -1
  102. package/scripts/forge_jev/gates.py +10 -1
  103. package/scripts/forge_jev/verify.py +10 -2
  104. package/scripts/forge_legacy.py +86 -0
  105. package/scripts/forge_memory_home.py +57 -0
  106. package/scripts/forge_models.py +151 -0
  107. package/scripts/forge_prefs.py +138 -0
  108. package/scripts/forge_side/__init__.py +10 -0
  109. package/scripts/forge_storage.py +28 -15
  110. package/ui/README.md +22 -10
  111. package/ui/docs/api.md +121 -99
  112. package/ui/forge_ui/control.py +46 -14
  113. package/ui/forge_ui/export.py +0 -10
  114. package/ui/forge_ui/models.py +15 -2
  115. package/ui/forge_ui/projects.py +4 -1
  116. package/ui/forge_ui/reader.py +456 -59
  117. package/ui/forge_ui/server.py +0 -10
  118. package/ui/forge_ui/static/app.js +28 -9
  119. package/ui/forge_ui/static/checksview.js +12 -3
  120. package/ui/forge_ui/static/controls.js +147 -11
  121. package/ui/forge_ui/static/convo.js +5 -2
  122. package/ui/forge_ui/static/diffview.js +4 -5
  123. package/ui/forge_ui/static/panel.js +180 -77
  124. package/ui/forge_ui/static/projectsview.js +16 -2
  125. package/ui/forge_ui/static/runmodel.js +18 -4
  126. package/ui/forge_ui/static/scene3d.js +29 -29
  127. package/ui/forge_ui/static/settings.js +1 -1
  128. package/ui/forge_ui/static/storageview.js +2 -2
  129. package/ui/forge_ui/static/style.css +23 -6
  130. package/ui/forge_ui/static/worktreesview.js +8 -4
  131. package/ui/forge_ui/transcripts.py +6 -0
  132. package/ui/forge_ui/worktrees.py +13 -1
  133. package/docs/fractal.md +0 -181
  134. package/references/fractal-dashboard.md +0 -21
  135. package/references/fractal.md +0 -307
  136. package/scripts/forge-fractal-dispatch.sh +0 -4
  137. package/scripts/forge-fractal-options.sh +0 -54
  138. package/scripts/forge-fractal.py +0 -6
  139. package/scripts/forge-install-fractal.sh +0 -4
  140. package/scripts/forge_fractal/__init__.py +0 -88
  141. package/scripts/forge_fractal/bridge.py +0 -46
  142. package/scripts/forge_fractal/cli.py +0 -224
  143. package/scripts/forge_fractal/dashboard.css +0 -138
  144. package/scripts/forge_fractal/dashboard.html +0 -41
  145. package/scripts/forge_fractal/dashboard.js +0 -687
  146. package/scripts/forge_fractal/decomposition.py +0 -262
  147. package/scripts/forge_fractal/execution.py +0 -659
  148. package/scripts/forge_fractal/inspection.py +0 -261
  149. package/scripts/forge_fractal/install.py +0 -158
  150. package/scripts/forge_fractal/invocation.py +0 -95
  151. package/scripts/forge_fractal/pipeline.py +0 -125
  152. package/scripts/forge_fractal/selection.py +0 -180
  153. package/ui/forge_ui/fractal.py +0 -582
@@ -85,6 +85,7 @@ window.ForgePanel = (() => {
85
85
  // the write controls of a plan run (task undefined) or of one of its tasks; a page without controls.js says it is read-only
86
86
  function controlsSection(host, ctx, task) {
87
87
  if (ctx.run.kind === 'solo') return;
88
+ if (ctx.run.removed) { muted(section(host, 'Controls'), `Read-only: this run was made with ${ctx.run.removed.name}, which forge ${ctx.run.removed.since} removed.`); return; }
88
89
  if (window.ForgeControls && window.ForgeUI && window.ForgeUI.confirmInline) { window.ForgeControls[task ? 'mountTask' : 'mountRun'](host, ctx, task); return; }
89
90
  const s = section(host, 'Controls');
90
91
  muted(s, 'Read-only: this page cannot change the run.');
@@ -255,13 +256,14 @@ window.ForgePanel = (() => {
255
256
  wrap.append(table);
256
257
  parent.append(wrap);
257
258
  }
258
- // What a reviewer said about its own tests (FORGE_TESTS). A review that could not run them stands out: its verdict
259
- // rests on reading alone. A reply that says nothing shows nothing.
260
- const TESTS_WORDS = { ran: 'Reviewer ran tests', not_needed: 'Reviewer needed no tests', could_not_run: 'Reviewer could not run tests', unclear: 'Reviewer\'s word on its tests is unclear' };
259
+ // What a reviewer said about its own tests (FORGE_TESTS). Reviews that could not run them or only finished partly stand out:
260
+ // their verdict rests on reading or partial checks alone. A reply that says nothing shows nothing.
261
+ const TESTS_WORDS = { ran: 'Reviewer ran tests', partial: 'Reviewer stopped or skipped some tests', not_needed: 'Reviewer needed no tests', could_not_run: 'Reviewer could not run tests', unclear: 'Reviewer\'s word on its tests is unclear' };
261
262
  function testsLine(parent, tests) {
262
263
  if (!tests || !TESTS_WORDS[tests.status]) return;
263
264
  const text = TESTS_WORDS[tests.status] + (tests.reason ? `: ${tests.reason}` : '');
264
- parent.append(el('p', text, tests.status === 'could_not_run' ? 'warn tests-line' : 'muted tests-line'));
265
+ const warn = tests.status === 'could_not_run' || tests.status === 'partial';
266
+ parent.append(el('p', text, warn ? 'warn tests-line' : 'muted tests-line'));
265
267
  }
266
268
  // An attempt's chip. A failed attempt is red whatever its words; a send-back says what forge did in its title.
267
269
  function attemptChip(word) {
@@ -437,6 +439,25 @@ window.ForgePanel = (() => {
437
439
  muted(s, line);
438
440
  if (run.retro.text != null) details(s, 'Report', run.retro.text, 'run-retro');
439
441
  }
442
+ // the Handoff section (forge handoff): which session drives the run, then the notes sessions left, newest first.
443
+ // Notes are plain text, like the retro report.
444
+ function handoffSection(host, run) {
445
+ const h = run.handoff;
446
+ if (!h || typeof h !== 'object') return;
447
+ const s = section(host, 'Handoff');
448
+ muted(s, 'Driver: ' + (RM.handoffDriverLine(h.driver) || 'none recorded'));
449
+ const notes = list(h.notes);
450
+ if (!notes.length) return;
451
+ const ul = el('ul', undefined, 'handoff-notes');
452
+ for (const n of notes) {
453
+ const li = el('li');
454
+ li.append(el('span', time(n.at) + (n.actor ? ' · ' + n.actor : ''), 'muted'), el('div', n.text));
455
+ ul.append(li);
456
+ }
457
+ s.append(ul);
458
+ const total = num(h.notes_total);
459
+ if (total !== null && total > notes.length) muted(s, `${total - notes.length} older notes in handoff.notes.jsonl`);
460
+ }
440
461
  // the run's record: what it was asked, how it was set up, and what verification printed (the header names and counts it)
441
462
  function runRecord(host, ctx) {
442
463
  const run = ctx.run, solo = run.kind === 'solo';
@@ -450,6 +471,7 @@ window.ForgePanel = (() => {
450
471
  ['Command', run.verification && run.verification.command, true]]);
451
472
  details(host, 'Request', display(run.request), 'run-request');
452
473
  retroSection(host, run);
474
+ handoffSection(host, run);
453
475
  if (!solo) details(host, 'Waves', list(run.waves).map((ids, i) => `${i + 1}: ${list(ids).join(', ')}`).join('\n') || '—', 'waves');
454
476
  if (run.verification && run.verification.log_tail != null) details(host, 'Verification output', run.verification.log_tail, 'verification-output');
455
477
  }
@@ -457,6 +479,29 @@ window.ForgePanel = (() => {
457
479
  // other ids on the page (mono). The hash is the other run's page, the same shape app.js uses.
458
480
  function chainRows(run) {
459
481
  const rows = [];
482
+ // A sub-plan (the subtasks of a split task): the task it belongs to, in the plan above.
483
+ const up = run.parent;
484
+ if (up && typeof up === 'object' && up.key && up.task) {
485
+ rows.push(['Subtasks of', link(`${up.task}${up.run_id ? ' · ' + up.run_id : ''}`, '#/runs/' + encodeURIComponent(up.key) + '/tasks/' + encodeURIComponent(up.task)), true]);
486
+ }
487
+ // The limits a split works within, and how much of the run was split (run.decomposition, when the plan records any).
488
+ const tree = run.decomposition, lim = tree && tree.limits;
489
+ if (lim && typeof lim === 'object') {
490
+ const off = lim.depth === 0 || lim.nodes === 0;
491
+ const text = off ? 'splitting is off for this run' : `depth ${lim.depth} · up to ${lim.children} subtasks per split · ${lim.nodes} subtasks in the run`;
492
+ const used = tree.split ? ` · ${tree.subtasks} subtask${tree.subtasks === 1 ? '' : 's'} in ${tree.split} split task${tree.split === 1 ? '' : 's'}` : '';
493
+ const value = el('span', text + (lim.frozen ? ' (frozen)' : '') + used);
494
+ value.title = 'The limits every split of a task works within: levels of subtasks, subtasks one split may make, and subtasks in the whole run. '
495
+ + (lim.frozen ? 'They were frozen when the plan first ran.' : 'They can still change with plan --split-depth, --split-children and --split-nodes; the first run freezes them.');
496
+ rows.push(['Decomposition', value, true]);
497
+ }
498
+ // A goal larger than one plan: the stage this plan is, and the stages its planner proposed after it.
499
+ const later = run.later;
500
+ if (later && typeof later === 'object') {
501
+ const names = list(later.stages).map(st => st && st.title).filter(Boolean);
502
+ if (num(later.stage) !== null) rows.push(['Stage', `${later.stage} of a larger goal`]);
503
+ if (names.length) rows.push(['Later stages', names.join(' · ')]);
504
+ }
460
505
  const prev = run.after;
461
506
  if (prev && typeof prev === 'object') {
462
507
  const label = prev.run_id || prev.key;
@@ -476,6 +521,8 @@ window.ForgePanel = (() => {
476
521
  function runView(host, ctx) {
477
522
  const run = ctx.run, now = ctx.now;
478
523
  const tr = RM.timeRange(run, now);
524
+ // An old run of a backend forge no longer has: it reads as any run, and nothing here can run it again.
525
+ if (run.removed) host.append(el('p', `This run was ${run.removed.note}. Start a new run for the work that is left.`, 'warn'));
479
526
  const s = section(host, 'Timeline');
480
527
  fields(s, [['Started', time(tr && tr.start)], ['Last activity', time(tr && tr.end)], ['Wall time', tr ? RM.fmtDur(tr.end - tr.start) : '—'],
481
528
  ['Concurrency limit', run.settings && run.settings.max_parallel != null ? run.settings.max_parallel : (run.kind === 'solo' ? '—' : '3 (default; not recorded)')]]);
@@ -684,6 +731,14 @@ window.ForgePanel = (() => {
684
731
  for (const item of items) {
685
732
  const li = el('li', undefined, 'trail-line');
686
733
  li.append(el('span', trailLine(item), 'trail-summary'));
734
+ const steered = list(item && item.steered);
735
+ if (steered.length) { // a person's message went into this attempt (#134)
736
+ const tag = el('span', 'steered', 'tag steered');
737
+ const live = steered.filter(m => m.mode === 'live').length;
738
+ tag.title = `${steered.length} message${steered.length === 1 ? '' : 's'} from ${[...new Set(steered.map(m => m.actor || '?'))].join(', ')} `
739
+ + `(forge control steer${live ? `, ${live} sent live while it ran` : ''}); left out of routing and calibration statistics`;
740
+ li.append(tag);
741
+ }
687
742
  const nav = executionLinks(ctx, task, item && item.executions);
688
743
  if (nav.childElementCount) li.append(nav);
689
744
  ol.append(li);
@@ -710,12 +765,13 @@ window.ForgePanel = (() => {
710
765
  }
711
766
  return seg;
712
767
  }
713
- // Asks, sends and answers one change to a summaries switch (`forge control set summaries`). `slot` takes the question
768
+ // Asks, sends and answers one change to a summaries switch (`forge control set summaries`, or `change.key`
769
+ // summaries-model). `slot` takes the question
714
770
  // and the answer. `held` is the section that holds a task's switch (null for the run's): it is kept as it is while the
715
771
  // question is open or the answer pends, the way controls.js keeps its own sections.
716
772
  function changeSummaries(slot, held, runKey, change, done) {
717
773
  const C = window.ForgeControls, U = window.ForgeUI, node = held || slot;
718
- const plan = C.prepare({ kind: 'set', key: 'summaries', input: change.input, task: change.task });
774
+ const plan = C.prepare({ kind: 'set', key: change.key || 'summaries', input: change.input, task: change.task });
719
775
  if (!plan.ok) { U.outcome(slot, { ok: false, status: 400, error: 'invalid', detail: plan.error }); return; }
720
776
  if (node.dataset.busy) return;
721
777
  node.dataset.editing = '1';
@@ -803,6 +859,74 @@ window.ForgePanel = (() => {
803
859
  writable.then(on => { if (!on) { row.remove(); if (!sum) s.remove(); } });
804
860
  }
805
861
 
862
+ // Messages for the task's next attempt (#134: `forge control steer`): the ones waiting, and where the page can write,
863
+ // a box that queues one. It starts nothing: the next implementer attempt, whatever starts it, gets them. While the
864
+ // task's implementer runs live (#252, claude and openclaude), Send now gives it the message at its next tool call.
865
+ function steerSection(host, ctx, task) {
866
+ const run = ctx.run, U = window.ForgeUI;
867
+ if (run.kind === 'solo' || task.status === 'MERGED') return;
868
+ const waiting = list(task.steer_waiting), sending = list(task.steer_sending), live = num(task.steer_live);
869
+ const s = section(host, live !== null ? 'Message for the implementer' : 'Message for the next attempt');
870
+ s.classList.add('steer-section');
871
+ s.dataset.hold = `steer:${run.key}:${task.id}`;
872
+ if (waiting.length) {
873
+ const ul = el('ul', undefined, 'steer-waiting');
874
+ for (const m of waiting) {
875
+ const li = el('li');
876
+ li.append(el('p', String(m.text || ''), 'steer-text'), el('p', `queued by ${m.actor || '?'}${num(m.at) !== null ? ', ' + ago(m.at, ctx.now) : ''}`, 'muted'));
877
+ ul.append(li);
878
+ }
879
+ s.append(ul);
880
+ }
881
+ muted(s, waiting.length ? 'Waiting: the task\'s next implementer attempt gets them, beside any review findings.'
882
+ : 'Nothing waiting. A message starts nothing: the task\'s next implementer attempt gets it (a retry, a resume, or the run\'s own next attempt). Steered attempts are marked and left out of routing and calibration statistics.');
883
+ if (sending.length) {
884
+ const ul = el('ul', undefined, 'steer-waiting steer-sending');
885
+ for (const m of sending) {
886
+ const li = el('li');
887
+ li.append(el('p', String(m.text || ''), 'steer-text'), el('p', `sending to the running implementer (from ${m.actor || '?'})`, 'muted'));
888
+ ul.append(li);
889
+ }
890
+ s.append(ul);
891
+ }
892
+ if (live !== null) muted(s, `The implementer of attempt ${live} is running live: Send now gives it a message at its next tool call, without stopping it. Queue message keeps it for the next attempt.`);
893
+ if (!U || !U.controlsEnabled) return;
894
+ const box = el('div', undefined, 'steer-box');
895
+ const field = el('textarea'); field.rows = 3; field.maxLength = 8000; field.autocomplete = 'off';
896
+ field.setAttribute('aria-label', 'Message for the next attempt');
897
+ const send = el('button', 'Queue message'); send.type = 'button';
898
+ const now = live !== null ? el('button', 'Send now') : null;
899
+ if (now) { now.type = 'button'; now.className = 'primary'; now.title = `Give it to the running implementer (attempt ${live}) at its next tool call`; }
900
+ const msgs = el('div', undefined, 'steer-msgs');
901
+ const mark = () => { s.dataset.editing = '1'; };
902
+ field.addEventListener('focus', mark);
903
+ field.addEventListener('input', mark);
904
+ field.addEventListener('blur', () => { if (!s.dataset.busy && !String(field.value || '').trim()) delete s.dataset.editing; });
905
+ const post = async (sendNow) => {
906
+ if (s.dataset.busy) return;
907
+ const text = String(field.value || '').trim();
908
+ if (!text) { U.outcome(msgs, { ok: false, status: 400, error: 'invalid', detail: 'the message is empty' }); return; }
909
+ s.dataset.busy = '1'; send.disabled = true; if (now) now.disabled = true;
910
+ const path = '/api/runs/' + encodeURIComponent(run.key) + '/tasks/' + encodeURIComponent(task.id) + '/steer';
911
+ let res;
912
+ try { res = await U.post(path, sendNow ? { text, now: true } : { text }); } catch (_) { res = { ok: false, error: 'failed', detail: 'could not send' }; }
913
+ delete s.dataset.busy; send.disabled = false; if (now) now.disabled = false;
914
+ if (!s.isConnected) return;
915
+ if (res && res.ok) {
916
+ field.value = ''; delete s.dataset.editing;
917
+ const n = res.data && num(res.data.waiting);
918
+ U.outcome(msgs, res, sendNow ? 'Sent: the running implementer gets it at its next tool call'
919
+ : `Queued for the next attempt${n ? ` (${n} waiting)` : ''}`);
920
+ if (ctx.refresh) ctx.refresh();
921
+ } else U.outcome(msgs, res);
922
+ };
923
+ send.addEventListener('click', () => post(false));
924
+ if (now) now.addEventListener('click', () => post(true));
925
+ box.append(field, ...(now ? [now] : []), send, msgs);
926
+ s.append(box);
927
+ U.controlsEnabled().then(on => { if (!on && box.isConnected) box.remove(); if (!on && !waiting.length && s.isConnected) s.remove(); });
928
+ }
929
+
806
930
  function taskView(host, ctx, task) {
807
931
  const run = ctx.run, now = ctx.now, solo = run.kind === 'solo';
808
932
  const detail = lazy(ctx, `/api/runs/${encodeURIComponent(run.key)}/tasks/${encodeURIComponent(task.id)}`, run.updated);
@@ -837,6 +961,7 @@ window.ForgePanel = (() => {
837
961
  if (!solo) fields(host, [['Difficulty', task.difficulty], ['Depends on', depLinks(task.deps, ctx)], ['Files', list(task.files).join('\n') || '—', true], ['Branch', task.branch, true]]);
838
962
  if (C) C.nowSection(host, ctx, task);
839
963
  sweepSection(host, ctx, task);
964
+ steerSection(host, ctx, task);
840
965
 
841
966
  // the models: who owned it, how it was routed, what it was escalated to
842
967
  const ms = section(host, 'Models');
@@ -902,7 +1027,7 @@ window.ForgePanel = (() => {
902
1027
  as.append(box);
903
1028
  }
904
1029
 
905
- if (run.fractal && run.fractal.enabled) fractalSection(host, ctx, task);
1030
+ decompositionSection(host, ctx, task);
906
1031
 
907
1032
  // reviews and their findings
908
1033
  const rs = section(host, 'Review findings');
@@ -988,79 +1113,58 @@ window.ForgePanel = (() => {
988
1113
  if (list(d.warnings).length) details(ps, `Reader warnings (${d.warnings.length})`, d.warnings.join('\n'), `exec-${sel.exec}-warn`);
989
1114
  }
990
1115
 
991
- /* ---------- Fractal: the child tasks a task was split into ---------- */
992
- const money = v => num(v) === null ? '—' : '$' + (v < 1 ? v.toFixed(3) : v.toFixed(2));
993
- const fractalPath = (run, task) => `/api/runs/${encodeURIComponent(run.key)}/tasks/${encodeURIComponent(task)}/fractal`;
994
- function fractalSection(host, ctx, task) {
995
- const run = ctx.run, fs = section(host, 'Fractal tree');
996
- if (!run.fractal.available) { muted(fs, `Fractal ran this run, but its state cannot be read: ${run.fractal.reason || 'unavailable'}.`); return; }
997
- const entry = lazy(ctx, fractalPath(run, task.id), run.updated);
998
- if (loading(fs, entry, 'the Fractal tree')) return;
999
- const F = entry.data;
1000
- if (ctx.onFractal) ctx.onFractal(task.id, F.available ? F : null);
1001
- if (!F.available) { muted(fs, F.reason || 'No Fractal state for this task.'); return; }
1002
- const st = F.state || {}, out = F.outcome || {};
1116
+ /* ---------- decomposition: the decision on a task, and the subtasks a split task has ---------- */
1117
+ // What a node spent, in tokens (input + output): forge records tokens, never a price.
1118
+ const spent = t => t && typeof t === 'object' ? (num(t.input) || 0) + (num(t.output) || 0) : null;
1119
+ const tok = v => v === null ? null : (v >= 1e6 ? (v / 1e6).toFixed(1) + 'M' : v >= 1e3 ? (v / 1e3).toFixed(1) + 'k' : String(v)) + ' tokens';
1120
+ const DECISIONS = { atomic: 'kept whole', split: 'split', bounded: 'kept whole at a limit' };
1121
+ // What each word means, shown when the pointer rests on it.
1122
+ const DECISION_HELP = {
1123
+ atomic: 'Done as one piece. Keeping a task whole is always a valid decision.',
1124
+ split: 'Split into subtasks. They run as a plan of their own, merge into this task, and the task is then reviewed on all of their work.',
1125
+ bounded: 'A split here would pass a limit of the run (levels, subtasks per split, or subtasks in the whole run), so it runs as one piece.',
1126
+ };
1127
+ const BY_HELP = {
1128
+ planner: 'The planner decided this when it planned.',
1129
+ user: 'A person decided this (retry --decide split).',
1130
+ auto: 'The run decided this: it was started with --auto-split, so the planner split a task that stopped on split.',
1131
+ default: 'Nobody decided: a task is one piece unless someone splits it.',
1132
+ };
1133
+ // task.decomposition: {decision, reason, by, at, sub: {key, run_id, path} | null, merged, waiting, start, kept,
1134
+ // nodes: [{id, parent, run, run_id, task, level, title, status, difficulty, model, qa, decision, reason, by, attempts,
1135
+ // tokens, has_diff}]}, the nodes in tree order through every level below the task. Absent on a plan with no record.
1136
+ function decompositionSection(host, ctx, task) {
1137
+ const D = task.decomposition, nodes = D ? list(D.nodes) : [];
1138
+ if (ctx.onSubtasks) ctx.onSubtasks(task.id, nodes.length ? nodes : null);
1139
+ if (!D || (!D.decision && !nodes.length)) return;
1140
+ // A task nobody decided about is one piece, as every task was before: nothing to say.
1141
+ if (D.decision === 'atomic' && D.by === 'default' && !nodes.length) return;
1142
+ const ds = section(host, 'Decomposition');
1003
1143
  const chips = el('div', undefined, 'chips');
1004
- if (st.status) chips.append(chip(st.status === 'active' ? 'RUNNING' : st.status, st.status === 'active' ? 'running' : undefined));
1005
- if (out.acceptance || st.acceptance) chips.append(chip('acceptance ' + (out.acceptance || st.acceptance), String(out.acceptance || '').toLowerCase() === 'pass' ? 'pass' : 'none'));
1006
- if (out.verification) chips.append(chip('verification ' + out.verification, out.verification === 'passed' ? 'pass' : 'none'));
1007
- fs.append(chips);
1008
- const nodes = list(F.nodes), cost = nodes.reduce((a, n) => a + (num(n.cost) || 0), 0);
1009
- muted(fs, `${nodes.length} node${nodes.length === 1 ? '' : 's'} · ${RM.fmtDur(st.elapsed)} · ${money(cost)} so far · click a node for its goal, decision and output`);
1010
- const T = RM.fractalTree(nodes), ul = el('ul', undefined, 'fractal-tree');
1144
+ if (D.decision) { const c = el('span', DECISIONS[D.decision] || D.decision, 'tag'); c.title = DECISION_HELP[D.decision] || ''; chips.append(c); }
1145
+ if (D.by) { const c = el('span', 'decided by ' + D.by, 'plate src-plate'); c.title = BY_HELP[D.by] || ''; chips.append(c); }
1146
+ ds.append(chips);
1147
+ if (D.reason) ds.append(el('p', D.reason));
1148
+ if (!nodes.length) return;
1149
+ const total = nodes.reduce((a, n) => a + (spent(n.tokens) || 0), 0), merged = nodes.filter(n => n.status === 'MERGED').length;
1150
+ muted(ds, [`${nodes.length} subtask${nodes.length === 1 ? '' : 's'}`, `${merged} merged`, total ? tok(total) : null,
1151
+ D.merged ? "their work is on this task's branch, and the task is reviewed on all of it" : 'the task is reviewed on all of their work once every one has merged',
1152
+ D.start === 'fresh' ? 'started over from the task\'s base' + (D.kept ? ` (earlier work kept at ${String(D.kept).slice(0, 12)})` : '') : null].filter(Boolean).join(' · '));
1153
+ if (list(D.waiting).length) ds.append(el('p', 'Waiting for: ' + list(D.waiting).join(', '), 'muted'));
1154
+ if (D.sub && D.sub.key) { const open = el('p', undefined, 'muted'); open.append(link('Open the subtasks as a plan of their own →', '#/runs/' + encodeURIComponent(D.sub.key))); ds.append(open); }
1155
+ const T = RM.nodeTree(nodes), ul = el('ul', undefined, 'node-tree');
1011
1156
  for (const n of nodes) {
1012
- const li = el('li', undefined, 'ft-node ft-d' + Math.min(6, (T.pos[n.id] || {}).depth || 0) + (n.reserved ? ' reserved' : ''));
1013
- li.append(el('i', undefined, 'led st-' + String(n.ui_status || 'unknown').toLowerCase()));
1014
- const target = { kind: 'fractal', task: task.id, node: n.id };
1015
- li.append(link(n.id, ctx.hash(target), () => ctx.onSelect(target)));
1016
- const bits = [n.reserved ? 'reserved' : n.status, n.difficulty, n.phase ? `${n.phase}${n.iteration ? ' #' + n.iteration : ''}` : null, num(n.cost) !== null ? money(n.cost) : null].filter(Boolean);
1157
+ const li = el('li', undefined, 'ft-node ft-d' + Math.min(6, (T.pos[n.id] || {}).depth || 0));
1158
+ li.append(el('i', undefined, 'led st-' + String(n.status || 'unknown').toLowerCase()));
1159
+ const a = el('a', n.task || n.id); a.href = ctx.nodeHash ? ctx.nodeHash(n) : '#'; li.append(a);
1017
1160
  if (n.model) li.append(plate(n.model));
1018
- li.append(el('span', bits.join(' · '), 'muted'));
1019
- const dec = n.decomposition;
1020
- if (dec && dec.decision) li.append(el('span', dec.decision === 'split' ? `split into ${list(dec.children).length}` : dec.decision, 'tag'));
1021
- if (n.has_diff) { const a = diffLink(ctx, 'diff', { kind: 'fractal', task: task.id, node: n.id }, 'diff-link small'); if (a) li.append(a); }
1022
- if (n.goal) li.title = n.goal;
1161
+ li.append(el('span', [n.status, n.difficulty, num(n.attempts) > 1 ? `${n.attempts} attempts` : null, tok(spent(n.tokens))].filter(Boolean).join(' · '), 'muted'));
1162
+ if (n.decision && n.decision !== 'atomic') { const c = el('span', DECISIONS[n.decision] || n.decision, 'tag'); c.title = DECISION_HELP[n.decision] || ''; li.append(c); }
1163
+ if (n.has_diff && ctx.nodeHash) { const d = el('a', 'diff', 'diff-link small'); d.href = ctx.nodeHash(n) + '/diff'; li.append(d); }
1164
+ li.title = [n.title, n.reason].filter(Boolean).join('\n');
1023
1165
  ul.append(li);
1024
1166
  }
1025
- fs.append(ul);
1026
- if (list(F.events).length) details(fs, `Recent events (${F.events.length})`, F.events.map(e => `${time(e.at)} ${e.kind}${e.node ? ' · ' + e.node : ''}${e.decision ? ' · ' + e.decision : ''}${e.status ? ' · ' + e.status : ''}${e.reason ? ' — ' + e.reason : ''}`).join('\n'), `fractal-${task.id}-events`);
1027
- if (list(F.warnings).length) details(fs, `Reader warnings (${F.warnings.length})`, F.warnings.join('\n'), `fractal-${task.id}-warn`);
1028
- }
1029
- function fractalNodeView(host, ctx, sel) {
1030
- const run = ctx.run, path = `${fractalPath(run, sel.task)}/nodes/${encodeURIComponent(sel.node)}`;
1031
- const entry = lazy(ctx, path, run.updated), n = entry.data;
1032
- const head = el('div', undefined, 'insp-head');
1033
- head.append(el('h2', sel.node), el('div', `Fractal node · task ${sel.task}`, 'insp-kind'));
1034
- const back = { kind: 'task', id: sel.task };
1035
- if (n) { const chips = el('div', undefined, 'chips'); chips.append(chip(n.reserved ? 'reserved' : n.ui_status || n.status, n.reserved ? 'none' : undefined)); if (n.decomposition && n.decomposition.decision) chips.append(el('span', n.decomposition.decision, 'tag')); head.append(chips); }
1036
- head.append(link('← task ' + sel.task, ctx.hash(back), () => ctx.onSelect(back)));
1037
- if (n && n.has_diff) { const a = diffLink(ctx, 'Its candidate diff →', { kind: 'fractal', task: sel.task, node: sel.node }); if (a) head.append(a); }
1038
- host.append(head);
1039
- if (loading(host, entry, 'this node')) return;
1040
- if (n.goal) host.append(el('p', n.goal));
1041
- fields(host, [['Parent', n.parent ? link(n.parent, ctx.hash({ kind: 'fractal', task: sel.task, node: n.parent }), () => ctx.onSelect({ kind: 'fractal', task: sel.task, node: n.parent })) : '—'],
1042
- ['Difficulty', n.difficulty], ['Model', n.model ? plate(n.model) : '—'], ['Resolved', n.resolved_model ? plate(n.resolved_model) : '—'], ['Paths', list(n.paths).join('\n') || '—', true], ['Depends on', list(n.deps).join(', ') || '—', true],
1043
- ['Phase', n.phase ? `${n.phase}${n.iteration ? ' · iteration ' + n.iteration : ''}` : '—'], ['Started', time(n.started_at)], ['Ended', time(n.ended_at)],
1044
- ['Cost', `${money(n.cost)}${n.unknown_cost_steps ? ` (+${n.unknown_cost_steps} steps of unknown cost)` : ''}`], ['Tokens', n.tokens ? `${display(n.tokens.input_tokens)} in (${display(n.tokens.cached_input_tokens)} cached) · ${display(n.tokens.output_tokens)} out` : '—']]);
1045
- if (n.error) host.append(el('p', n.error, 'warn'));
1046
- const dec = n.decomposition;
1047
- if (dec) {
1048
- const ds = section(host, 'Decomposition');
1049
- fields(ds, [['Decision', dec.decision], ['Phase', dec.phase], ['Attempts', dec.attempts]]);
1050
- if (dec.reason) ds.append(el('p', dec.reason));
1051
- const adm = list(dec.admission);
1052
- if (adm.length) {
1053
- const ul = el('ul', undefined, 'plain');
1054
- for (const a of adm) { const li = el('li'); li.append(link(a.name, ctx.hash({ kind: 'fractal', task: sel.task, node: a.name }), () => ctx.onSelect({ kind: 'fractal', task: sel.task, node: a.name })), document.createTextNode(` · ${a.difficulty || '—'} · `), plate(a.model), document.createTextNode(` — ${a.goal || ''}`)); ul.append(li); }
1055
- ds.append(el('p', 'Children it admitted:', 'muted'), ul);
1056
- }
1057
- if (dec.error) ds.append(el('p', dec.error, 'warn'));
1058
- }
1059
- if (list(n.decomposition_history).length > 1) details(host, `Decomposition history (${n.decomposition_history.length})`, n.decomposition_history.map(h => `${h.phase || '—'} · ${h.decision || '—'}${h.reason ? ' — ' + h.reason : ''}`).join('\n'), `fnode-${sel.task}-${sel.node}-hist`);
1060
- const ps = section(host, 'Output');
1061
- if (n.last != null) details(ps, 'Last message', n.last, `fnode-${sel.task}-${sel.node}-last`);
1062
- if (n.planning_last != null) details(ps, 'Planner\'s last message', n.planning_last, `fnode-${sel.task}-${sel.node}-plan`);
1063
- if (n.last == null && n.planning_last == null) muted(ps, 'No output yet.');
1167
+ ds.append(ul);
1064
1168
  }
1065
1169
 
1066
1170
  // Commits made outside forge that `adopt` brought in, each reviewed alone: a person's work, so no task row claims them.
@@ -1240,9 +1344,8 @@ window.ForgePanel = (() => {
1240
1344
  if (sel.kind === 'adoption') return adoptionView(host, ctx, sel);
1241
1345
  if (sel.kind === 'verification') return verificationView(host, ctx);
1242
1346
  if (sel.kind === 'integration') return integrationView(host, ctx);
1243
- if (sel.kind === 'fractal') return fractalNodeView(host, ctx, sel);
1244
1347
  return runView(host, ctx);
1245
1348
  }
1246
- return { render, cache, trailLine, reasonText, linkModel, headerActions, summaryBank, changeSummaries, answerOutcome };
1349
+ return { render, cache, trailLine, reasonText, linkModel, headerActions, summaryBank, changeSummaries, answerOutcome, decompositionSection };
1247
1350
  })();
1248
1351
  if (typeof module === 'object' && module.exports) module.exports = window.ForgePanel;
@@ -916,9 +916,17 @@
916
916
  line.append(el('span', r.text == null ? '' : String(r.text)));
917
917
  if (learningManual(r)) { line.append(document.createTextNode(' '), el('span', 'added by a person', 'chip prj-manual')); }
918
918
  box.append(line);
919
- if (!s.writes) { const commands = rowCommands(r); if (commands) box.append(commands); }
920
919
  return box;
921
920
  }
921
+ // Read-only: a row's copyable commands open below the filters on request, one row at a time, rather than
922
+ // two command lines in every Learning cell (#175).
923
+ function openCommands(r) {
924
+ const commands = rowCommands(r);
925
+ if (!commands) return;
926
+ const close = el('button', 'Close'); close.type = 'button'; close.setAttribute('aria-label', 'Close commands');
927
+ close.addEventListener('click', () => editHost.replaceChildren());
928
+ editHost.replaceChildren(el('p', 'Commands for ' + (learningKey(r) || String(r.text || ''))), commands, close);
929
+ }
922
930
  const empty = memoryEmpty(d);
923
931
  if (empty) {
924
932
  parts.push(el('p', empty, 'muted prj-empty'));
@@ -968,7 +976,7 @@
968
976
  });
969
977
  lbar.append(lab, forget);
970
978
  all.append(lbar, buildAddForm(), editHost, faction, lcount, lhost);
971
- } else all.append(lbar, faction, lcount, lhost);
979
+ } else all.append(lbar, editHost, faction, lcount, lhost);
972
980
  parts.push(all);
973
981
  body.replaceChildren(...parts);
974
982
  async function forgetSelected() {
@@ -1042,6 +1050,12 @@
1042
1050
  b.disabled = s.forgetting || !key; b.setAttribute('aria-label', 'Edit ' + (key || 'learning'));
1043
1051
  b.addEventListener('click', () => openEdit(r)); editButtons.push(b); return b;
1044
1052
  } });
1053
+ if (!s.writes) columns.push({ id: 'commands', label: '', title: 'Commands', sortable: false, hideable: false, cell: r => {
1054
+ if (!rowCommands(r)) return '';
1055
+ const name = learningKey(r) || String(r.text || ''), b = el('button', 'Commands'); b.type = 'button';
1056
+ b.setAttribute('aria-label', 'Commands for ' + name);
1057
+ b.addEventListener('click', () => openCommands(r)); return b;
1058
+ } });
1045
1059
  table(lhost, 'project-learnings', 'Learnings', columns, shown);
1046
1060
  syncForget();
1047
1061
  }
@@ -937,9 +937,23 @@
937
937
  return `${word(n('notes'), 'note', 'notes')}: ${fixable.join(', ')} · ${n('verified')} verified, ${n('claimed')} claimed · ${n('blocking')} blocking`;
938
938
  }
939
939
 
940
- /* ---------- Fractal: a task's child tasks as a tidy tree (depth across, siblings down) ---------- */
941
- // nodes: TaskFractal.nodes (tree order, parent ids); returns {pos: {id: {col, row, depth}}, edges: [[parent, child]], cols, rows}
942
- function fractalTree(nodes) {
940
+ /* ---------- the handoff (forge handoff: handoff.driver.json, handoff.notes.jsonl) ---------- */
941
+ // RunDetail.handoff.driver → one line, e.g. "claude-code · session 1da3e1ef… · since 2h05m · seen 4m10s ago".
942
+ // A stale driver (last seen over 12 hours ago) says another session may claim the run. Null when no driver.
943
+ function handoffDriverLine(driver, nowSec) {
944
+ if (!driver || typeof driver !== 'object' || typeof driver.harness !== 'string' || !driver.harness) return null;
945
+ const now = num(nowSec) === null ? Date.now() / 1000 : nowSec, since = num(driver.since), seen = num(driver.last_seen);
946
+ const parts = [driver.harness];
947
+ if (typeof driver.session === 'string' && driver.session) parts.push('session ' + (driver.session.length > 12 ? driver.session.slice(0, 8) + '…' : driver.session));
948
+ if (since !== null) parts.push('since ' + fmtDur(now - since));
949
+ if (seen !== null) parts.push('seen ' + fmtDur(now - seen) + ' ago');
950
+ const line = parts.join(' · ');
951
+ return driver.stale ? line + ' (stale: another session can claim the run)' : line;
952
+ }
953
+
954
+ /* ---------- decomposition: a split task's subtasks as a tidy tree (depth across, siblings down) ---------- */
955
+ // nodes: a task's decomposition.nodes (tree order, parent ids); returns {pos: {id: {col, row, depth}}, edges: [[parent, child]], cols, rows}
956
+ function nodeTree(nodes) {
943
957
  const ns = list(nodes).filter(n => n && n.id), ids = new Set(ns.map(n => n.id)), kids = new Map();
944
958
  const roots = [];
945
959
  for (const n of ns) {
@@ -965,5 +979,5 @@
965
979
  finalStatus, runReviewStatus, reviewSinceLine, reviewAt, taskStatus, statusText, statusLabel, causeLabel, resetText, taskVerdict, attemptStatus, attemptNote, attemptFailed, isWaiting,
966
980
  attributionLine, taskParts,
967
981
  taskTimes, metricValue, overlap, projectSchedule, execModel, verifyLeds, criticalPath, concurrency, stateAt, timeRange, events, lineage, structureKey, innerKey,
968
- fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents, fractalTree, sweepLine, sweepState, retroSummary };
982
+ fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents, nodeTree, sweepLine, sweepState, retroSummary, handoffDriverLine };
969
983
  });
@@ -418,46 +418,46 @@ export async function createStage(host, cb = {}) {
418
418
  }
419
419
  el.innerFlows.push(f);
420
420
  }
421
- syncFractal(el);
421
+ syncSubtasks(el);
422
422
  applyLayers();
423
423
  }
424
- /* ---------- Fractal: an opened task's child tasks, a small tree floating over it ---------- */
425
- const FRACTAL = new Map(); // task id → TaskFractal
426
- const FR_H = { low: 12, medium: 18, high: 26 };
427
- function syncFractal(el) {
424
+ /* ---------- decomposition: an opened split task's subtasks, a small tree floating over it ---------- */
425
+ const SUBTASKS = new Map(); // task id → its decomposition nodes
426
+ const SUB_H = { low: 12, medium: 18, high: 26 };
427
+ function syncSubtasks(el) {
428
428
  if (!el || !el.inner || el.kind !== 'task') return;
429
- const tid = el.data.task.id, data = FRACTAL.get(tid), nodes = data && data.available ? list(data.nodes) : [];
430
- const sig = JSON.stringify([E.theme, nodes.map(n => [n.id, n.parent, n.ui_status, n.difficulty, n.model, n.reserved ? 1 : 0])]);
431
- if (sig === el.fractalSig) return;
432
- el.fractalSig = sig;
433
- if (el.fractalG) { PICK = PICK.filter(o => !(o.userData.fractal && o.userData.fractal.task === tid)); E.disposeGroup(el.fractalG); el.fractalG = null; }
429
+ const tid = el.data.task.id, nodes = list(SUBTASKS.get(tid));
430
+ const sig = JSON.stringify([E.theme, nodes.map(n => [n.id, n.parent, n.status, n.difficulty, n.model, n.decision])]);
431
+ if (sig === el.subSig) return;
432
+ el.subSig = sig;
433
+ if (el.subG) { PICK = PICK.filter(o => !(o.userData.subtask && o.userData.subtask.task === tid)); E.disposeGroup(el.subG); el.subG = null; }
434
434
  if (!nodes.length) return;
435
- const T = RM.fractalTree(nodes), byId = new Map(nodes.map(n => [n.id, n])), { x, y, w, d, h } = el.n;
435
+ const T = RM.nodeTree(nodes), byId = new Map(nodes.map(n => [n.id, n])), { x, y, w, d, h } = el.n;
436
436
  const S = 34, DX = 62, DY = 44, tw = S + (T.cols - 1) * DX, td = S + Math.max(0, T.rows - 1) * DY;
437
437
  const x0 = x + w / 2 - tw / 2, y0 = y + d / 2 - td / 2, z0 = h + 70;
438
- const G = el.fractalG = new THREE.Group(); el.inner.add(G);
439
- const at = id => { const p = T.pos[id], n = byId.get(id); return { x: x0 + p.col * DX, y: y0 + p.row * DY, w: S, d: S, h: FR_H[String(n.difficulty || '').toLowerCase()] || 16 }; };
438
+ const G = el.subG = new THREE.Group(); el.inner.add(G);
439
+ const at = id => { const p = T.pos[id], n = byId.get(id); return { x: x0 + p.col * DX, y: y0 + p.row * DY, w: S, d: S, h: SUB_H[String(n.difficulty || '').toLowerCase()] || 16 }; };
440
440
  const cable = E.lmat({ polygonOffsetFactor: -3, polygonOffsetUnits: -8 }); cable.color.copy(E.majorMat.color).lerp(E.accent, .45);
441
441
  for (const [pa, ch] of T.edges) { const A = at(pa), B = at(ch), [P, Q] = E.ends(A, B, z0 + A.h / 2, z0 + B.h / 2); E.polyLine(E.curve(P, Q, 3, .1), cable, G); }
442
442
  // a stem from the task's floor to each root
443
443
  const stem = E.lmat({ dashed: true, dashSize: 4 * TS, gapSize: 3 * TS }); stem.color.copy(cable.color);
444
444
  for (const n of nodes) if (T.pos[n.id] && T.pos[n.id].depth === 0) { const A = at(n.id); E.polyLine([[x + w / 2, y + d / 2, 1], [A.x + S / 2, A.y + S / 2, z0]], stem, G).computeLineDistances(); }
445
445
  for (const n of nodes) {
446
- const b = at(n.id), M = E.mats(), col = E.statusColor(n.ui_status || 'unknown');
447
- const m = E.solid(b.x, b.y, z0, b.w, b.d, b.h, 6, M, G, { fractal: { task: tid, node: n.id } });
448
- E.paint(M, n.reserved ? .6 : 1, .6, 0, n.reserved ? .55 : 1, n.reserved ? .45 : 1, col, .3);
446
+ const b = at(n.id), M = E.mats(), col = E.statusColor(n.status || 'unknown');
447
+ const m = E.solid(b.x, b.y, z0, b.w, b.d, b.h, 6, M, G, { subtask: { task: tid, node: n.id, run: n.run, id: n.task } });
448
+ E.paint(M, 1, .6, 0, 1, 1, col, .3);
449
449
  PICK.push(m);
450
450
  const lab = E.tplane(S - 4, 13, E.pxIn(w, d), (cx, sc, C) => {
451
- E.font(cx, 4.6, sc, 600); cx.fillStyle = C.inkHi; cx.fillText(E.ellipsis(n.id, 12), 1 * sc, 5.4 * sc);
452
- E.font(cx, 3.6, sc); cx.fillStyle = C.ink; cx.fillText(E.ellipsis(n.reserved ? 'reserved' : n.model || n.status || '', 14), 1 * sc, 11 * sc);
451
+ E.font(cx, 4.6, sc, 600); cx.fillStyle = C.inkHi; cx.fillText(E.ellipsis(n.task || n.id, 12), 1 * sc, 5.4 * sc);
452
+ E.font(cx, 3.6, sc); cx.fillStyle = C.ink; cx.fillText(E.ellipsis(n.model || n.status || '', 14), 1 * sc, 11 * sc);
453
453
  }, G, M);
454
454
  E.roofAt(lab, b.x + 2, b.y + 2, z0 + b.h);
455
455
  }
456
456
  }
457
- E.themeHooks.add(() => { for (const el of EL.values()) if (el.fractalG) { el.fractalSig = ''; syncFractal(el); } });
457
+ E.themeHooks.add(() => { for (const el of EL.values()) if (el.subG) { el.subSig = ''; syncSubtasks(el); } });
458
458
  function closeInner(el) {
459
459
  if (!el.inner) return;
460
- if (el.kind === 'task') { const tid = el.data.task.id; PICK = PICK.filter(o => !(o.userData.fractal && o.userData.fractal.task === tid)); el.fractalG = null; el.fractalSig = ''; }
460
+ if (el.kind === 'task') { const tid = el.data.task.id; PICK = PICK.filter(o => !(o.userData.subtask && o.userData.subtask.task === tid)); el.subG = null; el.subSig = ''; }
461
461
  for (const k of el.kids || []) { EL.delete(k.id); PICK = PICK.filter(o => o.userData.el !== k.id); }
462
462
  PICK = PICK.filter(o => !(o.userData.floor && o.userData.el === el.id));
463
463
  E.disposeGroup(el.inner); el.inner = null; el.kids = []; el.innerFlows = [];
@@ -745,12 +745,12 @@ export async function createStage(host, cb = {}) {
745
745
  function selIds() {
746
746
  const s = st.sel, out = new Set(); if (!s) return out;
747
747
  if (st.view === 'atlas') { if (s.kind === 'run') out.add('r:' + s.key); return out; }
748
- const tid = s.kind === 'task' ? s.id : s.kind === 'execution' || s.kind === 'fractal' ? s.task : null;
748
+ const tid = s.kind === 'task' ? s.id : s.kind === 'execution' ? s.task : null;
749
749
  if (tid) {
750
750
  out.add('t:' + tid);
751
751
  if (s.kind === 'execution') for (const el of EL.values()) if (el.kind === 'part' && el.data.task === tid && el.data.part.exec && el.data.part.exec.id === s.exec) out.add(el.id);
752
752
  }
753
- if (s.kind === 'task' || s.kind === 'execution' || s.kind === 'fractal') {
753
+ if (s.kind === 'task' || s.kind === 'execution') {
754
754
  for (const el of EL.values()) {
755
755
  const it = el.data && el.data.item; if (!it) continue;
756
756
  if (s.kind !== 'execution' ? it.task === tid : it.id === s.exec || list(it.segs).some(g => g.id === s.exec)) out.add(el.id);
@@ -769,7 +769,7 @@ export async function createStage(host, cb = {}) {
769
769
  return new THREE.Color().copy(E.statusColor('pending')).lerp(E.accent, Math.sqrt(v / mx));
770
770
  }
771
771
  function retarget() {
772
- const sel = selIds(), tsel = st.sel && (st.sel.kind === 'task' ? st.sel.id : st.sel.kind === 'execution' || st.sel.kind === 'fractal' ? st.sel.task : null), open = tsel && st.mode === 'plan' && st.view === 'run' ? 't:' + tsel : null;
772
+ const sel = selIds(), tsel = st.sel && (st.sel.kind === 'task' ? st.sel.id : st.sel.kind === 'execution' ? st.sel.task : null), open = tsel && st.mode === 'plan' && st.view === 'run' ? 't:' + tsel : null;
773
773
  const crit = st.overlay.critical && st.crit ? new Set(st.crit.ids.map(id => 't:' + id)) : new Set();
774
774
  // the route: what the chosen task waits on and what waits on it, lit like a route set on a signal box desk
775
775
  const route = new Set();
@@ -1153,7 +1153,7 @@ export async function createStage(host, cb = {}) {
1153
1153
  const b = st.view === 'run' ? BEACONS.pick(cx, cy) : null;
1154
1154
  if (b) { cb.onFinding && cb.onFinding(b.data); return; }
1155
1155
  const o = E.pick(cx, cy, PICK, pickable), el = elOf(o);
1156
- if (o && o.userData.fractal) { cb.onSelect && cb.onSelect({ kind: 'fractal', task: o.userData.fractal.task, node: o.userData.fractal.node }); return; }
1156
+ if (o && o.userData.subtask) { cb.onOpenNode && cb.onOpenNode({ run: o.userData.subtask.run, task: o.userData.subtask.id }); return; }
1157
1157
  if (st.view === 'atlas') {
1158
1158
  if (el && el.kind === 'run') {
1159
1159
  st.sel = { kind: 'run', key: el.data.run.key }; retarget();
@@ -1235,7 +1235,7 @@ export async function createStage(host, cb = {}) {
1235
1235
  const span = Math.max(Math.max(...xs) - Math.min(...xs), Math.max(...ys) - Math.min(...ys));
1236
1236
  const pad = Math.max(st.mode === 'exec' ? 80 : 40, span * .3);
1237
1237
  const opening = st.mode === 'plan' && ids.some(el => el.kind === 'task');
1238
- const tree = opening && ids.some(el => FRACTAL.has(el.data && el.data.task && el.data.task.id)) ? hs + 130 : 0; // a Fractal tree floats above
1238
+ const tree = opening && ids.some(el => SUBTASKS.has(el.data && el.data.task && el.data.task.id)) ? hs + 130 : 0; // a subtask tree floats above
1239
1239
  E.frameBox([Math.min(...xs) - pad, Math.min(...ys) - pad, 0, Math.max(...xs) + pad, Math.max(...ys) + pad, Math.max(tree, hs * (opening ? 2 : 1.4))], dur, opening ? 52 : 40, dir);
1240
1240
  }
1241
1241
 
@@ -1437,10 +1437,10 @@ export async function createStage(host, cb = {}) {
1437
1437
  return c;
1438
1438
  },
1439
1439
  get cloud() { return cloud; },
1440
- // a task's Fractal tree (TaskFractal, or null), drawn over the task while it is open
1441
- setFractal(taskId, data) {
1442
- if (data) FRACTAL.set(taskId, data); else FRACTAL.delete(taskId);
1443
- const el = EL.get('t:' + taskId); if (el && el.inner) { syncFractal(el); E.invalidate(300); }
1440
+ // a split task's subtasks (its decomposition nodes, or null), drawn over the task while it is open
1441
+ setSubtasks(taskId, nodes) {
1442
+ if (nodes && nodes.length) SUBTASKS.set(taskId, nodes); else SUBTASKS.delete(taskId);
1443
+ const el = EL.get('t:' + taskId); if (el && el.inner) { syncSubtasks(el); E.invalidate(300); }
1444
1444
  },
1445
1445
  focus() { E.canvas.focus({ preventScroll: true }); },
1446
1446
  // frame again what is shown, in the part of the stage the modules leave free (after a module opens, folds or resizes)
@@ -98,7 +98,7 @@
98
98
  // The same order as forge_decide.profiles. A tier or key the body carries and this list does not still shows, after these.
99
99
  const TIERS = ['any', 'low', 'medium', 'high'];
100
100
  const POOLS = ['dwarf', 'qa'];
101
- const ROUTING_ORDER = ['planner', 'fractal_planner', 'final_reviewer', 'escalate_after', 'escalate_effort'];
101
+ const ROUTING_ORDER = ['planner', 'final_reviewer', 'escalate_after', 'escalate_effort'];
102
102
  const POLICY_ORDER = ['qa_threshold', 'retry_failed', 'infra_retries', 'verify_retries', 'timeout', 'explore', 'shadow_rate', 'shadow_qa', 'fast'];
103
103
  const BUDGET_PAIRS = [['run', 'run_tokens', 'run_usd'], ['daily', 'daily_tokens', 'daily_usd']];
104
104
  const PROFILE_LEVELS = ['user', 'repo', 'builtin'];
@@ -85,7 +85,7 @@
85
85
  function breakdown(data) {
86
86
  const t = (data && data.totals) || {}, runs = list(data && data.runs);
87
87
  const sum = f => runs.reduce((n, r) => n + (Number(f(r)) || 0), 0);
88
- const bytes = { snapshots: sum(r => r.snapshots), logs: sum(r => (r.logs || 0) + (r.gz || 0)), other: sum(r => (r.other || 0) + (r.fractal || 0)),
88
+ const bytes = { snapshots: sum(r => r.snapshots), logs: sum(r => (r.logs || 0) + (r.gz || 0)), other: sum(r => r.other || 0),
89
89
  strays: sum(r => r.strays), worktrees: t.worktrees || 0, home: (data && data.data_home && data.data_home.bytes) || 0 };
90
90
  const total = Object.values(bytes).reduce((a, b) => a + b, 0);
91
91
  return PARTS.map(p => ({ ...p, bytes: bytes[p.key], share: total ? bytes[p.key] / total : 0 }));
@@ -102,7 +102,7 @@
102
102
  const add = (g, key, n) => { n = Number(n) || 0; g.parts[key] += n; g.total += n; };
103
103
  for (const r of list(data && data.runs)) {
104
104
  const g = at(r.repo);
105
- add(g, 'snapshots', r.snapshots); add(g, 'logs', (r.logs || 0) + (r.gz || 0)); add(g, 'other', (r.other || 0) + (r.fractal || 0)); add(g, 'strays', r.strays);
105
+ add(g, 'snapshots', r.snapshots); add(g, 'logs', (r.logs || 0) + (r.gz || 0)); add(g, 'other', r.other); add(g, 'strays', r.strays);
106
106
  }
107
107
  for (const w of list(data && data.worktrees)) add(at(w.repo), 'worktrees', w.bytes);
108
108
  return Array.from(out.values()).filter(g => g.total > 0).sort((a, b) => b.total - a.total);