# QwenClaw + Qwen Code CLI - Complete Setup Guide

## Quick Start (5 Minutes)

### Step 1: Install QwenClaw

```bash
# Clone repository
git clone https://github.rommark.dev/admin/QwenClaw-with-Auth.git
cd QwenClaw-with-Auth

# Install dependencies
bun install

# Run setup (auto-configures everything)
bun run setup
```

### Step 2: Set as Default Agent

```bash
# Configure Qwen Code to use QwenClaw as ALWAYS-ON default agent
bun run set-default
```

### Step 3: Restart Qwen Code

```bash
# Close and reopen Qwen Code
qwen

# QwenClaw will auto-start automatically
# You'll see: 🐾 QwenClaw Agent initialized
```

---

## Usage Inside Qwen Code CLI

### Method 1: Use /qwenclaw Commands (Recommended)

Once QwenClaw is configured, use these commands directly in Qwen Code chat:

```
/qwenclaw status          - Check daemon status
/qwenclaw send "task"     - Send task to daemon
/qwenclaw skills          - List all 81 skills
/qwenclaw help            - Show help
```

### Method 2: Natural Language (QwenClaw is Default)

Since QwenClaw is your default agent, just talk naturally:

```
Check my pending tasks

Summarize my calendar for today

Use gui-automation to screenshot https://example.com

Start a multi-agent code review with Claude and Codex

Find documents about API design in my RAG store
```

### Method 3: MCP Commands

QwenClaw provides MCP tools you can invoke:

```
MCP: qwenclaw.start()
MCP: qwenclaw.send_message("Check my tasks")
MCP: qwenclaw.get_status()
```

---

## Configuration Files

### 1. Qwen Code Settings (`~/.qwen/settings.json`)

After running `bun run set-default`, this should exist:

```json
{
  "agents": {
    "default": "qwenclaw",
    "enforce": true,
    "qwenclaw": {
      "name": "QwenClaw",
      "autoStart": true,
      "alwaysOn": true,
      "skills": [
        "qwenclaw-integration",
        "gui-automation",
        "qwenbot-integration"
      ]
    }
  },
  "skills": {
    "default": "qwenclaw-integration",
    "enabled": [
      "qwenclaw-integration",
      "gui-automation",
      "qwenbot-integration"
    ]
  },
  "mcpServers": {
    "qwenclaw": {
      "command": "bun",
      "args": ["run", "start", "--web"],
      "cwd": "~/qwenclaw",
      "env": {
        "QWENCLAW_AUTO_START": "true"
      }
    }
  }
}
```

### 2. Agent Configuration (`~/.qwen/agent.json`)

```json
{
  "agent": {
    "default": "qwenclaw",
    "enforce": true,
    "agents": {
      "qwenclaw": {
        "name": "QwenClaw",
        "alwaysOn": true,
        "priority": 1
      }
    }
  }
}
```

### 3. MCP Configuration (`~/.qwen/mcp.json`)

```json
{
  "mcpServers": {
    "qwenclaw": {
      "command": "bun",
      "args": ["run", "start", "--web"],
      "cwd": "~/qwenclaw"
    },
    "council": {
      "command": "npx",
      "args": ["agents-council@latest", "mcp"]
    },
    "clawwork": {
      "command": "python",
      "args": ["-m", "clawwork.server"],
      "cwd": "~/ClawWork"
    }
  }
}
```

---

## Verify Installation

### 1. Check QwenClaw is Running

```bash
# In terminal
qwenclaw status

# Should show:
✅ QwenClaw daemon is running
   PID: 12345
   Web UI: http://127.0.0.1:4632
```

### 2. Check Qwen Code Configuration

```bash
# In Qwen Code CLI
qwen

# Then ask:
Are you QwenClaw?

# Should respond:
Yes! I'm QwenClaw, your persistent AI assistant daemon.
```

### 3. Test Daemon Communication

```
/qwenclaw send "Hello, are you running?"

# Should respond:
✅ QwenClaw daemon is running and ready to help!
```

---

## Common Use Cases

### 1. Code Review with Multi-Agent Council

```
Start a code review council with Claude and Codex to review my PR at https://github.rommark.dev/admin/QwenClaw-with-Auth/pull/42
```

### 2. GUI Automation

```
Use gui-automation to navigate to https://github.rommark.dev/admin/QwenClaw-with-Auth and take a screenshot
```

### 3. Economic Tasks (ClawWork)

```
Check my ClawWork balance and start working on a task
```

### 4. RAG Search

```
Find all documents in my RAG store about API design patterns
```

### 5. Schedule Task

```
Schedule a daily standup at 9 AM that summarizes my GitHub notifications
```

---

## Troubleshooting

### Issue: "Unknown command: /qwenclaw"

**Solution:**
```bash
# Re-run configuration
cd ~/qwenclaw
bun run set-default

# Restart Qwen Code
exit
qwen
```

### Issue: "QwenClaw daemon not running"

**Solution:**
```bash
# Start daemon manually
cd ~/qwenclaw
bun run start --web

# Or use command
qwenclaw start --web
```

### Issue: "Skills not enabled"

**Solution:**
```bash
# Check enabled skills
cat ~/.qwen/settings.json | grep -A 10 '"skills"'

# Should show:
"skills": {
  "enabled": [
    "qwenclaw-integration",
    "gui-automation",
    "qwenbot-integration"
  ]
}
```

### Issue: "MCP server not found"

**Solution:**
```bash
# Check MCP config
cat ~/.qwen/mcp.json

# Should have qwenclaw entry
{
  "mcpServers": {
    "qwenclaw": {
      "command": "bun",
      "args": ["run", "start", "--web"],
      "cwd": "~/qwenclaw"
    }
  }
}
```

---

## Full Feature List

### 81 Skills Available

| Category | Skills |
|----------|--------|
| **Content** | Research writer, changelog generator |
| **Development** | Code mentor, plugin dev, hook dev |
| **Design** | UI/UX Pro Max, shadcn/ui |
| **Automation** | GUI automation, Spawner MCP |
| **Multi-Agent** | Agents Council |
| **Economic** | ClawWork (220 GDP tasks) |
| **Tools** | QwenBot, file organizer |
| **Business** | Internal comms, lead research |
| **Creative** | Theme factory, canvas design |
| **Productivity** | Meeting insights, essence distiller |

### Daemon Features

- ✅ Auto-starts with Qwen Code
- ✅ Persistent sessions
- ✅ Web dashboard (http://127.0.0.1:4632)
- ✅ Telegram integration
- ✅ Scheduled jobs (cron)
- ✅ Heartbeat check-ins
- ✅ FULL RAG (vector store)
- ✅ Multi-agent orchestration
- ✅ Economic accountability (ClawWork)

---

## Quick Reference Card

```
╔══════════════════════════════════════════════════════════╗
║              QWENCLAW + QWEN CODE CLI                     ║
╠══════════════════════════════════════════════════════════╣
║  Setup:                                                   ║
║    git clone ... && cd QwenClaw-with-Auth                ║
║    bun install && bun run setup && bun run set-default   ║
║                                                           ║
║  Commands:                                                ║
║    /qwenclaw status          - Check daemon               ║
║    /qwenclaw send "task"     - Send task                  ║
║    /qwenclaw skills          - List skills                ║
║    /qwenclaw help            - Show help                  ║
║                                                           ║
║  Natural Language:                                        ║
║    "Check my tasks"                                       ║
║    "Screenshot https://..."                               ║
║    "Start code review council"                            ║
║    "Find docs about..."                                   ║
║                                                           ║
║  Web Dashboard: http://127.0.0.1:4632                     ║
║  Docs: ~/qwenclaw/README.md                               ║
╚══════════════════════════════════════════════════════════╝
```

---

## Next Steps

1. ✅ **Install & Configure** (5 min)
   ```bash
   git clone ... && cd QwenClaw-with-Auth
   bun install && bun run setup && bun run set-default
   ```

2. ✅ **Restart Qwen Code**
   ```bash
   exit
   qwen
   ```

3. ✅ **Test It**
   ```
   /qwenclaw status
   ```

4. ✅ **Start Using**
   ```
   Check my pending tasks
   ```

5. ✅ **Explore Features**
   ```
   /qwenclaw skills
   ```

---

**You're ready to use QwenClaw inside Qwen Code CLI!** 🐾🎉
