cc-weixin
CLAUDE.md154 starsChanged 8 months agoMITView on GitHub
WeChat channel plugin for Claude Code and Codex, connecting WeChat via the official iLink Bot API. Monorepo structure — the plugin source lives under plugins/weixin/. All commands run from plugins/weixin/: Follow Conventional Commits: - Two-layer design: src/ is platform-agnostic WeChat communication; server.ts is the Claude Code adapter; server-codex.ts is the Codex adapter. Keep them separated. - No reverse engineering: Only use the official iLink Bot API. - Credentials: Always chmod 0600 for account files. State dir: ~/.claude/channels/weixin/ (overridable via WEIXIN_STATE_DIR).…
- Reads credentials
The file
We split this CLAUDE.md into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 12
No semicolons omission — always use semicolons
- Very specific: line 13
Prefer const, use let only when reassignment is needed
- Distinctive: line 14
All source files should have a JSDoc module comment at the top
- Very specific: line 18
All commands run from plugins/weixin/:
- Distinctive: line 27
Prefer running single test files over the full suite during development
- Very specific: line 28
Always run typecheck after code changes before committing
- Distinctive: line 67
No reverse engineering: Only use the official iLink Bot API.
- Very specific: line 68
Credentials: Always chmod 0600 for account files.
- Very specific: line 81
Test files use WEIXIN_STATE_DIR env var to isolate from real credentials
- Distinctive: line 85
Never log or expose tokens, aes_keys, or account credentials
- Very specific: line 86
Never commit .env, account.json, or any credential files
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
cc-weixin Development Guide
Project Overview
WeChat channel plugin for Claude Code and Codex, connecting WeChat via the official iLink Bot API.
Monorepo structure — the plugin source lives under plugins/weixin/.
Code Style
- TypeScript strict mode, ES module syntax (
import/export) - 2-space indentation, LF line endings
- No semicolons omission — always use semicolons
- Prefer
const, useletonly when reassignment is needed - All source files should have a JSDoc module comment at the top
Build & Test
All commands run from plugins/weixin/:
bun install # install dependencies
bun run typecheck # tsc --noEmit
bun test # run all tests
bun test src/media.test.ts # run a single test file- Prefer running single test files over the full suite during development
- Always run
typecheckafter code changes before committing
Commit Convention
Follow Conventional Commits:
feat:new featurefix:bug fixdocs:documentation onlyrefactor:code restructuringtest:add/modify testschore:build/tooling changes
Project Structure
plugins/weixin/
├── server.ts # MCP Server entry (Claude Code adapter)
├── server-codex.ts # MCP Server + WebSocket bridge (Codex adapter, experimental)
├── src/
│ ├── types.ts # iLink Bot API type definitions
│ ├── api.ts # HTTP API wrapper
│ ├── accounts.ts # Credential storage (~/.claude/channels/weixin/)
│ ├── login.ts # QR code login flow
│ ├── monitor.ts # Long-poll message receiver (platform-agnostic)
│ ├── send.ts # Message sending + markdown-to-plaintext
│ ├── media.ts # CDN upload/download with AES-128-ECB encryption
│ ├── pairing.ts # Pairing code + allowlist access control
│ ├── codex-client.ts # Codex App Server WebSocket client
│ └── cli-login.ts # Standalone login script
├── skills/ # Skill definitions (shared by Claude Code and Codex)
├── .claude-plugin/ # Claude Code plugin metadata
└── .codex-plugin/ # Codex plugin metadataArchitecture Decisions
- Two-layer design:
src/is platform-agnostic WeChat communication;server.tsis the Claude Code adapter;server-codex.tsis the Codex adapter. Keep them separated. - No reverse engineering: Only use the official iLink Bot API.
- Credentials: Always
chmod 0600for account files. State dir:~/.claude/channels/weixin/(overridable viaWEIXIN_STATE_DIR). - Media encryption: AES-128-ECB with random key per upload.
Two aes_key encodings exist — see
parseAesKey()inmedia.ts.
Common Pitfalls
qrcode-terminalhas no types — usesrc/qrcode-terminal.d.tsfetchbody requiresUint8ArraynotBufferfor TypeScript compatibility- Long-poll timeout in
getUpdatesis expected — handleAbortErrorgracefully - Version numbers must stay in sync across 5 files:
package.json,server.ts,server-codex.ts,.claude-plugin/plugin.json,.codex-plugin/plugin.json, and root.claude-plugin/marketplace.json - Test files use
WEIXIN_STATE_DIRenv var to isolate from real credentials
Security Rules
- Never log or expose tokens, aes_keys, or account credentials
- Never commit
.env,account.json, or any credential files - Validate all user input at MCP tool boundaries (
server.ts,server-codex.ts)
References
- API protocol: @docs/API-REFERENCE.md
- Architecture design: @docs/DESIGN.md
- Access control: @plugins/weixin/ACCESS.md
- Contributing: @CONTRIBUTING.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

