Repository navigation
Description
Summary
Feature-research ring 2 (2026-10-06, validated against code: no config-file loading exists today — tole is purely flag/env driven). When tole runs inside a directory with .tole/config.toml, load defaults from it. Design settled by a grilling session on 2026-10-08 (decisions below supersede the original sketch).
Why
Every leading harness ships per-project config (Cline .clinerules, Claude settings, Gemini settings, goose config.yaml). Today a user must re-type --allow/--trust/--workspace per project. Fits tole's DNA: declarative defaults, no tool DSL (this configures the HARNESS, not tools).
Decisions (grilling 2026-10-08)
Trust model. A project config is untrusted input (it lives in a cloned repo and may carry allow, trust, hooks, mcp_server). All keys are allowed, but only after the directory's config is trusted (direnv-style, content-bound):
- Trust record lives OUTSIDE the repo:
$CODECORA_HOME/tole/trusted-configs.json(default~/.codecora, same root as skills/update-check), keyed by canonical directory path, storing a snapshot of the trusted file content; verification = byte comparison (no new crypto dependency). Config files are capped at ~64 KiB. - Config present but untrusted/changed: on a TTY (interactive CLI: run/chat/resume/mission) show the canonical path + full content (+ a diff vs the previously trusted version) and ask
trust this config? [y/N](default N, no "trust once" in v1); anywhere else (serve, acp, mcp, non-TTY, stdin used for the prompt) fail closed with an exact instruction (tole config trust). Escape hatches:--no-config(ignore the file) and--config <path>(a path named on the command line is user intent, hence trusted).
Precedence: flag > env > config > default (a deliberate deviation from the original sketch: env is the operator's decision for this session, config is the project default). List keys (allow, trust, mcp_server, hooks, skill): a higher layer replaces the whole list per key (same as --trust over TOLE_TRUST today). Boolean keys (plan_mode, no_auto_mcp, no_skills): flags can only turn things on; a config true is dropped only via --no-config or by editing the file.
Discovery: only <cwd>/.tole/config.toml (+ explicit --config <path>). No parent walk, no user-level layer in v1. Loaded by every command except config, upgrade and approvals (sessions_dir/workspace change where sessions/status/jobs/resume look).
Format: TOML via the toml crate in tole-cli only (tole-core stays platform-agnostic), #[serde(deny_unknown_fields)] so typos fail loudly. Flat snake_case keys mirroring the global flags (model, base_url, sessions_dir, workspace, plan_mode, memory, trust, allow, mcp_server, no_auto_mcp, on_pretool/on_posttool/on_turnend, skill, no_skills, system_prompt) + one [mission] table (max_steps, max_minutes, max_tokens, verify, verify_timeout). No version key in v1. Forbidden (hard error if present): api_key, serve_token and any secret.
Errors / paths: hard error (non-zero exit, file:line) for malformed TOML, unknown key, wrong type, secret key, unknown trust preset (same rule as the flag), file over the cap. Relative paths (sessions_dir, workspace, skill) resolve against the process cwd, like flags today.
Visibility: tole config check (validate + effective value per key with its source flag/env/config/default, secrets masked), tole config trust [--path] (shows diff vs the previously trusted version), tole config untrust; one stderr line tole: using config <path> whenever a config is loaded (stderr so ACP/serve stdout protocols are untouched).
Implementation notes: resolution is a pure function (like resolve_trust_flags / resolve_serve_url); flags with clap defaults become Option<T> (or use ArgMatches::value_source) so "given by the user" is distinguishable from the default; trust-store tests use a temp CODECORA_HOME serialized with a module-local mutex.
Staging: (1) load + validate + config check, nothing applied; (2) trust store, config trust/untrust, TTY prompt, fail-closed non-TTY, --no-config/--config; (3) apply precedence to all commands + README config section + CHANGELOG. --help and runtime behavior unchanged until PR 3.
Acceptance
- PR 1: loader, validation,
config check - PR 2: trust store + commands + prompt + fail-closed paths
- PR 3: precedence applied everywhere; flags/env still win; docs (README config section) + CHANGELOG same-PR
- Tests: pure precedence matrix; forbidden-secret and unknown-key errors; trust-store round trip, changed-content re-prompt, non-TTY refusal
Activity
feat(cli): load and validate .tole/config.toml via tole config check (#…
feat(cli): config trust store and tole config trust/untrust (#208, pa…
feat(cli): gate and apply low-risk project config keys at startup (#208…
feat(cli): apply security-sensitive project config keys (#208, part 3…
docs(changelog): consolidate the #208 config entries and note the --s…