loki-mode 11.3.0 → 11.3.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 (242) hide show
  1. package/README.md +68 -650
  2. package/SKILL.md +5 -5
  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/efficiency_cost.py +8 -0
  10. package/autonomy/lib/engine10-push.sh +22 -8
  11. package/autonomy/lib/prd-enrich.sh +1 -1
  12. package/autonomy/lib/voter-agents.sh +1 -1
  13. package/autonomy/loki +161 -105
  14. package/autonomy/run.sh +30 -18
  15. package/autonomy/sandbox.sh +1 -1
  16. package/autonomy/tui.sh +6 -5
  17. package/autonomy/verify.sh +1 -1
  18. package/bin/loki +195 -59
  19. package/completions/_loki +8 -0
  20. package/completions/loki.bash +3 -3
  21. package/dashboard/__init__.py +1 -1
  22. package/dashboard/server.py +47 -45
  23. package/docs/AGENT-CHANGE-RECEIPT.md +2 -2
  24. package/docs/ARCHITECTURE.md +337 -0
  25. package/docs/BRANDING.md +124 -0
  26. package/docs/CLI-REFERENCE.md +11 -1
  27. package/docs/COMPONENTS.md +447 -0
  28. package/docs/DEPLOYMENT.md +9 -9
  29. package/docs/DOCKER.md +469 -0
  30. package/docs/INSTALLATION.md +67 -1045
  31. package/docs/KNOWN-ISSUES.md +11 -35
  32. package/docs/OTEL-COLLECTOR.md +24 -0
  33. package/docs/ROUTING-EVIDENCE.md +32 -0
  34. package/docs/TESTING.md +161 -0
  35. package/docs/air-gapped.md +1 -2
  36. package/docs/alternative-installations.md +14 -24
  37. package/docs/architecture/DECISIONS.md +333 -0
  38. package/docs/audit-logging.md +7 -7
  39. package/docs/authentication.md +3 -3
  40. package/docs/authorization.md +1 -1
  41. package/docs/certification/04-production-deployment/lab.md +6 -6
  42. package/docs/certification/04-production-deployment/lesson.md +4 -4
  43. package/docs/certification/README.md +1 -1
  44. package/docs/control-plane-container.md +2 -2
  45. package/docs/dev/real-run.md +34 -0
  46. package/docs/dev/release-checklist.md +2 -2
  47. package/docs/environment-variables.md +1 -0
  48. package/docs/exit-codes.md +3 -3
  49. package/docs/git-workflow.md +3 -3
  50. package/docs/metrics.md +37 -55
  51. package/docs/network-security.md +1 -1
  52. package/docs/siem-integration.md +5 -5
  53. package/docs/spec-first-intent.md +28 -0
  54. package/docs/v10/CLI-MODERN.md +7 -3
  55. package/docs/v10/DECISIONS.md +59 -0
  56. package/docs/v10/DEPS.md +22 -22
  57. package/docs/v10/ENGINE.md +1 -1
  58. package/docs/v10/FAILURE-CLASSES.md +212 -1
  59. package/docs/v10/FOUNDER-QUEUE.md +1 -0
  60. package/docs/v10/GUARDS.md +31 -0
  61. package/docs/v10/GUIDE.md +7 -5
  62. package/docs/v10/LEGACY-REMOVAL.md +4 -6
  63. package/docs/v10/METRICS.md +14 -2
  64. package/docs/v10/MODERNIZE.md +1 -1
  65. package/docs/v10/OPERATING-MODEL.md +4 -3
  66. package/docs/v10/PROGRESS.md +35 -0
  67. package/docs/v11/COST-HALF.md +352 -0
  68. package/docs/v11/INTOTO-AGENT-CHANGE-PREDICATE.md +77 -0
  69. package/docs/v11/MARKET-SLICES.md +315 -0
  70. package/docs/v11/MCP-2026-07-28.md +55 -0
  71. package/docs/v11/REGISTRIES.md +730 -0
  72. package/docs/v11/VERIFY-PR-SANDBOX.md +41 -0
  73. package/loki-ts/data/model-pricing.json +52 -24
  74. package/loki-ts/dist/loki.js +1185 -945
  75. package/mcp/__init__.py +1 -1
  76. package/mcp/v10_tools.py +29 -0
  77. package/package.json +9 -11
  78. package/packages/control-plane/dist/ask-tools-server.js +8 -2
  79. package/packages/control-plane/dist/server.js +15832 -12361
  80. package/packages/control-plane/drizzle/0006_token_sessions.sql +1 -0
  81. package/packages/control-plane/drizzle/meta/0006_snapshot.json +807 -0
  82. package/packages/control-plane/drizzle/meta/_journal.json +7 -0
  83. package/packages/control-plane/src/db/schema.ts +1 -0
  84. package/packages/control-plane/src/server/routes/cost.ts +4 -3
  85. package/packages/control-plane/src/server/runs.ts +3 -3
  86. package/packages/control-plane/ui/dist/assets/index-DbLzr87u.js +190 -0
  87. package/packages/control-plane/ui/dist/index.html +1 -1
  88. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  89. package/providers/opencode.sh +2 -3
  90. package/src/observability/genai-spans.js +104 -0
  91. package/src/observability/otel-bridge.js +49 -1
  92. package/src/observability/otel.js +2 -2
  93. package/src/protocols/mcp-client.js +6 -2
  94. package/src/protocols/mcp-server.js +191 -6
  95. package/src/protocols/transport/sse.js +23 -2
  96. package/tools/audit-docs.py +1 -1
  97. package/web-app/dist/assets/{AdminPage-D_e45uTw.js → AdminPage-DuRQZsF9.js} +1 -1
  98. package/web-app/dist/assets/{Avatar-T3nIpoaf.js → Avatar-7GtOQvsO.js} +1 -1
  99. package/web-app/dist/assets/{Badge-BKqb59pP.js → Badge-CYgTnIxj.js} +1 -1
  100. package/web-app/dist/assets/{Button-DjVlkh8_.js → Button-rYSyIu7X.js} +1 -1
  101. package/web-app/dist/assets/{CockpitPage-DXJgLGmh.js → CockpitPage-9adANY4o.js} +1 -1
  102. package/web-app/dist/assets/{ComparePage-BRP_eVc_.js → ComparePage-DEG2oA-R.js} +1 -1
  103. package/web-app/dist/assets/{ErrorBoundary-CLjpGLjC.js → ErrorBoundary-CwtvY4xs.js} +1 -1
  104. package/web-app/dist/assets/{EvidenceReceiptPanel-DX-vb4Xy.js → EvidenceReceiptPanel-DTT73pPB.js} +1 -1
  105. package/web-app/dist/assets/{GitHubIssuesPanel-214HVHtX.js → GitHubIssuesPanel-CpWZLz2x.js} +1 -1
  106. package/web-app/dist/assets/{GitHubPRsPanel-BEiZKc4t.js → GitHubPRsPanel-H293R7E2.js} +1 -1
  107. package/web-app/dist/assets/{HomePage-VvMHS5ga.js → HomePage-B11Imp9k.js} +2 -2
  108. package/web-app/dist/assets/{LoginPage-5WD-v7n3.js → LoginPage-BZBgx5Jr.js} +1 -1
  109. package/web-app/dist/assets/{MagicPage-DUQT_Jye.js → MagicPage-B27S4_X8.js} +1 -1
  110. package/web-app/dist/assets/{MetricsPage-lga-z79v.js → MetricsPage-CfbJWNDG.js} +1 -1
  111. package/web-app/dist/assets/{NotFoundPage-CGhBX3G1.js → NotFoundPage-Tp_4zMSm.js} +1 -1
  112. package/web-app/dist/assets/{ProjectPage-CdzF2GzZ.js → ProjectPage-CM4fgMsV.js} +3 -3
  113. package/web-app/dist/assets/{ProjectsPage-DRG64N8s.js → ProjectsPage-DP2Fvsrd.js} +1 -1
  114. package/web-app/dist/assets/{SettingsPage-5fzW9Frb.js → SettingsPage-C4G9-EAy.js} +1 -1
  115. package/web-app/dist/assets/{ShowcasePage-DrTdxO4y.js → ShowcasePage-Dj-n4dwu.js} +1 -1
  116. package/web-app/dist/assets/{SystemSettingsPage-C9Mqs6Rd.js → SystemSettingsPage-BqMLpuGt.js} +1 -1
  117. package/web-app/dist/assets/{TeamsPage-CUGPdSWo.js → TeamsPage-mIH8H96m.js} +1 -1
  118. package/web-app/dist/assets/{TemplatesPage-CNraDY0F.js → TemplatesPage-BagW-v4n.js} +1 -1
  119. package/web-app/dist/assets/{TerminalOutput-BIu_6Pea.js → TerminalOutput-CTQRHhnK.js} +1 -1
  120. package/web-app/dist/assets/{activity-Bk-kgqaf.js → activity-DNQiBDDL.js} +1 -1
  121. package/web-app/dist/assets/{bell-BXmUdmo8.js → bell-Coiwdad1.js} +1 -1
  122. package/web-app/dist/assets/{bot-CiuzXxUR.js → bot-Cou-rTgR.js} +1 -1
  123. package/web-app/dist/assets/{check-BEzjXppd.js → check-CsF-XtQp.js} +1 -1
  124. package/web-app/dist/assets/{chevron-left-AYWCXHf8.js → chevron-left-BJiy55Ht.js} +1 -1
  125. package/web-app/dist/assets/{circle-alert-BNg2uSRq.js → circle-alert-D6-pQQWq.js} +1 -1
  126. package/web-app/dist/assets/{clock-DTj0kkGT.js → clock-BOGqwgt9.js} +1 -1
  127. package/web-app/dist/assets/{cloud-x4nTDBLT.js → cloud-DsxhTtf5.js} +1 -1
  128. package/web-app/dist/assets/{code-xml-BVh_MLrk.js → code-xml-CxJDHUlE.js} +1 -1
  129. package/web-app/dist/assets/{database-DdfBaowG.js → database-BJePscl_.js} +1 -1
  130. package/web-app/dist/assets/{dollar-sign-XuYFmAOY.js → dollar-sign-6qWGAkZo.js} +1 -1
  131. package/web-app/dist/assets/{file-code-corner-D4cRnmeL.js → file-code-corner-DcOtYeDb.js} +1 -1
  132. package/web-app/dist/assets/{file-plus-CyoVlHc_.js → file-plus-WuRyLFo0.js} +1 -1
  133. package/web-app/dist/assets/{globe-Y6IK2RPW.js → globe-r-xCP4DE.js} +1 -1
  134. package/web-app/dist/assets/{hammer-BKzr9VZI.js → hammer-DTt0SsCB.js} +1 -1
  135. package/web-app/dist/assets/{index-B20cSx5G.js → index-BkbXyH8y.js} +3 -3
  136. package/web-app/dist/assets/{layers-DebNOhGS.js → layers-BvZhvSMY.js} +1 -1
  137. package/web-app/dist/assets/{loader-circle-DyGbrEgd.js → loader-circle-3gosTei9.js} +1 -1
  138. package/web-app/dist/assets/{lock-BKPpyt20.js → lock-CZZMxP0U.js} +1 -1
  139. package/web-app/dist/assets/{package-egF5Wi4y.js → package-C5A8CkJr.js} +1 -1
  140. package/web-app/dist/assets/{plus-OiEgKIc-.js → plus-Btv7tTIF.js} +1 -1
  141. package/web-app/dist/assets/{refresh-cw-CzKvrONq.js → refresh-cw-DsWLXgs_.js} +1 -1
  142. package/web-app/dist/assets/{rotate-ccw-Bu2mII0p.js → rotate-ccw-DOVDjway.js} +1 -1
  143. package/web-app/dist/assets/{scroll-text-CSkiyax8.js → scroll-text-smySzlrX.js} +1 -1
  144. package/web-app/dist/assets/{server-DlPthJFw.js → server-b5PHsqAU.js} +1 -1
  145. package/web-app/dist/assets/{shield-alert-CbpHWQQX.js → shield-alert-BD7FDlh-.js} +1 -1
  146. package/web-app/dist/assets/{thumbs-up-DgGpZe-Q.js → thumbs-up-CAsFzbyE.js} +1 -1
  147. package/web-app/dist/assets/{trash-2-BV3GlCB-.js → trash-2-BJ35qHgl.js} +1 -1
  148. package/web-app/dist/assets/{trending-down-Y4TJtXhD.js → trending-down-Ozrd26cZ.js} +1 -1
  149. package/web-app/dist/assets/{trending-up-DsDNoHZY.js → trending-up-BhnMcM32.js} +1 -1
  150. package/web-app/dist/assets/{upload-gkThrc_I.js → upload-JVHfdwoA.js} +1 -1
  151. package/web-app/dist/assets/{usePolling-jpNSeNAe.js → usePolling-CTzbDV-e.js} +1 -1
  152. package/web-app/dist/assets/{user-3Zez1WOK.js → user-Bks3-GYv.js} +1 -1
  153. package/web-app/dist/index.html +1 -1
  154. package/docs/ARCHITECTURE-OVERVIEW.md +0 -209
  155. package/docs/AUTONOMI-ECOSYSTEM.md +0 -107
  156. package/docs/COCKPIT-SPEC.md +0 -72
  157. package/docs/COCKPIT-UX-MANDATE.md +0 -53
  158. package/docs/COMPETITIVE-ANALYSIS.md +0 -303
  159. package/docs/COMPETITIVE-NEXT-10.md +0 -316
  160. package/docs/COMPETITIVE-RALPH-ZEROSHOT-2026-07-08.md +0 -81
  161. package/docs/DASHBOARD-9.12-EVIDENCE.md +0 -97
  162. package/docs/DASHBOARD-ARCHITECTURE.md +0 -425
  163. package/docs/DASHBOARD_V2_CHECKLIST.md +0 -243
  164. package/docs/DEMOS.md +0 -63
  165. package/docs/ENTERPRISE-IDENTITY-ROADMAP.md +0 -206
  166. package/docs/EVIDENCE-RECEIPT-BUILD-APPLICABILITY.md +0 -79
  167. package/docs/FEAT-PRDREUSE-DOCKER-PLAN.md +0 -144
  168. package/docs/GATE-FAILURE-TRIAGE.md +0 -254
  169. package/docs/HANDOFF-2026-08-03.md +0 -439
  170. package/docs/LOOP-CANDIDATE-PROPOSAL-v1.md +0 -167
  171. package/docs/LOOP-HARNESS-AUDIT.md +0 -684
  172. package/docs/MERGE-DEDUP-MAP.md +0 -420
  173. package/docs/MERGE-ROUTE-MAP.md +0 -139
  174. package/docs/MODEL-REGISTRY-PLAN.md +0 -155
  175. package/docs/OUTCOME-FRONTIER.md +0 -536
  176. package/docs/P2-SPEC-ROBUSTNESS-PLAN.md +0 -192
  177. package/docs/PLANS-INDEX.md +0 -32
  178. package/docs/PRD-REUSE-DONE-RECOGNITION-PLAN.md +0 -536
  179. package/docs/PROMPT-ABLATION-RESULT.md +0 -97
  180. package/docs/R4-TRUST-TRAJECTORY-DESIGN.md +0 -127
  181. package/docs/R5-AUTO-WIKI-DESIGN.md +0 -137
  182. package/docs/R6-ROLLBACK-CHECKPOINT-PLAN.md +0 -107
  183. package/docs/R7-ZERO-CONFIG-FIRST-RUN-PLAN.md +0 -137
  184. package/docs/R8-SHAREABLE-TEAM-ASSETS-PLAN.md +0 -129
  185. package/docs/R9-OPEN-CORE-HOOKS-PLAN.md +0 -113
  186. package/docs/RARV-C-100X-PLAN.md +0 -286
  187. package/docs/RARV-C-LOOP-EFFICIENCY-PLAN.md +0 -470
  188. package/docs/SHAREABLE-PROOF-PLAN.md +0 -194
  189. package/docs/SONNET5-DEFAULT-PLAN.md +0 -157
  190. package/docs/SPEED-AND-FIRST-PASS-PLAN.md +0 -281
  191. package/docs/STALE-STATE-AUDIT.md +0 -174
  192. package/docs/SYNERGY-TASKS.md +0 -143
  193. package/docs/TASKLIST-ACCURACY-PLAN.md +0 -355
  194. package/docs/TOP-100-BACKLOG.md +0 -159
  195. package/docs/V8-ACCEPTANCE-TRIAGE-2026-07-24.md +0 -114
  196. package/docs/V8-COMPLEXITY-AUDIT-2026-07-24.md +0 -45
  197. package/docs/V8-MAJOR-RELEASE-PLAN.md +0 -137
  198. package/docs/V8-OVERNIGHT-PLAN-2026-07-25.md +0 -82
  199. package/docs/V8-SDK-RESEARCH-RAW.md +0 -129
  200. package/docs/WELCOME-OPENER-PLAN.md +0 -106
  201. package/docs/adoption-baseline-2026-07-31.md +0 -84
  202. package/docs/architecture/bmad-integration-epic.md +0 -271
  203. package/docs/architecture/bmad-integration-review.md +0 -86
  204. package/docs/architecture/bmad-integration-validation.md +0 -249
  205. package/docs/architecture/bmad-loki-voice-agent-council-analysis.md +0 -61
  206. package/docs/auto-claude-comparison.md +0 -250
  207. package/docs/bug-fixes/agent-01-cli-fixes.md +0 -101
  208. package/docs/bug-fixes/agent-02-purplelab-fixes.md +0 -88
  209. package/docs/bug-fixes/agent-03-dashboard-fixes.md +0 -119
  210. package/docs/bug-fixes/agent-04-memory-fixes.md +0 -105
  211. package/docs/bug-fixes/agent-05-provider-fixes.md +0 -86
  212. package/docs/bug-fixes/agent-06-integration-fixes.md +0 -101
  213. package/docs/bug-fixes/agent-07-dash-run-fixes.md +0 -101
  214. package/docs/bug-fixes/agent-08-docker-fixes.md +0 -164
  215. package/docs/bug-fixes/agent-09-e2e-build-fixes.md +0 -69
  216. package/docs/bug-fixes/agent-10-e2e-fullstack-fixes.md +0 -102
  217. package/docs/bug-fixes/agent-11-e2e-session-fixes.md +0 -70
  218. package/docs/bug-fixes/agent-12-scenario-fixes.md +0 -120
  219. package/docs/bug-fixes/agent-13-enterprise-fixes.md +0 -143
  220. package/docs/bug-fixes/agent-14-uat-newuser-fixes.md +0 -88
  221. package/docs/bug-fixes/agent-15-uat-poweruser-fixes.md +0 -132
  222. package/docs/bug-fixes/agent-19-code-review.md +0 -316
  223. package/docs/bug-fixes/agent-20-architecture-review.md +0 -331
  224. package/docs/competitive/bolt-new-analysis.md +0 -579
  225. package/docs/competitive/emergence-others-analysis.md +0 -605
  226. package/docs/competitive/replit-lovable-analysis.md +0 -622
  227. package/docs/dashboard-guide.md +0 -487
  228. package/docs/enterprise/migration.md +0 -265
  229. package/docs/history/one-run-audit.md +0 -304
  230. package/docs/plans/FORGE-AUTONOMOUS-QUEUE.md +0 -312
  231. package/docs/plans/ULTRAPLAN-FORGE-BAAS.md +0 -612
  232. package/docs/plans/UT2-6-LSP-DIAGNOSTIC-BROADCAST.md +0 -394
  233. package/docs/prd-purple-lab-ide.md +0 -152
  234. package/docs/prd-purple-lab-platform-v2.md +0 -223
  235. package/docs/prd-purple-lab-platform.md +0 -319
  236. package/docs/retrospectives/v7.5.15-fleet-postmortem.md +0 -325
  237. package/docs/retrospectives/v7.5.15-honesty-audit.md +0 -136
  238. package/docs/retrospectives/v7.5.15-llm-failure-modes.md +0 -49
  239. package/docs/show-hn-post.md +0 -46
  240. package/docs/test-scenarios/enterprise-scenarios.md +0 -732
  241. package/docs/thick2thin.md +0 -173
  242. package/packages/control-plane/ui/dist/assets/index-DcBJXjCJ.js +0 -190
@@ -1,6 +1,6 @@
1
1
  # CLI reference
2
2
 
3
- Generated from `loki-ts/src/cli/registry.ts` by `scripts/generate-stale-zero.sh` for v11.3.0. Do not edit by hand.
3
+ Generated from `loki-ts/src/cli/registry.ts` by `scripts/generate-stale-zero.sh` for v11.3.2. Do not edit by hand.
4
4
  Hidden and legacy-only commands are omitted; see `docs/v10/CLI-MODERN.md` for the full inventory.
5
5
 
6
6
  | Command | Description |
@@ -15,6 +15,8 @@ Hidden and legacy-only commands are omitted; see `docs/v10/CLI-MODERN.md` for th
15
15
  | `loki memory` | Cross-project learnings |
16
16
  | `loki memory list` | All learnings |
17
17
  | `loki memory index` | Show or rebuild the memory index |
18
+ | `loki memory learn` | Learn lessons from a merged PR's review comments |
19
+ | `loki memory lessons` | List PR review lessons with uses and outcomes |
18
20
  | `loki memory show` | Show one learning |
19
21
  | `loki memory search` | Search learnings |
20
22
  | `loki memory stats` | Memory statistics |
@@ -55,6 +57,14 @@ Hidden and legacy-only commands are omitted; see `docs/v10/CLI-MODERN.md` for th
55
57
  | `loki start` | Run the autonomous build |
56
58
  | `loki slack` | Slack inbound handler |
57
59
  | `loki slack serve` | Serve the Slack handler |
60
+ | `loki queue` | Overnight issue queue with a morning digest |
61
+ | `loki queue add` | Queue issue refs |
62
+ | `loki queue list` | Show the queue |
63
+ | `loki queue run` | Process the queue |
64
+ | `loki issues` | Run every open issue in a repo and open PRs |
65
+ | `loki issues run` | Triage and run open issues; split too-large ones into stacked PRs |
66
+ | `loki undo` | Plan or apply an undo of a run |
67
+ | `loki verify-pr` | Verify a PR against its linked issue in a sandbox |
58
68
  | `loki answer` | Resume a BLOCKED run with an answer |
59
69
  | `loki engine10` | v10 engine router |
60
70
  | `loki engine10 run` | Run the v10 engine |
@@ -0,0 +1,447 @@
1
+ # Loki Mode Components
2
+
3
+ This document maps the major components of the loki-mode codebase: each one's
4
+ purpose, key files, public interface, and dependencies on other components.
5
+
6
+ Loki Mode is an autonomous spec-to-product system. It takes a spec (PRD, GitHub
7
+ issue, OpenAPI/JSON/YAML, or one-line brief) to a deployed product through the
8
+ RARV-C closure loop (Reason - Act - Reflect - Verify - Close) with 8 quality
9
+ gates. It is provider-agnostic (Claude Code, OpenAI Codex CLI, Cline, Aider).
10
+
11
+ ## Component Map
12
+
13
+ | Component | Language | Role |
14
+ |---|---|---|
15
+ | `autonomy/` | Bash + Python | CLI and orchestration engine (RARV loop) |
16
+ | `loki-ts/` | TypeScript (Bun) | Modern runner: CLI, runner, council, providers, metrics |
17
+ | `memory/` | Python | Episodic/semantic/procedural memory with vector search |
18
+ | `providers/` | Bash + Python | Multi-provider config and model registry |
19
+ | `dashboard/` | Python (FastAPI) | Web dashboard API and control plane |
20
+ | `packages/control-plane/` | TypeScript | Control Plane (browser UI and service) |
21
+ | `web-app/` | Python + JS | Purple Lab web app (deprecated v7.44.0) |
22
+ | `mcp/` | Python | MCP server (tools, resources, prompts) |
23
+ | `api/` | TypeScript (Deno) | REST API surface and services |
24
+ | `events/` | Python + TS + Bash | Unified event bus |
25
+ | `agents/` | Python + JSON | Agent type registry and hub install |
26
+ | `skills/` | Markdown | On-demand skill modules (progressive disclosure) |
27
+ | `references/` | Markdown | Detailed documentation |
28
+ | `templates/` | Markdown | PRD templates per project archetype |
29
+ | `benchmarks/` | Bash + Python | SWE-bench and HumanEval benchmark harness |
30
+ | `plugins/` | JSON + Markdown | Claude Code plugin packaging |
31
+
32
+ ---
33
+
34
+ ## autonomy/
35
+
36
+ The CLI and orchestration engine. This is the heart of the bash route: the
37
+ RARV loop, completion detection, code review, healing, and all runtime state
38
+ management.
39
+
40
+ **Purpose:** Drive autonomous execution from spec to verified completion.
41
+
42
+ **Key files:**
43
+ - `loki` - Main CLI (~23K lines, 100+ `cmd_` functions, dispatch in `main()`).
44
+ - `run.sh` - Orchestration engine (~12K lines). Hosts the RARV iteration loop
45
+ (`run_autonomous()`), prompt construction (`build_prompt()`), state
46
+ persistence (`save_state()`), code review (`run_code_review()`), checkpoints,
47
+ and budget/rate-limit circuit breakers.
48
+ - `completion-council.sh` - Completion detection via council voting
49
+ (`council_should_stop()`).
50
+ - `council-v2.sh` - Reviewer council pipeline.
51
+ - `app-runner.sh` - Manages the generated app's run/healthcheck lifecycle.
52
+ - `checklist-verify.py`, `prd-checklist.sh`, `prd-analyzer.py` - PRD parsing
53
+ and checklist verification.
54
+ - `context-tracker.py`, `notification-checker.py` - Context window tracking and
55
+ notification triggers.
56
+ - `crash.sh`, `grill.sh`, `docker-run.sh`, `playwright-verify.sh` - Crash
57
+ capture, spec interrogation, containerized runs, and smoke testing.
58
+ - `hooks/` - Lifecycle hooks: `migration-hooks.sh` (healing safety gates),
59
+ `quality-gate.sh`, `session-init.sh`, `store-episode.sh`, `track-metrics.sh`,
60
+ `validate-bash.sh`.
61
+ - `lib/` - Helper library: proof/evidence generation (`proof-generator.py`,
62
+ `proof-verify.py`, `proof-pr.sh`, `proof_redact.py`), crash redaction
63
+ (`crash_capture.py`, `crash_redact.py`), claude flags, MCP config, locks,
64
+ launch kit, project graph, PRD enrichment.
65
+ - `issue-parser.sh`, `issue-providers.sh` - GitHub issue import.
66
+ - `CONSTITUTION.md` - Behavioral constitution for the autonomous agent.
67
+
68
+ **Public interface:**
69
+ - CLI commands: `loki start`, `loki verify`, `loki spec`, `loki grill`,
70
+ `loki heal` / `loki modernize heal`, `loki preview` / `loki open`,
71
+ `loki deploy`, `loki docker`, `loki mcp`, `loki memory`, `loki plan`,
72
+ `loki quickstart`, `loki demo`, `loki status`, `loki stop`, `loki doctor`.
73
+ - `.loki/` filesystem state files (session, queue, memory, checkpoints,
74
+ findings, healing artifacts) that all other components read and write.
75
+
76
+ **Dependencies:**
77
+ - `providers/` for provider-aware invocation and model selection.
78
+ - `memory/` for episodic trace storage and context retrieval.
79
+ - `events/` for event emission.
80
+ - `loki-ts/` as the default modern runner (bash route is the fallback via
81
+ `LOKI_LEGACY_BASH=1`).
82
+
83
+ ---
84
+
85
+ ## loki-ts/
86
+
87
+ The modern Bun/TypeScript runner. Default execution path; mirrors the bash
88
+ route's behavior with strict parity (checked by the parity suites under `tests/`).
89
+
90
+ **Purpose:** Fast, typed implementation of the runner, CLI, council,
91
+ provider abstraction, and metrics.
92
+
93
+ **Key files:**
94
+ - `src/cli.ts` - CLI entry.
95
+ - `src/version.ts` - Version reporting.
96
+ - `src/runner/` - Autonomous run loop, state, RARV phasing.
97
+ - `src/runner/providers.ts` - Provider abstraction with automatic failover.
98
+ - `src/runner/council.ts` - Completion-council hook: convergence tracking, the stagnation and done-signal force-stop valves, and the v8 confidence-spike re-check.
99
+ - `src/runner/goal_score.ts` - Goal-measurability scoring (v8.0.0). Advisory only; flags a goal the loop cannot hill-climb. Byte-mirrored in `autonomy/run.sh`.
100
+ - `src/runner/retry_class.ts` - Failure classification (v8.0.0). Separates transient failures from positively-identified permanent ones; unrecognized failures stay transient.
101
+ - `src/council/` - Reviewer council and verdict logic.
102
+ - `src/commands/` - Command implementations.
103
+ - `src/metrics/` - Efficiency and reward metrics.
104
+ - `src/project_graph.ts` - Project/codebase graph.
105
+ - `src/util/` - Shared utilities.
106
+ - `tests/` - Bun test suite; `stryker.config.json` for mutation testing.
107
+
108
+ **Public interface:**
109
+ - The `loki` binary behavior (parity with the bash CLI).
110
+ - Provider invocation contract consumed by the orchestration layer.
111
+
112
+ **Dependencies:**
113
+ - `providers/` (shared model catalog and provider semantics).
114
+ - `.loki/` state (shared with the bash route, byte-identical where required).
115
+
116
+ ---
117
+
118
+ ## memory/
119
+
120
+ The memory system: episodic interaction traces, generalized semantic patterns,
121
+ learned procedural skills, with optional vector search and cross-project recall.
122
+
123
+ **Purpose:** Persist and retrieve task-relevant context across iterations and
124
+ across projects.
125
+
126
+ **Key files:**
127
+ - `engine.py` - Memory orchestrator.
128
+ - `schemas.py` - Pydantic schemas (includes healing `FrictionPoint`,
129
+ `FailureMode`).
130
+ - `storage.py` - File-based storage backend (`.loki/memory/`).
131
+ - `retrieval.py` - Task-aware retrieval.
132
+ - `consolidation.py` - Episodic-to-semantic consolidation pipeline.
133
+ - `token_economics.py` - Discovery vs read token accounting.
134
+ - `embeddings.py`, `vector_index.py` - Optional embedding-based similarity.
135
+ - `cross_project.py`, `knowledge_graph.py`, `rag_injector.py` - Cross-project
136
+ recall, knowledge graph, and RAG prompt injection (v7.1.0+).
137
+ - `app_graph.py`, `error_log.py`, `ingest.py`, `namespace.py`, `replay.py`,
138
+ `unified_access.py` - Supporting modules.
139
+ - `layers/` - Progressive disclosure (index, timeline, full detail).
140
+ - `managed_memory/` - Managed memory client, gated on
141
+ `LOKI_MANAGED_MEMORY=true`.
142
+ - `tests/` - Memory test suite.
143
+
144
+ **Public interface:**
145
+ - `loki memory index|timeline|consolidate|economics|retrieve|episode|pattern|skill|vectors`.
146
+ - REST endpoints at `/api/memory/*` (via the API/dashboard layers).
147
+ - Python package API consumed by the runner and MCP server.
148
+
149
+ **Dependencies:**
150
+ - Consumed by `autonomy/` (trace storage bridge), `mcp/`, `dashboard/`,
151
+ and `api/`.
152
+ - Optional `sentence-transformers` for vector search.
153
+
154
+ ---
155
+
156
+ ## providers/
157
+
158
+ Multi-provider support. Shell-sourceable provider configs and a model registry
159
+ shared by both the bash route and loki-ts.
160
+
161
+ **Purpose:** Abstract over Claude Code, Cline, Codex CLI, and Aider with tiered
162
+ capability degradation.
163
+
164
+ **Key files:**
165
+ - `claude.sh` - Claude Code (Tier 1: full features).
166
+ - `cline.sh` - Cline (Tier 2: reduced parallelism).
167
+ - `codex.sh` - OpenAI Codex CLI (Tier 3: degraded, sequential).
168
+ - `aider.sh` - Aider (Tier 3: degraded).
169
+ - `loader.sh` - Provider loader utility.
170
+ - `models.sh`, `model_catalog.json` - Model name registry and catalog.
171
+ - `managed.py` - Managed provider client.
172
+
173
+ Note: Gemini CLI was deprecated in v7.5.18; `LOKI_PROVIDER=gemini` exits with a
174
+ migration message.
175
+
176
+ **Public interface:**
177
+ - `--provider <name>` flag, `LOKI_PROVIDER` env var.
178
+ - Sourceable shell functions consumed by `autonomy/run.sh`.
179
+
180
+ **Dependencies:**
181
+ - Consumed by `autonomy/` and `loki-ts/src/runner/providers.ts`.
182
+
183
+ ---
184
+
185
+ ## dashboard/
186
+
187
+ The FastAPI web dashboard: a control plane and observability surface for live
188
+ runs, plus auth, tenancy, telemetry, and migration tooling.
189
+
190
+ **Purpose:** Visualize and control autonomous runs from the browser.
191
+
192
+ **Key files:**
193
+ - `server.py` - FastAPI app (~6K lines, 100+ endpoints, WebSocket).
194
+ - `api_v2.py`, `control.py`, `runs.py` - Run control and v2 API.
195
+ - `auth.py`, `api_keys.py`, `tenants.py`, `app_secrets.py` - Auth, API keys,
196
+ multi-tenancy, secret storage.
197
+ - `database.py`, `models.py`, `registry.py` - Persistence and models.
198
+ - `activity_logger.py`, `audit.py`, `telemetry.py` - Logging and telemetry.
199
+ - `failure_extractor.py`, `prompt_optimizer.py`, `migration_engine.py`,
200
+ `rigour_integration.py` - Failure analysis, prompt tuning, healing/migration.
201
+ - `static/` - Built frontend (`index.html`, served by the API).
202
+ - `frontend/` - Frontend source assets.
203
+ - `run.py`, `Dockerfile`, `docker-compose.yml`, `requirements.txt` - Runtime.
204
+
205
+ **Public interface:**
206
+ - HTTP/WebSocket endpoints (run status, control, memory, council, cost,
207
+ context, escalations, notifications, app runner, migration).
208
+ - Served by `loki web` / `loki start --api`.
209
+
210
+ **Dependencies:**
211
+ - `memory/` for memory views.
212
+ - `events/` for live event streaming.
213
+ - `.loki/` state from `autonomy/` runs.
214
+
215
+ ---
216
+
217
+ ## Removed: legacy dashboard UI
218
+
219
+ The legacy browser UI source and its bundle were deleted in CPE-24. The browser UI is the Control Plane (`packages/control-plane`); `dashboard/server.py` serves the `/api/*` routes only.
220
+
221
+ ---
222
+
223
+ ## web-app/
224
+
225
+ The Purple Lab web app (deprecated v7.44.0; source kept, still in the tarball
226
+ during phased removal). Provided a multi-project lab surface with browser-based
227
+ PRD input.
228
+
229
+ **Purpose:** Legacy lab UI (superseded by the single dashboard web surface).
230
+
231
+ **Key files:**
232
+ - `auth.py`, `crypto.py`, `models.py`, `migrations/`, `alembic.ini` - Backend.
233
+ - `index.html`, `package.json`, `playwright.config.ts` - Frontend.
234
+ - `Dockerfile`, `docker-compose.purple-lab.yml`, `deploy/` - Deployment.
235
+
236
+ **Dependencies:**
237
+ - Historically consumed `autonomy/` runs; being retired.
238
+
239
+ ---
240
+
241
+ ## mcp/
242
+
243
+ The Model Context Protocol server. Exposes Loki capabilities (including code
244
+ search) to MCP clients.
245
+
246
+ **Purpose:** Make Loki's memory, tools, and search available over MCP.
247
+
248
+ **Key files:**
249
+ - `server.py` - MCP server (47 tools: 31 in-file + magic + gated managed + 8 cp; plus
250
+ 3 resources, 2 prompts).
251
+ - `tools.py` - Core tool implementations.
252
+ - `magic_tools.py` - Magic Modules tools.
253
+ - `cp_tools.py` - Read-only Control Plane data tools (`cp_*`, GET only; the CP URL
254
+ and token come from the MCP child env and are never returned).
255
+ - `managed_tools.py` - Managed-memory tool (`loki_memory_redact`, gated on
256
+ `LOKI_MANAGED_AGENTS=true` and `LOKI_MANAGED_MEMORY=true`).
257
+ - `resources.py` - MCP resources.
258
+ - `lsp_proxy.py` - LSP proxy (find references, go to definition, symbol lookup).
259
+ - `learning_collector.py` - Learning signal collection.
260
+ - `_sdk_loader.py` - Bootstraps the Python MCP SDK on first run.
261
+ - `tests/` - MCP test suite.
262
+
263
+ **Public interface:**
264
+ - MCP tools, resources, and prompts. Launched via `loki mcp`.
265
+
266
+ **Dependencies:**
267
+ - `memory/` for memory tools.
268
+ - ChromaDB for code search.
269
+ - On-PATH language servers for the LSP proxy.
270
+
271
+ ---
272
+
273
+ ## api/
274
+
275
+ The REST API surface (Deno/TypeScript): routes, middleware, and services that
276
+ bridge to the CLI and event bus.
277
+
278
+ **Purpose:** Programmatic HTTP access to runs, memory, learning, and events.
279
+
280
+ **Key files:**
281
+ - `server.ts`, `mod.ts`, `client.ts` - Server, module entry, client.
282
+ - `routes/` - `events.ts`, `health.ts`, `learning.ts`, `memory.ts`,
283
+ `sessions.ts`, `tasks.ts`.
284
+ - `middleware/` - `auth.ts`, `cors.ts`, `error.ts`, `timing.ts`.
285
+ - `services/` - `cli-bridge.ts`, `event-bus.ts`, `learning-collector.ts`,
286
+ `state-notifications.ts`, `state-watcher.ts`.
287
+ - `types/` - `api.ts`, `events.ts`, `memory.ts`.
288
+ - `openapi.yaml` - API specification.
289
+
290
+ **Public interface:**
291
+ - HTTP routes documented in `openapi.yaml`.
292
+
293
+ **Dependencies:**
294
+ - `autonomy/` CLI via `cli-bridge.ts`.
295
+ - `events/` via `event-bus.ts`.
296
+ - `memory/` via the memory route.
297
+
298
+ ---
299
+
300
+ ## events/
301
+
302
+ The unified event bus. Multi-language so any component can emit and consume
303
+ events.
304
+
305
+ **Purpose:** Decouple components via a shared event stream.
306
+
307
+ **Key files:**
308
+ - `bus.py` - Python event bus.
309
+ - `bus.ts` - TypeScript event bus.
310
+ - `emit.sh` - Bash helper for emitting events.
311
+
312
+ **Public interface:**
313
+ - `emit`/subscribe APIs in each language binding.
314
+
315
+ **Dependencies:**
316
+ - Consumed by `autonomy/`, `api/`, and `dashboard/`.
317
+
318
+ ---
319
+
320
+ ## agents/
321
+
322
+ The agent type registry and installation tooling.
323
+
324
+ **Purpose:** Define the specialized agent roles the orchestrator adopts per
325
+ phase.
326
+
327
+ **Key files:**
328
+ - `types.json` - Agent type definitions (41 agent types across 8 domains).
329
+ - `hub_install.py` - Agent hub install.
330
+ - `managed_registry.py` - Managed agent registry.
331
+
332
+ **Public interface:**
333
+ - Agent type definitions consumed during prompt construction.
334
+
335
+ **Dependencies:**
336
+ - Consumed by `autonomy/` (prompt building) and `loki-ts/`.
337
+
338
+ ---
339
+
340
+ ## skills/
341
+
342
+ On-demand skill modules following the progressive-disclosure architecture
343
+ (v3.0). Loaded selectively by the orchestrator.
344
+
345
+ **Purpose:** Provide modular operational knowledge without bloating the core
346
+ skill file.
347
+
348
+ **Key files:**
349
+ - `00-index.md` - Module selection rules and routing.
350
+ - `quality-gates.md` - The canonical 8-gate table and RARV-C flags.
351
+ - `model-selection.md`, `providers.md`, `healing.md`, `testing.md`,
352
+ `production.md`, `troubleshooting.md`, `agents.md`, `artifacts.md`,
353
+ `patterns-advanced.md`, `parallel-workflows.md`, `github-integration.md`,
354
+ `sdlc-fleet.md`, `memory.md`, `documentation.md`, `compound-learning.md`,
355
+ `magic-modules.md`, `mirofish-integration.md`, `openspec-integration.md`.
356
+
357
+ **Dependencies:**
358
+ - Referenced by `SKILL.md` and read at runtime by the orchestrator.
359
+
360
+ ---
361
+
362
+ ## references/
363
+
364
+ Detailed reference documentation backing the slim skill modules.
365
+
366
+ **Purpose:** Deep-dive docs for patterns, research foundations, and subsystems.
367
+
368
+ **Key files:**
369
+ - `core-workflow.md`, `sdlc-phases.md`, `task-queue.md`, `deployment.md`.
370
+ - `legacy-healing-patterns.md`, `quality-control.md`, `confidence-routing.md`.
371
+ - `memory-system.md`, `mcp-integration.md`, `multi-provider.md`.
372
+ - `openai-patterns.md`, `lab-research-patterns.md`, `advanced-patterns.md`,
373
+ `tool-orchestration.md`, `agent-types.md`, `competitive-analysis.md`,
374
+ `cursor-learnings.md`, `prompt-repetition.md`, `business-ops.md`,
375
+ `invariant-checks.md`, `magic-modules-patterns.md`,
376
+ `magic-rarv-integration.md`, `production-patterns.md`.
377
+
378
+ **Dependencies:**
379
+ - Linked from `skills/` and `CLAUDE.md`.
380
+
381
+ ---
382
+
383
+ ## templates/
384
+
385
+ PRD templates per project archetype. Used to bootstrap specs.
386
+
387
+ **Purpose:** Give users a starting PRD shaped to their project type.
388
+
389
+ **Key files:**
390
+ - One template per archetype: `saas-starter.md`, `cli-tool.md`,
391
+ `discord-bot.md`, `slack-bot.md`, `rest-api.md`, `rest-api-auth.md`,
392
+ `api-only.md`, `microservice.md`, `e-commerce.md`, `blog-platform.md`,
393
+ `ai-chatbot.md`, `chrome-extension.md`, `mobile-app.md`, `game.md`,
394
+ `data-pipeline.md`, `web-scraper.md`, `dashboard.md`, `npm-library.md`,
395
+ `static-landing-page.md`, `simple-todo-app.md`, `full-stack-demo.md`.
396
+ - `clusters/` - Grouped template clusters.
397
+
398
+ **Dependencies:**
399
+ - Consumed by `loki quickstart` and `loki start`.
400
+
401
+ ---
402
+
403
+ ## benchmarks/
404
+
405
+ The SWE-bench and HumanEval benchmark harness.
406
+
407
+ **Purpose:** Measure Loki's performance on standard coding benchmarks.
408
+
409
+ **Key files:**
410
+ - `run-benchmarks.sh` - Entry point (`humaneval`, `swebench`).
411
+ - `embedding-benchmark.py`, `prepare-submission.sh` - Embedding bench and
412
+ submission prep.
413
+ - `datasets/`, `tasks/`, `results/`, `swebench/`, `swebench-pro-pilot/`,
414
+ `magic-ab/`, `bench/` - Data, tasks, and outputs.
415
+ - `SCHEMA-adapter.md`, `SCHEMA-result.md`, `submission-template/` - Schemas.
416
+
417
+ **Public interface:**
418
+ - `./benchmarks/run-benchmarks.sh humaneval|swebench --execute --loki`.
419
+
420
+ **Dependencies:**
421
+ - `autonomy/` CLI for executing builds.
422
+
423
+ ---
424
+
425
+ ## plugins/
426
+
427
+ Claude Code plugin packaging and marketplace metadata.
428
+
429
+ **Purpose:** Distribute Loki Mode as a Claude Code plugin.
430
+
431
+ **Key files:**
432
+ - `loki-mode/.claude-plugin/plugin.json` - Plugin manifest (version pinned to
433
+ `VERSION`).
434
+ - `.claude-plugin/marketplace.json` (repo root) - Marketplace entry.
435
+
436
+ **Dependencies:**
437
+ - Packages `SKILL.md`, `skills/`, and `references/`.
438
+
439
+ ---
440
+
441
+ ## Cross-cutting state: `.loki/`
442
+
443
+ Not a source directory, but the integration substrate. The orchestrator,
444
+ dashboard, API, memory, and MCP server all communicate through filesystem
445
+ state under `.loki/` (session, queue, memory, checkpoints, findings, metrics,
446
+ healing artifacts, verify evidence). This file-based contract is what keeps the
447
+ bash route and the loki-ts runner interchangeable.
@@ -69,7 +69,7 @@ Better, for anything real: set `secrets.create=false` and
69
69
  External Secrets Operator or a Vault injector. Values passed with `--set` land
70
70
  in Helm release history and often in a git-tracked values file.
71
71
 
72
- Compose: put both in `.env` next to `docker-compose.yml`.
72
+ Compose: put both in `.env` at the repo root (`docker/docker-compose.yml` reads `../.env`).
73
73
 
74
74
  ```
75
75
  GITHUB_WEBHOOK_SECRET=<that value>
@@ -168,7 +168,7 @@ Then watch the worker:
168
168
 
169
169
  ```bash
170
170
  kubectl logs -l app.kubernetes.io/component=worker -f # Kubernetes
171
- docker compose --profile service logs -f worker # Compose
171
+ docker compose -f docker/docker-compose.yml --profile service logs -f worker # Compose
172
172
  ```
173
173
 
174
174
  You are looking for `[queue-consumer] starting build: spec=owner/repo#N`.
@@ -191,7 +191,7 @@ kubectl exec -it deploy/loki-redis-master -- \
191
191
  Compose:
192
192
 
193
193
  ```bash
194
- docker compose --profile service exec redis \
194
+ docker compose -f docker/docker-compose.yml --profile service exec redis \
195
195
  redis-cli RPUSH loki-builds 'owner/repo#123'
196
196
  ```
197
197
 
@@ -256,7 +256,7 @@ ground manually today.
256
256
  ## Kubernetes (Helm)
257
257
 
258
258
  No `helm dependency build` step: the chart has no subchart dependencies. Redis
259
- is a plain Deployment on `redis:7-alpine`, the same image `docker-compose.yml`
259
+ is a plain Deployment on `redis:7-alpine`, the same image `docker/docker-compose.yml`
260
260
  uses.
261
261
 
262
262
  The default image tag is the chart's `appVersion`, which tracks `VERSION` and so
@@ -457,21 +457,21 @@ cluster is a NAT gateway, firewall or proxy you run.
457
457
  ## Single node (Docker Compose)
458
458
 
459
459
  ```bash
460
- cp .env.example .env
460
+ cp docker/.env.example .env
461
461
  # set GITHUB_WEBHOOK_SECRET and ANTHROPIC_API_KEY
462
462
 
463
- docker compose --profile service up -d
464
- docker compose --profile service ps
463
+ docker compose -f docker/docker-compose.yml --profile service up -d
464
+ docker compose -f docker/docker-compose.yml --profile service ps
465
465
  ```
466
466
 
467
467
  The `service` profile is what separates the build service from the one-shot
468
- path. Without it, `docker compose run loki start prd.md` still does exactly
468
+ path. Without it, `docker compose -f docker/docker-compose.yml run loki start prd.md` still does exactly
469
469
  what it always did -- one build, right now, in the current directory.
470
470
 
471
471
  Scale workers:
472
472
 
473
473
  ```bash
474
- docker compose --profile service up -d --scale worker=4
474
+ docker compose -f docker/docker-compose.yml --profile service up -d --scale worker=4
475
475
  ```
476
476
 
477
477
  Same tenancy caveat as Kubernetes: each worker gets its own named volume, and