loki-mode 11.141.5 → 11.142.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 (82) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/agents/types.json +3 -3
  4. package/autonomy/lib/backlog.py +156 -20
  5. package/autonomy/loki +6 -3
  6. package/autonomy/telemetry.sh +1 -2
  7. package/dashboard/__init__.py +1 -1
  8. package/dashboard/server.py +4 -2
  9. package/dashboard/telemetry.py +1 -1
  10. package/docs/CLI-REFERENCE.md +1 -1
  11. package/docs/INSTALLATION.md +1 -1
  12. package/docs/dev/architecture-reference.md +3 -0
  13. package/docs/v10/GUIDE.md +3 -1
  14. package/loki-ts/dist/loki.js +1648 -1647
  15. package/mcp/__init__.py +1 -1
  16. package/package.json +2 -2
  17. package/packages/control-plane/dist/server.js +52 -9
  18. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  19. package/references/agent-types.md +3 -3
  20. package/references/business-ops.md +2 -2
  21. package/references/cursor-learnings.md +1 -1
  22. package/skills/agents.md +2 -2
  23. package/skills/github-integration.md +6 -0
  24. package/skills/model-selection.md +2 -2
  25. package/src/audit/compliance.js +11 -11
  26. package/web-app/dist/assets/{AdminPage-JzeyDRHB.js → AdminPage-DyMZec5q.js} +1 -1
  27. package/web-app/dist/assets/{Avatar-BLI-euGn.js → Avatar-COqdNbsk.js} +1 -1
  28. package/web-app/dist/assets/{Badge-C7UXsn3u.js → Badge-MAPrG4YW.js} +1 -1
  29. package/web-app/dist/assets/{Button-BsFDYQPM.js → Button-CCiLxPzL.js} +1 -1
  30. package/web-app/dist/assets/{CockpitPage-nU0B8qMQ.js → CockpitPage-CC65JqZo.js} +1 -1
  31. package/web-app/dist/assets/{ComparePage-5HK3EU2X.js → ComparePage-D8jLo09H.js} +1 -1
  32. package/web-app/dist/assets/{ErrorBoundary-pOL7Vuv2.js → ErrorBoundary-DSe6Jio9.js} +1 -1
  33. package/web-app/dist/assets/{EvidenceReceiptPanel-D7g9HerN.js → EvidenceReceiptPanel-C2AkMLOP.js} +1 -1
  34. package/web-app/dist/assets/{GitHubIssuesPanel-DVABIPMQ.js → GitHubIssuesPanel-xCJ1P7Zg.js} +1 -1
  35. package/web-app/dist/assets/{GitHubPRsPanel-DLR6cd49.js → GitHubPRsPanel-2AY8_R8P.js} +1 -1
  36. package/web-app/dist/assets/{HomePage-Dcg02AL9.js → HomePage-DOf4taLJ.js} +2 -2
  37. package/web-app/dist/assets/{LoginPage-ChuLL9LW.js → LoginPage-C0wwSd39.js} +1 -1
  38. package/web-app/dist/assets/{MagicPage-CSuWqXO4.js → MagicPage-BD3E-KJd.js} +1 -1
  39. package/web-app/dist/assets/{MetricsPage-CVWjxNhf.js → MetricsPage-qarlBbRU.js} +1 -1
  40. package/web-app/dist/assets/{NotFoundPage-yVR85r6o.js → NotFoundPage-BtrUhTdf.js} +1 -1
  41. package/web-app/dist/assets/{ProjectPage-2URjkyCj.js → ProjectPage-D4WKVQ7S.js} +3 -3
  42. package/web-app/dist/assets/{ProjectsPage-BXbxOSsZ.js → ProjectsPage-jCrAWz4h.js} +1 -1
  43. package/web-app/dist/assets/{SettingsPage-C7PjmFr9.js → SettingsPage-B4pPpffz.js} +1 -1
  44. package/web-app/dist/assets/{ShowcasePage-C_6WIlRG.js → ShowcasePage-DOjR7Ex-.js} +1 -1
  45. package/web-app/dist/assets/{SystemSettingsPage-C38yDlgA.js → SystemSettingsPage-95JqUbHx.js} +1 -1
  46. package/web-app/dist/assets/{TeamsPage-efEIcRlH.js → TeamsPage-yt8gvIKl.js} +1 -1
  47. package/web-app/dist/assets/{TemplatesPage-BVN8hYn5.js → TemplatesPage-DoUDJ9ub.js} +1 -1
  48. package/web-app/dist/assets/{TerminalOutput-DQug-ZN5.js → TerminalOutput-1rC0J4Bk.js} +1 -1
  49. package/web-app/dist/assets/{activity-CXqxbEYH.js → activity-Cl3Uec2Y.js} +1 -1
  50. package/web-app/dist/assets/{bell-AVtr4iZb.js → bell-DtNdQWzd.js} +1 -1
  51. package/web-app/dist/assets/{bot-BmoTiQie.js → bot-DDpmlSz3.js} +1 -1
  52. package/web-app/dist/assets/{check-BaHWRoFS.js → check-BMbCof2H.js} +1 -1
  53. package/web-app/dist/assets/{chevron-left-BaeSE3MB.js → chevron-left-ByTbAUwf.js} +1 -1
  54. package/web-app/dist/assets/{circle-alert-BqhM6ffv.js → circle-alert-Bn9aE4IN.js} +1 -1
  55. package/web-app/dist/assets/{clock-CK6yBr-X.js → clock-SBTAfWqd.js} +1 -1
  56. package/web-app/dist/assets/{cloud-CcsDRj1b.js → cloud-ChyNGWkw.js} +1 -1
  57. package/web-app/dist/assets/{code-xml-Cfpz-EBt.js → code-xml-DI_krPD4.js} +1 -1
  58. package/web-app/dist/assets/{database-Bk1oSAQj.js → database-Wd5ifrBK.js} +1 -1
  59. package/web-app/dist/assets/{dollar-sign-Cf1Wg3hh.js → dollar-sign-C_lCtKRp.js} +1 -1
  60. package/web-app/dist/assets/{file-code-corner-1D-LeA_0.js → file-code-corner-qM8aq8IB.js} +1 -1
  61. package/web-app/dist/assets/{file-plus-C13TfPSr.js → file-plus-C6LCrbiu.js} +1 -1
  62. package/web-app/dist/assets/{globe-D-bdUWR9.js → globe-CDZS309O.js} +1 -1
  63. package/web-app/dist/assets/{hammer-BDvg0Bpo.js → hammer-Cyaf53eE.js} +1 -1
  64. package/web-app/dist/assets/{index-PtPpcleW.js → index-D0a1MQnH.js} +3 -3
  65. package/web-app/dist/assets/{layers-CvZLTWTW.js → layers-DG1AyE8w.js} +1 -1
  66. package/web-app/dist/assets/{loader-circle-BMRJRTe3.js → loader-circle-D5yySgBF.js} +1 -1
  67. package/web-app/dist/assets/{lock-Dbi-okF-.js → lock-CJy7cTHd.js} +1 -1
  68. package/web-app/dist/assets/{package-C5m2TO7-.js → package-C7i6KmVK.js} +1 -1
  69. package/web-app/dist/assets/{plus-D30AFrWv.js → plus-rqC7IjWg.js} +1 -1
  70. package/web-app/dist/assets/{refresh-cw-CZ_9FRpU.js → refresh-cw-CtIjcJKv.js} +1 -1
  71. package/web-app/dist/assets/{rotate-ccw-GKppHg9k.js → rotate-ccw-CAmSTk-m.js} +1 -1
  72. package/web-app/dist/assets/{scroll-text-DnTznFUB.js → scroll-text-C300cwvb.js} +1 -1
  73. package/web-app/dist/assets/{server-Dz8p0Af6.js → server-CgwnLQuj.js} +1 -1
  74. package/web-app/dist/assets/{shield-alert-DR0OwBTR.js → shield-alert-Cu4nt6vg.js} +1 -1
  75. package/web-app/dist/assets/{thumbs-up-OMV8Huvt.js → thumbs-up-8OQoTJWS.js} +1 -1
  76. package/web-app/dist/assets/{trash-2-LDV528Je.js → trash-2-CIgxRV_x.js} +1 -1
  77. package/web-app/dist/assets/{trending-down-CivTGd3Q.js → trending-down-CelWNzAc.js} +1 -1
  78. package/web-app/dist/assets/{trending-up-r9twANK7.js → trending-up-B-mBwFXP.js} +1 -1
  79. package/web-app/dist/assets/{upload-DMl7KGNJ.js → upload-BkfzF_e_.js} +1 -1
  80. package/web-app/dist/assets/{usePolling-DbEcreMW.js → usePolling-CtnMxKVF.js} +1 -1
  81. package/web-app/dist/assets/{user-DZjXIjRz.js → user-BvZ0JmEO.js} +1 -1
  82. package/web-app/dist/index.html +1 -1
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Runs an autonomous software factory that knows what it is supposed to deliver and proves it did, with a signed receipt. Use when the user says Loki Mode or asks to build, fix or verify software autonomously.
4
4
  ---
5
5
 
6
- # Loki Mode v11.141.5
6
+ # Loki Mode v11.142.0
7
7
 
8
8
  **Current entry points (Loki 10 engine):** `loki "<task>"`, `loki owner/repo#N` and `loki quick "<task>"` run the Loki 10 engine and end with a signed receipt (`loki verify`). `loki backlog owner/repo --all` runs many issues in parallel. Guide: `docs/v10/GUIDE.md`. The skill instructions below, and `loki start`, describe the previous bash loop. PRD-file starts (`loki start ./prd.md`) and the opencode provider still run on it until FC38-SWEEP ports them; the legacy-engine command and the LOKI_ENGINE switch remain removed. Prefer `loki owner/repo#N` for issues.
9
9
 
@@ -461,4 +461,4 @@ Implemented, planned and deprecated items, with the version each landed in: `CHA
461
461
 
462
462
  ---
463
463
 
464
- **v11.141.5 | [Autonomi](https://www.autonomi.dev/) flagship product | core skill**
464
+ **v11.142.0 | [Autonomi](https://www.autonomi.dev/) flagship product | core skill**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 11.141.5
1
+ 11.142.0
package/agents/types.json CHANGED
@@ -123,9 +123,9 @@
123
123
  "type": "ops-compliance",
124
124
  "swarm": "operations",
125
125
  "name": "Compliance Engineer",
126
- "persona": "You are a senior compliance engineer specializing in regulatory frameworks, audit preparation, and policy enforcement.",
127
- "focus": ["SOC2", "GDPR", "HIPAA", "PCI-DSS", "audit preparation", "policy enforcement"],
128
- "capabilities": "SOC2, GDPR, HIPAA, PCI-DSS, audit preparation, policy enforcement"
126
+ "persona": "You are a senior compliance engineer specializing in audit preparation, policy documentation, and policy enforcement. You draft evidence and documents for the team's own review; you never state that a system is certified or compliant.",
127
+ "focus": ["audit preparation", "policy documentation", "policy enforcement", "evidence collection"],
128
+ "capabilities": "Audit preparation, policy documentation, policy enforcement, evidence collection (drafts for review, no compliance claim)"
129
129
  },
130
130
  {
131
131
  "type": "biz-marketing",
@@ -40,6 +40,21 @@ each as `loki jira:PROJ-N` / `loki linear:TEAM-N` from the current checkout.
40
40
  --issues takes item numbers (12 means PROJ-12). A large Jira or Linear item runs
41
41
  as one run: the engine splits only GitHub issues today.
42
42
 
43
+ What the user sees: one line per state change (queued, running with the log
44
+ path, the result), a heartbeat line every LOKI_BACKLOG_HEARTBEAT_S seconds
45
+ (default 120, 0 off) naming what still runs, and at the end one row per item
46
+ (cost, time, result with its PR or PR count) plus one Total line (done, not
47
+ done, PRs, cost, time). Child output goes only to <checkout>-backlog/logs. A
48
+ SIGINT or SIGTERM stops the children and still prints the rows and the Total
49
+ (exit 130). A finished run's receipts are kept under
50
+ <checkout>-backlog/receipts/<item> before its worktree is removed.
51
+
52
+ LOKI_BACKLOG_LOCAL_ORIGIN=1 (off by default) accepts a checkout whose origin is
53
+ a local bare repository (an absolute path, the rule engine10-push.sh uses):
54
+ issues are still read from owner/repo, and each run publishes its branch to
55
+ that bare repository and prints PR: local://<path>#<branch>. For rehearsals and
56
+ tests: branches and PRs go to the local bare repository; the run still uses GitHub for the issue itself.
57
+
43
58
  Test seam: LOKI_BACKLOG_LAUNCHER replaces the real launcher (called with the
44
59
  issue ref, cwd = the issue worktree).
45
60
  """
@@ -91,6 +106,17 @@ def origin_slug(cwd):
91
106
  return m.group(1) if m else ""
92
107
 
93
108
 
109
+ def local_bare_origin(cwd):
110
+ """The origin path when it is a local bare repository (absolute, colon-free, its own git dir), else ""."""
111
+ url = git("config", "--get", "remote.origin.url", cwd=cwd).stdout.strip()
112
+ if not url.startswith("/") or ":" in url or not os.path.isdir(url):
113
+ return ""
114
+ real = os.path.realpath(url)
115
+ if git("rev-parse", "--is-bare-repository", cwd=real).stdout.strip() != "true":
116
+ return ""
117
+ return url if os.path.realpath(git("rev-parse", "--absolute-git-dir", cwd=real).stdout.strip()) == real else ""
118
+
119
+
94
120
  def _issue(i, repo):
95
121
  """One work item. key: the job-table key; label: how it prints; ref: what the launcher runs; slug: branch suffix."""
96
122
  labels = [l.get("name", "") if isinstance(l, dict) else str(l) for l in i.get("labels") or []]
@@ -230,9 +256,41 @@ def add_spend(usd):
230
256
  json.dump(data, f)
231
257
 
232
258
 
259
+ def pr_urls(text):
260
+ """-> (distinct PR urls a run printed, how many more it only counted). local://: published to a local bare origin (engine10-push.sh)."""
261
+ urls = list(dict.fromkeys(re.findall(r"^PR:\s+((?:https?|local)://\S+)", text, re.M)))
262
+ more = re.search(r"^PR:\s+\(\+(\d+) more", text, re.M) # issues_epic.ts prLines folds the rest into a count
263
+ return urls, int(more.group(1)) if more else 0
264
+
265
+
266
+ def pr_count(text):
267
+ urls, more = pr_urls(text)
268
+ return len(urls) + more
269
+
270
+
271
+ def pr_text(text):
272
+ """"PR <url>" for the one PR an issue should end in; a run that opened several says how many and why (its Combined line)."""
273
+ urls, more = pr_urls(text)
274
+ if not urls:
275
+ return ""
276
+ if len(urls) + more == 1:
277
+ return "PR " + urls[0]
278
+ why = re.search(r"^Combined:\s+(.+)$", text, re.M)
279
+ note = " (%s)" % clip(why.group(1).strip(), 140) if why else ""
280
+ return "%d PRs%s, first %s" % (len(urls) + more, note, urls[0])
281
+
282
+
283
+ def clip(s, n):
284
+ return s if len(s) <= n else s[:n - 3] + "..."
285
+
286
+
287
+ def mins(seconds):
288
+ return "%ds" % round(seconds) if seconds < 90 else "%dm" % round(seconds / 60.0)
289
+
290
+
233
291
  def parse_result(rc, text):
234
292
  """-> (ok, status line text, cost_usd or None)."""
235
- pr = re.search(r"^PR:\s+((?:https?|local)://\S+)", text, re.M) # local://: published to a local bare origin (engine10-push.sh)
293
+ pr = pr_text(text)
236
294
  why = re.search(r"^Reason:\s+(.+)$", text, re.M)
237
295
  cost = re.search(r"^Cost:\s+(?:partial:\s+)?\$([0-9]+(?:\.[0-9]+)?)", text, re.M)
238
296
  usd = float(cost.group(1)) if cost else None
@@ -241,13 +299,13 @@ def parse_result(rc, text):
241
299
  usd = (usd or 0.0) + float(plan.group(1))
242
300
  reason = why.group(1).strip() if why else ""
243
301
  if rc == 0:
244
- return True, ("PR " + pr.group(1)) if pr else "VERIFIED", usd
302
+ return True, pr or "VERIFIED", usd
245
303
  if rc == 4:
246
304
  return False, "BLOCKED: " + (reason or "see the run log"), usd
247
305
  if rc == 3:
248
306
  return False, "BUDGET_STOP: " + (reason or "run cost cap reached"), usd
249
307
  if rc == 6: # PARTIAL: some proof missing; counts as done only with its (draft) PR
250
- return bool(pr), ("PARTIAL, PR " + pr.group(1)) if pr else "PARTIAL: " + (reason or "not every check proven"), usd
308
+ return bool(pr), ("PARTIAL, " + pr) if pr else "PARTIAL: " + (reason or "not every check proven"), usd
251
309
  return False, "FAILED: " + (reason or "exit %d" % rc), usd
252
310
 
253
311
 
@@ -392,7 +450,8 @@ def main(argv):
392
450
  top = git("rev-parse", "--show-toplevel").stdout.strip()
393
451
  if not top:
394
452
  return die("run this from a checkout of %s" % a.repo)
395
- if not tracker and origin_slug(top).lower() != a.repo.lower():
453
+ local_origin = local_bare_origin(top) if os.environ.get("LOKI_BACKLOG_LOCAL_ORIGIN") == "1" and not tracker else ""
454
+ if not tracker and not local_origin and origin_slug(top).lower() != a.repo.lower():
396
455
  return die("this checkout's origin is %r, not %s; cd into a checkout of %s"
397
456
  % (origin_slug(top) or "unknown", a.repo, a.repo))
398
457
 
@@ -496,24 +555,70 @@ def main(argv):
496
555
  "done": u["done"], "base": u["base"], "drop": sum(TRACKER_SECRETS.values(), ())} # a unit is a text task: no tracker token
497
556
  if u["spec"]: # frozen group acceptance for unit_mode (wall.ts)
498
557
  spec[k]["env"].update(LOKI_UNIT_SPEC=u["spec"], LOKI_SPEED="1")
499
- state = {k: {"status": "queued", "ok": None, "cost": None, "ran": False} for k in spec}
558
+ state = {k: {"status": "queued", "ok": None, "cost": None, "ran": False, "prs": 0, "secs": None} for k in spec}
500
559
  for k in state:
501
560
  say("backlog: %s queued" % spec[k]["label"])
502
561
  for n, (ok, status) in routed.items(): # in the summary, never in the job queue
503
- state[n] = {"status": status, "ok": ok, "cost": None, "ran": False}
562
+ state[n] = {"status": status, "ok": ok, "cost": None, "ran": False, "prs": 0, "secs": None}
504
563
  pending = list(spec)
505
564
  running = {} # key -> (Popen, log path, worktree)
506
565
  unmeasured = 0
507
-
508
- def stop_children(*_):
509
- for p, _l, _w in running.values():
566
+ t_start = time.time()
567
+ started = {} # key -> launch time
568
+ stop = [] # the signal that asked for a stop: the loop below ends, the children are stopped and the summary still prints
569
+ done_at_signal = set() # children that had already exited when the first signal came: they keep their real result
570
+
571
+ def term_children():
572
+ for k, (p, _l, _w) in list(running.items()):
573
+ if k in done_at_signal:
574
+ continue
510
575
  try:
511
576
  os.killpg(p.pid, signal.SIGTERM)
512
577
  except OSError:
513
578
  pass
514
- sys.exit(130)
515
- signal.signal(signal.SIGTERM, stop_children)
516
- signal.signal(signal.SIGINT, stop_children)
579
+
580
+ def on_signal(signum, _f): # the children are told at once, even while a launch is still preparing a worktree
581
+ if not stop: # before any SIGTERM from us, an exited child finished on its own
582
+ done_at_signal.update(k for k, (p, _l, _w) in list(running.items()) if p.poll() is not None)
583
+ stop.append(signum)
584
+ term_children()
585
+ signal.signal(signal.SIGTERM, on_signal)
586
+ signal.signal(signal.SIGINT, on_signal)
587
+
588
+ def stop_children():
589
+ """SIGTERM every child's process group, give the engine its cancel grace, then SIGKILL what is left."""
590
+ term_children()
591
+ try:
592
+ grace = float(os.environ.get("LOKI_BACKLOG_STOP_GRACE_S") or 30)
593
+ except ValueError:
594
+ grace = 30.0
595
+ deadline = time.time() + grace
596
+ for p, _l, _w in running.values():
597
+ try:
598
+ p.wait(timeout=max(0.1, deadline - time.time()))
599
+ except subprocess.TimeoutExpired:
600
+ try:
601
+ os.killpg(p.pid, signal.SIGKILL)
602
+ except OSError:
603
+ pass
604
+ p.wait()
605
+
606
+ def keep_receipts(k, wt):
607
+ """Copy the run dirs (receipt, events, epic.json, slice receipts) out before the worktree goes."""
608
+ src = os.path.join(wt, ".loki", "runs")
609
+ if spec[k]["unit"] or os.path.islink(src) or not os.path.isdir(src):
610
+ return
611
+ dst = os.path.join(wt_root, "receipts", spec[k]["wt"])
612
+ try:
613
+ if os.path.lexists(dst): # an earlier run's receipts move aside under a dated name, never deleted
614
+ base = "%s.%s" % (dst, time.strftime("%Y%m%d-%H%M%S", time.localtime(os.lstat(dst).st_mtime)))
615
+ aside, i = base, 1
616
+ while os.path.lexists(aside):
617
+ aside, i = "%s-%d" % (base, i), i + 1
618
+ os.rename(dst, aside)
619
+ shutil.copytree(src, dst, symlinks=True, ignore=shutil.ignore_patterns("worktrees", "node_modules"))
620
+ except (OSError, shutil.Error):
621
+ pass
517
622
 
518
623
  def harvest(k, wt):
519
624
  """Copy the newest unit receipt and events into the group dir before the worktree goes."""
@@ -550,9 +655,10 @@ def main(argv):
550
655
  except OSError:
551
656
  pass
552
657
 
553
- def finish(k):
658
+ def finish(k, stopped=False):
554
659
  nonlocal unmeasured
555
660
  p, log, wt = running.pop(k)
661
+ state[k]["secs"] = time.time() - started[k]
556
662
  try:
557
663
  with open(log, errors="replace") as f:
558
664
  text = redact(f.read(), token)
@@ -561,13 +667,16 @@ def main(argv):
561
667
  except OSError:
562
668
  text = ""
563
669
  ok, status, usd = parse_result(p.returncode, text)
670
+ if stopped: # the child was killed mid-run: never read its exit code as the run's verdict
671
+ ok, status = False, "STOPPED: interrupted%s; worktree kept at %s" % (", " + pr_text(text) if pr_text(text) else "", wt)
564
672
  if usd is None:
565
673
  unmeasured += 1
566
674
  else:
567
675
  add_spend(usd)
568
- state[k].update(status=status, ok=ok, cost=usd)
676
+ state[k].update(status=status, ok=ok, cost=usd, prs=pr_count(text))
569
677
  say("backlog: %s %s" % (spec[k]["label"], status))
570
678
  harvest(k, wt)
679
+ keep_receipts(k, wt)
571
680
  if ok:
572
681
  git("worktree", "remove", "--force", wt, cwd=top)
573
682
  if not spec[k]["unit"]: # a passing unit branch is kept for the integrator
@@ -604,8 +713,9 @@ def main(argv):
604
713
  p = subprocess.Popen(s["cmd"], cwd=wt, env=without(dict(child_env, **s["env"]), s.get("drop", ())), stdout=lf,
605
714
  stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL, start_new_session=True)
606
715
  running[k] = (p, log, wt)
716
+ started[k] = time.time()
607
717
  state[k].update(status="running", ran=True)
608
- say("backlog: %s running" % s["label"])
718
+ say("backlog: %s running (log: %s)" % (s["label"], log))
609
719
 
610
720
  def next_ready():
611
721
  """First pending job whose parents all passed; skip jobs whose parent did not."""
@@ -622,10 +732,20 @@ def main(argv):
622
732
  return k
623
733
  return None
624
734
 
625
- while pending or running:
735
+ try:
736
+ beat_s = float(os.environ.get("LOKI_BACKLOG_HEARTBEAT_S") or 120)
737
+ except ValueError:
738
+ beat_s = 120.0
739
+ last_beat = time.time()
740
+ while (pending or running) and not stop:
626
741
  for k in [k for k, (p, _l, _w) in running.items() if p.poll() is not None]:
627
742
  finish(k)
628
- while pending and len(running) < conc:
743
+ if beat_s > 0 and running and time.time() - last_beat >= beat_s:
744
+ last_beat = time.time()
745
+ say("backlog: %d running (%s), %d queued, %d finished, %s elapsed" % (
746
+ len(running), ", ".join("%s %s" % (spec[k]["label"], mins(last_beat - started[k])) for k in running),
747
+ len(pending), sum(1 for k in spec if state[k]["ok"] is not None), mins(last_beat - t_start)))
748
+ while pending and len(running) < conc and not stop:
629
749
  group_spent = sum(st["cost"] or 0 for st in state.values())
630
750
  if group_cap and group_spent >= group_cap:
631
751
  for k in pending:
@@ -654,14 +774,30 @@ def main(argv):
654
774
  if running:
655
775
  time.sleep(0.2)
656
776
 
777
+ if stop:
778
+ say("backlog: interrupted (signal %d); stopping %d running, %d never started" % (stop[0], len(running), len(pending)))
779
+ stop_children()
780
+ for k in list(running):
781
+ finish(k, stopped=k not in done_at_signal)
782
+ for k in pending:
783
+ state[k].update(status="NOT STARTED: interrupted", ok=False)
784
+ pending = []
785
+
657
786
  # ---- summary -----------------------------------------------------------
658
787
  say("")
659
788
  say("Summary: %s" % a.repo)
660
- say("%-14s %-10s %s" % ("ITEM", "COST", "RESULT"))
789
+ say("%-14s %-10s %-6s %s" % ("ITEM", "COST", "TIME", "RESULT"))
661
790
  for n, s in state.items():
662
- say("%-14s %-10s %s" % (spec[n]["label"] if n in spec else labels[n], ("$%.2f" % s["cost"] if s["cost"] is not None else "unmeasured" if s["ran"] else "-"), s["status"]))
791
+ say("%-14s %-10s %-6s %s" % (spec[n]["label"] if n in spec else labels[n], ("$%.2f" % s["cost"] if s["cost"] is not None else "unmeasured" if s["ran"] else "-"),
792
+ mins(s["secs"]) if s["secs"] is not None else "-", s["status"]))
663
793
  measured = sum(s["cost"] or 0 for s in state.values())
664
- say("Total measured cost: $%.2f%s" % (measured, " (%d run(s) unmeasured, not counted as $0)" % unmeasured if unmeasured else ""))
794
+ jobs = [s for n, s in state.items() if n in spec] # routed spec and human issues never run: they are counted apart
795
+ done = sum(1 for s in jobs if s["ok"])
796
+ say("Total: %d done, %d not done%s; %d PR(s); cost $%.2f%s; time %s" % (
797
+ done, len(jobs) - done, ", %d not run (spec or human)" % len(routed) if routed else "", sum(s["prs"] for s in jobs),
798
+ measured, " (%d run(s) unmeasured, not counted as $0)" % unmeasured if unmeasured else "", mins(time.time() - t_start)))
799
+ if stop:
800
+ return 130
665
801
  bad = [s for s in state.values() if not s["ok"]]
666
802
  if not bad:
667
803
  return 0
package/autonomy/loki CHANGED
@@ -14638,7 +14638,7 @@ cmd_backlog() {
14638
14638
  echo " --all Every open issue"
14639
14639
  echo " --label X Open issues with label X"
14640
14640
  echo " --issues 1,2,3 Exactly these issue numbers"
14641
- echo " --concurrency N Max runs in parallel (default: loki.yaml concurrency, else 2)"
14641
+ echo " --concurrency N Max issues in flight (default: loki.yaml concurrency, else 2)"
14642
14642
  echo " --dry-run Print each issue's triage class (implement, spec, human) and reason; launch nothing"
14643
14643
  echo ""
14644
14644
  echo "Run from a checkout of owner/repo (for Jira or Linear, the checkout the work lands in)."
@@ -14648,6 +14648,8 @@ cmd_backlog() {
14648
14648
  echo "human issues are listed with the reason. Label loki:implement|loki:spec|loki:human forces a class;"
14649
14649
  echo "LOKI_TRIAGE=0 runs every issue untriaged."
14650
14650
  echo "Config: loki.yaml (repo root, then ~/.loki/loki.yaml); see docs/loki.yaml.example."
14651
+ echo "Output: one line per state change, each run's own output in <checkout>-backlog/logs, then one row per issue"
14652
+ echo "(cost, time, result, PR) and one Total line (done, not done, PRs, cost, time). Ctrl-C still prints them (exit 130)."
14651
14653
  echo "Exit: 0 every run ended VERIFIED or with a PR (spec and human issues do not fail it); 3 only budget stops; 1 otherwise; 2 usage."
14652
14654
  return 0
14653
14655
  ;;
@@ -25209,7 +25211,7 @@ if (res.valid) {
25209
25211
  return $?
25210
25212
  }
25211
25213
 
25212
- # loki compliance - periodic compliance snapshot (SOC2 / ISO27001 / GDPR).
25214
+ # loki compliance - periodic audit evidence snapshot (three audit-event control mappings).
25213
25215
  # The scheduler is default-disabled (LOKI_COMPLIANCE_SNAPSHOT_INTERVAL_HOURS
25214
25216
  # unset or 0). `loki compliance snapshot` runs the self-rate-limiting check;
25215
25217
  # `--force` generates a snapshot now regardless of interval/elapsed gate.
@@ -25307,7 +25309,8 @@ process.exit(0);
25307
25309
  echo " help Show this help"
25308
25310
  echo ""
25309
25311
  echo "The compliance scheduler is default-disabled. A snapshot bundles the"
25310
- echo "SOC2, ISO27001 and GDPR reports plus the audit chain-integrity verdict"
25312
+ echo "audit evidence reports (three audit-event control mappings, no compliance"
25313
+ echo "claim) plus the audit chain-integrity verdict"
25311
25314
  echo "into .loki/audit/compliance-snapshots/. Enable periodic generation by setting"
25312
25315
  echo "LOKI_COMPLIANCE_SNAPSHOT_INTERVAL_HOURS, or run with --force on demand."
25313
25316
  ;;
@@ -2,8 +2,7 @@
2
2
  # Anonymous usage telemetry for Loki Mode
3
3
  # Collection is ON BY DEFAULT for individual interactive installs, but AUTO-OFF
4
4
  # in enterprise / CI / air-gapped contexts (see _loki_telemetry_auto_off), so
5
- # enterprise + air-gapped deployments stay silent out of the box (GDPR / FedRAMP
6
- # safe). Only anonymous diagnostics are ever sent (os, arch, version, error type,
5
+ # enterprise + air-gapped deployments stay silent out of the box. Only anonymous diagnostics are ever sent (os, arch, version, error type,
7
6
  # sanitized stack signatures); never code, prompts, paths, keys, or repo names.
8
7
  # Opt-out (always wins): LOKI_TELEMETRY=off / LOKI_TELEMETRY_DISABLED=true /
9
8
  # DO_NOT_TRACK=1 / ~/.loki/config: TELEMETRY_DISABLED=true
@@ -7,6 +7,6 @@ Modules:
7
7
  control: Session control helpers (status, atomic writes, origin check)
8
8
  """
9
9
 
10
- __version__ = "11.141.5"
10
+ __version__ = "11.142.0"
11
11
 
12
12
  __all__ = ["__version__"]
@@ -5609,7 +5609,7 @@ async def get_audit_summary(days: int = 7):
5609
5609
  # it always reflects live state -- never a stale cached snapshot.
5610
5610
  #
5611
5611
  # The report is produced by the authoritative Node compliance engine
5612
- # (src/audit/index.js, the single source of truth for SOC2/ISO/GDPR control
5612
+ # (src/audit/index.js, the single source of truth for the audit control
5613
5613
  # mappings) via its `report` CLI shim, so the Python surface never
5614
5614
  # reimplements (and never drifts from) the mapping logic. The chain it reads
5615
5615
  # is the JS AGENT chain at <project>/.loki/audit/audit.jsonl -- a different
@@ -5631,7 +5631,9 @@ def get_compliance_status(request: Request, report_type: str = Query("soc2", ali
5631
5631
  .loki-backed read endpoints; there is no DB tenant_id on a JSONL file
5632
5632
  to enforce against.
5633
5633
 
5634
- Query: ?type=soc2|iso27001|gdpr (default soc2).
5634
+ Query: ?type=<control set id> (one of _COMPLIANCE_TYPES; default the first).
5635
+ The ids are internal names for three audit-event control mappings; the report
5636
+ is an audit evidence report and makes no compliance claim.
5635
5637
 
5636
5638
  Returns the compliance report JSON regenerated from CURRENT audit
5637
5639
  state on every call. If no audit data has been recorded the report is
@@ -2,7 +2,7 @@
2
2
 
3
3
  Collection is ON BY DEFAULT for an ordinary individual install, and AUTO-OFF in
4
4
  enterprise / CI / air-gapped / non-interactive contexts (see _auto_off), so those
5
- deployments stay silent out of the box (GDPR / FedRAMP safe). Only anonymous
5
+ deployments stay silent out of the box. Only anonymous
6
6
  diagnostics are ever sent; never code, prompts, paths, keys, or repo names. The
7
7
  gate mirrors autonomy/telemetry.sh + autonomy/crash.sh exactly.
8
8
 
@@ -1,6 +1,6 @@
1
1
  # CLI reference
2
2
 
3
- Generated from `loki-ts/src/cli/registry.ts` by `scripts/generate-stale-zero.sh` for v11.141.5. Do not edit by hand.
3
+ Generated from `loki-ts/src/cli/registry.ts` by `scripts/generate-stale-zero.sh` for v11.142.0. Do not edit by hand.
4
4
  Hidden and legacy-only commands are omitted; see `docs/CLI-INVENTORY.md` for the full inventory.
5
5
 
6
6
  | Command | Description |
@@ -2,7 +2,7 @@
2
2
 
3
3
  Loki Mode, by [Autonomi](https://www.autonomi.dev/), turns a spec or an issue into a verified pull request with a receipt you can check. This page covers installing it, a first run, and the options around it.
4
4
 
5
- **Version:** v11.141.5
5
+ **Version:** v11.142.0
6
6
 
7
7
  **Engine note:** `loki start` is the primary command. `loki start`, `loki "<task>"`, `loki owner/repo#N` and `loki quick` all run the Loki 10 engine, whatever the flag order or input form (PRD file, issue ref, task or one-word brief). The previous loop runs only on `--engine legacy`, `LOKI_ENGINE=legacy`, or for one call when a flag Loki 10 cannot honor is present. See the [user guide](v10/GUIDE.md) and the [5-minute quickstart](QUICKSTART.md).
8
8
 
@@ -171,6 +171,7 @@ These knobs together implement the RARV-C (closure) loop: findings -> override c
171
171
  - `LOKI_E10_INTAKE_CAP_S` -- off by default since acc-148 (unset, `0` or a non-number keeps the per-command caps alone); a positive number of seconds turns the shared budget on. When on and it cuts a baseline, intake prints one line starting `loki: intake budget spent after N s` (`repo_profile.ts` intakeBudgetNote). Turned off because it had no measured accuracy benefit and cut 6 of 65 past baselines (a complete 196 s gitea suite among them), and a cut baseline is unattributable base red. (R3; `loki-ts/src/runner/repo_profile.ts` intakeCapS / baselineSuites `deadlineMs`, wired in `stages/intake.ts` and `project_model/install.ts` intakeDeps). One budget in seconds for all of intake's baseline test runs together: the root baseline, its rerun after an install, and the per-suite baselines. A run the budget cuts is recorded as cut off, and a suite with no budget left reads "baseline budget used up", as before. The dependency install keeps its own cap (INSTALL_CAP_MS) and is not counted. The failure: a suite past the 300 s per-command cap was measured twice under two names, so intake spent 600 s on two cut-off runs that excuse nothing. Of 65 recorded bench baselines, 6 took over 180 s in all; 1 of them (195.8 s root, 219.2 s suite) completed and would now be cut.
172
172
  - `LOKI_E10_MOCHA_TARGETED` -- on by default, `0` opts out (R5; `loki-ts/src/engine10/testmap.ts` mochaTargets, used by `stages/verify.ts`). When verify selects no test at all, a changed JS/TS file whose nearest package.json declares mocha (a dependency, a script, a `mocha` key, or a .mocharc file beside it) maps to its own test file: itself under the package's test/, tests/ or spec/ directory (fixtures excluded), else the file at the same path under one of them (with or without the source's first directory). At most 8, each run as `npx --no-install mocha <file>` (runner `mocha`, which runner detection never lists) through the normal test path, so base subtraction and the flaky rerun apply and a passing one covers its source. Mocha test files carry no .test or .spec suffix, so such a repo verified with no test at all.
173
173
  - `LOKI_E10_BASE_RED_SHAPE` -- on by default, `0` opts out (acc-147; `loki-ts/src/runner/repo_profile.ts` sameUnattributableRed inside attributeFullSuite, `loki-ts/src/util/check_result.ts` failureShape). The intake baseline records the output shape of a base suite that is red with no parseable failing ids (`failing_shape`). A head full suite of the same command is pre-existing only when it fails in the identical kind: the same exit code, no parseable ids, and the same shape (whole output, only durations, clock times, timestamps and hex addresses normalized). A newly broken test, a different message or count, or another exit code stays introduced. The excuse is disclosed on NOT PROVEN. Dev corpus 2026-11-13: 4 of 24 runs ended FAILED with fix rounds chasing such a suite ("the base run is not attributable").
174
+ - `LOKI_E10_BACKSTOP_SEAL` -- on by default, `0` opts out (`loki-ts/src/engine10/supervisor.ts` after the first worker; `worker.ts` LOKI_E10_SEAL_ONLY; `stages/seal.ts` sealOnlyPass). A worker the backstop killed before it sealed gets one seal pass: a resumed worker runs only commit and seal, bounded by min(45 s, ceiling + 25 s - elapsed) and skipped below 10 s. The receipt is never VERIFIED and carries the time-ran-out NOT PROVEN line. `LOKI_E10_TEST_BLOCK_AFTER_SESSION_MS` is a test-only hook that blocks the worker's event loop after its implement session.
174
175
  - `LOKI_RUN_DEADLINE_S` -- unset by default (off); a number of seconds turns it on (`loki-ts/src/util/run_cap.ts` deadlineCapS, used by resolveRunCapS and, for deep runs, the supervisor). The run cap is fixed at the deadline minus the process's uptime minus 30 s (at least 60 s), and never above another fixed cap, so the soft cap seals before the deadline.
175
176
  - `LOKI_E10_TIMEOUT_CARRY` -- on by default, `0` opts out (`loki-ts/src/engine10/stages/verify.ts` carriedTimeouts in runTests). A test check that timed out in the previous verify of the run, in a file the change did not touch and not a Wall, task-named or held-out check, is carried as not_run instead of rerun. Separately, runOnce SIGKILLs a check KILL_AFTER_MS (5 s) after its timeout or abort.
176
177
  - `LOKI_E10_WATCHDOG_SILENT_S` -- 120 by default, `0` turns it off (`loki-ts/src/engine10/supervisor.ts` silenceWatch, descendantNames, on the supervisor's 15 s alive beat). After that many seconds with no worker event, the supervisor appends `watchdog.silent` {silent_s, last_event, processes} (executable basenames under the supervisor, no arguments), again each further interval of silence.
@@ -230,6 +231,8 @@ These knobs together implement the RARV-C (closure) loop: findings -> override c
230
231
 
231
232
  `prepare_worktree(source_repo, dest, branch, setup=None, base=None)` creates an isolated git worktree and returns `{path, base_sha, deps, left_out_changes, deps_skipped}`. The start point is `origin/HEAD` after a fetch (when a remote exists), else HEAD. Uncommitted edits in the source checkout are never carried or stashed; their count is reported as `left_out_changes`. An fcntl lock at `~/.loki/repos/<slug>.lock` covers fetch and worktree add. Dependencies: a `setup` command run in the worktree, else a copy-on-write copy of ignored top-level `node_modules`, `.venv`, `venv`, `vendor` (a dir holding absolute symlinks or editable finders is never copied: it (or whose copy fails, with the partial copy removed) is left out, named in `deps_skipped`, `deps` is `skipped`, and the session installs it; a declared `setup` still fails hard), else `none`. CLI: `python3 autonomy/lib/worktree_prep.py SRC DEST BRANCH [--setup CMD] [--base REF]` prints the result as JSON. Callers: `autonomy/lib/backlog.py` (logs skipped deps), `autonomy/lib/workspace.py` (passes the entry `setup`) and `dashboard/api_start.py`.
232
233
 
234
+ `loki backlog` uses it for every issue worktree (`<checkout>-backlog/issue-N`, logs in `<checkout>-backlog/logs`, kept receipts in `<checkout>-backlog/receipts`). Testing aid: `LOKI_BACKLOG_LOCAL_ORIGIN=1` (off by default) lets `loki backlog` run from a checkout whose origin is an absolute path to a local bare repository, so a rehearsal's branches and PRs go to that bare repository while the run still uses GitHub for the issue itself; any URL or non-bare path keeps the refusal.
235
+
233
236
  ## Project memory across runs
234
237
 
235
238
  extract_learnings_from_session (autonomy/run.sh) mirrors learnings and decisions into .loki/memory/learnings/project-*.jsonl. get_relevant_learnings adds a bounded newest-first project_memory list (15 entries, LOKI_PROJECT_MEMORY_MAX_CHARS, default 2000) to .loki/state/relevant-learnings.json at run start. LOKI_PROJECT_MEMORY=0 disables both.
package/docs/v10/GUIDE.md CHANGED
@@ -409,9 +409,11 @@ on:
409
409
 
410
410
  `loki backlog` also takes `--all`, `--issues 1,2,3` and `--dry-run`, and `jira:PROJ` or `linear:TEAM` in place of `owner/repo` to work a Jira project or Linear team the same way (see [Jira and Linear intake](../trackers.md)). The nightly job runs the agent and a write token together, so label only issues you trust.
411
411
 
412
+ While it runs, `loki backlog` prints one line per state change (queued, running with the path of that issue's log, the result) and a short line every two minutes naming what is still running (`LOKI_BACKLOG_HEARTBEAT_S` changes the interval, `0` turns it off). Each run's own output goes to its log under `<checkout>-backlog/logs`, never to the terminal. At the end it prints one row per issue (cost, time, result and its pull request) and one `Total:` line: issues done, not done, pull requests, cost and time. An issue that ended in more than one pull request says how many and why. Ctrl-C or a job time limit (SIGTERM) stops the runs and still prints the rows and the total (exit 130). Receipts of a finished run are kept under `<checkout>-backlog/receipts`.
413
+
412
414
  Before anything runs, `loki backlog` triages every issue into one of three classes, each printed with a one-line reason (`--dry-run` prints only this and launches nothing):
413
415
 
414
- - `implement`: a concrete target (a file, function, value or expected result), or a large issue. Only these run. Large has one definition, the same one `loki start owner/repo#N` uses: an epic label (`epic`, `umbrella`, `tracking` or `meta`), or at least two of 4 or more solution parts, 4 or more acceptance criteria, and both a backend and a frontend named. A large issue is split into slices that each run on their own (the reason says `runs split into slices`). Slices that do not depend on each other run at the same time (up to 4; `LOKI_EPIC_PARALLEL=1` runs them one at a time), and a slice that fails or reports a spec conflict skips only the slices built on it. Each slice opens its own draft pull request, stacked on the slice it depends on.
416
+ - `implement`: a concrete target (a file, function, value or expected result), or a large issue. Only these run. Large has one definition, the same one `loki start owner/repo#N` uses: an epic label (`epic`, `umbrella`, `tracking` or `meta`), or at least two of 4 or more solution parts, 4 or more acceptance criteria, and both a backend and a frontend named. A large issue is split into slices that each run on their own (the reason says `runs split into slices`). Slices that do not depend on each other run at the same time (up to 4; `LOKI_EPIC_PARALLEL=1` runs them one at a time), and a slice that fails or reports a spec conflict skips only the slices built on it. The issue normally ends in one pull request, with one commit per slice. A slice that conflicts and cannot be resolved, with the slices built on it, opens its own pull request; a refused push or a combined diff over `LOKI_SPLIT_ONE_PR_MAX_FILES` files (default 150) opens one pull request per slice instead, and the summary row says how many and why (`LOKI_SPLIT_ONE_PR=0` always opens one per slice).
415
417
  - `spec`: vague or ambiguous (no concrete target named, or an ambiguity score at the threshold). Loki drafts `.loki/specs/<slug>.md` with `loki plan --spec`, runs nothing, and prints `loki start --spec .loki/specs/<slug>.md` to run after you edit or approve it.
416
418
  - `human`: the issue touches secrets, production or a destructive operation. Never run headless; listed with the reason. Repos without tests, UI work and infra work still run: Loki writes its own tests and verifies once at the end.
417
419