loki-mode 11.3.0 → 11.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/README.md +68 -650
  2. package/SKILL.md +4 -4
  3. package/VERSION +1 -1
  4. package/autonomy/completion-council.sh +2 -2
  5. package/autonomy/context-tracker.py +4 -4
  6. package/autonomy/council-v2.sh +1 -1
  7. package/autonomy/grill.sh +1 -1
  8. package/autonomy/lib/done-recognition.sh +1 -1
  9. package/autonomy/lib/prd-enrich.sh +1 -1
  10. package/autonomy/lib/voter-agents.sh +1 -1
  11. package/autonomy/loki +99 -75
  12. package/autonomy/run.sh +30 -18
  13. package/autonomy/sandbox.sh +1 -1
  14. package/autonomy/tui.sh +6 -5
  15. package/autonomy/verify.sh +1 -1
  16. package/bin/loki +166 -59
  17. package/completions/_loki +2 -0
  18. package/completions/loki.bash +2 -2
  19. package/dashboard/__init__.py +1 -1
  20. package/dashboard/server.py +25 -31
  21. package/docs/ARCHITECTURE.md +337 -0
  22. package/docs/BRANDING.md +124 -0
  23. package/docs/CLI-REFERENCE.md +7 -1
  24. package/docs/COMPONENTS.md +447 -0
  25. package/docs/DEPLOYMENT.md +9 -9
  26. package/docs/DOCKER.md +469 -0
  27. package/docs/INSTALLATION.md +67 -1045
  28. package/docs/KNOWN-ISSUES.md +11 -35
  29. package/docs/TESTING.md +161 -0
  30. package/docs/air-gapped.md +1 -2
  31. package/docs/alternative-installations.md +14 -24
  32. package/docs/architecture/DECISIONS.md +333 -0
  33. package/docs/audit-logging.md +7 -7
  34. package/docs/authentication.md +3 -3
  35. package/docs/authorization.md +1 -1
  36. package/docs/certification/04-production-deployment/lab.md +6 -6
  37. package/docs/certification/04-production-deployment/lesson.md +4 -4
  38. package/docs/certification/README.md +1 -1
  39. package/docs/control-plane-container.md +2 -2
  40. package/docs/dev/real-run.md +34 -0
  41. package/docs/dev/release-checklist.md +2 -2
  42. package/docs/exit-codes.md +3 -3
  43. package/docs/git-workflow.md +3 -3
  44. package/docs/metrics.md +37 -55
  45. package/docs/network-security.md +1 -1
  46. package/docs/siem-integration.md +5 -5
  47. package/docs/v10/CLI-MODERN.md +4 -3
  48. package/docs/v10/DECISIONS.md +44 -0
  49. package/docs/v10/DEPS.md +22 -22
  50. package/docs/v10/ENGINE.md +1 -1
  51. package/docs/v10/FAILURE-CLASSES.md +118 -1
  52. package/docs/v10/FOUNDER-QUEUE.md +1 -0
  53. package/docs/v10/GUARDS.md +13 -0
  54. package/docs/v10/LEGACY-REMOVAL.md +4 -6
  55. package/docs/v10/METRICS.md +2 -2
  56. package/docs/v10/MODERNIZE.md +1 -1
  57. package/docs/v10/OPERATING-MODEL.md +2 -1
  58. package/docs/v10/PROGRESS.md +29 -0
  59. package/docs/v11/COST-HALF.md +352 -0
  60. package/docs/v11/MARKET-SLICES.md +315 -0
  61. package/docs/v11/REGISTRIES.md +730 -0
  62. package/loki-ts/data/model-pricing.json +52 -24
  63. package/loki-ts/dist/loki.js +1036 -957
  64. package/mcp/__init__.py +1 -1
  65. package/package.json +1 -1
  66. package/packages/control-plane/dist/server.js +2467 -736
  67. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  68. package/src/protocols/mcp-client.js +6 -2
  69. package/src/protocols/mcp-server.js +13 -3
  70. package/tools/audit-docs.py +1 -1
  71. package/web-app/dist/assets/{AdminPage-D_e45uTw.js → AdminPage-CMkHNJbF.js} +1 -1
  72. package/web-app/dist/assets/{Avatar-T3nIpoaf.js → Avatar-BJyjV7Zi.js} +1 -1
  73. package/web-app/dist/assets/{Badge-BKqb59pP.js → Badge-D572l0uq.js} +1 -1
  74. package/web-app/dist/assets/{Button-DjVlkh8_.js → Button-T4BnOZgl.js} +1 -1
  75. package/web-app/dist/assets/{CockpitPage-DXJgLGmh.js → CockpitPage-Cj_GFsNn.js} +1 -1
  76. package/web-app/dist/assets/{ComparePage-BRP_eVc_.js → ComparePage-A8m4ZXak.js} +1 -1
  77. package/web-app/dist/assets/{ErrorBoundary-CLjpGLjC.js → ErrorBoundary-hugCg5yg.js} +1 -1
  78. package/web-app/dist/assets/{EvidenceReceiptPanel-DX-vb4Xy.js → EvidenceReceiptPanel-CuJKDC2G.js} +1 -1
  79. package/web-app/dist/assets/{GitHubIssuesPanel-214HVHtX.js → GitHubIssuesPanel-BYGKjarC.js} +1 -1
  80. package/web-app/dist/assets/{GitHubPRsPanel-BEiZKc4t.js → GitHubPRsPanel-c7sFIJlf.js} +1 -1
  81. package/web-app/dist/assets/{HomePage-VvMHS5ga.js → HomePage-A1MIkG2P.js} +2 -2
  82. package/web-app/dist/assets/{LoginPage-5WD-v7n3.js → LoginPage-8KQMRhtR.js} +1 -1
  83. package/web-app/dist/assets/{MagicPage-DUQT_Jye.js → MagicPage-C05QW2Lx.js} +1 -1
  84. package/web-app/dist/assets/{MetricsPage-lga-z79v.js → MetricsPage-Oukv5hme.js} +1 -1
  85. package/web-app/dist/assets/{NotFoundPage-CGhBX3G1.js → NotFoundPage-DKIwsawz.js} +1 -1
  86. package/web-app/dist/assets/{ProjectPage-CdzF2GzZ.js → ProjectPage-DwFRPLCG.js} +3 -3
  87. package/web-app/dist/assets/{ProjectsPage-DRG64N8s.js → ProjectsPage-CgY4YYDX.js} +1 -1
  88. package/web-app/dist/assets/{SettingsPage-5fzW9Frb.js → SettingsPage-BpfcSjUA.js} +1 -1
  89. package/web-app/dist/assets/{ShowcasePage-DrTdxO4y.js → ShowcasePage-BqBakC4K.js} +1 -1
  90. package/web-app/dist/assets/{SystemSettingsPage-C9Mqs6Rd.js → SystemSettingsPage-CZLu5VB0.js} +1 -1
  91. package/web-app/dist/assets/{TeamsPage-CUGPdSWo.js → TeamsPage-D55S1jKz.js} +1 -1
  92. package/web-app/dist/assets/{TemplatesPage-CNraDY0F.js → TemplatesPage-D3SydvxN.js} +1 -1
  93. package/web-app/dist/assets/{TerminalOutput-BIu_6Pea.js → TerminalOutput-hNg8G1-e.js} +1 -1
  94. package/web-app/dist/assets/{activity-Bk-kgqaf.js → activity-D2C0VagO.js} +1 -1
  95. package/web-app/dist/assets/{bell-BXmUdmo8.js → bell-CMvYi36w.js} +1 -1
  96. package/web-app/dist/assets/{bot-CiuzXxUR.js → bot-BvtQ6lmo.js} +1 -1
  97. package/web-app/dist/assets/{check-BEzjXppd.js → check-B13xkXed.js} +1 -1
  98. package/web-app/dist/assets/{chevron-left-AYWCXHf8.js → chevron-left-emu6r49E.js} +1 -1
  99. package/web-app/dist/assets/{circle-alert-BNg2uSRq.js → circle-alert-CExlwjuy.js} +1 -1
  100. package/web-app/dist/assets/{clock-DTj0kkGT.js → clock-D7Uas3oL.js} +1 -1
  101. package/web-app/dist/assets/{cloud-x4nTDBLT.js → cloud-CkB4S86C.js} +1 -1
  102. package/web-app/dist/assets/{code-xml-BVh_MLrk.js → code-xml-SL9IIWIn.js} +1 -1
  103. package/web-app/dist/assets/{database-DdfBaowG.js → database-BQFkd7t1.js} +1 -1
  104. package/web-app/dist/assets/{dollar-sign-XuYFmAOY.js → dollar-sign-qHmnNYsU.js} +1 -1
  105. package/web-app/dist/assets/{file-code-corner-D4cRnmeL.js → file-code-corner-C2YUDP0K.js} +1 -1
  106. package/web-app/dist/assets/{file-plus-CyoVlHc_.js → file-plus-C_ooIkDe.js} +1 -1
  107. package/web-app/dist/assets/{globe-Y6IK2RPW.js → globe-CQ-GL485.js} +1 -1
  108. package/web-app/dist/assets/{hammer-BKzr9VZI.js → hammer-U05L_D7V.js} +1 -1
  109. package/web-app/dist/assets/{index-B20cSx5G.js → index-CooHd7I-.js} +3 -3
  110. package/web-app/dist/assets/{layers-DebNOhGS.js → layers-Buo17rjW.js} +1 -1
  111. package/web-app/dist/assets/{loader-circle-DyGbrEgd.js → loader-circle-15vK3oV1.js} +1 -1
  112. package/web-app/dist/assets/{lock-BKPpyt20.js → lock-BeXLebuJ.js} +1 -1
  113. package/web-app/dist/assets/{package-egF5Wi4y.js → package-MVh_6-6R.js} +1 -1
  114. package/web-app/dist/assets/{plus-OiEgKIc-.js → plus-Dh_nd9vS.js} +1 -1
  115. package/web-app/dist/assets/{refresh-cw-CzKvrONq.js → refresh-cw-C9cBJEAT.js} +1 -1
  116. package/web-app/dist/assets/{rotate-ccw-Bu2mII0p.js → rotate-ccw-D3PAtzST.js} +1 -1
  117. package/web-app/dist/assets/{scroll-text-CSkiyax8.js → scroll-text-DZCoXQjo.js} +1 -1
  118. package/web-app/dist/assets/{server-DlPthJFw.js → server-OCOLI5J_.js} +1 -1
  119. package/web-app/dist/assets/{shield-alert-CbpHWQQX.js → shield-alert-oVhmf1_h.js} +1 -1
  120. package/web-app/dist/assets/{thumbs-up-DgGpZe-Q.js → thumbs-up-B-kbX4vN.js} +1 -1
  121. package/web-app/dist/assets/{trash-2-BV3GlCB-.js → trash-2-EL6moveW.js} +1 -1
  122. package/web-app/dist/assets/{trending-down-Y4TJtXhD.js → trending-down-Cl3kjpsx.js} +1 -1
  123. package/web-app/dist/assets/{trending-up-DsDNoHZY.js → trending-up-DST7I6M2.js} +1 -1
  124. package/web-app/dist/assets/{upload-gkThrc_I.js → upload-CUOT780G.js} +1 -1
  125. package/web-app/dist/assets/{usePolling-jpNSeNAe.js → usePolling-Djmt90eb.js} +1 -1
  126. package/web-app/dist/assets/{user-3Zez1WOK.js → user-BRBohA6J.js} +1 -1
  127. package/web-app/dist/index.html +1 -1
  128. package/docs/ARCHITECTURE-OVERVIEW.md +0 -209
  129. package/docs/AUTONOMI-ECOSYSTEM.md +0 -107
  130. package/docs/COCKPIT-SPEC.md +0 -72
  131. package/docs/COCKPIT-UX-MANDATE.md +0 -53
  132. package/docs/COMPETITIVE-ANALYSIS.md +0 -303
  133. package/docs/COMPETITIVE-NEXT-10.md +0 -316
  134. package/docs/COMPETITIVE-RALPH-ZEROSHOT-2026-07-08.md +0 -81
  135. package/docs/DASHBOARD-9.12-EVIDENCE.md +0 -97
  136. package/docs/DASHBOARD-ARCHITECTURE.md +0 -425
  137. package/docs/DASHBOARD_V2_CHECKLIST.md +0 -243
  138. package/docs/DEMOS.md +0 -63
  139. package/docs/ENTERPRISE-IDENTITY-ROADMAP.md +0 -206
  140. package/docs/EVIDENCE-RECEIPT-BUILD-APPLICABILITY.md +0 -79
  141. package/docs/FEAT-PRDREUSE-DOCKER-PLAN.md +0 -144
  142. package/docs/GATE-FAILURE-TRIAGE.md +0 -254
  143. package/docs/HANDOFF-2026-08-03.md +0 -439
  144. package/docs/LOOP-CANDIDATE-PROPOSAL-v1.md +0 -167
  145. package/docs/LOOP-HARNESS-AUDIT.md +0 -684
  146. package/docs/MERGE-DEDUP-MAP.md +0 -420
  147. package/docs/MERGE-ROUTE-MAP.md +0 -139
  148. package/docs/MODEL-REGISTRY-PLAN.md +0 -155
  149. package/docs/OUTCOME-FRONTIER.md +0 -536
  150. package/docs/P2-SPEC-ROBUSTNESS-PLAN.md +0 -192
  151. package/docs/PLANS-INDEX.md +0 -32
  152. package/docs/PRD-REUSE-DONE-RECOGNITION-PLAN.md +0 -536
  153. package/docs/PROMPT-ABLATION-RESULT.md +0 -97
  154. package/docs/R4-TRUST-TRAJECTORY-DESIGN.md +0 -127
  155. package/docs/R5-AUTO-WIKI-DESIGN.md +0 -137
  156. package/docs/R6-ROLLBACK-CHECKPOINT-PLAN.md +0 -107
  157. package/docs/R7-ZERO-CONFIG-FIRST-RUN-PLAN.md +0 -137
  158. package/docs/R8-SHAREABLE-TEAM-ASSETS-PLAN.md +0 -129
  159. package/docs/R9-OPEN-CORE-HOOKS-PLAN.md +0 -113
  160. package/docs/RARV-C-100X-PLAN.md +0 -286
  161. package/docs/RARV-C-LOOP-EFFICIENCY-PLAN.md +0 -470
  162. package/docs/SHAREABLE-PROOF-PLAN.md +0 -194
  163. package/docs/SONNET5-DEFAULT-PLAN.md +0 -157
  164. package/docs/SPEED-AND-FIRST-PASS-PLAN.md +0 -281
  165. package/docs/STALE-STATE-AUDIT.md +0 -174
  166. package/docs/SYNERGY-TASKS.md +0 -143
  167. package/docs/TASKLIST-ACCURACY-PLAN.md +0 -355
  168. package/docs/TOP-100-BACKLOG.md +0 -159
  169. package/docs/V8-ACCEPTANCE-TRIAGE-2026-07-24.md +0 -114
  170. package/docs/V8-COMPLEXITY-AUDIT-2026-07-24.md +0 -45
  171. package/docs/V8-MAJOR-RELEASE-PLAN.md +0 -137
  172. package/docs/V8-OVERNIGHT-PLAN-2026-07-25.md +0 -82
  173. package/docs/V8-SDK-RESEARCH-RAW.md +0 -129
  174. package/docs/WELCOME-OPENER-PLAN.md +0 -106
  175. package/docs/adoption-baseline-2026-07-31.md +0 -84
  176. package/docs/architecture/bmad-integration-epic.md +0 -271
  177. package/docs/architecture/bmad-integration-review.md +0 -86
  178. package/docs/architecture/bmad-integration-validation.md +0 -249
  179. package/docs/architecture/bmad-loki-voice-agent-council-analysis.md +0 -61
  180. package/docs/auto-claude-comparison.md +0 -250
  181. package/docs/bug-fixes/agent-01-cli-fixes.md +0 -101
  182. package/docs/bug-fixes/agent-02-purplelab-fixes.md +0 -88
  183. package/docs/bug-fixes/agent-03-dashboard-fixes.md +0 -119
  184. package/docs/bug-fixes/agent-04-memory-fixes.md +0 -105
  185. package/docs/bug-fixes/agent-05-provider-fixes.md +0 -86
  186. package/docs/bug-fixes/agent-06-integration-fixes.md +0 -101
  187. package/docs/bug-fixes/agent-07-dash-run-fixes.md +0 -101
  188. package/docs/bug-fixes/agent-08-docker-fixes.md +0 -164
  189. package/docs/bug-fixes/agent-09-e2e-build-fixes.md +0 -69
  190. package/docs/bug-fixes/agent-10-e2e-fullstack-fixes.md +0 -102
  191. package/docs/bug-fixes/agent-11-e2e-session-fixes.md +0 -70
  192. package/docs/bug-fixes/agent-12-scenario-fixes.md +0 -120
  193. package/docs/bug-fixes/agent-13-enterprise-fixes.md +0 -143
  194. package/docs/bug-fixes/agent-14-uat-newuser-fixes.md +0 -88
  195. package/docs/bug-fixes/agent-15-uat-poweruser-fixes.md +0 -132
  196. package/docs/bug-fixes/agent-19-code-review.md +0 -316
  197. package/docs/bug-fixes/agent-20-architecture-review.md +0 -331
  198. package/docs/competitive/bolt-new-analysis.md +0 -579
  199. package/docs/competitive/emergence-others-analysis.md +0 -605
  200. package/docs/competitive/replit-lovable-analysis.md +0 -622
  201. package/docs/dashboard-guide.md +0 -487
  202. package/docs/enterprise/migration.md +0 -265
  203. package/docs/history/one-run-audit.md +0 -304
  204. package/docs/plans/FORGE-AUTONOMOUS-QUEUE.md +0 -312
  205. package/docs/plans/ULTRAPLAN-FORGE-BAAS.md +0 -612
  206. package/docs/plans/UT2-6-LSP-DIAGNOSTIC-BROADCAST.md +0 -394
  207. package/docs/prd-purple-lab-ide.md +0 -152
  208. package/docs/prd-purple-lab-platform-v2.md +0 -223
  209. package/docs/prd-purple-lab-platform.md +0 -319
  210. package/docs/retrospectives/v7.5.15-fleet-postmortem.md +0 -325
  211. package/docs/retrospectives/v7.5.15-honesty-audit.md +0 -136
  212. package/docs/retrospectives/v7.5.15-llm-failure-modes.md +0 -49
  213. package/docs/show-hn-post.md +0 -46
  214. package/docs/test-scenarios/enterprise-scenarios.md +0 -732
  215. package/docs/thick2thin.md +0 -173
@@ -1,41 +1,17 @@
1
+ # Known issues
1
2
 
2
- ## doctor --json writes 108 bytes to stderr on a provider-less host
3
+ Issues in the current release that are known and not yet fixed. Report new ones with `loki crash` or at https://github.com/asklokesh/loki-mode/issues.
3
4
 
4
- `bash autonomy/loki doctor --json` on a host with NO provider CLI emits:
5
+ ## `loki verify` exit codes differ from the target table in three cases
5
6
 
6
- ```
7
- autonomy/loki: line 14066: required: command not found
8
- autonomy/loki: line 14066: status: command not found
9
- ```
7
+ | Input | Command | Exit today | Target |
8
+ |---|---|---|---|
9
+ | Empty diff (a git repo with no changes vs base) | `loki verify` | 1 (CONCERNS) | 3 |
10
+ | Not a git directory | `loki verify` | 1 (CONCERNS) | 2 |
11
+ | Unknown flag | `loki verify` with a flag it does not know | 3 | 64 |
10
12
 
11
- **Not user-affecting, and not a JSON defect.** stdout is 5176 bytes of valid
12
- JSON; only stderr is polluted. Every `doctor --json` assertion in the repo
13
- discards stderr (`tests/test-airgap-commands.sh:50`,
14
- `tests/test-doctor-ci-gateable.sh:46,84,86`).
15
- `tests/test-e2e-features.sh:104` was the lone outlier using `2>&1` and has been
16
- brought into line.
13
+ Changing these is a breaking change for CI gates, so it waits for a planned release. Details: [exit-codes.md](exit-codes.md#known-gaps).
17
14
 
18
- **Attribution:** introduced this session. `git show 0416810d:autonomy/loki`
19
- (v9.48.2) emits 0 bytes on the same host; HEAD emits 108. The region was last
20
- touched by `56e03374 feat(doctor): show provider availability`.
21
-
22
- **Six hypotheses tested and REFUTED, so the next person does not repeat them:**
23
-
24
- 1. Word-splitting of `$_provider_availability` at `:14066` -- the assignment is
25
- correctly quoted; reproduced in isolation as OK.
26
- 2. `provider_availability_json` emitting to stderr -- 0 bytes, clean 353-byte
27
- JSON in isolation.
28
- 3. Its callees `auto_detect_provider` / `check_provider_installed` -- both
29
- silent.
30
- 4. The JSON value's content -- `required` and `status` appear 0 times in it.
31
- 5. The value being multi-line and breaking the env-assignment chain -- forcing
32
- `LOKI_PROVIDER_AVAILABILITY=""` as a literal STILL reproduces.
33
- 6. `render_provider_availability` -- silent in isolation, and disabling the call
34
- still reproduces.
35
-
36
- **Also known:** `bash -n` parses the file clean; sourcing the file and calling
37
- `cmd_doctor_json` directly emits 0 bytes, while executing the file emits 108.
38
- That difference (streaming read vs single parse) is the strongest remaining
39
- lead. The words `required` and `status` are python identifiers at `:14085-14098`
40
- inside the `python3 -c "` string that opens at `:14069`.
15
+ ## `loki start` uses the older engine
41
16
 
17
+ `loki "<task>"`, `loki owner/repo#N` and `loki quick` run the Loki 10 engine. `loki start ./prd.md` still routes to the older engine, which is being removed. Prefer `loki owner/repo#N` or `loki "<task>"`.
@@ -0,0 +1,161 @@
1
+ # Testing
2
+
3
+ This document describes the test strategy, test types, and how to run and configure tests for Loki Mode.
4
+
5
+ Loki Mode is a polyglot codebase. Tests span three languages and runtimes:
6
+
7
+ - Bash (orchestration engine, CLI, councils, hooks)
8
+ - Python (dashboard API, memory system, benchmarks, MCP server)
9
+ - TypeScript / JavaScript (the Bun runner under `loki-ts/`, the Deno/Node API under `api/`, dashboard UI checks)
10
+
11
+ Because the product's central promise is verified completion ("Loki does not lie about done"), the test suite is treated as a trust layer, not a formality. Trust-surface code (completion councils, quality gates, evidence receipts, the Bun runner, memory integrity) is held to a higher bar: mutation testing, parity checks, and adversarial detectors back the standard unit and integration tests.
12
+
13
+ ## Test Strategy
14
+
15
+ 1. Test the trust surface hardest. Completion detection, override councils, the verified-completion evidence gate, and the RARV-C closure loop are the highest-risk paths. They get unit tests plus mutation testing plus cross-route parity checks.
16
+ 2. Cross-route parity is a first-class concern. Behavior must match between the legacy Bash route and the Bun (`loki-ts`) route. Parity is checked by `tests/test-bash-bun-parity.sh` and the per-command parity suites under `tests/` (for example, doctor-output text drift); there is no continuous parity workflow.
17
+ 3. Prefer real verification over mocked assertions. Dedicated detectors (`tests/detect-mock-problems.sh`, `tests/detect-semantic-test-problems.sh`, `tests/detect-test-mutations.sh`, `tests/detect-invariant-violations.sh`) flag tests that pass without exercising real logic.
18
+ 4. Local CI is the canonical pre-push gate. `scripts/local-ci.sh` mirrors the GitHub Actions workflows so failures are discovered on the developer machine, not after push. GitHub Actions is the post-push verifier.
19
+ 5. Run tests in matrices. Python runs across 3.10 through 3.13; the Node suite runs across the supported Node versions. Version-specific breakage (for example, a Python 3.13-only inode race) must be caught by the matrix.
20
+
21
+ ## Test Types
22
+
23
+ ### Unit tests
24
+
25
+ - Bash unit tests live under `tests/` (for example `tests/cli/`, `tests/council/`, `tests/memory/`) and are orchestrated by `tests/run-all-tests.sh`. They cover bootstrap, task queue, circuit breaker, agent timeout, state recovery, and the memory engine, among others. Several use function extraction: a helper is sourced out of `run.sh` and exercised in isolation. When a helper gains a new dependency, the extraction test must extract that dependency too, or the logic is silently skipped.
26
+ - Python unit tests are `tests/test_*.py` files (120+ modules) covering the classifier, composer, calibration, embeddings edge cases, event bus, compose port selection, app-runner PID recycling, and more. They run under `pytest`.
27
+ - TypeScript unit tests live under `loki-ts/tests/` (70+ `*.test.ts` files) and run under `bun test`. They cover the runner internals: state, prompt building, providers, budget, checkpoint, and shell utilities.
28
+ - Node/Deno unit tests are `*_test.ts` and `*.test.js` files under `api/` and `tests/` (protocols, observability, policies, audit, integrations), run with `node --test`.
29
+
30
+ ### Integration tests
31
+
32
+ - `tests/integration/` holds the integration suite, run via `bash tests/integration/run_integration_suite.sh` (also exposed as `npm run test:integration`).
33
+ - `tests/integrations/` covers external system integrations (GitHub, Jira, Slack), run with `node --test`.
34
+ - Managed-memory integration is gated behind flags and covered by `tests/managed_memory/` (flag matrix, SDK isolation, kill switch, shadow-write, retrieve).
35
+
36
+ ### End-to-end tests
37
+
38
+ - `tests/e2e/` and `tests/live/` contain end-to-end and live-path scenarios.
39
+ - Control Plane UI E2E lives in `packages/control-plane/test/e2e/` (Playwright, headless, loopback stub API).
40
+ - Docker E2E lives under `tests/docker/` with the `docker/Dockerfile.sandbox` image.
41
+ - Post-release distribution E2E is run after a release ships: install from the npm tarball, pull the Docker image, and exercise both the Bun and legacy-Bash routes on each channel.
42
+
43
+ ### Specialized test layers
44
+
45
+ - Mutation testing (`loki-ts`): Stryker mutates trust-surface modules (`src/runner/state.ts`, `build_prompt.ts`, `providers.ts`, `budget.ts`, `checkpoint.ts`, `src/util/shell.ts`). Config: `loki-ts/stryker.config.json`. Thresholds: break 50%, low 60%, high 80%.
46
+ - Parity tests: `tests/test-bash-bun-parity.sh` and the per-command parity suites verify the Bun and Bash routes agree.
47
+ - Integrity and quality detectors: shell scripts under `tests/` that detect mock-only tests, semantic test problems, test mutations, and invariant violations.
48
+
49
+ ## How to Run Tests
50
+
51
+ ### Quick start
52
+
53
+ ```bash
54
+ # Full default suite (bash syntax checks + node --test suites + managed-memory)
55
+ npm test
56
+
57
+ # Pre-push gate: mirrors every CI workflow. Run this before every git push.
58
+ bash scripts/local-ci.sh
59
+ ```
60
+
61
+ If `local-ci.sh` reports "DO NOT PUSH", do not push. Fix the failures and re-run.
62
+
63
+ ### By language and layer
64
+
65
+ ```bash
66
+ # Bash shell test suite
67
+ bash tests/run-all-tests.sh
68
+
69
+ # Python tests (all)
70
+ python3 -m pytest
71
+
72
+ # Python tests (single module)
73
+ python3 -m pytest tests/test_classifier.py -v
74
+
75
+ # TypeScript / Bun runner tests
76
+ cd loki-ts && bun test
77
+
78
+ # Bun runner type check
79
+ cd loki-ts && bun run typecheck
80
+
81
+ # Integration suite
82
+ npm run test:integration
83
+ # or
84
+ bash tests/integration/run_integration_suite.sh
85
+
86
+ # Control Plane tests
87
+ cd packages/control-plane && bun test ./test/
88
+ ```
89
+
90
+ ### Mutation testing (local)
91
+
92
+ ```bash
93
+ cd loki-ts && npx stryker run
94
+ ```
95
+
96
+ ### Syntax-only validation (fast smoke)
97
+
98
+ ```bash
99
+ bash -n autonomy/run.sh
100
+ bash -n autonomy/loki
101
+ bash -n autonomy/completion-council.sh
102
+ python3 -c "import ast, os; [ast.parse(open(f'dashboard/{f}').read()) for f in os.listdir('dashboard') if f.endswith('.py')]"
103
+ ```
104
+
105
+ ### Cleanup after test runs (mandatory)
106
+
107
+ Spawned processes and temp files must be cleaned up after any run that starts a server or test runner:
108
+
109
+ ```bash
110
+ lsof -ti:57374 | xargs kill -9 2>/dev/null || true
111
+ pkill -f "loki-run-" 2>/dev/null || true
112
+ rm -rf /tmp/loki-* /tmp/test-* /tmp/package /tmp/*.tgz 2>/dev/null || true
113
+
114
+ # Verify
115
+ ps -ef | grep -E "(loki|test)" | grep -v grep || echo "Clean"
116
+ ```
117
+
118
+ Note: never run `rm -rf /tmp/loki-*` while a live `loki` run is in progress; the orchestrator stages its run script at `/tmp/loki-run-*.sh`. Check `pgrep -f loki-run-` first.
119
+
120
+ ## Test Configuration
121
+
122
+ | Area | Tool | Config / entry point |
123
+ |---|---|---|
124
+ | Default test command | mixed (bash, node) | `package.json` `test` script |
125
+ | Bash suite | bash | `tests/run-all-tests.sh` |
126
+ | Python | pytest | invoked via `python3 -m pytest`; deps: `pytest`, `pytest-asyncio` |
127
+ | Bun runner | bun test | `loki-ts/package.json`, `loki-ts/bunfig.toml` |
128
+ | Node/Deno | `node --test` | `*_test.ts`, `*.test.js` |
129
+ | Mutation | Stryker | `loki-ts/stryker.config.json` |
130
+ | Control Plane UI E2E | Playwright | `packages/control-plane/test/e2e/` |
131
+ | Pre-push gate | bash | `scripts/local-ci.sh` |
132
+
133
+ Python test dependencies commonly required: `fastapi`, `httpx`, `pydantic`, `sqlalchemy[asyncio]`, `aiosqlite`, `uvicorn`. Install with pip before running the Python suite.
134
+
135
+ ## Coverage Goals
136
+
137
+ - No CI workflow collects or enforces a numeric line-coverage percentage. `bun test --coverage` can be run locally in `loki-ts`.
138
+ - Mutation-score thresholds for trust-surface modules: break at 50%, low at 60%, high at 80% (`loki-ts/stryker.config.json`).
139
+ - The Bash, Python and Bun suites do not currently enforce a numeric coverage percentage. Coverage of trust-surface logic is asserted through targeted unit tests, parity checks, and the mock/semantic/mutation detectors rather than a global percentage.
140
+
141
+ ## CI Integration
142
+
143
+ GitHub Actions workflows (under `.github/workflows/`) run on push and pull request:
144
+
145
+ | Workflow | File | What it runs |
146
+ |---|---|---|
147
+ | Tests | `test.yml` | Node suite (`npm test`), Python suite (`pytest`) across 3.10-3.13, shell suite (`tests/run-all-tests.sh`), Helm lint |
148
+ | Integrity audit | `integrity-audit.yml` | Repository and artifact integrity checks |
149
+ | Post-release smoke | `post-release-smoke.yml` | Smoke tests against published artifacts after a release |
150
+ | Security audit | `security-audit.yml` | Dependency and security scanning |
151
+ | SBOM | `sbom.yml` | Software bill of materials generation |
152
+
153
+ ### Local CI mirrors GitHub Actions
154
+
155
+ `scripts/local-ci.sh` is the canonical pre-push gate. It mirrors every GitHub Actions workflow: bun typecheck/test, the full `tests/run-all-tests.sh` shell suite (matching CI exactly, not a cherry-picked subset), npm pack contents, SBOM, license audit, npm audit, shellcheck, YAML parse, the no-emoji check, the no-`git add -A` check, and a cleanup probe.
156
+
157
+ Run it before every push. The Mac (developer machine) is the discovery channel; GitHub Actions is the post-push verifier. Distinguish real failures from local-environment false alarms (for example a missing `pytest-asyncio` in a Homebrew Python) before acting on a red result.
158
+
159
+ ### Release-time validation
160
+
161
+ Before a release is committed, the npm tarball is verified to contain the built dashboard and web-app artifacts, and a fresh global install is exercised end to end (`loki --version`, `loki web`, `/api/status`). After a release ships, post-release distribution validation runs across npm, Docker, and Homebrew on both the Bun and legacy-Bash routes.
@@ -90,8 +90,7 @@ your network, but the audit still counts it as required egress.
90
90
  Telemetry is ON by default for an individual interactive install and auto-off
91
91
  in CI, non-interactive, `LOKI_ENTERPRISE=true` and `LOKI_AIRGAP=true`
92
92
  contexts. The audit shows its real state. Every opt-out wins (`DO_NOT_TRACK=1`,
93
- `LOKI_TELEMETRY=off`, `loki telemetry off`). The adoption instrumentation added
94
- in v8.6.0 requires a second explicit opt-in on top of that -- see
93
+ `LOKI_TELEMETRY=off`, `loki telemetry off`). The adoption instrumentation requires a second explicit opt-in on top of that -- see
95
94
  [PRIVACY.md](./PRIVACY.md).
96
95
 
97
96
  ## Why `unknown` is the right answer offline
@@ -1,6 +1,6 @@
1
1
  # Alternative Installation Methods
2
2
 
3
- The recommended installation is via npm or Homebrew (see [README](../README.md#get-started-in-30-seconds)). These alternatives serve specific use cases.
3
+ The recommended installation is via npm or Homebrew (see [INSTALLATION.md](INSTALLATION.md)). These alternatives serve specific use cases.
4
4
 
5
5
  ---
6
6
 
@@ -16,7 +16,7 @@ git clone https://github.com/asklokesh/loki-mode.git ~/.claude/skills/loki-mode
16
16
  ln -sf ~/.claude/skills/loki-mode ~/.codex/skills/loki-mode
17
17
 
18
18
  # Optionally add CLI to PATH:
19
- ln -sf ~/.claude/skills/loki-mode/autonomy/loki /usr/local/bin/loki
19
+ ln -sf ~/.claude/skills/loki-mode/bin/loki /usr/local/bin/loki
20
20
  ```
21
21
 
22
22
  **Update:** `cd ~/.claude/skills/loki-mode && git pull`
@@ -27,21 +27,21 @@ ln -sf ~/.claude/skills/loki-mode/autonomy/loki /usr/local/bin/loki
27
27
 
28
28
  ## Docker
29
29
 
30
- **Status:** Image exists on Docker Hub. Tags: `latest`, version-specific (e.g., `9.8.0`).
30
+ **Status:** Image exists on Docker Hub. Tags: `latest`, one per release version (for example `X.Y.Z`, matching the npm version).
31
31
 
32
32
  ```bash
33
33
  docker pull asklokesh/loki-mode:latest
34
34
  ```
35
35
 
36
- **Limitation:** Claude Code is an interactive CLI that requires API keys and terminal access. Running it inside a Docker container is not the standard workflow. Docker is useful for:
36
+ **Limitation:** The image ships the Claude Code CLI. Docker is useful for:
37
37
 
38
38
  - CI/CD sandbox execution (running `loki` in isolated environments)
39
39
  - Testing Loki Mode without modifying your local system
40
40
  - Air-gapped environments with pre-built images
41
41
 
42
- **Not recommended for:** Interactive Claude Code sessions. Use npm or Homebrew instead.
42
+ `loki docker <command>` runs any loki command in the image with the current folder mounted, so `.loki/` state and resume behave like the local CLI.
43
43
 
44
- See [DOCKER_README.md](../DOCKER_README.md) for Docker-specific usage instructions.
44
+ See [DOCKER.md](DOCKER.md) for Docker-specific usage instructions.
45
45
 
46
46
  ---
47
47
 
@@ -63,7 +63,7 @@ jobs:
63
63
  runs-on: ubuntu-latest
64
64
  steps:
65
65
  - uses: actions/checkout@v4
66
- - uses: asklokesh/loki-mode@v8.0.0
66
+ - uses: asklokesh/loki-mode@vX.Y.Z # pin a release tag
67
67
  with:
68
68
  github_token: ${{ secrets.GITHUB_TOKEN }}
69
69
  mode: review
@@ -75,7 +75,7 @@ jobs:
75
75
  ```
76
76
 
77
77
  **Prerequisites:**
78
- - API key for your provider (set as repository secret): `ANTHROPIC_API_KEY` (Claude, recommended) or `OPENAI_API_KEY` (Codex). `GOOGLE_API_KEY` was for the Gemini provider, which is DEPRECATED as of v7.5.18.
78
+ - API key for your provider (set as repository secret): `ANTHROPIC_API_KEY` (Claude, recommended) or `OPENAI_API_KEY` (Codex).
79
79
  - The action auto-installs `loki-mode` and `@anthropic-ai/claude-code`
80
80
 
81
81
  **Action Inputs:**
@@ -83,13 +83,13 @@ jobs:
83
83
  | Input | Default | Description |
84
84
  |-------|---------|-------------|
85
85
  | `mode` | `review` | `review`, `fix`, or `test` |
86
- | `provider` | `claude` | `claude` (recommended), `cline`, `codex`, `aider`, or `opencode`. `gemini` was REMOVED in v7.5.18. |
86
+ | `provider` | `claude` | `claude` (recommended), `cline`, `codex`, `aider`, or `opencode`. |
87
87
  | `budget_limit` | `5.00` | Max cost in USD (passed to the Loki 10 engine as `--max-cost`) |
88
88
  | `max_iterations` | `3` | Max RARV cycles |
89
89
  | `github_token` | (required) | GitHub token for PR comments |
90
90
  | `prd_file` | | Path to PRD file (for fix/test modes) |
91
91
 
92
- **Engine:** every mode runs the Loki 10 engine through `loki start "<task>" --no-pr --provider <name> --max-cost <usd>` (the same path as `loki start owner/repo#N`). The PRD file or PR diff is folded into the task text. The action never opens a PR itself (Rule of Two). A run that crosses the cap ends BUDGET_STOP (exit 3). The legacy `--simple` path is no longer used.
92
+ **Engine:** every mode runs the Loki 10 engine through `loki start "<task>" --no-pr --provider <name> --max-cost <usd>` (the same path as `loki start owner/repo#N`). The PRD file or PR diff is folded into the task text. The action never opens a PR itself (Rule of Two). A run that crosses the cap ends BUDGET_STOP (exit 3).
93
93
 
94
94
  **Modes:**
95
95
 
@@ -108,20 +108,10 @@ jobs:
108
108
  **Status:** Working. Release assets available for each version.
109
109
 
110
110
  ```bash
111
- # Download and extract to skills directory
112
- curl -sL https://github.com/asklokesh/loki-mode/archive/refs/tags/v8.0.0.tar.gz | tar xz
113
- mv loki-mode-8.0.0 ~/.claude/skills/loki-mode
111
+ # Download the latest release and extract to the skills directory
112
+ VERSION=$(npm view loki-mode version)
113
+ curl -sL https://github.com/asklokesh/loki-mode/archive/refs/tags/v${VERSION}.tar.gz | tar xz
114
+ mv loki-mode-${VERSION} ~/.claude/skills/loki-mode
114
115
  ```
115
116
 
116
117
  **Best for:** Offline or air-gapped environments, pinned version deployments.
117
-
118
- ---
119
-
120
- ## VS Code Extension (Deprecated)
121
-
122
- > **DEPRECATED as of v7.2.0.** The Loki Mode VS Code extension is no longer
123
- > maintained and is no longer published to the VS Code Marketplace. Use the
124
- > Control Plane instead (`loki dashboard`).
125
- > The `vscode-extension/` source remains in the repository for contributors who
126
- > want to build it locally. See
127
- > [INSTALLATION.md](INSTALLATION.md#vs-code-extension-deprecated) for details.
@@ -0,0 +1,333 @@
1
+ # Architectural Decision Records
2
+
3
+ This document records the significant architectural decisions for **loki-mode**,
4
+ an autonomous spec-to-product system. Each record captures the context in which
5
+ a decision was made, the decision itself, and the consequences that follow.
6
+
7
+ Decisions are listed newest-first by ADR number. A decision marked **Superseded**
8
+ remains for historical reference; the record that replaces it is named inline.
9
+
10
+ For the detailed runtime-migration record, see
11
+ `docs/architecture/ADR-001-runtime-migration.md`. The summary below mirrors its
12
+ high-level conclusions.
13
+
14
+ ---
15
+
16
+ ## ADR-001: Migrate the orchestrator runtime from bash to Bun/TypeScript
17
+
18
+ **Status:** Accepted (phased; bash sunset gated on a clean soak)
19
+
20
+ ### Context
21
+
22
+ The original orchestrator was implemented as two very large bash programs:
23
+ `autonomy/run.sh` (the RARV-C iteration loop) and `autonomy/loki` (the CLI, with
24
+ 100+ command handlers). At over 10,000 lines each they were untyped, fragile,
25
+ and hard to refactor or test. As the product grew, the cost of changing core
26
+ control flow in bash kept rising, and the lack of static typing meant defects
27
+ surfaced only at runtime in users' terminals.
28
+
29
+ ### Decision
30
+
31
+ Port the orchestrator and CLI to TypeScript running on Bun (`loki-ts/`). Ship the
32
+ migration in phases (scaffold, read-only commands, build tooling, outer loop,
33
+ council and code review, then bash sunset) rather than as a single rewrite. A
34
+ `bin/loki` shim routes ported commands to the Bun CLI and falls through to the
35
+ bash implementation for the rest. `LOKI_LEGACY_BASH=1` forces the bash route as a
36
+ rollback escape hatch.
37
+
38
+ ### Consequences
39
+
40
+ - Both runtimes coexist during the migration, so every behavior must be verified
41
+ for cross-route parity. A dedicated parity matrix in CI guards against drift.
42
+ - New work lands in typed TypeScript with `bun test` coverage; the bash code is
43
+ frozen and only patched for parity.
44
+ - The final phase (deleting `run.sh` and `autonomy/loki`, removing the legacy
45
+ flag) is deliberately gated behind a multi-week clean soak with zero parity
46
+ regressions, rather than shipped on a date.
47
+ - Carrying two implementations is real maintenance overhead until sunset, traded
48
+ for a safe, reversible rollout.
49
+
50
+ ---
51
+
52
+ ## ADR-002: Provider-agnostic execution with automatic failover
53
+
54
+ **Status:** Accepted
55
+
56
+ ### Context
57
+
58
+ Tying the system to a single AI vendor would be a hard dependency and a single
59
+ point of failure. Users run different coding agents (Claude Code, OpenAI Codex
60
+ CLI, Cline, Aider) with different capabilities, and the product positioning
61
+ ("no vendor lock-in") requires running on more than one.
62
+
63
+ ### Decision
64
+
65
+ Abstract provider invocation behind shell-sourceable provider configs
66
+ (`providers/*.sh`) and a TypeScript provider layer
67
+ (`loki-ts/src/runner/providers.ts`), classified by capability tier:
68
+
69
+ - **Claude Code (Tier 1):** full features (subagents, parallelism, Task tool, MCP).
70
+ - **Cline (Tier 2):** reduced parallelism.
71
+ - **OpenAI Codex CLI and Aider (Tier 3):** degraded mode (sequential, no Task tool).
72
+
73
+ The orchestrator adapts its strategy to the active provider's tier and fails over
74
+ automatically. Google Gemini CLI was deprecated (v7.5.18) after upstream
75
+ deprecation; selecting it exits with a migration message.
76
+
77
+ ### Consequences
78
+
79
+ - Features must degrade gracefully: anything Tier 1 specific cannot be assumed
80
+ available, so the loop checks capability before using it.
81
+ - Adding a provider means adding a config plus tier mapping, not rewriting the loop.
82
+ - The capability matrix is a permanent part of the design and must be kept honest;
83
+ a provider listed at a tier it cannot meet would break runs silently.
84
+
85
+ ---
86
+
87
+ ## ADR-003: Verified completion via the RARV-C closure loop and an Evidence Receipt
88
+
89
+ **Status:** Accepted
90
+
91
+ ### Context
92
+
93
+ Most coding agents declare a task "done" by narrating it in a transcript, which
94
+ is unverifiable. The product's core differentiator is trust: "done" must mean
95
+ proven, not promised. An agent that lies about completion (empty diffs, failing
96
+ tests reported green) destroys user confidence and word-of-mouth.
97
+
98
+ ### Decision
99
+
100
+ Every iteration runs the RARV-C cycle (Reason, Act, Reflect, Verify, Close).
101
+ Completion is decided by deterministic, re-derivable facts rather than the
102
+ agent's own claim:
103
+
104
+ - An empty git diff against the run-start commit cannot be reported as done.
105
+ - Red tests block completion.
106
+ - Each build produces an **Evidence Receipt** separating **Facts** (diff SHAs,
107
+ file counts, test command and exit code, build command and exit code, gate
108
+ verdicts) from **Assessments** (AI judgments such as the review council).
109
+ - The receipt headline (VERIFIED / VERIFIED WITH GAPS / NOT VERIFIED) is computed
110
+ only from the facts; gaps are always listed by name so silence never reads as a
111
+ pass.
112
+
113
+ ### Consequences
114
+
115
+ - Completion logic must stay deterministic and independently re-checkable; LLM
116
+ judgment can inform but never make the headline green on its own.
117
+ - `loki verify` exposes the same gates as a standalone, CI-ready check with
118
+ machine-readable evidence and meaningful exit codes.
119
+ - The system will sometimes refuse to call work "done" that a user feels is done;
120
+ this friction is intentional and is the product's main promise.
121
+
122
+ ---
123
+
124
+ ## ADR-004: Quality enforced by 8 gates and a blind multi-reviewer council
125
+
126
+ **Status:** Accepted
127
+
128
+ ### Context
129
+
130
+ Autonomous code generation without enforcement produces plausible-looking but
131
+ incorrect output. A single reviewer (human or model) is prone to sycophancy and
132
+ blind spots. Quality has to be enforced mechanically and from independent angles,
133
+ not trusted.
134
+
135
+ ### Decision
136
+
137
+ Run 8 quality gates (static analysis, test pass/fail, blind 3-reviewer code
138
+ review with severity blocking, anti-sycophancy / devil's advocate, mock-integrity
139
+ detection, test-mutation detection, documentation coverage, magic-modules debate)
140
+ plus a conditional legacy-healing auditor. Code review uses three independent
141
+ reviewers whose verdicts must reconcile; Critical/High findings block, Medium/Low
142
+ are advisory. An override council can revisit a BLOCK only when backed by a
143
+ non-empty evidence artifact.
144
+
145
+ ### Consequences
146
+
147
+ - A red gate stops the release; "2-of-3 is good enough" is explicitly not
148
+ acceptable for the council, which loops until unanimous.
149
+ - Gates add latency and token cost to every iteration, accepted as the price of
150
+ trustworthy output.
151
+ - Each gate's blocking semantics must be precise; an over-eager gate that fires on
152
+ unrelated changes (as the legacy-healing auditor once did) erodes signal and was
153
+ scoped to fire only on healing-mode work.
154
+
155
+ ---
156
+
157
+ ## ADR-005: File-based memory in `.loki/` as the system's source of truth
158
+
159
+ **Status:** Accepted
160
+
161
+ ### Context
162
+
163
+ The orchestrator, dashboard, MCP server, and quality gates are separate processes
164
+ (and separate runtimes: bash, TypeScript, Python). They need shared, durable state
165
+ that survives crashes and resumes, without forcing an external database as a
166
+ prerequisite for a local-first tool.
167
+
168
+ ### Decision
169
+
170
+ All components communicate through filesystem state under `.loki/` (memory,
171
+ session, queue, checkpoints, findings, healing artifacts). Memory is a layered
172
+ Python package (`memory/`) with episodic, semantic, and procedural stores,
173
+ progressive-disclosure loading, optional vector search, and cross-project recall.
174
+ A unified event bus (`events/`) provides Python, TypeScript, and bash emitters
175
+ over the same conventions.
176
+
177
+ ### Consequences
178
+
179
+ - Any process can read or resume from disk; runs survive restarts and pod loss.
180
+ - Concurrent writers must coordinate via file locking; lost-update and inode races
181
+ here have been recurring, high-severity bug classes that demand careful locking
182
+ and tests.
183
+ - No database is required to run locally, preserving the self-hosted, private,
184
+ zero-egress posture; external stores (e.g. ChromaDB, object storage) are optional
185
+ add-ons, not dependencies.
186
+
187
+ ---
188
+
189
+ ## ADR-006: Polyglot stack (Bun/TypeScript, Python, bash) over a single language
190
+
191
+ **Status:** Accepted
192
+
193
+ ### Context
194
+
195
+ The system spans distinct concerns: orchestration control flow, a web dashboard
196
+ API, a memory engine with embeddings, an MCP server, and provider shims. No single
197
+ language is the best fit for all of them, and parts predate the Bun migration.
198
+
199
+ ### Decision
200
+
201
+ Use the right tool per concern: Bun/TypeScript for the orchestrator, CLI, and HTTP
202
+ API (`loki-ts/`, `api/`); Python for the memory engine, MCP server, and FastAPI
203
+ dashboard (`memory/`, `mcp/`, `dashboard/`); bash for provider configs, hooks, and
204
+ the legacy runtime during migration. Node.js 20+ is the minimum engine; the npm
205
+ package ships zero runtime dependencies in `package.json`.
206
+
207
+ ### Consequences
208
+
209
+ - Contributors need familiarity with more than one ecosystem, and CI must run a
210
+ matrix across runtimes (bun typecheck/test, Python syntax, shellcheck, parity).
211
+ - Cross-language contracts (the `.loki/` state files, the event bus) must be kept
212
+ in sync across three emitter implementations.
213
+ - Boundaries stay clean because each component owns its language; the cost is more
214
+ build and test tooling, mitigated by the local CI gate.
215
+
216
+ ---
217
+
218
+ ## ADR-007: Distribute across npm, Docker, and Homebrew from a single release pipeline
219
+
220
+ **Status:** Accepted
221
+
222
+ ### Context
223
+
224
+ Users install via different channels (npm global, Docker, Homebrew), and the
225
+ dashboard frontend and Python modules must be present and working in each. Past
226
+ releases shipped broken because local testing did not verify the published
227
+ tarball or a fresh global install.
228
+
229
+ ### Decision
230
+
231
+ A single GitHub Actions release workflow creates the tag and GitHub Release, then
232
+ publishes to npm, builds and pushes a multi-arch (amd64 + arm64) Docker image, and
233
+ updates the Homebrew tap. Every release is preceded by a mandatory local CI gate
234
+ (`scripts/local-ci.sh`) that mirrors every CI workflow, plus pre-publish
235
+ validation that inspects the npm tarball contents and performs a fresh global
236
+ install smoke test. Versions are kept in sync across all manifests and Dockerfiles.
237
+
238
+ ### Consequences
239
+
240
+ - The local Mac is the canonical pre-push gate; GitHub Actions is the verifier, not
241
+ the place defects are discovered.
242
+ - The dashboard frontend must be rebuilt and committed before release, and the
243
+ built artifacts must be tracked in git so every channel includes them.
244
+ - A single broken artifact can affect all channels at once, so the validation
245
+ checklist is non-negotiable per release.
246
+
247
+ ---
248
+
249
+ ## ADR-008: Source-available under BUSL-1.1 with a separate commercial brand
250
+
251
+ **Status:** Accepted
252
+
253
+ ### Context
254
+
255
+ The project needs broad adoption and community trust (which favors open source)
256
+ while leaving room for a sustainable commercial business and protection against
257
+ hosted-competitor free-riding.
258
+
259
+ ### Decision
260
+
261
+ License the source under the Business Source License 1.1: free for personal,
262
+ internal, and academic use, source-available, with commercial hosted/team
263
+ editions sold under the separate **Autonomi** brand (Autonomi Cloud, Autonomi
264
+ Enterprise). The same Loki CLI, SDK, and MCP are available to everyone.
265
+
266
+ ### Consequences
267
+
268
+ - BUSL-1.1 is not OSI-approved "open source"; the project consistently uses the
269
+ term "source-available" to avoid misleading users.
270
+ - Contributions require a CLA (`CLA.md`), adding friction for contributors in
271
+ exchange for a clear commercial path.
272
+ - The open core and commercial editions must stay aligned on the core surface so
273
+ the free tier remains genuinely useful, not a crippled demo.
274
+
275
+ ---
276
+
277
+ ## ADR-009: Model selection tiered by task, with deterministic auto-selection
278
+
279
+ **Status:** Accepted
280
+
281
+ ### Context
282
+
283
+ Using the most capable (and expensive) model for every task wastes budget; using
284
+ a weak model for architecture produces poor results. Forcing the user to choose a
285
+ model per task is friction and contradicts the autonomy goal.
286
+
287
+ ### Decision
288
+
289
+ Map task type to model tier: Opus for planning and architecture, Sonnet for
290
+ development and functional testing, Haiku for unit tests, monitoring, and simple
291
+ parallelizable work. The tier is auto-selected from task signals
292
+ (`run.sh:get_rarv_tier()`, `detect_complexity()`) rather than asked of the user;
293
+ model levers (session pin, mid-flight override, ceiling) exist as opt-out escape
294
+ hatches, and the cost quote, dashboard, and dispatched model always agree.
295
+
296
+ ### Consequences
297
+
298
+ - Cost scales with task difficulty automatically, and parallel cheap-model work is
299
+ encouraged for throughput.
300
+ - Selection must be deterministic and honest: the quoted plan cost and the actual
301
+ dispatch must never diverge, including ceiling-enforcement and tier-collapse
302
+ paths (e.g. an unavailable Fable tier collapsing to Opus).
303
+ - Adding or retiring a model means updating the registry and the auto-select
304
+ heuristic together, or quotes drift from reality.
305
+
306
+ ---
307
+
308
+ ## ADR-010: Progressive-disclosure skill architecture for the agent context
309
+
310
+ **Status:** Accepted
311
+
312
+ ### Context
313
+
314
+ Loading the full body of operational guidance (quality gates, healing, testing,
315
+ agent types, provider docs, advanced patterns) into every agent invocation would
316
+ waste context budget and dilute the signal. But the guidance still needs to be
317
+ available on demand.
318
+
319
+ ### Decision
320
+
321
+ Keep `SKILL.md` slim (a few hundred lines) and split detailed guidance into
322
+ on-demand modules under `skills/`, with an index (`skills/00-index.md`) that routes
323
+ to the right module, and deeper reference material under `references/`. Modules are
324
+ pulled in only when relevant to the current task.
325
+
326
+ ### Consequences
327
+
328
+ - Context stays focused and cheaper per iteration; agents read only what the task
329
+ needs.
330
+ - The routing index and module boundaries must be maintained, or guidance becomes
331
+ hard to find and modules drift out of sync with the code they describe.
332
+ - `SKILL.md` has a hard size budget; detailed content belongs in modules, not
333
+ inlined, which is enforced as a contribution rule.