feat: multi-user/multi-persona support with two-level home directory layout
Restructures persona storage from a flat personas/{name}/ layout to
home/{username}/persona/{name}/, mirroring Linux home directories.
Changes:
- persona.py: two ContextVars (user + persona), Linux-style name validation,
set_context(), get_user(), get_persona(), validate(), list_users(),
list_user_personas(); persona_path() takes (username, name)
- config.py: replaces personas_dir with home_dir + home_root()
- git mv personas/inara → home/scott/persona/inara (history preserved)
- home/holly/persona/tina/: Holly's persona stub added
- cron_runner.py: all storage functions take (username, persona) params
- tools/cron.py: stamps user + persona on jobs; APScheduler IDs are
{user}:{persona}:{job_id} to prevent collisions across users
- memory_distiller.py: distill_short/mid/long take (username, persona);
added missing Path + settings imports
- scheduler.py: _load_user_crons() iterates home/*/persona/* (two-level)
- routers/chat.py, orchestrator.py: user field added; set_context() called
- tests/conftest.py: home_root fixture with two-level structure;
patches home_dir instead of personas_dir
- tests/test_persona.py: fully rewritten for two-level API
- tests/test_api_files.py: updated fixture name and path
- .env.default: documents HOME_DIR setting; scrubs stale API key
- CLAUDE.md, README.md: directory maps updated for new layout
All 80 tests pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
65
home/scott/persona/inara/CONTEXT_TIERS.md
Normal file
65
home/scott/persona/inara/CONTEXT_TIERS.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# CONTEXT_TIERS.md — Cortex Dispatcher Loading Spec
|
||||
|
||||
This file defines which Inara context files to inject into a session based on the target model's
|
||||
context window. The dispatcher reads this to decide what to prepend.
|
||||
|
||||
---
|
||||
|
||||
## Tier 1 — Minimal (~1,500 tokens)
|
||||
|
||||
**Target:** Local models with ~8k context or less (Qwen 8B small, etc.)
|
||||
|
||||
**Load:**
|
||||
- `SOUL.md`
|
||||
- `IDENTITY.md`
|
||||
- `USER.md` — first 30 lines only (identity + what he cares about)
|
||||
|
||||
**Notes:** Just enough for Inara to know who she is and who Scott is.
|
||||
|
||||
---
|
||||
|
||||
## Tier 2 — Standard (~5,000 tokens)
|
||||
|
||||
**Target:** Models with 16k–32k context (Haiku, Gemini Flash, Qwen 8B full)
|
||||
|
||||
**Load:**
|
||||
- `SOUL.md`
|
||||
- `IDENTITY.md`
|
||||
- `USER.md` — full
|
||||
- `MEMORY.md`
|
||||
- `PROTOCOLS.md`
|
||||
|
||||
**Notes:** Full operational context. Sufficient for most routine tasks and conversations.
|
||||
|
||||
---
|
||||
|
||||
## Tier 3 — Extended (~15,000 tokens)
|
||||
|
||||
**Target:** Models with 32k–128k context (Sonnet, Gemini Pro, Qwen 14B, Qwen 30B)
|
||||
|
||||
**Load:**
|
||||
- Everything in Tier 2
|
||||
- `~/agents_sync/aether/docs/FLEET_MANIFEST.md`
|
||||
- Most recent 2 session files from `sessions/`
|
||||
- Relevant project doc (e.g., `CORTEX.md`) if task is project-related
|
||||
|
||||
---
|
||||
|
||||
## Tier 4 — Full (50,000+ tokens)
|
||||
|
||||
**Target:** Frontier models with 200k+ context (Claude Opus/Sonnet, Gemini 2.5 Pro)
|
||||
|
||||
**Load:**
|
||||
- Everything in Tier 3
|
||||
- Last 5–7 session files
|
||||
- Full project docs as relevant
|
||||
- `~/agents_sync/aether/docs/api_v3.md` if task involves Aether API
|
||||
|
||||
---
|
||||
|
||||
## Hard Rules
|
||||
|
||||
- `SOUL.md` and `IDENTITY.md` are **always** loaded, regardless of tier.
|
||||
- **Never inject:** `.env` files, `TOOLS.md` (contains credentials), raw session logs older than 30 days.
|
||||
- **MEMORY.md must stay under 4,000 tokens** — enforce this during distillation.
|
||||
- When in doubt, use Tier 2. Over-loading small models degrades output quality.
|
||||
Reference in New Issue
Block a user