loki chat
Interactive conversational QA terminal REPL — and the default screen when running loki with no arguments.
Usage & CLI Flags
bash
loki# or explicitly:loki chatloki chat --model ollama/llama3loki chat -m anthropic/claude-3-5-sonnet-latest
| Flag | Type | Default | Description |
|---|---|---|---|
| --model, -m | string | config / active profile | LiteLLM model override for the chat session (e.g. gemini/gemini-2.5-pro, openai/gpt-4o, ollama/llama3). |
loki chat launches an interactive multi-turn REPL (InteractiveQAChat). On startup, it automatically loads workspace context from .loki/config.yaml, .loki/rules.md, .loki/knowledge.json, and the incident.json summaries of the 3 most recent runs in .loki/runs/.
REPL Slash Commands
| Flag | Type | Default | Description |
|---|---|---|---|
| /model | REPL command | — | Show the active AI connection (model, api_base, api_key_env, source) and list all saved profiles in .loki/models.json. |
| /model <name> | REPL command | — | Switch the active profile in .loki/models.json to <name> immediately (applies to chat, rules evaluation, fix, and --auto-heal). |
| /model add <name> <model-id> [api_base=...] [api_key_env=...] [api_key=...] | REPL command | — | Save or update a named AI profile in .loki/models.json and activate it right away. |
| /model remove <name> | REPL command | — | Delete a saved profile from .loki/models.json. |
| /model reset (or default) | REPL command | — | Clear the active profile selection in .loki/models.json and fall back to .loki/config.yaml (or the bundled Gemini default). |
| /run [url] [flags] | REPL command | — | Dispatch loki run directly from the chat using the CLI's own Typer command parser (supports every loki run flag and --help), then reload workspace context. |
| /fix [run_id] [flags] | REPL command | — | Dispatch loki fix directly from the chat (e.g. /fix --apply, /fix --apply --yes) and reload workspace context. |
| /report [run_id] [flags] | REPL command | — | Dispatch loki report directly from the chat (e.g. /report, /report --no-open). |
| /runs | REPL command | — | Display a table of recent chaos runs in .loki/runs/ (Run ID, Persona, Crashes, Rule Violations) and reload context. |
| /rules | REPL command | — | Display the active natural-language business rules from .loki/rules.md. |
| /update | REPL command | — | Check GitHub Releases for a newer LOKI version and optionally upgrade via uv with interactive confirmation. |
| /clear | REPL command | — | Clear the conversation history and terminal screen. |
| /help | REPL command | — | Print the interactive slash command reference table. |
| exit / quit / q | REPL command | — | Exit the conversational QA terminal. |
Managing Models Inside Chat
bash
# Show current active model and saved profiles/model# Add a local Ollama profile and activate it immediately/model add local-llama ollama/llama3 api_base=http://localhost:11434/v1# Add an OpenAI or Mistral profile reading its key from an env var/model add gpt4o openai/gpt-4o api_key_env=OPENAI_API_KEY/model add mistral mistral/mistral-large-latest api_key_env=MISTRAL_API_KEY# Switch between saved profiles or reset to .loki/config.yaml/model local-llama/model reset# Launch a chaos run or auto-heal directly inside the REPL/run http://localhost:8000 --swarm --duration 5/fix --apply
