2 unstable releases

Uses new Rust 2024

new 0.1.0 Feb 16, 2026
0.0.1 Feb 15, 2026

#10 in #astrid

MIT/Apache

140KB
3.5K SLoC

Unified configuration system for the Astrid runtime.

This crate provides a single Config type that consolidates all configuration previously scattered across RuntimeConfig, SecurityPolicy, BudgetConfig, ServersConfig, GatewayConfig, and HooksConfig.

Usage

use astrid_config::Config;

// Load with full precedence chain (defaults → system → user → workspace → env).
let resolved = Config::load(Some(std::path::Path::new("."))).unwrap();
let config = resolved.config;
println!("Using model: {}", config.model.model);

Configuration Precedence

From highest to lowest priority:

  1. Workspace ({workspace}/.astrid/config.toml) — can only tighten security
  2. User (~/.astrid/config.toml)
  3. System (/etc/astrid/config.toml)
  4. Environment variables (ASTRID_*, ANTHROPIC_*) — fallback only
  5. Embedded defaults (defaults.toml compiled into binary)

Design

This crate has no dependencies on other internal astrid crates. It only depends on serde, toml, thiserror, tracing, and directories. Conversion from config types to domain types happens at the integration boundary (CLI startup, gateway init) via bridge modules.

Dependencies

~6–19MB
~139K SLoC