# Agent Persona

How a session's persona is defined, rendered into the system prompt, and stored.

## Agent persona

Each session carries its own persona, stored in the `session` row rather than a file:

| Field | Notes |
|---|---|
| `name` | Display name. Since v1.0.11 it is no longer backfilled with the session ID when left blank — a blank, session-ID-shaped, `tg-` or `dc-` name counts as auto-named and is replaced the first time a title is generated |
| `self_id` | Normalized to lowercase, up to 32 ASCII letters, digits, `_` or `-`; non-empty values must be unique across sessions (a duplicate returns 409); the lookup key for the `subagents` `self_id` parameter |
| `role` | Persona body, rendered into the system prompt's `## Bot Persona` block on each turn. Since v1.0.11 the operating identity named in that block is `self_id`, not `name`. Renamed from `rule` in v1.1.0: `GET` returns both `role` and `rule`, and `POST` still accepts `rule` (it wins when both are sent) |
| `model` / `reasoning` | Session model and reasoning level; `model: ""` resets to `auto`. Since v1.1.0 `reasoning` also accepts `auto`, which takes the level from the dispatcher's work-kind pick each turn and replaces the removed global `auto_reasoning` switch |

Edit `name`, `self_id` and the persona from the TUI with `/session` (`/session name|id|role`; `/bot` was folded into it in v1.0.22), or through `GET` / `POST` `/v1/session/:id` — one endpoint for the whole session object, with `POST` as a partial update.

## Where the persona is stored

Session configuration lives in the `session` table of `~/.config/agenvoy/.store/history.db`, not in per-session files: `name`, `self_id`, `model` (`auto` by default), `reasoning` (a level, or `auto` since v1.1.0), `role` (the persona body; renamed from `rule` in v1.1.0 — the old `rule` column is kept, written alongside and read as a fallback), plus the chat binding (`chat_id`, `guild_id`, `channel_id`, `user_id`). `self_id` is normalized to lowercase and accepts up to 32 ASCII letters, digits, `_`, or `-`; non-empty values must be unique.

The persona body is rendered into the system prompt's `## Bot Persona` block on every turn, which names `self_id` as the operating identity since v1.0.11. Edit it from the TUI with `/session role` (formerly `/bot`), or through `GET` / `POST` `/v1/session/:id`.

At daemon startup, legacy per-session `bot.json`, `bot.md`, `config.json`, `status.json`, `usage.log` and `summary.meta.json` are migrated into SQLite and are no longer written. The `state` table itself was dropped in v0.35.3 — a session's live state is now a ToriiDB online marker, not a stored row.
