# Xiaohongshu Ops

> General XiaoHongShu operation skill for browsing feeds, posting comments, auto-replying to comments (跟评自动回复), replying private messages (私信自动回复), and publishing image/video notes through mcporter + xiaohongshu-mcp (with optional VibeSurf browser mode for DM). Use when the user asks to "刷帖", random comment engagement, targeted feed comments, follow-up replies, DM reply automation, or automated note publishing with safe defaults (dry-run, rate limit, history).

- Skill: `growvv/xiaohongshu-ops` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add growvv/xiaohongshu-ops`
- Raw SKILL.md: https://api.skillmd.com/api/skills/growvv/xiaohongshu-ops/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: growvv (https://skillmd.com/u/growvv)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/growvv/xiaohongshu-ops

---


# Xiaohongshu Ops

## Overview

Use this skill for end-to-end XiaoHongShu operations:
- browse home recommendations or keyword search
- batch/random comment engagement
- automatic follow-up replies to existing comments in a feed
- automatic private-message replies (DM)
- publish image notes or video notes

## Prerequisites

- `python3`
- `mcporter` with `xiaohongshu-mcp` server configured
- XiaoHongShu account login is valid
- Optional for `reply-dm --mode browser`: VibeSurf endpoint (`http://127.0.0.1:9335`)
- Optional for campaign image auto-generation: Pillow

Quick dependency check:
- `scripts/check_dependencies.sh`

## Main Script

`scripts/xhs_ops.py`
`scripts/openclaw_campaign.py` (cron-oriented workflow)

## Quick Start

1. Check login:
- `scripts/xhs_ops.py status`

2. Browse feed:
- `scripts/xhs_ops.py feed --count 10 --fallback-search-keyword "AI"`

3. Dry-run random engagement:
- `scripts/xhs_ops.py comment-random --dry-run --max-comments 2 --exclude-nickname "你的昵称" --fallback-search-keyword "AI"`

4. Publish one image note (dry-run first):
- `scripts/xhs_ops.py publish-image --dry-run --title "标题" --content "正文" --image "/abs/path/a.jpg" --tag "日常"`

5. Run OpenClaw campaign (dry-run):
- `scripts/openclaw_campaign.py --dry-run --exclude-nickname "你的昵称"`

## Capabilities

### 1) 刷帖 / 浏览

- Home recommendations:
  - `scripts/xhs_ops.py feed --count 20`
- Keyword search:
  - `scripts/xhs_ops.py search "关键词" --count 20`

### 2) 评论互动

- Random/batch comments from feed:
  - `scripts/xhs_ops.py comment-random --max-comments 3 --comment-file ~/xhs_comments.txt --exclude-nickname "你的昵称"`
- Fixed comment on specific feed:
  - `scripts/xhs_ops.py comment-feed --feed-id "xxx" --xsec-token "yyy" --comment "感谢分享"`
- 跟评自动回复（指定帖子评论区）:
  - `scripts/xhs_ops.py reply-comments --feed-id "xxx" --xsec-token "yyy" --reply-file ~/xhs_replies.txt --max-replies 3 --dry-run`
  - 去掉 `--dry-run` 即可真实回复
- 私信自动回复:
  - 浏览器自动回复（推荐，适配当前无私信 API 的场景）:
    - `scripts/xhs_ops.py reply-dm --mode browser --reply-file ~/xhs_dm_replies.txt --max-replies 2 --dry-run`
    - 去掉 `--dry-run` 即可真实回复
  - MCP 直连回复（需后端提供 DM 发送工具）:
    - `scripts/xhs_ops.py reply-dm --mode mcp --conversation-id "thread_xxx" --reply "收到，我稍后回复你"`

### 3) 发帖

- Publish image note:
  - `scripts/xhs_ops.py publish-image --title "标题" --content "正文" --image "/abs/path/a.jpg" --image "/abs/path/b.jpg" --tag "AI"`
- Publish video note:
  - `scripts/xhs_ops.py publish-video --title "标题" --content "正文" --video "/abs/path/demo.mp4" --tag "vlog"`
- Scheduled publish:
  - Add `--schedule-at "2026-03-01T10:30:00+08:00"`

## Safety Defaults

- Prefer `--dry-run` before real posting.
- `comment-random` defaults to one comment per run and 30-minute interval guard.
- `reply-dm` defaults to browser mode + max 1 conversation per run.
- Track actions in local history (`~/.agent-reach/xiaohongshu-mcp/xhs_ops_history.json`).
- Use exclusion filters to avoid self-commenting.
- Campaign script stores state in `~/.agent-reach/xiaohongshu-mcp/openclaw_campaign_state.json` to avoid repeated celebration posting.

## Troubleshooting

- Login invalid:
  - Run login flow first, then retry `scripts/xhs_ops.py status`.
- `list_feeds` fails:
  - Add `--fallback-search-keyword "AI"` for feed/comment commands.
- `reply-dm --mode browser` fails:
  - Check `VIBESURF_ENDPOINT` (default `http://127.0.0.1:9335`) and ensure VibeSurf is healthy.
- `reply-dm --mode mcp` fails with missing tool:
  - Current `xiaohongshu-mcp` may not expose DM APIs; switch to `--mode browser`.
- Session/API intermittent errors:
  - Retry once and reduce `--max-comments`.

## Script Options

Run:
- `scripts/xhs_ops.py --help`
- `scripts/xhs_ops.py <subcommand> --help`
- `scripts/openclaw_campaign.py --help`

