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,114 +0,0 @@
1
- # v8 acceptance-test triage (partial, in progress)
2
-
3
- Date: 2026-07-24. Read-only audit against the v8 competitive plan (P2).
4
- Method: source-verified only. A filename containing a relevant word does NOT
5
- count as EXISTS; the assertion or enforcing code must be read.
6
-
7
- ## Why this triage exists
8
-
9
- Source 08 proposes 26 release-blocking acceptance tests. The plan's P2 says
10
- triage them EXISTS / PARTIAL / NET-NEW before treating any as work, because
11
- three earlier "gaps" from the same research corpus turned out already shipped
12
- (evidence-in-PR, the offline verifier, stuck-detection signals). Writing this as
13
- "add 26 tests" would repeat that error at 26x scale.
14
-
15
- Repo has 456 files under `tests/`.
16
-
17
- ## Verified so far
18
-
19
- | # | Test | Verdict | Evidence |
20
- |---|---|---|---|
21
- | 15 | empty diff != complete | **EXISTS** | `tests/test-evidence-gate.sh` enumerates 13 gate cases including case 2 "empty diff (baseline==HEAD, clean) -> BLOCK (rc 1), reason empty_diff" (`:21`), case 10 "empty diff + red tests -> BLOCK, reason empty_diff_and_tests_red" (`:29`), case 13 "truly-empty run (no untracked) -> BLOCK, reason empty_diff" (`:32`). Enforced in `autonomy/lib/proof-generator.py:1238` ("A non-empty diff is a PREREQUISITE for VERIFIED") and `autonomy/verify.sh:2067` ("empty diff yields CONCERNS (nothing to verify), never VERIFIED"). Note `test-evidence-gate.sh:126` explicitly guards against a false-pass where `.loki/` being untracked would mask the empty-diff BLOCK. |
22
- | 19 | unhealthy app != complete | **EXISTS** | `tests/test-evidence-boot-axis.sh` drives the REAL `council_evidence_gate` (sourced from `autonomy/completion-council.sh`, not a mock) with synthetic app-runner fixtures, isolating the boot axis by making the diff and test axes pass. Contract (`:2-7`): a SERVEABLE app confirmed unhealthy -> BLOCK; a non-web project (no serveable runner) or an un-probed one -> inconclusive pass-through, so a CLI/library build cannot deadlock. Health source is `.loki/app-runner/health.json` written by `app_runner_health_check`. |
23
-
24
- | 20 | stale/forged evidence != new run | **EXISTS (partial, honestly scoped)** | `tests/test-proof-forgery-defense.sh` locks THREE facts about `proof-verify.py` (v7.111.0) and is deliberately explicit that the non-forgeability gap is MITIGATED AND RELABELED, NOT closed: (a) genuine proof -> `ok:true, headline_consistent:true`; (b) INCONSISTENT forgery (headline flipped to VERIFIED, facts left `not_run`, hash recomputed) -> `ok:false, headline_consistent:false`; (c) CONSISTENT forgery on the UNSIGNED path -> STILL `ok:true`, reporting `generator_trusted:true`. |
25
-
26
- | 16 | failing tests != complete | **EXISTS** | `tests/test-evidence-gate-rc.sh` guards `_evidence_gate_and_surface()` (`autonomy/run.sh:10168`) rc propagation: a failing evidence gate must propagate its exact non-zero rc out of the wrapper, preserving the caller's `! council_evidence_gate` elif-chain semantics byte-for-byte. Written because the wrapper's own rc propagation had never been driven against the real function body (another test stubs it out), so a regression returning 0 unconditionally would have swallowed the gate. |
27
- | 17 | fake test output cannot satisfy gate | **EXISTS** | `tests/test-enforce-mutation-integrity.sh` drives `enforce_mutation_integrity()` (`autonomy/run.sh:10505`) against a REAL project fixture with an actual HIGH-severity finding. Wraps `tests/detect-test-mutations.sh` (Quality Gate 9) with `--block-high`; blocks the iteration (rc 1) iff output has at least one `[HIGH]` line, else rc 0 with MEDIUM/LOW routed to an advisory findings file. Explicitly guards the threat model: "a test-fitted commit (assertions mutated to match buggy output) sail[ing] through completion ungated". |
28
- | 18 | mock-only cannot satisfy prod completion | **EXISTS** | `tests/test-nomock-data-render.sh` drives both `autonomy/verify.sh` and `autonomy/completion-council.sh` against real fixtures, distinguishing legitimate static content catalogs from mock OPERATIONAL data (so a docs/content site is not false-failed while a mock-backed app is not false-passed). |
29
- | 24 | trust-core regressions pass | **EXISTS** | `tests/test-completion-council-affirmative-evidence.sh` locks the v7.41.5 trust-gate inversion: `council_evaluate_member` now requires AFFIRMATIVE positive evidence before voting COMPLETE. |
30
-
31
- ### Note: item 24 documents a real historical false-green
32
-
33
- Before v7.41.5, `council_evaluate_member` DEFAULTED to vote=COMPLETE and only
34
- flipped to CONTINUE on a DETECTED failure. On a greenfield run with an empty
35
- `.loki/` (no test results, no queue, few TODO files), `requirements_verifier`
36
- and `devils_advocate` both defaulted COMPLETE while only `test_auditor` went
37
- CONTINUE, so 2-of-3 cleared the size-3 threshold and the council approved a
38
- project with ZERO positive evidence. The fix inverts the default to CONTINUE
39
- and votes COMPLETE only on a real positive signal (shared base:
40
- `.loki/quality/test-results.json` present AND not red).
41
-
42
- This matters for positioning: it is a documented, fixed instance of exactly the
43
- failure class the moat claims to prevent, found and closed by the project
44
- itself. It is also a caution - the moat is an ongoing engineering commitment,
45
- not a property the architecture grants for free.
46
-
47
- ### Note: item 20's test is itself moat evidence
48
-
49
- Case (c) is a test written to STOP THE PROJECT OVERCLAIMING ITS OWN SECURITY. It
50
- asserts that a forger who rewrites both the facts and the headline into a
51
- mutually consistent lie and recomputes the hash STILL PASSES on the unsigned
52
- path. Neutral non-forgeability requires the signed record. This is the same
53
- honesty-engineering signal as the v7.111.0 removal of Loki's own false
54
- "non-forgeable" claim, and it is rare: most projects test that their defense
55
- works, not that it does not work as well as marketing might imply.
56
-
57
- Direct consequence for the plan: it names exactly what receipt SIGNING buys
58
- (neutral non-forgeability against a consistent forger), which is the remaining
59
- half of the "sign the receipt" item. The verifier and GPG path already exist in
60
- `autonomy/lib/proof-verify.py` (`_verify_gpg`); what is missing is key
61
- distribution and a signed-by-default path, not the mechanism.
62
-
63
- ## Additional corroborating tests (not yet read, listed to avoid re-derivation)
64
-
65
- The verdicts above rest on the assertions cited. These further files also bear
66
- on the same items and would deepen (not change) the verdicts:
67
- `test-evidence-gate-no-tests.sh`, `test-completion-route-evidence-gate.sh`
68
- (#16); `detect-test-mutations.sh` (#17); `detect-mock-problems.sh` (#18);
69
- `tests/test_proof_verify.py`, `test-completion-signal-consume.sh` (#20);
70
- `test-iteration-complete-accuracy.sh` (#24).
71
-
72
- ## Known NET-NEW (verified elsewhere this session)
73
-
74
- - **#3 no SDK-full silent fallback to legacy** and the stuck/stagnation coverage:
75
- **RESOLVED 2026-07-25, this section is kept for history.** When written, the
76
- stagnation and done-signal force-stop valves were NOT active on the TS/SDK
77
- route (`trackIteration` wrote placeholder zeros) while bash had both
78
- (`autonomy/completion-council.sh:4519`, `:4528`), making the port a hard
79
- prerequisite of the SDK-default flip.
80
-
81
- Both valves were ported in commit `5c3d2769` and now run on the TS route,
82
- persisting counters to `.loki/council/state.json` so they survive a runner
83
- restart (`loki-ts/src/runner/council.ts`). Fail-closed behavior for #3 was
84
- separately source-verified in `docs/V8-RUNTIME-TRUTH-2026-07-25.md`: there is
85
- no CLI fallback branch, and `sawResult ? exitCode : 1` means a stream that
86
- never produced a terminal result is a FAILED iteration.
87
-
88
- Note also that this document's related claim about SDK **session continuity**
89
- blocking the flip was later found FALSE and corrected in `c31f6f20` -- legacy
90
- session stamping is default-OFF and emits a per-iteration DISTINCT uuid, so it
91
- never provided cross-iteration continuity either. No capability regression
92
- blocks the flip; the remaining gate is the untested acceptance items.
93
-
94
- ## Honest status
95
-
96
- INCOMPLETE but no longer thin. 7 of 26 assertion-verified: items 15, 16, 17, 18,
97
- 19, 20, 24 all EXISTS; the stuck/stagnation axis is NET-NEW on the TS route.
98
-
99
- **The pattern is now strong enough to state as a finding:** every trust-core
100
- acceptance test the research proposed as new work already exists, and several
101
- are more rigorous than the proposal (they drive real function bodies rather than
102
- mocks, and two of them exist specifically to prevent the project overclaiming).
103
- The research's "26 release-blocking tests to add" framing was wrong for this
104
- bucket. Remaining NET-NEW risk is concentrated in the SDK/TS runtime items, not
105
- in the trust core.
106
-
107
- Not yet triaged: 1-14, 21, 22, 23, 25, 26. Items 1-14 concern SDK runtime truth,
108
- crash/resume, cancel, sandbox cleanup, secrets and network isolation; several
109
- are likely PARTIAL and are downstream of the Phase-0 runtime-truth audit anyway.
110
-
111
- Published partial rather than padded: a plausible-looking full table with
112
- unverified rows is worse than an admitted gap, which is the exact failure mode
113
- this plan exists to avoid. Two delegated audit agents returned no findings; all
114
- verdicts here were verified by reading source directly.
@@ -1,45 +0,0 @@
1
- # v8 complexity audit: delete-list candidates
2
-
3
- Date: 2026-07-24. Read-only. **Zero deletions performed** (founder decision).
4
-
5
- ## Why this audit exists
6
-
7
- The competitive research corpus (source 12) proposed deleting `voice.sh`,
8
- cockpit image rendering, `web-app/`, Managed Agents, and the "41 static roles"
9
- to reduce single-maintainer load. VALIDATION.md marks that source's "unused"
10
- label as an **assumption it never verified**, and the same source was already
11
- caught undercounting `autonomy/loki` by 10k lines. So each candidate needed
12
- positive proof, not a confident assertion.
13
-
14
- **Method:** positive proof of non-reference. An absent grep hit is not evidence
15
- (memory: grep-absence-false-green). A component counts as live if anything
16
- references it, dispatches it, or ships it.
17
-
18
- ## Findings
19
-
20
- | Candidate | Verdict | Evidence |
21
- |---|---|---|
22
- | `autonomy/voice.sh` (501 lines) | **ORPHANED (only true positive)** | Referenced by NOTHING except itself: a repo-wide search across `autonomy/`, `loki-ts/`, `scripts/`, `tests/`, `mcp/`, `dashboard/` returns only the file. Meanwhile `cmd_voice()` (`autonomy/loki:22751`) is dispatched (`:17884`) but is a 4-line stub that prints "Voice mode is planned for a future release" and points at issue #85. So the COMMAND is live and honest; the 501-line SCRIPT behind it is dead weight shipped in the npm tarball (`package.json` includes `autonomy/`). |
23
- | cockpit rendering | **LIVE** | Real module with 5 source files (`loki-ts/src/cockpit/{raster,cli,capability,svg,render}.ts`). Not an orphan. Source 12 cited `loki-ts/src/commands/cockpit.ts`, which does NOT exist: its path was wrong, its conclusion untested. |
24
- | `web-app/` | **LIVE AND SHIPPED** | 12 explicit entries in `package.json` `files` (`web-app/dist/`, `server.py`, `auth.py`, `models.py`, ...). Deleting it would break the published package. |
25
- | Managed Agents | **NOT SUBSTANTIATED** | The claimed "NOT TESTED against live Anthropic API" marker in SKILL.md was not found. The premise of the delete recommendation could not be reproduced. |
26
- | "41 static roles" | **MISCHARACTERIZED** | `references/agent-types.md:9` already documents these precisely: "prompt-defined specifications the orchestrator adopts per phase, **not separate processes**", with "typically 5-10 for simple projects" activated. They are a catalog, not 41 running agents. There is no static-role runtime cost to delete. |
27
-
28
- ## Conclusion
29
-
30
- **One of five candidates survived.** Four were live, mis-pathed, unsubstantiated,
31
- or mischaracterized. This is consistent with the pattern across this whole
32
- planning pass: the research corpus's confident specifics do not survive contact
33
- with the repo, and the plan's "audit before deleting anything" rule was load
34
- bearing rather than cautious.
35
-
36
- `autonomy/voice.sh` is a genuine 501-line orphan. Even so, **no deletion is
37
- performed here** per the founder decision. Recommended follow-up, separately and
38
- evidence-gated: either delete `voice.sh` and keep the honest `cmd_voice` stub, or
39
- keep the script if issue #85 will build on it. That is a small, isolated call
40
- with no dependents by definition.
41
-
42
- ## What this does NOT claim
43
-
44
- This audit covers only the five named candidates. It is not a repo-wide dead-code
45
- sweep, and it makes no claim about the rest of the tree.
@@ -1,137 +0,0 @@
1
- # v8 Major Release - Costed Decision Plan
2
-
3
- Status: PROPOSAL (founder review before any implementation spend). 2026-07-24.
4
- Author: this session, grounded in the actual repo state (not aspirational).
5
-
6
- ## TL;DR (the honest headline)
7
-
8
- **v8 is ~80% built and tested, but uncommitted.** The hard engineering - a 12,300-line
9
- parity-locked TypeScript runner, the Anthropic SDK route (`sdk_invoker.ts`, `sdk_mode.ts`,
10
- stream parser), and ~18,000 lines of *working, test-passing* feature work (supervised builds,
11
- deadline confinement, honesty/no-mock hardening, code-review calibration) - already exists in
12
- the working tree. The V8-AGENT-SDK-PLAN and RARV-C-100X-PLAN both say so explicitly:
13
- "much of this is already shipped."
14
-
15
- So "the v8 major release" is NOT a build-from-scratch effort. It is, in order of cost:
16
- 1. **CONSOLIDATE + VERIFY + SHIP** what already works (cheap, high-value, the bulk of the win).
17
- 2. **A bounded net-new layer** the founder asked for: jcode-informed harness-intelligence,
18
- PostHog analytics, the otel 2.x upgrade.
19
-
20
- This plan costs each phase so the founder funds them selectively, not as one open-ended blob.
21
-
22
- ---
23
-
24
- ## Where v8 actually stands (verified this session)
25
-
26
- | Component | State | Evidence |
27
- |---|---|---|
28
- | TS runner (autonomous loop, council, gates, prompt) | Built, parity-locked | `loki-ts/src/runner/` 12.3k lines, 22 modules |
29
- | Anthropic SDK route (judges = raw SDK, loop = Agent SDK) | Built + tested | `sdk_invoker.ts`, `sdk_mode.ts`, `sdk_stream_parser.ts`; tests: sdk_invoker, sdk_stream_parser, sdk_query_provider, sdk_loop_e2e |
30
- | One-switch `LOKI_SDK_MODE` (off/judges/full) + rollback | Built | CHANGELOG v8.1; byte-mirrored bash+TS, shared parity fixture |
31
- | Supervised builds / deadline confinement | Built + tests PASS | `deadline.py`, `build_supervisor.py`, `dependency-setup.sh` + `test-hard-deadline-confinement`, `test-supervised-*` (verified passing) |
32
- | Honesty / no-mock hardening | Built + tests PASS | `no_mock_scan.py`, `test-harness-false-green`, `test-honest-gate-status`, `test-nomock-data-render` (verified passing) |
33
- | Code-review calibration | Built | `test-review-severity-calibration`, `-assurance-tail`, `-lockfile-context` + council/quality_gates mods |
34
- | ~18k LOC uncommitted total | Working, not committed | `git diff`: 46 files +7173/-1296; 25 new files +11057 LOC |
35
- | Published to npm as 8.x | NO | npm latest = 7.129.4; v8 never published, never merged to main |
36
- | PostHog analytics | **BUILT** (`5dcc88c6`) | opt-in `build_verified` event behind a strict second gate (`LOKI_ANALYTICS=on`, default OFF even when telemetry is on), fixed allowlist reader emits proof scalars only |
37
- | otel 2.x (the deferred CVE fix) | **DONE** (`159dc7f4`) | clears GHSA-45rx-2jwx-cxfr at source |
38
- | Phase 3 harness intelligence | **BUILT** (`9e596e9a`, `889bd52a`, `500e74f6`) | 3a prompt-cache discipline already existed (verified, not rebuilt); 3b confidence-spike, 3c goal scoring, 3d smart retry landed 2026-07-25 |
39
- | Release identity (VERSION vs CHANGELOG) | **RESOLVED** (`a749ee54`) | folded the drafted `v8.1.0` block into one `v8.0.0` entry; no 8.x was ever published, so a first-ever 8.x as 8.1.0 would have described a release history that does not exist |
40
-
41
- **Releasability gate:** full `local-ci.sh` on the WIP tree - RESULT PENDING (running at write time;
42
- this plan's Phase 1 cost depends on how clean it is).
43
-
44
- ---
45
-
46
- ## The CHANGELOG-vs-WIP question (must resolve first)
47
-
48
- The `## v8.1.0 (unreleased)` CHANGELOG entry documents ONLY the SDK one-switch/rollback/packaging
49
- gate. But the ~18k uncommitted lines are mostly OTHER efforts (supervised builds, deadline,
50
- honesty, review calibration). **The documented release scope and the actual WIP do not match.**
51
-
52
- Resolution needed from founder: is the v8 MAJOR release =
53
- - (A) the SDK route ONLY (commit just the SDK-related files, ship a focused v8.0.0), OR
54
- - (B) EVERYTHING in the tree (SDK + supervised + honesty + review work) as one big v8.0.0?
55
-
56
- Recommendation: **(B)**, because the extra work is on-thesis (all deepens the trust moat), already
57
- tested, and shipping it piecemeal means more release cycles. But it requires per-theme commit
58
- curation (never one `git add -A`), so it costs more review time than (A). This is the single
59
- biggest scope decision and it changes Phase 1's cost.
60
-
61
- ---
62
-
63
- ## Phased plan (each phase independently fundable)
64
-
65
- ### Phase 1 - CONSOLIDATE + SHIP what's built [CHEAPEST, HIGHEST VALUE]
66
- The bulk of v8's value is already written. This phase makes it real.
67
- - Resolve the scope question (A vs B above).
68
- - Curate the WIP into coherent, themed commits (per-theme, individually staged - the same
69
- isolation discipline used for the v7.129.4 doc-gen commit; NEVER `git add -A`).
70
- - Get full local-ci green on the committed tree (prime deps + rebuild dist - the lesson from
71
- v7.129.4: most "failures" are environmental).
72
- - Reconcile the release identity: VERSION 8.0.0 vs CHANGELOG's 8.1.0; first-ever 8.x publish; a
73
- genuine MAJOR. Decide the number, write the CHANGELOG major entry.
74
- - **Do NOT publish yet** - land it green + reviewed on the branch, PR-ready. Publishing 8.0.0 is a
75
- separate, explicit, irreversible founder go (like the v7.129.4 push).
76
- - Cost: MODERATE (review/curation of 18k LOC + CI greening). Mostly verification, little new code.
77
- - Deliverable: v8 branch green, committed, coherent, PR-ready. The trust moat + SDK route SHIPPED.
78
-
79
- ### Phase 2 - PostHog analytics [NET-NEW, founder-requested]
80
- "log/monitor/get analytics as much as possible in PostHog."
81
- - Wire a PostHog sink alongside the existing OTLP/crash telemetry (opt-in, privacy-preserving -
82
- loki's zero-egress posture is a documented moat; PostHog must be explicit-opt-in, never covert).
83
- - The SDK route already surfaces rich typed telemetry (total_cost_usd, usage, cache read/creation,
84
- modelUsage, num_turns, duration_ms) - these become PostHog events cheaply.
85
- - Instrument: build lifecycle, gate outcomes, RARV iterations, provider/model, cost/tokens, council
86
- verdicts, receipt facts, per-stage latency, failure modes.
87
- - Cost: MODERATE (one new sink + event mapping; reuses existing telemetry seams).
88
- - Deliverable: opt-in PostHog analytics across the v8 build lifecycle.
89
-
90
- ### Phase 3 - jcode-informed harness intelligence [NET-NEW, "better than jcode"]
91
- Adopt jcode's measured-harness discipline onto loki's trust moat (see the jcode analysis in
92
- [[project-v8-major-release-mandate]]). Ranked by impact/effort:
93
- - 3a. **Prompt-cache discipline** (HIGH impact on latency+cost, MED effort): append-only context,
94
- stable prefix, MCP tools advertised up-front. The SDK route makes cache metrics visible already.
95
- - 3b. **Confidence-stepping / spike re-check** (HIGH, MED): force re-verify when agent confidence
96
- jumps to 100 (jcode's finding: confident-after is not signal). Layers onto the completion council.
97
- - 3c. **Hill-climbable goal scoring** (MED, MED): score each goal's quantifiability, push back on
98
- un-measurable goals. Complements the evidence gate.
99
- - 3d. **Auto-poke persistence** (MED, LOW): poke the loop back on incomplete todos; smart retry
100
- (transient retry, non-retryable stop-to-save-tokens). Partially exists (never-stop directive).
101
- - Cost: LARGE (each is a real feature). Fund individually; 3a is the best first (direct latency/cost win).
102
- - Deliverable: measurably faster/cheaper/more-persistent loop, trust moat intact.
103
-
104
- ### Phase 4 - otel 2.x + dependency modernization [DEFERRED FROM v7.129.4]
105
- - The breaking @opentelemetry 2.x major bump that clears GHSA-45rx-2jwx-cxfr for real (the v7.129.4
106
- patch waived it as not-reachable; here it gets genuinely fixed since major bumps belong in a major).
107
- - Re-verify tracing still works after the bump.
108
- - Founder standing directive: "always latest code, api, libraries" - audit + modernize other deps here.
109
- - Cost: SMALL-MODERATE (mechanical but needs tracing re-verification).
110
-
111
- ### Phase 5 - MAJOR RELEASE [IRREVERSIBLE, explicit founder go]
112
- - Full CLAUDE.md release workflow: 14-file version bump, CHANGELOG major entry, dashboard rebuild,
113
- pre-publish validation, merge to main -> publish npm/Docker/Homebrew.
114
- - Post-release validation across all channels + both routes (as done for v7.129.4).
115
- - Cost: SMALL (mechanical, proven process from v7.129.4). The GO is the founder's.
116
-
117
- ---
118
-
119
- ## Recommended sequence + why
120
-
121
- 1. **Phase 1 first, always.** It converts existing work into a shipped, reviewed, green branch -
122
- the highest value for the least new spend, and it de-risks everything else.
123
- 2. Then the founder picks Phase 2 (PostHog) and/or Phase 3 items (harness intelligence) to fund -
124
- these are the "better in every direction" asks and each is independently costed.
125
- 3. Phase 4 (otel/deps) bundles into whichever phase touches CI next.
126
- 4. Phase 5 (publish) only when the founder says the accumulated phases are worth a major release.
127
-
128
- ## Cost discipline (per the standing directives)
129
- - Ultrathink each phase's plan + advisor review before its implementation.
130
- - Ultracode (surgical workflow) for the implementation where parallelism pays - NOT for planning.
131
- - Every phase ends in a SHIPPED/committed/verified artifact, never another doc.
132
- - No `git add -A`; per-theme individual staging; repo-local asklokesh identity; explicit go before
133
- any irreversible publish.
134
-
135
- ## The one thing to decide now
136
- The founder's call that unblocks everything: **the CHANGELOG-vs-WIP scope question (A vs B) + confirm
137
- Phase 1 as the start.** Everything downstream flows from that.
@@ -1,82 +0,0 @@
1
- # v8 overnight execution plan (2026-07-25)
2
-
3
- Autonomous session. Founder asleep ~8h. Standing authorization: make the
4
- architectural calls, validate everything, commit and push verified increments.
5
-
6
- ## Governing principles
7
-
8
- 1. **Already-exists check FIRST on every item.** It has been right 5 times out
9
- of 5 this session (evidence-in-PR, offline verifier, stuck signals, signing,
10
- fail-closed SDK). The research corpus is consistently more confident than
11
- correct.
12
- 2. **"Don't overwhelm users" is an architectural constraint, not a preference.**
13
- Every new env var is user-facing complexity. Prefer: safe default, honest
14
- degradation, structured event for operators, NO new knob. If the safe
15
- behavior can be the default, make it the default.
16
- 3. **Never mark done what is not verified.** A test that passes against the
17
- pre-change code proves nothing; every behavioral change gets the
18
- revert-and-confirm-it-fails treatment.
19
- 4. **Gate on the CI verdict line, never the exit code.**
20
- 5. **`bun run build` after every `loki-ts/src` edit** - the shipped package runs
21
- `dist`, not `src`.
22
-
23
- ## Order (by reversibility, not task number)
24
-
25
- | # | Item | Shape | Status |
26
- |---|---|---|---|
27
- | 11 | SDK capability-degradation event | small increment | premise mostly satisfied |
28
- | 10 | Phase-0 runtime-truth audit | docs from source | gates 12 |
29
- | 12 | Flip SDK default | TESTS first, flip only if green | conditional |
30
- | 18 | Typed run journal | MEASURE first | may collapse |
31
- | 20 | First-4-min preview | MEASURE first | may collapse |
32
- | 17 | Workspace isolation | interface + Local adapter | Docker = design only |
33
- | 23 | Helm/RBAC/SSO | real, testable offline | helm lint / kubeval |
34
- | 15 | npm SDK | build fully, DO NOT PUBLISH | founder gate |
35
- | 22 | Managed cloud | design doc only | blocked on P0 results |
36
- | 24 | SWE-bench RESOLUTION | DO NOT RUN | ~$950 spend, deferred |
37
-
38
- ## Hard stops (will NOT do autonomously)
39
-
40
- - **#15 npm publish.** Building the package is in scope; `npm publish` is
41
- outward-facing and irreversible. "Commit and push" authorized the feature
42
- branch, not the public registry. The publish command is left for the founder.
43
- - **#24 SWE-bench RESOLUTION run.** 119 pinned instances at
44
- `LOKI_BUDGET_LIMIT=8` is up to ~$950 of real spend, on a benchmark the
45
- approved plan already marks DEFERRED by founder decision.
46
- - **Merge to main / publish 8.0.0.** Standing hard founder gate.
47
-
48
- ## #12 authorization, stated precisely
49
-
50
- The approved plan says: do not flip until parity AND recovery tests pass. That
51
- is a CONDITIONAL authorization, so #12's real content is writing those tests
52
- (acceptance #1 SDK-full with the claude binary absent, #7 SIGKILL recovery, #8
53
- resume does not repeat irreversible actions, plus both-route parity). If they
54
- pass, flipping executes the founder's decision. If any fail, do not flip and
55
- name the blocker.
56
-
57
- ## Findings that reshaped the queue
58
-
59
- **#11 is nearly done already.** `autonomous.ts:356 requireModule()` is fail-fast
60
- (a load-bearing module that cannot load is a fatal contract violation, not a
61
- silent stub). `providers.ts:559-640` is fail-closed: no CLI fallback,
62
- `exitCode=1` on throw, and `sawResult ? res.exitCode : 1` so a stream that never
63
- produced a terminal result cannot be counted as success. The SDK path's MAIN
64
- LOOP has no `claude`-binary dependency.
65
-
66
- **Scope stated exactly, 2026-07-26.** `providers.ts:570` delegates every
67
- non-mainLoop call back to `claudeProvider()`, which reaches the binary via
68
- `ensureClaudeHelpCache()`. But that is the `LOKI_SDK_MODE=off` path, and
69
- reading it alone to mean "the judge path shells out to claude" is wrong:
70
- under `judges`/`full`, `sdkModeDefaults()` enables all seven `JUDGE_VARS` and
71
- those sites have their own raw-SDK bridges. `completion-council.sh:2910` says
72
- so directly -- the raw-SDK vote path "needs no claude binary" (its precondition
73
- is bun plus the bridge), falling closed to `claude` only on an SDK miss.
74
-
75
- So under `LOKI_SDK_MODE=full` BOTH the loop and the judges have binary-free
76
- paths; the residual CLI dependency is off-mode delegation plus the fail-closed
77
- fallback. Pinned by
78
- `loki-ts/tests/runner/acceptance_sdk_binary_absent.test.ts`.
79
-
80
- The genuine remaining gap is OBSERVABILITY: an SDK load/stream failure is
81
- written into captured text, not emitted as a structured capability-degradation
82
- event an operator can alert on. That is the increment.
@@ -1,129 +0,0 @@
1
- # Claude Agent SDK Research (TypeScript) - for the v8 Loki migration
2
-
3
- Sources: live docs `code.claude.com/docs/en/agent-sdk` + `/agent-sdk/typescript` (WebFetch, today); installed `claude` v2.1.207 `--help`; and the **actual unpacked `@anthropic-ai/claude-agent-sdk@0.3.207` tarball** (published 3 days ago) - `sdk.d.ts` (6923 lines), `package.json`, `sdk.mjs`. Every API shape below was verified against the real `.d.ts`, not just docs (WebFetch invented a few types - those are flagged UNVERIFIED). Package repo: `github.com/anthropics/claude-agent-sdk-typescript`.
4
-
5
- ## THE ONE FINDING THAT REFRAMES THE FOUNDER'S PREMISE (verified, load-bearing)
6
-
7
- **The Claude Agent SDK does NOT remove the `claude` binary dependency. It IS the `claude` binary, wrapped as a subprocess.**
8
-
9
- Primary-source evidence from the 0.3.207 tarball:
10
- - `package.json`: `"dependencies": {}` but `"optionalDependencies"` ships **8 platform-specific native Claude Code binaries** (`@anthropic-ai/claude-agent-sdk-{linux,darwin,win32}-{x64,arm64}[-musl]@0.3.207`).
11
- - `sdk.mjs` imports `node:child_process` and calls `spawn()` (2 call sites, 291 refs to `claude`, 13 to `claude-code`).
12
- - `Options` exposes `executable?: 'bun'|'deno'|'node'`, `pathToClaudeCodeExecutable?: string`, `executableArgs`, and `spawnClaudeCodeProcess?: (o) => SpawnedProcess` - all subprocess-management knobs. There's even an `extractFromBunfs()` export whose only job is to locate the embedded `claude` binary when you `bun build --compile`.
13
- - Docs confirm: *"The TypeScript SDK bundles a native Claude Code binary for your platform as an optional dependency."* README: *"The Claude Code SDK is now the Claude Agent SDK."* - it's a rename of the Claude Code SDK.
14
-
15
- **Implication for the founder requirements.** Adopting `@anthropic-ai/claude-agent-sdk` gives Loki a first-class TS library, structured messages, in-process tools, and the full Claude Code harness - but it does **not** deliver the stated KEY strategic win (removing the CLI binary / "just an API key" containers). The binary is bundled instead of PATH-installed (so: no interactive login, no separate `claude` install step, no user-managed version drift - the SDK pins its own binary), but a native Claude Code executable still runs as a child process in every container. It's still "Claude Code," just vendored and spawned by your code instead of shelled out to on PATH.
16
-
17
- If "NO claude binary at all, pure API calls" is a hard requirement, the surface that actually delivers it is **`@anthropic-ai/sdk` (the Client SDK, v0.111.0)** - pure HTTPS to `api.anthropic.com`, zero binary - but then Loki owns the agent loop, tools, context management, and permissions itself (which RARV-C/run.sh largely already does). Or **Managed Agents** (Anthropic hosts the loop + sandbox; REST only). This is the real architectural fork; recommend surfacing it to the founder before committing.
18
-
19
- ---
20
-
21
- ## 1. Core primitives (verified against `sdk.d.ts`)
22
-
23
- **Entry point - `query()` (sdk.d.ts:2527):**
24
- ```ts
25
- export declare function query(_params: {
26
- prompt: string | AsyncIterable<SDKUserMessage>;
27
- options?: Options;
28
- }): Query;
29
- ```
30
- - `prompt: string` = one-shot. `prompt: AsyncIterable<SDKUserMessage>` = streaming-input mode (enables mid-session control methods).
31
- - Returns a `Query` (below); you `for await (const message of query(...))` to drive the agentic loop. The SDK runs the whole Reason→Act tool-use loop internally - you don't write the `while stop_reason === 'tool_use'` loop (that's the explicit contrast the docs draw vs the Client SDK).
32
-
33
- **`Query` interface (sdk.d.ts:2230) - `extends AsyncGenerator<SDKMessage, void>`** with control methods (all verified present):
34
- `interrupt()`, `setPermissionMode(mode)`, `setModel(model?)`, `setMaxThinkingTokens(n, display?)`, `applyFlagSettings(settings)`, `supportedModels()`, `supportedAgents()`, `supportedCommands()`, `mcpServerStatus()`, `setMcpServers()`, `reconnectMcpServer()`, `toggleMcpServer()`, `rewindFiles(userMessageId, {dryRun?})`, `streamInput(stream)`, `initializationResult()`, `reinitialize()`, `close()`. Mid-session setters (`setModel`, `setPermissionMode`, `applyFlagSettings`) work **only in streaming-input mode**.
35
-
36
- **Custom tools - `tool()` (sdk.d.ts:6745) + `createSdkMcpServer()` (sdk.d.ts:467):**
37
- ```ts
38
- export declare function tool<Schema extends AnyZodRawShape>(
39
- _name, _description, _inputSchema: Schema,
40
- _handler: (args: InferShape<Schema>, extra) => Promise<CallToolResult>,
41
- _extras?: { annotations?: ToolAnnotations }
42
- ): SdkMcpToolDefinition<Schema>;
43
-
44
- export declare function createSdkMcpServer(_options: CreateSdkMcpServerOptions): McpSdkServerConfigWithInstance;
45
- ```
46
- Tools are **in-process** (Zod-schema'd TS functions), bundled into an SDK MCP server, passed via `options.mcpServers`. This is how Loki would expose its own tools (queue, memory, council) to the agent without a separate MCP process - a genuine enhancement over shelling out.
47
-
48
- **Built-in tools (no implementation needed):** Read, Write, Edit, Bash, Monitor, Glob, Grep, WebSearch, WebFetch, AskUserQuestion, Agent (subagent invocation), + MCP. Gated by `allowedTools`/`disallowedTools`/`tools`.
49
-
50
- **Subagents / multi-agent - `options.agents: Record<string, AgentDefinition>` (sdk.d.ts:1327):**
51
- ```ts
52
- type AgentDefinition = {
53
- description: string; prompt: string;
54
- tools?: string[]; disallowedTools?: string[];
55
- model?: string; // alias, full id, or "inherit"
56
- mcpServers?: AgentMcpServerSpec[]; skills?: string[];
57
- maxTurns?: number; background?: boolean;
58
- memory?: 'user'|'project'|'local';
59
- effort?: 'low'|'medium'|'high'|'xhigh'|'max'|number;
60
- permissionMode?: PermissionMode;
61
- initialPrompt?: string; /* + experimental fields */
62
- };
63
- ```
64
- Subagents invoked via the `Agent` tool (include `"Agent"` in `allowedTools` to auto-approve). Messages from a subagent carry `parent_tool_use_id` so you can attribute them. This maps cleanly onto Loki's dev-fleet/council pattern - but note it's **one level deep** and runs subagents within the same host process, unlike Loki's current parallel-Task fan-out.
65
-
66
- **Memory/context:** three layers. (a) `CLAUDE.md`/`.claude/` loaded via `settingSources` (`'user'|'project'|'local'`). (b) Automatic context compaction is built into the Claude Code harness the SDK spawns. (c) `AgentDefinition.memory` + Skills (`.claude/skills/*/SKILL.md`, `options.skills`). There is no separate vector-memory primitive - Loki's `memory/` Python package has no SDK equivalent; you'd wire it in as SDK MCP tools or hooks.
67
-
68
- **Hooks:** `options.hooks` - `PreToolUse`, `PostToolUse`, `Stop`, `SessionStart`, `SessionEnd`, `UserPromptSubmit`, etc., as in-process callbacks (validate/block/transform/log). Good fit for Loki's quality gates and telemetry.
69
-
70
- ## 2. Session continuity (verified)
71
- - `options.resume?: string` (session id), `options.continue?: boolean` (most recent), `options.forkSession?: boolean`, `options.resumeSessionAt?: string` (resume at a specific message UUID), `options.sessionId?: string` (pin a UUID), `options.persistSession?: boolean`.
72
- - Session id comes from the `system`/`init` message (`message.session_id`) on the first query; pass it as `resume` on the next.
73
- - Storage: **JSONL on your filesystem** (docs confirm; helpers `listSessions()`, `getSessionMessages()`, `getSessionInfo()`, `renameSession()`, `tagSession()`). `options.sessionStore` can mirror transcripts to an external backend.
74
- - Maps to the CLI's `--resume`/`--session-id`/`--continue`/`--fork-session`/`--resume-session-at` (all present in `claude --help`). This is a strict superset of Loki's current CLI-flag resume usage.
75
-
76
- ## 3. Structured output (verified - direct CLI `--json-schema` equivalent)
77
- ```ts
78
- outputFormat?: OutputFormat; // sdk.d.ts:1686
79
- type OutputFormat = JsonSchemaOutputFormat; // :2016
80
- type JsonSchemaOutputFormat = { type: 'json_schema'; schema: Record<string, unknown> }; // :898
81
- ```
82
- Result lands on **`SDKResultSuccess.structured_output?: unknown`** (sdk.d.ts). There's a dedicated error subtype `error_max_structured_output_retries`, so the harness retries to satisfy the schema. This is the exact analog of the CLI's `--json-schema` flag. **Yes, fully supported.**
83
-
84
- ## 4. Budget / effort / model / fallback (verified - direct CLI-flag parity)
85
- | Need | Agent SDK option | CLI flag |
86
- |---|---|---|
87
- | Budget cap | `maxBudgetUsd?: number` → error subtype `error_max_budget_usd` | `--max-budget-usd` |
88
- | Effort | `effort?: 'low'\|'medium'\|'high'\|'xhigh'\|'max' \| number` (also runtime `applyFlagSettings({effortLevel})`) | `--effort` |
89
- | Model | `model?: string` (alias/full id; runtime `setModel()`) | `--model` |
90
- | Fallback | `fallbackModel?: string` | `--fallback-model` |
91
- | Turn cap | `maxTurns?: number` → `error_max_turns` | (SDK/`--max-turns`) |
92
- | Task budget | `taskBudget?: { total: number }` → sent as API `output_config.task_budget` + beta header `task-budgets-2026-03-13` | - |
93
- | Thinking | `thinking?: ThinkingConfig` (`maxThinkingTokens` deprecated) | - |
94
- | Betas | `betas?: SdkBeta[]` - only `'context-1m-2025-08-07'` is valid | `--betas` |
95
-
96
- Result message carries `total_cost_usd`, `usage` (NonNullableUsage), `modelUsage: Record<string, ModelUsage>`, `num_turns`, `duration_ms/api_ms`, `permission_denials` - richer cost/telemetry than parsing CLI stdout. **Every CLI control Loki uses has a typed SDK option.**
97
-
98
- ## 5. The "outcome" / Managed-Agents primitive vs RARV-C (honest assessment)
99
- There is **no `outcome` primitive in the Agent SDK.** The closest thing is the SDK's built-in agent loop bounded by `maxTurns` / `maxBudgetUsd` / `taskBudget` / structured-output retries - an *effort/budget-bounded* loop, **not** an iterate-until-a-grader-says-done loop.
100
-
101
- The grader-driven "iterate until an independent rubric passes" primitive is **Managed Agents' Outcomes** (`user.define_outcome` + rubric + `max_iterations`, with `span.outcome_evaluation_*` events and a separate grader model) - a **different product** (hosted REST API, `client.beta.sessions.*` on `@anthropic-ai/sdk`), not the Agent SDK. Per the docs' own comparison table, Managed Agents runs the loop + sandbox on Anthropic infra; the Agent SDK runs in your process.
102
-
103
- **Honest verdict:** RARV-C already *is* Loki's home-grown Outcomes equivalent (iterate → grade via council → close). Neither the Agent SDK nor Managed Agents Outcomes maps onto it 1:1. Do **not** fabricate a wiring where the SDK "provides" RARV-C - the SDK provides a bounded tool-use loop; the grader/council closure stays Loki's. Managed Agents Outcomes is the nearest hosted analog but would mean re-platforming completion onto Anthropic's grader (out of scope, and would cede Loki's council).
104
-
105
- ## 6. Runtime / auth / cost (verified)
106
- - **Runtime:** Node, Bun, or Deno - `executable?: 'bun'|'deno'|'node'`. TS SDK bundles the native binary per platform (no separate `claude` install). Python variant (`claude-agent-sdk`) needs Python ≥3.10.
107
- - **Auth:** `ANTHROPIC_API_KEY` (docs). Also Bedrock (`CLAUDE_CODE_USE_BEDROCK=1`), Claude Platform on AWS (`CLAUDE_CODE_USE_ANTHROPIC_AWS=1` + `ANTHROPIC_AWS_WORKSPACE_ID`), Vertex (`CLAUDE_CODE_USE_VERTEX=1`), Foundry (`CLAUDE_CODE_USE_FOUNDRY=1`). **Anthropic explicitly prohibits third-party products from using claude.ai login / subscription rate limits via the Agent SDK - API-key auth only.** No interactive login (a real improvement over the CLI's OAuth `claude auth`).
108
- - **Cost:** standard per-token API billing (surfaced live as `total_cost_usd` on the result). Same underlying `/v1/messages` cost as the CLI - the CLI's cost is API cost; the SDK doesn't change the cost model, it just reports it structurally.
109
-
110
- ## 7. Honest gaps (what each does that the other doesn't)
111
-
112
- **Agent SDK gains over Loki's `claude -p` wrapper:**
113
- - Typed streaming messages (`SDKMessage` union) instead of stdout parsing; structured `SDKResultSuccess`/`SDKResultError` with cost/usage/`structured_output`.
114
- - In-process custom tools (`tool()`), in-process hooks, programmatic subagents (`agents`), programmatic MCP.
115
- - Mid-session control (`interrupt`, `setModel`, `setPermissionMode`, `applyFlagSettings`, `streamInput`, `rewindFiles`) - no equivalent when you shell out to `claude -p`.
116
- - `startup()`/`WarmQuery` for low-latency warm spares.
117
-
118
- **Provider-agnostic caveat (per founder's constraint):** the Agent SDK is Anthropic/Claude-Code-specific. It does NOT give Loki Codex/Cline/Aider. Those routes need their own story (the OpenAI-compatible layer, explicitly out of scope here). Note the Agent SDK *can* target Bedrock/Vertex/Foundry via env vars, but that's still Claude models.
119
-
120
- **What the Agent SDK does NOT do / gaps vs the premise:**
121
- - **Does not remove the native binary** (finding above) - it spawns a bundled Claude Code executable per platform. "Library, just an API key, no binary" is only true of `@anthropic-ai/sdk` (Client SDK).
122
- - No grader/Outcomes primitive (RARV-C stays Loki's; §5).
123
- - No built-in vector memory (Loki's `memory/` package has no SDK analog; wire via MCP/hooks).
124
- - Only one valid `SdkBeta` (`context-1m-2025-08-07`) - other API betas (fast-mode, compaction, etc.) aren't first-class SDK options.
125
- - WebFetch-only claims I could NOT verify in the `.d.ts` and mark **UNVERIFIED**: the exact `SDKAssistantMessage`/`SDKPartialAssistantMessage` content-block shapes, `ThinkingConfig` as a 3-variant union, and `CanUseTool`'s full options object. The `thinking?: ThinkingConfig` field, `includePartialMessages?: boolean`, and `canUseTool?: CanUseTool` fields **are** confirmed present; their inner shapes should be re-read from `sdk.d.ts` before you write code against them.
126
-
127
- Verified type-def file (kept for the implementer): `/private/tmp/claude-501/-Users-lokesh-git-lokimode-anthropic/8db286db-3006-49f5-9dc6-cb241e559d45/scratchpad/package/sdk.d.ts` (line refs above are from this file, v0.3.207).
128
-
129
- **Recommendation to fold into the v8 plan:** the migration decision is not "Agent SDK vs bash" - it's a three-way fork (Agent SDK = bundled binary + full harness; Client SDK = pure API, Loki owns the loop; Managed Agents = hosted loop+sandbox+Outcomes). Only the Client SDK path delivers the founder's stated "no binary, API-key-only container" win, at the cost of re-owning the loop Loki mostly already owns. Surface this explicitly before locking scope.
@@ -1,106 +0,0 @@
1
- # Welcome Opener Plan (the "magic opener")
2
-
3
- ## Goal
4
- A polished welcome experience shown when people install the loki CLI or
5
- run the Docker image. It (1) introduces Loki/Autonomi with the dashboard's
6
- design language, (2) subtly highlights the research backing + memory
7
- compounding moat, (3) offers a simple opt-in form collecting anonymous
8
- role / business / tools, transmitted to PostHog on click, and (4) links to
9
- autonomi.dev/docs.
10
-
11
- ## Hard constraints (from the user + CLAUDE.md)
12
- - Anonymous usage analytics for PRODUCT IMPROVEMENT ONLY. NEVER transmit
13
- prompts, PRDs, code, or any project content. Disclosed, not covert.
14
- - Reuse the EXISTING PostHog contract already in the codebase:
15
- - host `https://us.i.posthog.com`, path `/capture/`
16
- - public ingest key `phc_ya0vGBru41AJWtGNfZZ8H9W4yjoZy4KON0nnayS7s87`
17
- (same key postinstall.js + autonomy/telemetry.sh already use; public
18
- ingest keys are safe in client code), overridable by LOKI_POSTHOG_KEY.
19
- - Honor opt-out: LOKI_TELEMETRY_DISABLED=true and DO_NOT_TRACK=1.
20
- - Design must match the loki dashboard: accent #553DE9, light bg #FAFAF7 /
21
- dark #0F0B1A, text #1A1614 / #F0ECF8, fonts DM Serif Display (headings),
22
- Inter (body), JetBrains Mono (mono). Glass cards. Light + dark.
23
- - No emojis, no em dashes anywhere.
24
-
25
- ## Components
26
-
27
- ### 1. web-app-less static page: `assets/welcome/welcome.html`
28
- Self-contained single HTML file (inline CSS + JS, Google Fonts link), so
29
- it works opened directly from disk OR served. Sections:
30
- - Hero: "Loki Mode by Autonomi" + tagline "Describe it. Walk away. Get
31
- working, tested software." + version (templated at serve time or left
32
- generic).
33
- - Three subtle highlight cards: (a) RARV-C closure + unanimous council
34
- ("finishes the work, verified"), (b) Cross-project memory that compounds
35
- ("your agents stop repeating mistakes across projects"), (c) Research
36
- backing (Anthropic Constitutional AI / DeepMind debate / OpenAI Agents
37
- SDK / NVIDIA ToolOrchestra) shown as small footnote-style chips, not
38
- loud claims.
39
- - Opt-in form: role (select), company size (select), primary tools
40
- (multi-select chips: Claude Code, Cursor, Codex, Copilot, Cline, Aider,
41
- other). A single "Send + get started" button. Consent line directly
42
- under it: "Sends anonymous usage analytics (your role, company size,
43
- tools) to help us improve the product. We never collect your prompts,
44
- PRDs, or code. Opt out anytime with LOKI_TELEMETRY_DISABLED=true."
45
- - CTA row: "Read the docs" -> https://www.autonomi.dev/docs ; "Quick
46
- start" copyable `loki start ./prd.md`.
47
- - On submit: POST to us.i.posthog.com/capture/ with event
48
- `welcome_profile`, distinct_id = the existing ~/.loki-telemetry-id (or a
49
- fresh uuid in browser localStorage if not injected), properties =
50
- {role, company_size, tools, source:'welcome_opener', loki_version}.
51
- Then show a thank-you state + the docs link. Submission is the ONLY
52
- network call; nothing is sent on page load.
53
- - Respect opt-out: if the page is served with ?telemetry=off (the CLI
54
- passes this when LOKI_TELEMETRY_DISABLED/DO_NOT_TRACK is set), the form
55
- is replaced with a "analytics disabled" note and the submit is a no-op.
56
-
57
- ### 2. CLI command: `loki welcome`
58
- - Mirrors cmd_dashboard_open idiom. Resolves the welcome.html path inside
59
- the package, opens it with `open`/`xdg-open`. If no browser opener
60
- (headless/Docker), prints the terminal fallback (see #4) + the file path
61
- + the autonomi.dev/docs URL.
62
- - Passes ?telemetry=off when opt-out env is set.
63
- - Dispatch: add `welcome) cmd_welcome "$@" ;;` near the `demo)` case
64
- (~autonomy/loki:12505) and a help line.
65
-
66
- ### 3. First-run auto-open (once)
67
- - Marker file: `~/.loki/.welcomed`. On first `loki start` (and at end of
68
- postinstall when a browser is available + not CI + not opt-out), if the
69
- marker is absent: open the welcome page once, then write the marker.
70
- Never auto-open again. CI/non-TTY/Docker never auto-open a browser; they
71
- only print the terminal welcome.
72
- - postinstall.js already prints an install summary; append a one-line
73
- "Run `loki welcome` for a quick tour" pointer (no auto browser launch in
74
- postinstall to avoid surprising npm installs).
75
-
76
- ### 4. Terminal fallback
77
- - A clean ASCII/ANSI welcome (loki accent color) printed when no browser:
78
- product one-liner, the 3 highlights as one line each, the docs URL, the
79
- quick-start command, and the consent/opt-out line. No network call from
80
- the terminal fallback (the form is browser-only; terminal just informs).
81
-
82
- ## Files
83
- - ADD `assets/welcome/welcome.html`
84
- - ADD `assets/welcome/welcome.terminal.sh` (sourced helper that prints the
85
- terminal welcome) OR inline in cmd_welcome.
86
- - EDIT `autonomy/loki`: cmd_welcome + dispatch + help + first-run hook in
87
- cmd_start.
88
- - EDIT `bin/postinstall.js`: add the "Run `loki welcome`" pointer line.
89
- - EDIT `package.json` "files": add `assets/`.
90
- - EDIT `Dockerfile`, `Dockerfile.sandbox`: COPY assets/.
91
- - ADD `tests/test-welcome-opener.sh`.
92
- - Version bump 14 locations + CHANGELOG.
93
-
94
- ## Privacy test matrix (must pass)
95
- - Page load makes ZERO network calls (only submit does).
96
- - Submit payload contains ONLY {role, company_size, tools, source,
97
- loki_version, distinct_id}; never any file/prompt/PRD content.
98
- - LOKI_TELEMETRY_DISABLED=true and DO_NOT_TRACK=1 each => form disabled,
99
- no capture.
100
- - `loki welcome` works headless (terminal fallback, no browser error).
101
- - First-run marker opens once and not again.
102
-
103
- ## Honesty
104
- Highlights cite real, documented research (already in README Research
105
- Foundation) and frame the memory moat as "retrieval/compounding," NOT a
106
- claimed task-success number (consistent with prior honesty fixes).