Skip to content

Configuration

Config is a single JSON object read from two files and merged per key, with project-local values winning:

  1. Global - ~/.config/polyglav/config.json (user-wide defaults, credentials).
  2. Local - .polyglav/config.json in the project path (project overrides).

Every process merges them in memory. The merge descends into nested objects, so a local nested object overrides only the keys it names and keeps the default (or global) values for the rest. Lists and scalars replace wholesale, they never merge. Nothing is distributed to folders. Writes default to the local file and hold only the keys you selected, so a save never re-writes the merged config. API keys live outside the config, in the global provider registry (~/.config/polyglav/providers.json), managed through /connect (see Models).

Stability

Config keys and the session format freeze at 1.0. Until then a deployment should still survive upgrades, so the rules going forward are:

  • An unknown key is stored as written and ignored, never fatal. A config written by a newer version still loads in an older one.
  • A removed key is ignored rather than fatal, and a removed tool or plugin leaves its keys inert.
  • The session format only grows. A new field is optional on read, and a removed field is ignored.
  • A rename, removal, or shape change is announced in CHANGELOG.md under the version that introduces it, together with its migration step, so the upgrade is a documented one-liner rather than a discovery.
  • At 1.0 the key set current at that point is frozen: later changes get the same announcement, and a key is not removed in a patch release.

Files written before the turn format (flat messages) and before the session-name rename are the documented exception: they are left untouched and no longer load.

# inspect in the REPL (alphabetical, key/value/source columns)
/config
# one key with its description and default
/config temperature
# every key with its default and description on an indented line
/config --verbose
# a value too long for the value column prints as an indented value/source block
# set a value (project-local, Git-like default)
/config temperature 0.3
# set a structured value
/config tools.deny ["run_command", "web_search"]
# set a single line in the global config
/config --global temperature 0.2
# remove a project-local value, falling back to global/default
/config unset temperature
# remove a value from the global config
/config --global unset temperature
# reload from disk
/config reload

The polyglav config CLI does the same headlessly and is fully scriptable:

polyglav config get max_tokens --show-origin     # one or more values + where they come from
polyglav config set max_tokens 0                 # project-local
polyglav config set max_tokens 0 --global        # global file
polyglav config unset max_tokens                 # remove from project-local

Deleting a project's .polyglav/config.json reverts it to the global and built-in defaults. To keep settings across local deletions, set them globally with --global (accepted by both the REPL /config and the CLI), e.g. /config --global model <provider>/<model>.

Schema

Key Default Description
access {"read_tools": [...]} Read-class permission keys (read, list, web, catalog, ask, delegate). Any key not listed is write-class, and unknown/new plugin keys default write (fail-closed). See modes.md
ask_min_question_chars 8 Minimum length of a kind='direction' ask question when it has no context and no options. A shorter question is rejected with an error so the model asks a self-contained question. 0 disables the guard
ask_policy (see below) Routing for the ask tool by kind (permission/direction)
auto_continue_max 2 Max continuation rounds per turn on truncation. 0 turns continuation off
base_url "https://api.ollama.com" Provider endpoint
clear_screen true Clear the screen before the REPL banner
compact_at 170000 Compaction limit. A value below 1 is a fraction of context_window (for example 0.85), a value above 1 is absolute tokens, and 1 is rejected as ambiguous. 0 disables the limit
compact_auto true Enable automatic compaction when the context approaches compact_at
compact_before 3 Rounds of headroom used to project the next context size before the limit
compact_keep 1 Rounds to keep when compacting the provider context
confirm_timeout 0 Seconds a REPL confirm/ask prompt waits for input before auto-denying (0 = wait forever). Applies at any depth
context_window 0 Context budget in tokens, used for relative compaction thresholds and display. It is not a hard model limit. 0 = unknown, so a relative compact_at is skipped. A model entry can carry its own value, and a provider that reports limit.context fills it automatically. Set it with /context window <tokens> or /models context <ref> <tokens>
cost.rates {} Cost model for metric records: USD per 1M tokens, keyed by provider/model, then provider, then default ({"input": .., "output": .., "cache_read": ..}). cache_read is a subset of the prompt tokens, and a 0 cache rate charges cached tokens at the input rate
delegate_depth 1 Maximum nested delegate siblings. 0 = unlimited. A sibling cannot spawn another until the user raises this. See modes.md
glyphs {} Glyph overrides by meaning (read, write, search, exec, ask, todo, call, delegate, enter, return, warning, question, default, spinner), or "ascii" for the ASCII preset. No runtime detection
grant_permission {} Optional narrowing of the mode-derived delegation ceiling. In write mode the mode itself grants write keys, in read mode grants are denied, and this key can only narrow the result (for example {"bash": "ask"}). See Permission authority
hide_confirm_input true Hide the typed input for the REPL [Y/n] tool confirm prompt (the answer is not echoed). Free-text ask answers stay visible
list_dir_max_entries 200 Cap entries list_dir returns (... (showing first N of M entries) appended). 0 = unlimited
markdown_streaming false Basic markdown-aware streaming
max_team_depth 2 Maximum nested team runs (a call stage that itself runs a team). 0 = unlimited. Cycles are refused regardless. See teams.md
max_tokens 8192 Output token cap sent to the provider. 0 = unset (provider default applies, e.g. Ollama caps at 2048). When left at the default and the model entry has a provider limit.output, that limit is used. An explicit global or local value wins
mcp.servers [] MCP client server definitions (owned by polyglav-core-mcp, see mcp.md)
mcp_server.allow_ask true When serving MCP, run ask-policy tools (deferred to the client) vs refuse them (owned by polyglav-core-mcp)
memory true Enable bounded memory summaries under .polyglav/memory/: role memory injected into sub-agent prompts, team/job memory into briefs, each refreshed after a run. false disables every scope
memory_max_chars 2000 Cap characters of a memory summary injected into a prompt or brief (... (truncated) appended). 0 = unlimited
memory_scopes {"role": true, "team": true, "job": true} Per-scope memory toggles, applied on top of memory
mode "read" Active agent mode: read (default, plan) or write (work). read adds the bookkeeping tools plan_write and todo. Any unknown value falls back to read with a warning. Switch the session with /mode <name> or persist with /config mode <value>. See modes.md
model "llama3.2" Model name or provider/model ref. The ref is the single source of truth: its prefix picks the provider, and a bare model uses base_url detection. /model <ref> stores the ref. A known ref must be approved (see Model refs and approval)
output_log false Write everything the REPL prints to a file, plain text (ANSI stripped), so a mis-rendered line can be inspected later. Spinner repaints are skipped. The config default is off, and onboarding defaults it on
output_log_ansi false Write the raw stream to the output log (ANSI colors and control characters kept) instead of plain text, for manual inspection
output_log_dir ".polyglav/output" Directory for the output log, relative to the worktree (or absolute). One file per session, named after it
plan {"dir": ".polyglav/plans"} Plan file directory, relative to the worktree or absolute. Plans are local by default and ignored by the .polyglav/* rule. See modes.md
plugins (bundled) Plugins to load. Empty = all discovered plugins load
project_instructions "AGENTS.md" Per-worktree instructions file auto-loaded into the system prompt (e.g. AGENTS.md, CLAUDE.md). "" disables. Absent files skipped, content capped at 20000 chars
query_refine false Auto-refine short web-search queries via a lightweight model call
query_refine_context 4 Recent-message context to inject into refinement
query_refine_min_words 3 Minimum query length before refinement applies
reasoning "auto" Request reasoning and control its token budget: false/"off" = none, true/"on"/"auto" = provider default, "low"/"medium"/"high" = explicit budget hint. Mapping is provider-specific (OpenAI reasoning_effort, Claude thinking.budget_tokens, Qwen enable_thinking)
report.webhook "" URL the bundled polyglav-core-webhook report connector POSTs a completed job run to (JSON). Empty = no out-of-band report. Plaintext http:// is refused for a non-loopback host. See jobs.md
report.webhook_secret "" Shared secret for the report connector. When set, the POST carries X-Polyglav-Timestamp and X-Polyglav-Signature: sha256=<hmac> over <timestamp>.<body>, so the receiver can authenticate the sender and reject a replay
search_results 10 Number of search results to fetch (owned by polyglav-core-web)
serve.allow_unauthenticated false Allow polyglav serve to bind a non-loopback host without a token. Only for a container published on loopback. See api.md
serve.token "" Bearer token required on every serve route except /health and /version (owned by polyglav-core-serve, also POLYGLAV_TOKEN and --token). A non-loopback bind without one refuses to start
show_version true Show the version in the REPL banner
stream_retries 2 Extra attempts (after the first) when a provider stream ends before a completion event without content
stream_retry_delay 0.5 Seconds to wait between stream retries
system_prompt "" The root instruction, injected for every front-end (REPL, run, serve) and composed with the active mode. Onboarding sets it later, and empty means no root persona
temperature 0.7 Sampling temperature
tool_calling true Enable OpenAI-compatible function calling
tool_max_result_chars 100000 Cap tool-result content returned to the model (... (truncated) appended). 0 = unlimited. With the default, the model sizes files via the file_read header and pages with offset/limit
tool_output_log true Append every tool result to <session>.tools.log and keep a summary and line-range ref on the part. false keeps inline output
tool_permission (see below) Category permission actions
tools.allow [] Name-level allowlist. Empty means no restriction
tools.deny [] Name-level deny list (takes precedence over allow)
verbosity "normal" Display preset: quiet, normal, or verbose
verbosity.footer "inherit" Footer detail: off, summary, full, or inherit
verbosity.output "inherit" Sub-run output scope: off, assistant, agent, all, or inherit. Default agent
verbosity.status "inherit" Live status time and approximate tokens: off, on, or inherit
verbosity.thinking "inherit" Reasoning scope: off, assistant, agent, all, or inherit. off hides the text but keeps the ✓ Thought marker
verbosity.tools "inherit" Tool detail: summary, full, or inherit. Legacy off maps to summary
word_streaming true Buffer REPL output to word boundaries so words render fully formed (no mid-word pauses). false streams character-by-character

The reasoning scopes are:

  • off - no reasoning output and no Thought line.
  • summary - a ✓ Thought <duration> line, with the reasoning text hidden. This is the normal default.
  • assistant - the top-level assistant only.
  • agent - the assistant plus every role-bearing sub-run at any depth. Role-less delegate siblings are excluded.
  • all - the assistant plus every sub-run, including role-less siblings.

The output scopes are off, assistant, agent, and all with the same role rules. off hides sub-run output but the run's final status line and footer still print.

verbosity.status controls the live elapsed time and approximate token count on sub-run lines. verbosity.tools controls tool detail, and full adds execution time and parameters. Every tool line shows its own result token estimate, and legacy off maps to summary. verbosity.footer controls the turn footer, which shows the caller's own total tokens as ✓ Done 1.2s (3,456 tokens). Context size stays in /status and /context, and each sub-agent reports its own tokens when it returns. /verbosity shows the effective values, defaults, and allowed options. /status and /context report context, input, output, thinking, and request token counts.

modes

There are two modes: read (default, described as plan) and write (described as work). read allows read-class permission keys plus the bookkeeping tools plan_write and todo, and denies every workspace write key. write leaves write keys to tool_permission. A mode may set a cap, a description, an instruction block, and a submitted-line color:

{
  "mode": "read",
  "modes": {
    "read": {
      "cap": "read",
      "description": "Assistance, chat, and planning tasks",
      "system_prompt": "You are in read mode, which is for assistant, chat, and planning tasks...",
      "color": "teal"
    },
    "write": {
      "cap": "write",
      "description": "Working tasks, tools, edits, commands, roles, and teams",
      "system_prompt": "You are in write mode, which is for working tasks, accessing tools, and creating and calling roles and teams...",
      "color": "orange"
    }
  },
  "plan": { "dir": ".polyglav/plans" },
  "access": {
    "read_tools": ["read", "list", "web", "catalog", "ask", "delegate"]
  }
}

cap is read or write and defaults from the mode name, so a custom mode named read is read-capped and any other name is write-capped. description is optional and shown by /modes --verbose. Access is classified by permission key. Any key not in access.read_tools is write-class, and an unknown key (a new plugin permission) defaults write, so read mode is fail-closed. The read cap is applied last, after grants and per-invocation resolvers, so a grant cannot widen past it. The mode instruction and system_prompt are injected as a system message, and the active mode is recorded on each turn. Switch the current session with /mode <name> and persist with /config mode <value>. An unknown mode falls back to read with a warning. Full detail in modes.md.

plan

{
  "plan": {
    "dir": ".polyglav/plans"
  }
}

plan.dir is the plan file directory, relative to the worktree or absolute. It is declared by polyglav-core-bookkeeping. The default is local and ignored by the .polyglav/* rule. Set it to a committed path, for example docs/plans, to keep plans in the repository. The todo state directory is fixed at .polyglav/todos/. plan_write and todo use the read permission key, so they are available in both modes and need no new permission. See modes.md.

tool_permission

{
  "ask": "allow",
  "bash": "ask",
  "call": "allow",
  "catalog": "allow",
  "delegate": "allow",
  "edit": "allow",
  "list": "allow",
  "mcp": "ask",
  "read": "allow",
  "vcs": "ask",
  "web": "allow"
}

Actions are allow (no prompt), ask (Y/n confirm), deny (tool hidden/refused). Read/write/list outside the worktree escalate to ask automatically. The call category gates the call tool. On top of the category action, a call resolves its permission from the target: a role uses its own callable action, a sequential team uses its stage callability, and a hierarchical team uses the manager's tool_permission.call action plus callable members. tool_permission.call gates initiating a call, while callable gates being called. A role not in the registry defaults to deny (see roles.md). The delegate category gates the read-class sibling. The ask category gates the ask tool (default allow, the interaction itself, answered by the user, see tools.md). The catalog category gates the catalog tool (default allow). It writes only to the project catalog in .polyglav/, so a team-composing agent can manage roles, teams, and skills without general file edits. Set it to ask to confirm every catalog change. The vcs category gates the git_commit tool (default ask): a role whose carve sets vcs: allow (an unattended committer, granted by its role) commits without a prompt, every other role confirms, and the broad staging form (all=true) always asks so an unattended commit never sweeps unrelated work. The never-push rule is unaffected, git_commit does not push, merge, checkout, or rewrite history.

ask_policy

Routes the ask tool by kind:

{
  "ask_policy": {
    "permission": "auto",
    "direction": ""
  }
}

permission is auto (ask the user) or deny (disable permission asks). direction always asks the user. A sub-agent inherits the root ReplUI as _ask_ui, so its asks reach the terminal.

  • permission - a sub-agent's request for a tool or write category it is not allowed to use (ask(kind="permission", permission="bash")). The user answers at the terminal. In read mode a request for a write key or for a category with declared write actions (for example catalog save) is redirected to a mode switch, since the action cannot take effect under the read cap (attended: the user is asked to switch, headless: the agent is told to use ask(kind="direction")). In write mode auto prompts the user, deny disables grants. A request above the mode-derived ceiling is always denied. The user may grant always (reusable for the rest of that sub-agent's run) or once. A user-routed ask offers Approve once / Approve always / Deny.
  • direction - a decision or scope change. It always asks the user. An explicit target is no longer part of the schema.

Permission authority

Every engine has two permission axes:

  • tool_permission - what the engine itself may use.
  • grant_permission - the ceiling on what it may hand down to sub-agents.

Both take permission keys, not tool categories: ask, bash, call, catalog, delegate, edit, list, mcp, read, vcs, web. A catalog save normalizes a category name (write -> edit, exec/shell/cmd -> bash, search -> web), rejects an unknown key with the valid list, and accepts an action of allow/ask/deny (true/false are accepted as allow/deny).

A sub-agent's effective permissions are the parent's tool_permission, narrowed by the role's tool_permission carve and capped by the mode-derived ceiling. The mode sets that ceiling: write makes write keys grantable, read denies them, and grant_permission (role or config) can only narrow the result. A role can never widen a category above the ceiling, so a sub-agent cannot gain a permission its caller was not authorized to delegate, and a sub-agent cannot escalate its mode past the caller's.

A role that sets grant_permission may delegate categories it does not use itself. For example, a supervisor with edit/bash denied for itself but allowed in its ceiling can hand them to an implementer while never running them, as long as the session is in write mode.

An approved permission request creates a one-shot grant on the asking sub-agent (once), consumed by the next matching call. The user may grant always, reusable for the rest of that sub-agent's run. Grants are never inherited by grandchildren and are recorded in the session permissions audit array.

exec_allow - command allowlist for run_command

exec_allow (list, default [], declared by polyglav-core-exec) restricts run_command to commands whose leading tokens match an allowed prefix. Empty or unset means unrestricted (the bash action applies to every command). When set:

  • Commands split into chained segments over the shell chaining operators. Every segment must start with an allowed prefix (e.g. pytest -q && ruff check . needs both pytest and ruff).
  • Matching is token-based, not textual. Each segment is tokenized and must begin with exactly the prefix tokens, so pytest does not admit pytestx and python does not admit python3. A multi-token prefix like python -m unittest matches only that module invocation.
  • Substitution and redirection are rejected outright: a command containing a backtick, $(, ${, > or < always returns deny, as do multi-line commands and any segment that fails tokenization (for example unbalanced quotes). Output redirection such as 2>&1 is therefore not available in allowlist mode.
  • A matching command falls through to the normal bash action (ask by default, allow/deny per config). A non-matching command is deny.

The check runs through the per-invocation policy resolver and a _config resolver argument, so it composes with modes, name-level tools.deny/tools.allow, and the worktree escalation. exec_allow is a guardrail that keeps a coding agent on tests, linters, and git, not a privilege boundary. Prefixes that execute what you point them at (python, sh, git -c, find -exec, xargs, tar) stay execution primitives, and only the sandboxed exec from the roadmap is a boundary. A resolver failure denies the call. See security.md for the control model.

Model registry (not config)

Two global files live separately from config in ~/.config/polyglav/. Neither is part of the config merge: /config never lists or writes them, and neither has a local scope.

Provider registry (providers.json)

~/.config/polyglav/providers.json (written 0600 when it holds keys) stores the active connections, keyed by provider name:

{
  "ollama": {
    "base_url": "https://custom.example/v1",
    "api_key": "...",
    "added_at": "...",
    "last_used": "..."
  }
}
  • api_key lives here, one per provider, and is the only place API keys live.
  • base_url is the effective base URL of the connection: the preset provider default (e.g. /connect ollama) or a custom URL (/connect <url>). The engine falls back to it when the config leaves base_url empty.
  • Managed through /connect (writes the key and any custom base URL). Re-running it re-enters a missing or stale key.
  • The engine resolves the active provider from the model ref and the provider entry. A manual openai-compatible entry in providers.json is the generic endpoint for a bare model or a custom OpenAI-compatible gateway. There is no api_key config key anymore, and polyglav config set api_key would store an unused ordinary value. Deleting a project config cannot lose the registry, which is global by design.

Model registry (models.json)

~/.config/polyglav/models.json is the history of approved models. Entries are {provider, model, added_at, last_used} with optional context_window and max_output limits and no API keys (those live in providers.json). It records every model you connect or switch to, so /models shows what has been used per provider with > marking the active one. The active model still comes from config.model.

  • /connect records the model for the connection it just saved.
  • /models shows approved models grouped by provider, the active one marked >, plus (key) when that provider has a stored key. Each entry carries ok_at (last successful run) and last_error (last failure), so /models marks a model (unused) when it never completed a run and (failed) when its last run errored.
  • /models list [provider] probes a provider's advertised models live (default: current provider).