# Cathay-Agent **Repository Path**: luckylo99/Cathay-Agent ## Basic Information - **Project Name**: Cathay-Agent - **Description**: 基于Hermes构建的稳定个人AI代理,具备codex控制的安全边界、与提供者无关的模型路由、消息通道、以及Debian,Ubuntu。wsl2部署。 - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-15 - **Last Updated**: 2026-06-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: Agent ## README # Cathay Agent Stable personal AI agent runtime built on Hermes, with Cathay-controlled safety boundaries, provider-agnostic model routing, messaging channels, native Cathay capabilities, and Debian deployment. **Current stable release:** `cathay-v0.4.4-dependency-security` — Dependabot advisory triage, Cargo.toml RUSTSEC documentation, dependency security gate, and 1109 passing tests. **Baseline certifications:** - `cathay-v0.4.3-tui-real-parity` — real Hermes-like CLI/TUI with incremental stream renderer, keybindings, persistent history, slash commands, PTY interaction tests - `cathay-v0.4.2-hermes-cli-parity` — bare `cathay` enters interactive chat, slash commands, prompt_toolkit + rich - `cathay-v0.4.1-production-certification` — Full Harness Fusion with persistent approval store, Feishu security, and 1082 tests > Online production certification must be run manually via `python scripts/v041_online_cert_gate.py`. --- ## Table of Contents 1. [Quickstart — Pick Your Region](#quickstart--pick-your-region) 2. [System Requirements](#system-requirements) 3. [Install on Debian / Ubuntu](#install-on-debian--ubuntu) 4. [Install on WSL2 (Windows)](#install-on-wsl2-windows) 5. [Install on macOS](#install-on-macos) 6. [Install on Bare Windows](#install-on-bare-windows) 7. [Upgrade from a Previous Version](#upgrade-from-a-previous-version) 8. [Daily Usage](#daily-usage) 9. [Command Reference](#command-reference) 10. [Providers](#providers) 11. [Security](#security) 12. [What's In v0.4.x](#whats-in-v04x) 13. [License](#license) --- ## Quickstart — Pick Your Region Cathay Agent is hosted on both GitHub (primary) and Gitee (mirror for China). Choose the install command that matches your network location. ### Global (GitHub, primary) ```bash curl -fsSL https://raw.githubusercontent.com/luckyLo99/Cathay-Agent/main/scripts/install_cathay.sh | bash ``` ### China (Gitee mirror, recommended when GitHub is slow or blocked) ```bash curl -fsSL https://gitee.com/luckyLo99/Cathay-Agent/raw/main/scripts/install_cathay.sh | bash ``` If you do not have a Gitee mirror yet, you can force the GitHub installer to pull from a clone you already have on disk: ```bash # Clone via mirror first, then install locally git clone https://gitee.com/luckyLo99/Cathay-Agent.git /tmp/cathay bash /tmp/cathay/scripts/install_cathay.sh ``` ### Pin to a stable tag (production / CI) ```bash # Global CATHAY_REF=cathay-v0.4.4-dependency-security \ bash <(curl -fsSL https://raw.githubusercontent.com/luckyLo99/Cathay-Agent/main/scripts/install_cathay.sh) # China CATHAY_REF=cathay-v0.4.4-dependency-security \ bash <(curl -fsSL https://gitee.com/luckyLo99/Cathay-Agent/raw/main/scripts/install_cathay.sh) ``` If the inline shell above is blocked in your CI, do it in two steps: ```bash curl -fsSL https://raw.githubusercontent.com/luckyLo99/Cathay-Agent/main/scripts/install_cathay.sh -o /tmp/install_cathay.sh CATHAY_REF=cathay-v0.4.4-dependency-security bash /tmp/install_cathay.sh ``` > The installer auto-detects your OS, installs the apt packages Cathay needs, creates a `cathay` system user, builds a Python venv at `/opt/cathay-agent/.venv`, and writes three CLI wrappers (`cathay`, `cathay-run`, `cathay-doctor`) into `/usr/local/bin/`. systemd and nginx are configured when available, and skipped on hosts that do not have them. --- ## System Requirements | Item | Minimum | Recommended | |------|---------|-------------| | OS | Debian 12 / Ubuntu 22.04 / WSL2 (Ubuntu 22.04) / Windows 10+ / macOS 13+ | Ubuntu 24.04 | | Python | 3.11 | 3.12 | | Memory | 2 GB | 4 GB+ | | Disk | 1 GB | 2 GB | | GPU | Not required | - | | Outbound | HTTPS to one LLM provider (DeepSeek, SenseNova, OpenAI-compatible, …) | - | Model inference runs via external API providers; no GPU is required. ### Required OS Packages Cathay Agent is a Python application. On Debian / Ubuntu, the installer adds these packages for you: | Package | Why | |---------|-----| | `ca-certificates` | HTTPS verification for provider / bot calls | | `curl` | Installer + provider HTTP | | `git` | Pulling source / tags for upgrades | | `bash` | Installer shell | | `build-essential` | Compiling native wheels (cryptography, pynacl, …) | | `python3` + `python3-dev` | Python runtime + headers for native extensions | | `python3-pip` | pip bootstrapping | | `python3-venv` | venv creation (PEP 405) | | `python3.13` + `python3.13-venv` + `python3.13-dev` | Preferred interpreter on Debian 12+ / Ubuntu 24.04 | | `nginx` | Optional reverse proxy + WebSocket for bot channels | | `jq` | Installer JSON output for bots | If you prefer to install Cathay on a host that does not have sudo / apt (e.g. minimal container), make sure you have at least: ``` git python3 (>=3.11) python3-venv build-essential ca-certificates curl ``` ### Required Python Tooling The installer creates a venv at `/opt/cathay-agent/.venv` and installs the `.[server]` extra. You should not need to install anything Python globally, but if you do it manually: ```bash python3 -m venv .venv . .venv/bin/activate python -m pip install -U pip wheel setuptools pip install -e ".[server]" ``` ### Network Requirements | Endpoint | Purpose | |----------|---------| | `https://github.com/luckyLo99/Cathay-Agent` (or Gitee mirror) | Installer, upgrades | | One LLM provider base URL | e.g. `https://api.deepseek.com`, `https://api.sensenova.cn`, `https://api.openai.com` | | `https://open.feishu.cn` | Optional — Feishu bot | | `https://qyapi.weixin.qq.com` | Optional — WeCom bot | | `https://bots.qq.com` | Optional — QQBot | If you are behind a corporate proxy, export `HTTPS_PROXY` / `HTTP_PROXY` before running the installer. --- ## Install on Debian / Ubuntu Tested on Debian 12 / Debian 13.2 / Ubuntu 22.04 / Ubuntu 24.04. ```bash # 1. Become root (or use sudo everywhere below) sudo -i # 2. Refresh package index apt update # 3. Install base tools (the installer will do this too, but doing it # up-front makes a re-run idempotent) apt install -y ca-certificates curl git bash # 4. Run the installer curl -fsSL https://raw.githubusercontent.com/luckyLo99/Cathay-Agent/main/scripts/install_cathay.sh | bash # 5. Edit your provider keys sudo nano /etc/cathay-agent/cathay.env # 6. Activate the CLI cathay doctor ``` For a production Debian server, also install `systemd` (already default on Debian 12+) and `nginx`: ```bash apt install -y systemd nginx systemctl enable --now nginx ``` --- ## Install on WSL2 (Windows) WSL2 is the recommended way to run Cathay on Windows. ```powershell # PowerShell: install WSL2 with Ubuntu wsl --install -d Ubuntu-24.04 ``` Inside the Ubuntu shell: ```bash # 1. Update WSL Ubuntu sudo apt update && sudo apt upgrade -y # 2. Install base tools sudo apt install -y ca-certificates curl git bash build-essential python3 python3-pip python3-venv python3-dev nginx # 3. Run the installer curl -fsSL https://raw.githubusercontent.com/luckyLo99/Cathay-Agent/main/scripts/install_cathay.sh | bash # 4. Configure provider keys sudo nano /etc/cathay-agent/cathay.env # 5. Test cathay doctor cathay ``` Notes for WSL2: - systemd is supported in WSL2 since Windows 11 22H2; enable it with `echo "[boot]\\nsystemd=true" | sudo tee /etc/wsl.conf` and restart WSL. - nginx inside WSL2 is not exposed by default — use port forwarding (`netsh interface portproxy`) or a Windows-side reverse proxy. - For Windows-native usage (no WSL), see "Install on Bare Windows" below. --- ## Install on macOS ```bash # 1. Install Homebrew if you do not have it /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # 2. Install base tools brew install git python@3.12 nginx jq # 3. Clone and install git clone https://github.com/luckyLo99/Cathay-Agent.git /opt/cathay-agent cd /opt/cathay-agent python3 -m venv .venv . .venv/bin/activate pip install -U pip wheel setuptools pip install -e ".[server]" # 4. CLI wrapper cat > /usr/local/bin/cathay <<'WRAPPER' #!/usr/bin/env bash cd /opt/cathay-agent . /opt/cathay-agent/.venv/bin/activate exec cathay "$@" WRAPPER chmod +x /usr/local/bin/cathay # 5. Test cathay doctor ``` > The official Debian installer (`install_cathay.sh`) supports macOS best-effort: it skips apt and systemd steps but still creates a venv and CLI wrappers. --- ## Install on Bare Windows Cathay is a Linux-first project. For a native Windows install, use the Python wheel + PowerShell. ```powershell # 1. Install Python 3.12 from python.org (tick "Add to PATH") # 2. Install Git for Windows # 3. Open PowerShell as Administrator git clone https://github.com/luckyLo99/Cathay-Agent.git C:\cathay-agent cd C:\cathay-agent py -3.12 -m venv .venv .\.venv\Scripts\Activate.ps1 python -m pip install -U pip wheel setuptools pip install -e ".[server]" # 4. Add C:\cathay-agent\.venv\Scripts to PATH, then test cathay doctor ``` If you are not on Windows 11, or cannot enable WSL2, prefer using a small Debian 12 VM (e.g. Multipass) instead of a native Windows install. --- ## Upgrade from a Previous Version Cathay Agent ships a `cathay_upgrade.sh` helper that performs a 6-step safe upgrade: backup → fetch → checkout → install → gate → restart. ```bash # 1. Upgrade to the latest stable release (default branch is `main`) sudo /opt/cathay-agent/scripts/cathay_upgrade.sh # 2. Upgrade to a specific tag (recommended for production) sudo /opt/cathay-agent/scripts/cathay_upgrade.sh cathay-v0.4.4-dependency-security # 3. Roll back to a previous tag sudo /opt/cathay-agent/scripts/cathay_upgrade.sh cathay-v0.4.3-tui-real-parity ``` What the upgrade script does, step by step: 1. **Backup** — runs `scripts/cathay_backup.sh` to snapshot `/etc/cathay-agent/`, `/var/lib/cathay-agent/`, and `/opt/cathay-agent/.venv`. 2. **Fetch** — `git fetch --all --tags`. 3. **Checkout** — `git checkout ` (tag, branch, or commit). 4. **Install** — `pip install -e ".[server]"` inside the existing venv. 5. **Gate** — `python scripts/rc8_stable_release_gate.py` to ensure tests still pass. 6. **Restart** — `systemctl restart cathay-agent` and prints the service status. If the gate step fails, the script aborts *before* restarting, so the previous version keeps serving traffic. The backup can be restored with `scripts/cathay_backup.sh restore`. ### Upgrade outside the helper (manual) ```bash cd /opt/cathay-agent git fetch --all --tags git checkout cathay-v0.4.4-dependency-security . .venv/bin/activate pip install -e ".[server]" sudo systemctl restart cathay-agent sudo systemctl status cathay-agent --no-pager ``` ### Upgrading across major version families (v0.3.x → v0.4.x) `v0.4.x` changed the Python entry point to `cathay-web` and added a system user. Run: ```bash sudo /opt/cathay-agent/scripts/install_cathay.sh # this is idempotent: it will pull latest, re-create the venv, and re-install # the systemd unit. Existing /etc/cathay-agent/cathay.env is preserved. ``` --- ## Daily Usage Start Cathay: ```bash cathay ``` Run one task: ```bash cathay run "Summarize this repository in 5 bullets." ``` TUI: ```bash cathay --tui ``` Setup: ```bash cathay setup ``` Doctor: ```bash cathay doctor ``` Slash commands (in interactive mode): ```text /help /doctor /memory /provider /tools /compact /history /clear /exit ``` Manage service: ```bash cathay service status cathay service logs cathay service restart ``` Verify bot channels: ```bash cathay bot verify ``` --- ## Command Reference | Command | Description | | --- | --- | | `cathay` | Start interactive chat (Hermes-like) | | `cathay --tui` | Launch TUI shell | | `cathay setup` | Show provider and runtime setup guide | | `cathay doctor` | Run local diagnostics | | `cathay doctor --prod` | Run production diagnostics | | `cathay run ` | Run a single task | | `cathay chat` | Start interactive chat session | | `cathay service status` | Show systemd service status | | `cathay service logs` | Tail service logs | | `cathay bot verify` | Verify Feishu / WeCom / QQBot adapters | | `cathay gate` | Run offline acceptance gate | | `cathay gate --online` | Run API-dependent acceptance gate | | `cathay update` | Upgrade Cathay Agent | --- ## Providers Cathay supports multiple LLM backends via provider-agnostic routing: | Provider | Priority | Notes | |----------|----------|-------| | DeepSeek v4-flash | 1 | Recommended for production | | SenseNova | 2 | Test environment | | Agnes AI | 3 | - | | NVIDIA NIM | 4 | - | | Generic OpenAI-compatible | 5 | Any OpenAI-compatible API | Configure in `/etc/cathay-agent/cathay.env` or `.env`. --- ## Security - API keys are stored in environment variables only - never in code - Secret audit runs on every CI push (`scripts/secret_audit.py`) - Token rotation uses `scripts/rotate_github_token.py` (env-var only, no CLI args) - Runtime tools go through Cathay BoundaryKeeper with 4 defense lines - **Persistent approval store** - SQLite-backed single-use approval tokens with TTL - **Feishu replay guard + SHA-256 signature verification** - wired into FeishuAdapter - **Unified dangerous command policy** - CommandPolicy.DENY_PREFIXES is single source of truth - Unicode prompt injection protection via `UnicodeSanitizer` - Multi-user session isolation via `SessionScope` - Layer isolation enforced in CI via `scripts/check_legacy_imports.py` - **Dependency security triage** - RUSTSEC advisories formally triaged in `docs/security/` Report vulnerabilities to: https://github.com/luckyLo99/Cathay-Agent/security --- ## What's In v0.4.x | Area | Component | Status | |------|-----------|--------| | Harness | AgentLoopV2 (ReAct + Planning + Verification + Reflexion) | Bridged via HarnessRuntimeAdapter | | Memory | MemoryOS (6 tiers) | Bridged via MemoryOSBridge to legacy MemoryManager | | Approvals | PersistentApprovalStore | Replaces stub validate_token() | | Feishu | ReplayGuard + SignatureVerifier | Integrated into FeishuAdapter | | CLI/TUI | Hermes-like interactive chat | prompt_toolkit + rich, slash commands | | Behavioral regression | SHA-256 fingerprinting + regression gate | eval module | | Self-improvement | Proposal-only, human-approved | proposal_engine | | Skill registry | Typed skills with risk-level tagging | skill_registry | | Dependency security | Dependabot advisory triage + gate | docs/security/ + v044 gate | --- ## License Apache 2.0 - see [LICENSE](LICENSE).