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
@@ -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