# State Internals `internal/state` owns safe workspace paths, atomic artifact writes, metadata, prior-snapshot lookup, and read-only inspection. Operators should use the [operations guide](../operations.md) for lifecycle and retention. ## Artifact Paths For each run, paths are grouped by artifact group and valid start date: | Artifact | Location | | --- | --- | | Module snapshot | `snapshots///modules..json` | | Metadata | `snapshots///metadata..json` | | Data package | `data-packages///data_package..yaml` | | Prompt preparation | `preflight///prompt_preparation..json` | | Prompt execution | `snapshots///prompt_execution..json` | | Raw generated text | `snapshots///generated_text_raw..json` | | Validated generated text | `snapshots///generated_text..json` | | Render context | `snapshots///render_context..json` | | Managed report | `reports///report..md` | | Notification | `notifications///distributor..json` | Batch notification records are `notifications/batches///distributor..json`. ## Metadata And Debug Storage New metadata is `weatherreporter.metadata.v2` and gains preparation and execution paths only after those artifacts are saved. Legacy V1 records remain readable; their historic preflight and generated-text-result fields are mapped to the corresponding preparation and execution views during inspection. New runs never write V1 records. `PromptDebugWriter` is separate from workspace state. An empty root disables it. An enabled absolute root is checked for safe directories and symlinks, then stores `preparation.json` and `execution.json` beneath `////`. Directories are `0700`; files are atomic `0600`. Normal state discovery does not read this root. Focused checks: ```sh go test ./internal/state ```