loki-mode 11.143.0 → 11.145.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/.github/actions/issue-to-pr/action.yml +18 -6
- package/README.md +2 -2
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/hooks/validate-bash.sh +122 -2
- package/dashboard/__init__.py +1 -1
- package/docs/ARCHITECTURE.md +5 -6
- package/docs/CLI-REFERENCE.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/TESTING.md +1 -1
- package/docs/dev/architecture-reference.md +23 -0
- package/docs/dev/release-checklist.md +2 -2
- package/docs/environment-variables.md +8 -1
- package/docs/examples/loki-issue-to-pr.yml.example +39 -194
- package/docs/v10/GUIDE.md +28 -4
- package/loki-ts/dist/loki.js +2274 -2117
- package/mcp/__init__.py +1 -1
- package/mcp/requirements.txt +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +10755 -8713
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-Bfyaout3.js → AdminPage-Dtrte_9h.js} +1 -1
- package/web-app/dist/assets/{Avatar-B4M87e2A.js → Avatar-BqDxz5Iw.js} +1 -1
- package/web-app/dist/assets/{Badge-BdWo4Pis.js → Badge-BGX45Lnh.js} +1 -1
- package/web-app/dist/assets/{Button-ga7zrGds.js → Button-DVr538c3.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-BCPdCf3y.js → CockpitPage-CIODjzWx.js} +1 -1
- package/web-app/dist/assets/{ComparePage-ei74A2H-.js → ComparePage-DSaexpQe.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-DOksQdek.js → ErrorBoundary-CnkNmsIK.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-BejiJCuC.js → EvidenceReceiptPanel-BOYje705.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-B4SLdG6W.js → GitHubIssuesPanel-D-obZbg0.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-DUfmJ8-D.js → GitHubPRsPanel-BDP6UPrV.js} +1 -1
- package/web-app/dist/assets/{HomePage-DLOrsiAX.js → HomePage-CyuUJmkD.js} +2 -2
- package/web-app/dist/assets/{LoginPage-CYX6EhD1.js → LoginPage-CwzpHE77.js} +1 -1
- package/web-app/dist/assets/{MagicPage-B9V-H8rJ.js → MagicPage-B-2U-xDs.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-DxR4dA3v.js → MetricsPage-cNfnAqIP.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-62GUMrsu.js → NotFoundPage-Bnja4u7t.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-aRlMvuO3.js → ProjectPage-DxKwokda.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-DlsVYWSU.js → ProjectsPage-D0HElwG2.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-CYBOAzSl.js → SettingsPage-cKZTmoDV.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-Cp9h_ikU.js → ShowcasePage-COCzMSj2.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-Bi8O5KM1.js → SystemSettingsPage-DpEdU35g.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-CvKAy4VC.js → TeamsPage-CRa-oR3c.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-DgZ8R3cj.js → TemplatesPage-CqVQ2RrJ.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-BXzQQ3ao.js → TerminalOutput-77EBpy6w.js} +1 -1
- package/web-app/dist/assets/{activity-wbwzJg71.js → activity-CwYJMGXJ.js} +1 -1
- package/web-app/dist/assets/{bell-CU-k59mu.js → bell-D7tpnhHd.js} +1 -1
- package/web-app/dist/assets/{bot-nRo4H6pJ.js → bot-BGEMExhD.js} +1 -1
- package/web-app/dist/assets/{check-BsSag1UJ.js → check-DXYfUB9x.js} +1 -1
- package/web-app/dist/assets/{chevron-left-CZr4us96.js → chevron-left-fmjoQGhm.js} +1 -1
- package/web-app/dist/assets/{circle-alert-C2EwgqPt.js → circle-alert-Bg5XeK2P.js} +1 -1
- package/web-app/dist/assets/{clock-B1jzN_2i.js → clock-CsKyZSPS.js} +1 -1
- package/web-app/dist/assets/{cloud-Bmbi0qzP.js → cloud-Bd60jog4.js} +1 -1
- package/web-app/dist/assets/{code-xml-VGyACVgD.js → code-xml-Ctl0DdWZ.js} +1 -1
- package/web-app/dist/assets/{database-CWmwrahT.js → database-ziASlG1B.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-CTuJpB-U.js → dollar-sign-Bo2f3aLO.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-CEKoA1FQ.js → file-code-corner-BZCY8u6u.js} +1 -1
- package/web-app/dist/assets/{file-plus-wJZDaswJ.js → file-plus-DZX_AwtZ.js} +1 -1
- package/web-app/dist/assets/{globe-CWQQ1FMq.js → globe-BqP4Lntz.js} +1 -1
- package/web-app/dist/assets/{hammer-CGzn_YVi.js → hammer-KMjpooTk.js} +1 -1
- package/web-app/dist/assets/{index-D7HK6vkd.js → index-B_8pnUwl.js} +3 -3
- package/web-app/dist/assets/{layers-Db1BfC4Q.js → layers-Bdkz5DFw.js} +1 -1
- package/web-app/dist/assets/{loader-circle-C0gn8jcq.js → loader-circle-BV_0L7bg.js} +1 -1
- package/web-app/dist/assets/{lock-wrIkF7MN.js → lock-DhK1z1dB.js} +1 -1
- package/web-app/dist/assets/{package-DhSgTaXb.js → package-De8MCdUa.js} +1 -1
- package/web-app/dist/assets/{plus-CdbYe7om.js → plus-BQbDrNgm.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-JNwtW3Ws.js → refresh-cw-BQ2ezlqR.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-Dld_mqp3.js → rotate-ccw-EuVYh2XK.js} +1 -1
- package/web-app/dist/assets/{scroll-text-DWs72mdn.js → scroll-text-BcrL2UnM.js} +1 -1
- package/web-app/dist/assets/{server-CucPfvl_.js → server-dpdGPXDc.js} +1 -1
- package/web-app/dist/assets/{shield-alert-D3IjFaYW.js → shield-alert-B2AnkpV_.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-CHz4RJSh.js → thumbs-up-Zock-j5_.js} +1 -1
- package/web-app/dist/assets/{trash-2-B6cfWy3k.js → trash-2-B9zGFCn0.js} +1 -1
- package/web-app/dist/assets/{trending-down-CfrEdZcD.js → trending-down-DWQW56VW.js} +1 -1
- package/web-app/dist/assets/{trending-up-Dn4jQ0v5.js → trending-up--6mzkyyP.js} +1 -1
- package/web-app/dist/assets/{upload-BIHmbeaS.js → upload-CNxdXaU0.js} +1 -1
- package/web-app/dist/assets/{usePolling-BpfFN5gC.js → usePolling-CVHCrC_t.js} +1 -1
- package/web-app/dist/assets/{user--rB-Jk_0.js → user-CuL3zj1a.js} +1 -1
- package/web-app/dist/index.html +1 -1
|
@@ -10,9 +10,11 @@ branding:
|
|
|
10
10
|
# must not hold a write token. Run it with `permissions: contents: read,
|
|
11
11
|
# issues: read` and `actions/checkout` with `persist-credentials: false`, upload
|
|
12
12
|
# `outputs.patch`, and push and open the PR from a second job that runs no
|
|
13
|
-
# agent.
|
|
14
|
-
#
|
|
15
|
-
#
|
|
13
|
+
# agent. The reusable workflow .github/workflows/loki-issue-to-pr.yml in
|
|
14
|
+
# asklokesh/loki-mode does both jobs and is what most repositories should call
|
|
15
|
+
# (docs/examples/loki-issue-to-pr.yml.example is the caller); use this action only
|
|
16
|
+
# to build your own agent job. Earlier versions pushed and opened the PR from the
|
|
17
|
+
# same step that ran the agent; this one does not.
|
|
16
18
|
#
|
|
17
19
|
# Token co-location within THIS job: the fetch step below holds GH_TOKEN and
|
|
18
20
|
# runs no agent; the agent step runs Loki 10 (`loki "<task>" --no-pr`) on the pre-fetched PRD text
|
|
@@ -227,16 +229,26 @@ runs:
|
|
|
227
229
|
# "status" would otherwise run that subcommand). The task goes first and
|
|
228
230
|
# --no-pr after it, because a flag-first call also stays on legacy.
|
|
229
231
|
# --no-pr: engine10 ignores LOKI_DELEGATE_PR; this step holds no token.
|
|
230
|
-
# The run commits on loki/<runId>
|
|
232
|
+
# The run commits on loki/<runId> and leaves this checkout on the branch it started on.
|
|
231
233
|
TASK="Resolve ${ISSUE_REF}. Task spec follows. $(cat "$PRD_FILE")"
|
|
232
234
|
loki "$TASK" --no-pr || RC=$?
|
|
233
235
|
|
|
234
236
|
OUT="$RUNNER_TEMP/loki-out"
|
|
235
237
|
mkdir -p "$OUT"
|
|
236
|
-
|
|
238
|
+
RUN_DIR="$(ls -d .loki/runs/e10-* 2>/dev/null | sort | tail -n 1 || true)"
|
|
239
|
+
# The change is the commit the receipt names (head_sha), not HEAD: the engine commits on its
|
|
240
|
+
# own branch and puts the checkout back on the branch it started on.
|
|
241
|
+
TIP="HEAD"
|
|
242
|
+
if [ -n "$RUN_DIR" ] && [ -f "$RUN_DIR/receipt.json" ]; then
|
|
243
|
+
HS="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("head_sha",""))' "$RUN_DIR/receipt.json" 2>/dev/null || true)"
|
|
244
|
+
case "$HS" in
|
|
245
|
+
*[!0-9a-f]*|'') ;;
|
|
246
|
+
*) if git rev-parse -q --verify "${HS}^{commit}" >/dev/null 2>&1; then TIP="$HS"; fi ;;
|
|
247
|
+
esac
|
|
248
|
+
fi
|
|
249
|
+
git diff --binary "$START_SHA" "$TIP" -- . ':(exclude).loki' > "$OUT/loki.patch"
|
|
237
250
|
# PR body: the Loki 10 receipt this run sealed under .loki/runs/e10-*/.
|
|
238
251
|
# Rendered from the run's own receipt.md; the digest comes from receipt.json.
|
|
239
|
-
RUN_DIR="$(ls -d .loki/runs/e10-* 2>/dev/null | sort | tail -n 1)"
|
|
240
252
|
{
|
|
241
253
|
echo "Resolves ${ISSUE_REF}."
|
|
242
254
|
echo ""
|
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ loki chat # interactive alternative: Plan and
|
|
|
57
57
|
|
|
58
58
|
Every run starts from a delivery contract derived from your task, writes checks from the task alone before touching code, implements, verifies, and ends in exactly one outcome: VERIFIED, ALREADY_SATISFIED, FAILED, BUDGET_STOP, BLOCKED or STALLED ([exit codes](docs/exit-codes.md)). If the contract cannot be satisfied as written, the run stops and asks one question instead of guessing.
|
|
59
59
|
|
|
60
|
-
- **A pull request** written for a quick review: what the issue asked, what changed, how it was tested, and what was NOT PROVEN. A VERIFIED run opens a ready PR; a PARTIAL run opens a draft PR titled `[PARTIAL]` that leads with what is not proven;
|
|
60
|
+
- **A pull request** written for a quick review: what the issue asked, what changed, how it was tested, and what was NOT PROVEN. A VERIFIED run opens a ready PR; a PARTIAL run opens a draft PR titled `[PARTIAL]` that leads with what is not proven; a FAILED run with committed work opens a draft PR titled `[FAILED: <check>]` that leads with the checks still failing. The exception is a security scan secret match: that branch is never pushed, and Loki prints the file and line it matched and the push command to run after review. Any other outcome keeps the branch local and prints where it is.
|
|
61
61
|
- **A signed receipt** at `.loki/runs/<run-id>/receipt.json`, signed with a local Ed25519 key created on first run.
|
|
62
62
|
- **A specialist review** when the review council runs: it selects reviewers from a specialist pool (`agents/types.json`, scored by `run.sh:FOCUS_KEYWORDS`) by matching the changed files and diff against each reviewer's keywords.
|
|
63
63
|
|
|
@@ -168,7 +168,7 @@ macOS and Linux are supported.
|
|
|
168
168
|
|
|
169
169
|
- [Installation](docs/INSTALLATION.md), [environment variables](docs/environment-variables.md), [exit codes](docs/exit-codes.md), [known issues](docs/KNOWN-ISSUES.md), [privacy and telemetry](docs/PRIVACY.md)
|
|
170
170
|
- Agent Change Receipt format: [docs/AGENT-CHANGE-RECEIPT.md](docs/AGENT-CHANGE-RECEIPT.md)
|
|
171
|
-
-
|
|
171
|
+
- Label an issue, get a pull request (GitHub Actions, no hosted service, about 15 lines of workflow): [setup](docs/v10/GUIDE.md#triggers-without-a-cloud), [full example](docs/examples/loki-issue-to-pr.yml.example)
|
|
172
172
|
- Jira and Linear intake: [docs/trackers.md](docs/trackers.md). Two-way Slack: [docs/slack.md](docs/slack.md). Multi-repo runs and composite receipts: [docs/WORKSPACES.md](docs/WORKSPACES.md). Deploy: [docs/DEPLOY-PLAN.md](docs/DEPLOY-PLAN.md)
|
|
173
173
|
- MCP: the bundled server exposes 48 tools over stdio (`loki mcp`), including starting a run, reading its status and verifying its receipt. One-click install: [Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=loki-mode&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImxva2ktbW9kZSIsIm1jcCJdfQ==), [VS Code](vscode:mcp/install?%7B%22name%22%3A%22loki-mode%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22loki-mode%22%2C%22mcp%22%5D%7D). Or run `loki mcp install --client claude|cursor|vscode|windsurf`.
|
|
174
174
|
- Claude Code plugin: `claude plugin marketplace add asklokesh/loki-mode`, then `claude plugin install loki-mode@loki-mode`. The same marketplace ships [loki-seal](packages/loki-seal/README.md), a Stop hook that refuses "done" when tests newly fail or were weakened.
|
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.145.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.145.0 | [Autonomi](https://www.autonomi.dev/) flagship product | core skill**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
11.
|
|
1
|
+
11.145.0
|
|
@@ -103,7 +103,7 @@ CWD="${CWD:-${LOKI_TARGET_DIR:-$PWD}}"
|
|
|
103
103
|
# separate container or microVM with no host Docker socket, restricted
|
|
104
104
|
# credentials, and network policy. This parser only inspects text.
|
|
105
105
|
if "$HOST_GUARD"; then
|
|
106
|
-
HOST_GUARD_REASON=$(_LOKI_GUARD_COMMAND="$COMMAND" python3 - <<'PY'
|
|
106
|
+
HOST_GUARD_REASON=$(_LOKI_GUARD_COMMAND="$COMMAND" _LOKI_GUARD_INPUT="$INPUT" python3 - <<'PY'
|
|
107
107
|
import os
|
|
108
108
|
import re
|
|
109
109
|
import shlex
|
|
@@ -260,7 +260,127 @@ def classify(value, depth=0):
|
|
|
260
260
|
return ""
|
|
261
261
|
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
# Q1 HEREDOC-MASK: the body of a heredoc whose delimiter is quoted (<<'EOF', <<"EOF", <<-'EOF') is data: bash
|
|
264
|
+
# expands nothing in it. Tokenizing it made a file write whose body holds one apostrophe or one double quote
|
|
265
|
+
# unparseable, and the guard refused it ("command text could not be parsed safely"). The masker drops such a body
|
|
266
|
+
# (and its terminator line) only when the body cannot become a command: the command reading it is cat or tee, its
|
|
267
|
+
# output is not piped on, and no command line names a shell, eval, source, ., exec, xargs, ssh or coproc. Every
|
|
268
|
+
# command line and every unquoted body (which expands $(...)) is kept and checked as before. It works on the
|
|
269
|
+
# command as the tool sent it, before continuations are joined: inside a quoted body a backslash-newline is
|
|
270
|
+
# literal, so a joined copy would end the body at a different line than bash does. On anything it does not model
|
|
271
|
+
# (an unclosed quote, a backtick, $(, ((, <( or >( on a command line, another delimiter form, a body with no
|
|
272
|
+
# terminator line) it gives up and the command is classified exactly as before.
|
|
273
|
+
QUOTED_HEREDOC = re.compile(r"<<(-?)[ \t]*(['\"])([A-Za-z_][A-Za-z0-9_]*)\2(?=[\s;&|()<>]|$)")
|
|
274
|
+
UNQUOTED_HEREDOC = re.compile(r"<<(-?)[ \t]*([A-Za-z_][A-Za-z0-9_]*)(?=[\s;&|()<>]|$)")
|
|
275
|
+
DATA_READERS = {"cat", "tee"}
|
|
276
|
+
RUNS_TEXT = re.compile(r"(?:^|[\s;&|()/])(?:bash|sh|zsh|dash|ksh|eval|source|exec|xargs|ssh|coproc)(?=$|[\s;&|()])|(?:^|[\s;&|()])\.(?=[ \t])")
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def mask_quoted_heredocs(raw):
|
|
280
|
+
n, i, out, pending = len(raw), 0, [], []
|
|
281
|
+
seg_start, no_pipe = 0, False
|
|
282
|
+
while i < n:
|
|
283
|
+
c = raw[i]
|
|
284
|
+
if c == "\\":
|
|
285
|
+
out.append(raw[i:i + 2])
|
|
286
|
+
i += 2
|
|
287
|
+
continue
|
|
288
|
+
if c == "`" or raw.startswith(("$(", "((", "<(", ">("), i):
|
|
289
|
+
return None
|
|
290
|
+
if c == "'":
|
|
291
|
+
j = raw.find("'", i + 1)
|
|
292
|
+
if j < 0:
|
|
293
|
+
return None
|
|
294
|
+
out.append(raw[i:j + 1])
|
|
295
|
+
i = j + 1
|
|
296
|
+
continue
|
|
297
|
+
if c == '"':
|
|
298
|
+
j = i + 1
|
|
299
|
+
while j < n and raw[j] != '"':
|
|
300
|
+
if raw[j] == "`" or raw.startswith("$(", j):
|
|
301
|
+
return None
|
|
302
|
+
j += 2 if raw[j] == "\\" else 1
|
|
303
|
+
if j >= n:
|
|
304
|
+
return None
|
|
305
|
+
out.append(raw[i:j + 1])
|
|
306
|
+
i = j + 1
|
|
307
|
+
continue
|
|
308
|
+
if c == "#" and (i == 0 or raw[i - 1] in " \t\n;&|()<>"):
|
|
309
|
+
j = raw.find("\n", i)
|
|
310
|
+
j = n if j < 0 else j
|
|
311
|
+
out.append(raw[i:j])
|
|
312
|
+
i = j
|
|
313
|
+
continue
|
|
314
|
+
if raw.startswith("<<<", i):
|
|
315
|
+
out.append("<<<")
|
|
316
|
+
i += 3
|
|
317
|
+
continue
|
|
318
|
+
if raw.startswith("<<", i):
|
|
319
|
+
m = QUOTED_HEREDOC.match(raw, i)
|
|
320
|
+
if m:
|
|
321
|
+
try:
|
|
322
|
+
head = words(raw[seg_start:i])
|
|
323
|
+
except ValueError:
|
|
324
|
+
return None
|
|
325
|
+
while head and assignment.match(head[0]):
|
|
326
|
+
head = head[1:]
|
|
327
|
+
if not head or basename(head[0]) not in DATA_READERS:
|
|
328
|
+
return None
|
|
329
|
+
pending.append((m.group(3), m.group(1) == "-", False))
|
|
330
|
+
no_pipe = True
|
|
331
|
+
else:
|
|
332
|
+
m = UNQUOTED_HEREDOC.match(raw, i)
|
|
333
|
+
if not m:
|
|
334
|
+
return None
|
|
335
|
+
pending.append((m.group(2), m.group(1) == "-", True))
|
|
336
|
+
out.append(m.group(0))
|
|
337
|
+
i = m.end()
|
|
338
|
+
continue
|
|
339
|
+
if c in ";&|()\n":
|
|
340
|
+
if c == "|" and no_pipe and not raw.startswith("||", i):
|
|
341
|
+
return None
|
|
342
|
+
if c == "|" and raw.startswith("||", i):
|
|
343
|
+
out.append("||")
|
|
344
|
+
i += 2
|
|
345
|
+
seg_start, no_pipe = i, False
|
|
346
|
+
continue
|
|
347
|
+
seg_start, no_pipe = i + 1, False
|
|
348
|
+
out.append(c)
|
|
349
|
+
i += 1
|
|
350
|
+
if c == "\n" and pending:
|
|
351
|
+
for delim, strip, keep in pending:
|
|
352
|
+
while True:
|
|
353
|
+
if i >= n:
|
|
354
|
+
return None
|
|
355
|
+
nl = raw.find("\n", i)
|
|
356
|
+
stop = n if nl < 0 else nl + 1
|
|
357
|
+
line = raw[i:stop].rstrip("\n")
|
|
358
|
+
if keep:
|
|
359
|
+
out.append(raw[i:stop])
|
|
360
|
+
i = stop
|
|
361
|
+
if (line.lstrip("\t") if strip else line) == delim:
|
|
362
|
+
break
|
|
363
|
+
pending = []
|
|
364
|
+
seg_start = i
|
|
365
|
+
if pending:
|
|
366
|
+
return None
|
|
367
|
+
masked = "".join(out)
|
|
368
|
+
return None if RUNS_TEXT.search(masked) else masked
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
def to_classify():
|
|
372
|
+
try:
|
|
373
|
+
import json
|
|
374
|
+
raw = (json.loads(os.environ.get("_LOKI_GUARD_INPUT", "")).get("tool_input") or {}).get("command")
|
|
375
|
+
except Exception:
|
|
376
|
+
return command
|
|
377
|
+
masked = mask_quoted_heredocs(raw.replace("\0", "")) if isinstance(raw, str) else None # bash drops NUL bytes from $COMMAND; so does this copy
|
|
378
|
+
if masked is None:
|
|
379
|
+
return command
|
|
380
|
+
return re.sub(r"(?<!\\)((?:\\\\)*)\\\r?\n", r"\1", masked) # the continuation join the input step applies
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
reason = classify(to_classify())
|
|
264
384
|
if reason:
|
|
265
385
|
print("LOKI_HOST_GUARD: refusing " + reason + ". Use the platform sandbox and lifecycle APIs instead.")
|
|
266
386
|
PY
|
package/dashboard/__init__.py
CHANGED
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -243,9 +243,8 @@ templates/ 21 PRD templates (saas, cli, discord-bot, ...)
|
|
|
243
243
|
agents/ Agent registry: types.json, hub install, managed registry
|
|
244
244
|
benchmarks/ benchmark harnesses
|
|
245
245
|
plugins/ Claude Code plugin packaging
|
|
246
|
-
.github/workflows/ release.yml, converge-dist-tags.yml
|
|
247
|
-
|
|
248
|
-
scripts/local-ci.sh on every PR and push)
|
|
246
|
+
.github/workflows/ release.yml, converge-dist-tags.yml
|
|
247
|
+
(distribution only; tests run locally)
|
|
249
248
|
SKILL.md Slim core skill (progressive disclosure entry)
|
|
250
249
|
CLAUDE.md Project + agent operating instructions
|
|
251
250
|
VERSION / package.json Single source of version truth
|
|
@@ -324,9 +323,9 @@ docker/ Container distribution (Dockerfiles, compose)
|
|
|
324
323
|
TS providers module.
|
|
325
324
|
- **Docker / Docker Compose** for distribution and for the multi-service,
|
|
326
325
|
12-factor stacks Loki generates (web + database + cache with healthchecks).
|
|
327
|
-
- **GitHub Actions** (`.github/workflows/`): `release.yml`
|
|
328
|
-
release)
|
|
329
|
-
|
|
326
|
+
- **GitHub Actions** (`.github/workflows/`): distribution only, `release.yml`
|
|
327
|
+
(multi-channel release) and `converge-dist-tags.yml`. The hermetic tests
|
|
328
|
+
(`scripts/local-ci.sh`) run locally.
|
|
330
329
|
|
|
331
330
|
---
|
|
332
331
|
|
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.145.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.145.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
|
|
package/docs/TESTING.md
CHANGED
|
@@ -9,7 +9,7 @@ bash scripts/local-ci.sh # all tests, cheap on
|
|
|
9
9
|
LOCAL_CI_ONLY=hygiene,pack-contents bash scripts/local-ci.sh # a subset
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
`npm test` runs the same command.
|
|
12
|
+
`npm test` runs the same command. GitHub Actions runs no test workflow; this script is the only test gate. One-time setup for `dist-freshness`: `bun install --cwd loki-ts --frozen-lockfile`.
|
|
13
13
|
|
|
14
14
|
## What each test guards
|
|
15
15
|
|
|
@@ -71,6 +71,16 @@ Four measured-harness disciplines on the trust core. None can weaken a gate.
|
|
|
71
71
|
load-bearing**: unrecognized failures stay TRANSIENT and retry as before; rate
|
|
72
72
|
limits are explicitly excluded from the permanent set. Never invert this
|
|
73
73
|
default. `LOKI_SMART_RETRY=0`.
|
|
74
|
+
- **Usage-limit pause** (`usageLimitOf` in `loki-ts/src/runner/retry_class.ts`,
|
|
75
|
+
`USAGE_LIMIT_STOP` in `loki-ts/src/engine10/machine.ts`): an engine10 session
|
|
76
|
+
that ends on a plan usage limit (the SDK parser's `[sdk-loop error: usage
|
|
77
|
+
limit...]` line from the structural rate_limit frame, or the provider CLI's
|
|
78
|
+
own stderr line) is session kind `usage_limit`, never a quota wait, a retry or
|
|
79
|
+
a failure. The run stops at that session: the cut stage records no result, commit
|
|
80
|
+
and seal never run, and the supervisor closes the run through the cancel path
|
|
81
|
+
(outcome CANCELLED, `run.completed` `paused: "usage_limit"`), so the next
|
|
82
|
+
`loki start` of the same task offers to resume it. The Reason line names the
|
|
83
|
+
stage, the provider's limit line and its reset.
|
|
74
84
|
|
|
75
85
|
Observability: SDK failures emit a structured `capability_degraded` record to
|
|
76
86
|
`.loki/events.jsonl`; `.loki/app-runner/first-preview.json` records
|
|
@@ -140,7 +150,9 @@ These knobs together implement the RARV-C (closure) loop: findings -> override c
|
|
|
140
150
|
- `LOKI_E10_RUN_OUTPUT_DROP` -- on by default, `0` opts out (RO; `runOutputs` in `loki-ts/src/e10ext/commit_filter.ts`, part of `dropSet` beside GB, named on the receipt with the GB note). A deterministic filter before commit, never a model judgment: an ADDED file under a `.loki/` or `.loki-*` directory at any depth (the root one was always dropped), under `test-results/`, `playwright-report/`, `blob-report/`, `coverage/`, `htmlcov/`, `.nyc_output/`, `.pytest_cache/`, `.mypy_cache/`, `.ruff_cache/`, `.tox/` or `.hypothesis/` anywhere, or a JUnit report, `*.log`, `.coverage`, `lcov.info`, `coverage.xml` or `nohup.out` file, never reaches the delivered diff. Kept: the task names the file, or that directory holds a file tracked at base. The self-check's stray-files item records these as `auto`. The failure: on held-out repos the top review-fail class was stray committed run artifacts (test-results output and nested `.loki` logs).
|
|
141
151
|
- `LOKI_E10_CHANGELOG_REF` -- on by default, `0` opts out (CR; `changelogRefStyle`, `releaseNoteProblems` and the CL brief line in `loki-ts/src/project_model/conventions.ts`; checked by the self-check's release-note item). The reference form most existing changelog entries use (a markdown issue/PR link, `(#N)`, an rst `:pr:` role, `GH-N`, bare `#N`; at least 3 of the first 40 bullets and at least half) goes into the CL brief line with "use the number the task gives in that form, and never invent a number". The self-check flags an added entry that cites a number the task does not give, an entry with no reference to the task's number when existing entries carry one, a changeset naming a package no changed file belongs to, and a towncrier fragment numbered differently from the task's issue; a flag starts the self-check's review turn. After that turn a deterministic pass (`stripInventedRefsInFile`, `stripInventedReleaseRefs` in `features/self_review.ts`) removes from every release-note line the run added each `#N`, `(#N)`, `[#N](url)`, issue or pull URL, `:pr:` role and `GH-N` whose number the task input never gives, and tidies what is left, so the entry falls back to the repo's no-reference form; the receipt lists each removal (`changelog_refs_removed`). Base lines are never touched. The failure: on held-out repos the second review-fail class was changelog entries with no PR or issue reference, or with the wrong package or issue number.
|
|
142
152
|
- `LOKI_E10_SELF_REVIEW` -- on by default, `0` opts out, `always` runs the turn on every run (SR; `loki-ts/src/features/self_review.ts`, called at the end of the implement stage after the named-sites check and before the Wall restore; the receipt carries `self_review`). The pre-delivery review self-check. Five deterministic items are computed on the implemented tree against base, with no model call: (a) a release note the repo's rules require (the CL, changeset or towncrier convention) and the diff lacks; (b) stray files: a run-added file in a directory the repo has never tracked (build output is recorded as `auto`, the commit filter drops it); (c) a source change with no test file in the diff; (d) format: `auto` when a configured formatter normalizes the changed files at commit, otherwise the style configs are named; (e) scope: edits to existing files outside every scope signal (`outsideScope`). When any item is flagged (or with `always`), one bounded resume of the implement session (suffix `-rv`, turn cap `LOKI_E10_SELF_REVIEW_MAX_TURNS`, default 12, the cost cap; skipped when the stage has under 60 s left) gets the flagged items, the CONTRIBUTING and PR template text (6000 characters) and the style config names, may edit the diff, must change nothing that already follows the rules, and ends with one `REVIEW <a-e>: ok|fixed|justified: <reason>` line per item. Each item is then settled: the after-turn check no longer flagging it reads `fixed`; a persisting flag reads `justified` only with a stated reason, else `unresolved`. A clean minimal diff starts no turn, so it is never touched and costs nothing. Verify and the commit stage run on the reviewed tree as usual.
|
|
153
|
+
- `LOKI_E10_VERIFIED_FINISH` -- OFF by default until measured, `1` turns it on (VF; `verifiedFinishBrief` in `loki-ts/src/features/self_review.ts`, `runVerifiedFinish` in `loki-ts/src/util/conflict_resume.ts`). When the SR self-check wants its one review turn, the turn runs as a FRESH session (iteration suffix `-fin`, no resume of the implement transcript, turn cap `LOKI_E10_VERIFIED_FINISH_MAX_TURNS`, default 8) whose whole brief is: a lead line, the SR review instructions and items, the release-note convention line, the diff against base (build and run output the commit filter drops left out; 40k chars), and the pre-fix text of each modified file (12k each, 36k total), with the repo's contribution rules inside the SR brief. No task text and no implement brief. The turn guard (TG below) always runs on it, whatever LOKI_E10_REVIEW_TURN_GUARD says. The receipt's `self_review.finish` is the fire marker (`fired`, `iteration`, `brief_chars`, `diff_files`, `left_out`).
|
|
143
154
|
- `LOKI_E10_REVIEW_TURN_GUARD` -- OFF by default until measured, `1` turns it on (TG; `guardReviewTurn`, `restoreTurnPaths` in `loki-ts/src/features/self_review.ts`, `reviewTurnGuard` in `loki-ts/src/engine10/stages/implement.ts`). Before the SR review turn the tree is snapshotted against base. When the turn changes any path, the tests of those paths (`patchCheckRefs`: the impacted tests of the turn's paths plus its own test files, at most 6) are rerun quietly through verify's runner. A test that fails after the turn is rerun with only the turn's paths put back to the snapshot; if it passes there, the turn stays taken back (the implement diff is kept, the implement result is not replaced by the review reply, and the items settle against the restored tree with the review reply ignored, so a flag the turn tried to fix reads unresolved), `self_review.turn_guard` records the paths, the runs and the broken test, and the receipt `not_proven` names it. A test that also fails without the turn keeps the turn. A new test file the turn added is never counted as a test that passed before.
|
|
155
|
+
- `LOKI_E10_REPO_CONVENTIONS` -- OFF by default until measured, `1` turns it on (RC; `repoConventionFlags`, `precommitFlags`, `guideBans`, `banFlags` in `loki-ts/src/features/self_review.ts`, self-check item (i) "conventions"). Runs the repository's own convention checks on the change, with no install and no model. (1) The local hooks of `.pre-commit-config.yaml` that need no environment: `language: fail` (a changed file matching `files` and not `exclude` is rejected with the hook's entry text) and `pygrep` (the entry regex found in an added line, `--ignore-case` honored). Python regexes are translated: `(?x)` verbose mode and `(?P<name>` groups. Hooks with an install, unknown `types` or other args are skipped. (2) The contribution guide's explicit bans, "never use `X`" / "do not use `X`" / "don't use `X`" for an identifier-shaped X, as a whole-word grep of added code lines with comments and string literals removed. Import and export lines are skipped, the guide's own "only exception is `X Y`" is exempt, and so is a use whose surrounding text the file already has on base (the repository's established usage, such as recharts' `DataKey<any>`). A hit flags the item, so the one review turn gets the hook's message or the rule. Replay on dev4 and dev2: verdicts/repo-conventions.md.
|
|
144
156
|
- `LOKI_E10_SR_COVERAGE` -- on by default since 11.141.3 (measured on dev2, 2 seeds, GOALS A3.2), `0` opts out (SC; `statedCases`, `caseCovered`, `siblingDefinitions` in `loki-ts/src/features/self_review.ts`). Two more self-check items, computed only when the diff changes source: (f) stated cases, kept to fenced code blocks that show an error or a result (an error or exception token, a `// =>` result comment, or an expected/actual/output/returns/raises line right after the block) and four sentence forms ("similar error when ...", "... has the same effect", "both `x` and `y`" with a code token, "gets neither treatment"); a block case is covered when an added test line carries one of the block's called names, a sentence case when an added test line carries one of its backticked tokens, and a sentence with no code token is always flagged; at most 8 cases. (g) sibling definitions: other definitions, by name, of the function or method enclosing each changed hunk (Python, JS/TS, Go, Rust), in untouched non-test files of the same language, outside vendored or built dirs; a name with more than 5 such definitions, and common names (`__init__`, `constructor`, `main` ...), are dropped. Either flag starts the existing single `-rv` review turn, whose brief adds items (f) and (g) and accepts `REVIEW f|g` lines; a clean minimal diff still starts no turn. The failure: on a held-out style dev set Loki fixed the headline case and missed a stated one (a "similar error when wrapping it in ..." edge, a "... has the same effect" sentence, the issue's own error reproduction) or a sibling override in a subclass, while a stronger raw model covered them; expected reach 3-4 of those 6 losses, unmeasured.
|
|
145
157
|
- `LOKI_E10_DOC_ENUM` -- on by default since 11.141.3 (measured on dev2, 2 seeds, GOALS A3.2), `0` opts out (DE; `docEnumerations` in `loki-ts/src/features/self_review.ts`, self-check item (h) "docs"). A Markdown file in a changed source file's directory, or a `docs/` page named after its directory or file, that the diff leaves untouched and that already names at least 2 of the option keys or quoted names the source file holds on base, is flagged when the change adds a new key or name the doc does not carry. The flag starts the existing single review turn (brief item (h), reply `REVIEW h`). The failure: a change added a secondary option to two rules and left each rule's README, which lists every other option, without it.
|
|
146
158
|
- `LOKI_E10_DOC_UPDATE_RULE` -- on by default since 11.141.3 (measured on dev2, 2 seeds, GOALS A3.2), `0` opts out (UD; `DOC_RULE_UPDATE` and `fixedRules` in `loki-ts/src/e10ext/context.ts`). The implement and fix rules no longer say "write no documentation": they say to write no new documentation pages unless asked, but to update existing docs that list what changed (an option, flag, method, rule or name a README or doc page already lists gets its entry, written like the entries around it). The never-announce-missing-behavior rule is unchanged. `=0` restores the v11.139.0 line byte for byte (`FIXED_RULES_DOC_V139`); either text is a constant, so the rules prefix stays cache-stable, and the legacy block (`LOKI_E10_PINNED_TEST_UPDATE=0`) keeps the old line. The failure: both Loki arms left a rule's README, which lists every option, without the added option, while every raw arm updated it.
|
|
@@ -172,6 +184,8 @@ These knobs together implement the RARV-C (closure) loop: findings -> override c
|
|
|
172
184
|
- `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
185
|
- `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
186
|
- `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.
|
|
187
|
+
- `LOKI_E10_SUITE_TIMEOUT_NOT_RUN` -- on by default, `0` opts out (`loki-ts/src/project_model/package_suite.ts` runPackageSuites and `loki-ts/src/engine10/stages/deep.ts` runFullSuite; `util/shell.ts` run reports `timedOut`). A full suite stopped by its timeout is not_run "timed out after N s" and runs in its own process group.
|
|
188
|
+
- `LOKI_E10_LINT_UNTOUCHED` -- off by default, `1` opts in (acc-174; off because it changed no label on 150 stored bench runs and has not fired on a real run; `loki-ts/src/engine10/stages/verify.ts` tscUntouchedOnly in runLintChecks, seal lists `lint_untouched`). A failed project-wide tsc whose every diagnostic is in an untouched, unnamed file, with no compiler or linter config changed, no changed symbol in the output, and every diagnostic line also in the same tsc run on the base snapshot (tscOnBase; no base output refuses), is not blocking and is disclosed on the receipt.
|
|
175
189
|
- `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.
|
|
176
190
|
- `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.
|
|
177
191
|
- `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.
|
|
@@ -191,6 +205,15 @@ These knobs together implement the RARV-C (closure) loop: findings -> override c
|
|
|
191
205
|
- `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
206
|
- `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
207
|
- `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.
|
|
208
|
+
- `LOKI_E10_PROVE_BY_RUNNING` -- on by default, `0` opts out of everything below (Q1 F5 and candidate 1; `loki-ts/src/e10ext/context.ts` issueRules, PROVE_BY_RUNNING_BLOCK, TAKE_THE_TIME_LINE, DELIVER_EACH_LINE, proveByRunningBlock; `engine10/types.ts` ISSUE_FINISH_LINE and issueRunBrief; `engine10/stages/implement.ts`; `engine10/machine.ts`). Scope: an issue run (intake source `issue`) on the claude provider, implement stage only. (1) Rules: fixedRules(env, true) is today's rules constant with `- Never leave a long-lived server running.` and `- Never kill processes.` replaced by ISSUE_RULE_LINE (start the repository's own services and throwaway dependencies, stop each by its recorded process id, never signal another process) and FINISH_LINE replaced by ISSUE_FINISH_LINE (the same three endings plus `LOKI_UNFINISHED: <what is left>`, and `LOKI_SPEC_CONFLICT` only for a contradicting test); the brief's closing finish line and the S1b continue brief use ISSUE_FINISH_LINE too. Each is a constant, so the prefix stays cache-stable within issue runs. (2) Per-task part: the prove-by-running block (run the change the way its caller does; no fixed port; tried-first rule for anything that cannot be run), the take-the-time line, the deliver-each line and the environment card line. (3) No time-budget sentence (machine.ts withTimeNote is skipped); the stage limit is enforced as before. LOKI_UNFINISHED needs no parser change: session.ts finishLineOf reads only the three finish lines, so S1b resumes such a reply and seals it `incomplete` (PARTIAL, diff and PR kept, the reply's own text in NOT PROVEN). A text goal, opencode, the fix stage and every other stage keep today's constants and briefs byte for byte.
|
|
209
|
+
- Q1 run scratch (no own knob; candidate 1 scope, `LOKI_E10_PROVE_BY_RUNNING=0` opts out; `loki-ts/src/runner/worker_proc.ts` createSessionScratch, cleanupSessionScratch, ownedProcesses, cleanupScratchRecord, cleanupStaleScratches). Before implement the harness makes /tmp/lk-XXXXXX (mode 700, a marker holding its own path) and writes `<runDir>/scratch.json` (dir, since, nonce, worker pid); the implement session and its resumes get LOKI_SCRATCH, LOKI_SCRATCH_SINCE, TMPDIR and LOKI_RUN_OWNER (scratchSessionEnv). Ownership is proven by the harness: a process of this user started at or after `since` is the run's when LOKI_RUN_OWNER=<nonce> is in its environment (`ps eww` on macOS, /proc/PID/environ on linux; only a match is kept), its resolved working directory (lsof cwd or /proc) or an absolute command-line path resolves inside the scratch directory, or its parent is the run's. A path in the work tree is never evidence; the session's `<dir>/pids` is a hint only, and a listed pid that is not proven is left alone and reported (`left running, not proven ours`). Each signal is sent only after the pid's start time (lstartEpoch, one or two spaces before a single-digit day) is read again and found unchanged: TERM, about 2 s, KILL; the scan repeats until nothing owned is alive, and only then is the directory removed (else kept, with the reason). Runs after implement and its resumes, in a process exit hook, in the supervisor after the worker exits (any stop path), and at the next run's start for a record whose worker pid is gone. Measured on macOS with real binaries: a pg_ctl postmaster and npm exec tsx with its node children carry the nonce; `redis-server --daemonize yes` loses it and is found only by a --dir in scratch; platform binaries such as /bin/sleep hide their environment from ps. tests/min/scratch-real-services.sh (non-hermetic, not in local-ci) runs the real pg_ctl, redis and tsx cases. The host guard has no scratch allowances.
|
|
210
|
+
- `LOKI_E10_CONFLICT_NEEDS_TEST` -- off by default, `1` turns it on (Q1 H1, unmeasured: off pending one measured run; `loki-ts/src/util/conflict_resume.ts` citesTestFile, asUnfinishedConflict, used by `engine10/stages/implement.ts` and resumeToFinish). On an issue run on claude, an implement reply whose LOKI_SPEC_CONFLICT reason cites no test file (no path under a tests, test, __tests__ or spec directory and no test or spec file name) is an unfinished reply: the conflict is dropped before the FC-19 conflict correction, so that reply never gets the `-r` turn, and S1b resumes it once per reply; if the session ends that way, implement exits `incomplete` (PARTIAL, work and pull request kept), never SPEC_CONFLICT or BLOCKED. A `-r` reply and each S1b resume reply get the same rule. A conflict that cites a test path, with or without a line, is unchanged. Text goals, opencode and the fix stage are unchanged.
|
|
211
|
+
- `LOKI_E10_COMPACT_WINDOW` -- unset by default (measurement knob; `loki-ts/src/runner/providers.ts` compactWindowSettings). `off` gives a Haiku session no 100K auto-compact window, so the model's own default applies.
|
|
212
|
+
- `LOKI_E10_TIME_NOTE` -- unset by default (measurement knob; `loki-ts/src/util/run_cap.ts` timeNoteOn, read by `engine10/machine.ts`). `0` adds no time-budget sentence to the implement brief or its resumes on any run; the stage limit is enforced as before. Issue runs on claude already omit it (LOKI_E10_PROVE_BY_RUNNING).
|
|
213
|
+
- `LOKI_E10_ENV_CARD` -- on by default, `0` opts out (candidate 1; `loki-ts/src/util/stack_tools.ts` neededServices, detectServiceBinaries, envCardLine, envCard; issue runs on claude with LOKI_E10_PROVE_BY_RUNNING on). Before implement, no model call, no network: the services the repository mentions (pg, postgres, psycopg, asyncpg, pgx; redis, ioredis; mysql, mariadb; mongodb, mongoose in package.json, requirements, pyproject, go.mod, docker-compose, compose or .env.example, up to two directories down) are looked up on PATH, then in Homebrew kegs `/opt/homebrew/opt/<keg>/bin` and `/usr/local/opt/<keg>/bin`, `/usr/lib/postgresql/<v>/bin` and `/Applications/Postgres.app/Contents/Versions/<v>/bin` (newest version wins). Each found off PATH is appended (never prepended) to the PATH of the implement session and its resumes only (SessionRunOptions.pathAppend, session.ts childEnv), and one `Available on this machine: ...` line joins the per-task brief. `<runDir>/env-card.json` and one `env.card` event record what was found; no env value is stored. Any error gives no card. `LOKI_E10_ENV_CARD_ROOTS` (colon list) replaces the off-PATH locations, for tests.
|
|
214
|
+
- `LOKI_E10_PROVE` -- off by default, `1` turns it on (Q1 prove stage; `loki-ts/src/engine10/stages/prove.ts`, run by `engine10/machine.ts` proveNow, not in FLOW). An issue run (intake source `issue`) on the claude provider whose implement ended `done`, after implement's continue loop and review turn and before the first verify. Budget: `LOKI_E10_PROVE_BUDGET_S` (default 600) covers the listing, the prover session, the head pass and the base pass; it is held back from implement's window and added to a sized cap up to `capCeilingS` (an explicit cap does not grow). (1) Listing (`stages/prove_list.ts` listBrief, frozen text): a short session (`ctx.sessions.run`, maxTurns 3, empty temp cwd, iteration `<run>-prove-ls<n>`) sees only the issue (issue.json title and body) and writes `{"asks": [...]}`; checkAsks accepts it only when every ask, without its list or checkbox marker and with whitespace collapsed, is a substring of the issue read the same way with checked-box lines dropped. One retry names the failures; a second failure ends the stage with `not proved: asks could not be listed`. More than 12 asks: the first 12 run and a `not proved: more than 12 asks` line caps. (2) Prover (iteration `<run>-prove`, the session model, up to half the budget): the issue, the environment card, the fixed list and the tree, never the implementer's reply, plan or brief; it writes setup.sh, teardown.sh and ask-<id>.sh (with endpoints and pids, the predeclared HARNESS-OUTPUTS). Its brief forbids fixed ports, prefers unix sockets in $PROVE_TMP and requires `$PROVE_DIR/endpoints` and `$PROVE_DIR/pids`. It must run its own setup and every ask script before it finishes, fix defects in its own scripts (quoting, a body the caller does not send, leftover data, not safe to rerun) and never change what a script checks; the harness then runs the final scripts in its own clean environment (a fresh $PROVE_TMP, endpoints and pids cleared). An edit or delete of an existing file it makes is put back and caps; a new file its own run created is removed and disclosed. `prover.done` lets a resumed run reuse the list and scripts. (3) Harness: one bash driver per pass in its own process group (Bun.spawn detached; `runner/worker_proc.ts` killGroup on the limit, on abort and always at the end; env `util/check_result.ts` plainTestEnv plus PROVE_ROOT, PROVE_TMP, PROVE_DIR): setup, then the endpoint check, then each ask with `LOKI_E10_PROVE_SCRIPT_S` (default 120 s), then teardown (rerun on its own when the pass was cut). An endpoint is the run's own when its port was not listening before setup (lsof for this user's listeners; on macOS netstat prints nothing from inside a Loki worker, so lsof leads; linux adds `ss -Hltn`, then netstat) and its listener started during the pass and is proven the pass's (`runner/worker_proc.ts` ownedProcesses: the pass's LOKI_RUN_OWNER value in its environment, its directory or a command-line path in $PROVE_TMP, or an owned parent), or the endpoint is a unix socket inside $PROVE_TMP; one bad endpoint skips every ask as `port was not ours`. Each pass's $PROVE_TMP is a harness scratch (`createSessionScratch`, recorded in the run dir); after teardown `cleanupSessionScratch` stops what is proven the pass's and removes it, and an id in prove/pids that is not proven is reported, never signalled. The prover session and each repair resume get a scratch of their own as TMPDIR, cleaned the same way after them (FireLater ps-1: the prover's own run left a Postgres and a Redis). A worker SIGINT/SIGTERM runs `cancelProve` (teardown, group kill, the same cleanup). Exit 0 is proved, 3 is not run here (the receipt line names services the card lists as not found), anything else, a missing script, a failed setup or a timeout is not proved. Asks proved on head run again on a fresh base checkout (`machine.ts` freshBaseCheckout); exit 0 there too is `check also passes without the change`; base not run lets head stand. After the verify loop a changed tree reruns the scripts (`recheckProve`) or caps. Seal adds `not proved: <ask>: <reason>` per unproved ask to its open notes (PARTIAL, never BLOCKED or FAILED); a run in scope with no complete record caps too. Receipt key `prove` (asks, command, head, base, endpoints, leftovers, wall_s) only when the stage left a record; `pr.ts` partialHead opens with the ask, command, result table. Events prove.started, prove.ask, prove.completed (with wall_s). A text goal, opencode and `LOKI_E10_PROVE=0` keep stage order, receipt keys, budgets and verdict byte-identical (tests/min/decompose-and-intake.sh).
|
|
215
|
+
- `LOKI_E10_PROVE_REPAIR` -- on by default, `0` opts out (Q1 prove repair; `engine10/stages/prove.ts`). After the head pass, asks that are not proved (not those skipped by the endpoint check, nor "not run here") go back to the implement session through `util/conflict_resume.ts` resumeForProve (resumeWith, suffix `-pv<round>`, the last implement iteration and the saved implement brief, gated on RESUME_MIN_LEFT_S of implement time and 90 s of stage time) with `repairBrief` (each ask, its command and its reason); the sealed Wall files are restored after each resume and the same scripts rerun. At most two rounds; each is a `rounds` entry with its iteration id and a prove.ask per ask. The base pass runs after the last round.
|
|
216
|
+
- F3 reviewer UNMET cap (no knob; Q1 F3; `loki-ts/src/engine10/stages/xreview.ts` isUnmetNote and parseReview, `stages/seal.ts` openNotes). A cross-review reason that says an asked-for line is unmet (`UNMET: ...`, the form util/intent_card.ts asks for) becomes an open note at seal, which caps VERIFIED at PARTIAL. parseReview sorts UNMET reasons ahead of the others before its 5-reason cap, so one written sixth is kept. The review levels, when the review runs and its prompt are unchanged; a run with no review is unchanged.
|
|
194
217
|
- `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
218
|
- `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
219
|
- `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.
|
|
@@ -5,7 +5,7 @@ Release steps and local CI details for maintainers.
|
|
|
5
5
|
## Local CI Before Every Push
|
|
6
6
|
|
|
7
7
|
`bash scripts/local-ci.sh` runs the hermetic tests under `tests/min/` (see `docs/TESTING.md`); it
|
|
8
|
-
is the pre-push gate and the
|
|
8
|
+
is the pre-push gate and the only test gate (GitHub runs distribution workflows only). `.githooks/pre-push`
|
|
9
9
|
enforces the repo-identity check, `bash -n` on `autonomy/run.sh` and `autonomy/loki`, the secret scan,
|
|
10
10
|
and the red-main warning; a push is not "done" until `git ls-remote origin refs/heads/main` matches
|
|
11
11
|
the local HEAD. `scripts/release.sh` runs no test gate: run `bash scripts/local-ci.sh` before
|
|
@@ -113,7 +113,7 @@ create tags.
|
|
|
113
113
|
|
|
114
114
|
Run the engine end-to-end check alone with `cd loki-ts && bun run test:engine10` (it runs `tests/min/engine10-e2e-stub.sh` through `scripts/local-ci.sh`).
|
|
115
115
|
|
|
116
|
-
`release.sh --ship` refuses with exit 6 (SHIP_CI_NOT_GREEN) unless the latest completed
|
|
116
|
+
`release.sh --ship` requires no GitHub CI run by default: the gate is one full `bash scripts/local-ci.sh` on the release SHA. To require one again, set LOKI_RELEASE_CI_WORKFLOWS to a comma list of workflow names; `--ship` then refuses with exit 6 (SHIP_CI_NOT_GREEN) unless the latest completed run of each on HEAD, or on its parent when HEAD has none, succeeded, and a gh error or a timeout (LOKI_RELEASE_CI_TIMEOUT_S, default 30) also refuses. `bash scripts/release.sh --check-ci` runs the same check alone.
|
|
117
117
|
|
|
118
118
|
Before pushing the release commit, run `bash scripts/release.sh --check-clean`: it exits 1 naming any tracked file (for example a stamped `loki-ts/dist/loki.js.map`) the commit left modified; `--bump-only` prints the "stage these files:" list.
|
|
119
119
|
|
|
@@ -28,10 +28,17 @@ 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
|
+
| `LOKI_E10_PROVE_BY_RUNNING` | `1` | On an issue run with the Claude provider, the implement session may start the repository's own services (and must stop what it started), is asked to prove the change by running it the way its real caller does, to finish every item the issue lists or end with `LOKI_UNFINISHED: <what is left>`, and gets no time-budget sentence. `0` leaves the issue-run brief as before. |
|
|
32
|
+
| `LOKI_E10_ENV_CARD` | `1` | On an issue run with the Claude provider, database and cache servers the repository needs (Postgres, Redis, MySQL or MariaDB, MongoDB) that are installed off PATH, for example as a Homebrew keg-only package, are added to the end of the implement session's PATH and named in its brief. `0` turns this off. |
|
|
33
|
+
| `LOKI_E10_PROVE` | `0` (off) | On an issue run with the Claude provider, the issue's asks are listed word for word, a separate session writes one script per ask and the harness runs them on a fresh environment and on the base commit; the run is VERIFIED only when every ask passes on the change and fails without it. Off by default; `1` turns the stage on. `LOKI_E10_PROVE_BUDGET_S` (default `600`) is the stage's time, added to a sized run cap; `LOKI_E10_PROVE_SCRIPT_S` (default `120`) is each script's limit. |
|
|
34
|
+
| `LOKI_E10_ISSUE_ACCEPTANCE` | on | On an issue run, the label is checked against the issue's own acceptance lines: one short check marks each line met (with evidence that it was exercised) or not met, and any line not met makes the run PARTIAL. `0` turns the check and the cap off. `LOKI_E10_ISSUE_ACCEPTANCE_MODEL` picks the model for the check (default: the run's own model). |
|
|
35
|
+
| `LOKI_PR_LABEL` | on | Loki sets a GitHub label on the pull request and the issue: `loki: safe to merge` on VERIFIED, `loki: needs you` otherwise. `0` turns it off. |
|
|
36
|
+
| `LOKI_E10_PROOF_RERUN` | on | On an issue run, Loki runs the session's proof script (`$TMPDIR/loki-proof.sh`) again by itself after the session and every fix round, in a new empty directory; the acceptance check uses that run's real output and a failing re-run keeps the run from VERIFIED. `0` turns it off. `LOKI_E10_PROOF_RERUN_S` is its time limit in seconds (default 600). |
|
|
37
|
+
| `LOKI_E10_PROVE_REPAIR` | `1` | The prove stage sends asks its scripts did not prove back to the implement session, two rounds at most, and reruns the scripts. `0` keeps the first result. |
|
|
31
38
|
| `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
39
|
| `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
40
|
| `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. |
|
|
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. |
|
|
41
|
+
| `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. When the push is refused as a non-fast-forward because the origin already holds `loki/<issue>-combined` from an earlier run of the issue, the rerun publishes on `loki/<issue>-combined-<run id>` (never a forced push), and its PR body links the earlier open combined PRs for you to close; Loki never closes, edits or deletes them. Any other push failure is not retried and the `Combined:` line gives its reason. `0` opens one PR per slice, as before. |
|
|
35
42
|
| `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. |
|
|
36
43
|
| `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. |
|
|
37
44
|
|