agent_manager.py (new): - AgentRecord dataclass: agent_id, level (1/2/3), role, task, status, started, parent_id (lineage), finished, result, notify, _task_ref - register() / finish() / cancel_agent() / list_agents() / get() / set_task_ref() - Calls notification.notify() on completion when notify=True (same channel as reminders and cron completions) - 24-hour pruning of completed records on each new registration spawn_agent (tools/agents.py): - background=True: fires asyncio.create_task(), registers in agent_manager, returns agent_id string immediately — sync path unchanged (no regression) - notify=True: push/Talk notification when the background task completes - Level enforcement: _agent_level param tracks hierarchy depth; when spawning from Level 2, child automatically gets spawn_agent + aider_run denied so Level 3 agents cannot delegate further New lifecycle tools (tools/agents.py + __init__.py): - agent_status(agent_id) — status, role, level, elapsed, task, result preview; user-level - agent_list(status, limit) — all agents for current user, newest first; user-level - agent_cancel(agent_id) — kills background task; admin-only, confirm-required tests/test_agent_manager.py (new, 41 tests): - agent_manager CRUD, pruning, notification hook - spawn_agent background: returns immediately, completes async, timeout, failure - Level enforcement: L1→L2 permits spawn, L2→L3 auto-denies; explicit tool_list path - agent_status / agent_list / agent_cancel output formatting - aider_run background: returns agent_id, completes async, sync path unchanged - All tests run without browser or Cortex service (~2.5s total) Run: cd cortex && .venv/bin/python -m pytest tests/test_agent_manager.py -v Docs: ARCH__FUTURE.md §13 (full design), ROADMAP.md, TODO__Agents.md, MASTER.md, HELP.md (orchestrator description corrected, tool schema line updated to reflect keyword routing), CLAUDE.md tool count 66→69. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
80 lines
4.3 KiB
Markdown
80 lines
4.3 KiB
Markdown
# Cortex — Roadmap
|
|
|
|
> Phases and priorities. For active tasks see `TODO__Agents.md`.
|
|
> Last updated: 2026-05-09
|
|
|
|
---
|
|
|
|
## Phase 0 — Foundation ✅
|
|
- Syncthing fleet sync (`agents_sync/`) operational
|
|
- MCP tools (`ae_*`) available in all Claude Code sessions
|
|
- Fleet agents running independently on each machine
|
|
|
|
## Phase 1 — Dispatcher Core ✅
|
|
- FastAPI service with streaming SSE responses
|
|
- Claude CLI and Gemini CLI subprocess backends
|
|
- Session context management (rolling window, file persistence)
|
|
- Nextcloud Talk bot (HMAC-signed webhook)
|
|
- Memory distiller (APScheduler — short/mid/long cycles)
|
|
- Local web UI (single-page, mobile-responsive)
|
|
- Auth status monitoring (`/auth/status`, UI banner)
|
|
- Session logging and file browser
|
|
|
|
## Phase 2 — Identity & Multi-User ✅
|
|
- Inara persona formalized (`IDENTITY.md`, `SOUL.md`, `PROTOCOLS.md`, context tiers)
|
|
- Two-level user/persona layout (`home/{user}/persona/{name}/`)
|
|
- Session auth: bcrypt passwords, JWT cookies, invite tokens, Google OAuth
|
|
- Multi-user live: Scott, Holly, Brian
|
|
- Per-user channel config (`channels.json`)
|
|
- Per-user Gemini API key (settings UI)
|
|
- Help & Reference system (shared base + per-persona additions)
|
|
- Lucide icons, persona picker page, session persistence across navigation
|
|
|
|
## Phase 3 — Intelligence Layer (In Progress)
|
|
- ✅ Gemini API orchestrator (tool loop → Claude responder)
|
|
- ✅ Tool suite: web search, AE Journal read/write, tasks, scratch, reminders, cron, system, email_send (+ per-user allowlist), nc_talk_send
|
|
- ✅ Agent mode in UI (async job, poll for result); role-based tool access + confirmation gate
|
|
- ✅ Local LLM backend (Open WebUI/Ollama, per-user multi-model config); inline model edit in registry UI
|
|
- ✅ Proactive cron (`message` / `brief` job types → NC Talk)
|
|
- ✅ Session search (full-text across past session logs)
|
|
- ✅ Distill notifications (NC Talk after mid/long runs)
|
|
- ✅ Local backend for distillation (DISTILL_BACKEND_MID/LONG in .env)
|
|
- ✅ Local orchestrator — OpenAI-compatible ReAct loop; fires when orchestrator role → local model
|
|
- ✅ Web push notifications — VAPID; `web_push` tool; PWA-installable; subscribe via ☰ menu
|
|
- ✅ Proactive notifications — daily reminder check (09:00); `notify()` routes to any configured channel; dedicated settings page
|
|
- ✅ Sub-agent spawning — `spawn_agent` tool; per-host concurrency limit; Gemini API + local OpenAI backends
|
|
- ✅ Web content extraction — `web_read` via trafilatura; strips ads/nav/boilerplate; 128K cap
|
|
- ✅ Session log reader — `session_read(date)` tool; complements `session_search`
|
|
- ✅ `http_post` — POST to external URLs with per-user URL prefix allowlist; admin-only, confirm-required
|
|
- ✅ `nc_talk_history` — read recent NC Talk messages; requires nc_username + nc_app_password in channels.json
|
|
- ✅ Local orchestrator retry — exponential backoff on 429/5xx/connection errors (3 attempts)
|
|
- ✅ Multi-level agent management — `agent_manager.py` (registry + lifecycle), background `spawn_agent`, `agent_status`/`agent_list`/`agent_cancel` tools, 3-level hierarchy enforcement (see `ARCH__FUTURE.md` §13)
|
|
- ✅ `aider_run` background mode — background task + push notification on completion; sync path unchanged
|
|
- [ ] Knowledge import — markdown → AE Journals (import script)
|
|
- [ ] Dev agent pipeline — specialist agents + supervisor + approval gate
|
|
- [ ] Gitea webhook integration + Actions CI
|
|
|
|
## Phase 4 — Channel Expansion
|
|
- ✅ Web UI
|
|
- ✅ Nextcloud Talk
|
|
- ✅ Google Chat
|
|
- [ ] WhatsApp (Business API or bridge — investigating)
|
|
- [ ] Webhook triggers from Aether platform events
|
|
|
|
## Phase 5 — Routing Intelligence & Scale
|
|
- [ ] Intelligent model routing (by task type, privacy, context length)
|
|
- [ ] Agent-to-agent task delegation across fleet
|
|
|
|
## Phase 6 — Infrastructure
|
|
- [ ] Server DMZ finalized
|
|
- [ ] WireGuard for all Cortex-accessing devices
|
|
- [ ] Camera/IoT VLAN segmentation
|
|
|
|
---
|
|
|
|
## Deferred / Watching
|
|
- **Speculative decoding** — llama.cpp supports it (E4B + E2B draft ≈ 2x speed); Ollama does not yet
|
|
- **RAG via Open WebUI** — feed Nextcloud docs into local knowledge collections; possible complement to AE Journals search
|
|
- **Multi-host local models** — per-user config already supports multiple hosts; routing logic TBD
|
|
- **WhatsApp** — requires Business API account or a bridge; not started
|