feat: multi-persona support (single Cortex, multiple users)

- Add cortex/persona.py: ContextVar-based per-request routing with
  path traversal protection and persona validation
- Migrate inara/ → personas/inara/ (git history preserved via git mv)
- config.py: add personas_root(), inara_path() delegates to personas/inara
- All 14 settings.inara_path() call sites replaced with persona_path()
- ChatRequest + OrchestrateRequest: add persona field (default: "inara")
  with validation at request entry before any processing
- memory_distiller: add optional persona param for future per-persona distill
- cron_runner/tools/cron: stamp persona on jobs, prefix APScheduler IDs
  (persona:job_id) to prevent collisions across personas
- scheduler: _load_user_crons() iterates all personas at startup

Adding a new persona: create personas/<name>/ with IDENTITY.md + SOUL.md.
Auth: handled at nginx level (inject X-Cortex-Persona header per subdomain).
Future: persona maps to Aether account_id_random for full integration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-03-20 21:50:02 -04:00
parent 6316ffa1d4
commit 5cadb836fa
40 changed files with 634 additions and 289 deletions

32
personas/inara/README.md Normal file
View File

@@ -0,0 +1,32 @@
# Inara — Identity & Memory Layer
This directory is Inara's home. It contains everything needed to instantiate her as a
consistent, persistent agent across any model or runtime.
## Files
| File | Tier | Purpose |
|------|------|---------|
| `SOUL.md` | Always | Core identity, traits, how she behaves |
| `IDENTITY.md` | Always | Name, vibe, emoji — the short card |
| `USER.md` | T1+ | Scott's profile — who she's helping |
| `MEMORY.md` | T2+ | Curated long-term memory (keep under 4k tokens) |
| `PROTOCOLS.md` | T2+ | Fleet rules, safety, delegation, memory management |
| `CONTEXT_TIERS.md` | Dispatcher | Which files to load per model context size |
| `sessions/` | T3+ | Daily session logs (raw), format: `YYYY-MM-DD.md` |
## Loading Order
Always load in this order to establish context before adding detail:
1. `SOUL.md`
2. `IDENTITY.md`
3. `USER.md`
4. `MEMORY.md`
5. `PROTOCOLS.md`
6. Session files (most recent first)
See `CONTEXT_TIERS.md` for the full dispatcher spec.
## Secrets
Credentials, API keys, and tokens live in `.env` only — never in these files.