@giamme/forge 0.21.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 (165) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +25 -15
  3. package/SKILL.md +137 -216
  4. package/VERSION +1 -1
  5. package/bin/forge.js +104 -0
  6. package/docs/README.md +2 -3
  7. package/docs/add-ons.md +5 -3
  8. package/docs/artifacts.md +17 -2
  9. package/docs/commands.md +85 -63
  10. package/docs/decomposed-runs.md +195 -21
  11. package/docs/development.md +12 -10
  12. package/docs/forge-ui.md +33 -4
  13. package/docs/install.md +127 -6
  14. package/docs/memory.md +6 -1
  15. package/docs/models.md +36 -10
  16. package/docs/reviews.md +50 -29
  17. package/docs/safety.md +27 -2
  18. package/docs/troubleshooting.md +8 -11
  19. package/forge +29 -4
  20. package/forge.cmd +56 -0
  21. package/package.json +6 -3
  22. package/references/dataset.md +10 -9
  23. package/references/decompose-integration.md +337 -0
  24. package/references/decompose-opt-in.md +527 -0
  25. package/references/decompose-recovery.md +569 -0
  26. package/references/decompose-review.md +256 -0
  27. package/references/decompose.md +99 -1606
  28. package/references/findings.md +68 -0
  29. package/references/harnesses.md +7 -12
  30. package/references/memory.md +13 -2
  31. package/references/planning.md +48 -18
  32. package/references/ripwire.md +38 -13
  33. package/references/runtime.md +22 -33
  34. package/references/setup.md +90 -0
  35. package/references/solo.md +13 -42
  36. package/references/ui.md +12 -5
  37. package/registry.tsv +40 -22
  38. package/scripts/forge-artifact.sh +148 -13
  39. package/scripts/forge-compare.py +5 -15
  40. package/scripts/forge-config.py +14 -1
  41. package/scripts/forge-contract.py +216 -53
  42. package/scripts/forge-control.py +781 -51
  43. package/scripts/forge-dispatch.sh +202 -42
  44. package/scripts/forge-du.py +13 -3
  45. package/scripts/forge-guard.py +137 -6
  46. package/scripts/forge-handoff.py +221 -39
  47. package/scripts/forge-install-ripwire.sh +100 -24
  48. package/scripts/forge-install.sh +100 -41
  49. package/scripts/forge-issues.py +6 -4
  50. package/scripts/forge-jev-options.sh +3 -5
  51. package/scripts/forge-lib-adopt.sh +169 -5
  52. package/scripts/forge-lib-attribute.sh +10 -3
  53. package/scripts/forge-lib-decompose.sh +454 -0
  54. package/scripts/forge-lib-env.sh +179 -0
  55. package/scripts/forge-lib-group.sh +9 -6
  56. package/scripts/forge-lib-plans.sh +38 -21
  57. package/scripts/forge-lib-review.sh +28 -8
  58. package/scripts/forge-lib-task.sh +263 -69
  59. package/scripts/forge-lib-verify.sh +59 -10
  60. package/scripts/forge-memory.sh +83 -4
  61. package/scripts/forge-metrics.sh +10 -3
  62. package/scripts/forge-parallel-options.sh +23 -4
  63. package/scripts/forge-parallel.sh +602 -217
  64. package/scripts/forge-plan-check.py +71 -8
  65. package/scripts/forge-planner.py +303 -17
  66. package/scripts/forge-pr.py +9 -1
  67. package/scripts/forge-prompt.py +2 -2
  68. package/scripts/forge-review-links.py +248 -0
  69. package/scripts/forge-ripwire.py +234 -16
  70. package/scripts/forge-route.py +19 -27
  71. package/scripts/forge-runs-rm.py +92 -21
  72. package/scripts/forge-runs.py +46 -5
  73. package/scripts/forge-runtime.py +39 -14
  74. package/scripts/forge-schedule.py +141 -33
  75. package/scripts/forge-setup-stale.py +236 -0
  76. package/scripts/forge-setup.py +804 -0
  77. package/scripts/forge-shadow.py +2 -20
  78. package/scripts/forge-solo-lock.py +46 -0
  79. package/scripts/forge-solo.sh +39 -58
  80. package/scripts/forge-sweep.py +3 -2
  81. package/scripts/forge-ui.py +8 -1
  82. package/scripts/forge-update.sh +8 -3
  83. package/scripts/forge-verify.py +17 -1
  84. package/scripts/forge-version.py +13 -1
  85. package/scripts/forge-watch.py +7 -2
  86. package/scripts/forge-win.sh +156 -0
  87. package/scripts/forge_brief/__init__.py +6 -1
  88. package/scripts/forge_brief/proposals.py +6 -1
  89. package/scripts/forge_dataset/__init__.py +1 -1
  90. package/scripts/forge_dataset/capture.py +0 -34
  91. package/scripts/forge_dataset/checks.py +0 -1
  92. package/scripts/forge_dataset/cli.py +5 -1
  93. package/scripts/forge_dataset/export.py +28 -6
  94. package/scripts/forge_dataset/facts.py +1 -2
  95. package/scripts/forge_dataset/forecast.py +1 -1
  96. package/scripts/forge_dataset/harvest.py +107 -7
  97. package/scripts/forge_dataset/importer.py +3 -2
  98. package/scripts/forge_dataset/pairs.py +3 -3
  99. package/scripts/forge_dataset/reviewers.py +4 -3
  100. package/scripts/forge_dataset/routing.py +6 -3
  101. package/scripts/forge_dataset/tiers.py +1 -1
  102. package/scripts/forge_decide/__init__.py +1 -1
  103. package/scripts/forge_decide/budget.py +12 -7
  104. package/scripts/forge_decide/profiles.py +11 -14
  105. package/scripts/forge_decide/replay.py +9 -4
  106. package/scripts/forge_decompose.py +987 -0
  107. package/scripts/forge_flock.py +17 -2
  108. package/scripts/forge_groups/review.py +6 -1
  109. package/scripts/forge_jev/__init__.py +1 -1
  110. package/scripts/forge_jev/cli.py +10 -1
  111. package/scripts/forge_jev/gates.py +10 -1
  112. package/scripts/forge_jev/verify.py +10 -2
  113. package/scripts/forge_legacy.py +86 -0
  114. package/scripts/forge_memory_home.py +57 -0
  115. package/scripts/forge_models.py +151 -0
  116. package/scripts/forge_posix.py +17 -0
  117. package/scripts/forge_prefs.py +138 -0
  118. package/scripts/forge_proc.py +108 -0
  119. package/scripts/forge_registry.py +2 -2
  120. package/scripts/forge_side/__init__.py +23 -4
  121. package/scripts/forge_storage.py +28 -15
  122. package/ui/README.md +22 -10
  123. package/ui/docs/api.md +121 -99
  124. package/ui/forge_ui/control.py +53 -16
  125. package/ui/forge_ui/export.py +0 -10
  126. package/ui/forge_ui/models.py +15 -2
  127. package/ui/forge_ui/projects.py +4 -1
  128. package/ui/forge_ui/reader.py +462 -60
  129. package/ui/forge_ui/server.py +0 -10
  130. package/ui/forge_ui/static/app.js +28 -9
  131. package/ui/forge_ui/static/checksview.js +12 -3
  132. package/ui/forge_ui/static/controls.js +147 -11
  133. package/ui/forge_ui/static/convo.js +5 -2
  134. package/ui/forge_ui/static/diffview.js +4 -5
  135. package/ui/forge_ui/static/panel.js +180 -77
  136. package/ui/forge_ui/static/projectsview.js +16 -2
  137. package/ui/forge_ui/static/runmodel.js +18 -4
  138. package/ui/forge_ui/static/scene3d.js +52 -31
  139. package/ui/forge_ui/static/settings.js +1 -1
  140. package/ui/forge_ui/static/storageview.js +2 -2
  141. package/ui/forge_ui/static/style.css +23 -6
  142. package/ui/forge_ui/static/worktreesview.js +8 -4
  143. package/ui/forge_ui/transcripts.py +6 -0
  144. package/ui/forge_ui/worktrees.py +13 -1
  145. package/docs/fractal.md +0 -181
  146. package/references/fractal-dashboard.md +0 -21
  147. package/references/fractal.md +0 -307
  148. package/scripts/forge-fractal-dispatch.sh +0 -4
  149. package/scripts/forge-fractal-options.sh +0 -54
  150. package/scripts/forge-fractal.py +0 -6
  151. package/scripts/forge-install-fractal.sh +0 -4
  152. package/scripts/forge_fractal/__init__.py +0 -88
  153. package/scripts/forge_fractal/bridge.py +0 -46
  154. package/scripts/forge_fractal/cli.py +0 -224
  155. package/scripts/forge_fractal/dashboard.css +0 -138
  156. package/scripts/forge_fractal/dashboard.html +0 -41
  157. package/scripts/forge_fractal/dashboard.js +0 -687
  158. package/scripts/forge_fractal/decomposition.py +0 -262
  159. package/scripts/forge_fractal/execution.py +0 -659
  160. package/scripts/forge_fractal/inspection.py +0 -261
  161. package/scripts/forge_fractal/install.py +0 -158
  162. package/scripts/forge_fractal/invocation.py +0 -95
  163. package/scripts/forge_fractal/pipeline.py +0 -125
  164. package/scripts/forge_fractal/selection.py +0 -180
  165. package/ui/forge_ui/fractal.py +0 -582
@@ -20,12 +20,16 @@ IS_WINDOWS = os.name == 'nt'
20
20
  SIGKILL = getattr(signal, 'SIGKILL', signal.SIGTERM)
21
21
  SIGUSR1 = getattr(signal, 'SIGUSR1', None)
22
22
  SIGQUIT = getattr(signal, 'SIGQUIT', None)
23
+ SIGBREAK = getattr(signal, 'SIGBREAK', None)
23
24
 
24
25
  _STILL_ACTIVE = 259
25
26
  _PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
27
+ _PROCESS_SET_QUOTA = 0x0100
26
28
  _PROCESS_TERMINATE = 0x0001
27
29
  _TH32CS_SNAPPROCESS = 0x00000002
28
30
  _ERROR_ACCESS_DENIED = 5
31
+ _JOB_OBJECT_EXTENDED_LIMIT_INFO = 9
32
+ _JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000
29
33
  _CREATE_NO_WINDOW = getattr(subprocess, 'CREATE_NO_WINDOW', 0x08000000)
30
34
 
31
35
 
@@ -88,6 +92,11 @@ def resolve_win_command(argv: list[str]) -> tuple[Path, list[str]]:
88
92
  raw = argv[0]
89
93
  if not IS_WINDOWS:
90
94
  return Path(raw).resolve(), list(argv)
95
+ if raw in ('/bin/bash', '/bin/sh'):
96
+ exe = bash_executable()
97
+ return Path(exe), [exe, *argv[1:]]
98
+ if len(raw) >= 2 and raw[0] == '/' and raw[1].isalpha() and (len(raw) == 2 or raw[2] == '/'):
99
+ raw = f'{raw[1].upper()}:/{raw[3:]}'
91
100
  found = shutil.which(raw)
92
101
  if found:
93
102
  binary = Path(found).resolve()
@@ -177,6 +186,47 @@ if IS_WINDOWS:
177
186
  ('szExeFile', _wintypes.WCHAR * 260),
178
187
  ]
179
188
 
189
+ class _IO_COUNTERS(ctypes.Structure):
190
+ _fields_ = [
191
+ ('ReadOperationCount', ctypes.c_uint64),
192
+ ('WriteOperationCount', ctypes.c_uint64),
193
+ ('OtherOperationCount', ctypes.c_uint64),
194
+ ('ReadTransferCount', ctypes.c_uint64),
195
+ ('WriteTransferCount', ctypes.c_uint64),
196
+ ('OtherTransferCount', ctypes.c_uint64),
197
+ ]
198
+
199
+ class _JOBOBJECT_BASIC_LIMIT_INFORMATION(ctypes.Structure):
200
+ _fields_ = [
201
+ ('PerProcessUserTimeLimit', ctypes.c_int64),
202
+ ('PerJobUserTimeLimit', ctypes.c_int64),
203
+ ('LimitFlags', _wintypes.DWORD),
204
+ ('MinimumWorkingSetSize', ctypes.c_size_t),
205
+ ('MaximumWorkingSetSize', ctypes.c_size_t),
206
+ ('ActiveProcessLimit', _wintypes.DWORD),
207
+ ('Affinity', ctypes.c_size_t),
208
+ ('PriorityClass', _wintypes.DWORD),
209
+ ('SchedulingClass', _wintypes.DWORD),
210
+ ]
211
+
212
+ class _JOBOBJECT_EXTENDED_LIMIT_INFORMATION(ctypes.Structure):
213
+ _fields_ = [
214
+ ('BasicLimitInformation', _JOBOBJECT_BASIC_LIMIT_INFORMATION),
215
+ ('IoInfo', _IO_COUNTERS),
216
+ ('ProcessMemoryLimit', ctypes.c_size_t),
217
+ ('JobMemoryLimit', ctypes.c_size_t),
218
+ ('PeakProcessMemoryUsed', ctypes.c_size_t),
219
+ ('PeakJobMemoryUsed', ctypes.c_size_t),
220
+ ]
221
+
222
+ _kernel32.CreateJobObjectW.argtypes = [ctypes.c_void_p, _wintypes.LPCWSTR]
223
+ _kernel32.CreateJobObjectW.restype = _wintypes.HANDLE
224
+ _kernel32.SetInformationJobObject.argtypes = [_wintypes.HANDLE, ctypes.c_int, ctypes.c_void_p, _wintypes.DWORD]
225
+ _kernel32.SetInformationJobObject.restype = _wintypes.BOOL
226
+ _kernel32.AssignProcessToJobObject.argtypes = [_wintypes.HANDLE, _wintypes.HANDLE]
227
+ _kernel32.AssignProcessToJobObject.restype = _wintypes.BOOL
228
+ _kernel32.TerminateJobObject.argtypes = [_wintypes.HANDLE, _wintypes.UINT]
229
+ _kernel32.TerminateJobObject.restype = _wintypes.BOOL
180
230
  _kernel32.OpenProcess.argtypes = [_wintypes.DWORD, _wintypes.BOOL, _wintypes.DWORD]
181
231
  _kernel32.OpenProcess.restype = _wintypes.HANDLE
182
232
  _kernel32.CloseHandle.argtypes = [_wintypes.HANDLE]
@@ -397,3 +447,61 @@ def group_alive(pgid: int) -> bool:
397
447
  return False
398
448
  return True
399
449
  return pid_alive(pgid)
450
+
451
+
452
+ class ProcessJob:
453
+ """Win32 Job Object binding child/grandchild processes to this guardian handle.
454
+
455
+ Configures ``JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE`` so an abrupt kill of the
456
+ guardian cleans up the entire descendant tree atomically; ``disarm()`` clears
457
+ the flag after a clean wait so intentional orphan reaping runs as designed.
458
+ """
459
+
460
+ def __init__(self) -> None:
461
+ self._handle: int | None = None
462
+
463
+ def attach(self, pid: int, *, kill_on_close: bool = True) -> bool:
464
+ if not IS_WINDOWS or not isinstance(pid, int) or pid <= 0 or pid > 0xFFFFFFFF:
465
+ return False
466
+ job = _kernel32.CreateJobObjectW(None, None)
467
+ if not job:
468
+ return False
469
+ if kill_on_close and not self._set_limit_flags(job, _JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE):
470
+ _kernel32.CloseHandle(job)
471
+ return False
472
+ proc = _kernel32.OpenProcess(_PROCESS_SET_QUOTA | _PROCESS_TERMINATE, False, pid)
473
+ if not proc:
474
+ _kernel32.CloseHandle(job)
475
+ return False
476
+ try:
477
+ if not _kernel32.AssignProcessToJobObject(job, proc):
478
+ _kernel32.CloseHandle(job)
479
+ return False
480
+ finally:
481
+ _kernel32.CloseHandle(proc)
482
+ self._handle = job
483
+ return True
484
+
485
+ def _set_limit_flags(self, handle: int, flags: int) -> bool:
486
+ info = _JOBOBJECT_EXTENDED_LIMIT_INFORMATION()
487
+ info.BasicLimitInformation.LimitFlags = flags
488
+ return bool(_kernel32.SetInformationJobObject(
489
+ handle,
490
+ _JOB_OBJECT_EXTENDED_LIMIT_INFO,
491
+ ctypes.byref(info),
492
+ ctypes.sizeof(info),
493
+ ))
494
+
495
+ def disarm(self) -> None:
496
+ if self._handle:
497
+ self._set_limit_flags(self._handle, 0)
498
+
499
+ def terminate(self, exit_code: int = 1) -> bool:
500
+ if self._handle:
501
+ return bool(_kernel32.TerminateJobObject(self._handle, exit_code))
502
+ return False
503
+
504
+ def close(self) -> None:
505
+ if self._handle:
506
+ _kernel32.CloseHandle(self._handle)
507
+ self._handle = None
@@ -62,7 +62,7 @@ def registry_dir() -> Path:
62
62
  user's repo. ``config_path()`` is ``<that>/forge/jev.json``; the registry is the
63
63
  sibling ``runs`` directory.
64
64
  """
65
- value = os.environ.get('XDG_CONFIG_HOME') or ''
65
+ value = forge_posix.host_path(os.environ.get('XDG_CONFIG_HOME') or '')
66
66
  base = Path(value).expanduser() if value else None
67
67
  if base is None or not base.is_absolute():
68
68
  base = Path.home() / '.config'
@@ -286,7 +286,7 @@ def _repo_of(run_dir: Path) -> Path | None:
286
286
  with os.fdopen(fd, 'rb') as handle:
287
287
  if not stat.S_ISREG(os.fstat(fd).st_mode):
288
288
  return None
289
- line = handle.readline(_REPO_LINE_MAX).decode(errors='replace').strip()
289
+ line = forge_posix.host_path(handle.readline(_REPO_LINE_MAX).decode(errors='replace').strip())
290
290
  # Empty, or text no path can hold, or relative: a relative repo would be resolved
291
291
  # against whatever directory the runner happened to start in, and keyed to the wrong repo.
292
292
  if not line or '\x00' in line or not os.path.isabs(line):
@@ -164,6 +164,16 @@ def settings(plan) -> dict:
164
164
  return resolved
165
165
 
166
166
 
167
+ def fallback_model(plan, feature) -> str:
168
+ """The model `feature` (`brief` or `summaries`) would have without the plan's own `<feature>_model`
169
+ file (#163): the user setting before the plan is planned, `''` once it is (a planned plan is frozen)."""
170
+ if feature not in ('brief', 'summaries'):
171
+ raise ValueError('feature must be brief or summaries, not %r' % (feature,))
172
+ if (Path(plan) / 'waves.tsv').exists():
173
+ return ''
174
+ return _model_of(_mapping(_user_features().get(feature)).get('model'))
175
+
176
+
167
177
  def plan_files(plan) -> dict:
168
178
  """The six plan files that freeze `plan`'s choices as they stand, for a plan made from it.
169
179
 
@@ -253,6 +263,13 @@ def _count(kind_dir: Path) -> int:
253
263
  return total
254
264
 
255
265
 
266
+ def _slot_number(name: str) -> int | None:
267
+ """Parse an ASCII base-10 slot directory name, ignoring Unicode digits like `²`."""
268
+ if not (name.isascii() and name.isdigit()):
269
+ return None
270
+ return int(name)
271
+
272
+
256
273
  def _next_n(kind_dir: Path, task: str) -> int:
257
274
  """1 + the highest numeric `<n>` already under this task. Other tasks have their own count."""
258
275
  highest = 0
@@ -263,8 +280,9 @@ def _next_n(kind_dir: Path, task: str) -> int:
263
280
  except OSError:
264
281
  children = []
265
282
  for child in children:
266
- if child.is_dir() and child.name.isdigit():
267
- highest = max(highest, int(child.name))
283
+ number = _slot_number(child.name)
284
+ if number is not None and child.is_dir():
285
+ highest = max(highest, number)
268
286
  return highest + 1
269
287
 
270
288
 
@@ -357,7 +375,8 @@ def _triage_slots(home: Path) -> tuple[int, int]:
357
375
  except OSError:
358
376
  return 0, 0
359
377
  for child in children:
360
- if not child.name.isdigit():
378
+ number = _slot_number(child.name)
379
+ if number is None:
361
380
  continue
362
381
  try:
363
382
  info = child.lstat()
@@ -367,7 +386,7 @@ def _triage_slots(home: Path) -> tuple[int, int]:
367
386
  raise ValueError('triage dispatch dir must be a real directory, not a symlink')
368
387
  if not stat.S_ISDIR(info.st_mode):
369
388
  continue
370
- highest = max(highest, int(child.name))
389
+ highest = max(highest, number)
371
390
  count += 1
372
391
  return highest, count
373
392
 
@@ -14,14 +14,13 @@ A run dir holds, by what this module calls them:
14
14
  or of a review stopped by a signal.
15
15
  logs `*.log`, `*.jsonl` and their `.gz`. `compressible` lists the ones `compact --logs`
16
16
  gzips: a dwarf's or reviewer's own log in its execution record,
17
- `attempts/<role>-<32 hex>/<role>.log` (role dwarf or qa), of at least LOG_MIN bytes,
18
- outside a Fractal tree. Those copies are written once, when the execution ends; the
17
+ `attempts/<role>-<32 hex>/<role>.log` (role dwarf or qa), of at least LOG_MIN bytes.
18
+ Those copies are written once, when the execution ends; the
19
19
  log a running agent writes, and every log a retry reads, is the one in the task dir,
20
20
  which is never touched. forge-ui reads the copy, plain or gzipped.
21
21
  strays what forge does not create: a dependency directory (DEP_DIRS) or a `.git` outside a
22
22
  snapshot, such as a dependency install someone ran by hand inside a run dir. Reported
23
23
  with its size, never removed.
24
- fractal Fractal's own workspaces (`.../nodes/<id>/product`), opt-in and managed by Fractal.
25
24
  other everything else: prompts, diffs, verdicts, metrics, the run's own records.
26
25
 
27
26
  Sizes are disk usage (allocated blocks, as `du` counts them), and a file with several hard links
@@ -87,7 +86,7 @@ def is_compressible_log(path, info=None) -> bool:
87
86
  match = ATTEMPT_DIR.fullmatch(os.path.basename(parent))
88
87
  if not match or os.path.basename(path) != match.group(1) + '.log':
89
88
  return False
90
- if os.path.basename(os.path.dirname(parent)) != 'attempts' or 'nodes' in Path(parent).parts:
89
+ if os.path.basename(os.path.dirname(parent)) != 'attempts':
91
90
  return False
92
91
  info = info if info is not None else _lstat(path)
93
92
  return info is not None and stat.S_ISREG(info.st_mode) and info.st_size >= LOG_MIN
@@ -139,13 +138,13 @@ def scan(run_dir, deadline=None) -> dict:
139
138
 
140
139
  {path, total, snapshots: {bytes, count, items: [{path, bytes}]},
141
140
  logs: {bytes, gz_bytes, compressible_bytes, compressible: [{path, bytes, size}]},
142
- strays: [{path, bytes, kind}], fractal, other, parts: [path], complete}
141
+ strays: [{path, bytes, kind}], other, parts: [path], complete}
143
142
  """
144
143
  root = os.path.realpath(os.fspath(run_dir))
145
144
  seen = _Seen()
146
145
  out = dict(path=root, total=0, snapshots=dict(bytes=0, count=0, items=[]),
147
146
  logs=dict(bytes=0, gz_bytes=0, compressible_bytes=0, compressible=[]),
148
- strays=[], fractal=0, other=0, parts=[], complete=True)
147
+ strays=[], other=0, parts=[], complete=True)
149
148
  stack = [root]
150
149
  while stack:
151
150
  if deadline is not None and time.monotonic() > deadline:
@@ -169,10 +168,6 @@ def scan(run_dir, deadline=None) -> dict:
169
168
  out['snapshots']['bytes'] += size
170
169
  out['snapshots']['count'] += 1
171
170
  out['complete'] = out['complete'] and done
172
- elif entry.name == 'product' and 'nodes' in Path(directory).parts:
173
- size, done = tree_usage(entry.path, seen, deadline)
174
- out['fractal'] += size
175
- out['complete'] = out['complete'] and done
176
171
  elif entry.name in DEP_DIRS or entry.name == '.git':
177
172
  size, done = tree_usage(entry.path, seen, deadline)
178
173
  out['strays'].append(dict(path=entry.path, bytes=size,
@@ -198,7 +193,7 @@ def scan(run_dir, deadline=None) -> dict:
198
193
  out['other'] += size
199
194
  stray = sum(s['bytes'] for s in out['strays'])
200
195
  out['total'] = (out['snapshots']['bytes'] + out['logs']['bytes'] + out['logs']['gz_bytes'] + stray
201
- + out['fractal'] + out['other'])
196
+ + out['other'])
202
197
  out['snapshots']['items'].sort(key=lambda s: s['path'])
203
198
  out['strays'].sort(key=lambda s: -s['bytes'])
204
199
  return out
@@ -447,13 +442,29 @@ def data_home_parts(home: Path, deadline=None) -> dict:
447
442
  return dict(path=str(home), bytes=sum(parts.values()), parts=parts)
448
443
 
449
444
 
445
+ def removed_state(deadline=None) -> list:
446
+ """What removed parts of forge left on disk: [{name, path, bytes, since, complete}]. Reads only."""
447
+ _scripts()
448
+ import forge_legacy
449
+ path = forge_legacy.state_dir()
450
+ if path.is_symlink() or not path.is_dir():
451
+ return []
452
+ size, done = tree_usage(str(path), deadline=deadline)
453
+ return [dict(name='Fractal', path=str(path), bytes=size, since=forge_legacy.REMOVED_IN, complete=done)]
454
+
455
+
450
456
  def report(repo=None, home=None, budget_s: float = 600.0, progress=None) -> dict:
451
457
  """What forge takes on disk, for one repository (a path) or, None, every one (`forge du`, forge-ui's Disk screen).
452
458
 
453
459
  {repo, computed, complete, runs: [{path, run_id, repo, updated, total, snapshots, snapshot_count, logs, gz,
454
- compressible, strays, fractal, other, reclaimable, complete}],
460
+ compressible, strays, other, reclaimable, complete}],
455
461
  strays: [{path, bytes, kind, run}], worktrees: [{repo, run_id, path, bytes, complete}],
456
- data_home: {path, bytes, parts} | None, totals: {runs, worktrees, data_home, reclaimable, snapshots, logs}}
462
+ data_home: {path, bytes, parts} | None, totals: {runs, worktrees, data_home, reclaimable, snapshots, logs},
463
+ removed: [{name, path, bytes, since, complete}]}
464
+
465
+ `removed` is what a part of forge that no longer exists left on this machine: today the state directory of
466
+ Fractal, the execution backend forge 0.23 removed. It belongs to no repository, so it is listed whatever
467
+ `repo` is. Nothing reads it and forge never deletes it.
457
468
  """
458
469
  _scripts()
459
470
  import forge_locations
@@ -475,7 +486,7 @@ def report(repo=None, home=None, budget_s: float = 600.0, progress=None) -> dict
475
486
  runs.append(dict(path=path, run_id=run_id, repo=named, updated=updated, total=scanned['total'],
476
487
  snapshots=scanned['snapshots']['bytes'], snapshot_count=scanned['snapshots']['count'],
477
488
  logs=scanned['logs']['bytes'], gz=scanned['logs']['gz_bytes'],
478
- compressible=scanned['logs']['compressible_bytes'], fractal=scanned['fractal'],
489
+ compressible=scanned['logs']['compressible_bytes'],
479
490
  strays=sum(s['bytes'] for s in scanned['strays']), other=scanned['other'],
480
491
  reclaimable=reclaimable(scanned), complete=scanned['complete']))
481
492
  strays.extend(dict(s, run=path) for s in scanned['strays'])
@@ -505,8 +516,10 @@ def report(repo=None, home=None, budget_s: float = 600.0, progress=None) -> dict
505
516
  data_home=home_parts['bytes'] if home_parts else 0, reclaimable=sum(r['reclaimable'] for r in runs),
506
517
  snapshots=sum(r['snapshots'] for r in runs), logs=sum(r['logs'] + r['gz'] for r in runs),
507
518
  strays=sum(s['bytes'] for s in strays))
519
+ removed = removed_state(deadline)
508
520
  return dict(repo=str(repo) if repo is not None else None, computed=time.time(), complete=complete, runs=runs,
509
- strays=sorted(strays, key=lambda s: -s['bytes']), worktrees=worktrees, data_home=home_parts, totals=totals)
521
+ strays=sorted(strays, key=lambda s: -s['bytes']), worktrees=worktrees, data_home=home_parts, totals=totals,
522
+ removed=removed)
510
523
 
511
524
 
512
525
  def footprints_of(result: dict) -> dict:
package/ui/README.md CHANGED
@@ -38,7 +38,7 @@ blocks on a plate, with cables between them and lamps that light up as things ha
38
38
  - **Beyond one run:** a full-screen **run cloud** of every run, grouped by project, in five
39
39
  layouts with filters and runs you can drag anywhere; **diffs** with each finding under the
40
40
  line it names; each dwarf's and reviewer's **conversation**, read from its CLI's log; a
41
- **model leaderboard**; a **files heatmap**; **Fractal** child-task trees;
41
+ **model leaderboard**; a **files heatmap**; the **subtasks** of a split task as a tree;
42
42
  **quick jump** and **notifications**; and **export** of a run as one HTML file. See
43
43
  [What you see](#what-you-see).
44
44
 
@@ -225,6 +225,9 @@ keep one meaning everywhere (amber running, green merged or passed, red failed,
225
225
  - **Retro:** a run with a retro report or retro notes has a Retro section in *Run details*: its note
226
226
  counts on one line (for example *5 notes: 3 you can fix, 2 for forge · 4 verified, 1 claimed · 1
227
227
  blocking*), then the report, collapsed.
228
+ - **Handoff:** a run with `handoff.driver.json` or `handoff.notes.jsonl` (`forge handoff claim` /
229
+ `note`) has a Handoff section in *Run details*: the driver on one line (harness, session, since,
230
+ last seen, *stale* past 12 hours), then the notes, newest first (the newest 50).
228
231
  - **Read-only:** a server started with `--read-only` shows all of this, without the switches or the
229
232
  answer boxes.
230
233
  - **Now and checks:** a running task's *Now* names the agent at work and its attempt, the phase
@@ -344,12 +347,16 @@ keep one meaning everywhere (amber running, green merged or passed, red failed,
344
347
  check or an environment problem (`/event/<n>` opens it there and stops following the end).
345
348
 
346
349
  <img src="docs/media/conversation.png" width="760" alt="A dwarf's conversation: its thinking, the files it wrote, a test run that failed with exit 1 and the run that passed after the fix.">
347
- - **Fractal child tasks:** when a run used Fractal, a task's inspector shows the tree it was split
348
- into (status, difficulty, model, phase, cost, the split decision), and the opened task in 3D
349
- carries the same tree floating above it. A node (`…/tasks/<id>/fractal/<node>`) shows its goal,
350
- paths, timings, cost and tokens, its decomposition and the children it admitted, its last
351
- messages, and its candidate diff. Fractal's state is read under `$XDG_STATE_HOME/forge/fractal`
352
- (default `~/.local/state`), only read, without following symlinks.
350
+ - **Subtasks:** when a task was split into subtasks, its inspector has a **Decomposition**
351
+ section: the decision (split, kept whole, or kept whole at a limit), who made it (the planner,
352
+ you, or the run with `--auto-split`) and why, then the tree of its subtasks through every
353
+ level, each with its status, model, difficulty, attempts, tokens and a link to its diff. The
354
+ opened task in 3D carries the same tree above it. A subtask opens as a task of its own, with
355
+ its attempts, reviews, findings and controls; *Open the subtasks as a plan of their own* shows
356
+ the sub-plan as a run, and that run links back to its task. The run's header shows the limits
357
+ every split works within, how much of the run was split, and, for a goal larger than one plan,
358
+ the stage this plan is and the stages after it. forge records tokens, not prices, so the tree
359
+ shows tokens. A run made with Fractal, which forge 0.23 removed, still opens, read-only.
353
360
  - **Export:** *Export…* in a run's header downloads the run as one HTML file that opens in any
354
361
  browser without forge-ui, offline included (in 2D; in 3D when cdn.jsdelivr.net is reachable).
355
362
  It asks each time: by default prompts, reviewer reports, logs, finding details and diffs are
@@ -390,7 +397,12 @@ takes effect, except a brief answer, which is sent when you press *Send*. The ro
390
397
  infra-retry budgets. A task has a threshold override (`Inherit`, P0–P3 or `None`, which
391
398
  exempts it from the run's threshold), its own retry budget and a **model pin**: the model
392
399
  its next full retry uses, once. A control that cannot apply (no live scheduler, a merged
393
- task) is disabled and says why. A Fractal plan's pin control is hidden.
400
+ task) is disabled and says why.
401
+ - **Models per difficulty (`forge control models`):** in a plan's inspector, the implementer and
402
+ reviewer of the `low`, `medium` and `high` tasks that have not started yet, one spec or a pool
403
+ separated by commas. Started tasks keep their model. Every spec on the page, a pin or a tier's
404
+ pool included, shows the model id it runs (`astra:xhigh runs gpt-6.2-astra on codex`), also while
405
+ you type it, so a pin never changes the model generation unnoticed.
394
406
  - **Open findings (`forge issues`):** the findings a run, or every run of its repository,
395
407
  left open. The list opens from a quick offline listing and then fills in what is already
396
408
  filed; select findings to file as GitHub issues, or dismiss them (and undo that).
@@ -449,8 +461,8 @@ turns all of it off: no token is issued, every change is a 405, and the controls
449
461
  responses it reads, the 3D stage's modules as one module text, a hash-based policy).
450
462
  - `forge_ui/static/modelstats.js`, `leaderboard.js`: the leaderboard's aggregation (outcomes as
451
463
  `scripts/forge_dataset/export.py` labels them, the interval of its `routing.py`) and its page.
452
- - `forge_ui/diffs.py`, `fractal.py`, `models.py`: diff parsing and finding pins, the Fractal state
453
- reader, and the facts behind the model leaderboard.
464
+ - `forge_ui/diffs.py`, `models.py`: diff parsing and finding pins, and the facts behind the model
465
+ leaderboard.
454
466
  - `forge_ui/static/search.js`, `notify.js`, `favicon.svg`: the quick jump and the notifications
455
467
  (ranking and change detection are in `runmodel.js`).
456
468
  - `tests/`: reader, executions, endpoints, server, static-script and browser checks; `run_fixture.py`