Loki Mode, by Autonomi, turns a spec or an issue into a verified pull request with a receipt you can check. This page covers installing it, a first run, and the options around it.
Version: v11.199.0
Engine note: loki start is the primary command. loki start, loki "<task>", loki owner/repo#N and loki quick all run the Loki 10 engine, whatever the flag order or input form (PRD file, issue ref, task or one-word brief). The previous loop runs only on --engine legacy, LOKI_ENGINE=legacy, or for one call when a flag Loki 10 cannot honor is present. See the user guide and the 5-minute quickstart.
Pick one. All three install the same loki CLI.
npm install -g loki-mode # Node.js 20+ (Node 22 LTS is the CI target)
bun install -g loki-mode # Bun 1.3+
brew tap asklokesh/tap && brew install loki-mode # Homebrew
The Loki 10 engine runs on Bun. The npm package bundles a Bun binary for macOS and Linux (x64 and arm64) as an optional dependency, so a plain npm install needs nothing else. With Homebrew, install Bun too if you do not have it: brew install oven-sh/bun/bun.
The npm postinstall step repoints any stale skill links and installs shell completions (skipped in CI or with LOKI_NO_COMPLETIONS=1). It never fails the install. To install the Loki skill into each detected provider CLI (~/.claude/skills/, ~/.config/opencode/), run:
loki setup-skill
npm install -g loki-mode --omit=optional
Skips the bundled Bun binary (62 to 86 MB per platform), the Claude Agent SDK and the OpenTelemetry packages. You then need Bun on PATH (curl -fsSL https://bun.sh/install | bash); without it every command exits with an error that says how to fix it.
pip install loki-mode-sdk installs only the Python REST client. The loki CLI is not on PyPI.
See alternative-installations.md for Docker and a git clone install.
loki --version # prints the installed version
loki doctor # checks providers, Bun, skill links and prerequisites
Required (loki doctor fails without them):
| Tool | Minimum |
|---|---|
| Node.js | 20+ (22 LTS is the CI target) |
| git | any recent version |
| curl | any |
For issue refs and pull requests you also need the GitHub CLI (gh), logged in with gh auth login.
Plus a way to reach a model. Claude Code (claude) is the default provider and the only one with every feature, so the default path needs it installed and logged in: npm install -g @anthropic-ai/claude-code, then claude auth login. With only ANTHROPIC_API_KEY set, loki "<goal>" runs on the bundled Claude Agent SDK with no CLI and no extra setting. loki edit and loki chat call the claude CLI directly. The only other provider is opencode (optional; any model, including OpenRouter via OPENROUTER_API_KEY). codex, cline, aider and gemini were removed and exit 2 with a migration line.
Optional: Python 3.8+ (deep scans, Python repos and group runs; loki "<goal>" runs without it), jq (loki status and the bash fallback CLI), Bun 1.3+ (bundled by the npm package), bash 4+ (recommended), Ollama or an OpenRouter key for non-Claude model routes.
One command checks and configures all of this:
loki setup # wizard: tools, Claude login, provider, model route, spend cap
loki setup --yes # non-interactive, accept defaults
loki setup --check # report only
loki doctor --fix # apply safe fixes; prints exact commands for the rest
loki config list # show settings; also: loki config get|set|path
loki doctor --json # machine-readable
loki doctor --fix creates state directories and a default config. It never installs system packages or runs sudo; it prints those commands instead.
Loki detects pytest, unittest, vitest, jest, bun, node, npm, go, cargo, maven, gradle, javac and dotnet tests from the repo’s own files, with no environment variable and no config. JVM and .NET repos need mvn, gradle or dotnet on PATH, or a committed mvnw or gradlew wrapper. A committed verify.test_command in loki.yaml overrides the detected command. loki doctor --repo shows the command Loki will run.
When no test can run on this machine (the build tool is missing and there is no wrapper, or the stack has no runner Loki supports, such as Ruby), loki start prints loki: cannot run this repo's tests on this machine: <reason> before any model session. The run continues, but it cannot end VERIFIED. Not covered yet: Kotlin tests are not detected, and a Python interpreter without pytest is not flagged up front.
Loki Mode ships an MCP server (npx -y loki-mode mcp, stdio). Register it in your editor with one click or one command.
loki mcp install --client claude, --client cursor, --client vscode or --client windsurf. Add --project or --global to pick the config scope, or --print to show the config and write nothing.For VS Code, loki mcp install --client vscode --project writes .vscode/mcp.json in the current folder (VS Code supports the workspace scope only). The file it writes:
{
"servers": {
"loki-mode": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"loki-mode",
"mcp"
]
}
}
}
Existing servers in that file are kept, and the old file is saved as .vscode/mcp.json.bak. The server lists loki_v10_run, loki_v10_status and loki_v10_verify among its tools.
loki setup # first-run wizard
loki start "add a /health route" # the primary path: build, verify, seal a receipt
loki start prd.md # same, from a PRD file
loki start owner/repo#42 # same, from a GitHub, GitLab or Jira issue
loki edit "rename fooBar to foo_bar" # one small change, no loop
loki chat # interactive alternative (Plan/Build modes)
loki welcome # what Loki is and what to do next
loki quickstart # guided first build: setup check, idea, template, plan, go
The shorter forms loki "<task>" and loki owner/repo#42 run the same engine. There is no default spend cap, with an API key or on a subscription login: a run stops when it is done or makes no progress. Set one with --max-cost <usd>, budgets.per_run in loki.yaml, or loki setup --budget. A quick walkthrough is in QUICKSTART.md.
loki quickstart asks four questions and shows the plan before anything runs. Press Enter at every step to build the sample Todo app. Add --dry-run --json to preview the plan without writing files.
Every finished run leaves a receipt. Check a branch the same way CI does:
loki verify # deterministic verification of HEAD against the base branch
Exit codes are listed in exit-codes.md. Receipt signing and third-party checking are covered in SIGNED-RECEIPTS.md.
The Control Plane is the local UI for runs, work and cost. It needs Bun.
loki control serve # 127.0.0.1:47821 by default
loki dashboard # reuse a running Control Plane, or start one, and open it
See control-plane-migration.md and control-plane-container.md.
| Provider | Notes |
|---|---|
claude |
Default (Tier 1). Full feature set. |
opencode |
Sequential only. Supported in engine10 (--provider opencode); cost not measured. Install with npm install -g opencode-ai; model via LOKI_OPENCODE_MODEL=provider/model or --model; OpenRouter models are openrouter/<vendor>/<model> with OPENROUTER_API_KEY set. |
When LOKI_PROVIDER is unset, Loki uses the first installed CLI in this order: claude, opencode. An explicit LOKI_PROVIDER or --provider NAME always wins.
Run OpenRouter or a local model through the Claude harness with LOKI_MODEL_ROUTE=<kind>/<id>, where kind is openrouter, ollama, lmstudio, llamacpp, vllm or custom (custom needs LOKI_MODEL_BASE_URL):
loki models --local # discover local models, print ready-to-paste values
LOKI_MODEL_ROUTE=ollama/qwen3-coder loki start prd.md
OpenRouter reads OPENROUTER_API_KEY. The route applies to the Claude child process only and every Loki control (cost, kill blocking, receipts) still applies. Details: user guide.
Loki runs with zero configuration. To set options in one place, use a config file:
loki config example > loki.yaml # annotated starter
loki config validate loki.yaml # rejects raw secrets and bad keys
loki start --config loki.yaml ./prd.md
A CLI flag beats an environment variable, which beats the config file, which beats the defaults. Reference secrets as ${VAR}; never write them inline. Every variable is listed in environment-variables.md.
Anonymous diagnostics are on for an ordinary interactive install and off automatically in CI, non-interactive sessions, and when LOKI_ENTERPRISE=true or LOKI_AIRGAP=true is set. They never include code, prompts, file paths or keys. Turn them off with loki telemetry off or DO_NOT_TRACK=1. Details: PRIVACY.md.
The npm install sets them up for you. To install them by hand:
loki completions install # detects bash or zsh
loki completions bash > ~/.loki-completion.bash # or print the script
| Method | Update | Uninstall |
|---|---|---|
| npm | npm update -g loki-mode |
npm uninstall -g loki-mode |
| Bun | bun update -g loki-mode |
bun remove -g loki-mode |
| Homebrew | brew upgrade loki-mode |
brew uninstall loki-mode |
Run state lives in .loki/ inside each project and in ~/.loki/. Uninstalling the CLI does not delete those directories. Receipts stay yours. Remove .loki/ and ~/.loki/ yourself only when you want the history gone.
loki wow runs one small task in a temporary repo when Claude or OpenCode is ready (it asks y/N before spending; --yes skips), and falls back to loki tour when it is not. loki factory "<task>" is loki start with the autonomy policy named first. --cost-first prefers a lower-cost model only when the advisor marks the route low risk. --max-cost and budgets.per_run stay the hard cap.
There is no importer that copies a Claude Code or OpenCode transcript into a Loki run. Inside one Loki run, the plan session resumes into implement unless LOKI_E10_FIX_RESUME=0. A rate limit stays a retry; a hard billing failure does not (loki-ts/src/runner/retry_class.ts). Checkpoint resume is loki resume. The handoff from another tool is the repo plus the task: loki start --provider opencode or the default Claude path, then loki chat --attach to watch. The MCP server and the Claude plugin return the same receipt-capable results as the CLI.
loki: command not found: the global bin directory of your package manager is not on PATH (npm prefix -g shows where npm installs).the Loki 10 engine cannot run on this machine: no working bun (exit 2, nothing runs): install Bun (curl -fsSL https://bun.sh/install | bash), or reinstall without --omit=optional.loki doctor names it and prints the install command.loki doctor --json, then KNOWN-ISSUES.md, then loki crash to file a report.