Key points
- Project overview: QwenPaw (formerly CoPaw; renamed at v1.0.0 after joining the Qwen ecosystem) is a local-first, skill-driven, multi-agent personal AI assistant platform under Apache-2.0, requiring Python 3.10+. Stack: AgentScope (multi-agent framework), FastAPI, Vue 3 (console), Tauri (desktop shell), Playwright (browser automation), and MCP.
- Tool registration (three tiers): 21 hardcoded built-in tools (shell, file ops, browser, subagent delegation, etc.); plugin tools auto-discovered via
__all__but disabled unless explicitly enabled in config; automatic registration ofview_task/wait_task/cancel_taskwhen any enabled tool usesasync_execution. Coding-mode tools (lsp,ast_search) register conditionally. - Plan gating: A
plan_notebookmaintains four flags (_plan_tool_gate,_plan_awaiting_user_confirm,_plan_text_only_after_mutation,_plan_just_mutated). A pre-lock mechanism preventsasyncio.gathersibling tools from bypassing gates before a mutation tool executes. - Auto-continue: If the model returns text-only replies, a bilingual
<system-hint>is injected and reasoning re-runs up to 2 extra times until a tool call occurs. - Media fault tolerance (three tiers): Proactive stripping based on cached multimodal capability; passive retry on 400/media-related errors; a learning layer that writes
rejects_mediainto the capability cache. Nested media blocks insideToolResultBlock.outputare also stripped. - MCP recovery: Three-stage flow — reconnect → rebuild (using stored
transport/name/command/args/env/url/headers) → reconnect again. - Multi-agent routing: Four-level priority — explicit
agent_id,request.state.agent_id,X-Agent-Idheader, then config fallback ("default").MultiAgentManageruses lazy workspace loading withasyncio.Eventcoordination. - ToolExecutionLevel:
STRICT(approve all),SMART(INFO/LOW auto-approved, MEDIUM+ require approval; recommended),AUTO(only explicit guarded tools),OFF. - Three guardians:
RuleBasedToolGuardian(env-var-driven rules),FilePathToolGuardian(path allow/deny lists with default secret-dir protection),ShellEvasionGuardian(shell obfuscation detection). - Defaults: Guard enabled by default (
QWENPAW_TOOL_GUARD_ENABLED> config >True); UI messages localized in English, Chinese, Russian, and Japanese; skills are scanned for hardcoded secrets and data-exfiltration patterns before installation. ModelInfotracks independent multimodal/image/video flags, probe source, token limits (defaults 8192 max tokens, 128k input), and per-modelgenerate_kwargsdeep-merged over provider-level kwargs.- Memory lifecycle:
__init__ → start() → summarize()/memory_search() → close(). Proactive memory is lazily imported to avoid circular dependencies. Automation-triggered requests (cron, heartbeat) skip long-term memory writes. LightContextManageruses an estimated token counter and two compaction prompt sets (initial vs. update).PluginTypeenum:TOOL,PROVIDER,HOOK,COMMAND,FRONTEND,GENERAL.- Skills resolve per workspace + channel via
resolve_effective_skills(); built-in skills have onlyen/zhlocalization variants; pool and workspace manifests are reconciled automatically; a remote skill hub is supported.
Layered architecture (six layers)
1. Channels Layer — 18 built-in channels registered in app/channels/registry.py (_BUILTIN_SPECS): IM (iMessage, Discord, DingTalk, Feishu, QQ, Telegram, Mattermost, MQTT, Matrix, WeCom, WeChat, OneBot), terminals (console, voice, SIP), and first-party ecosystems (Xiaoyi, Yuanbao). Each channel extends BaseChannel(ABC) with native payload adaptation, request merging, MessageRenderer, and per-channel access control. ChannelManager._process_batch handles batch processing with a per-channel queue cap of 1000 via UnifiedQueueManager.
2. Console Layer — Web UI and Tauri desktop app.
3. Agent Layer — QwenPawAgent(CodingModeMixin, ToolGuardMixin, ReActAgent) relies on strict MRO chaining; every _acting/_reasoning override must call super() or the interception chain breaks.
4. Security Layer — ToolGuard engine plus skill scanner.
5. Provider Layer — Provider(ProviderInfo, ABC) with 8 implementations (OpenAI file contains three classes: OpenAI, OpenCode, Kilo; plus Anthropic, Gemini, Ollama, LM Studio, OpenRouter).
6. Memory/Context Layer — Three memory backends (AgentMdManager filesystem-based, ReMeLightMemoryManager, ADBPGMemoryManager) plus LightContextManager for tool-result pruning, context-size checks, and compaction.
Agent layer mechanics
Security layer
Providers, memory, and context
Plugins and skills
Deployment and startup
Six deployment modes: pip, script installer, Docker, Alibaba Cloud ECS, ModelScope Spaces, and Tauri desktop app (beta). Startup is two-phase: Phase 1 targets < 100ms (cleanup, env registration, migrations, core managers, exposing app.state), while Phase 2 runs in the background (plugin loading, agent startup, local model resume, provider and command registration, startup hooks).
Design philosophy and assessment
Core principles: local-first privacy (secrets in ~/.qwenpaw.secret/, data in ~/.qwenpaw/, no auto-upload), security by default, progressive complexity, and resilient design (LLM retry with exponential backoff, MCP recovery, media tolerance, plan pre-locking). Noted improvement areas: inter-agent communication relies on tool calls without a native message bus, the plan system is tightly coupled to the agent core, and test coverage has room to grow (configured fail_under = 30).