loki-mode 11.3.8 → 11.4.2

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 (103) hide show
  1. package/README.md +34 -18
  2. package/SKILL.md +3 -3
  3. package/VERSION +1 -1
  4. package/agents/custom_agents.py +280 -0
  5. package/autonomy/council-v2.sh +22 -1
  6. package/autonomy/edit.sh +242 -0
  7. package/autonomy/lib/chat.sh +312 -0
  8. package/autonomy/lib/help-core.sh +164 -0
  9. package/autonomy/lib/json-output.sh +38 -0
  10. package/autonomy/lib/run-summary.sh +96 -0
  11. package/autonomy/loki +105 -10
  12. package/autonomy/route.sh +270 -0
  13. package/autonomy/run.sh +6 -0
  14. package/autonomy/setup-wizard.sh +161 -0
  15. package/autonomy/verify.sh +22 -2
  16. package/bin/loki +73 -18
  17. package/completions/_loki +55 -0
  18. package/completions/loki.bash +49 -3
  19. package/dashboard/__init__.py +1 -1
  20. package/docs/CLI-CORE-VERBS.md +112 -0
  21. package/docs/CLI-REFERENCE.md +7 -1
  22. package/docs/COMPARE-OPENCODE.md +94 -0
  23. package/docs/COMPONENTS.md +1 -0
  24. package/docs/INSTALLATION.md +56 -12
  25. package/docs/KNOWN-ISSUES.md +2 -12
  26. package/docs/QUICKSTART.md +108 -0
  27. package/docs/environment-variables.md +9 -2
  28. package/docs/exit-codes.md +29 -12
  29. package/docs/v10/CLI-MODERN.md +10 -4
  30. package/docs/v10/FAILURE-CLASSES.md +2 -2
  31. package/docs/v10/GUIDE.md +270 -44
  32. package/docs/v10/METRICS.md +6 -0
  33. package/docs/v10/OPENCODE-PARITY-PLAN.md +84 -0
  34. package/docs/v10/PROGRESS.md +7 -0
  35. package/loki-ts/dist/loki.js +968 -933
  36. package/mcp/__init__.py +1 -1
  37. package/package.json +2 -2
  38. package/packages/control-plane/dist/server.js +198 -86
  39. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  40. package/providers/claude.sh +16 -2
  41. package/providers/model_route_exec.sh +22 -0
  42. package/providers/model_routes.sh +188 -0
  43. package/skills/providers.md +13 -0
  44. package/templates/agents/planner.md +10 -0
  45. package/templates/agents/reviewer.md +10 -0
  46. package/templates/agents/tester.md +10 -0
  47. package/web-app/dist/assets/{AdminPage-D1jlQGeE.js → AdminPage-CYJ2BWRC.js} +1 -1
  48. package/web-app/dist/assets/{Avatar-QUX_aJfQ.js → Avatar-DdK4wynI.js} +1 -1
  49. package/web-app/dist/assets/{Badge-pysXUR6J.js → Badge-CrX3MI7J.js} +1 -1
  50. package/web-app/dist/assets/{Button-CWzlTw9P.js → Button-709-wwGM.js} +1 -1
  51. package/web-app/dist/assets/{CockpitPage-DLCoLdyF.js → CockpitPage-BapdTInO.js} +1 -1
  52. package/web-app/dist/assets/{ComparePage-CCENGIti.js → ComparePage-DT99pGvA.js} +1 -1
  53. package/web-app/dist/assets/{ErrorBoundary-BssCcbgv.js → ErrorBoundary-B0uJSys8.js} +1 -1
  54. package/web-app/dist/assets/{EvidenceReceiptPanel-CwmAqJ90.js → EvidenceReceiptPanel-BtMFgElP.js} +1 -1
  55. package/web-app/dist/assets/{GitHubIssuesPanel-DuSw8shb.js → GitHubIssuesPanel-DjJuU941.js} +1 -1
  56. package/web-app/dist/assets/{GitHubPRsPanel-CGvLbDjh.js → GitHubPRsPanel-HXfEX1BC.js} +1 -1
  57. package/web-app/dist/assets/{HomePage-BrBX5Gn2.js → HomePage-Cqyves-S.js} +2 -2
  58. package/web-app/dist/assets/{LoginPage-DPjr7QHU.js → LoginPage-jUbtC7_Y.js} +1 -1
  59. package/web-app/dist/assets/{MagicPage-Dxd7FWF2.js → MagicPage-DHRsqjgR.js} +1 -1
  60. package/web-app/dist/assets/{MetricsPage-BP47Urni.js → MetricsPage-B-pED05R.js} +1 -1
  61. package/web-app/dist/assets/{NotFoundPage-D7_07YoB.js → NotFoundPage-CsbUs21R.js} +1 -1
  62. package/web-app/dist/assets/{ProjectPage-SQ183efy.js → ProjectPage-BtlLEQwB.js} +3 -3
  63. package/web-app/dist/assets/{ProjectsPage-Cgr1K2Ae.js → ProjectsPage-DaRbRjSp.js} +1 -1
  64. package/web-app/dist/assets/{SettingsPage-kyYOSDt0.js → SettingsPage-DALrtP3F.js} +1 -1
  65. package/web-app/dist/assets/{ShowcasePage-CRd-H1A4.js → ShowcasePage-CoPHSNP0.js} +1 -1
  66. package/web-app/dist/assets/{SystemSettingsPage-BHBdGXod.js → SystemSettingsPage-kOuSN50O.js} +1 -1
  67. package/web-app/dist/assets/{TeamsPage-CI3Wdbjw.js → TeamsPage-DGWK0LMp.js} +1 -1
  68. package/web-app/dist/assets/{TemplatesPage-DfhCgP6i.js → TemplatesPage-C-_10CwA.js} +1 -1
  69. package/web-app/dist/assets/{TerminalOutput-Cs87YXLJ.js → TerminalOutput-Cz_vPbXL.js} +1 -1
  70. package/web-app/dist/assets/{activity-CrQx5SbK.js → activity-icIsXJVa.js} +1 -1
  71. package/web-app/dist/assets/{bell-Dde5IbnI.js → bell-DbPR2_4r.js} +1 -1
  72. package/web-app/dist/assets/{bot-trRuIJT6.js → bot-DvjP3Yh5.js} +1 -1
  73. package/web-app/dist/assets/{check-DmsthR-3.js → check-D1OBxHeU.js} +1 -1
  74. package/web-app/dist/assets/{chevron-left-C5wZb7mg.js → chevron-left-D09jDZ29.js} +1 -1
  75. package/web-app/dist/assets/{circle-alert-BCb173fK.js → circle-alert-DyZMLOcC.js} +1 -1
  76. package/web-app/dist/assets/{clock-CvcqL3Ma.js → clock-CdpdJTId.js} +1 -1
  77. package/web-app/dist/assets/{cloud-CW1r3-AN.js → cloud-CoLTlmoj.js} +1 -1
  78. package/web-app/dist/assets/{code-xml-uxBTXAfZ.js → code-xml-DrkE2ZZY.js} +1 -1
  79. package/web-app/dist/assets/{database-DBrvW0o1.js → database-CMQQuM2R.js} +1 -1
  80. package/web-app/dist/assets/{dollar-sign-WrOyoDcN.js → dollar-sign-CuioDaOG.js} +1 -1
  81. package/web-app/dist/assets/{file-code-corner-8JC8TI2_.js → file-code-corner-Cx9j9K1S.js} +1 -1
  82. package/web-app/dist/assets/{file-plus-CgUdOr2u.js → file-plus-CYD2zaaI.js} +1 -1
  83. package/web-app/dist/assets/{globe-w-0x46nt.js → globe-6w-hnQkL.js} +1 -1
  84. package/web-app/dist/assets/{hammer-Civ6_wQq.js → hammer-BpqtautL.js} +1 -1
  85. package/web-app/dist/assets/{index-wvGJotyF.js → index-Dzs-9EgJ.js} +3 -3
  86. package/web-app/dist/assets/{layers-Cc3wLG39.js → layers-D5hd7jb7.js} +1 -1
  87. package/web-app/dist/assets/{loader-circle-BedHqfS4.js → loader-circle-C6Y9x_7H.js} +1 -1
  88. package/web-app/dist/assets/{lock-CRyzk3QG.js → lock-D51L7rYh.js} +1 -1
  89. package/web-app/dist/assets/{package-DCT1v7W2.js → package-BJF8hkP8.js} +1 -1
  90. package/web-app/dist/assets/{plus-C7eerOb_.js → plus-D5kUQ79n.js} +1 -1
  91. package/web-app/dist/assets/{refresh-cw-DO753Y_B.js → refresh-cw-BKdlCa7F.js} +1 -1
  92. package/web-app/dist/assets/{rotate-ccw-ptlyGV4I.js → rotate-ccw-_bd_YI1e.js} +1 -1
  93. package/web-app/dist/assets/{scroll-text-CqPwk4yI.js → scroll-text-DbkegIxF.js} +1 -1
  94. package/web-app/dist/assets/{server-BP_VvY9m.js → server-DAwqFIsq.js} +1 -1
  95. package/web-app/dist/assets/{shield-alert-Bf0waB0a.js → shield-alert-BuR1tPHu.js} +1 -1
  96. package/web-app/dist/assets/{thumbs-up-p1roSIsw.js → thumbs-up-BF6p3mRd.js} +1 -1
  97. package/web-app/dist/assets/{trash-2-BrMaXAxl.js → trash-2-BVpnkqqz.js} +1 -1
  98. package/web-app/dist/assets/{trending-down-DaGcCn2W.js → trending-down-DpsDvRwW.js} +1 -1
  99. package/web-app/dist/assets/{trending-up-CKPupOSE.js → trending-up-mFogTjt3.js} +1 -1
  100. package/web-app/dist/assets/{upload-CR0gzibW.js → upload-4T8zpBsi.js} +1 -1
  101. package/web-app/dist/assets/{usePolling-kKzJRjFw.js → usePolling-DPXQv8WO.js} +1 -1
  102. package/web-app/dist/assets/{user-CPOXPTtD.js → user-BYGIFaTm.js} +1 -1
  103. package/web-app/dist/index.html +1 -1
@@ -23,7 +23,7 @@ with nowhere to look them up.
23
23
  |---|---|---|
24
24
  | `LOKI_PRD_FILE` | none | Path to a spec file, as an alternative to the positional argument. |
25
25
  | `LOKI_MAX_ITERATIONS` | `1000` | Hard cap on iterations. Reaching it is a deterministic terminal failure, not a success. Also in `config schema`. |
26
- | `LOKI_BUDGET_LIMIT` | `100.00` | Spend cap in USD. Breaching it **pauses** the run (writes `.loki/PAUSE` and saves state); it never kills work or discards a deliverable. Remove `.loki/PAUSE` to resume, or raise the cap. Set to `""` for no cap. A warning is logged at 80%. |
26
+ | `LOKI_BUDGET_LIMIT` | `100.00` | Spend cap in USD on the previous loop (the Loki 10 engine uses `--max-cost`, `budgets.per_run` or a default of $100 only when `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` is set; none on a subscription). Also enforced by kill on codex, cline, aider and opencode in the Loki 10 engine. Breaching it **pauses** the run (writes `.loki/PAUSE` and saves state); it never kills work or discards a deliverable. Remove `.loki/PAUSE` to resume, or raise the cap. Set to `""` for no cap. A warning is logged at 80%. |
27
27
  | `LOKI_MAX_DURATION` | unset (no cap) | Wall-clock cap in seconds. Stops cleanly at the next iteration boundary with a `max_duration_reached` terminal status. `loki start --max-duration` also accepts `90m` / `2h`. |
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**. |
@@ -40,7 +40,14 @@ interact and why hitting one is a failure rather than a success.
40
40
  | `LOKI_PROVIDER` | `claude` | `claude`, `cline`, `codex`, `aider`, or `opencode`. |
41
41
  | `LOKI_SESSION_MODEL` | `medium` | The capability tier for the run: `small`, `medium`, or `high`. See below. |
42
42
  | `LOKI_MAX_TIER` | unlimited | Caps model tier, so a run cannot escalate past what you are willing to pay for. |
43
- | `LOKI_MODEL_OVERRIDE` | unset | Overrides the resolved model outright. |
43
+ | `LOKI_MODEL_OVERRIDE` | unset | Overrides the resolved model outright. A route spec (`ollama/<id>`) works too. |
44
+ | `LOKI_MODEL_ROUTE` | unset | `<kind>/<id>` with kind `openrouter`, `ollama`, `lmstudio`, `llamacpp`, `vllm` or `custom`. Routes the Claude harness to that endpoint; `loki models` lists them, `loki models --local` discovers local runtimes. |
45
+ | `LOKI_MODEL_BASE_URL` | unset | Base URL for a `custom/<id>` route (required for `custom`). |
46
+ | `LOKI_MODEL_API_KEY` | unset | Token for a `custom/<id>` route (optional). OpenRouter reads `OPENROUTER_API_KEY`. |
47
+ | `LOKI_OPENCODE_MODEL` | unset | `provider/model` id passed to opencode (for example `openrouter/deepseek/deepseek-v3.2`). Also `LOKI_OPENCODE_FLAGS` and `LOKI_OPENCODE_CLI`. |
48
+ | `LOKI_EDIT_MODEL` | unset | Model for `loki edit`. |
49
+ | `LOKI_ENGINE` | unset | `legacy` forces the previous loop; the `--engine` flag wins over it. |
50
+ | `LOKI_SUMMARY_JSON` | unset | `1` prints the end-of-run summary as one JSON line on the previous loop. |
44
51
  | `LOKI_TIER` | `oss` | **Not a model setting.** The open-core licensing seam. Leave it unset. |
45
52
  | `LOKI_ALLOW_CLAUDE_SIDECALLS` | unset | `1` (exactly) lets PRD enrichment, done recognition, the council voters, the USAGE.md refresh and the quickstart intent check prompt the `claude` CLI under a non-claude provider; `loki doctor --airgap` then reports that as required egress to Anthropic. |
46
53
 
@@ -22,7 +22,10 @@ is the part most likely to surprise a script author.
22
22
  | 0 | The run completed |
23
23
  | nonzero | Something went wrong |
24
24
 
25
- There is no finer signal. A gate that needs to tell "failed the quality gate"
25
+ Usage errors are distinct from run outcomes: `loki start` with an unknown
26
+ option exits 64, and `loki quick` with no task description exits 64 (they were
27
+ 1 and 2). A missing provider CLI still exits 2 before any spend. There is no
28
+ finer run-outcome signal. A gate that needs to tell "failed the quality gate"
26
29
  from "crashed" must opt into the durable contract below.
27
30
 
28
31
  ### With `LOKI_DURABLE_STATE=1` (the platform contract)
@@ -56,6 +59,7 @@ identically; a parity test asserts they agree status for status.
56
59
  |---|---|
57
60
  | 0 | The run completed and its diff did not weaken the tests |
58
61
  | 3 | The diff weakened the tests (a skip marker added in a test file, a test runner config changed, or an existing test file deleted or renamed). The receipt headline is NOT VERIFIED and names what was weakened, for example `NOT VERIFIED (tests weakened: skip added in sum.test.js)` |
62
+ | 64 | Usage error: no task description |
59
63
  | other nonzero | The run itself failed; this code is passed through unchanged |
60
64
 
61
65
  `loki quick` has no `--json` flag; its structured result is `loki why --json`, schema: `schemas/why-result.schema.json` (`state.lastExitCode` carries the ladder above).
@@ -72,8 +76,9 @@ headline caused by unproven gates alone also keeps exit 0. The signal is the
72
76
  |---|---|
73
77
  | 0 | VERIFIED |
74
78
  | 1 | CONCERNS (findings below the block threshold, or inconclusive evidence) |
75
- | 2 | BLOCKED (findings at or above the block threshold) |
76
- | 3 | Verifier error: it could not complete, and never silently passes |
79
+ | 2 | BLOCKED (findings at or above the block threshold), or not a git directory |
80
+ | 3 | Verifier error: it could not complete, and never silently passes (also an empty diff) |
81
+ | 64 | Usage error: unknown option or unexpected argument |
77
82
 
78
83
  `loki verify` has no `--json` flag. `loki status --json` schema: `schemas/status-result.schema.json`.
79
84
 
@@ -142,19 +147,21 @@ An early draft spec listed `1=BLOCKED, 2=CONCERNS`. That ordering was rejected:
142
147
  it is not used anywhere, it has no consumers, and it inverts the
143
148
  severity-rises-with-the-code rule that every other command follows.
144
149
 
145
- ### Known gaps
150
+ ### Contract enforced from v11.4.0
146
151
 
147
- The table above is the target. On the current release, three inputs do not
148
- return what it implies. Measured on this checkout:
152
+ This is a deliberate contract change for the 11.4.0 minor release. Three inputs
153
+ that used to return a misleading code now return the table's value:
149
154
 
150
- | Input | Command | Exit today | Target |
155
+ | Input | Command | Exit | Note |
151
156
  |---|---|---|---|
152
- | Empty diff (a git repo with no changes vs base) | `loki verify` | 1 (CONCERNS) | 3 |
153
- | Not a git directory | `loki verify` | 1 (CONCERNS) | 2 |
154
- | Unknown flag | `loki verify --no-such-flag` | 3 | 64 |
157
+ | Empty diff (a repo with no changes vs base) | `loki verify` | 3 | Nothing to check is a verifier error, never a pass. VERDICT line still reads CONCERNS. |
158
+ | Not a git directory | `loki verify` | 2 | Could not check. VERDICT line still reads CONCERNS. |
159
+ | Unknown option or unexpected argument | `loki verify --no-such-flag` | 64 | Usage error, as in `proof verify`. |
155
160
 
156
- The gap is tracked as the pending moat case P2.verify-exit-contract in
157
- `tests/moat/pending.txt`.
161
+ A real finding keeps precedence: an empty diff that also carries a below-threshold
162
+ finding (for example spec drift) still exits 1, and a blocking finding still exits 2.
163
+ CI gates that tested `[ $rc -eq 1 ]` for these inputs must move to `[ $rc -ne 0 ]`.
164
+ The moat case `P2.verify-exit-contract` is no longer pending and is enforced.
158
165
 
159
166
  ### `loki verify --fast`
160
167
 
@@ -346,3 +353,13 @@ esac
346
353
  Do not read an exit code through a pipe. `$?` after a pipeline reports the last
347
354
  stage, so `loki verify | tee log` gives you `tee`'s status and always looks
348
355
  successful. Use `${PIPESTATUS[0]}` in bash, or capture first and test after.
356
+
357
+ ## `loki edit`
358
+
359
+ One provider pass, no loop.
360
+
361
+ | Code | Meaning |
362
+ |---|---|
363
+ | 0 | Edit done (or nothing to change, or `--dry-run` plan printed) |
364
+ | 1 | Provider pass failed, or `--verify` failed (nothing is committed) |
365
+ | 2 | Usage or setup error (no change text, not a git repo, claude or python3 missing, unsupported provider) |
@@ -6,12 +6,12 @@ Classes: KEEP-MODERN (v10-native or engine-neutral), UPDATE (live but needs mode
6
6
 
7
7
  ## Counts
8
8
 
9
- - KEEP-MODERN: 64
9
+ - KEEP-MODERN: 69
10
10
  - UPDATE: 22
11
- - DROP-LEGACY: 31
11
+ - DROP-LEGACY: 32
12
12
  - DELETE: 14
13
- - Total rows: 131
14
- - Registry paths (commands and nested subcommands): 181
13
+ - Total rows: 137
14
+ - Registry paths (commands and nested subcommands): 188
15
15
 
16
16
  ## Commands
17
17
 
@@ -45,6 +45,11 @@ Classes: KEEP-MODERN (v10-native or engine-neutral), UPDATE (live but needs mode
45
45
  | completion (hidden) | loki-ts/src/cli.ts | KEEP-MODERN | Hidden plumbing; completions install themselves |
46
46
  | __complete (hidden) | loki-ts/src/cli.ts | KEEP-MODERN | Hidden plumbing for generated completions |
47
47
  | help | autonomy/loki | KEEP-MODERN | Core |
48
+ | chat | autonomy/loki | KEEP-MODERN | Provider-neutral conversational verb |
49
+ | edit | autonomy/loki | KEEP-MODERN | Provider-neutral single-edit verb |
50
+ | diff | autonomy/loki | KEEP-MODERN | Passes extra args to git diff |
51
+ | models | autonomy/loki | KEEP-MODERN | Provider-neutral model tiers |
52
+ | setup | autonomy/loki | KEEP-MODERN | Onboarding gate |
48
53
  | quick | autonomy/loki | UPDATE | Routes to the v10 lean path by default |
49
54
  | quickstart | autonomy/loki | KEEP-MODERN | Onboarding path |
50
55
  | init | autonomy/loki | UPDATE | Templates predate v10 |
@@ -129,6 +134,7 @@ Classes: KEEP-MODERN (v10-native or engine-neutral), UPDATE (live but needs mode
129
134
  | cleanup | autonomy/loki | DROP-LEGACY | Legacy run.sh orphans |
130
135
  | state | autonomy/loki | DROP-LEGACY | Legacy engine |
131
136
  | agent | autonomy/loki | DROP-LEGACY | Legacy engine |
137
+ | agents | autonomy/loki | DROP-LEGACY | Legacy engine |
132
138
  | trigger | autonomy/loki | DROP-LEGACY | Legacy engine |
133
139
  | failover | autonomy/loki | DROP-LEGACY | Legacy engine |
134
140
  | reset | autonomy/loki | DROP-LEGACY | Legacy engine |
@@ -771,13 +771,13 @@ L0 review rule (ENGINE-LAWS.md L0): a fix that adds an `if` or a regex about the
771
771
 
772
772
  ## FC-90 Deleting the token env vars left the user's gh login and git credential helpers reachable (GH-KEYRING)
773
773
  - User saw: nothing yet (found by audit). With GH_TOKEN, GITHUB_TOKEN, GH_ENTERPRISE_TOKEN, GITHUB_ENTERPRISE_TOKEN and SSH_AUTH_SOCK removed, `gh auth token` exited 0 and `gh api user` returned the user's login on the founder machine, and git held `osxkeychain` plus `!gh auth git-credential` helpers over an HTTPS origin.
774
- - Law: P9 (agent and test code never holds the user's credential) is a property of every credential store a child can reach, not of the env vars alone; one shared mechanism builds the withheld env, so no env builder can delete a subset and call it token-free.
774
+ - Law: a child spawned by the harness must not reach the user's GitHub credential by default or by accident, through any store the child's env can resolve (env vars, gh config and keyring, git credential helpers), not through the env vars alone; one shared mechanism builds the withheld env, so no env builder can delete a subset and call it token-free. This is not a sandbox.
775
775
  - Cause (measured): tokenFreeEnv (util/safe_git.ts) and plainTestEnv (util/check_result.ts) only deleted the vars. gh then falls back to GH_CONFIG_DIR/hosts.yml and the OS keyring, and git calls its configured helpers on an HTTPS push. withholdGithubTokens already closed this for the worker, but only for the worker env. Measured with gh: GH_CONFIG_DIR alone leaves `gh auth token` exit 0 (keyring); a sentinel token alone makes `gh auth status` fail but a named-account read (`gh auth token --user`) still reads hosts.yml; both together close it.
776
776
  - Mechanism: util/credential_env.ts hardenCredentialEnv is the one function: the 4 vars become a non-working sentinel, GH_CONFIG_DIR is a per-process empty mode-700 directory, credential.helper is reset through GIT_CONFIG_COUNT/KEY/VALUE appended after existing entries (the user's gitconfig is never edited and identity survives), GIT_TERMINAL_PROMPT=0 and GCM_INTERACTIVE=never. tokenFreeEnv (so plainTestEnv, safeGitEnv) and withholdGithubTokens both call it; the LOKI_ALLOW_AGENT_GITHUB_TOKEN opt-out stays in withholdGithubTokens only, test envs are always hardened. The empty dir is made once per process (not per call), under LOKI_RUN_TMP when it is a real directory, else the OS temp dir, and removed by exact path at exit (the old per-call scoped dirs leaked).
777
777
  - Siblings swept: withholdGithubTokens (now shared), tokenFreeEnv callers (attempts, wall_snapshot, verify_pr, start), plainTestEnv callers (wall, verify, load_owner), the worker assertion (sentinel prefix now exported from credential_env.ts), and the bash route (_loki_withhold_github_tokens at autonomy/run.sh main() already sets the sentinel, a scoped GH_CONFIG_DIR, the helper reset and an EXIT trap removal). Raw `process.env` spawns elsewhere inherit an already-withheld process env (runner after autonomous.ts withholdGithubTokens, worker after supervisor.ts) and are policed by full_env_spawn_guard.
778
778
  - Fixture: tests/util/fc90_credential_env.test.ts (a fake HOME with a planted gh hosts.yml and a planted global git credential helper, each with a positive control on the raw env; red on the old tokenFreeEnv, red when the GH_CONFIG_DIR line, the credential.helper reset or the sentinel is removed; plus a count of loki-gh-config-* dirs in an isolated TMPDIR before and after).
779
779
  - CI note (fix-forward, cc8e17512 red on ubuntu): the named-account control `gh auth token --user` returned empty on gh for Linux because a flat hosts.yml is not read by a named lookup there (the multi-account `users:` shape is), while the default `gh auth token` reads only the flat one on the same gh. The fixture now probes the installed gh with each shape in a scratch home, plants the one that works in a separate named home, and skips the named-account test (control and hardened assertion together) when no shape works. Verified on ubuntu:24.04 with gh 2.102.0.
780
- - Residual: SSH keys under ~/.ssh and GIT_SSH_COMMAND are closed only for the worker env (withholdGithubTokens), not for plainTestEnv; a test command can still `ssh` with the user's default keys.
780
+ - Residual: code running as the same user can unset the variables and call gh or git directly (or read the keyring itself); this closes default and accidental reach, it is not a sandbox. A parent GIT_CONFIG_PARAMETERS helper is neutralised by appending the reset last. SSH keys under ~/.ssh and GIT_SSH_COMMAND are closed only for the worker env (withholdGithubTokens), not for plainTestEnv; a test command can still `ssh` with the user's default keys.
781
781
 
782
782
  ## FC-88 The release gate repeated the Tests workflow's typecheck and bun suite on the same tree (WF-GATE-DEDUP)
783
783
  - User saw: every release waited 6m40s in release.yml's gate step "Bun typecheck + test (protect published loki-ts dist)" (run 37859034694, v11.3.4) for work the Tests workflow had already finished green on the same tree, or on the bump-only parent (FC-70).
package/docs/v10/GUIDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Loki 10 engine guide
2
2
 
3
- Default: Loki 10 engine for `loki "<task>"`, `loki owner/repo#N` and `loki quick "<task>"`. `loki legacy` and LOKI_ENGINE were removed in 11.0.0. <!-- loki10-default -->
3
+ Default: Loki 10 engine for `loki start`, `loki "<task>"`, `loki owner/repo#N` and `loki quick "<task>"`. `loki legacy` was removed in 11.0.0; the previous loop runs only on an explicit `--engine legacy` or `LOKI_ENGINE=legacy` (see Routing). <!-- loki10-default -->
4
4
 
5
5
  Loki 10 is the rewritten engine (docs/v10/ENGINE.md). Since the D48 flip it
6
6
  runs `loki "<task>"`, `loki owner/repo#N` (issue mode) and `loki quick
@@ -12,29 +12,77 @@ newest entry in .loki/runs/ is a v10 run newer than the newest legacy proof
12
12
  it runs the v10 verify, otherwise the legacy verify. If bun is missing or
13
13
  LOKI_PROVIDER is unsupported, the default mode falls back to the bash path
14
14
  and prints one stderr line saying why. In 11.0.0 (LEGACY-ZERO W1-01) `loki
15
- legacy` was removed (it exits 2 with a removal message) and LOKI_ENGINE is no
16
- longer read; any value is ignored.
15
+ legacy` was removed (it exits 2 with a removal message). From 11.4.0
16
+ `--engine legacy|engine10` and LOKI_ENGINE select the engine explicitly (see
17
+ Routing below).
17
18
 
18
- `loki start owner/repo#N`, `loki start <issue URL>` and `loki start "<multi-word
19
- task>"` run Loki 10, the same as `loki owner/repo#N` and `loki "<task>"`. A PRD
20
- file, a flag-first call (`loki start --simple prd.md`) and a one-word start still
21
- run on the previous bash loop (autonomy/run.sh), and so does the opencode
22
- provider, until FC38-SWEEP ports them. `loki legacy` and LOKI_ENGINE remain
23
- removed. The previous loop is being removed (see docs/v10/LEGACY-REMOVAL.md).
19
+ ## Routing
20
+
21
+ Argument order and input form never change the engine. Flags are normalized
22
+ before the routing decision, so these all run on Loki 10:
23
+
24
+ ```
25
+ loki start prd.md loki start --no-pr prd.md
26
+ loki start owner/repo#123 loki start --provider codex owner/repo#123
27
+ loki start "fix the login bug" loki start --no-pr "fix the login bug"
28
+ loki start fixit loki quick -v "fix the login bug"
29
+ ```
30
+
31
+ A PRD file, an issue ref or URL, a multi-word task and a one-word brief take
32
+ the same path. `-v` means `--verbose`, `--budget` and `--budget-limit` mean
33
+ `--max-cost`, and `--yes`, `-y`, `--no-plan`, `--no-mirofish` and
34
+ `--no-dashboard` are accepted and ignored. A PRD file path that does not exist
35
+ exits 2 with "PRD file not found".
36
+
37
+ The previous loop (autonomy/run.sh) runs only when:
38
+
39
+ 1. you pass `--engine legacy` or set `LOKI_ENGINE=legacy` (`--engine engine10`
40
+ forces Loki 10 and refuses a flag it cannot honor; the flag wins over the
41
+ variable), or
42
+ 2. the call carries a flag Loki 10 does not support (for example `--simple`,
43
+ `--complex`, `--parallel`, `--github`, `--sandbox`, `--max-iterations`).
44
+ Only that call goes to the previous loop, and one stderr line names the flag
45
+ and the engine chosen, or
46
+ 3. LOKI_PROVIDER (or `--provider`) names a provider Loki 10 has no invoker
47
+ for (anything but claude, codex, cline, aider, opencode), or bun is missing, or the
48
+ PRD is larger than 100000 bytes. One stderr line says why.
49
+
50
+ `loki <word>` with a single bare word stays the command namespace (`loki doctor`),
51
+ so use `loki start <word>` for a one-word brief. A first argument starting with
52
+ `-` followed by a multi-word task or an issue ref (`loki --no-pr "fix it now"`)
53
+ runs on Loki 10 like the positional form.
54
+
55
+ ### See the route without running
56
+
57
+ ```
58
+ loki route start prd.md
59
+ loki route quick "fix the login redirect loop" --json
60
+ loki start --simple prd.md --explain-route
61
+ ```
62
+
63
+ `loki route [start|quick] <same args>` and `--explain-route` on start or quick
64
+ print the engine, provider, model, input type and the reason, then exit 0
65
+ without running anything. `--json` prints one JSON object with the keys
66
+ `engine`, `provider`, `model`, `input_type`, `input`, `reason`.
24
67
 
25
68
  Some pieces named in this guide are still being built. Each one below says
26
69
  so plainly instead of describing a finished feature.
27
70
 
28
71
  ## Quickstart
29
72
 
30
- Put the task first, as a quoted multi-word string, so bin/loki's router
31
- sends it to the v10 engine. A one-word argument that is not an issue ref,
32
- or any first argument starting with `-`, stays on the legacy engine.
73
+ `loki start` is the primary path. Give it a PRD file, an issue ref, a task in
74
+ quotes or a one-word brief. Flags may come before or after it; the engine is
75
+ the same (see Routing).
33
76
 
34
77
  ```
35
- loki "fix the login redirect loop" --no-pr
78
+ loki start prd.md
79
+ loki start "fix the login redirect loop" --no-pr
36
80
  ```
37
81
 
82
+ `loki "<task>"` and `loki owner/repo#N` are shorthand for the same run.
83
+ `loki chat` is an interactive alternative that can start and join these runs
84
+ (see Chat below).
85
+
38
86
  `loki quick "<task>"` is the small-task entry. It runs the same engine
39
87
  without opening a pull request (the legacy quick never opened one), and the
40
88
  engine's own sizing picks the lean path for a small task: Plan and Wall are
@@ -42,16 +90,16 @@ skipped and implement runs on your run's own model, like a raw session.
42
90
  `LOKI_E10_CASCADE=1` opts in to the cheaper sonnet start (it prints and
43
91
  records the downgrade); a repeated test failure always escalates up, never
44
92
  down (Engine Law L1).
45
- `loki quick --help` and a flag-first `loki quick -v "<task>"` stay on the
46
- legacy quick.
93
+ `loki quick --help` prints the help; `loki quick -v "<task>"` runs on Loki 10 with
94
+ `--verbose`.
47
95
 
48
96
  ```
49
97
  loki quick "fix the login redirect loop"
50
98
  ```
51
99
 
52
100
  If bun is not installed, or LOKI_PROVIDER names a provider the v10 engine
53
- has no invoker for (anything but claude, codex, cline, aider), these entry
54
- points fall back to the legacy engine instead of failing.
101
+ has no invoker for (anything but claude, codex, cline, aider, opencode), these entry
102
+ points fall back to the legacy engine with a one-line notice instead of failing.
55
103
 
56
104
  Issue refs work the same way:
57
105
 
@@ -74,14 +122,19 @@ Flags, from the engine's own `--help`:
74
122
  from 480s to 1800s (`loki-ts/src/engine10/types.ts`).
75
123
  - `--provider <name>`: pick the coding provider for this run. See the
76
124
  provider table below.
77
- - `--max-cost <usd>`: per-run cost cap in dollars. Without the flag the cap is
78
- `budgets.per_run` in the repo's `loki.yaml` (for example
79
- `budgets:` then ` per_run: 5`), else the default of $20.00. The flag wins over
80
- the file. The start line shows the cap in force, for example
81
- `... previous engine), cap $20.00 (default)`. Once priced cost reaches the cap
82
- the running stage is stopped, no later stage starts, and the run ends
83
- BUDGET_STOP with exit code 3. Sessions with no provider price never count
84
- toward the cap.
125
+ - `--max-cost <usd>`: per-run cost cap in dollars (`--budget` and
126
+ `--budget-limit` are aliases). Order of precedence: the flag, then
127
+ `budgets.per_run` in the repo's `loki.yaml` (for example `budgets:` then
128
+ ` per_run: 5`), then the default. The default is $100.00 when
129
+ `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` is set, and no dollar cap on a
130
+ subscription login (usage then counts against your plan limits). Source:
131
+ `loki-ts/src/e10ext/budget_cap.ts`. The start line shows the cap in force,
132
+ for example `cap $100.00 (default)` or `no dollar cap (subscription)`. Once
133
+ priced cost reaches the cap the running stage is stopped, no later stage
134
+ starts, and the run ends BUDGET_STOP with exit code 3. Sessions with no
135
+ provider price never count toward the cap. On the previous loop the same cap
136
+ is `LOKI_BUDGET_LIMIT` (default 100.00 USD; set it to an empty string for
137
+ unlimited), and a breach pauses the run instead of killing it.
85
138
 
86
139
  `--no-pr`, `--deep` and `--provider` are parsed by the supervisor
87
140
  (`loki-ts/src/engine10/supervisor.ts`) and take effect on a real run.
@@ -99,9 +152,117 @@ verify, seal) and then, in the supervisor, the pr stage, ending in the
99
152
  Slack is not part of the v10 engine surface (no command, no notification
100
153
  hook) and is in progress, tracked with the other wave 3 items.
101
154
 
155
+ ## Small changes: loki edit
156
+
157
+ `loki edit` is the lightest path: one Claude pass on the current repo with no
158
+ PRD, plan, council, PR, receipt or branch switch. It prints the diff stat, the
159
+ diff, and one line with cost and elapsed time.
160
+
161
+ ```
162
+ loki edit "rename fooBar to foo_bar"
163
+ loki edit src/foo.ts "rename X to Y"
164
+ loki edit --verify --commit src/a.ts "add null checks"
165
+ loki edit --dry-run "describe the change"
166
+ ```
167
+
168
+ - `--verify` runs the fast verifier on the result.
169
+ - `--receipt` writes an unsigned receipt to `.loki/edit-receipts/`.
170
+ - `--commit` commits only the files the pass touched, by name; skipped when
171
+ verify failed.
172
+ - `--dry-run` plans only (plan permission mode); nothing changes.
173
+ - `LOKI_EDIT_MODEL` overrides the model. Claude provider only for now.
174
+
175
+ Use `loki edit` for a single pass, `loki quick "<task>"` for a small task with
176
+ a verify loop, and `loki start` for anything that needs a plan, verification
177
+ and a sealed receipt. Exit codes: 0 done, 1 provider or verify failure, 2
178
+ usage or setup error ([exit-codes.md](../exit-codes.md)).
179
+
180
+ ## Custom agents
181
+
182
+ Define child agents as markdown with YAML frontmatter in `.loki/agents/<name>.md`
183
+ (project) or `~/.config/loki/agents/<name>.md` (user). A project agent wins
184
+ over a user agent of the same name. The body is the system prompt.
185
+
186
+ Frontmatter keys: `name` (must equal the file name without `.md`),
187
+ `description` (required), `model`, `provider` (`claude` by default; `codex`,
188
+ `cline`, `aider` or `opencode`), `tools` (allow list), `deny` (deny list) and
189
+ `permission` (`plan` default, `edit` or `full`).
190
+
191
+ ```
192
+ loki agents list
193
+ loki agents new reviewer # reviewer, planner and tester copy shipped examples
194
+ loki agents show reviewer
195
+ loki agents export --claude # writes .claude/agents/ (add --user for ~/.claude/agents)
196
+ ```
197
+
198
+ `permission: plan` exports as Claude Code `disallowedTools` Edit, Write,
199
+ NotebookEdit and Bash. Council reviewers pick up a matching agent: one named
200
+ `reviewer`, `tester` or `security` replaces the council-v2 reviewer prompt and
201
+ model for the matching roles (`code_quality_reviewer` and
202
+ `requirements_verifier` use `reviewer`; `test_auditor` uses `tester`;
203
+ `devils_advocate` uses `security`, then `reviewer`). With no agents configured
204
+ nothing changes. `loki agent` (singular) is the unchanged built-in agent-type
205
+ command.
206
+
207
+ ## Chat (interactive alternative)
208
+
209
+ `loki start` stays the primary path. `loki chat` is an interactive session for
210
+ exploring and small steps, and it hands off to and from `loki start`.
211
+
212
+ - Start with `loki chat` (needs a TTY; for one-shot tasks use `loki quick`).
213
+ Bare `loki` does not open chat.
214
+ - The session starts in Plan mode (read-only); `/plan` and `/build` switch
215
+ modes and the prompt shows `loki[plan]>` or `loki[build]>`. Plan mode is
216
+ enforced for Claude (`--permission-mode plan`); other providers get a
217
+ prompt-level read-only instruction.
218
+ - Slash commands: `/plan`, `/build`, `/run <prd|brief>`, `/quick <task>`,
219
+ `/edit <change>`, `/verify`, `/receipt`, `/cost`, `/diff`, `/undo`,
220
+ `/model <id>`, `/provider <name>`, `/help`, `/exit`.
221
+ - `/run` starts a normal `loki start` run with the chat's model and provider.
222
+ - `loki chat --attach` joins a running or the last `loki start` session, with
223
+ `/status`, `/steer`, `/diff`, `/verify`, `/receipt` and `/stop`.
224
+ - `loki chat --tui` launches the full Claude Code TUI with the Loki system
225
+ prompt appended.
226
+
227
+ ## Setup, doctor and config
228
+
229
+ ```
230
+ loki setup # wizard: tools, Claude login, provider, model route, spend cap
231
+ loki setup --yes # non-interactive defaults
232
+ loki setup --check # report only
233
+ loki doctor --fix # create state dirs and a default config; prints exact commands for the rest
234
+ loki config list # also: get <key>, set <key> <value>, path
235
+ ```
236
+
237
+ `loki setup` flags: `--provider claude|codex|cline|aider|opencode`,
238
+ `--model`, `--budget USD` and `--global`. `loki doctor --fix` never installs
239
+ system packages and never runs sudo. Prerequisites are in
240
+ [INSTALLATION.md](../INSTALLATION.md).
241
+
242
+ ## Exit codes
243
+
244
+ One contract, enforced from 11.4.0 (details in [exit-codes.md](../exit-codes.md)).
245
+ `loki verify` exits 0 VERIFIED, 1 CONCERNS, 2 BLOCKED or not a git directory,
246
+ 3 verifier error or empty diff, 64 usage error. Usage errors from `loki quick`
247
+ and `loki start` are also 64. CI gates should use `loki verify || fail`, not
248
+ `[ $rc -eq 1 ]`, and treat any code of 2 or higher as worse than CONCERNS. This
249
+ is a breaking change for scripts that tested rc==1 on an empty diff or a
250
+ non-git directory.
251
+
102
252
  ## The summary
103
253
 
104
- A finished run prints the start line, then one label per line (Outcome,
254
+ Every run on both engines also ends with one unified block: `Result:`
255
+ (verified, done-unverified, failed or stopped), `Files:` (N changed, +ins
256
+ -del), `Cost:` (`$X.XX`, marked `(estimated)` when not provider-reported,
257
+ `not measured` when unknown), `Elapsed:`, `Receipt:` (path, when one exists)
258
+ and one `next:` line naming the suggested command (`loki diff`, `loki verify`,
259
+ `loki undo`, `loki status`, `loki doctor`, or `loki chat --attach`). Pass
260
+ `--quiet` to print only this block and `--json` to add a `summary` object to
261
+ the JSON output. `NO_COLOR=1` disables color, which is also off when stdout is
262
+ not a TTY. On the previous loop, `LOKI_SUMMARY_JSON=1` prints the summary as
263
+ one JSON line, and its cost is always an estimate from the context tracker.
264
+
265
+ A finished engine10 run prints the start line, then one label per line (Outcome,
105
266
  PR, Receipt, NOT PROVEN, Cost, Time; a Reason line is added for any
106
267
  outcome other than VERIFIED or ALREADY_SATISFIED). The quiet default stays
107
268
  within 8 lines. The block below is the older 5-line form; the labels are the
@@ -221,18 +382,82 @@ receipt with no signing key configured (or a key that failed to load) reads
221
382
 
222
383
  ## Provider table
223
384
 
224
- | Provider | Cost measured | Kill blocking enforced |
225
- |----------|----------------|--------------------------|
226
- | claude | yes | yes |
227
- | codex | no | no |
228
- | cline | no | no |
229
- | aider | no | no |
230
- | opencode | not supported | n/a |
385
+ | Provider | Cost measured | Spend cap enforced | Guardrail scan | Kill blocking enforced |
386
+ |----------|---------------|--------------------|----------------|------------------------|
387
+ | claude | yes (provider-reported) | yes | native | yes |
388
+ | codex | yes (parsed or estimated) | yes | yes | no |
389
+ | cline | yes (parsed or estimated) | yes | yes | no |
390
+ | aider | yes (reported or estimated) | yes | yes | no |
391
+ | opencode | no | no (cost not measured); wall clock limit still applies | yes | no |
392
+
393
+ Claude Code is the default and the only Tier-1 provider; the others are
394
+ optional. Select one with `--provider <name>` or `LOKI_PROVIDER`.
395
+
396
+ ### Cost and the spend cap on non-Claude providers
397
+
398
+ For codex, cline and aider, engine10 reads token usage from the CLI output
399
+ (aider's `Cost: $X session` line is used as-is). If the CLI prints no usage,
400
+ cost is estimated from prompt and response sizes (about 4 characters per
401
+ token) with the built-in price table (`loki-ts/src/providers/price_table.ts`).
402
+ A model not in the table prices at a mid-range default of $2 per 1M input
403
+ tokens and $10 per 1M output tokens. Estimated figures carry `estimated: true`
404
+ and `cost_basis` (`provider-tokens` or `size-estimate`) on the `cost` event in
405
+ `events.jsonl`, and the efficiency record has `cost_source: "estimated"`.
406
+ Estimates are approximate. The cap in `--max-cost` applies unchanged. A run
407
+ with no prompt and no output stays `not measured`, never `$0.00`.
408
+
409
+ ### Guardrails on non-Claude providers
410
+
411
+ With codex, cline, aider or opencode, engine10 enforces the wall-clock limit
412
+ and `BUDGET_LIMIT` (for example `BUDGET_LIMIT=5 loki start prd.md`) by killing
413
+ the process group. After each iteration it scans the diff and reverts and
414
+ fails the iteration on mass deletion of tracked files, `.git/config` changes,
415
+ new git hooks, and symlinks or paths outside the project (a `guard.violation`
416
+ event). Native flags are used where the CLI has them: codex runs with
417
+ `--sandbox workspace-write`, aider with `--no-auto-commits`. Cline and
418
+ opencode have no sandbox flag. The scan is post-hoc rather than inline, so
419
+ receipts still list `kill blocking not enforced` for these providers.
420
+
421
+ For opencode, a run's Cost line reads `not measured` and the NOT PROVEN line
422
+ adds the literal entry `kill blocking not enforced`
423
+ (`loki-ts/src/engine10/stages/seal.ts`). opencode is a supported
424
+ engine10 provider (`loki-ts/src/runner/provider_opencode.ts`): install it with
425
+ `npm install -g opencode-ai` and select it with `--provider opencode`. It runs
426
+ `opencode run --auto` non-interactively, takes a `provider/model` id from
427
+ `LOKI_OPENCODE_MODEL` (for example `openrouter/deepseek/deepseek-v3.2`; unset
428
+ uses opencode's own default), passes extra flags from `LOKI_OPENCODE_FLAGS`,
429
+ and honors `LOKI_OPENCODE_CLI` for the binary path. `LOKI_HOST_GUARD=1` is
430
+ incompatible with non-Claude providers.
431
+
432
+ ### Model routes and local models
433
+
434
+ To run OpenRouter or a local model through the Claude harness, so every
435
+ Tier-1 control (cost, kill blocking, receipts) still applies, set
436
+ `LOKI_MODEL_ROUTE=<kind>/<id>` before `loki start`. Selection is by
437
+ environment variable; `loki start` has no `--model` flag.
438
+
439
+ ```
440
+ LOKI_MODEL_ROUTE=ollama/qwen3-coder loki start prd.md
441
+ LOKI_MODEL_ROUTE=openrouter/deepseek/deepseek-v3.2 loki start "fix the login bug"
442
+ ```
443
+
444
+ | Kind | Base URL | Token |
445
+ |------|----------|-------|
446
+ | `openrouter/<id>` | https://openrouter.ai/api | `OPENROUTER_API_KEY` |
447
+ | `ollama/<id>` | http://localhost:11434 | none |
448
+ | `lmstudio/<id>` | http://localhost:1234 | none |
449
+ | `llamacpp/<id>` | http://localhost:8080 | none |
450
+ | `vllm/<id>` | http://localhost:8000 | none |
451
+ | `custom/<id>` | `LOKI_MODEL_BASE_URL` (required) | `LOKI_MODEL_API_KEY` (optional) |
452
+
453
+ A route spec in `LOKI_MODEL_OVERRIDE` works too. The route environment
454
+ applies to the Claude child process only; the token is never exported into
455
+ your shell, put on a command line, or logged. Plain Claude ids (`opus`,
456
+ `sonnet`, `claude-*`) behave as before.
231
457
 
232
- For codex, cline and aider, a run's Cost line reads `not measured` and the
233
- NOT PROVEN line adds the literal entry `kill blocking not enforced`
234
- (`loki-ts/src/engine10/stages/seal.ts`). opencode is not one of engine10's
235
- provider names (`claude`, `codex`, `cline`, `aider`); it is not supported.
458
+ `loki models` lists the routes. `loki models --local` probes Ollama, LM
459
+ Studio, llama.cpp and vLLM on their default ports (1s timeout each) and prints
460
+ ready-to-paste values. Both accept `--json`.
236
461
 
237
462
  ## Model routing
238
463
 
@@ -321,10 +546,11 @@ runs on the B9 corpus, and it can emit shape defaults from those runs
321
546
 
322
547
  ## After the flip
323
548
 
324
- D48 made v10 the default for `loki "<task>"`, `loki owner/repo#N` and
325
- `loki quick "<task>"`. 11.0.0 removed the engine switch: `loki legacy` exits
326
- 2 with a removal message and LOKI_ENGINE is ignored. PRD-file starts
327
- (`loki start ./prd.md`), the opencode provider, and the no-bun
328
- fallback still run on the previous bash loop until FC38-SWEEP ports them; they are tracked in
329
- docs/v10/LEGACY-REMOVAL.md. The marked line near the top of this file and of
330
- README.md's Loki 10 section records the current state.
549
+ D48 made v10 the default for `loki start`, `loki "<task>"`,
550
+ `loki owner/repo#N` and `loki quick "<task>"`. 11.0.0 removed `loki legacy`
551
+ (it exits 2 with a removal message). From 11.4.0, `--engine legacy|engine10`
552
+ and `LOKI_ENGINE` select the engine explicitly, and PRD-file starts, flag-first
553
+ calls, one-word briefs and the opencode provider run on Loki 10 (see Routing).
554
+ The previous bash loop runs only in the cases listed under Routing. The marked
555
+ line near the top of this file and of README.md's Loki 10 section records the
556
+ current state.
@@ -611,3 +611,9 @@ the same hidden checks; wall_ratio = mean loki wall / mean raw wall; 95% percent
611
611
  ## Release latency metric (WF-2MIN-3)
612
612
 
613
613
  Definition: seconds from the Release run's dispatch/push event to the `+ loki-mode@<version>` line of the `npm publish` step in the `release` job. Baseline run 37869841774: 2m46s (gate/required-ci 30s, release 68s, publish-npm 64s). Target: under 2m. npm registry lag is NOT part of this metric; the non-blocking `npm-visible` job records it separately in its job summary (`npm registry lag: ... visible after Ns`, or `NPM-LAG-TIMEOUT`). Post-Release Smoke polls for visibility itself (up to 15 min).
614
+
615
+ | Version | Release run | Push SHA | Run created (UTC) | `+ loki-mode@` line (UTC) | Dispatch to publish | npm-visible done (UTC) | Registry lag (separate) | Target met |
616
+ |---|---|---|---|---|---|---|---|---|
617
+ | 11.3.8 | 37875150528 | 80989fdf0 | 02:33:37Z | 02:35:20Z | 1m43s | 02:39:49Z | ~4m29s | yes (under 2m) |
618
+
619
+ Source: `gh run view 37875150528 --log` (release job "Publish the verified tarball (no rebuild)" printed `+ loki-mode@11.3.8` at 2026-10-09T02:35:20Z), `gh run view 37875150528 --json createdAt` = 02:33:37Z; npm next = 11.3.8 at 436s after push. CTO steering smoke on 11.3.8: PASS (trivial-sum VERIFIED, $0.07, 27s). Prior run 11.3.7 (pre WF-2MIN-3) was 2m32s.