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:
Scott Idem
2026-03-20 22:35:40 -04:00
parent 92a8f5d894
commit 77e770cdb2
51 changed files with 463 additions and 208 deletions

View File

@@ -0,0 +1,128 @@
# Session Log — 2026-03-05
### [23:42] `051d6908`
**Scott:** Please respond with some Markdown so we can make sure it renders.
**Inara:** # Markdown Rendering Test ✨
Here's a little showcase to confirm everything renders properly.
---
## Text Formatting
This is **bold**, this is *italic*, and this is ~~strikethrough~~. Inline `code` looks like this.
## Lists
**Unordered:**
- Cortex orchestration layer
- WireGuard mesh networking
- Self-hosted everything
**Ordered:**
1. Request
2. Acknowledge
3. Result
## Code Block
```python
def greet(name: str) -> str:
return f"Hello from Inara, {name}."
print(greet("Scott"))
```
## Table
| Agent ID | Machine | Role |
|--------------|---------------|-----------------------|
| `scott_lpt` | Main Laptop | General Manager |
| `scott_wks` | Workstation | Operations Commander |
| `scott_gaming` | Gaming Laptop | Local LLM / Ollama |
## Blockquote
> *"You can't take the sky from me."*
## Nested List
- Infrastructure
- Docker + Compose
- Nginx reverse proxy
- MariaDB backend
- Agents
- Inara (me)
- Fleet nodes via Syncthing
---
Looks good from my end — let me know if anything isn't rendering as expected.
### [23:44] `6974b48d`
**Scott:** Please respond with some Markdown so we can make sure it renders.
**Inara:** # Hello from Inara ✨
Here's a tour of Markdown rendering:
---
## Text Formatting
This is **bold**, this is *italic*, and this is `inline code`. You can also do ~~strikethrough~~.
---
## Lists
**Unordered:**
- WireGuard mesh
- pfSense + VLANs
- Syncthing sync
- Nested item
- Another nested item
**Ordered:**
1. Request
2. Acknowledge
3. Result
---
## Code Block
```python
def greet(name: str) -> str:
return f"Hello, {name}. Fancy meeting you here."
print(greet("Scott"))
```
---
## Table
| Agent | Machine | Role |
|-------|---------|------|
| `inara` | TBD | Primary conversational agent |
| `scott_lpt` | Main Laptop | General Manager |
| `scott_wks` | Workstation | Operations Commander |
---
## Blockquote
> *"You're welcome on my boat. God ain't."*
> — Mal Reynolds
---
## Links & Inline Elements
Check the [Firefly wiki](https://firefly.fandom.com) — not that you need it. The ship is called **Serenity**. The signal can't be stopped.
---
Looks like everything's rendering. We're good to go. 🚀