loki-mode 11.128.1 → 11.129.0

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 (92) hide show
  1. package/README.md +1 -0
  2. package/SKILL.md +3 -3
  3. package/VERSION +1 -1
  4. package/autonomy/lib/help-core.sh +30 -42
  5. package/autonomy/lib/workspace.py +292 -19
  6. package/autonomy/lib/workspace_comment.py +40 -11
  7. package/autonomy/loki +109 -169
  8. package/autonomy/route.sh +8 -4
  9. package/autonomy/trigger-server.py +373 -32
  10. package/bin/loki +77 -14
  11. package/completions/_loki +11 -142
  12. package/completions/loki.bash +4 -2
  13. package/dashboard/__init__.py +1 -1
  14. package/docs/CLI-CORE-VERBS.md +61 -37
  15. package/docs/CLI-INVENTORY.md +152 -153
  16. package/docs/CLI-REFERENCE.md +20 -166
  17. package/docs/DEPLOYMENT.md +38 -3
  18. package/docs/INSTALLATION.md +7 -1
  19. package/docs/KNOWN-ISSUES.md +1 -1
  20. package/docs/PROOF-PASSPORT.md +21 -0
  21. package/docs/WORKSPACES.md +27 -0
  22. package/docs/cost-controls.md +74 -12
  23. package/docs/dev/architecture-reference.md +2 -2
  24. package/docs/environment-variables.md +7 -0
  25. package/docs/merge-queue.md +44 -3
  26. package/docs/sentry-intake.md +1 -1
  27. package/docs/slack.md +1 -1
  28. package/docs/v10/GUIDE.md +22 -4
  29. package/loki-ts/dist/loki.js +1502 -1456
  30. package/mcp/__init__.py +1 -1
  31. package/memory/knowledge_graph.py +442 -56
  32. package/package.json +2 -2
  33. package/packages/control-plane/dist/server.js +2182 -1808
  34. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  35. package/schemas/loki-yaml.schema.json +1 -0
  36. package/web-app/dist/assets/{AdminPage-DU19V0Z8.js → AdminPage-uxbsIyND.js} +1 -1
  37. package/web-app/dist/assets/{Avatar-8tZOYCzr.js → Avatar-5GhUf4pP.js} +1 -1
  38. package/web-app/dist/assets/{Badge-WsBr_wmd.js → Badge-93rdLyl8.js} +1 -1
  39. package/web-app/dist/assets/{Button-dbsRjgbK.js → Button-C94f2_e6.js} +1 -1
  40. package/web-app/dist/assets/{CockpitPage-BdmKE1BD.js → CockpitPage-C8cDx1mp.js} +1 -1
  41. package/web-app/dist/assets/{ComparePage-B0baIWVY.js → ComparePage-BU7VVcVf.js} +1 -1
  42. package/web-app/dist/assets/{ErrorBoundary-KGmneVKo.js → ErrorBoundary-Bn81ZPkG.js} +1 -1
  43. package/web-app/dist/assets/{EvidenceReceiptPanel-DzbcVDL0.js → EvidenceReceiptPanel-CVqzhxXI.js} +1 -1
  44. package/web-app/dist/assets/{GitHubIssuesPanel-BO6bSgxF.js → GitHubIssuesPanel-i1Yjc0mH.js} +1 -1
  45. package/web-app/dist/assets/{GitHubPRsPanel-BYiyPZye.js → GitHubPRsPanel-eoXw0hiw.js} +1 -1
  46. package/web-app/dist/assets/{HomePage-DDVp5P4l.js → HomePage-Cv_BXFF9.js} +2 -2
  47. package/web-app/dist/assets/{LoginPage-CSMf6PA9.js → LoginPage-CWYdAQSQ.js} +1 -1
  48. package/web-app/dist/assets/{MagicPage-CHxAoj4t.js → MagicPage-5r2ci7MS.js} +1 -1
  49. package/web-app/dist/assets/{MetricsPage-BgSvqiiI.js → MetricsPage-C37jE1uR.js} +1 -1
  50. package/web-app/dist/assets/{NotFoundPage-DMC9Etyr.js → NotFoundPage-CuBrziZd.js} +1 -1
  51. package/web-app/dist/assets/{ProjectPage-BYpWEnfs.js → ProjectPage-59GLzJlR.js} +3 -3
  52. package/web-app/dist/assets/{ProjectsPage-DksZuUPc.js → ProjectsPage-DgDtFRNm.js} +1 -1
  53. package/web-app/dist/assets/{SettingsPage-BRghQ4OZ.js → SettingsPage-DjMSy-kZ.js} +1 -1
  54. package/web-app/dist/assets/{ShowcasePage-AX3TFZdD.js → ShowcasePage-DESkYmrG.js} +1 -1
  55. package/web-app/dist/assets/{SystemSettingsPage-DVg5oEf3.js → SystemSettingsPage-d5jFreyF.js} +1 -1
  56. package/web-app/dist/assets/{TeamsPage-CNKKrZdS.js → TeamsPage-BEVAkxj3.js} +1 -1
  57. package/web-app/dist/assets/{TemplatesPage-DReGZVmw.js → TemplatesPage-DeK9wx22.js} +1 -1
  58. package/web-app/dist/assets/{TerminalOutput-6g4gZVbt.js → TerminalOutput-2vwck437.js} +1 -1
  59. package/web-app/dist/assets/{activity-kKs9rNVl.js → activity-XgL1xWCM.js} +1 -1
  60. package/web-app/dist/assets/{bell-D2f6TSrY.js → bell-EXDsjrzh.js} +1 -1
  61. package/web-app/dist/assets/{bot-CTiUgNPd.js → bot-B9I58zKH.js} +1 -1
  62. package/web-app/dist/assets/{check-b7nwLuDG.js → check-DgLUYM2x.js} +1 -1
  63. package/web-app/dist/assets/{chevron-left-z43N9oQm.js → chevron-left-BhHLpt7K.js} +1 -1
  64. package/web-app/dist/assets/{circle-alert-CFXh7q4_.js → circle-alert-rgioMmC9.js} +1 -1
  65. package/web-app/dist/assets/{clock-C5XlY5gQ.js → clock-BO__fq1n.js} +1 -1
  66. package/web-app/dist/assets/{cloud-DiRynGU2.js → cloud-iLJ3RtJs.js} +1 -1
  67. package/web-app/dist/assets/{code-xml-D0-7LFV7.js → code-xml-BFYU6YlU.js} +1 -1
  68. package/web-app/dist/assets/{database-BL7633cr.js → database-CXDLeUh_.js} +1 -1
  69. package/web-app/dist/assets/{dollar-sign-DYcrnk0S.js → dollar-sign-C9Jbgo-O.js} +1 -1
  70. package/web-app/dist/assets/{file-code-corner-CUf4Ao24.js → file-code-corner-CNPi6dkK.js} +1 -1
  71. package/web-app/dist/assets/{file-plus-DiPFi2oQ.js → file-plus-DAc0Sd1J.js} +1 -1
  72. package/web-app/dist/assets/{globe-2vq90XD6.js → globe-DN0njo3S.js} +1 -1
  73. package/web-app/dist/assets/{hammer-CPLZcW5e.js → hammer-CnpZO-SH.js} +1 -1
  74. package/web-app/dist/assets/{index-8TqwI_NF.js → index-BHwx0KjF.js} +3 -3
  75. package/web-app/dist/assets/{layers-DkjwiuGI.js → layers-_kP2XVgZ.js} +1 -1
  76. package/web-app/dist/assets/{loader-circle-B6seK0mv.js → loader-circle-CcupfVc5.js} +1 -1
  77. package/web-app/dist/assets/{lock-BokWI7Bq.js → lock-D3I89F_A.js} +1 -1
  78. package/web-app/dist/assets/{package-Bwj3Yy9P.js → package-BMz7_qR6.js} +1 -1
  79. package/web-app/dist/assets/{plus-DDtdbe28.js → plus-3rKyjjc7.js} +1 -1
  80. package/web-app/dist/assets/{refresh-cw-MCFH-IYf.js → refresh-cw-DGI9P9uf.js} +1 -1
  81. package/web-app/dist/assets/{rotate-ccw-DpGrHe4v.js → rotate-ccw-CEIZqe5z.js} +1 -1
  82. package/web-app/dist/assets/{scroll-text-AlMeqOJW.js → scroll-text-CBQ5ISFk.js} +1 -1
  83. package/web-app/dist/assets/{server-DlQAxyoR.js → server-DOr9ns7A.js} +1 -1
  84. package/web-app/dist/assets/{shield-alert-QMLIe6EO.js → shield-alert-pcQbbyMb.js} +1 -1
  85. package/web-app/dist/assets/{thumbs-up-CH-iPy2L.js → thumbs-up-Q7fwPWa9.js} +1 -1
  86. package/web-app/dist/assets/{trash-2-CC40OFfT.js → trash-2-D81689SS.js} +1 -1
  87. package/web-app/dist/assets/{trending-down-BkpkaJJX.js → trending-down-8b0O5hb9.js} +1 -1
  88. package/web-app/dist/assets/{trending-up-M8yk4S0A.js → trending-up-CD0tv_w5.js} +1 -1
  89. package/web-app/dist/assets/{upload-EHu6t2yj.js → upload-CphI5Pe_.js} +1 -1
  90. package/web-app/dist/assets/{usePolling-BavtK4H1.js → usePolling-yhGOhxnY.js} +1 -1
  91. package/web-app/dist/assets/{user-DP41l_sQ.js → user-CXM61B6o.js} +1 -1
  92. package/web-app/dist/index.html +1 -1
package/bin/loki CHANGED
@@ -496,6 +496,44 @@ _loki_bun() {
496
496
  done
497
497
  return 0
498
498
  }
499
+ # FR02: --detach/-d on a Loki 10 run. Re-launches the same engine10 argv in its own session, so closing the terminal
500
+ # sends it no SIGHUP (a foreground run stops on SIGHUP by design, runner/worker_proc.ts). stdin /dev/null, output to a log.
501
+ # Same launcher ladder as autonomy/loki _loki_new_session_exec and run.sh (legacy copies bin/loki cannot source).
502
+ _loki_e10_detach() { # $1 = bun, rest = engine10 args with --detach/-d already removed
503
+ local lb="$1" top ldir log pid rc=0 settle i=0
504
+ shift
505
+ top="$(git rev-parse --show-toplevel 2>/dev/null || pwd -P)"
506
+ ldir="${LOKI_DIR:-$top/.loki}/logs"
507
+ mkdir -p "$ldir" || { echo "loki: --detach could not create $ldir" >&2; exit 1; }
508
+ log="$ldir/detached-$(date -u +%Y%m%dT%H%M%SZ)-$$.log"
509
+ export LOKI_DETACHED=1
510
+ if command -v setsid >/dev/null 2>&1; then
511
+ nohup setsid "$lb" "${_LOKI_BUN_SAFE[@]}" "$BUN_CLI" engine10 "$@" >"$log" 2>&1 </dev/null &
512
+ elif command -v perl >/dev/null 2>&1; then
513
+ nohup perl -e 'use POSIX qw(setsid); setsid(); exec @ARGV or exit 127;' "$lb" "${_LOKI_BUN_SAFE[@]}" "$BUN_CLI" engine10 "$@" >"$log" 2>&1 </dev/null &
514
+ elif command -v python3 >/dev/null 2>&1; then
515
+ nohup python3 -c 'import os,sys; os.setsid(); os.execvp(sys.argv[1], sys.argv[1:])' "$lb" "${_LOKI_BUN_SAFE[@]}" "$BUN_CLI" engine10 "$@" >"$log" 2>&1 </dev/null &
516
+ else
517
+ nohup "$lb" "${_LOKI_BUN_SAFE[@]}" "$BUN_CLI" engine10 "$@" >"$log" 2>&1 </dev/null &
518
+ fi
519
+ pid=$!
520
+ if [ "${LOKI_DETACH_CAFFEINATE:-1}" != "0" ] && command -v caffeinate >/dev/null 2>&1; then
521
+ nohup caffeinate -i -w "$pid" >/dev/null 2>&1 </dev/null &
522
+ fi
523
+ settle="${LOKI_DETACH_SETTLE_S:-3}"; case "$settle" in ''|*[!0-9]*) settle=3 ;; esac
524
+ while [ "$i" -lt $((settle * 10)) ] && kill -0 "$pid" 2>/dev/null; do sleep 0.1; i=$((i + 1)); done
525
+ if ! kill -0 "$pid" 2>/dev/null; then
526
+ wait "$pid" || rc=$?
527
+ tail -n 20 "$log" >&2
528
+ echo "loki: the run ended before it detached (exit $rc); full log: $log" >&2
529
+ exit "$rc"
530
+ fi
531
+ printf 'Detached: the Loki 10 run continues in the background (pid %s); closing this terminal does not stop it.\n' "$pid"
532
+ printf ' Log: %s\n Follow: loki status --follow\n Cancel: loki cancel\n' "$log"
533
+ printf ' Result: the PR (or local branch) and receipt land as on a foreground run\n'
534
+ [ -n "${LOKI_SLACK_WEBHOOK_URL:-}${LOKI_WEBHOOK_URL:-}" ] || printf ' Notify: set LOKI_SLACK_WEBHOOK_URL before starting to get the outcome in Slack\n'
535
+ exit 0
536
+ }
499
537
  # No working bun for an engine10 command: say why and how to fix it, exit 2. A Homebrew install of loki-mode
500
538
  # (its own keg, not an npm install under Homebrew's node) is told the brew formula.
501
539
  _loki_no_bun_exit() {
@@ -752,6 +790,8 @@ case "v10" in
752
790
  ""|-*) _e10=0 ;;
753
791
  # http*://*/issues/* also covers GitLab's /-/issues/ URLs.
754
792
  */*\#[0-9]*|http*://*/issues/*|http*://*/browse/*|jira:*|linear:*|https://linear.app/*/issue/*) _e10=1 ;;
793
+ # FR01: a one-word "#N" is an issue of this checkout (engine10 resolves it against origin)
794
+ \#[0-9]*) case "${1#\#}" in *[!0-9]*) ;; *) _e10=1 ;; esac ;;
755
795
  *" "*) _e10=1 ;;
756
796
  # ponytail: a one-word argument stays on the legacy CLI. The telemetry
757
797
  # allowlist is not a command registry (estimate, intent, outcomes are
@@ -797,6 +837,24 @@ case "v10" in
797
837
  unset _e10_v
798
838
  ;;
799
839
  esac
840
+ # FR02: strip --detach/-d (task words after a bare -- are never flags) and detach the run.
841
+ case "${1:-}" in
842
+ keys|export|status|verify|dashboard|plan) ;;
843
+ *)
844
+ _e10_det=0; _e10_rest=(); _e10_dd=0
845
+ for _e10_a in ${_e10_args[@]+"${_e10_args[@]}"}; do
846
+ if [ "$_e10_dd" = "0" ]; then
847
+ case "$_e10_a" in
848
+ --) _e10_dd=1 ;;
849
+ --detach|-d) _e10_det=1; continue ;;
850
+ esac
851
+ fi
852
+ _e10_rest+=("$_e10_a")
853
+ done
854
+ if [ "$_e10_det" = "1" ]; then _loki_e10_detach "$_lb" ${_e10_rest[@]+"${_e10_rest[@]}"}; fi
855
+ unset _e10_det _e10_rest _e10_dd _e10_a
856
+ ;;
857
+ esac
800
858
  exec "$_lb" "${_LOKI_BUN_SAFE[@]}" "$BUN_CLI" engine10 ${_e10_args[@]+"${_e10_args[@]}"}
801
859
  fi
802
860
  unset _e10 _e10_args _e10_hard
@@ -886,6 +944,7 @@ fi
886
944
  # Bun-routed `report kpis` is not invisible to usage analytics (the v7.8.2 parity
887
945
  # the case-arm comment documents). Backgrounded, FD-detached, opt-out honored by
888
946
  # loki_telemetry itself.
947
+ _bun_two_token=0
889
948
  if [ "${1:-}" = "report" ]; then
890
949
  _report_first_sub=""
891
950
  for _report_arg in "${@:2}"; do
@@ -894,22 +953,26 @@ if [ "${1:-}" = "report" ]; then
894
953
  *) _report_first_sub="$_report_arg"; break ;;
895
954
  esac
896
955
  done
897
- if [ "$_report_first_sub" = "kpis" ]; then
898
- if command -v curl &>/dev/null && [ -f "$REPO_ROOT/autonomy/telemetry.sh" ]; then
899
- # Disclose once before egress if collection is genuinely enabled
900
- # (covers the case where a cli_command is the first ENABLED egress,
901
- # e.g. first run was CI/auto-off so .loki-first-run is already set).
902
- # AC3: foreground gate evaluation (no FD detach) so the exported
903
- # LOKI_TTY_INTERACTIVE signal / real TTY drives the verdict.
904
- if ( SCRIPT_DIR="$REPO_ROOT/autonomy"; source "$SCRIPT_DIR/telemetry.sh" 2>/dev/null \
905
- && declare -f _loki_telemetry_enabled >/dev/null 2>&1 && _loki_telemetry_enabled ); then
906
- _loki_disclose_telemetry_once
907
- fi
908
- ( SCRIPT_DIR="$REPO_ROOT/autonomy"; source "$SCRIPT_DIR/telemetry.sh" 2>/dev/null && loki_telemetry "cli_command" "command=$(_loki_known_command "${1:-}")" 2>/dev/null ) >/dev/null 2>&1 </dev/null &
909
- disown 2>/dev/null || true
956
+ [ "$_report_first_sub" = "kpis" ] && _bun_two_token=1
957
+ fi
958
+ # `review queue` (open Loki PRs ranked by risk) is Bun-only; `review` stays bash for every other form.
959
+ # Exactly `review queue` as the first two tokens, so a path or flag value named queue is never hijacked.
960
+ [ "${1:-}" = "review" ] && [ "${2:-}" = "queue" ] && _bun_two_token=1
961
+ if [ "$_bun_two_token" = "1" ]; then
962
+ if command -v curl &>/dev/null && [ -f "$REPO_ROOT/autonomy/telemetry.sh" ]; then
963
+ # Disclose once before egress if collection is genuinely enabled
964
+ # (covers the case where a cli_command is the first ENABLED egress,
965
+ # e.g. first run was CI/auto-off so .loki-first-run is already set).
966
+ # AC3: foreground gate evaluation (no FD detach) so the exported
967
+ # LOKI_TTY_INTERACTIVE signal / real TTY drives the verdict.
968
+ if ( SCRIPT_DIR="$REPO_ROOT/autonomy"; source "$SCRIPT_DIR/telemetry.sh" 2>/dev/null \
969
+ && declare -f _loki_telemetry_enabled >/dev/null 2>&1 && _loki_telemetry_enabled ); then
970
+ _loki_disclose_telemetry_once
910
971
  fi
911
- exec bun "${_LOKI_BUN_SAFE[@]}" "$BUN_CLI" "$@"
972
+ ( SCRIPT_DIR="$REPO_ROOT/autonomy"; source "$SCRIPT_DIR/telemetry.sh" 2>/dev/null && loki_telemetry "cli_command" "command=$(_loki_known_command "${1:-}")" 2>/dev/null ) >/dev/null 2>&1 </dev/null &
973
+ disown 2>/dev/null || true
912
974
  fi
975
+ exec bun "${_LOKI_BUN_SAFE[@]}" "$BUN_CLI" "$@"
913
976
  fi
914
977
 
915
978
  # Commands ported in Phase 2 -- route to Bun. Everything else goes to bash.
package/completions/_loki CHANGED
@@ -286,148 +286,17 @@ function _loki {
286
286
  function _loki_commands {
287
287
  local -a commands
288
288
  commands=(
289
- 'start:Start Loki Mode'
290
- 'quick:Quick single-task mode'
291
- 'quickstart:Guided first build from your idea'
292
- 'monitor:Monitor Docker Compose services with auto-fix'
293
- 'demo:Interactive 60-second demo'
294
- 'tour:Offline sample receipt replay (no key, no spend)'
295
- 'wow:Tiny real task in a temp repo, or the offline sample'
296
- 'try:Try Loki on a public repo in a temp clone, keep only the receipt'
297
- 'factory:loki start with the autonomy policy printed'
298
- 'welcome:Friendly first-run opener (what Loki is, next steps)'
299
- 'init:Interactive PRD builder'
300
- 'stop:Stop execution'
301
- 'pause:Pause execution'
302
- 'resume:Resume execution'
303
- 'cancel:Cancel the active Loki 10 run'
304
- 'steer:Steer a running build with a note (needs LOKI_PROMPT_INJECTION=1)'
305
- 'status:Show status'
306
- 'next:Run the right next step for the current build'
307
- 'ship:Finish the build (gates + PR advice) in one command'
308
- 'why:Explain why the last run did what it did'
309
- 'dashboard:Dashboard commands'
310
- 'web:Start the web app surface'
311
- 'logs:View session logs'
312
- 'serve:Start API server'
313
- 'api:API server commands'
314
- 'sandbox:Docker sandbox commands'
315
- 'docker:Run Loki in a Docker container'
316
- 'notify:Notification commands'
317
- 'import:Import GitHub issues'
318
- 'issue:GitHub issue commands'
319
- 'github:GitHub integration commands'
320
- 'config:Config commands'
321
- 'provider:Provider commands'
322
- 'reset:Reset session state'
323
- 'memory:Memory commands'
324
- 'compound:Knowledge compounding commands'
325
- 'checkpoint:Snapshot and restore session state'
326
- 'cp:Snapshot and restore session state (alias of checkpoint)'
327
- 'council:Completion council commands'
328
- 'dogfood:Self-development statistics'
329
- 'projects:Project registry commands'
330
- 'enterprise:Enterprise feature commands'
331
- 'secrets:Secrets and API key management'
332
- 'cockpit:Live cockpit view of a running build'
333
- 'secure:Secure-by-default gate (findings and waivers)'
334
- 'own:Finish-and-own ownership handoff'
335
- 'backup:Back up dashboard state (verified archive)'
336
- 'restore:Restore dashboard state from a verified backup archive'
337
- 'telemetry:OpenTelemetry management'
338
- 'agent:Agent type dispatch'
339
- 'doctor:Check system prerequisites'
340
- 'watchdog:Watchdog process supervision'
341
- 'docs:Documentation commands'
342
- 'onboard:Analyze repo and generate CLAUDE.md'
343
- 'metrics:Session productivity report'
344
- 'share:Share session report as GitHub Gist'
345
- 'proof:Inspect/share proof-of-run artifacts'
346
- 'outcomes:What happened to the work AFTER the receipt (reverted/reworked/survived)'
347
- 'preview:Preview the locally-running app'
348
- 'deploy:Deploy the built product (CI/CD-aware)'
349
- 'context:Context window management'
350
- 'ctx:Context window management (alias)'
351
- 'code:Codebase intelligence'
352
- 'web:Start the web dashboard'
353
- 'plan:Preview the build plan for a spec'
354
- 'report:Reporting commands (cost, kpis, share)'
355
- 'cost:Show cost of recent runs (--detail for cache + trend)'
356
- 'estimate:Estimate run cost from run history (--json, --model, --provider)'
357
- 'kpis:Key performance indicators'
358
- 'stats:Session statistics'
359
- 'preview:Open the running app preview'
360
- 'deploy:Advisory deploy command (print-only)'
361
- 'docker:Run Loki in a Docker container'
362
- 'mcp:MCP server commands'
363
- 'merge:Green-only serial merge queue'
364
- 'acp:Agent Client Protocol agent over stdio'
365
- 'magic:Spec-driven component generation'
366
- 'assets:Export/import shareable team assets'
367
- 'spec:Living spec drift detection'
368
- 'intent:Does the spec still say what was actually wanted'
369
- 'verify:Deterministic PR verification'
370
- 'keys:Export the receipt-signing public key'
371
- 'grill:Interrogate a spec before building'
372
- 'trust:Visible trust trajectory'
373
- 'trust-metrics:Trust metrics report'
374
- 'why:Explain the last build outcome'
375
- 'heal:Legacy system healing'
376
- 'modernize:Modernize a legacy system'
377
- 'migrate:Migration commands'
378
- 'analyze:Analyze a codebase'
379
- 'compliance:Compliance reporting'
380
- 'crash:Crash report management'
381
- 'otel:OpenTelemetry management'
382
- 'wiki:Wiki commands'
383
- 'answer:Answer a BLOCKED run; it continues under the same run id'
384
- 'verify-pr:Verify a PR against its linked issue in a sandbox'
385
- 'queue:Overnight issue queue with a morning digest'
386
- 'issues:Run every open issue in a repo and open PRs'
387
- 'runs:List runs across the projects registered with loki projects add'
388
- 'undo:Show what undoing a run would do (read-only plan; --dry-run adds the diffstat; --list shows recent runs)'
389
- 'chat:Interactive chat session (run, attach)'
390
- 'route:Print the engine, provider and model route without running'
391
- 'edit:Make a scoped edit to files'
392
- 'setup:First-run wizard for tools, provider, model route and spend cap'
393
- 'models:List models and routes (--local for local models)'
394
- 'agents:List, scaffold, show and export agent definitions'
395
- 'diff:Show what the last run changed'
396
- 'control:Control plane (preview, LOKI_CONTROL=1)'
397
- 'workspace:Multi-project workspaces (preview, LOKI_WORKSPACES=1)'
398
- 'backlog:Run every matching open issue, N in parallel'
399
- 'explain:Explain Loki concepts'
400
- 'optimize:Optimization commands'
401
- 'review:Code review commands'
402
- 'export:Export session data'
403
- 'test:Run tests'
404
- 'ci:CI helpers'
405
- 'watch:Watch mode'
406
- 'audit:Audit commands'
407
- 'syslog:System log commands'
408
- 'cluster:Cluster commands'
409
- 'failover:Failover commands'
410
- 'remote:Remote execution commands'
411
- 'worktree:Git worktree commands'
412
- 'wt:Git worktree commands (alias)'
413
- 'trigger:Trigger commands'
414
- 'cleanup:Clean up Loki state'
415
- 'rollback:Roll back a change'
416
- 'update:Update Loki Mode'
417
- 'self-update:Update Loki Mode'
418
- 'setup-skill:Set up the Claude Code skill'
419
- 'quickstart:Quickstart guide'
420
- 'sentrux:Sentrux integration'
421
- 'state:Inspect run state'
422
- 'template:PRD template commands'
423
- 'ultracode:Ultra code review'
424
- 'voice:Voice commands'
425
- 'bench:Run benchmarks'
426
- 'open:Open a project resource'
427
- 'rc:Release candidate commands'
428
- 'version:Show version (--json for machine-readable)'
429
- 'completions:Output shell completions'
430
- 'help:Show help'
289
+ 'start:Build from a goal, a PRD file or an issue'
290
+ 'chat:Talk it through; --attach joins the running build'
291
+ 'status:What is running, how it ended, what to do next'
292
+ 'verify:Deterministic verification with CI exit codes'
293
+ 'receipt:The signed proof of a run'
294
+ 'stop:Stop the running build'
295
+ 'undo:Plan or apply an undo of a run'
296
+ 'deploy:Deploy a VERIFIED run'
297
+ 'doctor:Check and repair your setup'
298
+ 'config:Show or change settings'
299
+ 'control:The local UI (Control Plane)'
431
300
  )
432
301
  _describe -t commands 'loki command' commands
433
302
  }
@@ -4,8 +4,10 @@ _loki_completion() {
4
4
  local cur prev words cword
5
5
  _init_completion || return
6
6
 
7
- # Main subcommands (must match autonomy/loki main case statement)
8
- local main_commands="start backlog quick monitor demo tour wow try factory welcome init stop pause resume cancel steer status next ship dashboard web serve api sandbox notify import github issue intent config provider reset memory compound checkpoint council dogfood projects enterprise secrets cockpit secure own handoff doctor watchdog audit metrics syslog onboard share proof receipt outcomes explain plan report cost estimate kpis stats test ci watch telemetry agent context ctx code run export review optimize heal modernize migrate cluster worktree wt trigger failover remote deploy docker mcp magic assets analyze compliance crash control workspace open otel preview quickstart rc rollback merge self-update sentrux setup-skill spec state template trust trust-metrics ultracode update verify voice why wiki bench cleanup logs grill docs cp version completions help keys answer queue issues undo runs acp verify-pr chat route edit setup models agents diff backup restore"
7
+ # Main subcommands: exactly the 11 KEEP commands of loki-ts/src/cli/registry.ts
8
+ # (tests/min/cli-entrypoints.sh compares them). Hidden commands still dispatch and
9
+ # keep their own flag completion in the case blocks below.
10
+ local main_commands="start chat status verify receipt stop undo deploy doctor config control"
9
11
 
10
12
  # 1. If we are on the first argument (subcommand)
11
13
  if [[ $cword -eq 1 ]]; then
@@ -7,6 +7,6 @@ Modules:
7
7
  control: Session control helpers (status, atomic writes, origin check)
8
8
  """
9
9
 
10
- __version__ = "11.128.1"
10
+ __version__ = "11.129.0"
11
11
 
12
12
  __all__ = ["__version__"]
@@ -1,43 +1,53 @@
1
1
  # Core verbs (CLI reference)
2
2
 
3
- The commands most people use, with their main flags. The complete generated
3
+ The 11 commands in `loki --help`, with their main flags. The complete generated
4
4
  command table is `docs/CLI-REFERENCE.md` (do not edit that file by hand).
5
- `loki help` prints the grouped summary; `loki help all` prints every command;
5
+ `loki help` prints the 11; `loki help all` adds the hidden and renamed commands;
6
6
  `loki help <topic>` prints a topic (start, models, providers, agents, verify,
7
- exit-codes, config); `loki help <command>` runs `<command> --help`. Scripts that
8
- parse the old default `loki help` output must switch to `loki help all`.
7
+ exit-codes, config); `loki help <command>` runs `<command> --help`. Every other command keeps working
8
+ unchanged; it is just not shown on the front page.
9
9
 
10
10
  `loki start` is the primary path. Everything else is a shortcut, a check, or an
11
11
  alternative surface for the same engine. Claude Code is the default Tier-1
12
12
  provider; other providers and model routes are additions selected with
13
13
  `--provider` or `LOKI_MODEL_ROUTE`.
14
14
 
15
- ## Start
15
+ ## The 11 commands
16
16
 
17
17
  | Command | What it does |
18
18
  | --- | --- |
19
- | `loki start [SPEC]` | The primary path. Build from a PRD file, an issue (`owner/repo#N`, issue URL, `PROJ-1`), a quoted task or a one-word brief. Alias: `run`. Shorthand: `loki "<task>"`, `loki owner/repo#N` |
20
- | `loki edit "<change>"` | One targeted change to the current repo in one pass. No PRD, plan, council, PR or branch switch |
21
- | `loki quick "<task>"` | One small task with a verify loop, no PR |
22
- | `loki chat` | Interactive alternative to `loki start` (Plan and Build modes, slash commands) |
19
+ | `loki "<goal>"` | Build it: a goal, a PRD file or an issue (`owner/repo#N`). Shorthand for `loki start` |
20
+ | `loki start [SPEC]` | The primary path. Build from a PRD file, an issue (`owner/repo#N`, issue URL, `PROJ-1`), a quoted task or a one-word brief. Alias: `run` |
21
+ | `loki chat [--attach]` | Interactive alternative to `loki start`; `--attach` joins the running build |
22
+ | `loki status [--json]` | What is running and where it stands |
23
+ | `loki verify [base] [--fast] [--json] [--pubkey FILE]` | Deterministic verification with CI-gate exit codes |
24
+ | `loki receipt [run]` | The proof-of-run receipt (`list`, `show`, `open`, `share`, `badge`, `md`, `bundle`). `proof` is the old name and still works |
25
+ | `loki stop` | Stop the running build |
26
+ | `loki undo <run> [--plan]` | Plan or apply an undo of a run |
27
+ | `loki deploy` | Deploy a VERIFIED run |
28
+ | `loki doctor [--fix] [--json]` | Check prerequisites, providers and login. `--fix` creates state dirs and a default config and prints exact commands for the rest; never runs sudo |
29
+ | `loki config list\|get\|set\|path\|show\|validate` | Settings; `config list --json` for machines |
30
+ | `loki control serve` | The local UI (Control Plane): `serve`, `stop`, `status`, `backfill`, `prune` |
23
31
 
24
- `start` flags: `--no-pr`, `--deep`, `--provider NAME`, `--max-cost USD`
32
+ `start` flags: `--no-pr`, `--deep`, `--provider NAME`, `--model ID`, `--max-cost USD`
25
33
  (aliases `--budget`, `--budget-limit`), `--session-model TIER`, `-v` (verbose),
26
- `--quiet`, `--json`, `--engine legacy|engine10`, `--explain-route`. Flags that
34
+ `--quiet`, `--json`, `--detach` (`-d`), `--engine legacy|engine10`, `--explain-route`. Flags that
27
35
  only the previous loop honors (`--simple`, `--complex`, `--parallel`,
28
36
  `--isolation`, `--sandbox`, `--max-iterations`, `--compliance`, ...) send that
29
37
  one call to the previous loop with a one-line notice.
30
38
 
39
+ ### Run in the background
40
+
41
+ `loki start "<task>" --detach` (also `loki "<task>" --detach`, `loki owner/repo#N --detach`, `loki quick ... --detach`) starts the run in its own session and returns at once, so closing the terminal or logging out does not stop it. It prints the pid and the log path (`.loki/logs/detached-*.log`); follow it with `loki status --follow`, stop it with `loki cancel`. When it finishes it reports as a foreground run does: a VERIFIED run opens a ready PR, a PARTIAL run a draft PR, an issue run posts its status comment, and Slack gets the PR, blocked, stuck and finished messages when `LOKI_SLACK_WEBHOOK_URL` is set (see `docs/slack.md`). Exit code: 0 once detached; if the engine refuses or fails within the first `LOKI_DETACH_SETTLE_S` seconds (default 3) the launcher prints the log tail and exits with the engine's own code, and a refusal that comes later lands only in the log (also check `loki status`). Two runs in one checkout are refused by the run lock. The detached run has no terminal, so prompts and the cost forecast behave as in CI. On macOS the run holds a `caffeinate -i` assertion, which blocks idle sleep only: a closed lid on battery still sleeps the Mac. For a run that must survive that, use a machine that stays on, such as the issue-to-pr workflow on a `runs-on: self-hosted` runner (`docs/examples/loki-issue-to-pr.yml.example`, not changed or tested by this feature). Not yet supported with `--spec` or `--attempts`.
42
+
31
43
  Spend cap: `--max-cost`, else `budgets.per_run` in `loki.yaml`, else $100 when
32
44
  `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` is set, else no dollar cap
33
45
  (subscription). Model routes: `LOKI_MODEL_ROUTE=ollama/qwen3-coder loki start prd.md`.
34
46
 
35
- ### loki edit
36
-
37
- `loki edit [paths...] "<change>"` with `--verify` (fast verifier), `--receipt`
38
- (unsigned receipt in `.loki/edit-receipts/`), `--commit` (only touched files, by
39
- name; skipped when verify failed) and `--dry-run` (plan only). `LOKI_EDIT_MODEL`
40
- overrides the model. Claude provider only for now.
47
+ Every run ends with one unified summary on both engines: `Result:`, `Files:`,
48
+ `Cost:` (marked `(estimated)` or `not measured`), `Elapsed:`, `Receipt:` and a
49
+ `next:` line. `--quiet` prints only that block; `--json` adds a `summary`
50
+ object; `NO_COLOR=1` disables color.
41
51
 
42
52
  ### loki chat
43
53
 
@@ -50,31 +60,45 @@ running or the last `loki start` session (`/status`, `/steer`, `/diff`,
50
60
  `/verify`, `/receipt`, `/stop`). `loki chat --tui` launches the Claude Code TUI
51
61
  with Loki context. Bare `loki` does not open chat.
52
62
 
53
- ## Check
63
+ ### loki edit (renamed, still works)
54
64
 
55
- | Command | What it does |
56
- | --- | --- |
57
- | `loki status [--json]` | Current run status |
58
- | `loki verify [--fast] [--json] [--pubkey FILE]` | Deterministic verification with CI-gate exit codes |
59
- | `loki receipt` (alias of `proof`) | Inspect the proof-of-run receipt |
60
- | `loki diff` / `loki undo <run> [--plan]` | Show what a run changed; plan or apply an undo |
61
- | `loki route [start\|quick] <args> [--json]` | Print the engine, provider, model, input type and reason without running |
65
+ `loki edit [paths...] "<change>"` with `--verify` (fast verifier), `--receipt`
66
+ (unsigned receipt in `.loki/edit-receipts/`), `--commit` (only touched files, by
67
+ name; skipped when verify failed) and `--dry-run` (plan only). `LOKI_EDIT_MODEL`
68
+ overrides the model. Claude provider only for now.
62
69
 
63
- Every run ends with one unified summary on both engines: `Result:`, `Files:`,
64
- `Cost:` (marked `(estimated)` or `not measured`), `Elapsed:`, `Receipt:` and a
65
- `next:` line. `--quiet` prints only that block; `--json` adds a `summary`
66
- object; `NO_COLOR=1` disables color.
70
+ ## Commands that moved
67
71
 
68
- ## Configure
72
+ Nothing was removed in this release: every command below still runs exactly as
73
+ before and is only hidden from `loki --help` and completions. The Replacement
74
+ column is where its behavior is going; a few targets arrive in later releases
75
+ (for example `loki start --answer` and `loki receipt key`), and until each one
76
+ lands the old name is the way to do it. `loki help all` prints this list and the
77
+ hidden commands for machine consumers, CI and operators (`review`, `merge`,
78
+ `workspace`, `trigger`, `memory`, `report`, `mcp`, `acp`, ...). The full table,
79
+ with the planned removal of commands that have no dependents, is the generated
80
+ `docs/CLI-INVENTORY.md`.
69
81
 
70
- | Command | What it does |
82
+ | Old command | Replacement |
71
83
  | --- | --- |
72
- | `loki setup [--yes] [--check]` | First-run wizard: tools, Claude login, provider, model route, spend cap. Flags: `--provider`, `--model`, `--budget USD`, `--global` |
73
- | `loki doctor [--fix] [--json]` | Check prerequisites, providers and login. `--fix` creates state dirs and a default config and prints exact commands for the rest; never runs sudo |
74
- | `loki config list\|get\|set\|path\|show\|validate` | Settings; `config list --json` for machines |
75
- | `loki models [--local] [--json]` | Model routes (openrouter, ollama, lmstudio, llamacpp, vllm, custom); `--local` probes local runtimes and prints ready-to-paste values |
76
- | `loki agents list\|new\|show\|export --claude` | Custom child agents in `.loki/agents/*.md` (project) or `~/.config/loki/agents/` (user). `loki agent` (singular) is the unchanged built-in agent-type command |
77
- | `loki provider list\|set NAME` | Providers and install status |
84
+ | `quick "<task>"`, `edit "<change>"` | `loki "<task>" --no-pr` |
85
+ | `run`, `resume` | `loki start` |
86
+ | `answer` | `loki start --answer "<text>"` |
87
+ | `steer` | `loki chat --attach` |
88
+ | `issues`, `queue`, `backlog` | `loki start owner/repo ...` |
89
+ | `plan`, `estimate` | `loki start <PRD> --dry-run` |
90
+ | `setup` | `loki doctor --fix` |
91
+ | `models`, `provider` | `loki config` |
92
+ | `proof`, `keys` | `loki receipt` |
93
+ | `verify-pr` | `loki verify <PR url>` |
94
+ | `rollback` | `loki undo <run>` |
95
+ | `dashboard` | `loki control serve` |
96
+ | `why`, `trust` | `loki status` |
97
+ | `quickstart`, `tour`, `demo`, `wow`, `factory` | `loki start` (first run) |
98
+ | `docs` | `loki help` |
99
+
100
+ `loki route [start|quick] <args> [--json]` still prints the engine, provider,
101
+ model, input type and reason without running anything.
78
102
 
79
103
  ## --json
80
104