feat: audit log, usage tracking UI, OpenAI orchestrator compaction, onboarding + docs
Tool audit log:
- Every orchestrator tool call logged to home/{user}/tool_audit/YYYY-MM-DD.jsonl
- Files panel sidebar: audit log group (collapsed), date-linked read-only table
- Admin endpoints: /api/audit/files, /api/audit/day, /api/audit/recent, /api/audit/stats
- Engine and model name recorded per entry
OpenAI orchestrator improvements:
- Context budget enforcement: 75% of model context_k (min 16k)
- Message compaction: truncates old tool results when approaching budget
- max_rounds respected per model config (intersected with server cap)
OpenRouter onboarding (setup.html, onboarding.py, app.js, settings.html):
- Step 3 of 3: /setup/model with curated model picker
- Chat banner for users on server-default model (informational, not alarmist)
- Settings quick-link card; /setup/model works standalone for existing users
Model registry + session store:
- set_role_config / get_role_config for per-role tool lists and system_append
- session_store: session rename, session name backfill endpoint
UI updates (app.js, index.html, style.css, local_llm.html):
- Role toggle in context panel
- Off-the-record mode
- Agent notes read-only viewer
- OPERATIONS.md loaded at T2+ in context
Documentation:
- HELP.md: full tool table, per-role tool sets, Agent Notes, usage tracking
- TOOLS.md: Agent Notes section, count corrected to 44
- ARCH__SYSTEM.md, ARCH__BACKENDS.md, MASTER.md updated to match reality
- CLAUDE.md: onboarding flow, documentation philosophy sections
- README.md: stack in practice, DeepSeek TUI mention, architecture diagram updated
- TODO__Agents.md: onboarding task completed with deviation notes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
43
CLAUDE.md
43
CLAUDE.md
@@ -146,8 +146,8 @@ http://localhost:8000/docs
|
||||
- Tools are registered in `cortex/tools/__init__.py` as both Gemini FunctionDeclarations and Python callables
|
||||
|
||||
### Context / Memory
|
||||
- `context_loader.py` assembles Inara's system prompt from `inara/` files based on tier (1–3)
|
||||
- Tier 1 = minimal (identity only); Tier 2 = standard (+ memory + user profile); Tier 3 = full
|
||||
- `context_loader.py` assembles Inara's system prompt from `inara/` files based on tier (1–4)
|
||||
- Tier 1 = minimal (identity only); Tier 2 = standard (+ memory + user profile); Tier 3 = + last 2 sessions; Tier 4 = + last 7 sessions
|
||||
- Memory files are written by the distiller or manually — do not delete them
|
||||
|
||||
### Security / Safety
|
||||
@@ -160,6 +160,31 @@ http://localhost:8000/docs
|
||||
- Passwords are bcrypt-hashed and stored in `home/{username}/auth.json` — never in `.env` or the DB
|
||||
- Invite tokens are one-time-use, 72-hour expiry, stored in `home/{username}/invite.json`
|
||||
|
||||
### Onboarding Flow
|
||||
New users follow a three-step setup before reaching the chat:
|
||||
1. `GET /setup/{token}` → password form → `POST /setup/{token}` sets password + session cookie
|
||||
2. `GET /setup/persona` → persona creation form → `POST /setup/persona` bootstraps persona directory
|
||||
3. `GET /setup/model` → OpenRouter quick-connect → `POST /setup/model` saves host + model + role assignment
|
||||
|
||||
Step 3 is optional (skip link goes straight to `/{user}/{persona}`). `/setup/model` also works
|
||||
standalone (accessible from Settings) for existing users who haven't configured a model.
|
||||
|
||||
All in `cortex/routers/onboarding.py`. Model writes use `model_registry.py`: `save_host()`,
|
||||
`save_model()`, `set_role(username, "chat", "primary", model_id)`.
|
||||
|
||||
### Documentation Philosophy
|
||||
Cortex is a no-black-box system. Docs must match reality — at all times.
|
||||
|
||||
- **Docs first:** When planning significant changes, update `TODO__Agents.md` and the relevant
|
||||
`ARCH__*.md` to describe the intended design *before* implementing. This creates a spec to
|
||||
implement against.
|
||||
- **Verify after:** Once implementation is complete, re-read the pre-written docs and confirm
|
||||
they match what was actually built. Update anything that drifted.
|
||||
- **HELP.md is a user contract:** It describes what users can do. Never let it describe
|
||||
features that don't exist or omit features that do.
|
||||
- **CLAUDE.md + ARCH__*.md are the developer contract:** Update them as the architecture evolves.
|
||||
- **Stale docs are bugs.** If you notice drift, fix it before moving on.
|
||||
|
||||
---
|
||||
|
||||
## Adding a New Tool
|
||||
@@ -212,19 +237,23 @@ clearly asked for a directory to be unblocked.
|
||||
|
||||
---
|
||||
|
||||
## Current State (2026-04-28)
|
||||
## Current State (2026-05-06)
|
||||
|
||||
Cortex is running and stable. All channels are live:
|
||||
|
||||
| Channel | Status | Notes |
|
||||
|---|---|---|
|
||||
| Web UI | ✅ Live | `https://cortex.dgrzone.com` |
|
||||
| Web UI | ✅ Live | `https://cortex.dgrzone.com` — PWA-installable |
|
||||
| Nextcloud Talk | ✅ Live | HMAC-signed webhook, async reply |
|
||||
| Google Chat | ✅ Live | Workspace Add-on, `hostAppDataAction` response format |
|
||||
| Local backend | ✅ Live | Open WebUI/Ollama, per-user multi-model config |
|
||||
| Orchestrator | ✅ Live | Gemini API tool loop → Claude response; ⚡ toggle in UI |
|
||||
| Local backend | ✅ Live | Open WebUI/Ollama on scott_gaming, per-user multi-model config |
|
||||
| Gemini orchestrator | ✅ Live | Gemini API tool loop → Claude response; ⚡ toggle in UI |
|
||||
| Local orchestrator | ✅ Live | OpenAI-compatible ReAct loop; fires when orchestrator role → local model |
|
||||
| Tool audit log | ✅ Live | Every tool call logged to `home/{user}/tool_audit/YYYY-MM-DD.jsonl` |
|
||||
| Token usage tracking | ✅ Live | Per-user `home/{user}/usage.json`; summary in Settings |
|
||||
| Web push | ✅ Live | VAPID push notifications; `web_push` tool; subscribe via ☰ menu |
|
||||
|
||||
Active users: scott (inara, developer), holly (tina), brian (wintermute)
|
||||
Active users: scott (inara), holly (tina), brian (wintermute)
|
||||
|
||||
**40 orchestrator tools:** web_search, http_fetch,
|
||||
file_read/list/write, shell_exec, claude_allow_dir,
|
||||
|
||||
Reference in New Issue
Block a user