include/entropic/types/config.h

← API

include/entropic/types/config.h

Functions

ModelConfig entropic::make_default_draft_model_config()

Speculative decoding configuration (v2.1.11, gh#36).

Off by default. When enabled is true and a draft_model is set, the engine loads the draft into the SecondaryModelLoader's "draft" slot at init and routes main-tier generation through LlamaCppBackend::do_generate_speculative. Placement axis: draft_n_gpu_layers selects CPU (0), full GPU (-1), or hybrid partial offload (>0 and < model_layers). The default of 0 puts the draft on CPU so the GPU stays saturated on the verifier — minimal VRAM cost. Build the v2.1.11 default ModelConfig for a speculative draft model. Differs from the standard tier defaults in three places that the kernel currently depends on: gpu_layers = 0 — CPU-resident draft (zero VRAM on top of primary). Override to -1 for full GPU when VRAM allows. flash_attn = false — required for partial seq_rm support on MoE / GQA architectures (the kernel rolls back draft KV after each speculative round). Override to true ONLY if your model backend can do partial seq_rm with flash attn enabled. context_length = 8192 — modest; speculative drafts are typically 4–32 tokens per round, no need for a wide window. n_threads = 4 — works on most laptops; bump to match physical core count for higher CPU draft throughput. Every other field comes from ModelConfig's standard defaults.

Returns
A ModelConfig carrying the draft-model default spec.

Enums

MCPAccessLevel

MCP tool access level for per-identity authorization.

Two ordered levels: READ < WRITE. WRITE implies READ. Default for ungranted keys is NONE (no access). Default for new tools is WRITE (safe default — tools must opt into READ).

  • NONE 0
  • READ 1
  • WRITE 2

ModelState

C++ enum class for model VRAM lifecycle states.

Maps 1:1 to C entropic_model_state_t for cross-boundary use. Internal C++ code uses this typed enum; C boundary uses the C enum.

  • ACTIVE ENTROPIC_MODEL_STATE_ACTIVE

AdapterState

LoRA adapter lifecycle state.

Mirrors ModelState but for LoRA adapters. An adapter must be HOT for its weights to influence generation. Multiple adapters can be WARM simultaneously (loaded in RAM), but only one can be HOT per inference context.

  • COLD 0
  • WARM 1
  • HOT 2

OutsideRootAccess

What the filesystem server does with a path outside its root.

The YAML spelling of mcp.filesystem.allow_outside_root: false, true, or optional (v2.13.0). An enum rather than optional<bool> on purpose — if (cfg.allow_outside_root) on an optional<bool> compiles and is TRUE for an explicit false, which is exactly the mistake a security switch cannot afford.

  • refuse
  • optional

DelegationIsolation

How a delegation's filesystem writes are contained (gh#160).

  • none
  • sandbox

entropic::AdapterInfo

Metadata for a loaded LoRA adapter.

std::string entropic::AdapterInfo::name

Unique adapter identifier.

std::filesystem::path entropic::AdapterInfo::path

Resolved path to .gguf adapter file.

AdapterState entropic::AdapterInfo::state

Current lifecycle state.

float entropic::AdapterInfo::scale

LoRA scaling factor (alpha/rank)

std::string entropic::AdapterInfo::tier_name

Tier this adapter is assigned to (empty = unassigned)

std::string entropic::AdapterInfo::base_model_path

Path of the base model this adapter targets.

size_t entropic::AdapterInfo::ram_bytes

RAM consumption when WARM/HOT (0 if COLD)

std::unordered_map<std::string, std::string> entropic::AdapterInfo::metadata

Adapter-specific metadata for routing decisions.

entropic::AuditLogConfig

Audit log configuration within StorageConfig .

std::filesystem::path entropic::AuditLogConfig::log_dir

Directory for audit log files.

std::string entropic::AuditLogConfig::session_id

UUID for this session.

bool entropic::AuditLogConfig::enabled

Master toggle for audit logging.

size_t entropic::AuditLogConfig::flush_interval_entries

Flush every N entries (0 = every entry)

size_t entropic::AuditLogConfig::max_file_size

Rotation size in bytes (0 = unlimited)

size_t entropic::AuditLogConfig::max_files

Max rotated files to keep.

entropic::BashConfig

Bash MCP server configuration (v2.13.0).

int entropic::BashConfig::timeout_seconds

Per-command wall-clock limit (>= 1)

entropic::CompactionConfig

Auto-compaction configuration.

bool entropic::CompactionConfig::enabled

Enable auto-compaction.

float entropic::CompactionConfig::threshold_percent

Compaction trigger (0.5–0.99)

int entropic::CompactionConfig::preserve_recent_turns

Turns to preserve (1–10)

int entropic::CompactionConfig::summary_max_tokens

Summary max tokens (500–4000)

bool entropic::CompactionConfig::notify_user

Notify user on compaction.

bool entropic::CompactionConfig::save_full_history

Save full history before compaction.

int entropic::CompactionConfig::tool_result_ttl

Tool result TTL in turns (>= 1; v2.1.3 #6: gated on fill, no upper bound)

float entropic::CompactionConfig::warning_threshold_percent

Warning trigger (0.3–0.9)

entropic::ConstitutionalValidationConfig

Constitutional validation pipeline configuration.

bool entropic::ConstitutionalValidationConfig::enabled

Global enable/disable (default OFF)

int entropic::ConstitutionalValidationConfig::max_revisions

Max re-generation attempts (0 = critique only)

int entropic::ConstitutionalValidationConfig::max_critique_tokens

Token budget for critique generation.

float entropic::ConstitutionalValidationConfig::temperature

Critique generation temperature.

bool entropic::ConstitutionalValidationConfig::enable_thinking

Enable think-blocks for critique (default OFF)

int entropic::ConstitutionalValidationConfig::priority

Hook priority (higher = later)

std::string entropic::ConstitutionalValidationConfig::grammar_key

Grammar registry key.

std::vector<std::string> entropic::ConstitutionalValidationConfig::skip_tiers

Tiers exempt from validation (default: lead — streams before hook fires)

std::string entropic::ConstitutionalValidationConfig::critique_tier

Tier to route critique generation on.

Empty = use the active tier (previous behavior). Pointing this at a smaller tier (e.g. "eng") avoids burning 35B primary inference on grammar- constrained critique work. (E4, 2.0.6-rc17)

entropic::DelegationConfig

Delegation behaviour knobs (gh#160, v2.13.0).

DelegationIsolation entropic::DelegationConfig::isolation

Default: none.

entropic::ExternalMCPConfig

External MCP server configuration (Entropic-as-server).

bool entropic::ExternalMCPConfig::enabled

Enable external MCP.

std::optional<std::filesystem::path> entropic::ExternalMCPConfig::socket_path

Socket path (nullopt = derived)

int entropic::ExternalMCPConfig::rate_limit

NOT ENFORCED.

Parsed since the bridge shipped and read by nothing; the bridge logs a warning at start when it is set to anything but the default (v2.14.0). Kept only so existing configs still load — enforcing it now at 10/min would throttle every consumer.

bool entropic::ExternalMCPConfig::ask_streaming

Route entropic.ask through entropic_run (false) or entropic_run_streaming (true, default).

Set false when MTP is active — streaming binds on_token and trips the MTP incompatibility guard (gh#115, v2.9.12).

int entropic::ExternalMCPConfig::http_port

Also serve the bridge over Streamable HTTP on 127.0.0.1:<port> (gh#204, v2.14.0).

0 (default) = unix socket only. One URL for every MCP client, instead of a host per client. Loopback only; clients authenticate with the bearer token written to ~/.entropic/serve/<port>.token (mode 0600) on each start. For remote use, tunnel with ssh -L <port>:127.0.0.1:<port> host. If the port cannot be served, configure fails with ENTROPIC_ERROR_IO.

bool entropic::ExternalMCPConfig::allow_shutdown

Advertise <prefix>.shutdown , which stops the host (v2.14.6).

false (default): the tool does not exist. The bridge is library code that embedders run inside their own process, so a tool that signals that process must be an explicit host decision. entropic serve --allow-shutdown sets it. When accepted, shutdown takes the same exclusive claim as release (refused while any session is decoding; no turn starts after), replies, then raises SIGTERM on the process.

std::string entropic::ExternalMCPConfig::tool_prefix

Namespace for the tools this bridge advertises (gh#145).

The engine is a substrate, not the product: librentropic.so is deliberately consumable by more than one app, so the tools a given host exposes are that HOST's identity. Default "entropic" reproduces the pre-2.12.0 names exactly, so an unset config is bit-identical. A prefix of "sumac" advertises sumac.ask, sumac.status, and so on.

std::string entropic::ExternalMCPConfig::server_name

serverInfo.name reported in the MCP initialize response (gh#145).

Independent of tool_prefix on purpose: the tool namespace is what a MODEL reasons over when choosing a tool, while this is what a PERSON reads in their MCP server list. A consumer may legitimately want to namespace its tools while still disclosing which engine is behind the bridge, or vice versa.

std::unordered_map<std::string, std::string> entropic::ExternalMCPConfig::tool_descriptions

Optional per-tool description overrides, keyed by bare suffix ("ask", "status", "context_clear", ...) — gh#145.

A tool description is the string a model actually reasons over when deciding what to call. The stock text describes the TRANSPORT ("Submit a prompt to the running entropic engine") rather than the capability, so a host with one specific job cannot express it. An absent or unknown key leaves the built-in description untouched.

entropic::ExternalServerEntry

Configuration for a single external MCP server entry.

std::string entropic::ExternalServerEntry::command

Stdio command (empty for SSE)

std::vector<std::string> entropic::ExternalServerEntry::args

Stdio command arguments.

std::unordered_map<std::string, std::string> entropic::ExternalServerEntry::env

Stdio environment variables.

std::string entropic::ExternalServerEntry::url

SSE endpoint URL (empty for stdio)

entropic::FilesystemConfig

Filesystem MCP server configuration.

bool entropic::FilesystemConfig::diagnostics_on_edit

Proactive diagnostics on edit/write.

bool entropic::FilesystemConfig::fail_on_errors

Rollback edit if it introduces errors.

float entropic::FilesystemConfig::diagnostics_timeout

Diagnostics timeout (0.1–5.0)

OutsideRootAccess entropic::FilesystemConfig::allow_outside_root

Paths OUTSIDE the root: refuse, allow, or ask (v2.13.0).

Defaults to optional. Until v2.13.0 this was a bool and data/default_config.yaml shipped it true, so every consumer on the bundled defaults gave the model unconfined READ and WRITE of the whole filesystem — through read_file, write_file, edit_file and list_directory — without anyone having chosen that. optional sends each escaping path to the host's path approver (entropic_set_path_approval_callback) with the resolved path and read/write; with no approver registered the call is REFUSED with a typed outside_root_approval_required message. It never fails open. Precedence, highest first: outside_root_deny (always refused), outside_root_allow (served, no prompt), then this setting. A path inside the root is always served. permissions.auto_approve does NOT approve an escape: it skips per-TOOL prompts, it does not widen the filesystem boundary. A named workspace's own servers are forced to refuse with an empty allow list and no approver (gh#166).

std::vector<std::filesystem::path> entropic::FilesystemConfig::outside_root_allow

Pre-approved subtrees outside the root — no prompt (v2.13.0).

Absolute paths (~ expanded at load). Matching is by canonical SUBTREE: /opt/data covers /opt/data/x, never /opt/database.

std::vector<std::filesystem::path> entropic::FilesystemConfig::outside_root_deny

Subtrees outside the root that are ALWAYS refused (v2.13.0).

Beats outside_root_allow and allow_outside_root: true. Same subtree matching. Governs outside-root paths only — a deny entry inside the root has no effect there and is warned about.

std::optional<int> entropic::FilesystemConfig::max_read_bytes

Byte budget of ONE read_file window (nullopt = derive from context).

v2.14.0 (gh#201): a longer file is paged, not refused; only a single line larger than the budget is size_exceeded.

float entropic::FilesystemConfig::max_read_context_pct

Context share for one read_file window (when max_read_bytes is unset)

int entropic::FilesystemConfig::max_walk_entries

Hard cap on directory entries visited by ONE glob or grep walk; <= 0 disables the cap (gh#161).

The pre-2.13.0 caps were on MATCHES only (500 for glob, 100 for grep), so a pattern that matched almost nothing still walked the whole tree — 187,855 entries on the repository that reported gh#161, where a single glob **‍/*.hpp took 87 seconds. A tool call that blocks the agent loop for a minute and a half is a hang from the model's point of view: it cannot see that it is waiting, and a consumer with a request timeout drops the turn. 250,000 is deliberately generous — larger than any first-party checkout, so it never fires on a normal workspace and is not a silent result filter. It is a CEILING that converts an open-ended stall into a bounded, ANNOUNCED result: hitting it appends an explicit truncation notice to the tool result (and a warning to the log), because a silently short answer would be worse than the hang it replaces.

entropic::GPUResourceProfile

Named GPU resource profile for controlling inference hardware knobs.

std::string entropic::GPUResourceProfile::name

Profile name ("maximum", "balanced", "background", "minimal")

int entropic::GPUResourceProfile::n_batch

Batch size for prompt processing (1-2048)

int entropic::GPUResourceProfile::n_threads

CPU threads for generation (0 = auto-detect)

int entropic::GPUResourceProfile::n_threads_batch

CPU threads for batch processing (0 = use n_threads)

std::string entropic::GPUResourceProfile::description

Human-readable description.

entropic::GenerationConfig

Generation parameters configuration (top-level defaults).

int entropic::GenerationConfig::max_tokens

Default max tokens (64–32768)

float entropic::GenerationConfig::default_temperature

Default temperature (0.0–2.0)

float entropic::GenerationConfig::default_top_p

Default top_p (0.0–1.0)

std::string entropic::GenerationConfig::budget_mode

gh#80 (v2.5.0) thinking-budget mode: "off" (default), "tokens", or "wall_clock".

Stored as a string here to keep types/config.h free of the core engine_types BudgetMode enum; the facade's build_loop_config maps it. Unknown values resolve to "off" with a warning.

int entropic::GenerationConfig::budget_limit

gh#80 (v2.5.0) budget ceiling: generated tokens (budget_mode "tokens") or wall-clock seconds (budget_mode "wall_clock") of tool-call-free generation before the engine nudges-then-hard-cuts.

Must be > 0 to engage.

bool entropic::GenerationConfig::stream_output

gh#110 (v2.9.6) agent-loop token delivery mode: true streams tokens via the per-token callback path, false batches the full response.

Default true preserves existing behavior. MTP/speculative decoding rejects streaming calls (the thinking-channel strip is a post-buffer operation) — set this false to make the agent loop reachable by inference.speculative.mtp.

entropic::GenerationParams

Generation parameters for a single inference call.

std::string entropic::GenerationParams::session_key

Caller-scoped session this generation belongs to (gh#144).

"" (default) is the single legacy sequence — bit-identical to pre-v2.12.0. The BACKEND owns the key-to-llama-sequence mapping and its eviction, because it owns the slots and the residency; the engine deliberately knows nothing about sequence ids.

float entropic::GenerationParams::temperature

Sampling temperature.

float entropic::GenerationParams::top_p

Nucleus sampling threshold.

int entropic::GenerationParams::top_k

Top-K sampling.

float entropic::GenerationParams::repeat_penalty

Repetition penalty.

float entropic::GenerationParams::min_p

Min-p nucleus sampling threshold (gh#23 MVP item 1).

Filters tokens whose probability is below min_p * P(top_token). 0.0 (default) disables — preserves pre-v2.3.10 behavior bit-for-bit. Typical productive range: 0.01–0.2. Values >= 1.0 filter every non-top token (degenerate but not crash-inducing; the dist sampler still selects the single survivor).

float entropic::GenerationParams::presence_penalty

Presence-penalty term in llama.cpp's penalties sampler (gh#23 MVP item 2).

Subtracts a constant from any token that has appeared at least once in the recent window. 0.0 (default) disables — preserves pre-v2.3.14 chain bit-for-bit. Typical range: 0.0–2.0.

std::unordered_map<int32_t, float> entropic::GenerationParams::logit_bias

Per-token logit bias map (gh#23 MVP item 4).

Maps token id → additive bias (in logit-space). Applied at the start of the sampler chain (before penalties), so it shapes the post-softmax distribution that every downstream filter (top-k, top-p, min-p, etc.) sees. Common uses: Suppress a token: bias = -INFINITY (or a large negative value like -100 if -INFINITY doesn't survive JSON). Force a token: bias = +INFINITY (or large positive). Subtle nudges: bias = ±1.0..±5.0. Empty map (default) disables the stage entirely — preserves pre-v2.3.16 chain shape bit-for-bit.

float entropic::GenerationParams::frequency_penalty

Frequency-penalty term in llama.cpp's penalties sampler (gh#23 MVP item 3).

Subtracts a per-occurrence linear amount from any token that has appeared in the recent window — penalizes by COUNT rather than presence. 0.0 (default) disables — preserves pre-v2.3.15 chain bit-for-bit. Typical range: 0.0–2.0. Pairs with repeat_penalty (multiplicative) and presence_penalty (per-presence constant); all three run in one llama_sampler_init_penalties call. Any non-default value here activates the penalties stage even when repeat_penalty == 1.0 and presence_penalty == 0.0.

int entropic::GenerationParams::max_tokens

Maximum tokens to generate.

int entropic::GenerationParams::seed

RNG seed for reproducible sampling.

-1 = random (default). Maps to LLAMA_DEFAULT_SEED when negative. (P2-14)

int entropic::GenerationParams::reasoning_budget

Per-call think budget override (-1 = unlimited)

bool entropic::GenerationParams::enable_thinking

Enable <think> blocks (false if reasoning_budget == 0)

bool entropic::GenerationParams::force_tool_call

Force this generation to make a tool call (v2.14.6).

Set by the engine for the retry after it nudged a tier that owes a tool call: the orchestrator then stages gh#134's require_tool_call for THIS generation only, so the tool-call grammar binds eagerly. A model that already complies is never constrained — the first attempt stays free-form.

std::string entropic::GenerationParams::grammar

GBNF grammar string (empty = unconstrained)

std::string entropic::GenerationParams::grammar_key

Grammar registry key.

Resolved to GBNF content by orchestrator before passing to the backend. If both grammar and grammar_key are set, grammar (raw string) takes precedence.

std::string entropic::GenerationParams::resolved_grammar_key

The key or frontmatter stem that was NAMED for this call, set by ModelOrchestrator::resolve_grammar_key (gh#154).

Carries the name even when the lookup MISSED, because a named key that resolved to nothing is the state gh#154 exists to make visible — GrammarProvenance::resolved is what says whether a grammar text actually reached the sampler.

bool entropic::GenerationParams::grammar_from_tier

true when resolved_grammar_key came from the TIER's frontmatter grammar: rather than the caller (gh#154).

All three request-side sources arrive as grammar, so without this a consumer cannot tell a tier-configured grammar from one they passed themselves.

std::vector<std::string> entropic::GenerationParams::stop

Stop sequences.

std::string entropic::GenerationParams::tool_call_mode

Per-call tool-call generation mode (gh#103).

Empty = defer to tier/default ("batch"). "sequential" → the orchestrator appends the resolved family tool-call close marker to stop at stage time, so the decode loop halts at the FIRST closed tool call (one tool/turn, observe-between-actions). "batch" = no injection (parallel calls).

int entropic::GenerationParams::logprobs

Top log-probs per token (0 = disabled)

int entropic::GenerationParams::time_limit_ms

Wall-clock time cap in milliseconds.

Generation is cancelled if this limit is reached. 0 = no time limit (default).

std::string entropic::GenerationParams::profile

GPU resource profile name.

Resolved to GPUResourceProfile by the orchestrator before passing to the backend. Empty string means use the "balanced" profile.

bool entropic::GenerationParams::auto_adapt

Enable throughput-based max_tokens auto-adaptation.

When true, the orchestrator may reduce max_tokens to fit within time_limit_ms based on recent throughput measurements. Ignored if time_limit_ms == 0.

float entropic::GenerationParams::adapt_headroom

Target time usage fraction for auto-adaptation.

0.9 means "use at most 90% of time_limit_ms for generation".

std::string entropic::GenerationParams::tools

Active tool definitions for this turn, as an MCP tool-list JSON array ( [{name, description, inputSchema}, ...] ), already filtered per-tier by the caller.

gh#87 (v2.7.0): structured tool defs flow here instead of being string-injected into the system message. The orchestrator stages them on the backend (LlamaCppBackend::set_active_tools) so the common_chat render emits — and parse extracts — the model's native tool-call wire format. Empty (default) = no tools this turn (the backend renders without a tool grammar).

entropic::GrammarEntry

Metadata for a registered grammar.

std::string entropic::GrammarEntry::key

Unique registry key (e.g., "compactor", "chess_executor")

std::string entropic::GrammarEntry::gbnf_content

Raw GBNF grammar string.

std::string entropic::GrammarEntry::source

Origin: "bundled", "file", "runtime", "dynamic".

bool entropic::GrammarEntry::validated

true if grammar has passed validation

std::string entropic::GrammarEntry::error

Non-empty if validation failed.

entropic::InferenceConfig

Inference-side configuration knobs (v2.1.11).

SpeculativeConfig entropic::InferenceConfig::speculative

Speculative decoding (gh#36)

entropic::LSPConfig

LSP integration configuration.

bool entropic::LSPConfig::enabled

Enable LSP integration.

bool entropic::LSPConfig::python_enabled

Enable Python LSP.

bool entropic::LSPConfig::c_enabled

Enable C/C++ LSP.

std::unordered_map<std::string, LSPServerConfig> entropic::LSPConfig::servers

Custom server overrides.

entropic::LSPServerConfig

Configuration for a single LSP server.

std::string entropic::LSPServerConfig::command

Server command.

std::vector<std::string> entropic::LSPServerConfig::args

Command arguments.

std::vector<std::string> entropic::LSPServerConfig::extensions

File extensions.

entropic::MCPConfig

MCP server configuration.

bool entropic::MCPConfig::enable_entropic

Enable entropic internal server (handoff, delegate, pipeline)

bool entropic::MCPConfig::enable_filesystem

Enable filesystem server.

bool entropic::MCPConfig::enable_bash

Enable bash server.

bool entropic::MCPConfig::enable_git

Enable git server.

bool entropic::MCPConfig::enable_diagnostics

Diagnostics server — placeholder, off by default (v2.14.0, gh#174)

bool entropic::MCPConfig::enable_web

Web server — placeholder, off by default (v2.14.0, gh#174)

FilesystemConfig entropic::MCPConfig::filesystem

Filesystem server config.

BashConfig entropic::MCPConfig::bash

Bash server config (v2.13.0)

ExternalMCPConfig entropic::MCPConfig::external

External MCP server config (Entropic-as-server)

int entropic::MCPConfig::server_timeout_seconds

Seconds an external MCP server gets to come up: the initialize handshake and its tools/list, on first connect and on every reconnect (gh#175, v2.14.0).

Must be >= 1. Parsed since v1.8.1 and read by nothing until v2.14.0, while a hardcoded 10 s bounded bring-up instead. The default is 10 so that wiring the key changes no deployment's behaviour — the old default of 30 never did anything. It matters more from v2.14.0: configure now connects external servers synchronously (gh#199), so this is how long a hung server can hold configure. Unrelated to bash.timeout_seconds (the bash tool's own limit).

std::string entropic::MCPConfig::working_dir

Server working directory (empty = CWD) (v2.0.4)

std::vector<std::filesystem::path> entropic::MCPConfig::plugins

In-process MCP server plugin .so paths (gh#133, v2.10.1).

Each entry is dlopened at startup and must implement the contract in entropic/interfaces/i_mcp_server.h. Distinct from external_servers, which spawn a separate process and speak MCP over stdio/SSE — these load into the engine's address space and are called directly through the C ABI. A path that fails to load is a loud error, not a skip.

std::unordered_map<std::string, ExternalServerEntry> entropic::MCPConfig::external_servers

Named external servers the operator declared (v1.8.7).

Declared here = enabled: an operator who writes an entry asked for it. Before v2.14.0 this key was in the struct and the schema but parsed from no config file and connected by nothing. v2.14.1: launched by EVERY server set — the handle's and each workspace's — started in that set's root. ${ENTROPIC_WORKSPACE_ROOT} in an entry's args or env values expands to that root, e.g. env: {CLAUDE_PROJECT_DIR: "${ENTROPIC_WORKSPACE_ROOT}"}.

std::vector<std::filesystem::path> entropic::MCPConfig::workspace_roots

Directories a workspace root may lie inside (gh#211, v2.14.4).

A workspace root is a tool root — the filesystem tools are confined to it and declared servers launch in it — and a bridge client names it by absolute path. Empty (the default) = unrestricted, the pre-2.14.4 behaviour. When set, a root must resolve (symlinks followed, .. collapsed) inside one entry, or workspace creation is refused. Entries must be absolute.

std::vector<std::string> entropic::MCPConfig::enabled_mcpjson_servers

.mcp.json servers pre-approved by name (gh#199).

Discovery reads <root>/.mcp.json and ~/.entropic/.mcp.json, then connects ONLY enabled entries: refused if named in disabled_mcpjson_servers; connected if named here or enable_all_project_mcp_servers is true; otherwise the ENTROPIC_HOOK_PRE_MCP_SERVER_CONNECT pre-hook decides; with no hook registered, NOT connected. Inherited by every workspace.

std::vector<std::string> entropic::MCPConfig::disabled_mcpjson_servers

.mcp.json servers always refused, even under enable-all.

bool entropic::MCPConfig::enable_all_project_mcp_servers

Pre-approve every discovered server not explicitly disabled.

ReconnectConfig entropic::MCPConfig::reconnect

Reconnection backoff policy.

uint32_t entropic::MCPConfig::health_check_interval_ms

Ping interval (0 = disabled)

uint32_t entropic::MCPConfig::tool_call_timeout_ms

Per-call timeout for external tools.

entropic::MCPKey

A single authorized MCP key with access level.

std::string entropic::MCPKey::tool_pattern

Tool pattern (e.g., "filesystem.*", "git.status")

MCPAccessLevel entropic::MCPKey::level

Granted access level (READ or WRITE)

entropic::ModelConfig

Model configuration for a single tier.

Derived by entropic::TierConfig.

std::filesystem::path entropic::ModelConfig::path

Resolved model file path.

std::string entropic::ModelConfig::adapter

Chat adapter name.

int entropic::ModelConfig::context_length

Context window size (512–131072)

int entropic::ModelConfig::gpu_layers

GPU offload layers (-1 = all)

bool entropic::ModelConfig::gpu_layers_auto

Derive gpu_layers from free VRAM at admission (gh#148).

Set by gpu_layers: auto in YAML. The engine then computes the split from the GGUF's size and the VRAM the device reports free, and LOGS the number it chose. Opt-in, because a derived split is a decision the operator should have asked for: the engine otherwise takes gpu_layers verbatim, and a clamp it applied on its own would be exactly the silent behaviour this codebase refuses. It derives the LAYER SPLIT and nothing else — in particular it does not touch use_mlock, which the model-test harness used to flip off behind the operator's back for oversized models. That combination is refused loudly instead.

bool entropic::ModelConfig::keep_warm

Keep this model resident in host RAM (WARM) when it leaves the active slot, instead of unloading it (gh#157).

Read by the swap-out path only. It has never controlled STARTUP loading, though it was documented as "pre-warm model at startup" from v1.8.0 to v2.12.2 — the default tier loaded at init regardless of this flag. Startup behaviour is ModelsConfig::defer_load.

bool entropic::ModelConfig::use_mlock

Lock model in system RAM.

int entropic::ModelConfig::cpu_moe_layers

EXPERIMENTAL: layers whose ROUTED-EXPERT tensors go to the host while everything else follows gpu_layers (gh#153, decision #42(iii)).

gpu_layers is role-blind — a layer is wholly on the card or wholly on the host — so a model that does not fit spends VRAM on rarely touched expert weights and exiles attention AND ITS KV to system RAM. This places the first N layers' expert FFN tensors (ffn_{gate,up,down,gate_up}_exps and their per-expert scales) on the CPU; attention, KV, the router, the shared/dense FFN, norms and embeddings are untouched and still follow gpu_layers. It maps 1:1 onto llama.cpp's --n-cpu-moe / -ncmoe (LLAMA_ARG_N_CPU_MOE) and is named for it deliberately: the mechanism, the semantics ("the FIRST N layers") and the tensor patterns are upstream's, so an operator who has read llama.cpp's docs transfers what they know without translation. 0 (default) installs no overrides at all and is byte-identical to every release before v2.13.0. There is no "all layers" sentinel: negative values are REFUSED, not reinterpreted.

int entropic::ModelConfig::reasoning_budget

Think token budget (-1 = unlimited)

std::string entropic::ModelConfig::cache_type_k

KV cache key quantization type.

std::string entropic::ModelConfig::cache_type_v

KV cache value quantization type.

int entropic::ModelConfig::n_batch

Batch size for prompt processing.

int entropic::ModelConfig::n_ubatch

Physical micro-batch size for prompt processing (gh#23 MVP item 5).

llama.cpp's cparams.n_ubatch. Decoupled from n_batch since llama.cpp v0.4 — n_batch is the LOGICAL batch (max tokens queued per llama_decode call) and n_ubatch is the PHYSICAL chunk the kernels actually process. Smaller n_ubatch reduces peak GPU memory for the same n_batch. 0 (default) means "match `n_batch`" — preserves pre-v2.3.17 behavior bit-for-bit since llama.cpp's default in that case is min(n_batch, default). Typical productive values: 128, 256, 512 (== n_batch).

int entropic::ModelConfig::n_threads

CPU threads (0 = auto-detect)

std::string entropic::ModelConfig::tensor_split

Multi-GPU tensor split ratios (empty = single GPU)

std::string entropic::ModelConfig::split_mode

Multi-GPU split mode for model load (gh#23 MVP item 6).

Maps to llama.cpp's enum llama_split_mode. Accepted values: "" (default) — keep llama.cpp's default (LAYER). "none" — single GPU, no split. Use with main_gpu. "layer" — split layers + KV across GPUs (llama.cpp default). "row" — split layers + KV with tensor parallelism. Unrecognized values fall back to the default with a logged warning. Empty (default) preserves pre-v2.3.18 model load bit-for-bit.

int entropic::ModelConfig::main_gpu

Primary GPU index for model load (gh#23 MVP item 7).

llama.cpp's mparams.main_gpu. Effective when split_mode == "none" (single-GPU pinning) or "row" (small tensors go to this GPU). Ignored when split_mode == "layer". 0 (default) preserves pre-v2.3.19 behavior bit-for-bit.

bool entropic::ModelConfig::offload_kqv

Offload KQV ops (incl.

KV cache) to the GPU (gh#23 MVP item 8). llama.cpp's cparams.offload_kqv. true (default) matches llama.cpp's default — KQV runs on GPU for max throughput. Set false to keep KQV on the CPU side; saves VRAM at a throughput cost. Useful for tight-VRAM single-GPU setups.

float entropic::ModelConfig::rope_freq_base

RoPE base frequency override (gh#23 MVP item 9).

llama.cpp's cparams.rope_freq_base. 0.0 (default) takes the model's trained value — preserves pre-v2.3.21 behavior bit-for-bit. Positive overrides typically range 10000–10000000; raising it stretches the RoPE period (extends effective context at a quality cost). Pair with rope_freq_scale for YaRN-style context-extension setups.

float entropic::ModelConfig::rope_freq_scale

RoPE frequency scaling factor (gh#23 MVP item 10).

llama.cpp's cparams.rope_freq_scale. 0.0 (default) takes the model's trained value — preserves pre-v2.3.22 behavior bit-for-bit. Values in (0, 1) shrink the effective context (denser RoPE positions); values > 1 stretch it. Typical YaRN-style extension uses values like 0.5 (2× context). Pairs with rope_freq_base.

int entropic::ModelConfig::n_parallel

Max parallel sequences per context (gh#23 MVP item 11).

llama.cpp's cparams.n_seq_max. 1 (default) matches llama.cpp's default — single-sequence context, bit-identical pre-v2.3.23 behavior. Raising this enables KV-cache slot reuse across multiple concurrent generations (e.g. speculative rejection batches, batched-server scenarios). Effective max is LLAMA_MAX_SEQ; consult llama.cpp for the current ceiling.

int entropic::ModelConfig::max_sessions

Resident per-caller conversation sessions this tier keeps KV for (gh#144).

1 (default) is bit-identical to pre-v2.12.0. Greater than 1 DERIVES the context geometry rather than being set alongside it — n_seq_max, kv_unified and n_ctx are computed from this and context_length, and the derivation is logged. Three independently settable knobs an operator can get inconsistent is precisely the silent-misconfiguration shape this codebase's fail-fast rule exists to prevent, and kv_unified is not a config key at all. context_length stays PER SESSION: a pool of 3 at 32768 allocates 98304 cells, not 3 sessions sharing 32768.

bool entropic::ModelConfig::flash_attn

Enable flash attention.

std::optional<std::vector<std::string> > entropic::ModelConfig::allowed_tools

Tool whitelist (nullopt = all)

std::filesystem::path entropic::ModelConfig::mmproj_path

Vision projector GGUF path.

When non-empty, the backend loads an mtmd_context alongside the base model for multimodal inference. Empty (default) = text-only model.

std::string entropic::ModelConfig::model_format

Expected model format.

"gguf" (default), "axmodel", "onnx", or empty (auto-detect). The backend validates that the file matches the expected format during load(). Mismatch returns ENTROPIC_ERROR_LOAD_FAILED with a diagnostic message identifying the actual format.

entropic::ModelsConfig

Configuration for all models (tiers + router).

std::unordered_map<std::string, TierConfig> entropic::ModelsConfig::tiers

Tier name → config.

std::optional<ModelConfig> entropic::ModelsConfig::router

Router model (separate from tiers)

std::string entropic::ModelsConfig::default_tier

Default tier name.

bool entropic::ModelsConfig::defer_load

Defer the default tier's model load to first use (gh#157).

false (default) keeps the pre-2.13.0 behaviour exactly: the default tier is loaded and activated during entropic_configure*. true leaves it COLD until the first thing that needs it asks — a generation, or any of the evaluation / state APIs — at which point it loads through the same residency gate and fires the same ENTROPIC_RESIDENCY_LOADED event as a mid-session tier swap. This is a NEW key rather than a meaning for keep_warm (which governs swap-out, not startup, and defaults to false): reusing it would have made every existing consumer lazy without their asking — a behaviour change disguised as a doc fix.

std::string entropic::ModelsConfig::find_tier_by_path(const std::filesystem::path &model_path) const

Find tier name by model path.

Iterates tiers to find one whose resolved path matches. Returns empty string if no tier uses the given path.

Parameters
  • model_path — Model file path to match.
Returns
Tier name, or empty string if not found.

entropic::ParsedConfig

Full parsed configuration.

ModelsConfig entropic::ParsedConfig::models

Tiers + router.

RoutingConfig entropic::ParsedConfig::routing

Routing rules.

GenerationConfig entropic::ParsedConfig::generation

Default generation params.

PermissionsConfig entropic::ParsedConfig::permissions

Tool permissions.

MCPConfig entropic::ParsedConfig::mcp

MCP server settings.

CompactionConfig entropic::ParsedConfig::compaction

Auto-compaction settings.

DelegationConfig entropic::ParsedConfig::delegation

Delegation isolation (gh#160)

LSPConfig entropic::ParsedConfig::lsp

LSP integration.

PromptCacheConfig entropic::ParsedConfig::prompt_cache

Prompt KV cache settings.

StorageConfig entropic::ParsedConfig::storage

Storage backend settings (v1.8.8)

std::string entropic::ParsedConfig::log_level

Log level string.

std::optional<std::filesystem::path> entropic::ParsedConfig::constitution

Constitution: nullopt = bundled default, disabled = explicit false.

bool entropic::ParsedConfig::constitution_disabled

true if constitution explicitly disabled

std::optional<std::filesystem::path> entropic::ParsedConfig::app_context

App context: nullopt = disabled by default.

bool entropic::ParsedConfig::app_context_disabled

true if app_context explicitly disabled

std::optional<std::string> entropic::ParsedConfig::app_context_content

Inline app_context text, supplied instead of a path (gh#141).

Set by the app_context: {content: ...} object form. Takes precedence over app_context when both are present. Exists because a consumer may hold this text in memory and be unable to write it to disk — the file is a provenance boundary for them, and on Android there is no stable writable path to point at.

std::filesystem::path entropic::ParsedConfig::workspace_app_context

Per-workspace app_context file, relative to each workspace root (gh#179, v2.14.0).

Empty = off (the default). When set (e.g. .entropic/ENTROPIC.md), a workspace whose root holds that file uses its text as the app_context for every session bound to it, in place of the handle's. A workspace without the file keeps the handle's. Off by default because it puts repository-supplied text into the system prompt — the same "the repository decides" exposure gh#199 closed for .mcp.json. Must be relative and stay inside the root (no ..). Read once, when the workspace is created.

bool entropic::ParsedConfig::concurrent_sessions

gh#158 (v2.13.0): may DIFFERENT session keys run together?

ON by default since the audit that decision #66 records was completed: every piece of per-handle mutable state a turn touches is now per-run or locked. The flag shipped false in the first half of gh#158 precisely because that audit was outstanding — a racy default is worse than honest serialization — so turning it on is the audit's conclusion, not a change of mind about the risk. It stays as a KILL SWITCH, not as an opt-in. Set concurrent_sessions: false to restore v2.12.0 semantics exactly: a second run on ANY key returns ENTROPIC_ERROR_ALREADY_RUNNING and the handle serializes every turn. That is the escape hatch for a consumer who hits a concurrency defect in the field and needs a one-line configuration change rather than a version pin. With it on (the default), only a second run on the SAME key is refused — that one is a genuine conflict, because the two runs share one conversation. YAML: concurrent_sessions: false.

bool entropic::ParsedConfig::inject_model_context

Auto-inject model context into system prompt.

int entropic::ParsedConfig::vram_reserve_mb

Reserved VRAM headroom (MB, 0–65536)

std::filesystem::path entropic::ParsedConfig::config_dir

Config dir — base for bundled data discovery.

std::filesystem::path entropic::ParsedConfig::log_dir

Session log directory (session.log + session_model.log).

When non-empty, the facade creates a SessionLogger on configure.

bool entropic::ParsedConfig::ggml_logging

Enable ggml/llama.cpp logging to llama_ggml.log in log_dir.

Default false — when off, ggml/llama output is silenced entirely.

std::filesystem::path entropic::ParsedConfig::llama_log_path

Override path for ggml/llama log when ggml_logging == true (gh#23 MVP item 12, v2.3.24).

When non-empty, the orchestrator installs llama_log_set against this exact path. When empty (default), keeps the pre-v2.3.24 hardcoded <log_dir>/llama_ggml.log — bit-identical for callers not opting in. Accepts absolute or relative paths; relative paths resolve from the process CWD (not log_dir).

bool entropic::ParsedConfig::console_logging

Emit engine spdlog output to the stderr console sink.

Default true (operators reading stderr see everything). TUI consumers that paint to fd 2 must set this false so engine log lines don't corrupt the screen — with it off, logs route to the per-handle session.log file sink only. (gh#59 follow-up, v2.3.7)

ConstitutionalValidationConfig entropic::ParsedConfig::constitutional_validation

Constitutional validation pipeline settings.

InferenceConfig entropic::ParsedConfig::inference

Inference-side knobs (currently speculative decoding only).

entropic::PermissionsConfig

Tool permission configuration.

std::vector<std::string> entropic::PermissionsConfig::allow

Allowed tool patterns (glob)

std::vector<std::string> entropic::PermissionsConfig::deny

Denied tool patterns (glob)

bool entropic::PermissionsConfig::auto_approve

Skip confirmation prompts.

entropic::PhaseConfig

Inference parameters for a single identity phase.

float entropic::PhaseConfig::temperature

Sampling temperature.

int entropic::PhaseConfig::max_output_tokens

Max tokens per generation.

bool entropic::PhaseConfig::enable_thinking

Enable think-block output.

float entropic::PhaseConfig::repeat_penalty

Repetition penalty.

std::optional<std::vector<std::string> > entropic::PhaseConfig::bash_commands

Phase-specific bash commands.

entropic::PromptCacheConfig

Prompt caching configuration.

size_t entropic::PromptCacheConfig::max_bytes

Maximum cache RAM (512 MB default)

bool entropic::PromptCacheConfig::enabled

Master switch (false = no caching)

bool entropic::PromptCacheConfig::log_hits

Log cache hit/miss at INFO level.

bool entropic::PromptCacheConfig::warm_keep

gh#96 (v2.7.5): keep the prior turn's KV resident and re-decode only the appended delta (warm-keep / incremental prefill) instead of re-decoding the whole post-system history every turn.

Default on; the oracle-equality tests toggle it off as the ground-truth comparison.

entropic::ReconnectConfig

Reconnection policy configuration for external MCP servers.

uint32_t entropic::ReconnectConfig::base_delay_ms

Initial retry delay.

uint32_t entropic::ReconnectConfig::max_delay_ms

Maximum retry delay cap.

uint32_t entropic::ReconnectConfig::max_retries

Max attempts (0 = infinite)

double entropic::ReconnectConfig::backoff_factor

Exponential backoff multiplier.

entropic::RoutingConfig

Configuration for model routing.

bool entropic::RoutingConfig::enabled

Enable routing.

std::string entropic::RoutingConfig::fallback_tier

Fallback when routing fails.

std::optional<std::string> entropic::RoutingConfig::classification_prompt

Custom prompt (nullopt = auto)

std::unordered_map<std::string, std::string> entropic::RoutingConfig::tier_map

Classification → tier mapping.

std::unordered_map<std::string, std::vector<std::string> > entropic::RoutingConfig::handoff_rules

Tier handoff rules.

entropic::SpeculativeConfig

Speculative-decoding configuration ( inference.speculative.

bool entropic::SpeculativeConfig::enabled

Master switch (off by default)

int entropic::SpeculativeConfig::n_draft

Window size (proposed tokens).

gh#108 (v2.9.2): 16 over-drafts the small MTP head — measured a NET slowdown on Q2 (0.53x @16 vs 1.39x @2) and 1.91x vs 2.34x on Q8; ~4 is the sweet spot (upstream MTP example uses 3).

bool entropic::SpeculativeConfig::mtp

gh#106 (v2.9.0): drive MTP (the draft is a trunk-sharing head via ctx_other) instead of the gh#36 separate-draft kernel.

draft.path points at the mtp-*.gguf head; target-owned, lossless.

ModelConfig entropic::SpeculativeConfig::draft

Full ModelConfig for the draft model.

Mirrors how tier configs are structured: every llama.cpp knob (gpu_layers, n_threads, n_batch, flash_attn, context_length, use_mlock, cache_type_k/v, tensor_split, ...) is consumer-tunable from YAML via inference.speculative.draft.<field>. path accepts a bundled-model registry key OR a literal filesystem path; resolved at config-parse time by BundledModels::resolve(). Defaults are kernel-aware — see make_default_draft_model_config().

entropic::StorageConfig

Storage backend configuration.

bool entropic::StorageConfig::enabled

Enable storage backend.

std::filesystem::path entropic::StorageConfig::db_path

SQLite database path (derived from config_dir)

size_t entropic::StorageConfig::log_max_file_size

Max log file size before rotation (10MB)

size_t entropic::StorageConfig::log_max_files

Max rotated log files to keep.

AuditLogConfig entropic::StorageConfig::audit_log

Audit log settings (v1.9.5)

entropic::TierConfig

Tier-specific model configuration.

Inherits from entropic::ModelConfig.

std::optional<std::filesystem::path> entropic::TierConfig::identity

Identity prompt path (nullopt = bundled)

bool entropic::TierConfig::identity_disabled

true if identity explicitly disabled

std::optional<std::filesystem::path> entropic::TierConfig::grammar

Grammar file path.

std::optional<std::string> entropic::TierConfig::auto_chain

Target tier name (nullopt = defer to identity)

std::optional<bool> entropic::TierConfig::routable

None = defer to identity frontmatter.

bool entropic::TierConfig::requires_context

gh#162 (v2.13.0): refuse a delegation to this tier that carries no context file references.

For a tier whose tool set cannot SEARCH — a reader with read_file and nothing else — a contextless task is structurally unanswerable, and the observed failure is the child inventing a path. The tool boundary refuses instead, so the lead gets an error it can fix in the same turn rather than a confident answer about a file that does not exist. YAML: models.tiers.<name>.requires_context: true.

std::optional<std::filesystem::path> entropic::TierConfig::adapter_path

Optional path to LoRA adapter .gguf file.

If set, orchestrator loads and activates on tier transition.

float entropic::TierConfig::adapter_scale

LoRA scaling factor (0.0–2.0, default 1.0).

std::vector<std::string> entropic::TierConfig::capabilities

Declared tier capabilities (gh#41).

Free-form lowercase strings — canonical values are "text" and "vision". Missing / empty in YAML resolves to {"text"} at config-load time so every pre-v2.1.8 tier config stays valid without modification. The orchestrator inspects this set when it sees a message with image content_parts; if no configured tier carries "vision", the run is rejected with ENTROPIC_ERROR_NO_VISION_TIER. Order is not significant. Duplicates are tolerated but idiomatic configs deduplicate.

std::optional<float> entropic::TierConfig::temperature

Per-tier sampler temperature from identity frontmatter (gh#82).

nullopt = not configured; the orchestrator leaves the incoming GenerationParams temperature in place. When set, applied as the tier baseline (an explicit per-call override still wins).

std::optional<int> entropic::TierConfig::max_output_tokens

Per-tier max output tokens from identity frontmatter (gh#82).

nullopt = not configured; same precedence as temperature.

std::optional<float> entropic::TierConfig::top_p

Per-tier sampler knobs from identity frontmatter (gh#85).

nullopt = not configured; applied as the tier baseline (an explicit per-call param override wins). Same precedence policy as temperature.

std::optional<int> entropic::TierConfig::top_k

gh#85

std::optional<float> entropic::TierConfig::min_p

gh#85

std::optional<float> entropic::TierConfig::presence_penalty

gh#85

std::optional<float> entropic::TierConfig::frequency_penalty

gh#85

std::optional<float> entropic::TierConfig::repeat_penalty

Per-tier repeat_penalty + enable_thinking from identity frontmatter (gh#86).

nullopt = not configured; same precedence as the other sampler knobs. enable_thinking flows to the GGUF chat template via GenerationParams.enable_thinking.

std::optional<bool> entropic::TierConfig::enable_thinking

gh#86

std::optional<std::string> entropic::TierConfig::tool_call_mode

Per-tier tool-call generation mode (gh#103).

nullopt = engine default ("batch"). "sequential" halts generation at the first closed tool call (the family close marker is appended to GenerationParams.stop) so a tier doing dependent tracing observes each result before the next call; "batch" keeps generating (parallel/independent calls preserved).

std::optional<bool> entropic::TierConfig::speculative_mtp

Per-tier MTP speculative-decode override (gh#108).

nullopt = inherit InferenceConfig::speculative.mtp (the global flag); when set, this tier's effective MTP-attempt decision regardless of the global value. Lets a consumer keep MTP on globally while opting a specific identity/model out (e.g. a grammar-heavy tier that should always run plain decode) rather than an all-or-nothing global switch.

std::optional<bool> entropic::TierConfig::require_tool_call

gh#134 (v2.10.4): require this tier to end every turn with a tool call.

nullopt/false = llama.cpp's COMMON_CHAT_TOOL_CHOICE_AUTO (the model may answer in prose); true = COMMON_CHAT_TOOL_CHOICE_REQUIRED, under which upstream sets grammar_lazy=false so the tool-call grammar binds from the FIRST sampled token — narrate-then-stop becomes structurally unrepresentable rather than corrected after the fact by the empty-turn nudge (which measured 0/12 recovery past the third nudge, gh#134). Opt-in per tier: front-office tiers legitimately answer in prose, so this must never be global. Inert unless the tier stages tools.

bool entropic::TierConfig::has_capability(const std::string &name) const

Return true if this tier declares the named capability.

Parameters
  • name — Lowercase capability name (e.g., "vision").
Returns
true if the capabilities vector contains name.

std::string entropic::TierConfig::get_param(const std::string &param_name) const

Get a named parameter derived from tier config fields.

Encapsulates policy mappings (e.g., auto_chain presence implies no explicit_completion). Keeps this logic on the data struct instead of in facade callbacks.

Parameters
  • param_name — Parameter name (e.g., "explicit_completion").
Returns
Value string, or empty if unknown.