- Add `cmd_isslop_prune`, `cmd_isslop_clear`, `cmd_isslop_analyze` CLI commands for AI usage analysis job management - Register `/game` router with `index` and `farm` endpoints for Code Farm idle game - Add `politics` to allowed TOPICS constant replacing `signals` - Introduce `ISSLOP_DIR`, `ISSLOP_WORKSPACES_DIR`, `ISSLOP_RUNS_DIR`, `ISSLOP_MEDIA_DIR` config paths - Add `clear_user_stars` and `clear_user_projects_cache` calls on vote and project create/delete - Update `make prod` to use `nproc` workers via `DEVPLACE_WEB_WORKERS` env var - Convert `database.py` and `utils.py` to packages for modular structure - Add `devplace apikey` and `devplace token` CLI subcommands for API key and access token management
46 lines
3.3 KiB
HTML
46 lines
3.3 KiB
HTML
<div class="docs-content" data-render>
|
|
# Data and persistence
|
|
|
|
Devii's durable state lives in the main DevPlace SQLite database, every table scoped by owner. See
|
|
also [Architecture and sessions](/docs/devii-architecture.html) and [Tools and scopes](/docs/devii-tools.html).
|
|
|
|
## Tables
|
|
|
|
| Table | Scope | Purpose |
|
|
|---|---|---|
|
|
| `devii_conversations` | `(owner_kind, owner_id)` | The full message list (JSON) per owner. Upserted after each turn for **users only**; loaded back on reconnect so a conversation survives reloads and restarts. |
|
|
| `devii_usage_ledger` | `(owner_kind, owner_id, created_at)` | One row per turn: token counts, `cost_usd`, model. The **authoritative source** for the rolling 24h spend cap. |
|
|
| `devii_turns` | `(owner_kind, owner_id, started_at)` | Per-turn audit: truncated prompt and reply, iterations, tool-call count, cost, error. |
|
|
| `devii_tasks` | `(owner_kind, owner_id)` | Autonomous tasks and reminders (schedule, status, next run, plus a `notify` flag and captured `tz`). Owner-scoped. A signed-in user's rows are run by the lock-owner service, so reminders survive restarts. |
|
|
| `devii_lessons` | `(owner_kind, owner_id)` | The self-learning memory: observation, conclusion, next action, tags. BM25-searched, owner-isolated. |
|
|
| `devii_behavior` | `(owner_kind, owner_id)` | One row per owner: the persistent `# TRUTH RULES AND BEHAVIOR` system-prompt section Devii self-configures via `update_behavior`. |
|
|
| `devii_virtual_tools` | `(owner_kind, owner_id)` | The user-defined tools (name, description, stored prompt, input hint, enabled) added to Devii's tool list per owner. |
|
|
| `email_accounts` | `(owner_kind, owner_id, label)` | IMAP/SMTP connection settings the `email_*` tools use, one row per named account. Soft-deletable; the password is stored as written and never returned by a tool. Signed-in users only. |
|
|
|
|
Indexes for these are created idempotently in `database.init_db()`.
|
|
|
|
## Persistent vs ephemeral
|
|
|
|
- **Signed-in users:** conversations, tasks, lessons, self-configured behavior, and user-defined
|
|
tools persist in the main DB, survive restarts, and rehydrate on reconnect. A pending task or reminder is re-armed at boot by the
|
|
lock-owner service and fires even if the user never reopens Devii; a `notify` reminder then raises
|
|
a `reminder` notification and toast. The user's browser timezone is persisted to `users.timezone`
|
|
for correct wall-clock-to-UTC scheduling.
|
|
- **Guests:** tasks, lessons, behavior, and user-defined tools use a fresh **in-memory** database
|
|
per session, never written to disk; conversations are not persisted at all. State is gone when the guest session ends, so a
|
|
guest reminder runs only while that session stays connected and never sends a notification.
|
|
|
|
## Owner isolation
|
|
|
|
Every store filters reads and writes by the owner tuple. The lesson store is built per session over
|
|
the owner's scope, so one account's lessons are never visible to another - a hard isolation
|
|
boundary, see [Security and limits](/docs/devii-security.html).
|
|
|
|
## Display vs source of truth
|
|
|
|
The in-memory `CostTracker` shows a live per-session figure but resets on reboot; it is **not** used
|
|
for the cap. The 24h limit and all spend reporting read `devii_usage_ledger`, so the financial
|
|
ceiling is correct across restarts and matches the admin analytics endpoint. The cap and pricing
|
|
themselves are set in [Configuration and CLI](/docs/devii-config.html).
|
|
</div>
|