# core/config — AGENTS.md

## Purpose

TOML configuration loading and live-reload: defines `CorrexConfig` (the top-level config shape), operator/project profiles, agent instructions, and read/write helpers.

## Ownership

CORREX kernel team. Config schema changes affect all consumers — coordinate with `apps/server` and `apps/cli`.

## Local Contracts

- `CorrexConfig` — top-level `@Serializable` config data class.
- `ConfigHolder` — mutable live config reference, updated on reload.
- `ConfigLoader` — reads TOML from disk; `CorrexConfigWriter` writes it back.
- `EditableConfig` — partial config for live patch operations (used by the TUI config editor).
- `OperatorProfile` — operator-level persona and behavior settings.
- `ProjectProfile` / `ProjectProfileLoader` / `ProjectProfileWriter` — project-scoped profile; loaded at session bind time.
- `AgentInstructions` / `AgentInstructionsLoader` — per-role prompt fragments loaded from config.

## Work Guidance

- Config is read from disk; it is not event-sourced. Do not add event/state/reducer structures here.
- `ConfigHolder` is the shared mutable reference injected into consumers. Never read the file directly in domain code — always go through `ConfigHolder`.
- `CorrexConfigWriter` regenerates TOML from the in-memory model; round-tripping loses comments by design.

## Verification

```bash
./gradlew :core:config:test --rerun-tasks
```

## Child DOX Index

No child AGENTS.md (leaf module).
