loki-mode 11.2.2 → 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 (216) 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/skill-link-heal.sh +78 -1
  11. package/autonomy/lib/voter-agents.sh +1 -1
  12. package/autonomy/loki +99 -75
  13. package/autonomy/run.sh +30 -18
  14. package/autonomy/sandbox.sh +1 -1
  15. package/autonomy/tui.sh +6 -5
  16. package/autonomy/verify.sh +1 -1
  17. package/bin/loki +166 -59
  18. package/completions/_loki +2 -0
  19. package/completions/loki.bash +2 -2
  20. package/dashboard/__init__.py +1 -1
  21. package/dashboard/server.py +25 -31
  22. package/docs/ARCHITECTURE.md +337 -0
  23. package/docs/BRANDING.md +124 -0
  24. package/docs/CLI-REFERENCE.md +7 -1
  25. package/docs/COMPONENTS.md +447 -0
  26. package/docs/DEPLOYMENT.md +9 -9
  27. package/docs/DOCKER.md +469 -0
  28. package/docs/INSTALLATION.md +67 -1045
  29. package/docs/KNOWN-ISSUES.md +11 -35
  30. package/docs/TESTING.md +161 -0
  31. package/docs/air-gapped.md +1 -2
  32. package/docs/alternative-installations.md +14 -24
  33. package/docs/architecture/DECISIONS.md +333 -0
  34. package/docs/audit-logging.md +7 -7
  35. package/docs/authentication.md +3 -3
  36. package/docs/authorization.md +1 -1
  37. package/docs/certification/04-production-deployment/lab.md +6 -6
  38. package/docs/certification/04-production-deployment/lesson.md +4 -4
  39. package/docs/certification/README.md +1 -1
  40. package/docs/control-plane-container.md +2 -2
  41. package/docs/dev/real-run.md +34 -0
  42. package/docs/dev/release-checklist.md +2 -2
  43. package/docs/exit-codes.md +3 -3
  44. package/docs/git-workflow.md +3 -3
  45. package/docs/metrics.md +37 -55
  46. package/docs/network-security.md +1 -1
  47. package/docs/siem-integration.md +5 -5
  48. package/docs/v10/CLI-MODERN.md +4 -3
  49. package/docs/v10/DECISIONS.md +44 -0
  50. package/docs/v10/DEPS.md +22 -22
  51. package/docs/v10/ENGINE.md +1 -1
  52. package/docs/v10/FAILURE-CLASSES.md +129 -1
  53. package/docs/v10/FOUNDER-QUEUE.md +1 -0
  54. package/docs/v10/GUARDS.md +13 -0
  55. package/docs/v10/LEGACY-REMOVAL.md +4 -6
  56. package/docs/v10/METRICS.md +2 -2
  57. package/docs/v10/MODERNIZE.md +1 -1
  58. package/docs/v10/OPERATING-MODEL.md +2 -1
  59. package/docs/v10/PROGRESS.md +29 -0
  60. package/docs/v11/COST-HALF.md +352 -0
  61. package/docs/v11/MARKET-SLICES.md +315 -0
  62. package/docs/v11/REGISTRIES.md +730 -0
  63. package/loki-ts/data/model-pricing.json +52 -24
  64. package/loki-ts/dist/loki.js +1036 -957
  65. package/mcp/__init__.py +1 -1
  66. package/package.json +1 -1
  67. package/packages/control-plane/dist/server.js +2467 -736
  68. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  69. package/src/protocols/mcp-client.js +6 -2
  70. package/src/protocols/mcp-server.js +13 -3
  71. package/tools/audit-docs.py +1 -1
  72. package/web-app/dist/assets/{AdminPage-C-iMLNxe.js → AdminPage-CMkHNJbF.js} +1 -1
  73. package/web-app/dist/assets/{Avatar-C7VUvwsO.js → Avatar-BJyjV7Zi.js} +1 -1
  74. package/web-app/dist/assets/{Badge-tGvQEhnw.js → Badge-D572l0uq.js} +1 -1
  75. package/web-app/dist/assets/{Button-_iHlH_yL.js → Button-T4BnOZgl.js} +1 -1
  76. package/web-app/dist/assets/{CockpitPage-J_nNjbcR.js → CockpitPage-Cj_GFsNn.js} +1 -1
  77. package/web-app/dist/assets/{ComparePage-B05ui6Xt.js → ComparePage-A8m4ZXak.js} +1 -1
  78. package/web-app/dist/assets/{ErrorBoundary-Bxex6DLn.js → ErrorBoundary-hugCg5yg.js} +1 -1
  79. package/web-app/dist/assets/{EvidenceReceiptPanel-BsgWfdD1.js → EvidenceReceiptPanel-CuJKDC2G.js} +1 -1
  80. package/web-app/dist/assets/{GitHubIssuesPanel-DZBhZ8_X.js → GitHubIssuesPanel-BYGKjarC.js} +1 -1
  81. package/web-app/dist/assets/{GitHubPRsPanel-BaxlAl6R.js → GitHubPRsPanel-c7sFIJlf.js} +1 -1
  82. package/web-app/dist/assets/{HomePage-mVJvzqbF.js → HomePage-A1MIkG2P.js} +2 -2
  83. package/web-app/dist/assets/{LoginPage-B0zd4A_G.js → LoginPage-8KQMRhtR.js} +1 -1
  84. package/web-app/dist/assets/{MagicPage-DXLQ-y_R.js → MagicPage-C05QW2Lx.js} +1 -1
  85. package/web-app/dist/assets/{MetricsPage-CLS34Xvr.js → MetricsPage-Oukv5hme.js} +1 -1
  86. package/web-app/dist/assets/{NotFoundPage-BXG8PbNV.js → NotFoundPage-DKIwsawz.js} +1 -1
  87. package/web-app/dist/assets/{ProjectPage-D3kFFC0F.js → ProjectPage-DwFRPLCG.js} +3 -3
  88. package/web-app/dist/assets/{ProjectsPage-2bFn-gnC.js → ProjectsPage-CgY4YYDX.js} +1 -1
  89. package/web-app/dist/assets/{SettingsPage-CBM0ziWE.js → SettingsPage-BpfcSjUA.js} +1 -1
  90. package/web-app/dist/assets/{ShowcasePage-BTaXhjI3.js → ShowcasePage-BqBakC4K.js} +1 -1
  91. package/web-app/dist/assets/{SystemSettingsPage-BrC2hyAr.js → SystemSettingsPage-CZLu5VB0.js} +1 -1
  92. package/web-app/dist/assets/{TeamsPage-oqxdbVbY.js → TeamsPage-D55S1jKz.js} +1 -1
  93. package/web-app/dist/assets/{TemplatesPage-CEbUIY21.js → TemplatesPage-D3SydvxN.js} +1 -1
  94. package/web-app/dist/assets/{TerminalOutput-aIoWLbJA.js → TerminalOutput-hNg8G1-e.js} +1 -1
  95. package/web-app/dist/assets/{activity-CPyi45gt.js → activity-D2C0VagO.js} +1 -1
  96. package/web-app/dist/assets/{bell-BhaNBaJp.js → bell-CMvYi36w.js} +1 -1
  97. package/web-app/dist/assets/{bot-Da8REaEP.js → bot-BvtQ6lmo.js} +1 -1
  98. package/web-app/dist/assets/{check-DPj99ArM.js → check-B13xkXed.js} +1 -1
  99. package/web-app/dist/assets/{chevron-left-CkxonN0X.js → chevron-left-emu6r49E.js} +1 -1
  100. package/web-app/dist/assets/{circle-alert-C0JkB1y5.js → circle-alert-CExlwjuy.js} +1 -1
  101. package/web-app/dist/assets/{clock-COzFIiWi.js → clock-D7Uas3oL.js} +1 -1
  102. package/web-app/dist/assets/{cloud-bjkac4kn.js → cloud-CkB4S86C.js} +1 -1
  103. package/web-app/dist/assets/{code-xml-hlKlvXUJ.js → code-xml-SL9IIWIn.js} +1 -1
  104. package/web-app/dist/assets/{database-D555S5Km.js → database-BQFkd7t1.js} +1 -1
  105. package/web-app/dist/assets/{dollar-sign-CVcApzcD.js → dollar-sign-qHmnNYsU.js} +1 -1
  106. package/web-app/dist/assets/{file-code-corner-UORaMIcO.js → file-code-corner-C2YUDP0K.js} +1 -1
  107. package/web-app/dist/assets/{file-plus-ALJtDoI2.js → file-plus-C_ooIkDe.js} +1 -1
  108. package/web-app/dist/assets/{globe-CPlrM_IC.js → globe-CQ-GL485.js} +1 -1
  109. package/web-app/dist/assets/{hammer-qaGZHpja.js → hammer-U05L_D7V.js} +1 -1
  110. package/web-app/dist/assets/{index-BcXljIAO.js → index-CooHd7I-.js} +3 -3
  111. package/web-app/dist/assets/{layers-BV8R9VUK.js → layers-Buo17rjW.js} +1 -1
  112. package/web-app/dist/assets/{loader-circle-6TlDS9Tu.js → loader-circle-15vK3oV1.js} +1 -1
  113. package/web-app/dist/assets/{lock-B9t6oWI0.js → lock-BeXLebuJ.js} +1 -1
  114. package/web-app/dist/assets/{package-2gEUAtZJ.js → package-MVh_6-6R.js} +1 -1
  115. package/web-app/dist/assets/{plus-DXocxPjU.js → plus-Dh_nd9vS.js} +1 -1
  116. package/web-app/dist/assets/{refresh-cw-D3dWHBd6.js → refresh-cw-C9cBJEAT.js} +1 -1
  117. package/web-app/dist/assets/{rotate-ccw-CvuWqaSB.js → rotate-ccw-D3PAtzST.js} +1 -1
  118. package/web-app/dist/assets/{scroll-text-ktmD_xJY.js → scroll-text-DZCoXQjo.js} +1 -1
  119. package/web-app/dist/assets/{server-E7pZtj5A.js → server-OCOLI5J_.js} +1 -1
  120. package/web-app/dist/assets/{shield-alert-968j9z0V.js → shield-alert-oVhmf1_h.js} +1 -1
  121. package/web-app/dist/assets/{thumbs-up-Tz_8rpU_.js → thumbs-up-B-kbX4vN.js} +1 -1
  122. package/web-app/dist/assets/{trash-2-Drh9IIj8.js → trash-2-EL6moveW.js} +1 -1
  123. package/web-app/dist/assets/{trending-down-DCQXtVSL.js → trending-down-Cl3kjpsx.js} +1 -1
  124. package/web-app/dist/assets/{trending-up-BIiwQbWV.js → trending-up-DST7I6M2.js} +1 -1
  125. package/web-app/dist/assets/{upload-sCbPkfmy.js → upload-CUOT780G.js} +1 -1
  126. package/web-app/dist/assets/{usePolling-BMIg6ZVT.js → usePolling-Djmt90eb.js} +1 -1
  127. package/web-app/dist/assets/{user-kGzXC3V2.js → user-BRBohA6J.js} +1 -1
  128. package/web-app/dist/index.html +1 -1
  129. package/docs/ARCHITECTURE-OVERVIEW.md +0 -209
  130. package/docs/AUTONOMI-ECOSYSTEM.md +0 -107
  131. package/docs/COCKPIT-SPEC.md +0 -72
  132. package/docs/COCKPIT-UX-MANDATE.md +0 -53
  133. package/docs/COMPETITIVE-ANALYSIS.md +0 -303
  134. package/docs/COMPETITIVE-NEXT-10.md +0 -316
  135. package/docs/COMPETITIVE-RALPH-ZEROSHOT-2026-07-08.md +0 -81
  136. package/docs/DASHBOARD-9.12-EVIDENCE.md +0 -97
  137. package/docs/DASHBOARD-ARCHITECTURE.md +0 -425
  138. package/docs/DASHBOARD_V2_CHECKLIST.md +0 -243
  139. package/docs/DEMOS.md +0 -63
  140. package/docs/ENTERPRISE-IDENTITY-ROADMAP.md +0 -206
  141. package/docs/EVIDENCE-RECEIPT-BUILD-APPLICABILITY.md +0 -79
  142. package/docs/FEAT-PRDREUSE-DOCKER-PLAN.md +0 -144
  143. package/docs/GATE-FAILURE-TRIAGE.md +0 -254
  144. package/docs/HANDOFF-2026-08-03.md +0 -439
  145. package/docs/LOOP-CANDIDATE-PROPOSAL-v1.md +0 -167
  146. package/docs/LOOP-HARNESS-AUDIT.md +0 -684
  147. package/docs/MERGE-DEDUP-MAP.md +0 -420
  148. package/docs/MERGE-ROUTE-MAP.md +0 -139
  149. package/docs/MODEL-REGISTRY-PLAN.md +0 -155
  150. package/docs/OUTCOME-FRONTIER.md +0 -536
  151. package/docs/P2-SPEC-ROBUSTNESS-PLAN.md +0 -192
  152. package/docs/PLANS-INDEX.md +0 -32
  153. package/docs/PRD-REUSE-DONE-RECOGNITION-PLAN.md +0 -536
  154. package/docs/PROMPT-ABLATION-RESULT.md +0 -97
  155. package/docs/R4-TRUST-TRAJECTORY-DESIGN.md +0 -127
  156. package/docs/R5-AUTO-WIKI-DESIGN.md +0 -137
  157. package/docs/R6-ROLLBACK-CHECKPOINT-PLAN.md +0 -107
  158. package/docs/R7-ZERO-CONFIG-FIRST-RUN-PLAN.md +0 -137
  159. package/docs/R8-SHAREABLE-TEAM-ASSETS-PLAN.md +0 -129
  160. package/docs/R9-OPEN-CORE-HOOKS-PLAN.md +0 -113
  161. package/docs/RARV-C-100X-PLAN.md +0 -286
  162. package/docs/RARV-C-LOOP-EFFICIENCY-PLAN.md +0 -470
  163. package/docs/SHAREABLE-PROOF-PLAN.md +0 -194
  164. package/docs/SONNET5-DEFAULT-PLAN.md +0 -157
  165. package/docs/SPEED-AND-FIRST-PASS-PLAN.md +0 -281
  166. package/docs/STALE-STATE-AUDIT.md +0 -174
  167. package/docs/SYNERGY-TASKS.md +0 -143
  168. package/docs/TASKLIST-ACCURACY-PLAN.md +0 -355
  169. package/docs/TOP-100-BACKLOG.md +0 -159
  170. package/docs/V8-ACCEPTANCE-TRIAGE-2026-07-24.md +0 -114
  171. package/docs/V8-COMPLEXITY-AUDIT-2026-07-24.md +0 -45
  172. package/docs/V8-MAJOR-RELEASE-PLAN.md +0 -137
  173. package/docs/V8-OVERNIGHT-PLAN-2026-07-25.md +0 -82
  174. package/docs/V8-SDK-RESEARCH-RAW.md +0 -129
  175. package/docs/WELCOME-OPENER-PLAN.md +0 -106
  176. package/docs/adoption-baseline-2026-07-31.md +0 -84
  177. package/docs/architecture/bmad-integration-epic.md +0 -271
  178. package/docs/architecture/bmad-integration-review.md +0 -86
  179. package/docs/architecture/bmad-integration-validation.md +0 -249
  180. package/docs/architecture/bmad-loki-voice-agent-council-analysis.md +0 -61
  181. package/docs/auto-claude-comparison.md +0 -250
  182. package/docs/bug-fixes/agent-01-cli-fixes.md +0 -101
  183. package/docs/bug-fixes/agent-02-purplelab-fixes.md +0 -88
  184. package/docs/bug-fixes/agent-03-dashboard-fixes.md +0 -119
  185. package/docs/bug-fixes/agent-04-memory-fixes.md +0 -105
  186. package/docs/bug-fixes/agent-05-provider-fixes.md +0 -86
  187. package/docs/bug-fixes/agent-06-integration-fixes.md +0 -101
  188. package/docs/bug-fixes/agent-07-dash-run-fixes.md +0 -101
  189. package/docs/bug-fixes/agent-08-docker-fixes.md +0 -164
  190. package/docs/bug-fixes/agent-09-e2e-build-fixes.md +0 -69
  191. package/docs/bug-fixes/agent-10-e2e-fullstack-fixes.md +0 -102
  192. package/docs/bug-fixes/agent-11-e2e-session-fixes.md +0 -70
  193. package/docs/bug-fixes/agent-12-scenario-fixes.md +0 -120
  194. package/docs/bug-fixes/agent-13-enterprise-fixes.md +0 -143
  195. package/docs/bug-fixes/agent-14-uat-newuser-fixes.md +0 -88
  196. package/docs/bug-fixes/agent-15-uat-poweruser-fixes.md +0 -132
  197. package/docs/bug-fixes/agent-19-code-review.md +0 -316
  198. package/docs/bug-fixes/agent-20-architecture-review.md +0 -331
  199. package/docs/competitive/bolt-new-analysis.md +0 -579
  200. package/docs/competitive/emergence-others-analysis.md +0 -605
  201. package/docs/competitive/replit-lovable-analysis.md +0 -622
  202. package/docs/dashboard-guide.md +0 -487
  203. package/docs/enterprise/migration.md +0 -265
  204. package/docs/history/one-run-audit.md +0 -304
  205. package/docs/plans/FORGE-AUTONOMOUS-QUEUE.md +0 -312
  206. package/docs/plans/ULTRAPLAN-FORGE-BAAS.md +0 -612
  207. package/docs/plans/UT2-6-LSP-DIAGNOSTIC-BROADCAST.md +0 -394
  208. package/docs/prd-purple-lab-ide.md +0 -152
  209. package/docs/prd-purple-lab-platform-v2.md +0 -223
  210. package/docs/prd-purple-lab-platform.md +0 -319
  211. package/docs/retrospectives/v7.5.15-fleet-postmortem.md +0 -325
  212. package/docs/retrospectives/v7.5.15-honesty-audit.md +0 -136
  213. package/docs/retrospectives/v7.5.15-llm-failure-modes.md +0 -49
  214. package/docs/show-hn-post.md +0 -46
  215. package/docs/test-scenarios/enterprise-scenarios.md +0 -732
  216. package/docs/thick2thin.md +0 -173
@@ -1,61 +0,0 @@
1
- # BMAD Method x Loki Mode Voice Agent -- Council Analysis
2
-
3
- **Date:** 2026-02-25
4
- **Council:** 3 Opus reviewers (blind review)
5
- **Verdict:** Unanimous YES with phased approach
6
-
7
- ## Proposal Summary
8
-
9
- Integrate the BMAD Method (https://github.com/bmad-code-org/BMAD-METHOD) with Loki Mode
10
- to create a structured requirements elicitation pipeline. BMAD provides a 4-phase
11
- workflow (Analysis, Planning, Solutioning, Implementation) with agent personas, step-file
12
- architecture, and adversarial review -- complementing Loki Mode's autonomous execution engine.
13
-
14
- ## Council Findings
15
-
16
- ### Reviewer 1: Architecture Focus
17
-
18
- **Vote:** YES (phased)
19
-
20
- - BMAD's step-file architecture aligns with Loki's progressive disclosure model
21
- - BMAD artifacts (product-brief, PRD, architecture, epics) map cleanly to Loki's SDLC phases
22
- - Context budget is manageable: BMAD step files load one-at-a-time (~3K tokens each)
23
- - Integration surface is well-defined: `.loki/queue/`, `build_prompt()`, event bus
24
- - Risk: BMAD is an external dependency that may change format without notice
25
-
26
- ### Reviewer 2: Integration Feasibility
27
-
28
- **Vote:** YES (phased)
29
-
30
- - BMAD PRD output sections (Functional Requirements, Success Criteria, User Journeys)
31
- match most of prd-analyzer.py's existing dimension patterns
32
- - Agent overlap is complementary, not conflicting: BMAD covers pre-development, Loki covers execution
33
- - Voice.sh needs significant extension for structured dialogue (currently only 4-section dictation)
34
- - MIT license is fully compatible with Loki Mode's distribution
35
- - Risk: Voice agent layer (Phase 3) has highest uncertainty; STT reliability for technical terms
36
-
37
- ### Reviewer 3: Risk and Quality
38
-
39
- **Vote:** YES (phased, with gates)
40
-
41
- - Backward compatibility is achievable: BMAD integration is additive (new flag, new adapter)
42
- - Existing non-BMAD projects are untouched unless `--bmad-project` is explicitly used
43
- - Quality gates apply to all new code: 3-reviewer blind review, anti-sycophancy, test coverage
44
- - BMAD's adversarial review methodology strengthens Loki's existing quality gate system
45
- - Risk: Scope creep from Epic 2 (engine embedding) and Epic 3 (voice agent) -- phase gates essential
46
-
47
- ## Recommended Phased Approach
48
-
49
- | Phase | Epic | Priority | Risk |
50
- |-------|-------|----------|------|
51
- | P0 | BMAD Artifact Pipeline (parse, score, load) | Must-have | Low |
52
- | P1 | BMAD Engine Embedding (agent YAML parser, step processor) | Should-have | Medium |
53
- | P2 | Voice Agent Layer (structured dialogue, BMAD-to-voice) | Nice-to-have | High |
54
-
55
- ## Key Constraints
56
-
57
- 1. P0 must ship independently and prove value before P1/P2 begin
58
- 2. No runtime dependency on BMAD repo -- adapter reads BMAD output artifacts only
59
- 3. Zero regression on existing non-BMAD workflows
60
- 4. All code must pass existing 8-gate quality system
61
- 5. Context budget: BMAD additions must stay under 15K tokens per iteration
@@ -1,250 +0,0 @@
1
- # Auto-Claude vs Loki Mode: Honest Technical Comparison
2
-
3
- ## Overview
4
-
5
- | Metric | Auto-Claude | Loki Mode |
6
- |--------|-------------|-----------|
7
- | **GitHub Stars** | 11,479 | 594 |
8
- | **Release Type** | Desktop app (Electron) | CLI skill |
9
- | **License** | AGPL-3.0 | MIT |
10
- | **Requires** | Claude Pro/Max subscription | Claude API (any tier) |
11
- | **Version** | v2.7.5 (stable) | v5.25.0 |
12
- | **Created** | Dec 2025 | Jan 2026 |
13
- | **Community** | Discord, YouTube | GitHub only |
14
-
15
- ## Honest Assessment: Where Auto-Claude is Better
16
-
17
- ### 1. Desktop GUI with Visual Task Management
18
- Auto-Claude provides a native Electron app with:
19
- - Kanban board for visual task tracking
20
- - Multiple agent terminals (up to 12)
21
- - Real-time progress visualization
22
- - Point-and-click interface
23
-
24
- **Loki Mode:** CLI + web dashboard with dark Vercel/Linear theme, sidebar navigation, overview cards, Completion Council views. Dashboard served on port 57374.
25
-
26
- **Verdict: Auto-Claude wins** - GUI significantly lowers barrier to entry.
27
-
28
- ### 2. Package Distribution
29
- Auto-Claude provides:
30
- - Pre-built binaries for Windows, macOS (Intel + ARM), Linux
31
- - Auto-updates
32
- - SHA256 checksums
33
- - VirusTotal scans for security
34
-
35
- **Loki Mode:** npm, Homebrew, Docker, and git clone. Multiple distribution methods.
36
-
37
- **Verdict: Auto-Claude wins** - Professional distribution.
38
-
39
- ### 3. Community and Adoption
40
- - Auto-Claude: 11,479 stars, Discord community, YouTube channel, active development
41
- - Loki Mode: 594 stars, GitHub-only community, CONTRIBUTING.md + issue templates added
42
-
43
- **Verdict: Auto-Claude wins** - Network effects matter.
44
-
45
- ### 4. External Integrations
46
- Auto-Claude has built-in:
47
- - GitHub/GitLab integration (import issues, create MRs)
48
- - Linear integration (sync tasks)
49
- - OAuth setup flow
50
-
51
- **Loki Mode:** No built-in integrations. Manual git operations.
52
-
53
- **Verdict: Auto-Claude wins** - Better workflow integration.
54
-
55
- ### 5. Interactive Controls
56
- Auto-Claude allows:
57
- - Ctrl+C to pause and add instructions
58
- - HUMAN_INPUT.md for file-based intervention
59
- - PAUSE file to pause after current session
60
-
61
- **Loki Mode:** Limited. INTERVENTION_NEEDED signal exists but less refined.
62
-
63
- **Verdict: Auto-Claude wins** - Better human-in-the-loop.
64
-
65
- ### 6. AI-Powered Merge
66
- Auto-Claude has automatic conflict resolution when merging branches.
67
-
68
- **Loki Mode:** Has auto-merge but aborts on conflicts.
69
-
70
- **Verdict: Auto-Claude wins** - Smarter merge handling.
71
-
72
- ---
73
-
74
- ## Honest Assessment: Where Loki Mode is Better
75
-
76
- ### 1. Research Foundation
77
- Loki Mode is built on peer-reviewed research:
78
- - Anthropic: Constitutional AI, alignment detection
79
- - DeepMind: SIMA 2, Scalable Oversight via Debate
80
- - OpenAI: Agents SDK patterns
81
- - Academic: CONSENSAGENT (ACL 2025), GoalAct, A-Mem/MIRIX
82
-
83
- **Auto-Claude:** No documented research foundation.
84
-
85
- **Verdict: Loki Mode wins** - Academically grounded.
86
-
87
- ### 3. Full SDLC Coverage
88
- Loki Mode covers:
89
- - Engineering (code, tests, deployment)
90
- - Business operations (marketing, sales, legal)
91
- - Growth (A/B testing, community, lifecycle)
92
-
93
- **Auto-Claude:** Engineering only. No business/marketing agents.
94
-
95
- **Verdict: Loki Mode wins** - Full spec-to-product lifecycle vs coding only.
96
-
97
- ### 4. Anti-Sycophancy Measures
98
- Loki Mode implements CONSENSAGENT (ACL 2025):
99
- - Blind 3-reviewer system
100
- - Devil's advocate on unanimous approval
101
- - Severity-based blocking
102
-
103
- **Auto-Claude:** Single QA loop with no anti-sycophancy checks.
104
-
105
- **Verdict: Loki Mode wins** - Research-backed quality assurance.
106
-
107
- ### 5. Quality Gates
108
- Loki Mode runs 8 deterministic quality gates plus full SDLC phase coverage.
109
-
110
- The 8 deterministic quality gates: static analysis (CodeQL, ESLint), test suite (pass/fail), blind 3-reviewer review with severity blocking, anti-sycophancy Devil's Advocate, mock-integrity, test-mutation, documentation coverage, and Magic Modules debate. (Backward-compatibility is a conditional healing-mode auditor, not a numbered gate.)
111
-
112
- Beyond the gates, the SDLC pipeline covers these phases:
113
- 1. Static analysis (CodeQL, ESLint)
114
- 2. Unit tests (test suite passes; coverage % not measured this release)
115
- 3. API/Integration tests
116
- 4. E2E tests (Playwright)
117
- 5. Security scanning (OWASP)
118
- 6. Parallel code review (3 reviewers)
119
- 7. Performance/load testing
120
- 8. Accessibility (WCAG)
121
- 9. Regression testing
122
- 10. UAT simulation
123
- 11. Anti-sycophancy check
124
- 12. Scale-aware review intensity
125
- 13. Continuous monitoring
126
-
127
- **Auto-Claude:** Single QA validation loop (up to 50 iterations).
128
-
129
- **Verdict: Loki Mode wins** - Comprehensive quality vs single loop.
130
-
131
- ### 7. Licensing
132
- - Loki Mode: BUSL-1.1 (source-available)
133
- - Auto-Claude: AGPL-3.0 (copyleft, requires open-sourcing modifications)
134
-
135
- ### 8. API Access
136
- - Loki Mode: Works with Claude API (any tier)
137
- - Auto-Claude: Requires Claude Pro/Max subscription
138
-
139
- **Verdict: Loki Mode wins** - Lower barrier to entry.
140
-
141
- ### 9. No External Dependencies
142
- - Loki Mode: Pure bash/skill, no Electron, no Python backend
143
- - Auto-Claude: Requires Python 3.9+, Node.js, Electron, specific npm packages
144
-
145
- **Verdict: Loki Mode wins** - Simpler, lighter footprint.
146
-
147
- ### 10. Cursor Scale Patterns (v3.3.0)
148
- Loki Mode now incorporates proven patterns from Cursor's large-scale agent deployments:
149
- - Recursive sub-planners
150
- - Judge agents for cycle decisions
151
- - Optimistic concurrency control
152
- - Scale-aware review intensity
153
-
154
- **Auto-Claude:** Does not document scale patterns.
155
-
156
- **Verdict: Loki Mode wins** - Production-tested at scale.
157
-
158
- ---
159
-
160
- ## Feature Comparison Matrix
161
-
162
- | Feature | Auto-Claude | Loki Mode |
163
- |---------|:-----------:|:---------:|
164
- | Desktop GUI | Yes | Web Dashboard (dark theme) |
165
- | CLI Support | Yes | Yes |
166
- | Git Worktrees | Yes | Yes |
167
- | Parallel Agents | 12 terminals | 3-5 sessions |
168
- | Memory Persistence | Yes (Graphiti) | Yes (episodic/semantic) |
169
- | GitHub Integration | Yes | No |
170
- | Linear Integration | Yes | No |
171
- | Auto-Updates | Yes | No |
172
- | Research Foundation | No | Yes |
173
- | Specialized Agents | 4 types | 41 types |
174
- | Business Automation | No | Yes |
175
- | Anti-Sycophancy | No | Yes |
176
- | Quality Gates | 1 (QA loop) | 14 + Completion Council |
177
- | Published Benchmarks | No | Yes |
178
- | AI Merge Resolution | Yes | No |
179
- | Complexity Tiers | Yes | No |
180
- | Human Intervention | Yes (Ctrl+C, files) | Limited |
181
- | License | AGPL-3.0 | MIT |
182
- | Subscription Required | Yes (Pro/Max) | No |
183
-
184
- ---
185
-
186
- ## What Loki Mode Should Learn from Auto-Claude
187
-
188
- ### High Priority
189
- 1. **AI-Powered Merge Resolution** - Handle conflicts automatically instead of aborting
190
- 2. **Human Intervention Mechanism** - Add Ctrl+C pause, HUMAN_INPUT.md, PAUSE file
191
- 3. **Complexity Tiers** - Simple (3 phases), Standard (6), Complex (8)
192
- 4. **Session Memory Persistence** - Graphiti-style cross-session memory
193
-
194
- ### Medium Priority
195
- 5. **Visual Dashboard Upgrade** - Better than current basic HTML polling
196
- 6. **Spec Runner Pattern** - Interactive spec creation like Auto-Claude's CLI
197
- 7. **GitHub/GitLab Integration** - Import issues, create MRs
198
-
199
- ### Lower Priority
200
- 8. **Package Distribution** - Consider Electron or at least versioned releases
201
- 9. **Discord Community** - Build community infrastructure
202
-
203
- ---
204
-
205
- ## What Auto-Claude Could Learn from Loki Mode
206
-
207
- 1. **Research Foundation** - Document the science behind decisions
208
- 3. **Anti-Sycophancy** - Blind review prevents false positives
209
- 4. **Full SDLC** - Business, marketing, growth automation
210
- 6. **Source-available (BUSL-1.1)** - Inspect and self-host the full code
211
-
212
- ---
213
-
214
- ## Conclusion
215
-
216
- **Auto-Claude is better if you want:**
217
- - Visual GUI with Kanban board
218
- - Pre-packaged desktop app
219
- - GitHub/Linear integration
220
- - Large community
221
-
222
- **Loki Mode is better if you want:**
223
- - Research-backed architecture
224
- - Full spec-to-product lifecycle (not just coding)
225
- - 41 specialized agent roles
226
- - Anti-sycophancy measures
227
- - Source-available (BUSL-1.1) license
228
- - No subscription requirement
229
- - Verified benchmarks
230
-
231
- ### Honest Summary
232
-
233
- Auto-Claude has better UX and community. Loki Mode has better architecture and coverage.
234
-
235
- Auto-Claude is a polished product. Loki Mode is a research-backed system.
236
-
237
- For pure coding tasks with GUI preference: **Auto-Claude wins**.
238
- For full autonomous spec-to-product delivery with quality guarantees: **Loki Mode wins**.
239
-
240
- ---
241
-
242
- ## Sources
243
-
244
- - [Auto-Claude GitHub](https://github.com/AndyMik90/Auto-Claude)
245
- - [MemOS - Memory Operating System](https://github.com/MemTensor/MemOS)
246
- - [Dexter - Financial Research Agent](https://github.com/virattt/dexter)
247
- - [Simon Willison - Scaling Long-Running Autonomous Coding](https://simonwillison.net/2026/Jan/19/scaling-long-running-autonomous-coding/)
248
- - [Cursor - Scaling Agents Blog](https://cursor.com/blog/scaling-agents)
249
- - [CONSENSAGENT - ACL 2025](https://aclanthology.org/2025.findings-acl.1141/)
250
- - [Agentic AI Trends 2026](https://machinelearningmastery.com/7-agentic-ai-trends-to-watch-in-2026/)
@@ -1,101 +0,0 @@
1
- # Agent 01 - CLI Functional Testing Bug Fixes
2
-
3
- File modified: `autonomy/loki`
4
- Total changes: 166 insertions, 39 deletions
5
-
6
- ## Known Bugs Fixed
7
-
8
- ### BUG-CLI-003 | PID recycling guard for `cmd_web_stop`
9
- - **Location**: `cmd_web_stop()` PID file kill block
10
- - **Fix**: Before killing a PID from the PID file, verify the process command matches `python`, `uvicorn`, or `Purple` via `ps -p PID -o comm=`. If the PID has been recycled by the OS to a non-Purple-Lab process, skip the kill and warn the user.
11
-
12
- ### BUG-CLI-012 | Shell injection via unquoted Python file paths
13
- - **Location**: Multiple `python3 -c` calls throughout the CLI
14
- - **Fix**: Replaced all `open('$variable')` patterns in `python3 -c` calls with environment-variable-based parameter passing (`_VAR="$value" python3 -c "import os; open(os.environ['_VAR'])"`). Fixed 14 instances across:
15
- - `cmd_status` context window (lines ~1741-1742)
16
- - Healing report (friction map, failure modes)
17
- - Trigger schedule count
18
- - Failover chain providers
19
- - Vector index stats (numpy)
20
- - Context show (5 token metrics)
21
- - Budget cost display (2 metrics)
22
- - OTEL config endpoint
23
- - Project description JSON output
24
-
25
- ### BUG-CLI-005 | `cmd_web_status` wrong port and log paths
26
- - **Location**: `cmd_web_status()`
27
- - **Fix**: Port lookup now checks `$PURPLE_LAB_STATE_DIR/port` (home-based) first before CWD-based fallback. Log path resolves against home-based state dir first, falling back to CWD-based path.
28
-
29
- ### BUG-CLI-006 | `loki logs` truncates to 50 lines silently
30
- - **Location**: `cmd_logs()`
31
- - **Fix**: Added full argument parsing with `--tail/-n`, `--follow/-f`, `--all/-a`, and `--help`. The 50-line default is now documented in a hint line shown with output. Added `--follow` for live streaming.
32
-
33
- ### BUG-CLI-007 | `loki init` skips directory creation on failure
34
- - **Location**: `cmd_init()` project directory creation
35
- - **Fix**: Added `if ! mkdir -p` guards for both the project directory and `.loki` directory creation. Script now exits with an error message if directory creation fails.
36
-
37
- ### BUG-CLI-008 | `loki export` overwrites without confirmation
38
- - **Location**: `_export_json()`, `_export_markdown()`, `_export_csv()`, `_export_timeline()`
39
- - **Fix**: Added `_export_check_overwrite()` helper that checks if the output file exists and prompts `Overwrite? [y/N]` before writing. Called in all four export format functions.
40
-
41
- ### BUG-CLI-009 | `loki share` generates non-unique IDs
42
- - **Location**: `cmd_share()` gist description
43
- - **Fix**: Changed gist description timestamp from `%Y-%m-%d` (day granularity) to `%Y-%m-%dT%H:%M:%S` (second granularity) to avoid collisions when sharing multiple times per day.
44
-
45
- ### BUG-CLI-010 | `loki config set` accepts any key without validation
46
- - **Location**: `cmd_config_set()` wildcard case
47
- - **Fix**: Changed from a warning that stores the value anyway to a hard error that lists valid keys and returns 1. Unknown keys are now rejected.
48
-
49
- ### BUG-CLI-011 | `config_get` error handling
50
- - **Location**: `cmd_config_get()`
51
- - **Fix**: Wrapped the Python heredoc in a subshell capture with `|| { error; return 1; }` pattern to gracefully handle python3 failures without leaking state. Removed unnecessary `unset` of inline env vars.
52
-
53
- ### BUG-CLI-008 (Medium) | `LOKI_DIR` not exported for Python heredocs
54
- - **Location**: Line 129
55
- - **Fix**: Added `export LOKI_DIR` immediately after assignment. This ensures all Python heredocs using `os.environ.get("LOKI_DIR", ".loki")` receive the correct value.
56
-
57
- ### BUG-PAR-002 | `worktree list` branch pattern never matches
58
- - **Location**: `cmd_worktree()` list subcommand
59
- - **Fix**: Branch matching pattern changed from `loki-parallel-*` to match both `parallel-*` and `loki-parallel-*`. The actual branches created by `run.sh` use `parallel-<stream>` prefix (line 2130 of run.sh), not `loki-parallel-`.
60
-
61
- ### BUG-PAR-010 | `worktree clean` doesn't kill running sessions
62
- - **Location**: `cmd_worktree()` clean subcommand
63
- - **Fix**: Before removing a worktree via `git worktree remove`, check for `.loki/loki.pid` in the worktree directory. If a session is running, send SIGTERM, wait 1 second, then SIGKILL if needed.
64
-
65
- ## New Bugs Found and Fixed
66
-
67
- ### NEW-CLI-001 | Division by zero in context percentage calculation
68
- - **Location**: `cmd_status()` and `_context_show()`
69
- - **Fix**: Added `if [ "$ctx_total" -gt 0 ]` / `if [ "$total_tokens" -gt 0 ]` guards before the `$((used * 100 / total))` arithmetic. If total is zero, percentage defaults to 0.
70
-
71
- ### NEW-CLI-002 | Missing `loki web logs` subcommand
72
- - **Location**: `cmd_web()` case dispatch
73
- - **Fix**: Added `logs)` case to `cmd_web()` that displays Purple Lab server logs using `tail -n`. Defaults to 100 lines. Also checks home-based state dir and CWD-based fallback for log file location. Updated `cmd_web_help()` to list the `logs` subcommand.
74
-
75
- ## Bugs Investigated But Not Fixed (Already Correct)
76
-
77
- ### BUG-CLI-001 / BUG-CLI-002 | `--port` / `--prd` unbound variable
78
- - **Status**: Already fixed in current code. `cmd_web_start()` initializes `port="${PURPLE_LAB_DEFAULT_PORT}"` and `prd_file=""` before the argument parsing loop. The `--port` and `--prd` handlers properly check `${2:-}` before accessing `$2`.
79
-
80
- ### BUG-CLI-004 | `--no-open` flag ignored
81
- - **Status**: Already working correctly. The `open_browser` variable is set to `false` by `--no-open` and checked with `if [ "$open_browser" = true ]` before any browser-open calls.
82
-
83
- ### BUG-CLI-009 (Medium) | Empty array with `set -u` in `list_running_sessions`
84
- - **Status**: Already fixed. Uses `${sessions[@]+"${sessions[@]}"}` pattern throughout, which is the correct `set -u`-safe array expansion.
85
-
86
- ### BUG-CMD-001 | `cmd_web` wildcard duplicates arguments
87
- - **Status**: Analyzed and found to be working correctly. The `*)` case properly shifts the subcommand-as-flag, then passes it along with remaining args to `cmd_web_start`.
88
-
89
- ## Bugs Found But Not Fixed (Out of Scope or Extensive)
90
-
91
- ### Missing `$2` guards in `shift 2` patterns
92
- - **Location**: Multiple argument parsers (e.g., `cmd_state query`, trigger config parsing)
93
- - **Issue**: Under `set -u`, if a flag like `--agent` is the last argument without a value, `$2` is unset, causing a crash. The pattern `shift 2 ;;` should be guarded with `${2:-}` checks.
94
- - **Impact**: Low -- only triggers on malformed user input.
95
- - **Scope**: 20+ occurrences across the file; would require systematic refactoring.
96
-
97
- ### Remaining shell-expanded heredocs with `$variable` in `open()` calls
98
- - **Location**: Lines 3745, 8002, 9332, 10228, 10262, 12604, 16844, etc.
99
- - **Issue**: Double-quoted heredocs (`<< HEREDOC`) interpolate shell variables into Python `open()` calls. While the variables are internally-constructed paths (not user input), specially-crafted directory names with quotes could theoretically cause injection.
100
- - **Impact**: Very low -- would require the user to be working in a directory with Python metacharacters in its path.
101
- - **Scope**: 15+ occurrences; fixing all requires converting to single-quoted heredocs with env var passing.
@@ -1,88 +0,0 @@
1
- # Agent 02: Purple Lab Functional Testing - Bug Fix Report
2
-
3
- ## Summary
4
-
5
- Audited `web-app/server.py` (5,679 lines) and all frontend components in `web-app/src/` (50 files).
6
- Fixed 8 bugs (3 security, 2 resource leaks, 2 race conditions, 1 missing validation).
7
- Verified all 13 bugs from BUG-AUDIT-v6.61.0 against the current codebase.
8
-
9
- ## Bugs Fixed
10
-
11
- ### FIX-1: `_save_secrets()` crashes when crypto module is missing (BUG-PL-013 related)
12
- - **File**: `web-app/server.py:2431`
13
- - **Severity**: Medium
14
- - **Problem**: `_save_secrets()` calls `from crypto import encrypt_value, encryption_available` without try/except ImportError. When the crypto module is not installed, saving any secret (POST /api/secrets) crashes with an unhandled ImportError. The counterpart `_load_secrets()` already handles this correctly.
15
- - **Fix**: Wrapped the crypto import in try/except ImportError with plaintext fallback, matching the pattern in `_load_secrets()`.
16
-
17
- ### FIX-2: `fix_session` orphans child processes (BUG-PL-007 related)
18
- - **File**: `web-app/server.py:4203`
19
- - **Severity**: High
20
- - **Problem**: `run_fix()` in the `/api/sessions/{id}/fix` endpoint spawns a subprocess but never calls `_track_child_pid()` or `_untrack_child_pid()`. When `loki web stop` runs, these fix processes are not found in the tracking list and remain as orphans, consuming resources. The chat endpoint (`run_chat()`) correctly tracks and untracks -- this was a missed pattern.
21
- - **Fix**: Added `_track_child_pid(proc.pid)` after process creation and `_untrack_child_pid(proc.pid)` in the finally block.
22
-
23
- ### FIX-3: Session history leaks full filesystem paths (BUG-PL-003 from task description)
24
- - **File**: `web-app/server.py:3411`
25
- - **Severity**: Medium (security/information disclosure)
26
- - **Problem**: `get_sessions_history()` returned `"path": str(entry)` which exposes full paths like `/Users/lokesh/purple-lab-projects/project-123`. In deployed scenarios this leaks the server's filesystem structure, username, and directory layout.
27
- - **Fix**: Replaced with sanitized relative paths using `~/` prefix (e.g., `~/purple-lab-projects/project-123`). This is safe because the session history path is display-only on the frontend.
28
-
29
- ### FIX-4: `delete_session` leaks filesystem path in response
30
- - **File**: `web-app/server.py:3495`
31
- - **Severity**: Low (security/information disclosure)
32
- - **Problem**: `delete_session()` returned `"path": str(target)` in its response, exposing the full filesystem path to the client.
33
- - **Fix**: Changed to return `"session_id": session_id` instead.
34
-
35
- ### FIX-5: `start_session` accepts arbitrary projectDir without validation
36
- - **File**: `web-app/server.py:2510`
37
- - **Severity**: High (security)
38
- - **Problem**: The `projectDir` field from StartRequest was used directly without any path validation. A malicious client could pass `/etc`, `/root`, or any system path, and the server would create directories and write PRD files there. The `onboard_session` endpoint already validates paths correctly.
39
- - **Fix**: Added validation ensuring user-supplied `projectDir` resolves to within the home directory, matching the pattern in `onboard_session`.
40
-
41
- ### FIX-6: `create_session_file` missing content size limit (BUG-PL-005 from task description)
42
- - **File**: `web-app/server.py:3691`
43
- - **Severity**: Medium
44
- - **Problem**: `create_session_file()` (POST) accepts file content without any size validation. The sibling `save_session_file()` (PUT) correctly enforces a 1MB limit. A client could create arbitrarily large files via the POST endpoint.
45
- - **Fix**: Added `len(req.content.encode(...)) > 1_048_576` check matching the PUT endpoint.
46
-
47
- ### FIX-7: `pause_session` and `resume_session` mutate state without lock
48
- - **File**: `web-app/server.py:2972, 2989`
49
- - **Severity**: Medium (race condition)
50
- - **Problem**: Both `pause_session()` and `resume_session()` read `session.running`, `session.process`, and write `session.paused` without holding `session._lock`. Concurrent pause/resume and stop operations could produce torn state. The `stop_session` and `start_session` endpoints correctly use `async with session._lock`.
51
- - **Fix**: Wrapped both endpoints' state access in `async with session._lock`.
52
-
53
- ### FIX-8: `delete_secret` endpoint missing key format validation
54
- - **File**: `web-app/server.py:4340`
55
- - **Severity**: Low (defense in depth)
56
- - **Problem**: The `delete_secret()` endpoint accepts arbitrary strings as the `key` parameter without validation. While not exploitable (used only as dict key lookup), the `set_secret()` endpoint validates key format -- the inconsistency could mask bugs.
57
- - **Fix**: Added `re.match(r'^[A-Za-z_][A-Za-z0-9_]*$', key)` validation matching `set_secret()`.
58
-
59
- ## Bugs from Audit Already Fixed in Current Codebase
60
-
61
- The following bugs from BUG-AUDIT-v6.61.0 were already fixed before this audit:
62
-
63
- | Bug ID | Description | Status |
64
- |--------|-------------|--------|
65
- | BUG-PL-001 | Dead code after `stop_session` return | Fixed: no early return, full cleanup runs |
66
- | BUG-PL-002 | `session.reset()` never called on stop | Fixed: `session.reset()` called at line 2742 |
67
- | BUG-PL-003 (audit) | Reader task sets `running=False` without lock | Fixed: uses `async with session._lock` at line 2361 |
68
- | BUG-PL-004 | Chat/fix missing secrets injection | Fixed: both endpoints call `_load_secrets()` |
69
- | BUG-PL-005 (audit) | Pause state never tracked | Fixed: `session.paused` set in both pause/resume |
70
- | BUG-PL-006 | `delete_session` can delete active session | Fixed: explicit active session check at line 3458 |
71
- | BUG-PL-009 | Project dir name collision (second-granularity) | Fixed: uses milliseconds (`time.time() * 1000`) |
72
- | BUG-PL-010 | `get_status` mutates `running` without lock | Fixed: uses local `is_running` variable, not session state |
73
- | BUG-PL-011 | Session history breaks after first non-empty dir | Fixed: no early `break` in history loop |
74
- | BUG-PL-012 | `cancel_chat` unhandled `TimeoutExpired` | Fixed: caught at line 4133 |
75
-
76
- ## New Bugs Discovered (Beyond Audit)
77
-
78
- All bugs listed in the "Bugs Fixed" section above (FIX-1 through FIX-8) are new discoveries not covered by the original BUG-AUDIT-v6.61.0 for the Purple Lab category. FIX-1, FIX-2, FIX-5, FIX-6, FIX-7, and FIX-8 are entirely new findings.
79
-
80
- ## Verification
81
-
82
- - Python syntax: `ast.parse()` passes on modified server.py
83
- - Frontend build: `npm run build` succeeds with no new errors
84
- - All changes are backward-compatible (no API contract changes except delete_session response field rename from `path` to `session_id`)
85
-
86
- ## Files Modified
87
-
88
- - `web-app/server.py` -- 8 bug fixes (50 insertions, 26 deletions)
@@ -1,119 +0,0 @@
1
- # Agent 03: Dashboard API Functional Testing - Bug Fix Report
2
-
3
- ## Scope
4
- File: `dashboard/server.py` (~5,259 lines, FastAPI)
5
- Focus: All API routes, WebSocket handlers, task board features, security audit
6
-
7
- ## Bug Audit Status from BUG-AUDIT-v6.61.0.md
8
-
9
- ### Already Fixed (verified in current codebase)
10
-
11
- | Bug ID | Description | Status |
12
- |--------|-------------|--------|
13
- | BUG-DASH-001 | Token creation endpoint has no authentication | FIXED - `require_scope("admin")` dependency at line 1719 |
14
- | BUG-DASH-002 | WebSocket rate-limit calls close() on unaccepted connection | FIXED - `accept()` then `close()` at lines 1396-1397 |
15
- | BUG-DASH-003 | WebSocket connection limit rejection enters receive loop | FIXED - `connect()` returns False, caller returns at line 1421-1422 |
16
- | BUG-DASH-004 | `create_project` doesn't validate tenant_id | FIXED - Tenant existence check + `Field(..., gt=0)` validation |
17
- | BUG-DASH-005 | `update_task` doesn't clear completed_at on reopen | FIXED - `completed_at = None` in else branch at line 1254 |
18
- | BUG-DASH-006 | Task state machine missing DONE transitions | FIXED - `DONE: {IN_PROGRESS, REVIEW}` at line 1316 |
19
- | BUG-DASH-009 | ProjectUpdate.status allows arbitrary strings | FIXED - `Literal["active", "archived", "completed", "paused"]` at line 179 |
20
- | BUG-DASH-010 | Audit log offset allows negative values | FIXED - `ge=0` constraint at line 1824 |
21
- | BUG-DASH-011 | Learning signals offset allows negative values | FIXED - `ge=0` constraint at line 2443 |
22
- | BUG-DASH-012 | WebSocket idle timeout doesn't call disconnect | FIXED - `finally: manager.disconnect(websocket)` at line 1469 |
23
- | BUG-DASH-013 | GET /api/tasks ignores project_id parameter | FIXED - Filter applied at lines 1132-1134 |
24
-
25
- ### Not Applicable (code removed)
26
-
27
- | Bug ID | Description | Status |
28
- |--------|-------------|--------|
29
- | BUG-PL-001 | Dead code after stop_session return | N/A - Purple Lab code removed from server.py |
30
- | BUG-PL-002 | session.reset() never called on stop | N/A - Purple Lab code removed from server.py |
31
- | BUG-PL-003 | Reader task sets running=False without lock | N/A - Purple Lab code removed |
32
- | BUG-PL-004 | Chat/fix/auto-fix missing secrets injection | N/A - Purple Lab code removed |
33
- | BUG-PL-005 | Pause state never tracked | N/A - Purple Lab code removed |
34
- | BUG-PL-006 | delete_session can delete active directory | N/A - Purple Lab code removed |
35
- | BUG-PL-007 | Chat PIDs tracked but never untracked | N/A - Purple Lab code removed |
36
- | BUG-DS-002 | Auto-fix restart double-wraps command | N/A - Dev server code removed |
37
- | BUG-DS-003 | Overly broad port regex | N/A - Dev server code removed |
38
- | BUG-DS-004 | pip install into server's own environment | N/A - Dev server code removed |
39
- | BUG-DS-005 | Docker Compose port parsing crash | N/A - Dev server code removed |
40
- | BUG-DASH-007 | pause_session polling loop is dead code | N/A - pause_session rewritten (no polling loop) |
41
-
42
- ## Fixes Applied in This Session
43
-
44
- ### 1. BUG-DASH-008: `_safe_read_text` not truly safe (lines 95-101)
45
-
46
- **Problem**: `_safe_read_text` used `Path.read_text()` directly without exception handling. While `Path.read_text()` properly manages file handles (no leak), the function could raise `OSError` on permission errors or missing files. The "safe" name was misleading -- callers expected it to never raise.
47
-
48
- **Fix**: Wrapped in try/except to return empty string on any I/O error, making the function truly safe as its name implies.
49
-
50
- ### 2. SECURITY: `/api/focus` POST/DELETE missing authentication (lines 1637, 1672)
51
-
52
- **Problem**: The `/api/focus` POST and DELETE endpoints had no auth dependency. Any network-reachable client could redirect the dashboard to read from an arbitrary project directory, potentially exposing data from other projects or causing the dashboard to process attacker-controlled state files.
53
-
54
- **Fix**:
55
- - Added `dependencies=[Depends(auth.require_scope("control"))]` to both POST and DELETE
56
- - Added validation requiring the target directory to contain a `.loki/` subdirectory to prevent pointing the dashboard at arbitrary filesystem locations
57
- - Changed to resolve path before checking, preventing TOCTOU issues
58
-
59
- ### 3. SECURITY: `/api/enterprise/tokens` GET missing authentication (line 1766)
60
-
61
- **Problem**: The token listing endpoint had no auth dependency. When enterprise mode was enabled, any client could enumerate all API tokens (names, scopes, creation dates, expiration). While raw token values are not returned, the metadata exposure is still a security risk for token enumeration and scope discovery.
62
-
63
- **Fix**: Added `dependencies=[Depends(auth.require_scope("admin"))]` to require admin authentication.
64
-
65
- ### 4. Deprecated `asyncio.get_event_loop()` in sync_registry (line 1600)
66
-
67
- **Problem**: Used `asyncio.get_event_loop()` which is deprecated in Python 3.10+ for getting the running loop from within an async function. This could cause `DeprecationWarning` or incorrect behavior in future Python versions.
68
-
69
- **Fix**: Changed to `asyncio.get_running_loop()` which is the correct API for async contexts.
70
-
71
- ### 5. Input validation: timeRange parameters on learning endpoints (lines 2361, 2430, 2450)
72
-
73
- **Problem**: The `timeRange` parameters on `/api/learning/metrics`, `/api/learning/trends`, and `/api/learning/signals` accepted arbitrary strings with no validation. While `_parse_time_range()` handles invalid input gracefully (returns None), passing malformed strings wastes processing and could be used for fuzzing.
74
-
75
- **Fix**: Added `Query(..., pattern=r"^\d{1,4}[hdm]$")` constraint to validate format (1-4 digit number followed by h/d/m).
76
-
77
- ### 6. Input validation: quality report format parameter (line 4970)
78
-
79
- **Problem**: The `format` parameter on `/api/quality-report` accepted any string, passing it to `rigour.export_report()`. Arbitrary format strings could cause unexpected behavior in the export function.
80
-
81
- **Fix**: Added `pattern="^(json|markdown|html)$"` constraint to limit to known formats.
82
-
83
- ### 7. Input validation: migration start target and codebase_path (line 5048)
84
-
85
- **Problem**: The `start_migration` endpoint accepted `codebase_path` and `target` without type checking. Non-string values (lists, dicts) from JSON body would cause cryptic errors downstream.
86
-
87
- **Fix**: Added type validation (`isinstance` check for str) and length limit (255 chars) for `target`.
88
-
89
- ## Security Audit Summary (OWASP Top 10)
90
-
91
- | OWASP Category | Status | Notes |
92
- |----------------|--------|-------|
93
- | A01: Broken Access Control | FIXED | Added auth to /api/focus, /api/enterprise/tokens |
94
- | A02: Cryptographic Failures | OK | Token generation uses `secrets` module |
95
- | A03: Injection | OK | SQLAlchemy ORM prevents SQL injection; list-form subprocess calls prevent shell injection; realpath + regex prevent path traversal |
96
- | A04: Insecure Design | FIXED | Focus endpoint now requires .loki/ subdirectory |
97
- | A05: Security Misconfiguration | OK | CORS restricted to localhost; default bind to 127.0.0.1; TLS optional |
98
- | A06: Vulnerable Components | N/A | Dependency audit out of scope |
99
- | A07: Auth Failures | OK | Rate limiting on sensitive endpoints; token management requires admin |
100
- | A08: Data Integrity | OK | Atomic file writes for state mutations (tmp + rename) |
101
- | A09: Logging Failures | OK | Audit logging on destructive operations (delete, stop, kill) |
102
- | A10: SSRF | MITIGATED | Focus endpoint restricted to dirs with .loki/ subdirectory |
103
-
104
- ## Route Coverage Audit
105
-
106
- Verified all 100+ routes in server.py for:
107
- - Authentication requirements (auth scope dependencies)
108
- - Input validation (Pydantic models, Query constraints, regex patterns)
109
- - Error handling (try/except with proper HTTP status codes)
110
- - Rate limiting (control and read limiters)
111
- - Path traversal protection (realpath checks, SAFE_ID_RE regex)
112
- - Resource cleanup (WebSocket disconnect in finally block)
113
-
114
- ## Verification
115
-
116
- ```
117
- python3 -c "import ast; ast.parse(open('dashboard/server.py').read()); print('Syntax OK')"
118
- # Output: Syntax OK
119
- ```