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/autonomy/loki CHANGED
@@ -1840,98 +1840,52 @@ show_help_all() {
1840
1840
  if [ ! -t 1 ]; then
1841
1841
  BOLD=''; NC=''
1842
1842
  fi
1843
+ # shellcheck source=/dev/null
1844
+ source "$_LOKI_SCRIPT_DIR/lib/help-core.sh"
1843
1845
  echo -e "${BOLD}Loki Mode v$version${NC}"
1844
1846
  echo ""
1845
- echo "Usage: loki <command> [options]"
1846
- echo ""
1847
- echo "New here? Try these in order:"
1848
- echo " loki setup One-step wizard: tools, provider login, model route, spend cap (--yes for defaults)"
1849
- echo " loki welcome Friendly first-run opener (what Loki is, next steps)"
1850
- echo " loki doctor Check your setup is ready (a few seconds)"
1851
- echo " loki quickstart Guided first build from your idea (no PRD needed)"
1852
- echo " loki start ./prd.md Build from a spec (PRD file, GitHub/GitLab/Jira/Azure issue, or no arg)"
1853
- echo " quickstart = guided first build; quick = one small task (Loki 10 engine, no PR)."
1854
- echo " loki \"<task>\", loki owner/repo#N and loki quick run on the Loki 10 engine by default."
1855
- echo " Docs: https://github.com/asklokesh/loki-mode | Report a problem: loki crash"
1856
- echo ""
1857
- # CLI consolidation (Phase A): the front page presents ~17 canonical
1858
- # workflow-oriented entries grouped by section. Deprecated alias names
1859
- # (stats, metrics, cost, trust-metrics, serve, open, otel, cp, wt, rc, ...)
1860
- # do NOT appear here; they live in the collapsed footer below and in
1861
- # `loki help aliases`. The full long-tail surface is still dispatchable and
1862
- # documented per-command via `loki <command> --help`.
1863
- #
1864
- # v7.39.0: trimmed three lower-traffic canonical entries off the front page
1865
- # to hold the lean target after `ultracode` (v7.38.0) joined Verify/trust:
1866
- # grill (pre-build spec interrogation, advanced), spec (living-spec drift,
1867
- # advanced), and cleanup (orphaned-process recovery, rare). They remain
1868
- # fully canonical (NOT aliases), dispatchable, and listed in the "More
1869
- # commands" footer below + documented via `loki <command> --help`.
1870
- echo "Commands:"
1871
- echo ""
1872
- echo "Build:"
1873
- echo " start [SPEC] Start a build (PRD file, GitHub/GitLab/Jira/Azure issue, or no arg)"
1874
- echo " plan <PRD-file> Dry-run analysis: complexity, cost, execution plan"
1875
- echo " backlog <owner/repo> --all|--label X|--issues N,N Run every matching open issue, N in parallel"
1876
- echo " workspace list | infer <name> | run <name> <ref> Multi-repo runs from loki.yaml workspaces (LOKI_WORKSPACES=0 disables)"
1877
- echo " start --workspace <name> \"<brief>\" Run a workspace; start --deploy [--health-url U] deploys after a VERIFIED run"
1878
- echo " quickstart [idea] Guided first build: setup, idea, template, plan, go"
1879
- echo " try <repo-url> Try Loki on a public repo in a temp clone (--dry-run previews); only the receipt is kept"
1880
- echo ""
1881
- echo "Session:"
1882
- echo " status [--json|--badge|--probe] Show current status (--json machine-readable, --badge deploy badge, --probe re-check deploy health)"
1883
- echo " next Run the right next step for you (resume / ship / why)"
1884
- echo " stop Stop execution immediately"
1885
- echo " pause Pause after current session"
1886
- echo " resume Resume a paused or interrupted run (after Ctrl-C or a crash)"
1887
- echo " cancel Cancel the active Loki 10 run at its next stage boundary"
1888
- echo " steer \"<note>\" Nudge a running build (Loki 10 engine; legacy loop needs LOKI_PROMPT_INJECTION=true)"
1847
+ # The 11 core commands, then the hidden ones, then the renamed ones. The two
1848
+ # lists below are the HIDE and FOLD classes of loki-ts/src/cli/registry.ts;
1849
+ # tests/min/cli-entrypoints.sh fails when they drift from it.
1850
+ help_core_commands
1889
1851
  echo ""
1890
- echo "Verify / trust:"
1891
- echo " verify [base] [--fast] Deterministic PR verification (CI-gate exit codes; --fast: no model, no network)"
1892
- echo " verify-pr <pr> Verify a PR against its linked issue; 'verify-pr respond <pr>' fixes review comments"
1893
- echo " keys export Print the public receipt-signing key (JWK) for third-party verify --pubkey"
1894
- echo " review [opts] Standalone code review with quality gates"
1895
- echo " ultracode \"task\" Run a task as a native Claude Code Dynamic Workflow (opt-in, Claude-only)"
1896
- echo " trust [cmd] Visible trust trajectory; 'trust detail' for metrics"
1897
- echo " undo <run> [--plan|--dry-run] Plan or apply (LOKI_UNDO=1) an undo of a run; verifies the receipt"
1898
- echo " undo --list List recent runs with verdict, files changed and age"
1852
+ echo "Integration and maintenance (hidden from the front page; they keep working):"
1853
+ echo " stats memory backup restore kpis report crash contract slack engine10 review mcp acp github"
1854
+ echo " ci modernize self-update secrets sandbox docker web syslog test bench compliance enterprise"
1855
+ echo " audit metrics magic workspace agents trigger merge heal"
1899
1856
  echo ""
1900
- echo "Observe:"
1901
- echo " dashboard [cmd] Operations UI server (start|stop|status|url|open)"
1902
- echo " mcp Launch the MCP server (Model Context Protocol, stdio)"
1903
- echo " acp Run Loki as an ACP agent over stdio (VS Code, JetBrains, Zed)"
1904
- echo ""
1905
- echo "Report:"
1906
- echo " report [cmd] Reporting: session|metrics|cost|export|share|dogfood|release-notes"
1907
- echo ""
1908
- echo "Knowledge:"
1909
- echo " analyze [cmd] Codebase intelligence: explain|onboard|code|context"
1910
- echo " memory [cmd] Cross-project learnings (list|show|search|stats|compound)"
1911
- echo ""
1912
- echo "Modernize:"
1913
- echo " modernize [cmd] Legacy modernization: heal|migrate"
1914
- echo ""
1915
- echo "Config:"
1916
- echo " config [cmd] Manage configuration (show|init|edit|path|set|get)"
1917
- echo " doctor [--json] [--quiet] Check system prerequisites and skill symlinks"
1918
- echo ""
1919
- echo " version [--json] Show version (--json for machine-readable)"
1920
- echo " help Show this help ('loki help aliases' for old names)"
1921
- echo ""
1922
- echo "More commands (the most useful; many more are dispatchable):"
1923
- echo " Advanced: ship, deploy, init, web"
1924
- echo " Cloud + CI: github, import, ci"
1925
- echo " Debugging: logs, crash, cleanup"
1926
- echo "...run 'loki help <name>' for any command."
1927
- echo ""
1928
- echo "Aliases (deprecated): older command names still work; they print a"
1929
- echo "one-line pointer to stderr and never alter --json output. See the full"
1930
- echo "list with 'loki help aliases'."
1857
+ echo "Renamed (the old name keeps working unchanged; some targets arrive in later releases,"
1858
+ echo "and until each one lands the old name is the way to do it):"
1859
+ echo " provider -> loki config set provider NAME"
1860
+ echo " rollback -> loki undo <run>"
1861
+ echo " trust -> loki status --json"
1862
+ echo " queue -> loki start owner/repo#1 owner/repo#2"
1863
+ echo " issues -> loki start owner/repo --label L --limit N --parallel K"
1864
+ echo " verify-pr -> loki verify <PR url>"
1865
+ echo " answer -> loki start --answer \"<text>\""
1866
+ echo " edit -> loki \"<change>\" --no-pr"
1867
+ echo " models -> loki config list"
1868
+ echo " setup -> loki doctor --fix"
1869
+ echo " quick -> loki \"<task>\" --no-pr"
1870
+ echo " quickstart -> loki \"<idea>\" in an empty folder"
1871
+ echo " keys -> loki receipt key"
1872
+ echo " dashboard -> loki control serve"
1873
+ echo " resume -> loki start"
1874
+ echo " why -> loki status"
1875
+ echo " tour -> loki start outside a repo"
1876
+ echo " wow -> loki start outside a repo"
1877
+ echo " factory -> loki start -v"
1878
+ echo " docs -> loki help"
1879
+ echo " estimate -> loki start <PRD> --dry-run"
1880
+ echo " plan -> loki start <PRD> --dry-run"
1881
+ echo " backlog -> loki start owner/repo --label L --parallel K"
1882
+ echo " steer -> loki chat --attach"
1883
+ echo " demo -> loki start outside a repo"
1884
+ echo " run -> loki start"
1931
1885
  echo ""
1932
1886
  echo "Options for 'start':"
1933
1887
  echo " --provider NAME AI provider: claude (default) or opencode"
1934
- echo " (model route: set LOKI_MODEL_ROUTE, e.g. ollama/qwen3-coder; there is no --model flag)"
1888
+ echo " --model ID Model tier or id (small, opus, ollama/qwen3-coder, openrouter/<id>); a route can also be set with LOKI_MODEL_ROUTE"
1935
1889
  echo " --simple Force simple complexity tier (3 phases)"
1936
1890
  echo " --complex Force complex complexity tier (8 phases)"
1937
1891
  echo " --no-dashboard Disable web dashboard"
@@ -1955,29 +1909,12 @@ show_help_all() {
1955
1909
  echo ""
1956
1910
  echo "Examples:"
1957
1911
  echo ""
1958
- echo " # Starting a session"
1959
- echo " loki start ./prd.md # Start with PRD file"
1960
- echo " loki start owner/repo#123 # GitHub issue (auto-fetches)"
1961
- echo " loki start PROJ-456 # Jira issue"
1962
- echo " loki quick \"add dark mode\" # Single-task mode (Loki 10 engine)"
1963
- echo " loki tour # See a real sample result (no provider, no key, no spend)"
1964
- echo " loki tour --live # Same as loki wow: a tiny real task when a provider is ready"
1965
- echo " loki wow # Live mini-task, or the offline sample when no key is available"
1966
- echo " loki factory \"<task>\" # loki start, and print the autonomy policy"
1967
- echo " loki demo # Build a sample todo app end to end"
1968
- echo " loki init -t saas-starter # Scaffold from template"
1969
- echo " loki template install <src> # Install a community PRD template"
1970
- echo ""
1971
- echo " # Session ops + observability"
1972
- echo " loki status [--json] # Current status"
1973
- echo " loki report session --efficiency # Token + cost stats"
1974
- echo " loki report kpis [--json] # Accuracy + efficiency KPI snapshot"
1975
- echo " loki report kpis --since 7d # Window KPI totals (Nd or YYYY-MM-DD)"
1976
- echo " loki doctor [--json] # System prereq + skill symlinks"
1977
- echo " loki logs # Tail recent log output"
1978
- echo " loki report export json|markdown|csv|timeline # Export session"
1979
- echo " loki assets export team.tgz # Export shareable team assets (redacted)"
1980
- echo " loki cleanup # Kill orphaned processes"
1912
+ echo " loki start ./prd.md # Build from a PRD file"
1913
+ echo " loki start owner/repo#123 # Build from a GitHub issue"
1914
+ echo " loki start ./prd.md --dry-run # Quote complexity and cost, change nothing"
1915
+ echo " loki status --json # What is running, as JSON"
1916
+ echo " loki verify --json # Machine-readable verification for CI"
1917
+ echo " loki doctor --fix # Check setup and repair what it can"
1981
1918
  echo ""
1982
1919
  echo " # Providers + model routing"
1983
1920
  echo " loki provider list # Show available providers, including opencode"
@@ -1996,50 +1933,6 @@ show_help_all() {
1996
1933
  echo " # only the OpenAI-shaped /v1/chat/completions. Use the opencode"
1997
1934
  echo " # route above for OpenRouter."
1998
1935
  echo ""
1999
- echo " # Cross-project context (Phase F)"
2000
- echo " # Drop .loki/app.json with {schema_version:1,app_id:myapp,members:[ui,api]}"
2001
- echo " # at the parent of related repos for shared CLAUDE.md + memory."
2002
- echo ""
2003
- echo " # Memory + learnings"
2004
- echo " loki memory list # All learnings"
2005
- echo " loki memory search <query> # Search across learnings"
2006
- echo " loki memory consolidate # Run episodic-to-semantic pipeline"
2007
- echo " loki memory learn --recent N # Learn from the newest N merged PRs"
2008
- echo ""
2009
- echo " # Config + dashboard"
2010
- echo " loki config set maxTier sonnet # Cap model cost"
2011
- echo " loki dashboard start # Open the Control Plane UI"
2012
- echo " loki watch # Auto-rerun on PRD changes"
2013
- echo " loki cockpit # Live multi-repo cockpit (terminal image)"
2014
- echo " loki remote # Remote session (phone/browser)"
2015
- echo ""
2016
- # COMPLETE COMMAND INDEX. The curated sections above stay curated -- they
2017
- # are the onboarding path and stuffing 112 commands into them would make
2018
- # the first screen useless. But a command that appears NOWHERE in help does
2019
- # not exist to a user: measured, 43 of 112 were unreachable from here,
2020
- # including `loki proof` -- the Evidence Receipt, which is the whole trust
2021
- # argument. Discoverability is an adoption lever, not tidiness.
2022
- #
2023
- # tests/test-help-discoverability.sh fails the build when a real command is
2024
- # missing from this list, so a new command cannot ship invisible.
2025
- echo ""
2026
- echo "All commands:"
2027
- echo " agents chat diff edit models route"
2028
- echo " acp agent analyze api assets audit backlog backup bench cancel checkpoint (cp) ci cleanup"
2029
- echo " cluster cockpit code compliance completions compound config context (ctx)"
2030
- echo " cost council crash dashboard demo deploy docker docs doctor dogfood"
2031
- echo " enterprise estimate explain export factory failover github grill heal help"
2032
- echo " import init intent"
2033
- echo " issue keys kpis logs magic mcp memory metrics migrate modernize monitor"
2034
- echo " next notify onboard open optimize otel outcomes own (handoff) pause plan preview"
2035
- echo " projects proof (receipt) provider quick quickstart rc remote report reset"
2036
- echo " merge restore resume review rollback run runs sandbox secrets secure self-update sentrux"
2037
- echo " serve setup setup-skill share ship spec start state stats status steer stop"
2038
- echo " syslog telemetry template test tour trigger trust trust-metrics try"
2039
- echo " ultracode undo update verify version voice watch watchdog web welcome why"
2040
- echo " wiki workspace worktree (wt) wow"
2041
- echo " control"
2042
- echo ""
2043
1936
  echo "Any command: loki <command> --help"
2044
1937
  echo ""
2045
1938
  echo "Phase A-J features are default-on. See CHANGELOG."
@@ -4207,7 +4100,7 @@ cmd_start() {
4207
4100
  fi
4208
4101
 
4209
4102
  # Load saved provider if not specified on command line
4210
- if [ -z "$provider" ]; then
4103
+ if [ -z "$provider" ] && [ -z "${LOKI_PROVIDER:-}" ]; then
4211
4104
  if [ -f "$LOKI_DIR/state/provider" ]; then
4212
4105
  provider=$(cat "$LOKI_DIR/state/provider" 2>/dev/null)
4213
4106
  if [ -n "$provider" ]; then
@@ -6896,7 +6789,7 @@ cmd_status() {
6896
6789
  if [ -f "$LOKI_DIR/state/provider" ]; then
6897
6790
  saved_provider=$(cat "$LOKI_DIR/state/provider" 2>/dev/null)
6898
6791
  fi
6899
- local current_provider="${saved_provider:-${LOKI_PROVIDER:-claude}}"
6792
+ local current_provider="${LOKI_PROVIDER:-${saved_provider:-claude}}"
6900
6793
  # Show provider with capability
6901
6794
  local capability="full features"
6902
6795
  case "$current_provider" in
@@ -7781,11 +7674,11 @@ _cmd_provider_help() {
7781
7674
  echo ""
7782
7675
  echo "Precedence (highest wins):"
7783
7676
  echo " 1. loki start --provider NAME CLI flag (per-invocation)"
7784
- echo " 2. .loki/state/provider saved value (per-project)"
7785
- echo " 3. LOKI_PROVIDER env var shell session default"
7677
+ echo " 2. LOKI_PROVIDER env var shell session default"
7678
+ echo " 3. .loki/state/provider saved value (per-project)"
7786
7679
  echo " 4. claude built-in default"
7787
7680
  echo ""
7788
- echo " Note: 'loki status' reflects the SAVED provider, not the env var."
7681
+ echo " Note: LOKI_PROVIDER, when set, beats the saved value; 'loki status' and 'loki provider show' follow the same order."
7789
7682
  echo " Run 'loki provider set <name>' to make a project-level choice persist."
7790
7683
  echo ""
7791
7684
  echo "Examples:"
@@ -7805,9 +7698,9 @@ cmd_provider_show() {
7805
7698
  saved_provider=$(cat "$LOKI_DIR/state/provider" 2>/dev/null)
7806
7699
  fi
7807
7700
 
7808
- local current="${positional_arg:-${saved_provider:-${LOKI_PROVIDER:-claude}}}"
7809
- # A removed provider saved in .loki/state/provider: the migration line and how to clear it, as `loki start` says.
7810
- if [ -z "$positional_arg" ] && [ "$current" = "$saved_provider" ] && loki_is_removed_provider "$saved_provider"; then
7701
+ local current="${positional_arg:-${LOKI_PROVIDER:-${saved_provider:-claude}}}"
7702
+ # A removed provider saved in .loki/state/provider (and not overridden by LOKI_PROVIDER): the migration line and how to clear it, as `loki start` says.
7703
+ if [ -z "$positional_arg" ] && [ -z "${LOKI_PROVIDER:-}" ] && [ "$current" = "$saved_provider" ] && loki_is_removed_provider "$saved_provider"; then
7811
7704
  loki_removed_provider_message "$saved_provider" >&2
7812
7705
  loki_removed_saved_provider_hint "$saved_provider" >&2
7813
7706
  exit 2
@@ -7827,7 +7720,9 @@ cmd_provider_show() {
7827
7720
  ;;
7828
7721
  esac
7829
7722
 
7830
- if [ -n "$saved_provider" ]; then
7723
+ if [ -z "$positional_arg" ] && [ -n "${LOKI_PROVIDER:-}" ]; then
7724
+ echo -e "${DIM}(from LOKI_PROVIDER, which beats the saved choice)${NC}"
7725
+ elif [ -n "$saved_provider" ]; then
7831
7726
  echo -e "${DIM}(saved in .loki/state/provider)${NC}"
7832
7727
  else
7833
7728
  echo -e "${DIM}(default - not explicitly set)${NC}"
@@ -7893,7 +7788,7 @@ cmd_provider_list() {
7893
7788
  if [ -f "$LOKI_DIR/state/provider" ]; then
7894
7789
  saved_provider=$(cat "$LOKI_DIR/state/provider" 2>/dev/null)
7895
7790
  fi
7896
- local current="${saved_provider:-${LOKI_PROVIDER:-claude}}"
7791
+ local current="${LOKI_PROVIDER:-${saved_provider:-claude}}"
7897
7792
 
7898
7793
  # Check which CLIs are installed
7899
7794
  local claude_status="${RED}not installed${NC}"
@@ -21404,6 +21299,14 @@ print(json.loads(p.read_text()).get('port', 7373) if p.exists() else 7373)
21404
21299
  else
21405
21300
  echo "Schedules configured: 0"
21406
21301
  fi
21302
+ python3 "$trigger_server_script" --health
21303
+ ;;
21304
+ resume)
21305
+ if [[ -z "${1:-}" ]]; then
21306
+ echo "Usage: loki trigger resume <source>" >&2
21307
+ return 1
21308
+ fi
21309
+ python3 "$trigger_server_script" --resume "$1"
21407
21310
  ;;
21408
21311
  list)
21409
21312
  python3 "$trigger_schedule_script" list
@@ -21548,6 +21451,7 @@ for line in sys.stdin:
21548
21451
  echo " Start the webhook receiver server (default port: 7373)"
21549
21452
  echo " stop Stop the webhook receiver server"
21550
21453
  echo " status Show server and schedule status"
21454
+ echo " resume <source> Resume a source that auto-paused (also clears its failure count)"
21551
21455
  echo " list List configured schedules"
21552
21456
  echo " add schedule <name> <cron_expr> <action> [args...]"
21553
21457
  echo " Add a cron-based schedule trigger"
@@ -21559,9 +21463,14 @@ for line in sys.stdin:
21559
21463
  echo " help Show this help"
21560
21464
  echo ""
21561
21465
  echo "Webhook events handled:"
21562
- echo " issues (opened) -> loki run <issue_number> --pr --detach"
21563
- echo " pull_request (sync) -> loki run <pr_number> --detach"
21564
- echo " workflow_run (failure) -> loki run --detach"
21466
+ echo " issues opened -> loki start o/r#N --pr"
21467
+ echo " pull_request synchronize -> loki start o/r#N"
21468
+ echo " workflow_run failure on default branch -> loki start --brief <CI brief> --pr"
21469
+ echo " pull_request_review changes_requested -> loki verify-pr respond o/r#N"
21470
+ echo " /sentry, /slack, /linear, /jira, /teams -> PR-only or job runs"
21471
+ echo ""
21472
+ echo "Auto-pause: LOKI_TRIGGER_PAUSE_AFTER=N consecutive failed runs pause a source"
21473
+ echo "(default 3, 0 disables). 'loki trigger status' shows each source's health."
21565
21474
  echo ""
21566
21475
  echo "Schedule cron format: minute hour day-of-month month day-of-week"
21567
21476
  echo " Examples:"
@@ -24259,6 +24168,10 @@ cmd_ultracode() {
24259
24168
 
24260
24169
  # Standalone code review - diff-based quality gates (v6.20.0)
24261
24170
  cmd_review() {
24171
+ if [ "${1:-}" = "queue" ]; then
24172
+ echo "loki review queue needs the Bun runtime; unset LOKI_LEGACY_BASH" >&2
24173
+ return 2
24174
+ fi
24262
24175
  local review_staged=false
24263
24176
  local review_pr=""
24264
24177
  local review_since=""
@@ -26952,6 +26865,8 @@ except Exception as e:
26952
26865
  echo " loki memory crossproject --for 'build api'"
26953
26866
  echo " loki memory graph --export graph.json"
26954
26867
  echo " loki memory graph rebuild"
26868
+ echo " loki memory graph ingest [<path>...]"
26869
+ echo " loki memory graph ask \"who owns billing\" [--repo <dir>]"
26955
26870
  echo " loki memory enable-hook"
26956
26871
  echo " loki memory disable-hook"
26957
26872
  echo ""
@@ -27111,6 +27026,14 @@ except Exception as e:
27111
27026
  # semantic/*.json across discovered projects and persists them
27112
27027
  # to the org knowledge graph -- the population path that makes
27113
27028
  # crossproject + load_memory_context augmentation non-inert.
27029
+ # FR06: `ingest [<path>...]` reads services, CODEOWNERS and decision docs from repos into the
27030
+ # org graph (~/.loki/knowledge/graph.json); `ask "<question>"` prints the cited facts.
27031
+ if [ "${1:-}" = "ingest" ] || [ "${1:-}" = "ask" ]; then
27032
+ local _kg_args=("$@")
27033
+ if [ "${_kg_args[0]}" = "ingest" ] && [ "${#_kg_args[@]}" -eq 1 ]; then _kg_args+=("."); fi
27034
+ PYTHONPATH="${SKILL_DIR:-$(pwd)}" python3 "${SKILL_DIR:-$(pwd)}/memory/knowledge_graph.py" "${_kg_args[@]}"
27035
+ return $?
27036
+ fi
27114
27037
  if [ "${1:-}" = "rebuild" ]; then
27115
27038
  shift
27116
27039
  PYTHONPATH="${SKILL_DIR:-$(pwd)}" python3 -c "
@@ -27151,7 +27074,7 @@ except Exception as e:
27151
27074
  while [ $# -gt 0 ]; do
27152
27075
  case "$1" in
27153
27076
  --export) _graph_export="${2:-}"; if [ $# -ge 2 ]; then shift 2; else shift; fi ;;
27154
- -h|--help) echo "Usage: loki memory graph [--export <path>] | loki memory graph rebuild"; return 0 ;;
27077
+ -h|--help) echo "Usage: loki memory graph [--export <path>] | loki memory graph rebuild | loki memory graph ingest [<path>...] | loki memory graph ask \"<question>\" [--repo <dir>]"; return 0 ;;
27155
27078
  *) shift ;;
27156
27079
  esac
27157
27080
  done
@@ -28060,8 +27983,9 @@ EOF_RENAMES
28060
27983
  # Shared merge gate. One PR (number or branch) merges only when it is not a
28061
27984
  # draft, `gh pr checks` exits 0 after polling pending (rc=8), and, with
28062
27985
  # --require-verified, every clean proof recorded for the PR's head commit
28063
- # (facts.git.head_sha == headRefOid, dirty-tree proofs ignored) says VERIFIED; a stale or missing proof
28064
- # refuses ("gate: head"). The merge passes --match-head-commit so a push after
27986
+ # (facts.git.head_sha == headRefOid, dirty-tree proofs ignored) says VERIFIED, or, for a Loki 10 run
27987
+ # with no legacy proof, a .loki/runs receipt whose head_sha is the PR head passes `loki verify <run>`;
27988
+ # a stale or missing proof refuses ("gate: head"). The merge passes --match-head-commit so a push after
28065
27989
  # the gate cannot land unjudged. On refusal it prints the exact blocking gate
28066
27990
  # ("gate: draft|head|verdict|trust|checks") and leaves the PR open.
28067
27991
  # Usage: _merge_pr_gated <pr> [--require-verified] [--delete-branch]
@@ -28119,6 +28043,22 @@ _merge_pr_gated() {
28119
28043
  [ -n "$hl" ] || hl="UNREADABLE"
28120
28044
  if [ -z "$headline" ]; then headline="$hl"; elif [ "$headline" != "$hl" ]; then disagree=true; fi
28121
28045
  done
28046
+ # Loki 10 (`loki start`) records no .loki/proofs: with no legacy proof for this head,
28047
+ # judge the sealed run receipts in .loki/runs. A receipt counts only when its head_sha
28048
+ # is the PR head and `loki verify <run>` agrees (rc 0 VERIFIED; rc 4 is a run outcome
28049
+ # that is not VERIFIED; anything else is not verified). Legacy proof acceptance above is unchanged.
28050
+ if [ -z "$headline" ] && ! $disagree; then
28051
+ local rf="" rid="" vrc=0 rhl=""
28052
+ for rf in .loki/runs/*/receipt.json; do
28053
+ [ -f "$rf" ] || continue
28054
+ [ "$(jq -r '.head_sha // empty' "$rf" 2>/dev/null)" = "$head" ] || continue
28055
+ [ "$(jq -r '.schema // empty' "$rf" 2>/dev/null)" = "loki.v10.receipt/1" ] || continue
28056
+ rid="$(basename "$(dirname "$rf")")"
28057
+ vrc=0; "$_LOKI_SCRIPT_DIR/../bin/loki" verify "$rid" >/dev/null 2>&1 || vrc=$?
28058
+ if [ "$vrc" = "0" ]; then rhl="VERIFIED"; else rhl="NOT VERIFIED (loki verify rc $vrc)"; fi
28059
+ if [ -z "$headline" ]; then headline="$rhl"; elif [ "$headline" != "$rhl" ]; then disagree=true; fi
28060
+ done
28061
+ fi
28122
28062
  if $disagree; then
28123
28063
  echo "$pr: not merged, gate: verdict (proofs for PR head ${head:0:12} disagree); PR left open" >&2
28124
28064
  _pr_record_merge "$pr" "blocked:verdict" "verdict"
@@ -28252,7 +28192,7 @@ cmd_merge() {
28252
28192
  echo " watch <pr> Wait for checks; on red run up to LOKI_PR_REPAIR_MAX (2) bounded"
28253
28193
  echo " repair sessions on the PR branch, push, re-check, merge when green."
28254
28194
  echo " pr <pr|branch> Merge one PR through the same gate (not draft, checks green;"
28255
- echo " --require-verified also needs a VERIFIED run verdict)."
28195
+ echo " --require-verified also needs a VERIFIED run: a legacy proof, or a Loki 10 receipt in .loki/runs, for the PR head)."
28256
28196
  echo " add <pr>... Queue pull requests"
28257
28197
  echo " list Show the queue"
28258
28198
  echo " run [--dry-run] Merge one at a time, only when checks are green;"
package/autonomy/route.sh CHANGED
@@ -19,7 +19,7 @@ _ROUTE_OPTVAL_FLAGS=" --mirofish "
19
19
  # engine rather than configure it: the route still resolves (R_FRONT=1) but the dispatcher leaves the call to the front end.
20
20
  _ROUTE_FRONT_FLAGS=" --workspace --deploy --health-url --health-match --auto-rollback --destination --canary --domain "
21
21
  # Flags engine10 honors as-is.
22
- _ROUTE_E10_FLAGS=" --no-pr --deep --json --verbose --quiet --resume --provider --max-cost --spec --attempts --seal-existing "
22
+ _ROUTE_E10_FLAGS=" --no-pr --deep --json --verbose --quiet --resume --provider --max-cost --spec --attempts --seal-existing --detach -d "
23
23
  # The largest PRD engine10 takes: it carries the task in env vars and CLI arguments (with a context pack added under
24
24
  # --session-model), and Linux caps one string at 128 KiB. A bigger PRD runs on the legacy engine, or is refused under
25
25
  # SDK mode with claude (the legacy engine has no SDK path).
@@ -35,7 +35,6 @@ _route_refusal_hint() {
35
35
  case "$1" in
36
36
  --ship) echo "engine10 opens the PR itself and does not auto-merge; merge it with 'loki merge-queue', or pass --engine legacy to keep --ship" ;;
37
37
  --worktree|-w) echo "engine10 runs each attempt in its own isolated worktree already; drop the flag, or pass --engine legacy for a git-worktree run" ;;
38
- --detach|-d) echo "run it in the background yourself ('nohup loki start ... &') or queue it with 'loki queue run', or pass --engine legacy for --detach" ;;
39
38
  --parallel) echo "use 'loki queue run --parallel K' or 'loki issues run --parallel K' for parallel runs, or pass --engine legacy for --parallel" ;;
40
39
  --issue) echo "give the issue as the task instead: loki start owner/repo#N (or the issue URL)" ;;
41
40
  *) echo "drop it, or pass --engine legacy to run the legacy loop with it" ;;
@@ -48,7 +47,7 @@ _route_has() { case "$1" in *" $2 "*) return 0 ;; esac; return 1; }
48
47
  _route_provider() {
49
48
  local p="$1"
50
49
  if [ -z "$p" ]; then p="${LOKI_PROVIDER:-}"; fi
51
- if [ -z "$p" ] && [ -f "${PWD}/.loki/state/provider" ]; then p="$(sed -n '1p' "${PWD}/.loki/state/provider" 2>/dev/null || true)"; fi
50
+ if [ -z "$p" ] && [ -f "${PWD}/.loki/state/provider" ]; then p="$(sed -n '1p' "${PWD}/.loki/state/provider" 2>/dev/null || true)"; p="${p%"${p##*[![:space:]]}"}"; fi # trailing whitespace, a CRLF line's CR included
52
51
  printf '%s' "${p:-claude}"
53
52
  }
54
53
 
@@ -404,7 +403,10 @@ $(loki_removed_saved_provider_hint "$R_PROVIDER")"
404
403
  else
405
404
  # L009: a provider with no engine10 invoker is refused, never sent to the legacy loop.
406
405
  if ! validate_provider "$R_PROVIDER"; then
407
- R_ERR="loki: provider $R_PROVIDER is not supported; use one of: $(loki_supported_providers_joined)"; return 0
406
+ R_ERR="loki: provider $R_PROVIDER is not supported; use one of: $(loki_supported_providers_joined)"
407
+ if [ -z "$provider_flag" ] && [ -z "${LOKI_PROVIDER:-}" ]; then R_ERR="$R_ERR
408
+ loki: this project saved provider '$R_PROVIDER' in .loki/state/provider; switch it with: loki provider set claude"; fi
409
+ return 0
408
410
  fi
409
411
  if [ "${sz:-0}" -gt "$_ROUTE_PRD_MAX" ] && _route_sdk_claude "$R_PROVIDER"; then
410
412
  R_ERR="loki: this PRD is ${sz} bytes, over the ${_ROUTE_PRD_MAX}-byte limit of the Loki 10 engine, and the legacy engine has no Agent SDK path; trim the PRD below 100 KB, or unset LOKI_SDK_MODE, LOKI_SDK and LOKI_SDK_LOOP to run the legacy engine on a provider CLI"
@@ -500,6 +502,8 @@ loki_route_dispatch() {
500
502
  loki_route_resolve bare "$@"; verb=bare ;;
501
503
  esac
502
504
  fi
505
+ # FR01: a pasted PR URL is a goal too; `loki <PR URL>` is `loki start <PR URL>` (verify-pr: sandboxed, no model call)
506
+ if [ "$R_DECIDED" != "1" ] && [ -n "$(_route_pr_url "$first")" ]; then loki_route_resolve start "$@"; verb=bare; fi
503
507
  ;;
504
508
  esac
505
509
  if [ "$R_DECIDED" != "1" ]; then _route_task_first "$verb" "$@"; return 0; fi