loki-mode 11.119.0 → 11.120.1

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 (89) hide show
  1. package/SKILL.md +4 -13
  2. package/VERSION +1 -1
  3. package/autonomy/completion-council.sh +3 -4
  4. package/autonomy/lib/backlog.py +107 -37
  5. package/autonomy/lib/contract-scaffold/README.md +2 -2
  6. package/autonomy/lib/proof-generator.py +1 -2
  7. package/autonomy/lib/scaffold-hook.sh +3 -7
  8. package/autonomy/loki +5 -3
  9. package/autonomy/notification-checker.py +2 -2
  10. package/autonomy/run.sh +28 -57
  11. package/dashboard/__init__.py +1 -1
  12. package/dashboard/api_v2.py +1 -1
  13. package/docs/ARCHITECTURE.md +4 -4
  14. package/docs/CLI-REFERENCE.md +1 -1
  15. package/docs/COMPONENTS.md +1 -3
  16. package/docs/INSTALLATION.md +1 -1
  17. package/docs/dev/architecture-reference.md +8 -12
  18. package/docs/trackers.md +12 -0
  19. package/docs/v10/GUIDE.md +3 -3
  20. package/loki-ts/data/child-env.json +2 -2
  21. package/loki-ts/data/finding-schema.json +2 -2
  22. package/loki-ts/dist/loki.js +1526 -1516
  23. package/mcp/__init__.py +1 -1
  24. package/mcp/lsp_proxy.py +3 -3
  25. package/package.json +2 -2
  26. package/packages/control-plane/dist/server.js +4947 -4750
  27. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  28. package/skills/model-selection.md +1 -1
  29. package/skills/quality-gates.md +8 -38
  30. package/skills/testing.md +1 -1
  31. package/skills/troubleshooting.md +0 -1
  32. package/tools/calibration-audit.py +1 -1
  33. package/web-app/dist/assets/{AdminPage-BI9sK7Ww.js → AdminPage-CSwrd2UA.js} +1 -1
  34. package/web-app/dist/assets/{Avatar-CqStW3hh.js → Avatar-B6SmKtXt.js} +1 -1
  35. package/web-app/dist/assets/{Badge-Sqo523qW.js → Badge-CR4U3l95.js} +1 -1
  36. package/web-app/dist/assets/{Button-65BGFYzo.js → Button-DmcHmlo6.js} +1 -1
  37. package/web-app/dist/assets/{CockpitPage-DLppS7i4.js → CockpitPage-CR_GmqRg.js} +1 -1
  38. package/web-app/dist/assets/{ComparePage-y-To7RDW.js → ComparePage-DH9gwrob.js} +1 -1
  39. package/web-app/dist/assets/{ErrorBoundary-BRfjLxKD.js → ErrorBoundary-23WE8Kb8.js} +1 -1
  40. package/web-app/dist/assets/{EvidenceReceiptPanel-BZYXpZlj.js → EvidenceReceiptPanel-dFODI74J.js} +1 -1
  41. package/web-app/dist/assets/{GitHubIssuesPanel-D5VQeqef.js → GitHubIssuesPanel-CudHcPXf.js} +1 -1
  42. package/web-app/dist/assets/{GitHubPRsPanel-B-ZTugBP.js → GitHubPRsPanel-0WcASaRW.js} +1 -1
  43. package/web-app/dist/assets/{HomePage-3O1Ixdaj.js → HomePage-CQL8xADH.js} +2 -2
  44. package/web-app/dist/assets/{LoginPage-D_c2Q5Yd.js → LoginPage-BRfdWXgI.js} +1 -1
  45. package/web-app/dist/assets/{MagicPage-CWoBDJIL.js → MagicPage-CaaPZyuJ.js} +1 -1
  46. package/web-app/dist/assets/{MetricsPage-D_8_KsDG.js → MetricsPage-BjQ0sz0F.js} +1 -1
  47. package/web-app/dist/assets/{NotFoundPage-Ck7EB21i.js → NotFoundPage-BNnrwX96.js} +1 -1
  48. package/web-app/dist/assets/{ProjectPage-DjzxAUpk.js → ProjectPage-pDqfWbBG.js} +3 -3
  49. package/web-app/dist/assets/{ProjectsPage-IiL9eZZl.js → ProjectsPage-CiHCZYVm.js} +1 -1
  50. package/web-app/dist/assets/{SettingsPage-B21XsJXj.js → SettingsPage-B-1-R56L.js} +1 -1
  51. package/web-app/dist/assets/{ShowcasePage-Dw-qMqRX.js → ShowcasePage-BCa643R5.js} +1 -1
  52. package/web-app/dist/assets/{SystemSettingsPage-DRKM2q7Y.js → SystemSettingsPage-BUHVmvMB.js} +1 -1
  53. package/web-app/dist/assets/{TeamsPage-cE3eF_mQ.js → TeamsPage-CG-DqMjn.js} +1 -1
  54. package/web-app/dist/assets/{TemplatesPage-2m8EFD1w.js → TemplatesPage-CO_kXHRt.js} +1 -1
  55. package/web-app/dist/assets/{TerminalOutput-BVj57oRn.js → TerminalOutput-C_iYHB-7.js} +1 -1
  56. package/web-app/dist/assets/{activity--3RdDrr_.js → activity-Cp6ZIiZc.js} +1 -1
  57. package/web-app/dist/assets/{bell-Cf1aNwyn.js → bell-BZf6hsa9.js} +1 -1
  58. package/web-app/dist/assets/{bot-C9eepiBo.js → bot-CGmNbYLx.js} +1 -1
  59. package/web-app/dist/assets/{check-C0eAyl30.js → check-CMDDpUDY.js} +1 -1
  60. package/web-app/dist/assets/{chevron-left-CQzEDgKz.js → chevron-left-DTtdfTHr.js} +1 -1
  61. package/web-app/dist/assets/{circle-alert-C45LOFIn.js → circle-alert-Ch6h3j52.js} +1 -1
  62. package/web-app/dist/assets/{clock-DRQ4_6O5.js → clock-Ce1nf2ai.js} +1 -1
  63. package/web-app/dist/assets/{cloud-D2YwYtSX.js → cloud-p2TFekpg.js} +1 -1
  64. package/web-app/dist/assets/{code-xml-C0kAguzE.js → code-xml-Kyu4vmM1.js} +1 -1
  65. package/web-app/dist/assets/{database-Dc-69TwF.js → database-B4HrqS9b.js} +1 -1
  66. package/web-app/dist/assets/{dollar-sign-D80FbCfO.js → dollar-sign-Cw-uyKAg.js} +1 -1
  67. package/web-app/dist/assets/{file-code-corner-D0vcShuD.js → file-code-corner-C8N3vuAd.js} +1 -1
  68. package/web-app/dist/assets/{file-plus-D7P7v4hD.js → file-plus-Ddd367Rd.js} +1 -1
  69. package/web-app/dist/assets/{globe-DGnqby6a.js → globe-BW_Nzcek.js} +1 -1
  70. package/web-app/dist/assets/{hammer-BvafjTXC.js → hammer-rS0zwOgP.js} +1 -1
  71. package/web-app/dist/assets/{index-1Kvtppgn.js → index-BFtUVrg2.js} +3 -3
  72. package/web-app/dist/assets/{layers-7f3JxJPK.js → layers-ChTtsWHz.js} +1 -1
  73. package/web-app/dist/assets/{loader-circle-Dsmov_Fj.js → loader-circle-Dl2j378Y.js} +1 -1
  74. package/web-app/dist/assets/{lock-CYPcR4L9.js → lock-H0jwxcaH.js} +1 -1
  75. package/web-app/dist/assets/{package-CDRe5Fid.js → package-Cn0OyUWi.js} +1 -1
  76. package/web-app/dist/assets/{plus-BwmTPRgM.js → plus-c4Cn8Hg_.js} +1 -1
  77. package/web-app/dist/assets/{refresh-cw-DxlbreLM.js → refresh-cw-CvtIp31h.js} +1 -1
  78. package/web-app/dist/assets/{rotate-ccw-CpTwximO.js → rotate-ccw-CACNVELf.js} +1 -1
  79. package/web-app/dist/assets/{scroll-text-CgcWfO8K.js → scroll-text-wcpAN4zz.js} +1 -1
  80. package/web-app/dist/assets/{server-CBVNgMbf.js → server-C8tiYYoH.js} +1 -1
  81. package/web-app/dist/assets/{shield-alert-CL8lOpTJ.js → shield-alert-D2EqAn5F.js} +1 -1
  82. package/web-app/dist/assets/{thumbs-up-B245iaZM.js → thumbs-up-DoxGQgUE.js} +1 -1
  83. package/web-app/dist/assets/{trash-2-D_LCAVug.js → trash-2-HbLfFoN4.js} +1 -1
  84. package/web-app/dist/assets/{trending-down-DQn3R8k7.js → trending-down-Djd4tkxi.js} +1 -1
  85. package/web-app/dist/assets/{trending-up-BuXPO-tN.js → trending-up-B9Nco_QQ.js} +1 -1
  86. package/web-app/dist/assets/{upload-DNc_smXL.js → upload-Bu_bR4UG.js} +1 -1
  87. package/web-app/dist/assets/{usePolling-CwMs9ya4.js → usePolling-D6jTTEO8.js} +1 -1
  88. package/web-app/dist/assets/{user-DupXJP9t.js → user-3vyW2Iwk.js} +1 -1
  89. 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.119.0
6
+ # Loki Mode v11.120.1
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
 
@@ -395,15 +395,12 @@ Two completion-trust features extend the verification gates. Full details in `sk
395
395
 
396
396
  ## Harness intelligence (v8.0.0)
397
397
 
398
- Four measured-harness disciplines layered onto the existing trust core. None of
398
+ Three measured-harness disciplines layered onto the existing trust core. None of
399
399
  them can weaken a gate: each either adds verification or saves budget on work
400
400
  that cannot succeed.
401
401
 
402
402
  | Env Var | Default | Effect |
403
403
  |---------|---------|--------|
404
- | `LOKI_CONFIDENCE_SPIKE=0` | on | Disable the confidence-spike re-check |
405
- | `LOKI_CONFIDENCE_SPIKE_DELTA` | `40` | Confidence jump (points) that counts as a spike |
406
- | `LOKI_CONFIDENCE_SPIKE_MIN` | `90` | Absolute level that counts as a spike on first arrival |
407
404
  | `LOKI_GOAL_SCORING=0` | on | Disable the goal-measurability advisory |
408
405
  | `LOKI_SMART_RETRY=0` | on | Retry every failure, including non-retryable ones |
409
406
  | `LOKI_SIMPLE=1` | off | Strip the coaching half of the system prompt (-78%, ~1562 tokens/iteration). Experimental ablation arm. |
@@ -413,18 +410,12 @@ that cannot succeed.
413
410
  `[CACHE_BREAKPOINT]`; the SDK judge path applies `cache_control` on that split.
414
411
  Any new always-on instruction belongs in the prefix, or it busts the cache
415
412
  every iteration.
416
- - **Confidence-spike re-check.** A jump to near-maximal self-reported confidence
417
- forces ONE extra verification before the done-signal valve force-stops a run.
418
- Strictly additive: a spike can only ADD a verification pass, never skip,
419
- shorten, or satisfy a gate. It cannot delay the stagnation valve, and the
420
- delay is one-shot, so a repeatedly-spiking run cannot postpone the valve
421
- indefinitely.
422
413
  - **Hill-climbable goal scoring.** A `COMPLETION_PROMISE` with no measurable
423
414
  target (no number, comparator, named metric, or verifiable artifact) gets a
424
415
  prompt advisory asking for a checkable success condition. Advisory only: it
425
416
  never blocks a build and never rewrites the goal. Suppressed for an absent
426
417
  goal and in perpetual mode, where open-endedness is the chosen configuration.
427
- Byte-mirrored across the bash and TypeScript routes.
418
+ Implemented in the bash loop (`autonomy/run.sh`).
428
419
  - **Smart retry.** A positively-identified permanent failure (bad credentials,
429
420
  unknown model, exhausted quota) stops early instead of burning the retry
430
421
  budget on guaranteed-identical failures. Fail-safe: an unrecognized error
@@ -473,4 +464,4 @@ Implemented, planned and deprecated items, with the version each landed in: `CHA
473
464
 
474
465
  ---
475
466
 
476
- **v11.119.0 | [Autonomi](https://www.autonomi.dev/) flagship product | core skill**
467
+ **v11.120.1 | [Autonomi](https://www.autonomi.dev/) flagship product | core skill**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 11.119.0
1
+ 11.120.1
@@ -2031,7 +2031,7 @@ runner = d.get('runner', 'none')
2031
2031
  passed = d.get('pass')
2032
2032
  status = d.get('status', '')
2033
2033
  # BACKLOG 89: a recorded failure count above zero is a failure whatever "pass"
2034
- # says, as the Bun gate reads it (quality_gates.ts artifactCount): a numeric
2034
+ # says: a numeric
2035
2035
  # failed_count wins, the legacy numeric failed is the fallback, and anything
2036
2036
  # else (null, missing, a bool) is unmeasured, never a failure and never 0.
2037
2037
  def _count(v):
@@ -3295,8 +3295,7 @@ ISSUES: CRITICAL:description (optional, one per line per issue)"
3295
3295
  # output; the downstream parse already greps VOTE/REASON/ISSUES.
3296
3296
  # CAVEMAN_DEFAULT_MODE=off suppression is preserved (see above).
3297
3297
  # bash-F3: timeout-guard the provider subcall so a hung CLI can
3298
- # not stall the whole council. Default 600s matches the Bun route
3299
- # (council.ts LOKI_COUNCIL_TIMEOUT_MS=600000).
3298
+ # not stall the whole council. Default 600s.
3300
3299
  # bash-F4 (WAVE10 SAFE-DEFAULT): capture the subcall exit code so a
3301
3300
  # timeout (124) is NOT silently routed into council_heuristic_review.
3302
3301
  # The heuristic fallback defaults to APPROVE on benign evidence, so
@@ -3502,7 +3501,7 @@ REASON: one-line justification citing path:line evidence"
3502
3501
  # v7.41.3 BUG A: full capture, no tail-truncation (see member
3503
3502
  # subcall note). CAVEMAN_DEFAULT_MODE=off suppression preserved.
3504
3503
  # bash-F3: timeout-guard the devil's-advocate subcall (same 600s
3505
- # default as the member subcalls / Bun council.ts). An empty
3504
+ # default as the member subcalls). An empty
3506
3505
  # verdict on timeout hits the conservative REJECT fallback below.
3507
3506
  verdict=$(echo "$prompt" | timeout "${LOKI_COUNCIL_REVIEW_TIMEOUT:-600}" env "SHELL=$_co_shell" CAVEMAN_DEFAULT_MODE=off claude "${_co_argv[@]}" -p 2>/dev/null)
3508
3507
  fi
@@ -3,11 +3,14 @@
3
3
 
4
4
  loki backlog owner/repo --all | --label X | --issues 1,2,3
5
5
  [--concurrency N] [--slots N] [--dry-run]
6
+ loki backlog jira:PROJ | linear:TEAM (same options; Jira and Linear items)
6
7
 
7
8
  Each issue gets its own git worktree and branch (loki/backlog-N) beside the
8
9
  checkout; the launcher runs inside it. Success = the child exited 0 (the engine's
9
- ladder: 0 VERIFIED, 1 FAILED, 3 BUDGET_STOP, 4 BLOCKED, 5 STALLED). A draft PR
10
- from a failed run is still FAILED. Exit: 0 all ok, 3 only budget stops, 1 other
10
+ ladder: 0 VERIFIED, 1 FAILED, 3 BUDGET_STOP, 4 BLOCKED, 5 STALLED, 6 PARTIAL). A
11
+ draft PR from a failed run is still FAILED; a PARTIAL run counts only with its PR.
12
+ A split issue prints one Outcome and one Cost line for all its slices, so its
13
+ spend reaches the day ledger like any run. Exit: 0 all ok, 3 only budget stops, 1 other
11
14
  failures, 2 usage/config error.
12
15
 
13
16
  Unit mode (D61 slice 10): --dag FILE [--group G] also runs the units of a
@@ -21,14 +24,22 @@ Passing unit branches are kept for the integrator; issue mode is unchanged.
21
24
 
22
25
  Triage: before anything runs, every issue is classified by the triage router
23
26
  (loki-ts/src/features/triage.ts, via `loki internal triage`) as implement (run
24
- it), spec (draft .loki/specs/<slug>.md with `loki plan --spec`, run nothing,
25
- print the command to run it after review) or human (never run headless; listed
26
- with the reason). --dry-run prints the class and reason per issue. A label
27
+ it; a large issue, by the one rule in features/decompose.ts deliverables, runs
28
+ and the engine splits it into slices), spec (vague or ambiguous: draft
29
+ .loki/specs/<slug>.md with `loki plan --spec`, run nothing, print the command to
30
+ run it after review) or human (never run headless; listed with the reason). --dry-run prints the class and reason per issue. A label
27
31
  loki:implement, loki:spec or loki:human forces the class; LOKI_TRIAGE=0 turns
28
32
  the router off (every issue runs, as before). The class and reason reach each
29
33
  child run as LOKI_TRIAGE_CLASS / LOKI_TRIAGE_REASON, which the engine records in
30
34
  the run events, the receipt and the PR body.
31
35
 
36
+ Jira and Linear: `jira:PROJ` or `linear:TEAM` in place of owner/repo lists that
37
+ project's open items with `loki internal tracker-list` (features/tracker_intake.ts,
38
+ the same credentials as `loki jira:PROJ-1`), triages them the same way and runs
39
+ each as `loki jira:PROJ-N` / `loki linear:TEAM-N` from the current checkout.
40
+ --issues takes item numbers (12 means PROJ-12). A large Jira or Linear item runs
41
+ as one run: the engine splits only GitHub issues today.
42
+
32
43
  Test seam: LOKI_BACKLOG_LAUNCHER replaces the real launcher (called with the
33
44
  issue ref, cwd = the issue worktree).
34
45
  """
@@ -51,6 +62,10 @@ import worktree_prep # noqa: E402
51
62
 
52
63
  REPO_ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
53
64
  REPO_RE = re.compile(r"^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$")
65
+ TRACKER_RE = re.compile(r"^(jira|linear):([A-Za-z][A-Za-z0-9_]*)$")
66
+ # A tracker item key names worktree, branch and log paths: only PROJECT-<number> of the listed project is accepted.
67
+ ITEM_KEY_RE = r"^%s-\d+$" # %s: the validated, uppercased project key
68
+ TRACKER_SECRETS = {"jira": ("JIRA_API_TOKEN", "JIRA_TOKEN", "LOKI_JIRA_TOKEN"), "linear": ("LINEAR_API_KEY", "LOKI_LINEAR_TOKEN")} # each tracker's token and its aliases
54
69
 
55
70
 
56
71
  def say(msg):
@@ -76,9 +91,41 @@ def origin_slug(cwd):
76
91
  return m.group(1) if m else ""
77
92
 
78
93
 
79
- def _issue(i):
94
+ def _issue(i, repo):
95
+ """One work item. key: the job-table key; label: how it prints; ref: what the launcher runs; slug: branch suffix."""
80
96
  labels = [l.get("name", "") if isinstance(l, dict) else str(l) for l in i.get("labels") or []]
81
- return {"number": i["number"], "title": i.get("title") or "", "body": i.get("body") or "", "labels": labels}
97
+ n = i["number"]
98
+ return {"number": n, "key": n, "label": "#%d" % n, "ref": "%s#%d" % (repo, n), "slug": str(n), "split": True,
99
+ "title": i.get("title") or "", "body": i.get("body") or "", "labels": labels}
100
+
101
+
102
+ def list_tracker(spec, label, numbers, env):
103
+ """Jira/Linear items via `loki internal tracker-list` (features/tracker_intake.ts). Raises RuntimeError."""
104
+ source, project = spec.split(":", 1)
105
+ cmd = [os.path.join(REPO_ROOT, "bin", "loki"), "internal", "tracker-list", spec]
106
+ if label:
107
+ cmd += ["--label", label]
108
+ if numbers:
109
+ cmd += ["--issues", ",".join(str(n) for n in numbers)]
110
+ r = subprocess.run(cmd, capture_output=True, text=True, env=env, stdin=subprocess.DEVNULL)
111
+ try:
112
+ rows = json.loads(r.stdout) if r.returncode == 0 else None
113
+ if not isinstance(rows, list):
114
+ raise ValueError("not a list")
115
+ out = [{"number": int(x["number"]), "key": str(x["key"]), "label": str(x["key"]), "ref": "%s:%s" % (source, x["key"]),
116
+ "slug": str(x["key"]), "split": False, "title": str(x.get("title") or ""), "body": str(x.get("body") or ""),
117
+ "labels": [str(l) for l in x.get("labels") or []], "source": source} for x in rows]
118
+ except (ValueError, TypeError, KeyError):
119
+ why = (r.stderr.strip().splitlines() or ["no usable output"])[-1]
120
+ raise RuntimeError("listing %s failed (%s)" % (spec, why))
121
+ key_re = re.compile(ITEM_KEY_RE % re.escape(project))
122
+ for i in out:
123
+ if not key_re.fullmatch(i["key"]) or not str(i["number"]) == i["key"].rsplit("-", 1)[1]:
124
+ raise RuntimeError("listing %s returned an invalid item key %r; refusing to use it in a path" % (spec, i["key"][:40]))
125
+ missing = sorted(set(numbers or []) - {i["number"] for i in out})
126
+ if missing:
127
+ raise RuntimeError("%s has no item %s" % (spec, ", ".join("%s-%d" % (project.upper(), n) for n in missing)))
128
+ return out
82
129
 
83
130
 
84
131
  def list_issues(repo, label, env):
@@ -89,7 +136,7 @@ def list_issues(repo, label, env):
89
136
  r = subprocess.run(cmd, capture_output=True, text=True, env=env)
90
137
  if r.returncode != 0:
91
138
  raise RuntimeError("gh issue list failed: " + (r.stderr.strip().splitlines() or ["unknown error"])[0])
92
- return sorted((_issue(i) for i in json.loads(r.stdout or "[]")), key=lambda i: i["number"])
139
+ return sorted((_issue(i, repo) for i in json.loads(r.stdout or "[]")), key=lambda i: i["number"])
93
140
 
94
141
 
95
142
  def view_issues(repo, numbers, env):
@@ -99,7 +146,7 @@ def view_issues(repo, numbers, env):
99
146
  capture_output=True, text=True, env=env)
100
147
  if r.returncode != 0:
101
148
  raise RuntimeError("gh issue view %d failed: %s" % (n, (r.stderr.strip().splitlines() or ["unknown error"])[0]))
102
- out.append(_issue(json.loads(r.stdout or "{}")))
149
+ out.append(_issue(json.loads(r.stdout or "{}"), repo))
103
150
  return out
104
151
 
105
152
 
@@ -107,12 +154,12 @@ TRIAGE_CLASSES = ("implement", "spec", "human")
107
154
 
108
155
 
109
156
  def triage(issues, top, env):
110
- """-> {number: (class, reason)} from `loki internal triage`; raises RuntimeError (fail closed: nothing untriaged runs)."""
157
+ """-> {key: (class, reason)} from `loki internal triage`; raises RuntimeError (fail closed: nothing untriaged runs)."""
111
158
  if os.environ.get("LOKI_TRIAGE") == "0":
112
- return {i["number"]: ("implement", "LOKI_TRIAGE=0: router off") for i in issues}
159
+ return {i["key"]: ("implement", "LOKI_TRIAGE=0: router off") for i in issues}
113
160
  if not issues:
114
161
  return {}
115
- items = [{"id": i["number"], "title": i["title"], "body": i["body"], "labels": i["labels"]} for i in issues]
162
+ items = [{"id": i["key"], "title": i["title"], "body": i["body"], "labels": i["labels"], "split": i["split"]} for i in issues]
116
163
  r = subprocess.run([os.path.join(REPO_ROOT, "bin", "loki"), "internal", "triage", "--repo-dir", top],
117
164
  input=json.dumps(items), capture_output=True, text=True, env=env)
118
165
  try:
@@ -120,12 +167,17 @@ def triage(issues, top, env):
120
167
  got = {row["id"]: (row["class"], row["reason"]) for row in rows if row.get("class") in TRIAGE_CLASSES}
121
168
  except (ValueError, TypeError, KeyError, AttributeError):
122
169
  got = None
123
- if not got or set(got) != {i["number"] for i in issues}:
170
+ if not got or set(got) != {i["key"] for i in issues}:
124
171
  why = (r.stderr.strip().splitlines() or ["no usable output"])[-1]
125
172
  raise RuntimeError("triage failed (%s); fix it, or set LOKI_TRIAGE=0 to run every issue untriaged" % why)
126
173
  return got
127
174
 
128
175
 
176
+ def without(env, keys):
177
+ """A copy of env with keys removed."""
178
+ return {k: v for k, v in env.items() if k not in keys}
179
+
180
+
129
181
  def draft_spec(issue, top, env):
130
182
  """Draft .loki/specs/<slug>.md with `loki plan --spec` (one plan session). -> (ok, status line)."""
131
183
  task = issue["title"] + ("\n\n" + issue["body"] if issue["body"].strip() else "")
@@ -180,10 +232,13 @@ def add_spend(usd):
180
232
 
181
233
  def parse_result(rc, text):
182
234
  """-> (ok, status line text, cost_usd or None)."""
183
- pr = re.search(r"^PR:\s+(https?://\S+)", text, re.M)
235
+ pr = re.search(r"^PR:\s+((?:https?|local)://\S+)", text, re.M) # local://: published to a local bare origin (engine10-push.sh)
184
236
  why = re.search(r"^Reason:\s+(.+)$", text, re.M)
185
237
  cost = re.search(r"^Cost:\s+(?:partial:\s+)?\$([0-9]+(?:\.[0-9]+)?)", text, re.M)
186
238
  usd = float(cost.group(1)) if cost else None
239
+ plan = re.search(r"^Split planning:\s+(?:partial:\s+)?\$([0-9]+(?:\.[0-9]+)?)", text, re.M) # a refused split's planning sessions
240
+ if plan:
241
+ usd = (usd or 0.0) + float(plan.group(1))
187
242
  reason = why.group(1).strip() if why else ""
188
243
  if rc == 0:
189
244
  return True, ("PR " + pr.group(1)) if pr else "VERIFIED", usd
@@ -191,6 +246,8 @@ def parse_result(rc, text):
191
246
  return False, "BLOCKED: " + (reason or "see the run log"), usd
192
247
  if rc == 3:
193
248
  return False, "BUDGET_STOP: " + (reason or "run cost cap reached"), usd
249
+ 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
194
251
  return False, "FAILED: " + (reason or "exit %d" % rc), usd
195
252
 
196
253
 
@@ -283,8 +340,14 @@ def main(argv):
283
340
  ap.add_argument("--group", help="unit group id (default: the DAG's group, else g1)")
284
341
  a = ap.parse_args(argv)
285
342
 
286
- if not REPO_RE.match(a.repo):
287
- return die("repo must be owner/repo, got %r" % a.repo)
343
+ tracker = TRACKER_RE.match(a.repo)
344
+ if tracker: # jira:proj is jira:PROJ: tracker project keys are uppercase
345
+ a.repo = "%s:%s" % (tracker.group(1), tracker.group(2).upper())
346
+ tracker = TRACKER_RE.match(a.repo)
347
+ if tracker and os.environ.get("LOKI_TRACKER_INTAKE") == "0":
348
+ return die("LOKI_TRACKER_INTAKE=0 disables Jira and Linear; unset it to run %s" % a.repo)
349
+ if not (REPO_RE.match(a.repo) or tracker):
350
+ return die("repo must be owner/repo, jira:PROJ or linear:TEAM, got %r" % a.repo)
288
351
  if not (a.all or a.label or a.issues or a.dag):
289
352
  return die("choose one of --all, --label X, --issues 1,2,3, --dag FILE")
290
353
  group, dag_units = None, []
@@ -329,7 +392,7 @@ def main(argv):
329
392
  top = git("rev-parse", "--show-toplevel").stdout.strip()
330
393
  if not top:
331
394
  return die("run this from a checkout of %s" % a.repo)
332
- if origin_slug(top).lower() != a.repo.lower():
395
+ if not tracker and origin_slug(top).lower() != a.repo.lower():
333
396
  return die("this checkout's origin is %r, not %s; cd into a checkout of %s"
334
397
  % (origin_slug(top) or "unknown", a.repo, a.repo))
335
398
 
@@ -345,8 +408,11 @@ def main(argv):
345
408
  u["base"] = sha
346
409
 
347
410
  try:
348
- issues = (view_issues(a.repo, numbers, env) if numbers
349
- else list_issues(a.repo, a.label, env) if (a.all or a.label) else [])
411
+ if tracker:
412
+ issues = list_tracker(a.repo, a.label, numbers, env) if (numbers or a.all or a.label) else []
413
+ else:
414
+ issues = (view_issues(a.repo, numbers, env) if numbers
415
+ else list_issues(a.repo, a.label, env) if (a.all or a.label) else [])
350
416
  klass = triage(issues, top, env)
351
417
  except RuntimeError as e:
352
418
  return die(redact(str(e), token), 1)
@@ -354,13 +420,14 @@ def main(argv):
354
420
  say("backlog: %s concurrency %d, %d issue(s)" % (a.repo, conc, len(issues))
355
421
  + (", %d unit(s) in group %s" % (len(dag_units), group) if dag_units else ""))
356
422
  for i in issues:
357
- c, why = klass[i["number"]]
358
- say("backlog: #%d %-9s %s | %s" % (i["number"], c, i["title"], why))
423
+ c, why = klass[i["key"]]
424
+ say("backlog: %s %-9s %s | %s" % (i["label"], c, i["title"], why))
359
425
  if a.dry_run:
360
- n_of = lambda c: sum(1 for i in issues if klass[i["number"]][0] == c) # noqa: E731
426
+ 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].startswith("large ("))
361
428
  if issues:
362
- say("backlog: dry run: %d would run, %d would get a drafted spec, %d need a human; nothing launched"
363
- % (n_of("implement"), n_of("spec"), n_of("human")))
429
+ say("backlog: dry run: %d would run%s, %d would get a drafted spec, %d need a human; nothing launched"
430
+ % (n_of("implement"), " (%d split into slices)" % n_large if n_large else "", n_of("spec"), n_of("human")))
364
431
  for u in dag_units:
365
432
  say("backlog: would run unit %s-%d (%s) after: %s" % (group, u["n"], u["id"], ", ".join(u["deps"]) or "nothing"))
366
433
  return 0
@@ -395,26 +462,29 @@ def main(argv):
395
462
  day_cap = cfg.get("budgets", {}).get("per_day_usd")
396
463
 
397
464
  # Triage: only implement issues run; spec issues get a drafted spec, human issues are listed.
398
- routed = {} # number -> (ok, status) for issues that do not run
465
+ routed = {} # key -> (ok, status) for issues that do not run
466
+ labels = {i["key"]: i["label"] for i in issues}
399
467
  for i in issues:
400
- c, why = klass[i["number"]]
468
+ c, why = klass[i["key"]]
401
469
  if c == "human":
402
- routed[i["number"]] = (True, "HUMAN: " + why)
470
+ routed[i["key"]] = (True, "HUMAN: " + why)
403
471
  elif c == "spec":
404
- ok, status = draft_spec(i, top, child_env)
405
- routed[i["number"]] = (ok, "%s (%s)" % (status, why))
472
+ ok, status = draft_spec(i, top, without(child_env, sum(TRACKER_SECRETS.values(), ())))
473
+ routed[i["key"]] = (ok, "%s (%s)" % (status, why))
406
474
  if c != "implement":
407
- say("backlog: #%d %s" % (i["number"], routed[i["number"]][1]))
475
+ say("backlog: %s %s" % (i["label"], routed[i["key"]][1]))
408
476
 
409
477
  # One job table for issues and units: they share one slot pool.
410
478
  spec = {}
411
479
  for i in issues:
412
- n = i["number"]
480
+ n = i["key"]
413
481
  if n in routed:
414
482
  continue
415
- spec[n] = {"label": "#%d" % n, "branch": "loki/backlog-%d" % n, "wt": "issue-%d" % n,
416
- "cmd": [launcher, "%s#%d" % (a.repo, n)], "deps": [], "unit": False,
417
- "env": {"LOKI_TRIAGE_CLASS": klass[n][0], "LOKI_TRIAGE_REASON": klass[n][1]}}
483
+ spec[n] = {"label": i["label"], "branch": "loki/backlog-%s" % i["slug"], "wt": "issue-%s" % i["slug"],
484
+ "cmd": [launcher, i["ref"]], "deps": [], "unit": False,
485
+ "env": {"LOKI_TRIAGE_CLASS": klass[n][0], "LOKI_TRIAGE_REASON": klass[n][1]},
486
+ # a child keeps only its own tracker's token (intake and writeback need it); the other tracker's never reaches it
487
+ "drop": [k for src, keys in TRACKER_SECRETS.items() if src != i.get("source") for k in keys]}
418
488
  key_of = {u["id"]: "unit-%s-%d" % (group, u["n"]) for u in dag_units}
419
489
  for u in dag_units:
420
490
  k = key_of[u["id"]]
@@ -423,7 +493,7 @@ def main(argv):
423
493
  "deps": [key_of[d] for d in u["deps"]],
424
494
  "env": {"LOKI_GROUP_ID": group, "LOKI_UNIT_ID": u["id"], "LOKI_UNIT_N": str(u["n"]),
425
495
  "LOKI_UNIT_DEPS": ",".join(u["deps"]), "LOKI_UNIT_WRITE_SET": "\n".join(u["write_set"])},
426
- "done": u["done"], "base": u["base"]}
496
+ "done": u["done"], "base": u["base"], "drop": sum(TRACKER_SECRETS.values(), ())} # a unit is a text task: no tracker token
427
497
  if u["spec"]: # frozen group acceptance for unit_mode (wall.ts)
428
498
  spec[k]["env"].update(LOKI_UNIT_SPEC=u["spec"], LOKI_SPEED="1")
429
499
  state = {k: {"status": "queued", "ok": None, "cost": None, "ran": False} for k in spec}
@@ -531,7 +601,7 @@ def main(argv):
531
601
  return
532
602
  log = os.path.join(wt_root, "logs", s["wt"] + ".log")
533
603
  with open(log, "w") as lf:
534
- p = subprocess.Popen(s["cmd"], cwd=wt, env=dict(child_env, **s["env"]), stdout=lf,
604
+ p = subprocess.Popen(s["cmd"], cwd=wt, env=without(dict(child_env, **s["env"]), s.get("drop", ())), stdout=lf,
535
605
  stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL, start_new_session=True)
536
606
  running[k] = (p, log, wt)
537
607
  state[k].update(status="running", ran=True)
@@ -589,7 +659,7 @@ def main(argv):
589
659
  say("Summary: %s" % a.repo)
590
660
  say("%-14s %-10s %s" % ("ITEM", "COST", "RESULT"))
591
661
  for n, s in state.items():
592
- say("%-14s %-10s %s" % (spec[n]["label"] if n in spec else "#%d" % n, ("$%.2f" % s["cost"] if s["cost"] is not None else "unmeasured" if s["ran"] else "-"), s["status"]))
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"]))
593
663
  measured = sum(s["cost"] or 0 for s in state.values())
594
664
  say("Total measured cost: $%.2f%s" % (measured, " (%d run(s) unmeasured, not counted as $0)" % unmeasured if unmeasured else ""))
595
665
  bad = [s for s in state.values() if not s["ok"]]
@@ -33,7 +33,7 @@ knowledge of any specific PRD** (anti-teaching-to-the-test).
33
33
  This is a capability module, like FV-1 was. It changes zero existing build
34
34
  behavior. **Wiring it into the default build lane is the gated next step** (the
35
35
  M1->"M1-wire" fork, analogous to FV-1->FV-2): that step touches the parity-locked
36
- `run.sh`/`build_prompt.ts` core, reclassifies what every build produces, and
36
+ `run.sh` build_prompt core, reclassifies what every build produces, and
37
37
  requires bash+bun parity work + council review + founder sign-off. Do NOT wire it
38
38
  in as a solo/rushed action.
39
39
 
@@ -79,5 +79,5 @@ UI -- the spine working as designed).
79
79
  ## Next (wiring, see the plan)
80
80
 
81
81
  - Wire M1+M2+M3 into the build lane (GATED: touches parity-locked run.sh/
82
- build_prompt.ts core -> bash+bun parity + council + founder sign-off).
82
+ run.sh build_prompt core -> council + founder sign-off).
83
83
  - Wire the FV harness into the completion verdict (FV-2, founder-gated).
@@ -3,7 +3,6 @@
3
3
 
4
4
  Single implementation called by both routes:
5
5
  - bash: autonomy/run.sh generate_proof_of_run() via python3
6
- - Bun: loki-ts/src/runner/proof.ts via spawn
7
6
 
8
7
  Assembles the frozen proof.json schema v1.0 from .loki/ state, runs the
9
8
  redaction chokepoint exactly once, computes an integrity hash, and writes
@@ -341,7 +340,7 @@ def _test_results_fresh(quality_dir):
341
340
  test-results.json together with .test-results.iter; they are this
342
341
  iteration's evidence only when that marker holds this iteration's number.
343
342
  Both loop callers always pass the iteration as ITERATION_COUNT (run.sh
344
- generate_proof_of_run, Bun runner/proof.ts); a set but empty value is not
343
+ generate_proof_of_run); a set but empty value is not
345
344
  fresh.
346
345
  ponytail: ITERATION_COUNT absent altogether means a hand run outside any
347
346
  loop, with no iteration to compare against, so the pre-82 reading applies
@@ -14,13 +14,9 @@
14
14
  # lets the normal build proceed -- it can only ADD a starting skeleton, never
15
15
  # remove or overwrite existing code.
16
16
  #
17
- # PARITY: this is a bash-only ORCHESTRATION seam in run_autonomous, NOT part of
18
- # the byte-mirrored build_prompt() contract (build_prompt.ts is unchanged). It
19
- # mirrors the LOKI_SENTRUX_GATE precedent, which is likewise bash-orchestration
20
- # only (not behavior-mirrored in the bun runner). Because it is DEFAULT-OFF, the
21
- # bun default path is unaffected. When the bun runner (loki-ts autonomous.ts,
22
- # currently a skeleton port) reaches run_autonomous behavior parity, it should
23
- # mirror this opt-in gate.
17
+ # This is a bash-only ORCHESTRATION seam in run_autonomous, not part of
18
+ # build_prompt(). It follows the LOKI_SENTRUX_GATE precedent, which is likewise
19
+ # bash-orchestration only. It is DEFAULT-OFF.
24
20
 
25
21
  # Is the target dir greenfield (no meaningful source yet)? Ignores .loki, .git,
26
22
  # the PRD, and dotfiles. Echoes "yes"/"no".
package/autonomy/loki CHANGED
@@ -14873,6 +14873,7 @@ cmd_backlog() {
14873
14873
  echo -e "${BOLD}loki backlog${NC} - run a v10 issue-mode run for every matching open issue"
14874
14874
  echo ""
14875
14875
  echo "Usage: loki backlog owner/repo (--all | --label X | --issues 1,2,3) [--concurrency N] [--dry-run]"
14876
+ echo " loki backlog jira:PROJ | linear:TEAM (same options; --issues 12 means PROJ-12)"
14876
14877
  echo ""
14877
14878
  echo " --all Every open issue"
14878
14879
  echo " --label X Open issues with label X"
@@ -14880,8 +14881,10 @@ cmd_backlog() {
14880
14881
  echo " --concurrency N Max runs in parallel (default: loki.yaml concurrency, else 2)"
14881
14882
  echo " --dry-run Print each issue's triage class (implement, spec, human) and reason; launch nothing"
14882
14883
  echo ""
14883
- echo "Run from a checkout of owner/repo. Each issue runs in its own worktree on loki/backlog-N."
14884
- echo "Triage: only implement issues run; spec issues get .loki/specs/<slug>.md and the command to run it;"
14884
+ echo "Run from a checkout of owner/repo (for Jira or Linear, the checkout the work lands in)."
14885
+ echo "Each issue runs in its own worktree on loki/backlog-N. Jira and Linear use the credentials in docs/trackers.md."
14886
+ echo "Triage: implement issues run, and a large one is split into slices that each run on their own;"
14887
+ echo "vague or ambiguous (spec) issues get .loki/specs/<slug>.md and the command to run it;"
14885
14888
  echo "human issues are listed with the reason. Label loki:implement|loki:spec|loki:human forces a class;"
14886
14889
  echo "LOKI_TRIAGE=0 runs every issue untriaged."
14887
14890
  echo "Config: loki.yaml (repo root, then ~/.loki/loki.yaml); see docs/loki.yaml.example."
@@ -36886,7 +36889,6 @@ except Exception:
36886
36889
  #
36887
36890
  # Concretely, this is what reported 2 CRITICAL findings on the v8 PR:
36888
36891
  # sk-ant-xxx (loki-ts/test/runner/oauth_dev.test.ts)
36889
- # sk-ant-test-not-called (loki-ts/tests/runner/quality_gates.test.ts)
36890
36892
  # Both exist to prove the SDK path fails closed without a real key. Flagging
36891
36893
  # them trains people to ignore CRITICAL, which is how a real one gets missed.
36892
36894
  local _ci_secret_deny='(test|example|sample|fixture|dummy|fake|placeholder|redacted|changeme|your[-_]|xxx+|not[-_]called|\$\{|\$[A-Za-z_]|process\.env|os\.(environ|getenv)|<[^>]*>)'
@@ -265,7 +265,7 @@ def check_quality_gate(trigger, loki_dir, iteration, notifications):
265
265
  defect as the budget key, in the same file.
266
266
 
267
267
  gate-failures.txt is the canonical failure source used by
268
- proof-generator.py:413 and loki-ts build_prompt.ts, so this
268
+ proof-generator.py:413 and run.sh build_prompt, so this
269
269
  reuses a proven contract rather than introducing a second one.
270
270
  """
271
271
  failures_file = Path(loki_dir) / "quality" / "gate-failures.txt"
@@ -273,7 +273,7 @@ def check_quality_gate(trigger, loki_dir, iteration, notifications):
273
273
  try:
274
274
  if failures_file.exists():
275
275
  # Cap the read: a pathological file must not be loaded whole
276
- # (same reason as build_prompt.ts:707).
276
+ # (same reason as proof-generator.py:413).
277
277
  raw = failures_file.read_text(errors="replace")[:8000]
278
278
  seen = set()
279
279
  for name in raw.replace("\n", ",").split(","):