loki-mode 11.141.6 → 11.143.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.
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/agents/types.json +3 -3
- package/autonomy/lib/backlog.py +157 -21
- package/autonomy/loki +7 -4
- package/autonomy/telemetry.sh +1 -2
- package/dashboard/__init__.py +1 -1
- package/dashboard/server.py +4 -2
- package/dashboard/telemetry.py +1 -1
- package/docs/CLI-REFERENCE.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/dev/architecture-reference.md +5 -0
- package/docs/environment-variables.md +3 -1
- package/docs/v10/GUIDE.md +3 -1
- package/loki-ts/dist/loki.js +1789 -1785
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +336 -152
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/references/agent-types.md +3 -3
- package/references/business-ops.md +2 -2
- package/references/cursor-learnings.md +1 -1
- package/scripts/verify-pr-sandbox.sh +1 -1
- package/skills/agents.md +2 -2
- package/skills/github-integration.md +6 -0
- package/skills/model-selection.md +2 -2
- package/src/audit/compliance.js +11 -11
- package/web-app/dist/assets/{AdminPage-i9PHmMPD.js → AdminPage-Bfyaout3.js} +1 -1
- package/web-app/dist/assets/{Avatar-D_6q3v1s.js → Avatar-B4M87e2A.js} +1 -1
- package/web-app/dist/assets/{Badge-OB8s72yd.js → Badge-BdWo4Pis.js} +1 -1
- package/web-app/dist/assets/{Button-DrmV9ik6.js → Button-ga7zrGds.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-DJrzZLPZ.js → CockpitPage-BCPdCf3y.js} +1 -1
- package/web-app/dist/assets/{ComparePage-CPClwQTQ.js → ComparePage-ei74A2H-.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-EA1o3dOi.js → ErrorBoundary-DOksQdek.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-CPUmEtva.js → EvidenceReceiptPanel-BejiJCuC.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-ED2faRlk.js → GitHubIssuesPanel-B4SLdG6W.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-Bclc5nd2.js → GitHubPRsPanel-DUfmJ8-D.js} +1 -1
- package/web-app/dist/assets/{HomePage-Bv3f7LxZ.js → HomePage-DLOrsiAX.js} +2 -2
- package/web-app/dist/assets/{LoginPage-BTFpc_0h.js → LoginPage-CYX6EhD1.js} +1 -1
- package/web-app/dist/assets/{MagicPage-D6qauYXz.js → MagicPage-B9V-H8rJ.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-DZfxKmxi.js → MetricsPage-DxR4dA3v.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-C-ZQu1UW.js → NotFoundPage-62GUMrsu.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-CRFiZLSc.js → ProjectPage-aRlMvuO3.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-BavFLKKb.js → ProjectsPage-DlsVYWSU.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-zfZDQjF-.js → SettingsPage-CYBOAzSl.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-DlHcRnXc.js → ShowcasePage-Cp9h_ikU.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-pFanwBec.js → SystemSettingsPage-Bi8O5KM1.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-BLevzZIc.js → TeamsPage-CvKAy4VC.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-ylTIFbRI.js → TemplatesPage-DgZ8R3cj.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-CubbKVIZ.js → TerminalOutput-BXzQQ3ao.js} +1 -1
- package/web-app/dist/assets/{activity-CAWSp_6M.js → activity-wbwzJg71.js} +1 -1
- package/web-app/dist/assets/{bell-jGlMrpVq.js → bell-CU-k59mu.js} +1 -1
- package/web-app/dist/assets/{bot-2hTcA-8p.js → bot-nRo4H6pJ.js} +1 -1
- package/web-app/dist/assets/{check-D80eIYDT.js → check-BsSag1UJ.js} +1 -1
- package/web-app/dist/assets/{chevron-left-CnH2CR-8.js → chevron-left-CZr4us96.js} +1 -1
- package/web-app/dist/assets/{circle-alert-C7oUl8Ek.js → circle-alert-C2EwgqPt.js} +1 -1
- package/web-app/dist/assets/{clock-DOzHiqGs.js → clock-B1jzN_2i.js} +1 -1
- package/web-app/dist/assets/{cloud-FSE-P1Jp.js → cloud-Bmbi0qzP.js} +1 -1
- package/web-app/dist/assets/{code-xml-CJnb9wRC.js → code-xml-VGyACVgD.js} +1 -1
- package/web-app/dist/assets/{database-aawTQ1Q7.js → database-CWmwrahT.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-FvH5JFJr.js → dollar-sign-CTuJpB-U.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-f13oHQ3O.js → file-code-corner-CEKoA1FQ.js} +1 -1
- package/web-app/dist/assets/{file-plus-iOo8cPnc.js → file-plus-wJZDaswJ.js} +1 -1
- package/web-app/dist/assets/{globe-DQ9k16nT.js → globe-CWQQ1FMq.js} +1 -1
- package/web-app/dist/assets/{hammer-BS6OgHCv.js → hammer-CGzn_YVi.js} +1 -1
- package/web-app/dist/assets/{index-D9_qIW5t.js → index-D7HK6vkd.js} +3 -3
- package/web-app/dist/assets/{layers-DkgEg5Ww.js → layers-Db1BfC4Q.js} +1 -1
- package/web-app/dist/assets/{loader-circle-DkjkYuPZ.js → loader-circle-C0gn8jcq.js} +1 -1
- package/web-app/dist/assets/{lock-C6YNAGAd.js → lock-wrIkF7MN.js} +1 -1
- package/web-app/dist/assets/{package-EMz5m_kz.js → package-DhSgTaXb.js} +1 -1
- package/web-app/dist/assets/{plus-ALTNaQeY.js → plus-CdbYe7om.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-CHtVqI4m.js → refresh-cw-JNwtW3Ws.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-C70B3mg2.js → rotate-ccw-Dld_mqp3.js} +1 -1
- package/web-app/dist/assets/{scroll-text-BKIkCUal.js → scroll-text-DWs72mdn.js} +1 -1
- package/web-app/dist/assets/{server-DVlrE-zu.js → server-CucPfvl_.js} +1 -1
- package/web-app/dist/assets/{shield-alert-DNcGRK6A.js → shield-alert-D3IjFaYW.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-DPAOjRCj.js → thumbs-up-CHz4RJSh.js} +1 -1
- package/web-app/dist/assets/{trash-2-CLgQfWQK.js → trash-2-B6cfWy3k.js} +1 -1
- package/web-app/dist/assets/{trending-down-C_C7_So6.js → trending-down-CfrEdZcD.js} +1 -1
- package/web-app/dist/assets/{trending-up-D_L2MWc2.js → trending-up-Dn4jQ0v5.js} +1 -1
- package/web-app/dist/assets/{upload-_qHiSlwI.js → upload-BIHmbeaS.js} +1 -1
- package/web-app/dist/assets/{usePolling-z23loSZm.js → usePolling-BpfFN5gC.js} +1 -1
- package/web-app/dist/assets/{user-BeGvNcEy.js → user--rB-Jk_0.js} +1 -1
- 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.
|
|
6
|
+
# Loki Mode v11.143.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.
|
|
464
|
+
**v11.143.0 | [Autonomi](https://www.autonomi.dev/) flagship product | core skill**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
11.
|
|
1
|
+
11.143.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
|
|
127
|
-
"focus": ["
|
|
128
|
-
"capabilities": "
|
|
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",
|
package/autonomy/lib/backlog.py
CHANGED
|
@@ -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 =
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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
|
|
|
@@ -424,7 +483,7 @@ def main(argv):
|
|
|
424
483
|
say("backlog: %s %-9s %s | %s" % (i["label"], c, i["title"], why))
|
|
425
484
|
if a.dry_run:
|
|
426
485
|
n_of = lambda c: sum(1 for i in issues if klass[i["key"]][0] == c) # noqa: E731
|
|
427
|
-
n_large = sum(1 for i in issues if i["split"] and klass[i["key"]][0] == "implement" and klass[i["key"]][1].
|
|
486
|
+
n_large = sum(1 for i in issues if i["split"] and klass[i["key"]][0] == "implement" and klass[i["key"]][1].endswith("runs split into slices")) # WHOLE-FIRST: only a reason that says so counts
|
|
428
487
|
if issues:
|
|
429
488
|
say("backlog: dry run: %d would run%s, %d would get a drafted spec, %d need a human; nothing launched"
|
|
430
489
|
% (n_of("implement"), " (%d split into slices)" % n_large if n_large else "", n_of("spec"), n_of("human")))
|
|
@@ -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
|
-
|
|
509
|
-
|
|
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
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 "-"),
|
|
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
|
-
|
|
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,16 +14638,18 @@ 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
|
|
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)."
|
|
14645
14645
|
echo "Each issue runs in its own worktree on loki/backlog-N. Jira and Linear use the credentials in docs/trackers.md."
|
|
14646
|
-
echo "Triage: implement issues run
|
|
14646
|
+
echo "Triage: implement issues run; a large one runs as one whole-issue run on Sonnet and stronger models, split into slices on Haiku;"
|
|
14647
14647
|
echo "vague or ambiguous (spec) issues get .loki/specs/<slug>.md and the command to run it;"
|
|
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
|
|
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 "
|
|
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
|
;;
|
package/autonomy/telemetry.sh
CHANGED
|
@@ -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 (
|
|
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
|
package/dashboard/__init__.py
CHANGED
package/dashboard/server.py
CHANGED
|
@@ -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
|
|
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
|
|
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
|
package/dashboard/telemetry.py
CHANGED
|
@@ -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
|
|
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
|
|
package/docs/CLI-REFERENCE.md
CHANGED
|
@@ -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.
|
|
3
|
+
Generated from `loki-ts/src/cli/registry.ts` by `scripts/generate-stale-zero.sh` for v11.143.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 |
|
package/docs/INSTALLATION.md
CHANGED
|
@@ -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.
|
|
5
|
+
**Version:** v11.143.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
|
|
|
@@ -191,6 +191,9 @@ These knobs together implement the RARV-C (closure) loop: findings -> override c
|
|
|
191
191
|
- `LOKI_E10_LINT_MISSING_DISCLOSE` -- on by default, `0` opts out (acc-150; `loki-ts/src/engine10/stages/verify.ts` lintFallbacks in runLintChecks, `stages/seal.ts` missingLintChecks). When ruff cannot be started, verify retries it the way the repo's own tooling would without a global install: `uvx ruff`, then the repo virtualenv's `python -m ruff`. A lint check (`lint:*`) whose tool still could not be started (skip_code `tool_not_on_path`) leaves the verdict inputs and is disclosed as "linter not installed, not run (disclosed, does not cap)". A linter that runs and reports violations still caps, and a missing test runner is never disclosed this way.
|
|
192
192
|
- `LOKI_E10_PROOF_COMPILED_BUDGET` -- on by default, `0` opts out (acc-152; `loki-ts/src/util/mutation_proof.ts` proofBudgetS / warmGoBuild). The fail-then-pass proof of a compiled stack (go, cargo, maven, gradle, javac, dotnet tests) gets the 40 s cap (MAX_TOTAL_S, inside seal's 60 s limit) by default instead of 30 s. An explicit LOKI_MUTATION_PROOF_TIMEOUT_S or caller budget still wins. For go, the base worktree's test packages are compiled once (`go test -run ^$ -count=1 ./<pkg>`, no test runs) inside the same deadline before the timed runs. It only grants time; what counts as proof is unchanged. Before it, go-chi/chi's cold go build took 32 s of the 30 s budget and a real fail-then-pass read "inconclusive (timeout)".
|
|
193
193
|
- `LOKI_E10_NAMED_EXACT` -- on by default, `0` opts out (acc-154; `loki-ts/src/engine10/sizing.ts` namedFiles, used by sizing and by verify's task-named tests). A basename every mention of which sits inside a spelled path names only the files those paths spell, even when the spelled file does not exist yet. A bare mention ("fix page.tsx") keeps naming every file with that basename. Before it, FireLater#24's task spelled `.../search/page.tsx` and named all 54 `page.tsx` files and 46 `page.test.tsx` files in the repo.
|
|
194
|
+
- `LOKI_RERUN_GUARD` -- on by default, `0` opts out (Q1 F4; `loki-ts/src/commands/issues_run.ts` openLokiPrGuard, called by `engine10/supervisor.ts` right after the issue fetch, before startIssueEpic and any session). It lists the open pull requests with the same `gh pr list` and coveredIssues rule `loki issues run` dedupes by, and stops (exit 2) when one whose head is a `loki/` branch owned by the origin's owner covers the issue. A list that cannot be read stops the run (fail closed). It is skipped with `--no-pr`, when gh is not ready (publish already falls back to no PR) and when the origin is not a GitHub remote: a local mirror publishes `local://` branches, so no GitHub pull request can be duplicated and the hermetic tests and local-mirror runs are unaffected. It never writes to the pull request.
|
|
195
|
+
- `LOKI_E10_CONTINUE_MAX` (default 4, `0` turns the resume off, at most 10) and `LOKI_E10_CONTINUE_MAX_USD` (default 1.00) -- Q1 S1b, claude provider only (CLI and SDK routes; opencode is unchanged). `loki-ts/src/engine10/session.ts` finishLineOf sets `markers.finishLine` from the last non-empty line of a session's final text (a literal `LOKI_DONE`, `LOKI_ALREADY_DONE:` or `LOKI_SPEC_CONFLICT:` line; a finish line quoted earlier or any other `LOKI_` token is not one); `markers.done` and its readers are unchanged. An implement session without a finish line is resumed in the same session through resumeWith (`util/conflict_resume.ts` resumeToFinish, suffix `-k<n>`), before the follow-up gates and the `-rv` turn, while each resume changes the tree (anti_loop.ts treeFingerprint), RESUME_MIN_LEFT_S holds, the count is under LOKI_E10_CONTINUE_MAX and the run's measured spend is under LOKI_E10_CONTINUE_MAX_USD (unmeasured spend, as on the CLI invoker, leaves only the count). The brief says the summary request is over, quotes the reply's last lines, names plan-scope files not in the tree and ends with FINISH_LINE. Each resume emits `s1b.resumed` {resume, iteration_id, compactions, finish_line}. A session still unfinished gets implement exit `incomplete`: no follow-up gate runs on it, the diff and the PR are kept, and seal adds `implement ended without a finish line (<why> after <n> resumes): <outstanding>` to the open notes, which caps VERIFIED at PARTIAL. The implement record carries `finish` {continues, ended, outstanding, spent_usd, compactions} only when S1b fired; compactions come from the SDK stream's system/compact_boundary (sdk_stream_parser.ts) and are null on the CLI route. Each resume is a new query, so the Haiku session caps (effort_policy.ts: implement 45 turns, 160K new tokens) start from zero per resume.
|
|
196
|
+
- `LOKI_ISSUE_WHOLE_FIRST` -- unset: on for Sonnet and stronger models, off for a run that implements on Haiku (`loki-ts/src/util/claude_model.ts` haikuRun; LOKI_ROUTER=1, whose plan may route implement to Haiku later, is not covered); `1` forces it on any model, `0` opts out (Q1 S1; `loki-ts/src/features/decompose.ts` issueWholeFirst, read by `engine10/supervisor.ts` before startIssueEpic and by `features/triage.ts`). An issue run from `loki start owner/repo#N` (so also every `loki backlog` and `loki issues run` child) never asks for the up-front MASS-2 split: the issue runs as one whole-issue run on the same path `LOKI_UNIT_ID=whole` took (sized as before, plan kept for a large issue, Wall off by default). `0` restores the split. The per-model rule lives in issueWholeFirst.
|
|
194
197
|
- `LOKI_E10_OWN_BY_PATH` -- on by default, `0` restores collateralTests' stem rule (acc-154; `loki-ts/src/engine10/stages/verify.ts` ownTests). Of the relevant tests (always selected, A-114), the task's own (never excused as red on base, and the ones that decide a quick verify, `keep`, `targets0`, `targetNames`) are only a test file the task names, or a test path-paired with a named non-test file the diff changed: the same covered stem, in that file's directory or its `__tests__`, `tests` or `test` subdirectory. A named file the diff did not edit is a reference, so its tests are collateral (base comparison, COLLATERAL_RED cap). Before it, a named `X/page.tsx`, or a reference "is not modified" or "following the pattern in", made every same-stem test in the repo the task's own (FireLater#24).
|
|
195
198
|
- `LOKI_E10_TOUCHED_BASE_RED` -- on by default, `0` opts out (acc-154; `loki-ts/src/runner/repo_profile.ts` touchedRedOnBase, `stages/verify.ts` editedTestTitles). A test file the diff edited is excused (pre_red, never decisive, disclosed on the receipt's baseline line, never a cap) only when the environment is as intake left it (envChangedSince), every comparable failing id is red in the intake profile of this exact base commit with the same error lines, and no failing id is a case the diff added or whose body it edited (a changed line counts as editing the case above it only when it sits deeper than that case's title, so a top-level import edits none). A previously green id that now fails, a new error under an old id, or a failing added or edited case keeps it blocking. Before it, FireLater#24's one added assertion in a Sidebar.test.tsx with 19 base-red tests made the whole file the slice's failure.
|
|
196
199
|
- `LOKI_E10_COLLATERAL_BASELINE` -- on by default, `0` opts out (acc-154, fix D; `loki-ts/src/runner/repo_profile.ts` collateralOnBaseline, `stages/verify.ts`). A collateral test (relevant, not the task's own) is pre-existing at once, with no COLLATERAL_RED cap and no fix round, only when the environment is as intake left it, the test file is unedited, no changed file is its path-paired source, and every comparable failing id with its error lines equals this base commit's intake profile. A changed paired source, a new failing id, or the same id with another error keeps the cap and the fix round. Before it, FireLater#24's collateral page tests cost a fix round each slice and capped VERIFIED although they matched base exactly.
|
|
@@ -231,6 +234,8 @@ These knobs together implement the RARV-C (closure) loop: findings -> override c
|
|
|
231
234
|
|
|
232
235
|
`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`.
|
|
233
236
|
|
|
237
|
+
`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.
|
|
238
|
+
|
|
234
239
|
## Project memory across runs
|
|
235
240
|
|
|
236
241
|
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.
|
|
@@ -28,7 +28,9 @@ with nowhere to look them up.
|
|
|
28
28
|
| `LOKI_AUTO_CONFIRM` | unset | `true`/`false` to control prompts. Takes precedence over `CI`. |
|
|
29
29
|
| `LOKI_CONFIG_DUMP` | `0` | `1` prints the resolved configuration and exits **without starting a run or spending anything**. |
|
|
30
30
|
| `LOKI_KEEP_RUN_BRANCH` | unset | When a Loki 10 run ends, Loki returns your checkout to the branch you started from (only when it has no uncommitted changes; otherwise it prints how to return), removes the run's leftover temporary worktrees, and deletes the `loki/e10-*` run branch. A branch that was pushed is simply deleted; an unpushed one is first saved as a git bundle in `.loki/runs/<run-id>/branch.bundle` (with `branch.json` holding the branch name and head SHA), and the summary prints the restore command `git fetch .loki/runs/<run-id>/branch.bundle <branch>:<branch>`. If the bundle cannot be written, the branch is kept. Run branches left by earlier runs are saved and removed the same way at the end of the next run (bundles without a run directory go to `.loki/runs/legacy-branches/`). A run that passed but published nothing (no remote, or `--no-pr`) keeps its branch checked out, a run you can still resume keeps its branch, and a live run's branch or a branch checked out in any worktree is never touched; branches not named `loki/e10-*` are never touched. `1` turns all of this off and keeps every run branch, as before. Independently of this setting, session id files are written in the run directory instead of loose in `.loki/`, and the next run moves older loose ones there. |
|
|
31
|
-
| `
|
|
31
|
+
| `LOKI_RERUN_GUARD` | `1` | Before any model call, `loki start owner/repo#N` stops when an open Loki pull request from the same owner already covers the issue, and prints its URL. It never closes, edits or comments on that pull request. If the open pull requests cannot be listed it stops too. Skipped with `--no-pr` and when the origin is not on GitHub (a local mirror). `0` starts the run anyway. |
|
|
32
|
+
| `LOKI_ISSUE_WHOLE_FIRST` | unset (on for Sonnet and stronger models, off on Haiku) | `loki start owner/repo#N` (and the runs `loki backlog` and `loki issues run` start) runs the issue as one whole-issue run and never splits it up front, whatever its size, on Sonnet and stronger models. A run that implements on Haiku (`--session-model haiku` or `small`, `--haiku`, a Haiku model override) keeps the up-front split of a large issue. `1` forces the whole-issue run on any model; `0` restores the split everywhere. Sizing, the plan and the checks are unchanged. |
|
|
33
|
+
| `LOKI_EPIC_PARALLEL` | provider slots, at most 4 (claude 4, opencode 1) | How many slices of a split issue (`loki start owner/repo#N` on a large issue under `LOKI_ISSUE_WHOLE_FIRST=0`) run at once. Slices with no dependency run at the same time, each in its own worktree; a slice that depends on another waits for it and starts on its branch. `1` runs them one at a time. A failing or spec-conflicting slice skips only the slices that depend on it. Slices share one `--max-cost` cap, which can be passed by up to (slices in flight - 1) session costs because each running session sees the cap at its next cost event. |
|
|
32
34
|
| `LOKI_SPLIT_ONE_PR` | `1` | A split issue ends in ONE pull request for the issue, not one per slice. Each slice still runs and verifies on its own branch; at the end Loki builds `loki/<issue>-combined` from the issue's base, one commit per slice (`<slice id>: <slice title>`) in dependency order, reruns every slice's sealed tests plus the tests the combined change impacts, seals one combined receipt that lists each slice's verdict (the combined verdict is the weakest slice's, lowered by anything the combined tree breaks), and opens one PR with a section per slice. A merge conflict between slices gets one resolve session; if it still conflicts, that slice (and the slices stacked on it) opens its own PR and the `Combined:` line says why. `0` opens one PR per slice, as before. |
|
|
33
35
|
| `LOKI_SPLIT_ONE_PR_MAX_FILES` | `150` | When the combined diff of a split issue touches more files than this, the slices open one PR each instead of one combined PR, and the reason is printed. |
|
|
34
36
|
| `LOKI_SPLIT_MAX_SLICES` | `8` | The most slices one split may have (at least 2, at most 32). A split over the cap is re-asked once with the limit. |
|
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.
|
|
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 runs as one whole-issue run on Sonnet and stronger models (the reason says `runs as one run`). On a run that implements on Haiku, and with `LOKI_ISSUE_WHOLE_FIRST=0`, it is split up front into slices that each run on their own (the reason then 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
|
|