Init system: layered llm-log init files and init.d fragments #58

Open
opened 2026-09-07 03:14:17 +00:00 by nsaspy · 0 comments
Owner

Goal

Give llm-log an init-file system for local policy, detectors, hooks and machine-specific configuration without forcing everything into one generated Home Manager command line.

Design

Keep the canonical typed runtime config, but add layered initialization:

  1. built-in defaults;
  2. normal config TOML;
  3. default init file $XDG_CONFIG_HOME/llm-log/init.toml (fallback ~/.config/llm-log/init.toml) when present;
  4. lexically sorted $XDG_CONFIG_HOME/llm-log/init.d/*.toml fragments;
  5. repeatable explicit --init PATH files/directories;
  6. explicit CLI flags last.

Directories load regular *.toml files in stable lexical order. Missing implicit init paths are allowed. Missing explicit --init paths are errors. Unknown keys/types remain fail-closed.

Use cases

  • quantization anomaly detector thresholds;
  • OpenRouter observability/routing policy;
  • notification/event hooks;
  • per-machine provider policy;
  • optional expert-plane settings.

Invariants

  • deterministic merge order;
  • no arbitrary Python/shell evaluation as configuration;
  • secrets are not required in init files and must not enter Nix store output;
  • list/map merge behavior is documented and tested;
  • llm-log config dump or equivalent can show effective config and provenance without secret values.

Acceptance

  • implicit init.toml + init.d work standalone;
  • explicit --init works and errors when missing;
  • multiple fragments merge deterministically;
  • CLI still wins;
  • Home Manager can provision init fragments declaratively;
  • tests cover duplicate/conflicting keys and provenance of the winning value.
## Goal Give llm-log an init-file system for local policy, detectors, hooks and machine-specific configuration without forcing everything into one generated Home Manager command line. ## Design Keep the canonical typed runtime config, but add layered initialization: 1. built-in defaults; 2. normal config TOML; 3. default init file `$XDG_CONFIG_HOME/llm-log/init.toml` (fallback `~/.config/llm-log/init.toml`) when present; 4. lexically sorted `$XDG_CONFIG_HOME/llm-log/init.d/*.toml` fragments; 5. repeatable explicit `--init PATH` files/directories; 6. explicit CLI flags last. Directories load regular `*.toml` files in stable lexical order. Missing implicit init paths are allowed. Missing explicit `--init` paths are errors. Unknown keys/types remain fail-closed. ## Use cases - quantization anomaly detector thresholds; - OpenRouter observability/routing policy; - notification/event hooks; - per-machine provider policy; - optional expert-plane settings. ## Invariants - deterministic merge order; - no arbitrary Python/shell evaluation as configuration; - secrets are not required in init files and must not enter Nix store output; - list/map merge behavior is documented and tested; - `llm-log config dump` or equivalent can show effective config and provenance without secret values. ## Acceptance - implicit init.toml + init.d work standalone; - explicit --init works and errors when missing; - multiple fragments merge deterministically; - CLI still wins; - Home Manager can provision init fragments declaratively; - tests cover duplicate/conflicting keys and provenance of the winning value.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/llm-log#58
No description provided.