Files
Jarvis/packages/Config/README.md
james.maesandClaude Opus 4.7 508cf924d0 docs(packages): per-package README files
Adds README.md to each of the 13 SPM packages (AgentCore, Bus, Config,
DevOverlay, Harness, Keychain, Logging, MCP, Memory, Replay, Shell, Vision,
Voice). Each covers purpose, key public types, deps, consumers, invariants
(pulled from CLAUDE.md + grep-gates + audit findings), test stack, and
notable files. Memory README explicitly marks the package functionally OFF
until vec0.dylib + Ollama models land.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 17:13:33 -05:00

46 lines
2.1 KiB
Markdown

# Config
Two-tier config snapshot model + JSON persistence. Trivial prefs go to `UserDefaults`; secrets go to `Keychain`; everything else lives here.
## Key public types
| Type | Purpose |
|------|---------|
| `LaunchSnapshot` | Read once at startup — provider selection, feature flags, logging level |
| `PerTurnSnapshot` | Read at every turn start — TTS, STT, AppleScript policy, confirmation policy, Ollama config |
| `ConfigStore` | The owning store (atomic snapshot reads + writes) |
| `ConfigLoader` | JSON read/write at `~/Library/Application Support/Jarvis/` |
| `SchemaMigrator` | Backward-compat migration on schema bump |
| `ProviderSelection` | `.anthropic` / `.ollama` toggle |
| `FeatureFlags` | Risky/in-development feature gates (no rebuild needed to flip) |
| `TTSConfig` / `STTConfig` / `OllamaConfig` | Per-subsystem tunables |
| `AppleScriptPolicy` | Per-target allowlist + confirmation requirements |
| `ConfirmationPolicy` | Per-tool confirmation rules |
## Depends on
`Keychain`, `Logging`. External: `swift-log`.
## Used by
`App/AppDelegate`, `packages/AgentCore` (orchestrator reads `PerTurnSnapshot`), `packages/Voice`, `packages/Memory`, `packages/Replay`.
## Key invariants / contracts
- **`LaunchSnapshot` is immutable per-process.** Writes go through `ConfigStore.update` and require a relaunch to apply (currently — could become live-reload later).
- **`PerTurnSnapshot` is read at the start of every turn.** Live-reload contract for everything except provider selection.
- **Secrets are NEVER written to JSON config.** API keys go to `Keychain` only.
- **Schema version on disk.** `SchemaMigrator` runs forward-only; downgrade is undefined.
## Tests
XCTest coverage for snapshot read/write round-trips, schema migration, default-value generation. No env-flag gates.
## Notable files
- `Sources/Config/ConfigStore.swift` — the owning store
- `Sources/Config/LaunchSnapshot.swift` — startup-only config
- `Sources/Config/PerTurnSnapshot.swift` — per-turn config
- `Sources/Config/SchemaMigrator.swift` — migration path
- `Sources/Config/ConfirmationPolicy.swift` — tool-confirmation rules