Skip to content

Commit e08a3e1

Browse files
Catoclaude
andcommitted
feat: SwarmSync routing, context compaction, PTY sessions, MCP runtime, pipeline workers, Telegram bridge, desktop fixes
Core agent improvements: - SwarmSync routing enabled and verified (routes calls to best model via complexity score) - Context compaction: _maybe_compact() distils old turns at 2500 token/30 turn threshold keeping live window of 12 turns; distilled summaries injected into system prompt - /api/routing/status endpoint for live SwarmSync diagnostics - Model badge suppression for default model in ChatView New subsystems: - PTY session manager (cato/orchestrator/pty_session.py) + API routes - MCP runtime server (cato/mcp/runtime.py) with JSON-RPC tool dispatch - Pipeline workers + models + phase validation (cato/pipeline/) - Memory upkeep service (cato/core/memory_upkeep.py) - Telegram bridge (cato_telegram_bridge.py) + autostart installer Desktop app: - TerminalPane and InteractiveCLIView components - Updated Sidebar, ChatView, SettingsView, useChatStream hook - Tauri sidecar improvements (sidecar.rs, build.rs) - Build script improvements (build_release.ps1, pre_bundle.py) Tests (1661 passing, 100%): - test_compaction.py (19 tests): compaction trigger/no-op/storage/formatting - test_mcp_runtime.py, test_gateway_mcp.py, test_memory_upkeep.py - test_pty_session.py, test_pty_routes_integration.py - test_pipeline_runtime.py, test_router.py, test_start_channel.py - test_empire_cli.py, test_port_fallback_integration.py Docs: setup guides (Windows/macOS/Linux), audit pipeline, remote-MCP, TESTING GitHub Actions: python-verify.yml CI workflow Genesis_meta_agent.py: reference implementation for meta-agent design Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 73e0169 commit e08a3e1

87 files changed

Lines changed: 12500 additions & 417 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Python Verify
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
verify:
11+
runs-on: windows-latest
12+
steps:
13+
- name: Check out repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
21+
- name: Install package and test dependencies
22+
run: python -m pip install --upgrade pip && python -m pip install .[dev]
23+
24+
- name: Verify Python source and built wheel
25+
run: python scripts/verify_python_build.py

CLAUDE.md

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,111 @@ CODE COMPLETE
5858

5959
## PROJECT OVERVIEW
6060

61-
**Cato** — Privacy-focused AI agent daemon. Alternative to OpenClaw/ClawdBot.
62-
- Python 3.11+, asyncio, aiohttp, websockets
61+
**Cato** — Privacy-focused AI agent daemon. Alternative to OpenClaw/ClawdBot/MoltBot.
62+
- Package: `cato-daemon` v0.2.0, entry point `cato.cli:main`
63+
- Python 3.11+, asyncio, aiohttp, websockets, patchright, tiktoken, sentence-transformers
6364
- Tauri v2 desktop app (`desktop/`) — React 19 + TypeScript + Rust sidecar
64-
- SQLite memory, YAML config, AES-256-GCM vault
65-
- Ports: HTTP 8080, WS 8081 (canonical defaults)
66-
- Live install: `pip install -e .` at this directory
65+
- SQLite memory, YAML config, AES-256-GCM encrypted vault
66+
- **Ports: HTTP 8080, WS 8081** (canonical defaults)
67+
- Live install: `pip install -e .` at `C:\Users\Administrator\Desktop\Cato`
68+
69+
## DAEMON CONFIGURATION
70+
71+
- Config: `%APPDATA%\cato\config.yaml`
72+
- Default model: `openrouter/minimax/minimax-m2.5`
73+
- **workspace_dir**: defaults to `%APPDATA%\cato\workspace` on Windows, `~/.cato/workspace` on macOS/Linux (critical for identity files)
74+
- **swarmsync_enabled: true** — SwarmSync routing is enabled; routes calls to the best model based on complexity
75+
- Vault: `%APPDATA%\cato\vault.enc` — stores `OPENROUTER_API_KEY`, `TELEGRAM_BOT_TOKEN`, `SWARMSYNC_API_KEY`
76+
- Vault password: `CATO_VAULT_PASSWORD=mypassword123` (**example only — always choose a unique, strong password in real installs**)
77+
- Run daemon: `CATO_VAULT_PASSWORD=<your-strong-password> python cato_svc_runner.py`
78+
- Health check: `curl http://localhost:8080/health`
79+
80+
## TELEGRAM INTEGRATION (2026-03-09)
81+
82+
- **Status**: ENABLED and bidirectional
83+
- **Bot token**: Stored in encrypted vault as `TELEGRAM_BOT_TOKEN` (NOT in config.yaml)
84+
- config.yaml has `telegram_bot_token: ''` and `telegram_enabled: 'true'`
85+
- Messages flow: Telegram → TelegramAdapter → gateway.ingest() → WebSocket broadcast → desktop app
86+
- Responses flow: Agent loop → gateway.send() → WebSocket (desktop) + Telegram adapter (phone)
87+
- Desktop app: `useChatStream.ts` handles `type: "message"` for incoming Telegram user messages
88+
- Gateway: Both `ingest()` and `send()` broadcast telegram/whatsapp channels to WebSocket clients
6789

6890
## KEY DIRECTORIES
6991

7092
```
7193
cato/ Python daemon source
7294
api/ aiohttp web + WebSocket handlers
7395
orchestrator/ Multi-model CLI fan-out (Claude/Codex/Gemini/Cursor)
74-
audit/ Hash-chained audit log
96+
cli_invoker.py Claude/Codex/Gemini/Cursor invocation with timeouts
97+
cli_process_pool.py Warm pool for Claude/Codex
98+
audit/ Hash-chained audit log (PACKAGE)
99+
auth/ Token store + checker
75100
core/ Memory, context, scheduling
76-
ui/ Web UI (coding_agent.html)
101+
memory.py MemorySystem
102+
context_builder.py ContextBuilder (loads SOUL.md, IDENTITY.md, SKILL.md)
103+
schedule_manager.py SchedulerDaemon
104+
ui/
105+
server.py aiohttp server, workspace_put/get endpoints, CORS middleware
106+
dashboard.html Web UI (monolithic SPA, ~1700 lines)
107+
adapters/
108+
telegram.py Telegram long-polling adapter
109+
cli.py Main Click CLI
110+
agent_loop.py Core agent loop + register_all_tools
111+
gateway.py Message routing hub — WebSocket broadcast + adapter delivery
112+
vault.py AES-256-GCM vault
113+
budget.py Hard spend caps
77114
desktop/ Tauri v2 desktop app
78115
src/ React/TypeScript frontend
116+
hooks/
117+
useChatStream.ts WebSocket hook — handles web + Telegram messages, 5s history poll
118+
views/
119+
ChatView.tsx Main chat interface
120+
SettingsView.tsx Settings tabs (general/memory/channels/scheduling/workspace)
79121
src-tauri/ Rust sidecar
80-
tests/ pytest test suite (1285+ tests, must stay 100%)
122+
target/release/ cato-desktop.exe (17MB release build)
123+
tests/ pytest test suite (1346+ tests, must stay 100%)
81124
```
82125

126+
## DESKTOP APP DETAILS
127+
128+
- Built: `desktop/src-tauri/target/release/cato-desktop.exe`
129+
- Desktop shortcut: `C:\Users\Administrator\Desktop\Cato.lnk` → points to exe above
130+
- Build script: `desktop/build_release.ps1`
131+
- Build env: MSVC 14.44.35207 + Windows SDK 10.0.26100.0
132+
- **Heartbeat timeout**: 45s (server sends every 30s)
133+
- **CORS**: `cors_middleware` in `cato/ui/server.py` adds `Access-Control-Allow-Origin: *`
134+
- Coding agent WS is on port 8080 (aiohttp), NOT 8081 (gateway)
135+
- Logo: `cato-logo.png` (transparent 1024×1024 PNG), 44×44px in sidebar
136+
137+
## SKILLS SYSTEM
138+
139+
- Skills directory: `~/.cato/skills/` (18+ skills: add-notion, coding-agent, daily-digest, etc.)
140+
- System prompt injection: `agent_loop.py` builds prompt with `skills_dir` parameter
141+
- SwarmSync routing is enabled (`swarmsync_enabled: true`) — routes each call to the best model
142+
- Workspace files (`SOUL.md`, `IDENTITY.md`, `AGENTS.md`, `TOOLS.md`) loaded from `workspace_dir`
143+
144+
## CODING AGENT STATUS
145+
146+
Fan-out to Claude/Codex/Gemini/Cursor in parallel (60s timeout each):
147+
- **Claude**: cli_process_pool (warm) — nested execution, blocked in production
148+
- **Codex**: cli_process_pool (warm) — works
149+
- **Gemini**: Subprocess only — hangs on Windows (stdin pipe detection issue)
150+
- **Cursor**: Subprocess only — most reliable on this system
151+
- All timeouts return degraded response with confidence 0.5
152+
153+
## WINDOWS-SPECIFIC NOTES
154+
155+
- npm CLIs (codex, gemini) are .CMD files; resolved via `shutil.which()` + `["cmd.exe", "/c", path]`
156+
- ANTHROPIC_API_KEY loaded from `.env` (python-dotenv); OpenRouter env key in `.env` is STALE — use vault
157+
- Cato is run as SEPARATE daemon — Claude CLI is NOT nested in production
158+
- PowerShell required for build scripts; bash available via Git Bash
159+
160+
## TEST INFRASTRUCTURE
161+
162+
- pytest asyncio_mode=auto, tests/ directory
163+
- Coverage via pytest-cov; `norecursedirs` excludes `.claude`, `BRAINSTORM`, `venv`
164+
- **1346/1346 tests passing** as of 2026-03-09
165+
83166
## AUDIT REPORT LOCATIONS
84167

85168
- Alex audit: `CATO_ALEX_AUDIT.md` (repo root)

0 commit comments

Comments
 (0)