LOKI LogoLOKIv1.10.0

loki fix

Autonomously diagnose crashes from a run, synthesize a surgical code patch, apply it with a .loki.bak backup, and verify it via repro_test.py.

Usage

bash
loki fix [run_id] [--apply] [--yes] [--verify / --no-verify] [--model <model>]

Flags

FlagTypeDefaultDescription
[run_id]stringlatestPositional run ID in .loki/runs/ (e.g. run_20261022_120000). Defaults to the most recent run.
--apply, -aboolfalseSynthesize a surgical code patch (CodeHealer), create a <file>.loki.bak backup, apply the patch to the local source file, and verify the fix.
--yes, -yboolfalseAutomatically confirm applying the patch without an interactive prompt (requires --apply).
--verify / --no-verifybooltrueRun .loki/runs/<run_id>/repro_test.py after applying the patch to verify the crash is resolved; automatically rolls back from .loki.bak if the crash still reproduces.
--model, -mstringconfig / active profileLiteLLM model override for diagnosis and patch synthesis (e.g. openai/gpt-4o, anthropic/claude-3-5-sonnet-latest, ollama/llama3).

Examples

bash
# Terminal diagnosis only (prints Root Cause Analysis & Proposed Code Fix)
loki fix
loki fix run_20261022_120000
# Interactive patch synthesis, .loki.bak backup, apply & deterministic verification
loki fix --apply
# Non-interactive batch healing with a specific AI model
loki fix --apply --yes --model anthropic/claude-3-5-sonnet-latest
# Apply patch without running repro_test.py verification
loki fix --apply --no-verify