# wechat-claude-code **Repository Path**: h_x_d/wechat-claude-code ## Basic Information - **Project Name**: wechat-claude-code - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-05 - **Last Updated**: 2026-04-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # wechat-claude-code **English** | [δΈ­ζ–‡](README_zh.md) A [Claude Code](https://claude.ai/claude-code) Skill that bridges personal WeChat to your local Claude Code. Chat with Claude from your phone via WeChat β€” text, images, permission approvals, slash commands, all supported. ## Features - **Real-time progress updates** β€” see Claude's tool calls (πŸ”§ Bash, πŸ“– Read, πŸ” Glob…) as they happen - **Thinking preview** β€” get a πŸ’­ preview of Claude's reasoning before each tool call - **Interrupt support** β€” send a new message mid-query to abort and redirect Claude - **System prompt** β€” set a persistent prompt via `/prompt` (e.g. "Reply in Chinese") - Text conversation with Claude Code through WeChat - Image recognition β€” send photos for Claude to analyze - Permission approval β€” reply `y`/`n` in WeChat to approve Claude's tool use - Slash commands β€” `/help`, `/clear`, `/model`, `/prompt`, `/status`, `/skills`, and more - Launch any installed Claude Code skill from WeChat - Cross-platform β€” macOS (launchd), Linux (systemd + nohup fallback) - Session persistence β€” resume conversations across messages - Rate-limit safe β€” automatic exponential backoff on WeChat API throttling ## Prerequisites - Node.js >= 18 - macOS or Linux - Personal WeChat account (QR code binding required) - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) with `@anthropic-ai/claude-agent-sdk` installed > **Note:** The SDK supports third-party API providers (e.g. OpenRouter, AWS Bedrock, custom OpenAI-compatible endpoints) β€” set `ANTHROPIC_BASE_URL` and `ANTHROPIC_API_KEY` accordingly. ## Installation Clone into your Claude Code skills directory: ```bash git clone https://github.com/Wechat-ggGitHub/wechat-claude-code.git ~/.claude/skills/wechat-claude-code cd ~/.claude/skills/wechat-claude-code npm install ``` `postinstall` automatically compiles TypeScript via `tsc`. ## Quick Start ### 1. Setup (first time only) Scan QR code to bind your WeChat account: ```bash cd ~/.claude/skills/wechat-claude-code npm run setup ``` A QR code image will open β€” scan it with WeChat. Then configure your working directory. ### 2. Start the daemon ```bash npm run daemon -- start ``` - **macOS**: registers a launchd agent for auto-start and auto-restart - **Linux**: uses systemd user service (falls back to nohup if systemd unavailable) ### 3. Chat in WeChat Send any message in WeChat to start chatting with Claude Code. ### 4. Manage the service ```bash npm run daemon -- status # Check if running npm run daemon -- stop # Stop the daemon npm run daemon -- restart # Restart (after code updates) npm run daemon -- logs # View recent logs ``` ## WeChat Commands | Command | Description | |---------|-------------| | `/help` | Show available commands | | `/clear` | Clear current session (start fresh) | | `/reset` | Full reset including working directory | | `/model ` | Switch Claude model | | `/permission ` | Switch permission mode | | `/prompt [text]` | View or set a system prompt appended to every query | | `/status` | View current session state | | `/cwd [path]` | View or switch working directory | | `/skills` | List installed Claude Code skills | | `/history [n]` | View last N chat messages | | `/compact` | Start a new SDK session (clear token context) | | `/undo [n]` | Remove last N messages from history | | `/ [args]` | Trigger any installed skill | ## Permission Approval When Claude requests to execute a tool, you'll receive a permission request in WeChat: - Reply `y` or `yes` to allow - Reply `n` or `no` to deny - No response within 120 seconds = auto-deny You can switch permission mode with `/permission `: | Mode | Description | |------|-------------| | `default` | Manual approval for each tool use | | `acceptEdits` | Auto-approve file edits, other tools need approval | | `plan` | Read-only mode, no tools allowed | | `auto` | Auto-approve all tools (dangerous mode) | ## How It Works ``` WeChat (phone) ←→ ilink bot API ←→ Node.js daemon ←→ Claude Code SDK (local) ``` - The daemon long-polls WeChat's ilink bot API for new messages - Messages are forwarded to Claude Code via `@anthropic-ai/claude-agent-sdk` - Tool calls and thinking previews are streamed back as Claude works - Responses are sent back to WeChat with automatic rate-limit retry - Platform-native service management keeps the daemon running (launchd on macOS, systemd/nohup on Linux) ## Data All data is stored in `~/.wechat-claude-code/`: ``` ~/.wechat-claude-code/ β”œβ”€β”€ accounts/ # WeChat account credentials (one JSON per account) β”œβ”€β”€ config.env # Global config (working directory, model, permission mode, system prompt) β”œβ”€β”€ sessions/ # Session data (one JSON per account) β”œβ”€β”€ get_updates_buf # Message polling sync buffer └── logs/ # Rotating logs (daily, 30-day retention) ``` ## Development ```bash npm run dev # Watch mode β€” auto-compile on TypeScript changes npm run build # Compile TypeScript ``` ## License [MIT](LICENSE)