# CORREX Configuration Sample
# Place at ~/.config/correx/config.toml

[server]
host = "localhost"
port = 8080

[tui]
theme = "dark"
session_list_limit = 5

[cli]
default_output = "human"

[tools]
sandbox_root = "~/.config/correx/sandbox"
working_dir = "/tmp"
default_system_prompt_path = "~/.config/correx/prompts/default_system.md"

[tools.shell]
enabled = true
allowed_executables = ["bash", "sh", "python3", "node"]

[tools.file_read]
enabled = true

[tools.file_write]
enabled = true

[tools.file_edit]
enabled = true

# ─────────────────────────────────────────────────────────────
# Managed model configuration (Slice 1: correx spawns + owns llama-server)
#
# When [[models]] is present, correx launches llama-server at boot and kills it on
# shutdown.  Use this instead of (or alongside) [[providers]].
#
# [models] — global settings for the managed llama-server process
# [[models]] — one entry per model file; correx will load the defaultModel at startup.
# ─────────────────────────────────────────────────────────────
[models]
default_model = "mistral-7b"          # which [[models]] entry to load at boot
llama_server_bin = "llama-server"     # path to the llama-server binary (default: llama-server)
host = "127.0.0.1"                    # host for llama-server to bind / correx to connect
port = 10000                          # port for llama-server

[[models]]
id = "mistral-7b"
model_path = "~/models/mistral-7b-gguf/model.gguf"
context_size = 8192
capabilities = { General = 1.0, Coding = 0.7, Reasoning = 0.6, Summarization = 0.8, ToolCalling = 0.5 }

# Example: additional model (swap via TUI in a later slice)
# [[models]]
# id = "codellama-7b"
# model_path = "~/models/codellama-7b-gguf/model.gguf"
# context_size = 4096
# capabilities = { General = 0.8, Coding = 1.0, Reasoning = 0.7, Summarization = 0.6, ToolCalling = 0.7 }

# ─────────────────────────────────────────────────────────────
# Legacy static provider configuration (array of tables)
# Use [[providers]] when correx should connect to an already-running llama-server
# (i.e. you launch the server yourself externally).
# If [[models]] is configured, [[providers]] entries are registered as additional
# static providers alongside the managed one.
# ─────────────────────────────────────────────────────────────
# [[providers]]
# id = "local-llama"
# type = "llamacpp"
# model_id = "mistral-7b"
# model_path = "~/models/mistral-7b-gguf/model.gguf"
# url = "http://127.0.0.1:10000"
# capabilities = { General = 1.0, Coding = 0.7, Reasoning = 0.6, Summarization = 0.8, ToolCalling = 0.5 }

# Project-scoped, cross-session memory (distilled decision journal + repo map).
# When enabled, decisions are distilled to durable per-repo memory at session end and
# retrieved at the next session's start via the router L3 path.
[project]
enabled = false
root = ""          # repo root key; empty = current working dir
memory_k = 5       # distilled decisions retrieved per session start
# Repo-map indexer (emits a ranked file/symbol index as a recorded observation at session
# start; a top-K slice rides in context as droppable L3 memory — paths + symbol names only).
max_depth = 4                                   # directory recursion cap
inject_top_k = 30                               # entries injected into context (ranked by score)
# ignore_globs = [".git", "node_modules", "build", "target", ".gradle", "dist", ".idea"]

# Router configuration (optional, defaults shown below)
[router]
conversation_keep_last = 6     # how many recent chat turns to keep in context
retrieval_k = 5                # L3 memory hits to retrieve per query
token_budget = 4096            # context budget for router prompts

# Sampling/length for router chat + steering replies.
[router.generation]
temperature = 0.7
top_p = 0.9
max_tokens = 512

# Router narration (the live workflow commentary). max_tokens is higher than chat so
# reasoning models can finish "thinking" and still emit the line; max_per_run caps how
# many narrations fire per workflow run.
[router.narration]
temperature = 0.7
top_p = 0.9
max_tokens = 1024
max_per_run = 100

[router.embedder]
backend = "noop"               # or "llamacpp"
dimension = 1536
# url = "http://127.0.0.1:11000"
# model_id = "nomic-embed-text"

[router.l3]
backend = "in_memory"          # or "turbovec"
# persist_path = "~/.config/correx/router/l3/index.tq"
# python_executable = "python3"
# script_path = "~/.config/correx/python/turbovec_sidecar.py"
# dim = 1536
# bit_width = 4

# Custom artifact kinds. Each entry points to a JSON file holding the kind's JSON
# schema (object type, typed properties, required, additionalProperties). Workflows
# may then declare `produces` slots of this kind; LLM-emitted kinds are validated
# against the declared schema. schema_path is absolute, ~-relative, or relative to
# this config file's directory.
# [[artifacts]]
# id = "review_report"
# schema_path = "schemas/review_report.json"
# llm_emitted = true
#
# The bundled examples/workflows/review_loop.toml uses this kind: the reviewer emits a
# review_report whose `verdict` field gates the implementer↔reviewer loop via
# artifact_field_equals transitions. See docs/schemas/review_report.json for the schema.

[[artifacts]]
id = "execution_plan"
schema_path = "schemas/execution_plan.json"
llm_emitted = true
