loki start is the primary path. This page gets you from install to a
verified result, then shows the interactive alternative and the small-change
path.
npm install -g loki-mode
You need Node.js 20+, git and curl, and for issue refs and pull requests the GitHub CLI (gh, logged in). Python 3.8+ and jq are optional. Claude
Code (claude) is the default provider and is needed for the default path:
npm install -g @anthropic-ai/claude-code
claude auth login
The other supported coding CLI, opencode, is optional (any model, including OpenRouter). Full list: INSTALLATION.md.
cd your-repo
loki setup # checks tools, Claude login, provider, model route, spend cap
loki setup --yes accepts defaults. loki doctor --fix creates state
directories and a default config and prints exact commands for anything
missing; it never runs sudo.
loki start "add rate limiting to /api/login"
Also accepted: loki start prd.md, loki start owner/repo#123, and a
one-word brief as loki start <word>. Add --no-pr to skip the pull request.
The PR uses your existing gh auth login (and git) credentials; no extra token
is needed. On a repo you cannot push to, Loki pushes the branch to your fork and
opens the PR upstream from it (the branch is public on your fork); a draft
outcome (anything but VERIFIED) stays on the fork, and Loki posts no status
comment on that repo’s issue. Status and backstop issue comments post only when
gh confirms you can push; a failed check skips them rather than guessing.
LOKI_PR_FORK=0 turns the fork fallback off.
Preview the route first with loki route start prd.md.
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>.
Every run ends with one block:
Result: verified
Files: 3 changed (+42 -5)
Cost: $0.42
Elapsed: 4m12s
Receipt: .loki/runs/<run-id>/receipt.json
next: loki diff
Cost reads (estimated) when the provider did not report it and not
measured when unknown. The next: line names the one command to run now.
loki verify re-checks the receipt; loki undo reverts the run. Exit codes
are in exit-codes.md: usage errors are 64, and a CI gate
should be loki verify || fail.
loki chat --attach # joins the running or last `loki start` session
Inside: /status, /steer <text>, /diff, /verify, /receipt, /stop.
loki chat on its own is the interactive alternative: it starts in Plan mode
(read-only), /build allows edits, and /run <brief> starts a normal
loki start run with the chat’s model and provider. Bare loki does not open
chat.
loki edit "rename fooBar to foo_bar"
loki edit src/foo.ts "rename X to Y"
loki edit --verify --commit src/a.ts "add null checks"
One pass, no plan, council or PR. It prints the diff and one line with cost and
time. Use loki quick "<task>" when you want a verify loop.
loki models --local # finds Ollama, LM Studio, llama.cpp, vLLM
LOKI_MODEL_ROUTE=ollama/qwen3-coder loki start prd.md
LOKI_MODEL_ROUTE=openrouter/deepseek/deepseek-v3.2 loki start prd.md # needs OPENROUTER_API_KEY
loki start --provider opencode --model openrouter/deepseek/deepseek-v3.2 prd.md # opencode via OpenRouter
Routes: openrouter, ollama, lmstudio, llamacpp, vllm, and custom
(set LOKI_MODEL_BASE_URL). They run through the Claude harness, so cost,
kill blocking and receipts still apply.
User guide, core verbs, custom agents, comparison with opencode.