CLI Reference

June 3, 2026 ยท View on GitHub

Complete reference for all Loki Mode CLI commands with copy-paste examples.


Installation

# npm (recommended)
npm install -g loki-mode

# Homebrew
brew install asklokesh/tap/loki-mode

# Verify installation
loki version
loki doctor

Quick Start Examples

# Run a 60-second interactive demo to see Loki Mode in action
loki demo

# Quick single-task mode (lightweight, 3 iterations max)
loki quick "add dark mode to the app"

# Build a spec (PRD markdown) interactively from templates
loki init

# Start from a template
loki init -t saas-starter

# Start with a spec (PRD markdown file)
loki start ./prd.md

# Start without a spec (analyzes existing codebase)
loki start

# Use a GitHub issue as the spec
loki issue 42 --start

# Import all open GitHub issues and work on them
LOKI_GITHUB_IMPORT=true loki start --github

# Check what's happening
loki status
loki logs
loki dashboard open

Global Options

loki [command] [options]

Options:
  --version, -v    Show version number
  --help, -h       Show help

Core Commands

loki start

Start autonomous execution from a spec. Works with or without one -- if no spec is provided, Loki analyzes the existing codebase and generates one. A spec is typically a PRD markdown file, but can also be sourced from a GitHub issue (loki issue).

loki start [SPEC_FILE] [OPTIONS]

Options:

OptionDescription
--provider {claude|codex|cline|aider}Select AI provider (default: claude)
--parallelEnable parallel mode with git worktrees
--bg, --backgroundRun in background
--simpleForce simple complexity (3 phases)
--complexForce complex complexity (8 phases)
--githubEnable GitHub issue import
--no-dashboardDisable web dashboard
--sandboxRun in Docker sandbox
--yes, -ySkip confirmation prompt
--budget AMOUNTCost budget limit in USD
--skip-memorySkip memory context loading at startup
--regen-prdForce a fresh generated PRD on a no-spec run, overriding staleness-aware reuse. Aliases: --regenerate-prd, --regen, or LOKI_PRD_REGEN=1 (v7.17.0)

Examples:

# Start with a spec (PRD markdown file)
loki start ./my-app-prd.md

# Analyze existing codebase (no spec needed)
loki start

# Use OpenAI Codex as provider
loki start ./prd.md --provider codex

# Use Cline as provider
loki start ./prd.md --provider cline

# Run in background with parallel mode
loki start ./prd.md --background --parallel

# Run in Docker sandbox for isolation
loki start ./prd.md --sandbox

# Set a \$5 budget limit
loki start ./prd.md --budget 5.00

# Import GitHub issues and work on them with sync-back
LOKI_GITHUB_SYNC=true loki start --github

# Full featured: background, parallel, GitHub, budget
loki start ./prd.md --bg --parallel --github --budget 10.00

loki quick

Quick single-task mode. Lightweight execution with a maximum of 3 iterations.

loki quick "TASK_DESCRIPTION"

Examples:

# Add a feature
loki quick "add a dark mode toggle to the settings page"

# Fix a bug
loki quick "fix the login form validation error on empty email"

# Add tests
loki quick "add unit tests for the user authentication module"

# Refactor
loki quick "refactor the database connection pool to use async/await"

loki demo

Run an interactive demo (~60 seconds) to see Loki Mode in action without affecting your codebase.

loki demo

loki init

Build a PRD markdown spec interactively or from one of 12 built-in templates. Output is a .md file you can pass to loki start.

loki init [OPTIONS]

Options:

OptionDescription
-t, --template NAMEStart from a template
-l, --listList available templates

Examples:

# Interactive PRD spec builder
loki init

# List available templates
loki init --list

# Start from a template
loki init -t saas-starter
loki init -t cli-tool
loki init -t discord-bot
loki init -t landing-page
loki init -t api-service

loki stop

Stop a running session. As of v7.7.30 this is FOLDER-SCOPED by default: it stops only the session in the current directory and leaves Loki sessions in other folders running. The shared dashboard stays up while any other project is still running, and is stopped only when no project remains.

loki stop          # stop ONLY the current folder's session
loki stop 52       # stop only session #52 in this folder
loki stop --all    # stop EVERY loki runner on this machine (legacy behavior)

Use loki stop --all for the old machine-wide behavior (also reaps orphaned runners from crashed sessions). loki cleanup also reaps orphans when no session is running in the current folder.


loki pause

Pause after current session completes. The agent finishes its current iteration before stopping.

loki pause

loki resume

Resume paused execution.

loki resume

loki status

Show current session status including phase, iteration count, active agents, and task queue.

loki status [OPTIONS]

Options:

OptionDescription
--jsonMachine-readable JSON output

Examples:

# Human-readable status
loki status

# JSON output (for scripting)
loki status --json

# Use in scripts
if loki status --json | jq -e '.running' > /dev/null; then
  echo "Loki is running"
fi

loki logs

View session logs.

loki logs [LINES]

Examples:

# Show last 50 lines (default)
loki logs

# Show last 200 lines
loki logs 200

# Real-time log following (use tail directly)
tail -f .loki/logs/session.log

loki reset

Reset session state.

loki reset [TYPE]

Types:

TypeDescription
allReset all state (default)
retriesReset only retry counter
failedClear failed task queue

Examples:

# Reset everything
loki reset

# Just reset retry counter (after fixing an issue)
loki reset retries

# Clear failed tasks to retry them
loki reset failed

GitHub Integration

loki issue

Use a GitHub issue as a spec -- converts the issue body to a PRD markdown file and optionally starts working on it.

loki issue [URL|NUMBER] [OPTIONS]

Options:

OptionDescription
--repo OWNER/REPOSpecify repository (default: auto-detect)
--number NUMSpecify issue number
--startStart Loki Mode after generating the PRD spec
--dry-runPreview without saving
--output FILECustom output path

Examples:

# Generate a spec from a GitHub issue number (auto-detects repo from git remote)
loki issue 123

# Generate a spec from a full GitHub issue URL
loki issue https://github.com/myorg/myapp/issues/42

# Generate and immediately start working
loki issue 123 --start

# Preview the generated spec (PRD markdown) without saving
loki issue 123 --dry-run

# Save to custom path
loki issue 123 --output ./docs/feature-prd.md

# Specify a different repo
loki issue 42 --repo myorg/other-repo

# Parse issue details only
loki issue parse 123

# View issue in terminal
loki issue view 123

loki import

Import GitHub issues as tasks into the Loki queue.

loki import

Examples:

# Import all open issues
loki import

# Import with filters (via environment variables)
LOKI_GITHUB_LABELS=bug loki import
LOKI_GITHUB_MILESTONE=v2.0 loki import
LOKI_GITHUB_ASSIGNEE=@me loki import
LOKI_GITHUB_LIMIT=10 loki import

# Import and start working
LOKI_GITHUB_IMPORT=true loki start --github

loki github

Full GitHub integration management (v5.41.0).

loki github [SUBCOMMAND]

Subcommands:

CommandDescription
statusShow GitHub integration status and config
syncSync completed task statuses back to GitHub issues
exportExport local tasks as new GitHub issues
pr [name]Create pull request from completed work

Examples:

# Check GitHub integration status
loki github status

# Sync completed tasks back to GitHub issues
loki github sync

# Export local tasks as GitHub issues
loki github export

# Create PR from completed work
loki github pr "Add user authentication"

# Full workflow: import issues, work on them, sync status, create PR
LOKI_GITHUB_IMPORT=true \
LOKI_GITHUB_SYNC=true \
LOKI_GITHUB_PR=true \
loki start --github

Environment Variables:

LOKI_GITHUB_IMPORT=true        # Import open issues as tasks on start
LOKI_GITHUB_SYNC=true          # Sync status back to issues during session
LOKI_GITHUB_PR=true            # Create PR when session completes
LOKI_GITHUB_LABELS=bug,task    # Filter issues by labels
LOKI_GITHUB_MILESTONE=v2.0     # Filter by milestone
LOKI_GITHUB_ASSIGNEE=@me       # Filter by assignee
LOKI_GITHUB_LIMIT=50           # Max issues to import (default: 100)
LOKI_GITHUB_REPO=owner/repo    # Override auto-detected repo
LOKI_GITHUB_PR_LABEL=automated # Label for created PRs

Provider Commands

loki provider

Manage AI providers (Claude, Codex, Cline, Aider).

loki provider [SUBCOMMAND]

Subcommands:

CommandDescription
showDisplay current provider
set {claude|codex|cline|aider}Set default provider
listList available providers with status
info [provider]Get detailed provider information

Examples:

# Show current provider
loki provider show

# Switch to OpenAI Codex
loki provider set codex

# Switch to Cline
loki provider set cline

# List all providers and their CLI status
loki provider list

# Get detailed info about a provider
loki provider info cline
loki provider info codex

Dashboard Commands

loki dashboard

Manage the web dashboard for real-time monitoring.

loki dashboard [SUBCOMMAND] [OPTIONS]

Subcommands:

CommandDescription
start [--port PORT]Start dashboard server
stopStop dashboard server
statusGet dashboard status
url [--format {url|json}]Get dashboard URL
openOpen dashboard in browser

Examples:

# Start dashboard
loki dashboard start

# Start on custom port
loki dashboard start --port 8080

# Open in browser
loki dashboard open

# Check if dashboard is running
loki dashboard status

# Get URL for sharing
loki dashboard url

loki serve / loki api

Manage the HTTP API server (alias for dashboard).

loki serve [OPTIONS]
loki api [SUBCOMMAND] [OPTIONS]

Examples:

# Start API server
loki serve
loki api start

# Start on custom host/port
loki serve --port 9000 --host 0.0.0.0

# Stop API server
loki api stop

# Check status
loki api status

Memory Commands

loki memory

Manage cross-project learnings that persist across sessions.

loki memory [SUBCOMMAND] [OPTIONS]

Subcommands:

CommandDescription
listList all learnings
show {patterns|mistakes|successes}Display specific type
search QUERYSearch learnings
statsShow statistics
export [FILE]Export learnings to JSON
clear {patterns|mistakes|successes|all}Clear learnings
dedupeRemove duplicate entries

Examples:

# List all learnings
loki memory list

# Show only error patterns
loki memory show mistakes

# Show success patterns
loki memory show successes

# Search for specific topics
loki memory search "authentication"
loki memory search "docker"
loki memory search "rate limit"

# View statistics
loki memory stats

# Export for backup
loki memory export ./learnings-backup.json

# Clean up duplicates
loki memory dedupe

# Clear old mistakes
loki memory clear mistakes

loki compound

Knowledge compounding -- structured solutions extracted from session learnings (v5.30.0).

loki compound [SUBCOMMAND]

Subcommands:

CommandDescription
listList solutions by category
show CATEGORYShow solutions in a category
search QUERYSearch across all solutions
runManually trigger compounding
statsShow solution statistics

Examples:

# List all solution categories
loki compound list

# Show security solutions
loki compound show security

# Show performance solutions
loki compound show performance

# Search for Docker-related solutions
loki compound search "docker"

# Manually trigger compounding
loki compound run

# View statistics
loki compound stats

Categories: security, performance, architecture, testing, debugging, deployment, general


Completion Council

loki council

Manage the Completion Council -- multi-agent voting system that decides when a project is done (v5.25.0).

loki council [SUBCOMMAND]

Subcommands:

CommandDescription
statusShow council state and vote summary
verdictsDisplay decision log (vote history)
convergenceShow convergence tracking data
force-reviewForce an immediate council review
reportDisplay the final completion report
configShow council configuration

Examples:

# Check council status
loki council status

# View vote history
loki council verdicts

# Check convergence data
loki council convergence

# Force immediate review (useful if you think it's done)
loki council force-review

# View the final report
loki council report

# View council config
loki council config

Checkpoint Commands

loki checkpoint (alias: loki cp)

Save and restore session checkpoints (v5.34.0).

loki checkpoint [SUBCOMMAND]

Subcommands:

CommandDescription
create [MESSAGE]Create a new checkpoint
listList recent checkpoints
show IDShow checkpoint details

Examples:

# Create a checkpoint before risky changes
loki checkpoint create "before refactoring auth module"

# Create with short alias
loki cp create "stable state"

# List all checkpoints
loki checkpoint list

# Show details of a specific checkpoint
loki checkpoint show 3

Sandbox Commands

loki sandbox

Run Loki Mode in an isolated Docker container.

loki sandbox [SUBCOMMAND]

Subcommands:

CommandDescription
startStart sandbox container
stopStop sandbox
statusCheck status
logs [--follow]View logs
shellOpen interactive shell
buildBuild sandbox image

Examples:

# Build the sandbox image
loki sandbox build

# Start sandbox
loki sandbox start

# Check sandbox status
loki sandbox status

# View logs (follow mode)
loki sandbox logs --follow

# Open shell into the container
loki sandbox shell

# Stop sandbox
loki sandbox stop

Notification Commands

loki notify

Send notifications via Slack, Discord, or webhooks.

loki notify [SUBCOMMAND] [MESSAGE]

Subcommands:

CommandDescription
test [MESSAGE]Test all configured channels
slack MESSAGESend to Slack
discord MESSAGESend to Discord
webhook MESSAGESend to webhook
statusShow notification config

Examples:

# Check notification config
loki notify status

# Test all channels
loki notify test "Hello from Loki!"

# Send to Slack
loki notify slack "Build complete - all tests passing"

# Send to Discord
loki notify discord "Deployment successful"

# Send to custom webhook
loki notify webhook "Session finished"

Environment Variables:

LOKI_SLACK_WEBHOOK=https://hooks.slack.com/services/...
LOKI_DISCORD_WEBHOOK=https://discord.com/api/webhooks/...
LOKI_WEBHOOK_URL=https://your-server.com/webhook

Voice Commands

loki voice

Voice input for spec creation -- dictate a PRD markdown file by speaking (v5.36.0).

loki voice [SUBCOMMAND]

Subcommands:

CommandDescription
statusCheck voice input availability
listenStart listening for voice input
dictateDictate a PRD markdown spec
speak TEXTText-to-speech output
startStart voice-driven session

Examples:

# Check if voice input is available
loki voice status

# Dictate a PRD spec
loki voice dictate

# Start voice-driven session
loki voice start

Project Registry

loki projects

Manage multi-project registry for cross-project learnings and monitoring.

loki projects [SUBCOMMAND]

Subcommands:

CommandDescription
listList registered projects
show PROJECTShow project details
register PROJECTRegister new project
add PROJECTAlias for register
remove PROJECTUnregister a project
discoverAuto-discover projects
syncSync project data
healthCheck project health

Examples:

# List all registered projects
loki projects list

# Auto-discover projects in common locations
loki projects discover

# Register a project
loki projects register ~/projects/my-saas-app
loki projects add ~/projects/mobile-app

# Check project health
loki projects health

# Sync project data
loki projects sync

# Remove a project
loki projects remove my-saas-app

Enterprise Commands

loki enterprise

Manage enterprise features: API tokens, OIDC, audit trails.

loki enterprise [SUBCOMMAND]

Subcommands:

CommandDescription
statusShow enterprise status
token generate NAME [OPTIONS]Create API token
token list [--all]List tokens
token revoke {ID|NAME}Revoke token
token delete {ID|NAME}Delete token
audit summaryAudit summary
audit tailRecent audit entries

Examples:

# Check enterprise feature status
loki enterprise status

# Generate a CI/CD bot token (expires in 30 days)
loki enterprise token generate ci-bot --scopes "read,write" --expires 30

# Generate an admin token
loki enterprise token generate admin-key --scopes "*"

# List all tokens
loki enterprise token list
loki enterprise token list --all

# Revoke a token
loki enterprise token revoke ci-bot

# View audit summary
loki enterprise audit summary

# View recent audit entries
loki enterprise audit tail

Monitoring Commands

loki audit

View agent action audit trail (v5.38.0).

loki audit [SUBCOMMAND]

Examples:

# View recent audit entries
loki audit log

# Count total entries
loki audit count

loki metrics

Fetch Prometheus/OpenMetrics metrics from dashboard.

loki metrics [OPTIONS]

Examples:

# Display all metrics
loki metrics

# Filter specific metric
loki metrics | grep loki_cost_usd
loki metrics | grep loki_iteration

# Custom host/port
loki metrics --port 8080

# Use with Prometheus (add to prometheus.yml)
# - job_name: 'loki-mode'
#   static_configs:
#     - targets: ['localhost:57374']
#   metrics_path: '/api/metrics'

Available Metrics:

MetricTypeDescription
loki_session_statusgauge0=stopped, 1=running, 2=paused
loki_iteration_currentgaugeCurrent iteration number
loki_tasks_totalgaugeTasks by status
loki_agents_activegaugeCurrently active agents
loki_cost_usdgaugeEstimated total cost in USD
loki_uptime_secondsgaugeSession uptime

loki watchdog

Process supervision and health monitoring.

loki watchdog [SUBCOMMAND]

Examples:

# Check watchdog status
loki watchdog status

loki secrets

API key status and validation.

loki secrets [SUBCOMMAND]

Examples:

# Check API key status (masked)
loki secrets status

# Validate all configured keys
loki secrets validate

Configuration

loki config

Manage configuration.

loki config [SUBCOMMAND]

Examples:

# Show current config
loki config show

# Initialize config file
loki config init

# Edit in your default editor
loki config edit

# Show config file path
loki config path

loki doctor

Check system prerequisites and installation health.

loki doctor [OPTIONS]

Examples:

# Interactive health check
loki doctor

# JSON output (for CI/CD)
loki doctor --json

Checks: Node.js, Python 3, jq, git, curl, Claude CLI, Codex CLI, bash 4.0+


Utility Commands

loki version

loki version
loki --version
loki -v

loki help

loki help
loki --help
loki -h

loki completions

Install shell tab completions for bash or zsh.

# Generate bash completions
loki completions bash >> ~/.bashrc

# Generate zsh completions
loki completions zsh >> ~/.zshrc

# Or source directly
source <(loki completions zsh)

loki dogfood

Show self-development statistics (how Loki Mode was used to build itself).

loki dogfood

Common Workflows

Fix 10 GitHub issues autonomously

# Import bugs, work on them, sync status back, create PR
LOKI_GITHUB_IMPORT=true \
LOKI_GITHUB_SYNC=true \
LOKI_GITHUB_PR=true \
LOKI_GITHUB_LABELS=bug \
LOKI_GITHUB_LIMIT=10 \
loki start --github

Improve an existing codebase

# No spec needed -- Loki analyzes the code and generates improvements
loki start

# Or give it a quick task
loki quick "improve test coverage to 80%"

Run with budget and notifications

# Set a \$5 budget, get Slack notifications
LOKI_SLACK_WEBHOOK=https://hooks.slack.com/services/xxx \
loki start ./prd.md --budget 5.00

Background mode with monitoring

# Start in background
loki start ./prd.md --bg

# Monitor from dashboard
loki dashboard open

# Check status anytime
loki status

# View logs
loki logs 100

# Pause when needed
loki pause

# Resume later
loki resume

Multi-provider comparison

# Run the same spec with different providers
loki start ./prd.md --provider claude
loki start ./prd.md --provider codex
loki start ./prd.md --provider cline

Environment Variables Reference

VariableDefaultDescription
LOKI_MAX_ITERATIONS1000Max loop iterations before exit
LOKI_PROVIDERclaudeAI provider (claude/codex/cline/aider)
LOKI_DASHBOARDtrueEnable web dashboard
LOKI_DASHBOARD_PORT57374Dashboard port
LOKI_BUDGET(none)Cost budget limit in USD
LOKI_GITHUB_IMPORTfalseImport GitHub issues on start
LOKI_GITHUB_SYNCfalseSync status back to issues
LOKI_GITHUB_PRfalseCreate PR on completion
LOKI_GITHUB_LABELS(all)Filter issues by labels
LOKI_GITHUB_MILESTONE(all)Filter by milestone
LOKI_GITHUB_ASSIGNEE(all)Filter by assignee
LOKI_GITHUB_LIMIT100Max issues to import
LOKI_GITHUB_REPO(auto)Override repo detection
LOKI_GITHUB_PR_LABEL(none)Label for created PRs
LOKI_SLACK_WEBHOOK(none)Slack webhook URL
LOKI_DISCORD_WEBHOOK(none)Discord webhook URL
LOKI_WEBHOOK_URL(none)Custom webhook URL
LOKI_COMPLETION_PROMISE(none)Explicit stop condition text
LOKI_MAX_WS_CONNECTIONS100Max WebSocket connections