loki-mode

Alternative Installation Methods

The recommended installation is via npm or Homebrew (see INSTALLATION.md). These alternatives serve specific use cases.


Git Clone (Manual)

Best for: contributors, development, or environments without npm/brew.

# Clone to Claude Code skills directory
git clone https://github.com/asklokesh/loki-mode.git ~/.claude/skills/loki-mode

# Optionally add CLI to PATH:
ln -sf ~/.claude/skills/loki-mode/bin/loki /usr/local/bin/loki

Update: cd ~/.claude/skills/loki-mode && git pull

Limitation: Does not install the loki CLI to PATH automatically. You must symlink or add to PATH manually.


Docker

Status: Image exists on Docker Hub. Tags: latest, one per release version (for example X.Y.Z, matching the npm version).

docker pull asklokesh/loki-mode:latest

Limitation: The image ships the Claude Code CLI. Docker is useful for:

loki docker <command> runs any loki command in the image with the current folder mounted, so .loki/ state and resume behave like the local CLI.

See DOCKER.md for Docker-specific usage instructions.


GitHub Action

Loki no longer ships a pull request review action (removed in the release after 11.178.0). For review on pull requests use Claude Code itself: anthropics/claude-code-action@v1, /code-review --comment from a terminal, or Code Review on Team and Enterprise plans. A workflow pinned to an older tag (asklokesh/loki-mode@v5 and the like) keeps working. To turn a labelled issue into a verified pull request in GitHub Actions, see Triggers without a cloud.


GitHub Release Download

Status: Working. Release assets available for each version.

# Download the latest release and extract to the skills directory
VERSION=$(npm view loki-mode version)
curl -sL https://github.com/asklokesh/loki-mode/archive/refs/tags/v${VERSION}.tar.gz | tar xz
mv loki-mode-${VERSION} ~/.claude/skills/loki-mode

Best for: Offline or air-gapped environments, pinned version deployments.


Setup requirements (LM-001)

This is the authoritative statement of what Loki Mode needs to run a first task. It mirrors one shared table, autonomy/lib/setup-requirements.json. loki doctor, loki doctor --requirements, loki doctor --json (key requirements), loki setup, and the runtime “provider CLI missing” errors all read that table, so wording and fixes match.

Normal repository build dependencies (the toolchain of the project you point Loki at) are not Loki overhead and are not listed.

How to read your machine

loki doctor --requirements   # per path: ready or not ready, each item required or optional, present or missing, one-line fix
loki doctor --json           # same data under "requirements", plus "first_task_ready"

A first task is ready when every required “All paths” item is present and at least one execution path is ready. first_task_ready in the JSON reports exactly that. It checks presence on this machine; it does not prove that a provider login is valid or that an API key is accepted.

Execution paths

Install methods

Install method What it provides What you still need
npm install -g loki-mode Loki, a bundled Bun binary and the Claude Agent SDK as npm optional dependencies Node 20+, git, curl, and one execution path above (python3 and jq are optional)
npm install -g loki-mode --omit=optional (slim) Loki only; no bundled Bun, no Agent SDK Everything above, plus Bun from https://bun.sh for the Bun route. Without Bun, bin/loki falls back to the bash CLI. The API-key path is unavailable
Homebrew (brew install loki-mode) Loki Same as npm, and install Bun yourself if you want the Bun route
git clone Loki sources Same as npm; see the Git Clone section above for the clone steps

Supported platforms are the os entries in package.json (darwin, linux).

Requirements by path

The tables below are generated from the shared requirements source. Do not edit between the markers.

All paths

Needed by every Loki command.

Requirement Level Check Fix
Node.js 20 or newer required node on PATH, version 20.0 or newer install Node 20+ from https://nodejs.org
Python 3.8 or newer (deep scans, Python repos, group runs; loki “" runs without it) optional python3 on PATH, version 3.8 or newer install python3 with your package manager (brew install python3)
jq (loki status and the bash fallback CLI; loki “" runs without it) optional jq on PATH install jq with your package manager (brew install jq)
git required git on PATH install git with your package manager (brew install git)
curl required curl on PATH install curl with your package manager (brew install curl)
bash 4.0 or newer optional bash on PATH, version 4.0 or newer install a newer bash (brew install bash); macOS ships 3.2
Bun 1.3 or newer (bundled by npm install) optional bun on PATH, version 1.3 or newer reinstall without –no-optional (npm bundles @oven/bun-*) or install from https://bun.sh; without it loki falls back to the slower bash CLI

Claude Code CLI path (default, loki start)

Loki drives the claude binary you installed and logged in.

Requirement Level Check Fix
claude CLI on PATH (then log in: claude auth login) required claude on PATH npm install -g @anthropic-ai/claude-code

Anthropic API-key path (Agent SDK, no claude CLI)

loki “" runs on the bundled Agent SDK over HTTPS with only a key; no claude CLI and no extra setting.

Requirement Level Check Fix
Anthropic credentials (API key, OAuth token, auth token or gateway URL) required one of ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL is set export ANTHROPIC_API_KEY=
Claude Agent SDK platform binary (optional npm dependency) required executable @anthropic-ai/claude-agent-sdk-<platform>/claude in an installed node_modules reinstall without –no-optional: npm install -g loki-mode (the SDK is an optionalDependency)
Bun runtime (the SDK loop runs only on the Bun route) required bun on PATH, version 1.3 or newer reinstall without –no-optional (npm bundles @oven/bun-*) or install from https://bun.sh

Other provider CLIs

opencode: replaces the claude CLI and reaches any model, including OpenRouter.

Requirement Level Check Fix
opencode CLI optional opencode on PATH npm install -g opencode-ai

When an optional dependency is missing

Missing Effect
@anthropic-ai/claude-agent-sdk (or its platform binary) The api-key-sdk path is unavailable and doctor reports it not ready. The claude-cli path and all other providers are unaffected.
@oven/bun-* (Bun) bin/loki falls back to the bash CLI (slower). The api-key-sdk path is unavailable because the SDK loop runs only on Bun.

opencode with OpenRouter

Supported providers are Claude Code (--provider claude, the default; API-key users run it through the Anthropic Agent SDK with no CLI) and opencode (--provider opencode). opencode reaches OpenRouter directly:

npm install -g opencode-ai
export OPENROUTER_API_KEY=sk-or-...        # or: opencode auth login, then choose OpenRouter
opencode models openrouter | head           # lists openrouter/<vendor>/<model> ids
loki start --provider opencode --model openrouter/deepseek/deepseek-v3.2 ./prd.md

Without the key, opencode models openrouter reports Provider not found: openrouter. LOKI_OPENCODE_MODEL=openrouter/<vendor>/<model> sets the model without the flag. Loki passes OPENROUTER_API_KEY through unchanged and runs opencode run --auto -m <model> <prompt>.

The Claude path can reach OpenRouter too, through a model route: loki start --model openrouter/<id> ./prd.md with --provider claude (or LOKI_MODEL_ROUTE=openrouter/<id>) points the claude CLI at OpenRouter with OPENROUTER_API_KEY.

Install smoke test

scripts/smoke-install.sh packs the repository, installs the tarball into a temporary prefix, and runs loki --version, loki doctor --json and loki route "add a health endpoint" --json. It then repeats with Bun and the optional Agent SDK hidden. It is run by hand, is not part of CI, and writes a reproducible log. A run on one machine is evidence for that machine and OS only; it is not an OS matrix.

Known behaviors