Loki Mode

May 29, 2026 ยท View on GitHub

Loki Mode

Build the future, faster.

Describe what you want. Get production-ready code.

npm version npm downloads GitHub stars Docker Pulls License

Website | Documentation | Installation | Changelog | Purple Lab Web UI


How it works: Drop a spec -- a PRD, GitHub issue, OpenAPI/JSON/YAML, or one-line brief. Loki Mode classifies complexity (run.sh:detect_complexity()), assembles an agent team from 41 specialized types across 8 swarms, and runs autonomous RARV cycles (Reason - Act - Reflect - Verify, see run.sh:run_autonomous()) with 11 quality gates (see skills/quality-gates.md). Code is not "done" until it passes automated verification. Output is a Git repo with source, tests, configs, and audit logs.


Why Loki Mode?

  • Spec to product, autonomously -- Describe what you want, walk away, come back to working code with tests. Loki runs the full RARV-C closure loop (Reason - Act - Reflect - Verify - Close) until the work is actually done, not just attempted.
  • Production quality built in -- 11 quality gates (skills/quality-gates.md), blind 3-reviewer code review (run.sh:run_code_review()), anti-sycophancy checks
  • Cross-project memory -- Episodic/semantic/procedural memory with vector search; knowledge learned on one project surfaces on the next (v5.15.0+, see memory/engine.py)
  • Self-hosted and private -- Your keys, your infrastructure, no data leaves your network
  • Legacy system healing -- loki heal archaeology/stabilize/isolate/modernize/validate phases (v6.67.0, see skills/healing.md)
  • MCP server -- 15 tools including ChromaDB code search (mcp/server.py)
  • Full-stack output -- Source code, tests, Docker configs, CI/CD pipelines, audit logs
  • Provider-agnostic -- runs on Claude, Codex, Cline, or Aider with automatic failover (loki-ts/src/runner/providers.ts); no vendor lock-in. Gemini CLI deprecated v7.5.18; Antigravity CLI coming soon.
  • Open source -- Free for personal, internal, and academic use.

Get Started in 30 Seconds

Prerequisites

Loki drives a coding agent CLI and orchestrates real builds, so it needs a few tools on your PATH. loki doctor checks all of these and tells you what is missing.

Required:

  • An agent provider CLI (at least one): Claude Code (claude, Tier 1, recommended), or OpenAI Codex CLI (codex), Cline, or Aider.
  • Python 3.10+ (python3) for the dashboard, memory system, and orchestration helpers.
  • Git 2.x (git) for checkpoints and worktrees.
  • curl for installation and network calls.

Recommended:

  • Bun 1.3.0+ (bun) for the fast runtime (the recommended install path below installs it).
  • Node.js 18+ and npm if you install via npm instead of Bun.
  • jq for nicer JSON handling in shell flows.
  • Docker if you want Loki's App Runner to run containerized projects, or to run Loki itself from the published image.

You also need credentials for whichever provider you use (for Claude Code, an authenticated claude login or ANTHROPIC_API_KEY).

Recommended (Bun, fastest):

# Install Bun once (skip if you already have it)
curl -fsSL https://bun.sh/install | bash      # macOS / Linux
# or: brew install oven-sh/bun/bun

bun install -g loki-mode
loki doctor                                   # verify environment
loki init my-app --template simple-todo-app
cd my-app
loki start prd.md                             # autonomous build from a Markdown PRD
loki start owner/repo#123                     # ...or a GitHub issue
loki start ./openapi.yaml                     # ...or an OpenAPI/YAML spec

Or skip scaffolding and go straight to a quick task:

loki quick "build a landing page with a signup form"

Other install methods (all work, all keep working):

MethodCommandNotes
Bun (recommended)bun install -g loki-modeFastest. v8 will be Bun-only.
Homebrewbrew tap asklokesh/tap && brew install loki-modeAuto-installs Bun as a dep
Dockerdocker pull asklokesh/loki-mode:7.7.31 && docker run --rm asklokesh/loki-mode:7.7.31 start prd.mdBun pre-installed in image
npm (compat)npm install -g loki-modeWorks without Bun (bash fallback). Migrate any time with loki self-update --to bun.

Upgrading:

loki self-update                  # upgrade in place via current manager
loki self-update --to bun         # switch from npm/brew to Bun
loki self-update --check          # show current install path + manager

loki self-update auto-detects which package manager installed loki and runs the right upgrade. If you installed via npm and want to switch to Bun (recommended for v8.0.0 forward-compat), loki self-update --to bun does the migration in one command (installs via Bun first, then uninstalls the npm copy).

See the Installation Guide for the long form.


Runtime Architecture

Loki Mode is in a phased migration from a Bash-based runtime to a TypeScript/Bun runtime. The migration has merged to main and ships incrementally with each release.

What ships today:

  • Commands routed to the Bun runtime when bun is on PATH (the router lives in bin/loki): version, --version, -v, status, stats, doctor, provider (covers provider show and provider list), memory (covers memory list and memory index), rollback, kpis, and internal.
  • Every other command continues to execute on the existing Bash CLI (autonomy/loki), including the autonomous loki start / loki run loop which remains the Bash orchestrator (autonomy/run.sh).
  • If bun is not on PATH, the shim falls through to Bash silently. Existing users without Bun installed see no behavior change.

Rollback flag:

Force every command to take the legacy Bash path:

LOKI_LEGACY_BASH=1 loki <cmd>

This is the documented escape hatch for any user who hits a regression on the Bun route. The Bash path remains the source of truth through Phase 5.

Phase 6 (planned, calendar TBD):

The next major release sunsets the Bash runtime entirely. There is no firm calendar date. Users who need to stay on the Bash route should pin the last v7.x release.

Cost:

  • Adds a Bun runtime dependency (Bun 1.3.0 or newer recommended; the shim works as long as bun resolves).
  • Adds a Bun toolchain to the system (Bun itself is roughly 50 MB installed via brew install or the official curl installer). The published loki-ts/dist/loki.js bundle inside the npm tarball is approximately 152 KB.
  • Speedup on the ported commands is measured in .loki/metrics/migration_bench_soak.jsonl and analysed in ADR-001. Recorded soak results show roughly 3x to 5x faster execution on the ported commands (per-command range 2.9x to 5.0x); treat as indicative, not contractual.

More:


Other install methods
MethodCommand
Homebrewbrew tap asklokesh/tap && brew install loki-mode
Dockerdocker pull asklokesh/loki-mode:7.7.31
Inside Claude Codeclaude --dangerously-skip-permissions then type "Loki Mode"
Git clonegit clone https://github.com/asklokesh/loki-mode.git

See the full Installation Guide.

Supported spec formats

A "spec" is whatever you hand loki start. Loki auto-detects the format and normalises it before the RARV loop. A Markdown PRD is one form of spec; the table below lists every input the CLI accepts.

FormatExampleNotes
Markdown PRDloki start ./prd.mdCanonical form. Headings become section anchors.
JSON specloki start ./spec.jsonFree-form JSON; keys surfaced to agents.
YAML specloki start ./openapi.yamlOpenAPI / AsyncAPI / plain YAML all accepted.
Plain text briefloki start ./brief.txtOne-paragraph briefs work; complexity auto-detects to "simple".
GitHub issue URLloki start https://github.com/owner/repo/issues/42Title + body + labels become the spec.
GitHub shorthandloki start owner/repo#42Same as above, shorter.
Jira ticket keyloki start PROJ-456Requires JIRA_BASE_URL + JIRA_TOKEN env vars.
GitLab / Azure DevOps URLloki start https://gitlab.com/group/proj/-/issues/7GitLab and Azure DevOps issue URLs both supported.
Bare issue numberloki start #123 or loki start 123Resolved against the current repo's origin remote.
OpenSpec change directoryloki start --openspec ./openspec/change-001Reads OpenSpec change manifest + delta files.
Auto-detect (no input)loki startPicks up ./prd.md, ./spec.{json,yaml,yml}, or ./SPEC.md from cwd.

All formats land in the same RARV pipeline and pass the same 11 quality gates (skills/quality-gates.md).


What You Can Build

ProjectBuild TimeComplexity
Landing page with signup form~10 minSimple
REST API with JWT auth~20 minSimple
Portfolio with animations~15 minSimple
SaaS dashboard with analytics~25 minStandard
E-commerce store with Stripe~45 minStandard
Task manager with kanban board~25 minStandard
Chat app with WebSocket~30 minStandard
Blog platform with MDX~30 minStandard
Microservice architecture~2 hoursComplex
ML pipeline with monitoring~3 hoursComplex

What To Expect

SimpleStandardComplex
ExamplesLanding page, todo app, single APICRUD + auth, REST API + ReactMicroservices, real-time, ML pipelines
Duration5-30 min30-90 min2+ hours
AutonomyCompletes independentlyMay need guidance on complex partsUse as accelerator with human review

Architecture

Loki Mode Architecture

RARV Cycle

Every iteration: Reason (read state) - Act (execute, commit) - Reflect (update context) - Verify (run tests, check spec). Failures trigger self-correction.

Core Workflow

41 Agent Types

8 swarms: engineering, operations, business, data, product, growth, review, orchestration. Auto-composed by PRD complexity.

Agent Types

11 Quality Gates

Blind review, anti-sycophancy, severity blocking, mock/mutation detection, backward compatibility (gate 10, v6.67.0), documentation coverage (gate 11, v7.5.0). Code does not ship until all gates pass.

Quality Gates

Memory System

3-tier architecture: episodic (interaction traces), semantic (generalized patterns), procedural (learned skills). Vector search optional.

Memory Architecture

Dashboard

Real-time monitoring, agent status, task queue, WebSocket streaming. Auto-starts at localhost:57374.

Dashboard Guide

Enterprise Layer

TLS, OIDC/SSO, RBAC, OTEL tracing, policy engine, audit trails. Activated via env vars.

Enterprise Guide


Purple Lab

The hosted development platform. A Replit-like web UI for visual PRD-to-code workflow with AI chat for iterative development.

loki web                           # launches at http://localhost:57375

Platform Pages

  • Home -- One-line prompt to start building instantly
  • Projects -- Browse, search, filter past builds
  • Templates -- 20+ starter PRDs by category
  • Showcase -- Gallery of example projects to build
  • Compare -- Feature comparison vs competitors

IDE Workspace

  • Monaco editor with tabs, Cmd+P quick open
  • AI chat panel for iterative development
  • Activity panel: build log, agents, quality gates
  • Live preview with URL bar navigation
  • Right-click context menu: Review, Test, Explain

Loki Mode vs. Alternatives

FeatureLoki Modebolt.newReplitLovable
Self-hosted / your keysYesNoNoNo
5 AI provider failoverYesNoNoNo
11 quality gatesYesNoNoNo
Blind code reviewYesNoNoNo
Enterprise auth (SSO/RBAC)YesNoYesNo
Air-gapped deploymentYesNoNoNo
Docker + CI/CD generationYesNoYesNo
Open sourceYesNoNoNo
Free tierOpen sourceYesYesYes

Loki Mode is the only platform that is fully self-hosted, open source, and includes automated quality verification. Your code, your keys, your infrastructure.


Provider-Agnostic Runtime

Loki's autonomy and quality loop are the product; the underlying coding CLI is swappable. Loki runs on any of the providers below so you are never locked to one vendor.

ProviderStatusAutonomous FlagParallel AgentsInstall
Claude CodeActive (Tier 1)--dangerously-skip-permissionsYes (10+)npm i -g @anthropic-ai/claude-code
Codex CLIActive (Tier 3)--full-autoSequentialnpm i -g @openai/codex
Cline CLIActive (Tier 2)--auto-approveSequentialnpm i -g @anthropic-ai/cline
AiderActive (Tier 3)--yes-alwaysSequentialpip install aider-chat
Google Gemini CLIDEPRECATED v7.5.18----Upstream deprecated; runtime removed. LOKI_PROVIDER=gemini exits with migration message.
Anthropic Antigravity CLIComing soon----Integration planned.

Claude gets full features (subagents, parallelization, MCP, Task tool). Other active providers run sequentially. Auto-failover switches providers when rate-limited. See Provider Guide.


CLI Reference

All commands
CommandDescription
loki start [PRD]Start with optional PRD file (also accepts an issue ref; replaces deprecated loki run)
loki stopStop execution
loki heal <path>Legacy system healing (archaeology, stabilize, isolate, modernize, validate -- v6.67.0)
loki pause / resumePause/resume after current session
loki statusShow current status
loki dashboardOpen web dashboard
loki webLaunch Purple Lab web UI
loki doctorCheck environment and dependencies
loki plan [PRD]Pre-execution analysis: complexity, cost, iterations
loki review [--staged|--diff]AI-powered code review with severity filtering
loki test [--file|--dir|--changed]AI test generation (8 languages, 9 frameworks)
loki onboard [path]Project analysis and CLAUDE.md generation
loki importImport GitHub issues as tasks
loki ciCI/CD quality gate integration
loki failoverCross-provider auto-failover management
loki memory <cmd>Memory system: index, timeline, search, consolidate
loki enterpriseEnterprise feature management
loki versionShow version

Run loki --help for all options. Full reference: CLI Reference | Config: config.example.yaml


BMAD Method Integration

Loki Mode integrates with the BMAD Method, a structured AI-driven agile methodology. If your project uses BMAD for requirements elicitation, Loki Mode can consume those artifacts directly:

loki start --bmad-project ./my-project

The adapter handles BMAD's frontmatter conventions, FR-format functional requirements, Given/When/Then acceptance criteria, and artifact chain validation. Non-BMAD projects are unaffected -- the integration is opt-in via --bmad-project.

See BMAD Integration Validation.

Enterprise Features

Enterprise features are included but require env var activation. Self-audit: 35/45 capabilities working, 0 broken, 1,314 tests passing.

export LOKI_TLS_ENABLED=true
export LOKI_OIDC_PROVIDER=google
export LOKI_AUDIT_ENABLED=true
loki enterprise status

Enterprise Architecture | Security | Authentication | Authorization | Metrics | Audit Logging

Benchmarks

Self-reported results from the included test harness. Verification scripts included for reproduction.

BenchmarkResultNotes
HumanEval162/164 (98.78%)Max 3 retries, RARV self-verification
SWE-bench299/300 patchesPatch generation -- evaluator not yet run

See benchmarks/ for methodology.

Presentation

Loki Mode Presentation

9 slides: Problem, Solution, 41 Agents, RARV Cycle, Benchmarks, Multi-Provider, Full Lifecycle

Download PPTX


Limitations

AreaWhat WorksWhat Doesn't (Yet)
Code GenFull-stack apps from PRDsComplex domain logic may need human review
DeployGenerates configs, Dockerfiles, CI/CDDoes not deploy -- human runs deploy commands
Testing11 automated quality gatesTest quality depends on AI assertions
Providers5 providers with auto-failoverNon-Claude providers lack parallel agents
DashboardReal-time single-machine monitoringNo multi-node clustering

What "autonomous" means: The system runs RARV cycles without prompting. It does NOT access your cloud accounts, payment systems, or external services unless you provide credentials. Human oversight is expected for deployment, API keys, and critical decisions.


Research Foundation

Papers and sources
SourceWhat We Use
Anthropic: Building Effective AgentsEvaluator-optimizer, parallelization
Anthropic: Constitutional AISelf-critique against quality principles
DeepMind: Scalable Oversight via DebateDebate-based verification in council review
DeepMind: SIMA 2Self-improvement loop design
OpenAI: Agents SDKGuardrails, tripwires, tracing
NVIDIA ToolOrchestraEfficiency metrics, reward signals
CONSENSAGENT (ACL 2025)Anti-sycophancy in blind review
GoalActHierarchical planning for complex PRDs

Practitioner insights: Boris Cherny, Simon Willison, HN Community

Full Acknowledgements -- 50+ papers and resources


Contributing

git clone https://github.com/asklokesh/loki-mode.git && cd loki-mode
npm install && npm test              # 683 tests
python3 -m pytest                    # 631 tests

See CONTRIBUTING.md for guidelines.

License

Business Source License 1.1 -- Free for personal, internal, academic, and non-commercial use. Converts to Apache 2.0 on March 19, 2030. Contact founder@autonomi.dev for commercial licensing.


Autonomi | Documentation | Changelog | Comparisons