magi-rs 0.7.0

Magi Agent: a terminal AI assistant in Rust with sandboxed tool execution, OAuth login, and encrypted local memory (Argon2 + AES-256-GCM-SIV + Reed-Solomon FEC).
# magi-rs configuration — reference example.
#
# NOTE: as of v0.6.0 the values below ARE the built-in defaults — what magi-rs
# uses with NO `magi.toml` and no env vars (Ollama-first: provider = "openai",
# http://localhost:11434/v1, kimi-k2.6:cloud + the qwen3.5 / gpt-oss / deepseek
# trio). Running `magi-rs --init-config` or the `/init-config` TUI command
# generates exactly this profile. To use Anthropic instead, set
# provider = "anthropic" (or MAGI_PROVIDER=anthropic).
#
# Copy this file to `magi.toml` (per-workspace) and edit. `magi.toml` is
# gitignored; only `docs/magi.toml.example` is tracked.
#
# IMPORTANT: API keys NEVER live in this file. They come from environment
# variables (ANTHROPIC / OPENAI credential env vars), the OS keyring, or
# `key.txt` (for the Anthropic key). This file holds non-secret runtime
# configuration only. Placing credential fields (or any other unknown field) in
# this file is a PARSE ERROR under `deny_unknown_fields`, not silent
# acceptance — magi-rs will reject the TOML at startup and fall back to
# defaults with a surfaced warning.
#
# Precedence for every setting: env var > magi.toml > built-in default.

# Which provider backend to use. Default when omitted: "openai" (Ollama-first).
#   - "openai"    — any OpenAI-compatible Chat Completions endpoint
#                   (Ollama [default], OpenAI, Groq, OpenRouter, …)
#   - "anthropic" — Anthropic Messages API (opt-in as of v0.6.0)
provider = "openai"

[openai]
# OpenAI-compatible base URL. Examples:
#   http://localhost:11434/v1       (Ollama, local, dummy auth token accepted)
#   https://api.openai.com/v1       (OpenAI)
#   https://api.groq.com/openai/v1  (Groq)
#   https://openrouter.ai/api/v1    (OpenRouter)
base_url = "http://localhost:11434/v1"

# Model name. Built-in default when omitted: "kimi-k2.6:cloud" (env OPENAI_MODEL
# and this field both override it). NOTE: the default is an Ollama tag — point
# `base_url` at a non-Ollama service and you MUST set a model that exists there.
model = "kimi-k2.6:cloud"

[anthropic]
# Anthropic model to use when `provider = "anthropic"`. Optional — when
# omitted, magi-rs falls back to its built-in default (claude-sonnet-4-6).
model = "claude-sonnet-4-6"

# ---------------------------------------------------------------------------
# [magi] — per-agent model selection (opt-in; absent = all three share the
# principal model above, identical to v0.4.0 behavior).
#
# Why: the three MAGI perspectives reach a stronger consensus when they have
# genuine lineage diversity — different model families reason and fail
# differently, so agreement across them is more meaningful. Overrides reuse the
# principal provider's base_url + credentials and change ONLY the model name, so
# true cross-family diversity (e.g. Qwen + GPT + DeepSeek) requires the principal
# to be an Ollama-style endpoint serving all three families. With an Anthropic
# principal you can still vary across Anthropic models (tier diversity).
#
# Note: the Ollama cloud catalog models are all reasoning ("thinking") models, so
# at the Maximum tier the diversity is by LINEAGE (Alibaba / OpenAI / DeepSeek),
# each distinct from the others and from a typical principal (e.g. Moonshot kimi).
#
# Precedence per agent: MAGI_MODEL_<AGENT> env var > this section > principal model.
# A blank value is treated as unset.
#
# Suggested tiers (served via one Ollama OpenAI-compatible endpoint):
#   Tier      Melchior            Balthasar           Caspar                 VRAM
#   Light     qwen3.6:27b         gpt-oss:20b         deepseek-r1:8b         16-24 GB
#   Balanced  qwen3.6:35b-a3b     gpt-oss:20b         deepseek-r1:32b        48-64 GB
#   Maximum   qwen3.5:397b-cloud  gpt-oss:120b-cloud  deepseek-v4-pro:cloud  Cloud
#
# (Qwen 3.6 is local-only — no :cloud tag — so Maximum uses qwen3.5:397b-cloud, the
#  flagship Qwen on Ollama cloud. Tags verified on ollama.com, 2026-06.)
#
# [magi]
# melchior_model  = "qwen3.6:27b"    # Scientist  (Alibaba)  — theoretical analysis
# balthasar_model = "gpt-oss:20b"    # Pragmatist (OpenAI)   — practical trade-offs
# caspar_model    = "deepseek-r1:8b" # Critic     (DeepSeek) — adversarial review
#
# auto_approve = false
#   false (default) — the agent asks for approval before each autonomous MAGI
#                     consensus launch triggered by the main LLM in its tool loop.
#   true            — auto-approve autonomous launches; the TUI announces the launch
#                     so you know the 3-LLM consensus is running (takes seconds to
#                     minutes depending on the model tier).
#   Note: the explicit /consult TUI command is ALWAYS user-initiated and is never
#   gated — this flag only affects auto-routing in the agent tool loop.

# ---------------------------------------------------------------------------
# [memory] — tiered memory subsystem (opt-in; absent = all defaults below).
# Default mode is "selective" (embedding-indexed retrieval under a bounded
# context). Set mode = "load_all" to reproduce the v0.6.0 "load all history"
# behavior (the benchmark control). All values below ARE the built-in defaults.
# NO secrets here — deny_unknown_fields rejects credential fields and unknown keys.
#
# [memory]
# mode = "selective"                  # selective | load_all
# context_budget_tokens = 8000        # assembled-context token budget
# response_headroom_tokens = 1024     # tokens reserved for the reply
# safety_margin_ratio = 0.1           # fraction of budget held back (heuristic guard)
# chars_per_token = 3.5               # token heuristic; es ~3.5, code ~3, CJK ~2
# oversized_turn_policy = "truncate"  # truncate | error
# top_k = 12                          # retrieval candidates
# weight_similarity = 1.0             # reranker weights
# weight_recency = 0.3
# weight_salience = 0.5
# default_salience = 0.3              # base salience at write
# preference_salience = 1.0           # protected floor for preferences
# protect_salience_threshold = 0.9    # >= never evicted by decay
# decay_half_life_days = 30.0         # wall-clock recency half-life
# access_saturation_cap = 50          # bound on access-reinforcement
# forget_strength_threshold = 0.1     # below this strength => forgettable
# evicted_retention_days = -1         # -1 archive | 0 hard-delete now | N>0 after N days
# max_records = 50000                 # hard ceiling on active records (0 = opt-out)
# supersede_similarity_threshold = 0.85
# distill_every_n_turns = 20          # 0 = on-demand / session-close only
# distill_on_session_close = true
# distill_enabled = true              # false = zero memory egress for distillation
# distill_max_batch_tokens = 4000     # distiller per-run payload cap (privacy)
# supersede_max_candidate_pairs = 50  # distiller hard-supersession pair cap
# profile_max_tokens = 1024           # always-injected preference profile bound
# reembed_batch_size = 32             # lazy re-embed throttle
# max_evictions_per_pass = 1000       # clock-jump guard
# migration_throttle_batch = 256      # lazy migration batch size
# seed = 42                           # determinism
# index = "exact"                     # exact (default) | ann (needs the `ann` build feature)
# salience_markers = ["prefer", "preference", "always", "never", "remember"]

# ---------------------------------------------------------------------------
# [embedding] — embedding provider (OpenAI-compatible, Ollama-first).
# The embedding provider key is read from the environment ONLY (dummy
# "ollama" is fine for the local Ollama server); it NEVER lives in this file.
#
# [embedding]
# provider = "openai"
# base_url = "http://localhost:11434/v1"   # Ollama default; point elsewhere for cloud
# model = "nomic-embed-text-v2-moe:latest"
# dim = 0                                  # 0 = autodetect from the first response (default); set to e.g. 768 to pin the dimension
# query_prefix = "search_query: "          # nomic-embed-text-v2-moe asymmetric prefixes
# document_prefix = "search_document: "