How j-mazz/qwenclaw works
QwenClaw is a local agent runtime and gateway, with CLI and Lit dashboard clients. The principal flow sends a user request through the WebSocket RPC gateway to the agent loop, which calls an inference provider and may orchestrate tools before returning streamed results. Sessions persist transcripts; context and semantic memory support continued work. Separate capabilities include HTTP control, channels, MCP, scheduled jobs, access control, and a Node plugin sidecar. Edges use README-documented relationships or shown source references; many implementation details were not sampled, so those links are omitted.
Main entry points: agent_loop.cpp Agent loop · app.ts Lit dashboard · tool_registry.cpp Tool orchestration · gateway_server.cpp WebSocket RPC
Components 23
User interfaces
- CLI commands
src/cli/cli_manager.cpp - Lit dashboard
ui/src/ui/app.ts
Gateway services
- WebSocket RPC
src/gateway/gateway_server.cpp - RPC handlers
src/gateway/rpc_handlers_core.cpp - HTTP control API
src/web/api_routes.cpp
Agent runtime
- Agent loop
src/core/agent_loop.cpp - Inference providers
src/providers/provider_registry.cpp - Context assembly
src/core/prompt_builder.cpp
Tools and integrations
- Tool orchestration
src/tools/tool_registry.cpp - Browser control
src/tools/browser_tool.cpp - MCP client
src/mcp/mcp_client.cpp - MCP server
src/mcp/mcp_server.cpp - Channel adapters
src/channels/adapter_manager.cpp - Plugin system
src/plugins/plugin_system.cpp - Plugin sidecar
sidecar/src/index.ts
State and safeguards
- Session persistence
src/session/session_manager.cpp - Semantic memory
src/core/memory_search.cpp - Cron scheduler
src/core/cron_scheduler.cpp - Access controls
src/security/rbac.cpp
Other components
- Operator
- LLM services
- External MCP servers
- Channel users
Connections 21
- Operator → CLI commands: issues commands
- Operator → Lit dashboard: uses dashboard
- CLI commands → WebSocket RPC: sends RPC
- Lit dashboard → WebSocket RPC: connects by WebSocket
- Lit dashboard → HTTP control API: uses control API
- WebSocket RPC → RPC handlers: dispatches requests
- RPC handlers → Agent loop: routes agent work
- Agent loop → Context assembly: builds prompt
- Agent loop → Inference providers: requests inference
- Inference providers → LLM services: calls inference
- Agent loop → Tool orchestration: invokes tools
- Tool orchestration → Browser control: offers browser tool
- Tool orchestration → MCP client: bridges MCP tools
- MCP server → External MCP servers: exposes tools
- Agent loop → Session persistence: persists transcripts
- Agent loop → Semantic memory: searches memory
- Agent loop → Access controls: checks permissions
- Channel users → Channel adapters: sends messages
- Channel adapters → Agent loop: routes messages
- Cron scheduler → Agent loop: schedules tasks
- Plugin system → Plugin sidecar: runs plugin runtime