The Problem
CoPaw is a personal AI assistant that connects across multiple chat platforms (DingTalk, Feishu, QQ, Discord, iMessage) but has significant code health issues that increase maintenance risk and deployment vulnerability. The codebase contains circular imports, unpinned dependencies with known CVEs, and a missing lockfile that creates drift between tested and shipped artifacts.
What This Does
CoPaw is a full-stack Python/TypeScript application with a React console interface and Python backend. The console (console/, 139 files) handles the user interface built with React/Vite, while the Python source (src/, 349 files) provides the core assistant logic, agent orchestration, and channel integrations. A React runtime function t in website/src/i18n.ts is called from 55 other files, indicating the i18n system is deeply wired into the UI. The Python package is pip-installable via pyproject.toml and setup.py, and the project can be containerized with the deploy/Dockerfile. Skills and channels are extensible through the src/copaw/agents/skills/ and src/copaw/app/channels/ modules.
How It Is Wired
Execution starts at console/src/App.tsx:15 which reaches a single function and is the root of the React client. On the server, console/src/api/index.ts (Ca 23, Ce 16, instability 0.41) is the highest-instability hub - 23 modules import from it and it imports 16 others, making it a high-blast-radius point where changes ripple widely. The API request layer flows through console/src/api/request.ts which builds headers and makes fetches to the backend. The internal call graph shows t is called from 95 places and request from 83 places, representing the most break-prone edges. Circular imports exist in src/copaw/config/__init__.py, src/copaw/config/utils.py, and src/copaw/app/channels/registry.py - mutually reachable modules that will cause import failures if any one is reordered. Execution can leave the process via 2 functions running external commands and 1 function reading/writing files, primarily through skill execution and file-based configs.
Entry points: App (console/src/App.tsx:15), getSession (console/src/pages/Chat/sessionApi/index.ts:286), handleSubmit (console/src/pages/Agent/Skills/index.tsx:107), createSession (console/src/pages/Chat/sessionApi/index.ts:374), handleConfirmImport (console/src/pages/Agent/Skills/index.tsx:72), CronJobsPage (console/src/pages/Control/CronJobs/index.tsx:15).
How To Use It
Setup:
# Clone the repository
git clone https://github.com/moses-y/CoPaw
# Install dependencies (pnpm)
cd CoPaw
pnpm install
# Install the Python package
pip install -e .
Configuration: Required environment variables and keys are managed through console/src/pages/Settings/Environments/useEnvVars.ts. The Python configuration lives in src/copaw/config/config.py (Ca 17, Ce 1) and src/copaw/config/__init__.py. Channel configs (DingTalk, Feishu, Discord, etc.) are defined in console/src/api/types/channel.ts.
Running it:
- Start the console UI:
pnpm dev(fromconsole/package.json) - Start the Python backend: The package exposes a CLI; invocation would use the installed
copawcommand orpython -m copaw
Note: The repo provides scripts/install.sh and scripts/install.ps1 for environment setup, but specific environment variable names are not documented in the analyzed structure.
Real-World Use
A user adds a new channel configuration via the web console (console/src/pages/Settings/Environments/index.tsx), which calls useEnvVars.ts to persist settings. The Python side reads these via src/copaw/config/config.py and registers the channel handler. When a message arrives, it routes through the channel base (src/copaw/app/channels/base.py) and gets processed by the skill system (src/copaw/agents/skills_manager.py). A cron job scheduled through console/src/pages/Control/CronJobs/useCronJobs.ts can trigger periodic tasks like daily digests or reminders, with job definitions stored in the database and dispatched via the cron runtime defined in console/src/api/types/cronjob.ts.
Code Health & Issues
The static analysis identified 155 findings (42 high, 113 medium, 0 low) across 7 distinct categories. Key issues:
- [HIGH/clarity] Hub module x7 -
console/src/api/types/index.ts,console/src/api/index.ts,src/copaw/constant.py; 47 modules depend on these; high-blast-radius churn point - [HIGH/soundness] Import cycle member x8 -
src/copaw/config/__init__.py,src/copaw/config/utils.py,src/copaw/app/channels/registry.py; circular import dependency - [MEDIUM/resilience] Broad exception handling x12 -
src/copaw/app/channels/base.py, office validator files; bareexceptswallows errors indiscriminately - [HIGH/cognitive_load] Deep nesting x24 -
src/copaw/app/channels/base.py,src/copaw/agents/utils/tool_message_utils.py, validators; max indentation depth 6 - [HIGH/cognitive_load] Oversized file x7 -
src/copaw/app/channels/base.py(676 lines),src/copaw/agents/skills_manager.py, validators; hard to hold in one head - [HIGH/clarity] Duplicated code blocks x2658 across 106 files; 6-line blocks repeated
SDLC observations: License file present (LICENSE), CI configured (GitHub Actions), Dockerfile present, lockfiles present for Python (pyproject.toml) and Node (console/package-lock.json), no committed secrets detected. However, 9 dependency vulnerabilities are pinned including agentscope@1.0.16 CVE-2026-6604 and 7 more advisories.
The Bottom Line
CoPaw functional architecture - multi-channel AI assistant with React front-end and Python back-end - is sound but burdened by structural debt: circular imports create import-time failures risk, unpinned dependencies carry known CVEs, and a missing lockfile creates ship-vs-test drift. The hub at console/src/api/index and the t runtime function are the highest-risk touch points for anyone extending the codebase. It's suitable for teams that can absorb the remediation work (pin SHAs, break cycles, extract duplicated logic) and want a self-hostable AI assistant with extensible channels. Teams needing zero-config deployment or strict security posture should look elsewhere.