pub struct Settings {Show 46 fields
pub version: u32,
pub thinking_level: ThinkingLevel,
pub theme: String,
pub glyph_set: GlyphSet,
pub default_model: Option<String>,
pub default_provider: Option<String>,
pub last_used_model: Option<String>,
pub last_used_provider: Option<String>,
pub max_tokens: Option<u32>,
pub temperature: Option<f32>,
pub default_temperature: Option<f64>,
pub max_response_tokens: Option<usize>,
pub session_history_size: usize,
pub session_dir: Option<PathBuf>,
pub extensions_enabled: bool,
pub auto_compaction: bool,
pub disabled_tools: Vec<String>,
pub tool_timeout_seconds: u64,
pub ask_timeout_secs: u64,
pub extensions: Vec<String>,
pub skills: Vec<String>,
pub prompts: Vec<String>,
pub themes: Vec<String>,
pub custom_providers: Vec<CustomProvider>,
pub dynamic_models: HashMap<String, Vec<String>>,
pub keybindings: HashMap<String, Vec<String>>,
pub edit_format: EditFormat,
pub todo_panel_enabled: bool,
pub agent_hub_enabled: bool,
pub snapcompact_enabled: bool,
pub mermaid_render_enabled: bool,
pub commit_tool_enabled: bool,
pub memory_enabled: bool,
pub memory_db_path: Option<PathBuf>,
pub mnemopi_engine: bool,
pub memory_backend: Option<String>,
pub memory_llm_extract: bool,
pub memory_llm_extract_model: String,
pub embedding_provider: String,
pub embedding_base_url: Option<String>,
pub embedding_api_key_env: String,
pub embedding_model: String,
pub ttsr_enabled: bool,
pub ttsr_interrupt_mode: String,
pub model_roles: HashMap<String, String>,
pub advisor: AdvisorSettings,
}Expand description
Application settings
Fields§
§version: u32Settings format version. Used for automatic migration.
thinking_level: ThinkingLevelThinking level for agent responses
theme: StringColor theme — resolved by Theme::by_name (e.g. “oxi_dark”, “nord”).
glyph_set: GlyphSetTerminal glyph set — controls every UI symbol (status markers, list cursors, box drawing, spinners, icons).
unicode (default): box-drawing + emoji, works on any UTF-8 terminal.
ascii: 7-bit fallback for serial consoles / CI logs.
nerd: Nerd Font private-use codepoints (needs a patched font).
default_model: Option<String>Deprecated: use last_used_model instead. Kept for serde backward compat.
default_provider: Option<String>Deprecated: use last_used_provider instead. Kept for serde backward compat.
last_used_model: Option<String>Model selected by the user (last used = current default). Set during onboarding and updated every time the user switches model.
last_used_provider: Option<String>Provider for the last used model.
max_tokens: Option<u32>Max tokens for responses
temperature: Option<f32>Temperature for generation (0.0–2.0)
default_temperature: Option<f64>Default temperature as f64 (higher precision, takes precedence over temperature)
max_response_tokens: Option<usize>Maximum tokens for generation (usize variant, takes precedence over max_tokens)
session_history_size: usizeSession history size (entries to keep in memory)
session_dir: Option<PathBuf>Directory for storing sessions (default: ~/.oxi/sessions)
extensions_enabled: boolWhether extensions are enabled
auto_compaction: boolWhether to auto-compact conversations that exceed context window
disabled_tools: Vec<String>Built-in tools to disable (by name, e.g. ["web_search", "github_search"]).
All tools are enabled by default; list tools here to turn them off.
tool_timeout_seconds: u64Timeout in seconds for tool execution
ask_timeout_secs: u64Ask overlay timeout in seconds. 0 = disabled (wait indefinitely). When timeout fires, auto-selects the recommended option (or first).
extensions: Vec<String>List of extension paths or npm package sources to load
skills: Vec<String>List of skill paths or npm package sources to load
prompts: Vec<String>List of prompt template paths to load
themes: Vec<String>List of theme paths to load
custom_providers: Vec<CustomProvider>Registered custom providers (loaded from [[custom_provider]] TOML sections).
dynamic_models: HashMap<String, Vec<String>>Cached model lists fetched from provider /models endpoints.
Key is the provider name, value is a list of model IDs.
Updated when API keys are entered in setup wizard or on demand.
keybindings: HashMap<String, Vec<String>>User-defined keybinding overrides.
Format: { "ActionName": ["Ctrl+x", "Alt+y"] }
Actions are matched case-insensitively to the Action enum in oxi-tui.
edit_format: EditFormatPer-channel output language for the TUI agent loop.
Maps a channel key (e.g. "response", "code_comment",
Edit format for the edit tool.
str_replace (default): traditional find-and-replace.
hashline: line-anchored patches with content-derived tags.
todo_panel_enabled: boolEnable the sticky todo panel in the TUI. Default: true.
agent_hub_enabled: boolEnable the Agent Hub overlay (Ctrl+h / /agents). Default: true.
snapcompact_enabled: boolEnable the Snapcompact PNG-frame compactor. Default: false (experimental).
mermaid_render_enabled: boolEnable Mermaid diagram rendering in markdown. Default: true.
commit_tool_enabled: boolEnable the Commit tool with optional LLM analysis. Default: false (opt-in, LLM cost).
memory_enabled: boolEnable session-spanning memory tools (retain/recall/reflect/edit). Default: false (opt-in).
memory_db_path: Option<PathBuf>Path to the SQLite memory database. Default: ~/.oxi/memory/<project>.db
when empty.
mnemopi_engine: boolUse the Mnemopi engine (FTS5 + vector recall) instead of the basic
SQLite LIKE-search backend. Requires memory_enabled = true.
Default: false (uses basic SqliteMemoryStore).
memory_backend: Option<String>Backend selector for the autonomous memory pipeline (omp
local-backend analog). None (default) disables the
pipeline; Some("local") enables per-session extraction
- cross-session consolidation.
memory_llm_extract: boolLLM fact extraction for memory_retain. When true, the
memory_retain tool is wrapped so each put(content, …)
call is sent through the configured model’s
structured-extraction prompt and the resulting atomic
facts are stored individually.
memory_llm_extract_model: StringModel pattern used for LLM fact extraction when
memory_llm_extract = true. Empty means “use the
session’s default model”.
embedding_provider: StringEmbedding provider for the Mnemopi engine. One of:
"none"(default) — recall runs in FTS5-only mode."remote"— OpenAI-compatible/v1/embeddings.
embedding_base_url: Option<String>Base URL for the remote embedding provider (no trailing slash).
embedding_api_key_env: StringEnv-var holding the remote-embedding API key (so the key
never lands in settings.toml). Default OPENAI_API_KEY.
embedding_model: StringLogical embedding model name. Recorded alongside stored embeddings for cache keying and diagnostics.
ttsr_enabled: boolEnable Time-Traveling Stream Rules (stream interrupt on rule violation). Default: false (opt-in, stable-first).
ttsr_interrupt_mode: StringTTSR interrupt mode. Default: “prose_only”.
model_roles: HashMap<String, String>Named model-role → model-pattern assignments (e.g. "commit" →
"anthropic/claude-haiku", "slow" → "pi/default").
Empty by default. Role names are open-ended: the 10 built-in roles
(default/smol/slow/vision/plan/designer/commit/title/
task/advisor) plus any user-defined role are accepted.
Resolution — including pi/<role> alias expansion with cycle
detection — is done by oxi_ai::RoleRegistry. The role-switching
layer (which role is active when) is wired separately.
advisor: AdvisorSettingsAdvisor subsystem settings. Default OFF (opt-in). Drives the
oxi_agent::advisor engine wired into AgentSession.
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn settings_dir() -> Result<PathBuf>
pub fn settings_dir() -> Result<PathBuf>
Get the global settings directory path (~/.oxi).
Sourcepub fn settings_toml_path() -> Result<PathBuf>
pub fn settings_toml_path() -> Result<PathBuf>
Get the global settings TOML file path (~/.oxi/settings.toml).
Sourcepub fn settings_json_path() -> Result<PathBuf>
pub fn settings_json_path() -> Result<PathBuf>
Get the global settings JSON file path (~/.oxi/settings.json).
Sourcepub fn settings_path() -> Result<PathBuf>
pub fn settings_path() -> Result<PathBuf>
Get the global settings file path (JSON takes priority).
Returns the path to the settings file that should be used. If both JSON and TOML exist, JSON is returned (takes priority). If only one exists, that path is returned. If neither exists, returns the JSON path by default.
Sourcepub fn settings_path_with_preference(prefer_json: bool) -> Result<PathBuf>
pub fn settings_path_with_preference(prefer_json: bool) -> Result<PathBuf>
Get the effective settings file path, preferring the specified format.
If prefer_json is true, checks JSON first; otherwise checks TOML first.
Returns the first existing file, or the preferred path if neither exists.
Sourcepub fn detect_format(path: &Path) -> SettingsFormat
pub fn detect_format(path: &Path) -> SettingsFormat
Detect the settings file format from its path.
Sourcepub fn find_project_settings(start_dir: &Path) -> Option<PathBuf>
pub fn find_project_settings(start_dir: &Path) -> Option<PathBuf>
Get the project-local settings file path.
Searches for .oxi/settings.json first, then .oxi/settings.toml.
Returns the first one found, or None if neither exists.
Sourcepub fn effective_session_dir(&self) -> Result<PathBuf>
pub fn effective_session_dir(&self) -> Result<PathBuf>
Resolve the effective session directory.
Priority: session_dir field → ~/.oxi/sessions.
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load settings, applying all layers:
- Built-in defaults
- Global
~/.oxi/settings.toml - Project
.oxi/settings.toml - Environment variable overrides
§Examples
use oxi_cli::Settings;
let settings = Settings::load().expect("Failed to load settings");
println!("Using model: {}", settings.effective_model(None));Sourcepub fn load_from(dir: &Path) -> Result<Self>
pub fn load_from(dir: &Path) -> Result<Self>
Load settings with an explicit working directory for project config discovery.
Always layers the global config from Self::settings_path() when it
exists. Use Settings::load_from_with to inject a custom global
path (e.g. for tests or portable mode).
Sourcepub fn load_from_with(
dir: &Path,
global_override: Option<&Path>,
) -> Result<Self>
pub fn load_from_with( dir: &Path, global_override: Option<&Path>, ) -> Result<Self>
Load settings with an explicit project directory and an optional global settings path override.
Layering order:
- Defaults
- Global config from
global_overrideifSome, else fromSelf::settings_path()if it exists. - Project config (
<dir>/.oxi/settings.{toml,json}). - Environment variable overrides.
- Migration.
- TUI language policy validation.
Passing global_override = None keeps the default behavior of
reading the user’s real ~/.oxi/settings.{toml,json}. Tests pass
Some(custom_path) or rely on the real path being absent to get
pure defaults. (The test suite uses Some(specific_path) semantics
by passing a temp path; passing None is also valid for “skip the
global layer entirely”.)
Sourcepub fn load_from_cwd() -> Result<Self>
pub fn load_from_cwd() -> Result<Self>
Convenience: load from current working directory.
Sourcepub fn apply_env(&mut self)
pub fn apply_env(&mut self)
Apply environment variable overrides in-place.
DEPRECATED: Environment variable overrides are being phased out in favor
of file-based configuration (~/.oxi/settings.toml). This method is
kept for CI/CD compatibility but should not be relied upon for local
development. Use oxi config set or oxi setup instead.
Supported variables (CI/CD only):
| Env var | Setting |
|---|---|
OXI_MODEL | default_model |
OXI_PROVIDER | default_provider |
OXI_THINKING | thinking_level |
OXI_THEME | theme |
OXI_MAX_TOKENS | max_tokens |
OXI_TEMPERATURE | default_temperature |
OXI_SESSION_DIR | session_dir |
OXI_EXTENSIONS_ENABLED | extensions_enabled |
OXI_AUTO_COMPACTION | auto_compaction |
OXI_TOOL_TIMEOUT | tool_timeout_seconds |
OXI_DISABLED_TOOLS | disabled_tools |
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build a Settings instance from only environment variables
(all other fields stay at defaults).
DEPRECATED: Returns defaults since env overrides are disabled.
Use Settings::load() to load from settings.toml instead.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Save settings to the global config file.
Uses the format of the existing file if present, otherwise saves as JSON. Preserves backward compatibility with existing TOML files.
Sourcepub fn save_to(&self, path: &Path) -> Result<()>
pub fn save_to(&self, path: &Path) -> Result<()>
Save settings to a specific path, using the format determined by the file extension.
Sourcepub fn save_project(&self, project_dir: &Path) -> Result<()>
pub fn save_project(&self, project_dir: &Path) -> Result<()>
Save settings to the project-local config file.
Uses the format of the existing file if present, otherwise saves as JSON.
Sourcepub fn serialize_for_format(
settings: &Settings,
format: SettingsFormat,
) -> Result<String>
pub fn serialize_for_format( settings: &Settings, format: SettingsFormat, ) -> Result<String>
Serialize settings to a string in the specified format.
Sourcepub fn parse_from_str(content: &str, format: SettingsFormat) -> Result<Settings>
pub fn parse_from_str(content: &str, format: SettingsFormat) -> Result<Settings>
Parse settings from a string in the specified format.
Sourcepub fn merge_cli(&mut self, model: Option<String>, provider: Option<String>)
pub fn merge_cli(&mut self, model: Option<String>, provider: Option<String>)
Merge with CLI arguments (CLI takes precedence).
§Arguments
model— CLI-specified model overrideprovider— CLI-specified provider override
Sourcepub fn effective_model(&self, cli_model: Option<&str>) -> Option<String>
pub fn effective_model(&self, cli_model: Option<&str>) -> Option<String>
Get the effective model ID (provider/model format). Returns None if no model is configured.
Sourcepub fn effective_provider(&self, cli_provider: Option<&str>) -> Option<String>
pub fn effective_provider(&self, cli_provider: Option<&str>) -> Option<String>
Get the effective provider. Returns None if no provider is configured.
Sourcepub fn effective_temperature(&self) -> Option<f64>
pub fn effective_temperature(&self) -> Option<f64>
Get the effective temperature, preferring default_temperature (f64)
over temperature (f32), falling back to None.
Sourcepub fn effective_max_tokens(&self) -> Option<usize>
pub fn effective_max_tokens(&self) -> Option<usize>
Get the effective max tokens, preferring max_response_tokens (usize)
over max_tokens (u32), falling back to None.
Sourcepub fn save_last_used(model_id: &str)
pub fn save_last_used(model_id: &str)
Save the last used model/provider and persist to disk.
Splits the model_id on first / to store provider and model separately.
Sourcepub fn save_theme(&mut self, name: &str) -> Result<()>
pub fn save_theme(&mut self, name: &str) -> Result<()>
Save the current theme to settings and persist to disk.
Sourcepub fn get_theme_name(&self) -> String
pub fn get_theme_name(&self) -> String
Get the theme name from settings, returning a default if not set.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Settings
impl<'de> Deserialize<'de> for Settings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnsafeUnpin for Settings
impl UnwindSafe for Settings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSendSync for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.