# Data Rules

These rules apply to the data layer.

## Scope Boundary

- Data layer owns shared runtime mechanics.
- Data layer must not encode workflow business decisions.
- Keep feature-specific logic inside workflow modules.

## Context and Settings Rules

- `WorkflowContext` is the single runtime context source.
- Standard paths come from context (`task_path`, `plan_path`, `module_path`).
- `load_settings()` must hard-fail when settings are missing.
- Module resolution must fail fast on unknown module names.

## Parsing Rules

- Frontmatter parsing and serialization must be stable and deterministic.
- Keep `modules` normalization strict (`all` cannot mix with specific modules).
- Never silently fall back on malformed module input.
- Preserve list semantics for list fields when updating frontmatter.

## Agent SDK Rules

- `call_agent(...)` is the only shared entry point for provider calls.
- Provider allowlist remains explicit (`claude`, `gemini`, `codex`).
- Unknown provider values must raise hard errors.
- Provider calls must use bounded timeouts and hard-fail on timeout.
- Subprocess providers must hard-fail on non-zero exit codes.

## Logging Rules

- Logs are per `work_folder`.
- Keep `trace.log` usable for real-time tailing.
- Keep `raw.log` complete for debugging.
- Concurrent entries must remain correlatable by call identity.
