
# Runtime State

Rudel runtime state is DB-backed only.

The host WordPress MySQL database contains Rudel's metadata tables:

- `wp_rudel_environments`
- `wp_rudel_worktrees`

Those tables are the source of truth for sandbox identity, lifecycle metadata, worktree metadata, cleanup policy, and timestamps.

## Environment records

`wp_rudel_environments` stores:

- stable record ID
- public sandbox ID
- name and slug
- status
- path
- table prefix
- selected theme metadata
- lifecycle metadata
- clone metadata
- timestamps

## Worktree records

`wp_rudel_worktrees` stores linked worktree metadata for Git-backed theme directories.

Rudel does not infer runtime state from filesystem paths. Filesystem paths are artifacts that belong to the runtime records.

## Table naming

By default, Rudel table names derive from:

```text
{wordpress_db_prefix} + rudel_ + {table_name}
```

For a normal `wp_` installation:

```text
wp_rudel_environments
wp_rudel_worktrees
```

Advanced embedders can set `RUDEL_RUNTIME_TABLE_PREFIX` to change the Rudel portion while leaving the WordPress DB prefix untouched.

Explicit per-table constants win over the shared prefix:

```php
define( 'RUDEL_RUNTIME_TABLE_PREFIX', 'themefoo_' );
define( 'RUDEL_RUNTIME_TABLE_ENVIRONMENTS', 'custom_environments' );
```

These constants should be defined before first install/bootstrap when persisted records already matter.

## No alternate runtime store

Rudel does not use JSON as runtime config.

Rudel does not store its metadata in SQLite.

Sandbox site data lives in cloned WordPress tables in the same host MySQL database.
