{"id":"369399cf-7853-4a62-9f5a-c2d6f20512a3","entityType":"agent","slug":"clawhub-lucasygu-redbook","name":"redbook","canonicalUrl":"https://www.xpersona.co/agent/clawhub-lucasygu-redbook","canonicalPath":"/agent/clawhub-lucasygu-redbook","generatedAt":"2026-10-09T20:53:47.225Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T09:37:07.683Z","emptyReason":null},"description":"Search, read, analyze, and automate Xiaohongshu (小红书) content via CLI","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 3.1K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s178n5dtwwsjcmy1nhtkhtj4ph83m208:redbook","sourceUrl":"https://clawhub.ai/lucasygu/redbook","homepage":"https://clawhub.ai/lucasygu/skills/redbook","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/lucasygu/redbook","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/lucasygu/skills/redbook","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":62,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"redbook technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T09:37:07.683Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T09:37:07.683Z","emptyReason":null},"stars":null,"forks":null,"downloads":3129,"packageName":null,"latestVersion":"0.8.2","tractionLabel":"3.1K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T09:37:07.683Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T09:37:07.683Z","lastCrawledAt":"2026-10-09T09:37:07.683Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T09:37:07.683Z","lastVerifiedAt":null,"highlights":[{"version":"0.8.2","createdAt":"2026-09-12T18:08:08.283Z","changelog":"redbook v0.8.2 - Added social-preview.png for improved sharing and visual identity. - Updated dependencies in package.json and package-lock.json. - Improved CLI and library logic in src/cli.ts, src/lib/client.ts, and src/lib/signing.ts. - Refined documentation in README.md and SKILL.md. - Removed obsolete skill-card.md.","fileCount":30,"zipByteSize":383284},{"version":"0.8.1","createdAt":"2026-07-04T21:59:40.586Z","changelog":"**Redbook 0.8.1 Changelog** - Added new platform and environment detection modules (`src/lib/detect.ts`, `src/lib/platform.ts`) - Extended CLI and API support to accept both user IDs and profile URLs for user commands - Added `account-report` command for batch account metrics and monthly reports - Improved cookie handling, with export and cloud/OpenClaw save options - Documentation updated (README.md, SKILL.md) with new commands and options - Internal code cleanup and dependency updates; removed unused `skill-card.md` file","fileCount":29,"zipByteSize":127718},{"version":"0.8.0","createdAt":"2026-06-06T19:01:34.341Z","changelog":"redbook v0.8.0 - Added LICENSE file for open source clarity. - Updated documentation with strong warnings about Xiaohongshu (XHS) rate limits and safe research pacing. - Emphasized the need for the \"Research Loop\" to avoid account throttling or IP blocks from XHS when reading or analyzing content at scale. - Updated quick reference and usage instructions reflecting safe usage patterns. - Removed obsolete skill-card.md. This release focuses on safe, compliant research practices and improved documentation.","fileCount":27,"zipByteSize":111581},{"version":"0.7.2","createdAt":"2026-04-12T05:35:45.031Z","changelog":"redbook v0.7.2 - Updated dependencies in package.json for improved stability or compatibility. - No user-facing features or documentation changes.","fileCount":26,"zipByteSize":103973},{"version":"0.7.1","createdAt":"2026-04-12T05:33:26.100Z","changelog":"- Bump skill version from 0.5.0 to 0.7.1 in package.json. - No functional or documentation changes to the skill itself.","fileCount":25,"zipByteSize":102728},{"version":"0.7.0","createdAt":"2026-04-12T05:31:29.239Z","changelog":"redbook 0.7.0 - Added documentation on content language strategy (`docs/content-language-strategy.md`) - Introduced new URL utility module (`src/lib/url.ts`) - Updated CLI logic and project metadata to support new features and library structure - Improved internal code organization for better maintainability","fileCount":25,"zipByteSize":102728},{"version":"0.6.0","createdAt":"2026-03-20T08:21:15.167Z","changelog":"Redbook 0.6.0 introduces new API coverage and CLI commands for advanced account and note operations. - Added health check module (`health.ts`) and new `redbook health` CLI command for note status and risk analysis. - Expanded account ops: like, unlike, delete note, list followers/following, boards, and albums via CLI. - CLI reference updated with new commands, including `like`, `unlike`, `delete`, `followers`, `following`, `boards`, `board`, and publishing image notes. - Infrastructure changes in codebase to support new endpoints and improve modularity.","fileCount":23,"zipByteSize":99957},{"version":"0.5.1","createdAt":"2026-03-07T16:16:52.373Z","changelog":"redbook 0.5.1 - Updated dependencies in package.json and package-lock.json - Modified src/lib/cdp-cookies.ts (details not specified) - No user-facing command or API changes documented","fileCount":22,"zipByteSize":92429}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s178n5dtwwsjcmy1nhtkhtj4ph83m208:redbook","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s178n5dtwwsjcmy1nhtkhtj4ph83m208:redbook` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/lucasygu/redbook before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-09T20:53:47.221Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-lucasygu-redbook/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T09:37:07.683Z","emptyReason":null},"readme":"Skill: redbook\n\nOwner: lucasygu\n\nSummary: Search, read, analyze, and automate Xiaohongshu (小红书) content via CLI\n\nTags: latest:0.8.2\n\nVersion history:\n\nv0.8.2 | 2026-09-12T18:08:08.283Z | auto\n\nredbook v0.8.2\n\n- Added social-preview.png for improved sharing and visual identity.\n- Updated dependencies in package.json and package-lock.json.\n- Improved CLI and library logic in src/cli.ts, src/lib/client.ts, and src/lib/signing.ts.\n- Refined documentation in README.md and SKILL.md.\n- Removed obsolete skill-card.md.\n\nv0.8.1 | 2026-07-04T21:59:40.586Z | auto\n\n**Redbook 0.8.1 Changelog**\n\n- Added new platform and environment detection modules (`src/lib/detect.ts`, `src/lib/platform.ts`)\n- Extended CLI and API support to accept both user IDs and profile URLs for user commands\n- Added `account-report` command for batch account metrics and monthly reports\n- Improved cookie handling, with export and cloud/OpenClaw save options\n- Documentation updated (README.md, SKILL.md) with new commands and options\n- Internal code cleanup and dependency updates; removed unused `skill-card.md` file\n\nv0.8.0 | 2026-06-06T19:01:34.341Z | auto\n\nredbook v0.8.0\n\n- Added LICENSE file for open source clarity.\n- Updated documentation with strong warnings about Xiaohongshu (XHS) rate limits and safe research pacing.\n- Emphasized the need for the \"Research Loop\" to avoid account throttling or IP blocks from XHS when reading or analyzing content at scale.\n- Updated quick reference and usage instructions reflecting safe usage patterns.\n- Removed obsolete skill-card.md.\n\nThis release focuses on safe, compliant research practices and improved documentation.\n\nv0.7.2 | 2026-04-12T05:35:45.031Z | auto\n\nredbook v0.7.2\n\n- Updated dependencies in package.json for improved stability or compatibility.\n- No user-facing features or documentation changes.\n\nv0.7.1 | 2026-04-12T05:33:26.100Z | auto\n\n- Bump skill version from 0.5.0 to 0.7.1 in package.json.  \n- No functional or documentation changes to the skill itself.\n\nv0.7.0 | 2026-04-12T05:31:29.239Z | auto\n\nredbook 0.7.0\n\n- Added documentation on content language strategy (`docs/content-language-strategy.md`)\n- Introduced new URL utility module (`src/lib/url.ts`)\n- Updated CLI logic and project metadata to support new features and library structure\n- Improved internal code organization for better maintainability\n\nv0.6.0 | 2026-03-20T08:21:15.167Z | auto\n\nRedbook 0.6.0 introduces new API coverage and CLI commands for advanced account and note operations.\n\n- Added health check module (`health.ts`) and new `redbook health` CLI command for note status and risk analysis.\n- Expanded account ops: like, unlike, delete note, list followers/following, boards, and albums via CLI.\n- CLI reference updated with new commands, including `like`, `unlike`, `delete`, `followers`, `following`, `boards`, `board`, and publishing image notes.\n- Infrastructure changes in codebase to support new endpoints and improve modularity.\n\nv0.5.1 | 2026-03-07T16:16:52.373Z | auto\n\nredbook 0.5.1\n\n- Updated dependencies in package.json and package-lock.json\n- Modified src/lib/cdp-cookies.ts (details not specified)\n- No user-facing command or API changes documented\n\nv0.5.0 | 2026-03-06T14:28:07.278Z | auto\n\nRedbook v0.5.0\n\n- Added support for managing Xiaohongshu favorites: new `favorites`, `collect`, and `uncollect` CLI commands.\n- Extended CLI quick reference with new commands for listing and modifying collections.\n- Documentation updated to reflect expanded content automation and engagement features.\n- Various improvements across the codebase.\n\nv0.4.0 | 2026-03-06T03:14:32.196Z | auto\n\n- Added Chrome DevTools Protocol (CDP) cookie extraction (new src/lib/cdp-cookies.ts).\n- Refactored internal cookie handling to support additional extraction methods.\n- Improved CLI and core library structure for greater maintainability.\n- Updated documentation to reflect new cookie options.\n- Bumped version to 0.4.0.\n\nv0.3.3 | 2026-03-03T19:46:42.098Z | auto\n\n- Adds new `render` command to convert markdown to Xiaohongshu-styled cards.\n- Major version bump: v0.2.0 → v0.3.3.\n- Documentation expanded with usage and command references for new features.\n- Internal codebase updated: new files for rendering support, improvements across CLI and reply strategy.\n\nv0.2.0 | 2026-03-02T22:14:43.612Z | user\n\nInitial ClawHub release — XHS CLI with 14 commands, 11 analysis modules (A-K), comment ops, viral templates\n\nArchive index:\n\nArchive v0.8.2: 30 files, 383284 bytes\n\nFiles: CLAUDE.md (2423b), docs/content-language-strategy.md (1776b), docs/research-task-1789.md (12027b), LICENSE (1065b), package-lock.json (37516b), package.json (1644b), README.md (36044b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), skill-card.md (2645b), SKILL.md (61087b), social-preview.html (5184b), social-preview.png (267636b), src/cli.ts (79329b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (23857b), src/lib/cookies.ts (13605b), src/lib/creator-signing.ts (1805b), src/lib/detect.ts (6769b), src/lib/fingerprint-data.ts (2376b), src/lib/health.ts (5631b), src/lib/platform.ts (2751b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (23317b), src/lib/template.ts (8176b), src/lib/url.ts (1826b), tsconfig.json (458b), _meta.json (126b)\n\nFile v0.8.2:SKILL.md\n\n---\ndescription: Search, read, analyze, and automate Xiaohongshu (小红书) content via CLI\nallowed-tools: Bash, Read, Write, Glob, Grep\n# OpenClaw / ClawHub metadata (clawhub install redbook)\nname: redbook\nversion: 0.5.0\nmetadata:\n  openclaw:\n    requires:\n      bins:\n        - redbook\n    install:\n      - kind: node\n        package: \"@lucasygu/redbook\"\n        bins: [redbook]\n    os: [macos]\n    homepage: https://github.com/lucasygu/redbook\ntags:\n  - xiaohongshu\n  - social-media\n  - analytics\n  - content-ops\n---\n\n# Redbook — Xiaohongshu CLI\n\nUse the `redbook` CLI to search notes, read content, analyze creators, automate engagement, and research topics on Xiaohongshu (小红书/RED).\n\n**OpenClaw users:** Install via `clawhub install redbook` or `npm install -g @lucasygu/redbook`.\n\n> **⚠️ Research discipline (read this first).** XHS 风控 throttles *reading*, not just writing. Any research that reads more than a handful of notes MUST run through the **[Research Loop](#research-loop--rate-limit-safe-long-running-research)** — **human-paced by default** (~20 s/note, one at a time; a typical job finishes in tens of minutes, large ones spread across the day). Hammering `read` / `comments` / `analyze-viral` in a tight loop trips captcha / IP block (300012) within a few dozen hits and degrades the account for hours. ⚡ Fast mode is **emergency-only** and requires a printed warning + explicit user opt-in. Never fire reads in parallel or with zero delay.\n\n## Usage\n\n```\n/redbook search \"AI编程\"              # Search notes\n/redbook read <url>                   # Read a note\n/redbook user <profileUrl>            # Creator profile\n/redbook account-report --file ids.txt --json  # Batch account metrics\n/redbook analyze <userId>             # Full creator analysis (profile + posts)\n```\n\n## Quick Reference\n\n| Intent | Command |\n|--------|---------|\n| Search notes | `redbook search \"keyword\" --json` |\n| Read a note | `redbook read <url> --json` |\n| Get comments | `redbook comments <url> --json --all` |\n| Creator profile | `redbook user <userId-or-profileUrl> --json` |\n| Creator's posts | `redbook user-posts <userId-or-profileUrl> --json` |\n| Batch account report | `redbook account-report --file accounts.txt --month YYYY-MM --json` |\n| Browse feed | `redbook feed --json` |\n| Search hashtags | `redbook topics \"keyword\" --json` |\n| Analyze viral note | `redbook analyze-viral <url> --json` |\n| Extract content template | `redbook viral-template <url1> <url2> --json` |\n| Post a comment | `redbook comment <url> --content \"text\"` |\n| Reply to comment | `redbook reply <url> --comment-id <id> --content \"text\"` |\n| Batch reply (preview) | `redbook batch-reply <url> --strategy questions --dry-run` |\n| Like a note | `redbook like <url>` |\n| Unlike a note | `redbook like <url> --undo` |\n| List favorites | `redbook favorites --json` or `redbook favorites <userId> --json` |\n| Collect a note | `redbook collect <url>` |\n| Remove from collection | `redbook uncollect <url>` |\n| List followers | `redbook followers <userId> --json` |\n| List following | `redbook following <userId> --json` |\n| Delete own note | `redbook delete <url>` |\n| Check note health | `redbook health --json` or `redbook health --all --json` |\n| List user boards | `redbook boards` or `redbook boards <userId> --json` |\n| List album notes | `redbook board <board-url>` or `redbook board <boardId> --json` |\n| Render markdown to cards | `redbook render content.md --style xiaohongshu` |\n| Publish image note | `redbook post --title \"...\" --body \"...\" --images img.jpg` |\n| Check connection | `redbook whoami` |\n| Save cookies for cloud/OpenClaw | `redbook auth export` or `redbook auth save --cookie-string \"a1=...; web_session=...\"` |\n\n**Always add `--json`** when parsing output programmatically. Without it, output is human-formatted text.\n\n---\n\n## XHS Platform Signals\n\nXHS is not Twitter or Instagram. These platform-specific engagement ratios reveal content type and audience behavior.\n\n### Collect/Like Ratio (`collected_count / liked_count`)\n\nXHS's \"collect\" (收藏) is a save-for-later mechanic — users build personal reference libraries. This ratio is the strongest signal of content utility.\n\n| Ratio | Classification | Meaning |\n|-------|---------------|---------|\n| >40% | 工具型 (Reference) | Tutorial, checklist, template — users bookmark for reuse |\n| 20–40% | 认知型 (Insight) | Thought-provoking but not saved for later |\n| <20% | 娱乐型 (Entertainment) | Consumed and forgotten — engagement is passive |\n\n### Comment/Like Ratio (`comment_count / liked_count`)\n\nMeasures how much a note triggers conversation.\n\n| Ratio | Classification | Meaning |\n|-------|---------------|---------|\n| >15% | 讨论型 (Discussion) | Debate, sharing experiences, asking questions |\n| 5–15% | 正常互动 (Normal) | Typical engagement pattern |\n| <5% | 围观型 (Passive) | Users like but don't engage further |\n\n### Share/Like Ratio (`share_count / liked_count`)\n\nMeasures social currency — whether users share to signal identity or help others.\n\n| Ratio | Meaning |\n|-------|---------|\n| >10% | 社交货币 — people share to signal taste, identity, or help friends |\n| <10% | Content consumed individually, not forwarded |\n\n### Search Sort Semantics\n\n| Sort | What It Reveals |\n|------|----------------|\n| `--sort popular` | Proven ceiling — the best a keyword can do |\n| `--sort latest` | Content velocity — how much is being posted now |\n| `--sort general` | Algorithm-weighted blend (default) |\n\n### Content Form Dynamics\n\n| Form | Tendency |\n|------|----------|\n| 图文 (image-text, `type: \"normal\"`) | Higher collect rate — users save reference content |\n| 视频 (video, `type: \"video\"`) | Higher like rate — easier to consume passively |\n\n---\n\n## Analysis Modules\n\nEach module is a composable building block. Combine them for different analysis depths.\n\n### Module A: Keyword Engagement Matrix\n\n**Answers:** Which keywords have the highest engagement ceiling? Which are saturated vs. underserved?\n\n**Commands:**\n```bash\nredbook search \"keyword1\" --sort popular --json\nredbook search \"keyword2\" --sort popular --json\n# Repeat for each keyword in your list\n```\n\n**Fields to extract** from each result's `items[]`:\n- `items[].note_card.interact_info.liked_count` — likes (may use Chinese numbers: \"1.5万\" = 15,000)\n- `items[].note_card.interact_info.collected_count` — collects\n- `items[].note_card.interact_info.comment_count` — comments\n- `items[].note_card.user.nickname` — author\n\n**How to interpret:**\n- **Top1 ceiling** = `items[0]` likes — the best-performing note for this keyword. This is the proven demand signal.\n- **Top10 average** = mean likes across `items[0..9]` — how well an average top note does.\n- A high Top1 but low Top10 avg means one outlier dominates; hard to compete.\n- A high Top10 avg means consistent demand; easier to break in.\n\n**Output:** Keyword × engagement table ranked by Top1 ceiling.\n\n| Keyword | Top1 Likes | Top10 Avg | Top1 Collects | Collect/Like |\n|---------|-----------|-----------|---------------|-------------|\n| keyword1 | 12,000 | 3,200 | 5,400 | 45% |\n| keyword2 | 8,500 | 4,100 | 1,200 | 14% |\n\n---\n\n### Module B: Cross-Topic Heatmap\n\n**Answers:** Which topic × scene intersections have demand? Where are the content gaps?\n\n**Commands:**\n```bash\n# Combine base topic with scene/angle keywords\nredbook search \"base topic + scene1\" --sort popular --json\nredbook search \"base topic + scene2\" --sort popular --json\nredbook search \"base topic + scene3\" --sort popular --json\n```\n\n**Fields to extract:** Same as Module A — Top1 `liked_count` for each combination.\n\n**How to interpret:**\n- High Top1 = proven demand for this intersection\n- Zero or very low results = content gap (opportunity or no demand — check if the combination makes sense)\n- Compare across scenes to find which angles resonate most with the base topic\n\n**Output:** Base × Scene heatmap.\n\n```\n             scene1    scene2    scene3    scene4\nbase topic   ████ 8K   ██ 2K     ████ 12K  ░░ 200\n```\n\n---\n\n### Module C: Engagement Signal Analysis\n\n**Answers:** What type of content is each keyword? Reference, insight, or entertainment?\n\n**Commands:** Use search results from Module A, or for a single note:\n```bash\nredbook analyze-viral \"<noteUrl>\" --json\n```\n\n**Fields to extract:**\n- From search results: compute ratios from `interact_info` fields\n- From `analyze-viral`: use pre-computed `engagement.collectToLikeRatio`, `engagement.commentToLikeRatio`, `engagement.shareToLikeRatio`\n\n**How to interpret:** Apply the ratio benchmarks from [XHS Platform Signals](#xhs-platform-signals) above.\n\n**Output:** Per-keyword or per-note classification.\n\n| Keyword | Collect/Like | Comment/Like | Type |\n|---------|-------------|-------------|------|\n| keyword1 | 45% | 8% | 工具型 + 正常互动 |\n| keyword2 | 12% | 22% | 娱乐型 + 讨论型 |\n\n---\n\n### Module D: Creator Discovery & Profiling\n\n**Answers:** Who are the key creators in this niche? What are their strategies?\n\n**Commands:**\n```bash\n# 1. Collect unique user_ids from search results across keywords\n#    Extract from items[].note_card.user.user_id\n\n# 2. For each creator:\nredbook user \"<userId>\" --json\nredbook user-posts \"<userId>\" --json\n```\n\n**Fields to extract:**\n- From `user`: `interactions[]` where `type === \"fans\"` → follower count\n- From `user-posts`: `notes[].interact_info.liked_count` for all posts → compute avg, median, max\n- From `user-posts`: `notes[].display_title` → content patterns, posting frequency\n\n**How to interpret:**\n- **Avg vs. Median likes:** Large gap means viral outliers inflate the average. Median is the \"true\" baseline.\n- **Max / Median ratio:** >5× means they've had breakout hits. Study those notes specifically.\n- **Post frequency:** Count notes to estimate posting cadence. Prolific creators (>3/week) vs. quality-focused (<1/week).\n\n**Output:** Creator comparison table.\n\n| Creator | Followers | Avg Likes | Median | Max | Posts | Style |\n|---------|----------|-----------|--------|-----|-------|-------|\n| @creator1 | 12万 | 3,200 | 1,800 | 45,000 | 89 | Tutorial |\n| @creator2 | 5.4万 | 8,100 | 6,500 | 22,000 | 34 | Story |\n\n---\n\n### Module D2: Known Account Reporting\n\n**Answers:** Given a known list of account IDs/profile URLs, how often did each account post and how did each post perform?\n\nUse this when the user already has KOS/KOC account IDs and wants clean account-scoped metrics. Do **not** approximate this with keyword search; keyword search introduces unrelated posts and noisy attribution.\n\n```bash\nredbook account-report --file accounts.txt --month 2026-07 --json\nredbook account-report \"<profileUrl1>\" \"<profileUrl2>\" --max-pages 2 --json\n```\n\nInput files are newline-separated user IDs or profile URLs; blank lines and `#` comments are ignored. Prefer profile URLs containing `xsec_token` when available. JSON output includes account summary fields (`fetchedPosts`, `postsInMonth`, `complete`, `pagesFetched`), engagement totals and averages, top posts, and per-note rows with title, type, publish time, metrics, and `webUrl`.\n\nDefault mode fetches only the first page per account. `complete: false` means more pages exist. Use `--all` only when the user explicitly wants full history and the account list is small enough to pace safely; otherwise prefer `--max-pages <n>`.\n\n---\n\n### Module E: Content Form Breakdown\n\n**Answers:** Do image-text or video notes perform better for this topic?\n\n**Commands:**\n```bash\nredbook search \"keyword\" --type image --sort popular --json\nredbook search \"keyword\" --type video --sort popular --json\n```\n\n**Fields to extract:**\n- Compare Top1 and Top10 avg `liked_count` and `collected_count` between the two result sets\n- Note the `type` field: `\"normal\"` = image-text, `\"video\"` = video\n\n**Output:** Form × engagement table.\n\n| Form | Top1 Likes | Top10 Avg | Collect/Like |\n|------|-----------|-----------|-------------|\n| 图文 | 8,000 | 2,400 | 42% |\n| 视频 | 15,000 | 5,100 | 18% |\n\n---\n\n### Module F: Opportunity Scoring\n\n**Answers:** Which keywords should I target? Where is the best effort-to-reward ratio?\n\n**Input:** Keyword matrix from Module A.\n\n**Scoring logic:**\n- **Demand** = Top1 likes ceiling (proven audience size)\n- **Competition** = density of high-engagement results (how many notes in Top10 have >1K likes)\n- **Score** = Demand × (1 / Competition density)\n\n**Tier thresholds** (based on Top1 likes):\n\n| Tier | Top1 Likes | Meaning |\n|------|-----------|---------|\n| S | >100,000 (10万+) | Massive demand — hard to compete but huge upside |\n| A | 20,000–100,000 | Strong demand — competitive but winnable |\n| B | 5,000–20,000 | Moderate demand — good for growing accounts |\n| C | <5,000 | Niche — low competition, low ceiling |\n\n**Output:** Tiered keyword list.\n\n| Tier | Keyword | Top1 | Competition | Opportunity |\n|------|---------|------|-------------|------------|\n| A | keyword1 | 45K | Medium (6/10 >1K) | High |\n| B | keyword3 | 12K | Low (2/10 >1K) | Very High |\n| S | keyword2 | 120K | High (10/10 >1K) | Medium |\n\n---\n\n### Module G: Audience Inference\n\n**Answers:** Who is the audience for this niche? What do they want?\n\n**Input:** Engagement ratios from Module C + comment themes from `analyze-viral` + content patterns.\n\n**Fields to extract** from `analyze-viral` JSON:\n- `comments.themes[]` — recurring phrases and keywords from comment section\n- `comments.questionRate` — % of comments that are questions (learning intent)\n- `engagement.collectToLikeRatio` — save behavior signals intent\n- `hook.hookPatterns[]` — what title patterns attract this audience\n\n**Inference rules:**\n- High collect rate + high question rate → learning-oriented audience (students, professionals)\n- High comment rate + emotional themes → community-oriented audience (sharing experiences)\n- High share rate → aspiration-oriented audience (lifestyle, identity signaling)\n- Comment language patterns → age/education signals (formal = older, slang = younger)\n\n**Output:** Audience persona summary — demographics, intent, content preferences.\n\n---\n\n### Module H: Content Brainstorm\n\n**Answers:** What specific content should I create, backed by data?\n\n**Input:** Opportunity scores (Module F) + audience persona (Module G) + heatmap gaps (Module B).\n\n**For each content idea, specify:**\n- **Target keyword** — from opportunity scoring\n- **Hook angle** — based on `hookPatterns` that work for this niche\n- **Content type** — 工具型/认知型/娱乐型 based on what the audience wants\n- **Form** — 图文 or 视频 based on Module E\n- **Engagement target** — realistic based on Top10 avg for this keyword\n- **Competitive reference** — specific note URL that proves this angle works\n\n**Output:** Ranked content ideas with data backing.\n\n| # | Keyword | Hook Angle | Type | Target Likes | Reference |\n|---|---------|-----------|------|-------------|-----------|\n| 1 | keyword3 | \"N个方法...\" (List) | 工具型 图文 | 5K+ | [top note URL] |\n| 2 | keyword1 | \"为什么...\" (Question) | 认知型 视频 | 10K+ | [top note URL] |\n\n---\n\n### Module I: Comment Operations\n\n**Answers:** Which comments deserve a reply? What is the comment quality distribution?\n\n**Commands:**\n```bash\n# 1. Fetch all comments\nredbook comments \"<noteUrl>\" --all --json\n\n# 2. Preview reply candidates (dry run)\nredbook batch-reply \"<noteUrl>\" --strategy questions --dry-run --json\n\n# 3. Execute replies with template (5 min delay with ±30% jitter)\nredbook batch-reply \"<noteUrl>\" --strategy questions \\\n  --template \"感谢提问！关于{content}，...\" \\\n  --max 10\n```\n\n**Fields to extract from `--dry-run` JSON:**\n- `candidates[].commentId` — target comments\n- `candidates[].isQuestion` — boolean, detected question\n- `candidates[].likes` — engagement signal\n- `candidates[].hasSubReplies` — whether already answered\n- `skipped` — how many comments were filtered out\n- `totalComments` — total fetched\n\n**Strategies:**\n- `questions` — replies to comments ending with `？` or `?` (learning-oriented audience)\n- `top-engaged` — replies to highest-liked comments (maximum visibility)\n- `all-unanswered` — replies to comments with no existing sub-replies (fill gaps)\n\n**How to interpret:**\n- High question rate (>15%) = audience is learning-oriented → reply to build authority\n- High top-engaged comments (>100 likes) = reply to visible comments for maximum reach\n- Many unanswered comments = engagement gap, opportunity to increase reply rate\n\n**Safety:** Hard cap 30 replies per batch, minimum 3-minute delay with ±30% jitter (default 5 min), `--dry-run` by default (no template = preview only), immediate stop on captcha. See [Rate Limits & Safety](#rate-limits--safety) for details.\n\n**Output:** Reply plan table with candidate comments, strategy match reason, and status.\n\n---\n\n### Module J: Viral Replication\n\n**Answers:** What structural template can I extract from successful notes to guide new content creation?\n\n**Commands:**\n```bash\n# 1. Find top notes for a keyword\nredbook search \"keyword\" --sort popular --json\n\n# 2. Extract structural template from 2-3 top performers\nredbook viral-template \"<url1>\" \"<url2>\" \"<url3>\" --json\n```\n\n**Fields to extract from `viral-template` JSON:**\n- `dominantHookPatterns[]` — hook types appearing in majority of notes\n- `titleStructure.commonPatterns[]` — specific title formula\n- `titleStructure.avgLength` — target title length\n- `bodyStructure.lengthRange` — target word count [min, max]\n- `bodyStructure.paragraphRange` — target paragraph count\n- `engagementProfile.type` — reference/insight/entertainment\n- `audienceSignals.commonThemes[]` — what the audience talks about\n\n**How to interpret:**\n- Consistent hook patterns across notes = proven formula for this niche\n- Narrow body length range = audience has clear content length preference\n- High collect/like in profile = audience saves content → create reference material\n- Common comment themes = topics to address in new content\n\n**Composition with other modules:**\n- Uses Module A results to identify top URLs for template extraction\n- Feeds into Module H (Content Brainstorm) as structural constraint\n- Uses Module C classification to validate engagement profile\n\n**Output:** Content template spec — the structural skeleton for content creation. An LLM (via the composed workflow) uses this template to generate actual title, body, hashtags, and cover image prompt.\n\n---\n\n### Module K: Engagement Automation\n\n**Answers:** How should I manage ongoing engagement with my audience?\n\nThis module is a workflow that composes Modules I and J with human oversight.\n\n**Workflow:**\n1. **Monitor** — `redbook comments \"<myNoteUrl>\" --all --json` to fetch recent comments\n2. **Filter** — `redbook batch-reply --strategy questions --dry-run` to identify reply candidates\n3. **Review** — Human reviews dry-run output (or LLM reviews with persona guidelines)\n4. **Execute** — `redbook batch-reply --strategy questions --template \"...\" --max 10`\n5. **Report** — Summary of replies sent, errors encountered, rate limit status\n\n**Safety rules:**\n- Always `--dry-run` first, human approval before execution\n- Maximum 30 replies per session (hard cap)\n- Minimum 3-minute delay between replies, default 5 minutes, with ±30% random jitter\n- Never reply to the same comment twice (check `hasSubReplies`)\n- Stop immediately on captcha — do not retry\n- See [Rate Limits & Safety](#rate-limits--safety) for XHS risk control thresholds\n\n**Anti-spam guidelines:**\n- Vary reply templates across batches\n- Limit to 1-2 batch runs per note per day\n- Prioritize quality (targeted strategy) over quantity\n- Uniform timing patterns trigger bot detection — jitter is applied automatically\n\n---\n\n### Module L: Card Rendering\n\n**Answers:** How do I turn markdown content into Xiaohongshu-ready image cards?\n\n**Commands:**\n```bash\n# Render markdown to styled PNG cards\nredbook render content.md --style xiaohongshu\n\n# Custom style and output directory\nredbook render content.md --style dark --output-dir ./cards\n\n# JSON output (for programmatic use)\nredbook render content.md --json\n```\n\n**Input:** Markdown file with YAML frontmatter:\n```markdown\n---\nemoji: \"🚀\"\ntitle: \"5个AI效率技巧\"\nsubtitle: \"Claude Code 实战\"\n---\n\n## 技巧一：...\nContent here...\n\n---\n\n## 技巧二：...\nMore content...\n```\n\n**Output:** `cover.png` + `card_1.png`, `card_2.png`, ... in the same directory.\n\n**Card specs:**\n- **Size:** 1080×1440 (3:4 ratio, standard XHS image)\n- **DPR:** 2 (retina quality, actual output 2160×2880)\n- **Styles:** purple, xiaohongshu, mint, sunset, ocean, elegant, dark\n\n**Pagination modes:**\n- `auto` (default) — smart split on heading/paragraph boundaries using character-count heuristic\n- `separator` — manual split on `---` in markdown\n\n**How to interpret:**\n- Uses the user's existing Chrome for rendering (via `puppeteer-core`) — no browser download needed\n- Purely offline — no XHS API or cookies required\n- Output images are ready for `redbook post --images cover.png card_1.png ...`\n\n**Dependencies:** Requires `puppeteer-core` and `marked` (optional, install with `npm install -g puppeteer-core marked`).\n\n**Composition with other modules:**\n- Pairs with Module H (Content Brainstorm) — generate content ideas, write markdown, render to cards\n- Pairs with Module J (Viral Replication) — extract template, write content matching the template, render\n- Output feeds into `redbook post --images` for publishing\n\n---\n\n### Module M: Note Health Check (限流检测)\n\n**Answers:** Are any of my notes being secretly rate-limited by XHS?\n\nXHS assigns a hidden `level` field to each note in the creator backend API. This level controls recommendation distribution but is **never shown in the UI**. Your note may look \"normal\" while secretly receiving zero recommendations.\n\n**Commands:**\n```bash\n# Check all notes (first page)\nredbook health\n\n# Check all pages\nredbook health --all\n\n# JSON output for programmatic use\nredbook health --all --json\n```\n\n**Level definitions:**\n\n| Level | Status | Meaning |\n|-------|--------|---------|\n| 4 | 🟢 Normal | Full recommendation distribution |\n| 2-3 | 🟡 Baseline | Basically normal, minor constraints |\n| 1 | ⚪ New | Under review (new post) |\n| -1 | 🔴 Soft limit | Mild throttling, decreased recommendations |\n| -5 to -101 | 🔴 Moderate | Moderate throttling, minimal promotion |\n| -102 | ⛔ Severe | Irreversible — must delete and repost |\n\n**Additional checks:**\n- **Sensitive word detection** — flags titles containing automation/AI keywords (自动化, AI生成, 批量, etc.)\n- **Tag count warning** — flags notes with >5 hashtags (risk factor)\n\n**How to interpret:**\n- Level -1 or below = your note is being throttled. Consider editing or deleting + reposting.\n- Level -102 = irreversible. Delete the note and create fresh content.\n- Sensitive word hits = risky title keywords that may trigger throttling. Rephrase.\n- Excessive tags = potential spam signal. Use 3-5 targeted tags.\n\n**Output:** Terminal dashboard with color-coded distribution summary, limited notes list, and risk factor warnings.\n\n**Discovery credit:** [@xxx111god](https://x.com/xxx111god) — [xhs-note-health-checker](https://github.com/jzOcb/xhs-note-health-checker)\n\n---\n\n## Composed Workflows\n\nCombine modules for different analysis depths.\n\n### Quick Topic Scan (~5 min)\n**Modules:** A → C → F\n\nSearch 3–5 keywords, classify engagement type, rank opportunities. Good for quickly validating whether a niche is worth deeper research.\n\n### Content Planning\n**Modules:** A → B → E → F → H\n\nBuild keyword matrix, map topic × scene intersections, check content form performance, score opportunities, brainstorm specific content ideas.\n\n### Creator Competitive Analysis\n**Modules:** A → D\n\nFind who dominates a niche and study their content strategy, posting frequency, and engagement patterns.\n\n### Full Niche Analysis\n**Modules:** A → B → C → D → E → F → G → H\n\nThe comprehensive playbook — keyword landscape, cross-topic heatmap, engagement signals, creator profiles, content form analysis, opportunity scoring, audience personas, and data-backed content ideas.\n\n### Single Note Deep-Dive\n**Command:** `redbook analyze-viral \"<url>\" --json`\n\nNo module composition needed — `analyze-viral` returns hook analysis, engagement ratios, comment themes, author baseline comparison, and a 0-100 viral score in one call.\n\n### Viral Pattern Research → Content Template\n```bash\n# 1. Find top notes\nredbook search \"keyword\" --sort popular --json\n\n# 2. Extract template from top 3 notes (replaces manual synthesis)\nredbook viral-template \"<url1>\" \"<url2>\" \"<url3>\" --json\n```\n\n`viral-template` automates what previously required manual synthesis across `analyze-viral` results. It outputs a `ContentTemplate` JSON that captures dominant hooks, body structure ranges, engagement profile, and audience signals.\n\n### Reply Management\n**Modules:** I\n\nSingle-module workflow for managing comment engagement on your notes. Use `batch-reply --dry-run` to audit, then execute with a template.\n\n### Content Replication\n**Modules:** A → J → H → L\n\nKeyword research → viral template extraction → data-backed content brainstorm → render to image cards. The template provides structural constraints that guide Module H's content ideas. Module L renders the final markdown to XHS-ready PNGs.\n\n### Content Creation End-to-End\n**Modules:** A → J → H → L → `post`\n\nThe full pipeline: research keywords → extract viral template → brainstorm content → write markdown → render to styled image cards → publish via `redbook post --images cover.png card_1.png ...`\n\n### Account Health Monitoring\n**Modules:** M\n\nRun `redbook health --all` periodically to catch throttled notes early. If level drops below 1, investigate the note's content for policy violations. Combine with Module I to check if throttled notes still have unanswered comments worth replying to.\n\n### Full Operations\n**Modules:** A → C → I → J → K → M\n\nComprehensive automation playbook — keyword analysis, engagement classification, comment operations, viral replication templates, and engagement automation workflow.\n\n---\n\n## Rate Limits & Safety\n\nXHS enforces aggressive anti-spam (风控) that detects automated behavior through device fingerprinting, activity ratio monitoring, and timing pattern analysis. The CLI applies safe defaults based on platform research.\n\n### Safe Thresholds\n\n| Action | Safe Interval | CLI Default | Hard Cap |\n|--------|--------------|-------------|----------|\n| Post a note | 3-4 hours (2-3 notes/day max) | N/A (manual) | — |\n| Comment | ≥3 minutes | N/A (manual) | — |\n| Reply | ≥3 minutes | N/A (manual) | — |\n| Batch reply delay | ≥3 minutes | 5 min ±30% jitter | — |\n| Batch reply count | — | 10 | 30 |\n\n### Anti-Detection Measures\n\n- **Timing jitter:** ±30% random variation on all batch delays. Uniform intervals are a bot signature.\n- **Hard caps:** Maximum 30 replies per batch (down from 50). No override.\n- **Rate limit warnings:** `post`, `comment`, and `reply` commands display safe interval reminders after each action.\n- **Captcha circuit breaker:** Batch operations stop immediately on captcha (NeedVerify).\n\n### What Triggers Risk Control\n\n- **Uniform timing** — replying at exact 3-second intervals flags bot detection\n- **High frequency** — >50 interactions/minute across any action type\n- **Activity ratio anomaly** — more comments than post views signals inauthentic behavior\n- **Device fingerprint mismatch** — XHS fingerprints 21 hardware parameters\n\n### Best Practices for Agents\n\n1. Always `--dry-run` first, review candidates, then execute\n2. Use the default 5-minute delay — do not override `--delay` below 180000 (3 min)\n3. Limit batch runs to 1-2 per note per day\n4. Vary reply templates between batches\n5. Space `post` commands 3-4 hours apart (2-3 notes/day maximum)\n\n---\n\n## Research Loop — Rate-Limit-Safe Long-Running Research\n\nThe [Rate Limits & Safety](#rate-limits--safety) section above paces *writes*. This section paces **reads** — the part research actually hammers. `read`, `comments`, and `analyze-viral` each hit the note-detail API (with `xsec_token`); fire 30–50 in a tight loop and XHS returns `NeedVerify` / captcha or IP-blocks you (300012), and a tripped account stays degraded for **hours**. So research here is **paced, not parallel**: one note in flight, spaced to look like a human reading rather than a script scraping.\n\nThe mechanism is a **file-based loop**: a queue of work items on disk, one item processed per \"tick\", every result checkpointed immediately. Because all state lives in files, the loop is **resumable and survives the session ending** — a fresh session (or a Push heartbeat) picks up exactly where the last left off. Pairs with the `/checkpoint-research` skill for the synthesis step.\n\n### Pace — the safe band (why these numbers)\n\nThese are calibrated to XHS's documented read-side safe band, not guesswork. Community crawlers ([MediaCrawler](https://github.com/NanmiCoder/MediaCrawler)) default to **~2 s/request, single-threaded** (`CRAWLER_MAX_SLEEP_SEC = 2`, `MAX_CONCURRENCY_NUM = 1`); reverse-engineering write-ups put the \"looks-human\" frequency at **3–8 s/request** and the per-IP ceiling at **≤5 requests/min** (~12 s average). This skill runs on your **real logged-in cookies + residential IP + real Chrome fingerprint** — the *lowest*-detection profile (the thing scrapers spend most of their effort faking). So the binding risk isn't request signature, it's **behavioral**: a human doesn't open 100 note-detail pages in two minutes. We therefore pace to a human reading cadence — comfortably inside the safe band — rather than to the absolute minimum. (5-minute gaps, an earlier guess, are ~25× slower than the ceiling and buy nothing.)\n\n### The real rule: behave like a human reading (not \"go slow\")\n\nDetection here is **distributional, not a rate threshold.** XHS doesn't ask \"more than N requests?\" — it models what a human session looks like and flags the *unlikely* ones. Pure speed isn't the tell; the **shape** of the behavior is. Three things give a script away:\n\n- **Timing micro-structure.** A human's gaps between actions are high-variance and heavy-tailed (2 s, then 40 s, then 5 min — they read, scroll, get distracted). A script emits a tight, low-variance stream. *Three distinct searches in five seconds has near-zero variance and is faster than a person can read a result page* — that single fact is a stronger signal than the total count.\n- **Session macro-structure.** Humans browse depth-first: search → open a note → dwell → open a related note → wander. A scrape is breadth-first enumeration: search A, search B, search C… never clicking in, never dwelling. A keyword list run top-to-bottom *is* the signature.\n- **Action composition.** Real sessions mix likes, collects, dwell, scroll, video-watch. A research run is 100% read with zero dwell and zero engagement — an impossible ratio for a person.\n\nSo the rule is **not \"go slow.\"** It's **make the session indistinguishable from a person reading**: human-shaped *variance* (jitter + the occasional long pause, not merely a bigger constant), one note at a time *with dwell*, depth over breadth, a ceiling because people don't open hundreds of things, and **stop at the first sign of friction** (a human who hits a captcha backs off; a bot retries — so the circuit breaker is itself human-like behavior).\n\n**Safety-first is the *more* agentic posture, not the timid one.** An agent's real advantage isn't speed — it's *patience at scale*: it can run a human-shaped loop for eight hours, which no person will. Aggression imitates the one human trait that gets you caught (impatience) and wastes the one the agent uniquely has (tireless patience). Lean into the patience.\n\n**This is a pattern, not a blacklist.** The numbers here were calibrated from a real incident — a beverage-trend sweep that fired *3 distinct searches in ~5 seconds* across ~17 unrelated keywords and drew an account-level warning. What's encoded is the *behavioral invariant* (human-shaped timing, one-in-flight, ceiling, dwell, breaker), **not** \"don't run those queries.\" It generalizes to any topic and any platform. The incident is the calibration sample that tells us where the human/bot line sits — not a rule about matcha.\n\n### Three modes\n\n| Mode | Pace per note | ~Reads/min | Use when | Gate |\n|------|--------------|-----------|----------|------|\n| 🚶 **Steady (default)** | **20 s ± 50% jitter** (≈10–35 s) | ~2–3 | All routine / multi-note research | **None — this is the default.** |\n| 🐢 **Deep / overnight** | 60–120 s | ~0.5–1 | Very large corpora, or minimizing footprint | Opt in for big jobs |\n| ⚡ **Fast (emergency)** | **5 s ± jitter floor**, max 30-note burst then cooldown | ~10+ (over the safe ceiling) | A genuine deadline that cannot wait | MUST print the [fast-mode warning](#-fast-mode-warning-emergency-only) verbatim **and** get explicit user opt-in |\n\n**Invariants (all modes):** never zero-delay, never parallel, exactly one note in flight, and — except for warned Fast mode — **never exceed ~5 reads/min sustained.** At the Steady pace a 100-note queue finishes in ~35–50 min; only very large queues or Deep mode stretch toward end-of-day.\n\n### Strict rules (non-negotiable)\n\n1. **The loop is mandatory; Steady is the default pace.** Any research touching more than ~5 notes runs through the loop at Steady pace. Deep/overnight and especially Fast are explicit opt-ins — Fast additionally requires the printed warning + user confirmation.\n2. **One note in flight.** Never batch or parallelize reads. No `for url in …; do redbook read …; done` without the inter-item delay. No background `&` fan-out. (`MAX_CONCURRENCY = 1`, like the reference crawlers.)\n3. **Stay under ~5 reads/min, always jittered.** The per-IP safe ceiling is ~5 requests/min (~12 s/note); Steady (20 s) sits comfortably under it. Apply ±50% random jitter to every wait — uniform intervals are a bot signature. Only warned Fast mode may cross the ceiling.\n4. **Cap comment pagination.** Comment / sub-comment reads are the highest-risk endpoint — they trip 风控 first (deep comment crawls fail even at very long sleeps). Keep `--comment-pages ≤ 3`, count each comment page against the pace + budget like any other read, and never deep-crawl a comment thread.\n5. **Checkpoint every item.** Write each result to disk and update the manifest *before* the next tick. Nothing in memory only.\n6. **Respect the daily budget.** Default soft cap **~200 detail-reads/day** — anomalous *volume* is its own 风控 trigger, independent of pace. When `consumedToday >= dailyBudget`, stop until the next calendar day — do not \"just finish a few more\".\n7. **Circuit breaker is absolute.** On the first 风控 signal (see [Circuit breaker](#circuit-breaker)), STOP the entire loop, persist state, surface to the user, and **do not auto-retry through it.** Resume only on an explicit human \"resume\".\n8. **Reads, not writes.** This loop is for reading/analysis only. Engagement actions (comment/reply/like) keep their own [write-side limits](#rate-limits--safety) and are never folded into a research tick.\n\n### State contract (resumable, survives session death)\n\nAll state lives under one job directory — default `research/xhs/<job-slug>/` in the **private content repo** (ask if unclear which repo):\n\n| File | Role |\n|------|------|\n| `queue.jsonl` | The work queue, one item per line: `{ \"id\": \"001\", \"kind\": \"read\\|comments\\|analyze-viral\\|search\\|user\\|user-posts\", \"arg\": \"<url-or-keyword-or-userId>\", \"status\": \"pending\\|done\\|error\", \"note\": \"\" }` |\n| `results/<id>.json` | Raw `--json` output for each processed item (the corpus) |\n| `loop-state.json` | `{ \"mode\": \"steady\\|deep\\|fast\", \"intervalSec\": 20, \"jitterPct\": 50, \"dailyBudget\": 200, \"consumedToday\": 0, \"budgetDate\": \"YYYY-MM-DD\", \"lastTickAt\": \"<iso>\", \"breaker\": \"ok\\|tripped\", \"breakerReason\": null }` (Deep: `intervalSec` 60–120; Fast: `intervalSec` 5 + `mode:\"fast\"`) |\n| `manifest.md` | Human-readable plan + progress (checkmark per done item) — the recovery checkpoint, updated every tick |\n| `SUMMARY.md` | Final synthesis, written once the queue drains |\n\n**Seeding the queue:** the cheap list endpoints (`search`, `feed`, and `user-posts` with a fresh profile URL/token) are how you *build* the queue, not part of the paced loop. Run a `search`/`feed` up front, extract each note `webUrl`, and write one `read`/`analyze-viral` item per note into `queue.jsonl`. Then the loop drains the expensive detail-reads at the Steady pace. Always carry the fresh `webUrl` (with token) as the item `arg` — tokens expire, so don't queue bare noteIds (see [xsec_token](#xsec_token--required-for-reading--sharing-notes)). For creator queues, prefer a profile URL containing `xsec_token`; bare userIds may return `code=-1`.\n\n### One tick = one note\n\nA tick is the unit both drivers call. It processes exactly one item and stops:\n\n1. **Load `loop-state.json`.** If `breaker != \"ok\"` → exit immediately (surface the reason; do not process).\n2. **Roll the daily budget.** If `budgetDate` != today, reset `consumedToday = 0`, `budgetDate = today`. If `consumedToday >= dailyBudget` → exit until tomorrow.\n3. **Pop the next `pending` item** from `queue.jsonl`. If none remain → **finalize**: synthesize `SUMMARY.md` from `results/`, mark the loop complete, and tell the driver to stop. Done.\n4. **Run exactly one read:** `redbook <kind> \"<arg>\" --json`.\n5. **Inspect the result for a 风控 signal** (empty `{}`, `NeedVerify`/captcha, `Session expired`, IP block 300012). If found → **trip the breaker**: set `breaker:\"tripped\"` + `breakerReason`, leave the item `pending` (not consumed), persist, surface to the user, STOP. (See [Circuit breaker](#circuit-breaker).)\n6. **On success:** write `results/<id>.json`, set the item `status:\"done\"`, check it off in `manifest.md`, `consumedToday += 1`, set `lastTickAt`.\n7. **Stop.** One note only — the driver re-invokes after the (jittered) interval.\n\n### Drivers — keeping the loop running in the background\n\nThe same tick, driven two ways. Pick by how long the job must outlive the current session:\n\n**A) In-session pacing (default — Steady).** The simplest driver and the right one for most jobs: run ticks back-to-back inside one session, sleeping `intervalSec` ± jitter between each read. At Steady pace a 100-note queue finishes in ~35–50 min — comfortably within one session — and every item is checkpointed, so a crash just resumes. No scheduler needed. (Pace *per read*; don't fake it with one long blocking `sleep`.)\n\n**B) `/loop` self-paced (Deep / overnight / survives idle gaps).** For Deep mode or jobs spanning hours, drive ticks with `/loop` *without* an interval (self-paced): do one tick, then `ScheduleWakeup` for `intervalSec` + jitter, and re-fire. `ScheduleWakeup` clamps to **≥60 s**, so it fits Deep (60–120 s) — not sub-minute Steady (run that in-session, per A). The loop ends itself when the queue drains (Step 3) or the breaker trips (Step 5).\n\n**C) Hook — Push recurring issue (multi-day / true background, survives app restarts).** Best for \"run this every day\" research or corpora too big for one day. Create a **recurring issue** (`recurringIntervalSec` — a few minutes per tick, or a daily sweep) assigned to a redbook-capable agent. Each occurrence is a **fresh session = one tick** against the same job directory — so the issue body must point at the job dir and say \"run exactly one tick, then exit.\" It keeps firing until a human retires it; the agent finalizes + comments when the queue drains, and comments + leaves it for human attention if the breaker trips. (Push \"scout\" pattern — the schedule lives on the issue, the agent's Auto switch gates it.)\n\n> **Why file-state, not a long-lived process:** a single blocking `sleep`-loop dies with the terminal and can't be resumed. The queue + `loop-state.json` + per-item result files mean *any* future session — `/loop` wake, Push heartbeat, or a human re-running the tick — continues exactly where the last stopped, and the partial corpus is never lost.\n\n### ⚡ Fast-mode warning (emergency only)\n\nBefore **any** fast-mode run, print this verbatim and require an explicit \"yes, fast mode\" from the user. Do not proceed on silence or a vague affirmative:\n\n```\n⚠️  XHS FAST RESEARCH MODE — elevated 风控 risk\n    Reading at ~12 notes/min crosses the safe ~5/min ceiling and\n    materially raises the chance of:\n      • captcha / NeedVerify mid-run (stops the loop)\n      • IP block (error 300012) for hours\n      • account-level recommendation throttling\n    Steady mode (the default, ~20s/note) stays inside the safe band\n    and still finishes a typical job in well under an hour.\n    Proceed with fast mode for this run only? (yes / no)\n```\n\nFast mode still obeys the floor (≥5 s ± jitter between notes — never zero), caps a burst at 30 notes then forces a cooldown back to Steady pace, and the circuit breaker still hard-stops on the first 风控 signal. Fast mode raises the *pace* past the safe ceiling; it never removes the floor or the breaker.\n\n### Circuit breaker\n\nTrip the breaker and STOP the whole loop on the **first** of any of these from a read:\n\n| Signal | Where it shows |\n|--------|----------------|\n| `NeedVerify` / captcha | error message or response flag |\n| Empty `{}` response | usually expired/invalid `xsec_token` or anti-scrape — re-seed the queue with fresh `webUrl`s, don't retry blindly |\n| `Session expired` / \"No 'a1' cookie\" | cookie invalid — re-login in Chrome before resuming |\n| IP block `300012` | hard rate limit — wait it out / switch network |\n\nOn trip: set `loop-state.breaker:\"tripped\"` + `breakerReason`, leave the current item `pending`, persist, and surface to the user (or comment on the Push issue). **Never auto-retry through a block** — that's what escalates a soft throttle into a multi-hour block. Resume only after a human clears the cause and explicitly says to continue.\n\n---\n\n## API vs Browser Limitations\n\nThe following operations work reliably via API:\n- **Reading**: search, notes, comments, user profiles, feed, favorites\n- **Writing**: top-level comments, comment replies, collect/uncollect notes\n- **Analysis**: viral scoring, template extraction, batch reply planning\n\nThe following operations are unreliable via API (frequently trigger captcha):\n- Publishing notes (use `--private` for higher success rate)\n- Bulk operations at very high frequency\n\nThe following operations require browser automation (not supported by this CLI):\n- Captcha solving, real-time notifications\n- Like/follow (heavy anti-automation enforcement)\n- DM/private messaging\n- Cover image generation (use external tools like Gemini/DALL-E)\n\n---\n\n## Command Details\n\n### `redbook search <keyword>`\n\nSearch for notes by keyword. Returns note titles, URLs, likes, author info.\n\n```bash\nredbook search \"Claude Code教程\" --json\nredbook search \"AI编程\" --sort popular --json        # Sort: general, popular, latest\nredbook search \"Cursor\" --type image --json           # Type: all, video, image\nredbook search \"MCP Server\" --page 2 --json           # Pagination\n```\n\n**Options:**\n- `--sort <type>`: `general` (default), `popular`, `latest`\n- `--type <type>`: `all` (default), `video`, `image`\n- `--page <n>`: Page number (default: 1)\n\n### `redbook read <url>`\n\nRead a note's full content — title, body text, images, likes, comments count.\n\n```bash\nredbook read \"https://www.xiaohongshu.com/explore/abc123\" --json\n```\n\nAccepts full URLs or short note IDs. Falls back to HTML scraping if API returns captcha.\n\n### `redbook comments <url>`\n\nGet comments on a note. Use `--all` to fetch all pages.\n\n```bash\nredbook comments \"https://www.xiaohongshu.com/explore/abc123\" --json\nredbook comments \"https://www.xiaohongshu.com/explore/abc123\" --all --json\n```\n\n### `redbook user <userId|profileUrl>`\n\nGet a creator's profile — nickname, bio, follower count, note count, likes received.\n\n```bash\nredbook user \"https://www.xiaohongshu.com/user/profile/5a1234567890abcdef012345?xsec_token=...&xsec_source=pc_search\" --json\n```\n\nAccepts a bare userId or a full profile URL. If a bare userId returns `code=-1`, use a fresh profile URL containing `xsec_token`, or pass `--xsec-token <token> --xsec-source pc_search`.\n\n### `redbook user-posts <userId|profileUrl>`\n\nList all notes posted by a creator. Returns titles, URLs, likes, timestamps.\n\n```bash\nredbook user-posts \"https://www.xiaohongshu.com/user/profile/5a1234567890abcdef012345?xsec_token=...&xsec_source=pc_search\" --json\n```\n\n### `redbook account-report <userId|profileUrl...>`\n\nBatch summarize account posting and engagement metrics.\n\n```bash\nredbook account-report --file accounts.txt --month 2026-07 --json\nredbook account-report \"<profileUrl1>\" \"<profileUrl2>\" --max-pages 2 --json\n```\n\nOptions:\n- `--file <path>`: newline-separated account IDs/profile URLs\n- `--month <YYYY-MM>`: month used for `postsInMonth` (default: current month)\n- `--max-pages <n>`: page cap per account when not using `--all` (default: 1)\n- `--all`: fetch every page for each account\n- `--delay <ms>`: delay between page/account requests (default: 3000)\n\nFor KOS/KOC reporting, feed it known account IDs or profile URLs instead of using keyword search. If a bare userId returns `code=-1`, use a fresh profile URL containing `xsec_token`.\n\n### `redbook feed`\n\nBrowse the recommendation feed.\n\n```bash\nredbook feed --json\n```\n\n### `redbook topics <keyword>`\n\nSearch for topic hashtags. Useful for finding trending topics to attach to posts.\n\n```bash\nredbook topics \"Claude Code\" --json\n```\n\n### `redbook favorites [userId]`\n\nList a user's collected (bookmarked) notes. Defaults to the current logged-in user when no userId is provided.\n\n```bash\nredbook favorites --json                        # Your own favorites\nredbook favorites \"5a1234567890abcdef\" --json   # Another user's favorites\nredbook favorites --all --json                  # Fetch all pages\n```\n\n**Options:**\n- `--all`: Fetch all pages of favorites (default: first page only)\n\n**Note:** Other users' favorites are only visible if they haven't set their collection to private.\n\n### `redbook collect <url>`\n\nCollect (bookmark) a note to your favorites.\n\n```bash\nredbook collect \"https://www.xiaohongshu.com/explore/abc123\"\n```\n\n### `redbook uncollect <url>`\n\nRemove a note from your collection.\n\n```bash\nredbook uncollect \"https://www.xiaohongshu.com/explore/abc123\"\n```\n\n### `redbook analyze-viral <url>`\n\nAnalyze why a viral note works. Returns a deterministic viral score (0–100).\n\n```bash\nredbook analyze-viral \"https://www.xiaohongshu.com/explore/abc123\" --json\nredbook analyze-viral \"https://www.xiaohongshu.com/explore/abc123\" --comment-pages 5\n```\n\n**Options:**\n- `--comment-pages <n>`: Comment pages to fetch (default: 3, max: 10)\n\n**JSON output structure:**\nReturns `{ note, score, hook, content, visual, engagement, comments, relative, fetchedAt }`.\n\n- `score.overall` (0–100) — composite of hook (20) + engagement (20) + relative (20) + content (20) + comments (20)\n- `hook.hookPatterns[]` — detected title patterns (Identity Hook, Emotion Word, Number Hook, Question, etc.)\n- `engagement` — likes, comments, collects, shares + ratios (collectToLikeRatio, commentToLikeRatio, shareToLikeRatio)\n- `relative.viralMultiplier` — this note's likes / author's median likes\n- `relative.isOutlier` — true if viralMultiplier > 3\n- `comments.themes[]` — top recurring keyword phrases from comments\n\n### `redbook viral-template <url> [url2] [url3]`\n\nExtract a reusable content template from 1-3 viral notes. Analyzes each note (same pipeline as `analyze-viral`) and synthesizes common structural patterns.\n\n```bash\nredbook viral-template \"<url1>\" \"<url2>\" \"<url3>\" --json\nredbook viral-template \"<url1>\" --comment-pages 5 --json\n```\n\n**Options:**\n- `--comment-pages <n>`: Comment pages to fetch per note (default: 3, max: 10)\n\n**JSON output structure:**\nReturns `{ dominantHookPatterns, titleStructure, bodyStructure, engagementProfile, audienceSignals, sourceNotes, generatedAt }`.\n\n- `dominantHookPatterns[]` — hook types appearing in majority of input notes\n- `titleStructure.avgLength` — average title length across notes\n- `bodyStructure.lengthRange` — [min, max] body length\n- `engagementProfile.type` — \"reference\" / \"insight\" / \"entertainment\"\n- `audienceSignals.commonThemes[]` — merged comment themes across notes\n\n### `redbook comment <url>`\n\nPost a top-level comment on a note.\n\n```bash\nredbook comment \"<noteUrl>\" --content \"Great post!\" --json\n```\n\n**Options:**\n- `--content <text>` (required): Comment text\n\n### `redbook reply <url>`\n\nReply to a specific comment on a note.\n\n```bash\nredbook reply \"<noteUrl>\" --comment-id \"<commentId>\" --content \"Thanks for asking!\" --json\n```\n\n**Options:**\n- `--comment-id <id>` (required): Comment ID to reply to (from `comments --json` output)\n- `--content <text>` (required): Reply text\n\n### `redbook batch-reply <url>`\n\nReply to multiple comments using a filtering strategy. Always preview with `--dry-run` first.\n\n```bash\n# Preview which comments match the strategy\nredbook batch-reply \"<noteUrl>\" --strategy questions --dry-run --json\n\n# Execute replies with a template (default 5 min delay with jitter)\nredbook batch-reply \"<noteUrl>\" --strategy questions \\\n  --template \"感谢提问！{content}\" --max 10\n```\n\n**Options:**\n- `--strategy <name>`: `questions` (default), `top-engaged`, `all-unanswered`\n- `--template <text>`: Reply template with `{author}`, `{content}` placeholders\n- `--max <n>`: Max replies (default: 10, hard cap: 30)\n- `--delay <ms>`: Delay between replies in ms (default: 300000 / 5 min, min: 180000 / 3 min). ±30% random jitter applied automatically.\n- `--dry-run`: Preview candidates without posting (default when no template)\n\n**Safety:** Stops immediately on captcha. No template = dry-run only. Delays include random jitter to avoid uniform timing patterns that trigger XHS bot detection.\n\n### `redbook render <file>`\n\nRender a markdown file with YAML frontmatter into styled PNG image cards. Uses the user's existing Chrome installation — no browser download needed.\n\n```bash\nredbook render content.md --style xiaohongshu\nredbook render content.md --style dark --output-dir ./cards\nredbook render content.md --pagination separator --json\n```\n\n**Options:**\n- `--style <name>`: `purple`, `xiaohongshu` (default), `mint`, `sunset\n\nFile v0.8.2:README.md\n\n# redbook — 小红书命令行工具\n\n小红书 CLI 工具：搜索笔记、阅读内容、分析博主、发布图文。使用浏览器 Cookie 认证，无需 API Key。\n\n[English](#english) | 中文\n\n> ### 最快上手方式\n>\n> 把这段话发给你的 AI 助手（Claude Code、Cursor、Codex、Windsurf、OpenClaw 等）：\n>\n> **\"帮我用 npm 安装 `@lucasygu/redbook` 这个小红书 CLI 工具，然后运行 `redbook whoami` 验证是否能正常连接。GitHub 地址：https://github.com/lucasygu/redbook\"**\n>\n> OpenClaw 用户也可以直接：**`clawhub install redbook`**\n>\n> AI 会自动完成安装、验证连接、处理可能的 Cookie 问题。你只需要确保已在 Chrome 中登录 xiaohongshu.com。\n>\n> 安装完成后，试试：**\"帮我分析'AI编程'这个话题在小红书上的竞争格局\"** —— AI 会自动搜索关键词、分析互动数据、发现头部博主、给出内容建议。\n\n## 安装\n\n```bash\nnpm install -g @lucasygu/redbook\n# 或通过 ClawHub（OpenClaw 生态）\nclawhub install redbook\n```\n\n需要 Node.js >= 22。支持 **macOS、Windows、Linux**。使用 Chrome 浏览器的 Cookie —— 请先在 Chrome 中登录 xiaohongshu.com。\n\n安装后运行 `redbook whoami` 验证连接。CLI 会自动检测所有 Chrome 配置文件，找到你的小红书登录状态。\n\n- **macOS** —— 如果遇到钥匙串弹窗，请点击\"始终允许\"\n- **Windows** —— Chrome 127+ 使用了 App-Bound Encryption，CLI 会自动启动 Chrome headless 模式读取 Cookie（需要先关闭 Chrome）。如果自动提取失败，可以用 `--cookie-string` 手动传入\n\n## 能做什么\n\n- **话题研究** —— 搜索关键词，分析哪些话题有流量、哪些是蓝海\n- **竞品分析** —— 找到头部博主，对比粉丝量、互动数据、内容风格\n- **爆款拆解** —— 分析爆款笔记的标题钩子、互动比例、评论主题\n- **爆款模板** —— 从多篇爆款笔记提取内容模板（标题结构、正文结构、钩子模式）\n- **限流检测** —— 检测笔记是否被隐形限流（通过创作者后台 API 的隐藏 level 字段）\n- **收藏专辑** —— 查看收藏专辑内容，分析专辑内的笔记\n- **收藏管理** —— 查看收藏列表、收藏/取消收藏笔记（支持自己和其他用户的公开收藏）\n- **评论管理** —— 发评论、回复评论、按策略批量回复（问题优先 / 高赞优先 / 未回复优先）\n- **图文卡片** —— Markdown 渲染为小红书风格的 PNG 图文卡片（7 种配色主题）\n- **内容策划** —— 基于数据发现内容机会，生成有数据支撑的选题建议\n- **受众洞察** —— 从互动信号推断目标用户画像\n\n通过 AI 助手使用时，这些工作流可以自动串联完成。直接使用 CLI 时，每个命令也可以独立运行。\n\n## 快速开始\n\n```bash\n# 检查连接\nredbook whoami\n\n# 搜索笔记\nredbook search \"AI编程\" --sort popular\n\n# 阅读笔记\nredbook read https://www.xiaohongshu.com/explore/abc123\n\n# 获取评论\nredbook comments https://www.xiaohongshu.com/explore/abc123 --all\n\n# 浏览推荐页\nredbook feed\n\n# 查看博主信息\nredbook user \"<profileUrl>\"\nredbook user-posts \"<profileUrl>\"\nredbook account-report --file kos-accounts.txt --month 2026-07 --json\n\n# 搜索话题标签\nredbook topics \"Claude Code\"\n\n# 查看收藏（默认当前用户）\nredbook favorites --json\nredbook favorites <userId> --json --all\n\n# 收藏/取消收藏\nredbook collect \"<noteUrl>\"\nredbook uncollect \"<noteUrl>\"\n\n# 分析爆款笔记\nredbook analyze-viral https://www.xiaohongshu.com/explore/abc123\n\n# 从多篇爆款提取内容模板\nredbook viral-template \"<url1>\" \"<url2>\" \"<url3>\" --json\n\n# 发评论\nredbook comment \"<noteUrl>\" --content \"写得好！\"\n\n# 回复评论\nredbook reply \"<noteUrl>\" --comment-id \"<id>\" --content \"感谢提问！\"\n\n# 按策略批量回复（先预览再执行）\nredbook batch-reply \"<noteUrl>\" --strategy questions --dry-run\nredbook batch-reply \"<noteUrl>\" --strategy questions --template \"感谢！{content}\" --max 10\n\n# 查看收藏专辑\nredbook boards                          # 列出自己的专辑\nredbook boards <userId>                 # 列出他人的专辑\nredbook board \"https://www.xiaohongshu.com/board/abc123\"\nredbook board abc123 --json\n\n# 检测笔记限流状态\nredbook health\nredbook health --all --json\n\n# 将 Markdown 渲染为图文卡片（需要可选依赖）\nredbook render content.md --style xiaohongshu\nredbook render content.md --style dark --output-dir ./cards\n\n# 发布图文笔记\nredbook post --title \"标题\" --body \"正文内容\" --images cover.png\nredbook post --title \"测试\" --body \"...\" --images img.png --private\n```\n\n## 命令一览\n\n| 命令 | 说明 |\n|------|------|\n| `whoami` | 查看当前登录账号 |\n| `search <关键词>` | 搜索笔记 |\n| `read <url>` | 阅读单篇笔记 |\n| `comments <url>` | 获取笔记评论 |\n| `user <userId\\|profileUrl>` | 查看用户资料 |\n| `user-posts <userId\\|profileUrl>` | 列出用户所有笔记 |\n| `account-report <user...>` | 批量统计账号发帖和互动数据 |\n| `feed` | 获取推荐页内容 |\n| `post` | 发布图文笔记（易触发验证码，详见下方说明） |\n| `topics <关键词>` | 搜索话题/标签 |\n| `favorites [userId]` | 查看收藏笔记列表（默认当前用户） |\n| `collect <url>` | 收藏（书签）笔记 |\n| `uncollect <url>` | 取消收藏笔记 |\n| `health` | 检测笔记隐形限流（通过创作者后台隐藏 level 字段） |\n| `boards [userId]` | 列出用户的收藏专辑（默认当前用户） |\n| `board <url>` | 查看收藏专辑内容（接受专辑 URL 或 ID） |\n| `analyze-viral <url>` | 分析爆款笔记（钩子、互动、结构） |\n| `viral-template <url...>` | 从 1-3 篇爆款笔记提取内容模板 |\n| `comment <url>` | 发表评论 |\n| `reply <url>` | 回复指定评论 |\n| `batch-reply <url>` | 按策略批量回复评论（支持预览模式） |\n| `render <文件>` | Markdown 渲染为小红书图文卡片 PNG（需可选依赖） |\n| `auth` | 保存、导出、检查 Cookie 文件，适合云端/OpenClaw 使用 |\n\n### 通用选项\n\n| 选项 | 说明 | 默认值 |\n|------|------|--------|\n| `--cookie-source <浏览器>` | Cookie 来源浏览器（chrome, safari, firefox） | `chrome` |\n| `--chrome-profile <名称>` | Chrome 配置文件目录名（如 \"Profile 1\"），默认自动检测 | 自动 |\n| `--cookie-string <cookies>` | 手动传入 Cookie 字符串：`\"a1=值; web_session=值\"`（从 Chrome DevTools 复制） | 无 |\n| `--platform <name>` | 强制后端：`xhs`（大陆）或 `rednote`（全球版），不传则自动检测 | 自动 |\n| `--global` | 强制使用全球版 RedNote 后端（等同 `--platform rednote`） | 无 |\n| `--json` | JSON 格式输出 | `false` |\n\n### 保存 Cookie / 云端使用\n\n如果在 OpenClaw、云服务器或 CI 里运行，不想每条命令都加 `--cookie-string`，可以把 Cookie 保存成文件。普通命令会按这个顺序读取 Cookie：`--cookie-string` → `REDBOOK_COOKIE_STRING` → `REDBOOK_COOKIE_FILE` → `~/.redbook/cookies.json` → 本机浏览器。\n\n```bash\n# 本地浏览器已登录时，导出到默认路径 ~/.redbook/cookies.json\nredbook auth export\n\n# 或手动保存从 DevTools 复制的 Cookie 字符串\nredbook auth save --cookie-string \"a1=值; web_session=值\"\n\n# 查看保存位置和键名（不会打印 Cookie 值）\nredbook auth path\nredbook auth inspect\n\n# 上传 ~/.redbook/cookies.json 到云端后，普通命令会自动读取\nredbook whoami\n\n# 如果放在自定义路径\nexport REDBOOK_COOKIE_FILE=/secure/path/redbook-cookies.json\nredbook search \"AI编程\" --json\n```\n\nCookie 文件是明文登录凭据，默认写入权限为 `0600`。不要提交到 Git，也不要贴到日志里。需要撤销时可以删除文件或执行 `redbook auth clear`，然后在浏览器里退出登录/重新登录刷新会话。\n\n### 用户主页选项\n\n`user` 和 `user-posts` 可以接受完整主页 URL，例如 `https://www.xiaohongshu.com/user/profile/<id>?xsec_token=...&xsec_source=pc_search`。如果只有用户 ID，但接口返回 `code=-1`，请从搜索结果或浏览器地址栏复制带 `xsec_token` 的主页 URL，或手动传入：\n\n```bash\nredbook user \"<userId>\" --xsec-token \"<token>\" --xsec-source pc_search --json\nredbook user-posts \"<userId>\" --xsec-token \"<token>\" --xsec-source pc_search --json\n```\n\n### 账号报表选项\n\n`account-report` 用于按账号 ID/主页 URL 批量统计发帖和互动数据，适合 KOS/KOC 账号巡检。文件中每行一个用户 ID 或带 `xsec_token` 的主页 URL，`#` 开头的行会被忽略。\n\n```bash\nredbook account-report --file kos-accounts.txt --month 2026-07 --json\nredbook account-report \"<profileUrl1>\" \"<profileUrl2>\" --max-pages 2 --json\n```\n\n默认每个账号只拉第一页，结果里 `complete: false` 表示后面还有分页；需要完整历史时加 `--all`，或用 `--max-pages <n>` 控制每个账号最多拉几页。JSON 输出包含账号汇总和每篇笔记的点赞、评论、收藏、分享、总互动、发布时间和 `webUrl`。\n\n### 搜索选项\n\n| 选项 | 说明 | 默认值 |\n|------|------|--------|\n| `--sort <类型>` | `general`（综合）、`popular`（热门）、`latest`（最新） | `general` |\n| `--type <类型>` | `all`（全部）、`video`（视频）、`image`（图文） | `all` |\n| `--page <页码>` | 页码 | `1` |\n\n### 分析选项（analyze-viral / viral-template）\n\n| 选项 | 说明 | 默认值 |\n|------|------|--------|\n| `--comment-pages <n>` | 获取评论页数 | `3` |\n\n### 批量回复选项（batch-reply）\n\n| 选项 | 说明 | 默认值 |\n|------|------|--------|\n| `--strategy <策略>` | `questions`（提问）、`top-engaged`（高赞）、`all-unanswered`（未回复） | `questions` |\n| `--template <模板>` | 回复模板，支持 `{author}`, `{content}` 占位符 | 无（预览模式） |\n| `--max <数量>` | 最大回复数（上限 30） | `10` |\n| `--delay <毫秒>` | 回复间隔（最小 180000ms/3分钟），自动添加 ±30% 随机抖动 | `300000`（5分钟） |\n| `--dry-run` | 只预览不发送 | 无模板时自动开启 |\n\n> ⚠️ **风控安全：** 小红书检测均匀时间间隔的自动化行为。回复间隔已自动添加 ±30% 随机抖动，避免触发机器人检测。建议每天每篇笔记最多批量回复 1-2 次。\n\n### 渲染选项（render）\n\n将 Markdown 文件渲染为小红书风格的 PNG 图文卡片。使用本机 Chrome 渲染，无需额外下载浏览器。\n\n| 选项 | 说明 | 默认值 |\n|------|------|--------|\n| `--style <名称>` | 配色：purple, xiaohongshu, mint, sunset, ocean, elegant, dark | `xiaohongshu` |\n| `--pagination <模式>` | 分页：auto（自动拆分）、separator（按 `---` 拆分） | `auto` |\n| `--output-dir <目录>` | 输出目录 | 与输入文件同目录 |\n| `--width <像素>` | 卡片宽度 | `1080` |\n| `--height <像素>` | 卡片高度 | `1440` |\n| `--dpr <倍率>` | 设备像素比 | `2` |\n\n**可选依赖：** 需要安装 `puppeteer-core` 和 `marked`：\n```bash\nnpm install -g puppeteer-core marked\n```\n\n### 发布选项（post）\n\n发布功能目前**容易触发验证码**（type=124）。图片上传正常，但发布步骤经常被拦截。如需发布笔记，建议使用浏览器自动化。\n\n| 选项 | 说明 |\n|------|------|\n| `--title <标题>` | 笔记标题（必填） |\n| `--body <正文>` | 笔记正文（必填） |\n| `--images <路径...>` | 图片文件路径（必填） |\n| `--topic <关键词>` | 附加话题标签 |\n| `--private` | 发布为私密笔记 |\n\n## 常见问题\n\n| 问题 | 解决方案 |\n|------|----------|\n| `No 'a1' cookie found` | 在 Chrome 中登录 xiaohongshu.com，然后重试 |\n| Windows 上 `-101` 错误 | Chrome 127+ 的 App-Bound Encryption 导致。先**关闭 Chrome**，再运行命令（CLI 会自动启动 Chrome headless 读取 Cookie）。如仍失败，用 `--cookie-string` 手动传入 |\n| Windows `--cookie-string` 用法 | Chrome 按 F12 → Application → Cookies → xiaohongshu.com，复制 `a1` 和 `web_session` 的值：`redbook whoami --cookie-string \"a1=值; web_session=值\"` |\n| macOS 钥匙串弹窗 | 输入密码后点击\"始终允许\"，CLI 需要读取 Chrome 的加密 Cookie |\n| 多个 Chrome 配置文件 | CLI 自动扫描所有配置文件（macOS / Windows / Linux）。如需指定：`--chrome-profile \"Profile 1\"` |\n| 使用 Brave/Arc 等浏览器 | 尝试 `--cookie-source safari`，或在 Chrome 中登录 |\n| `user` / `user-posts` / `comments` 报 `code=-1`（HTTP 406） | 请求签名被拒绝，通常是小红书更新了网页签名。升级到最新版：`npm i -g @lucasygu/redbook@latest` |\n| `search` 报 `-104`（当前登录账号没有权限访问） | 小红书按账号限制接口权限，不是 Cookie 或签名问题。`whoami` / `feed` / `read` 正常、只有 `search` 报 `-104` 时，换一个账号或改用浏览器搜索。新号、未养号的账号，以及高频调用或触发过风控的账号都可能遇到 |\n| 用小红书号（纯数字）查用户失败 | `user` / `user-posts` 需要主页 URL 里 24 位的用户 ID（`/user/profile/<id>`），不是小红书号。直接传完整主页 URL 最稳妥 |\n\n## 工作原理\n\n`redbook` 从 Chrome 读取小红书的登录 Cookie，然后用 TypeScript 实现的签名算法对 API 请求签名。\n\n**三层 Cookie 提取策略：**\n1. **sweet-cookie**（快速路径）—— 直接读取 Chrome 的 SQLite 数据库，macOS 上即开即用\n2. **CDP 回退**（Windows 自动触发）—— 启动 Chrome headless，通过 DevTools Protocol 读取 Cookie，绕过 Chrome 127+ 的 App-Bound Encryption\n3. **`--cookie-string`**（手动兜底）—— 从 Chrome DevTools 复制 Cookie 字符串，任何平台通用\n\n**两套签名系统：**\n- **主 API**（`edith.xiaohongshu.com`）—— 读取：搜索、推荐页、笔记、评论、用户资料。使用 144 字节 x-s 签名（v4.3.1）\n- **创作者 API**（`creator.xiaohongshu.com`）—— 写入：上传图片、发布笔记。使用 AES-128-CBC 签名\n\n## 分析模块（A-M）\n\n内置 13 个可组合的分析模块，覆盖从关键词研究到内容发布的完整工作流：\n\n| 模块 | 功能 |\n|------|------|\n| A. 关键词矩阵 | 分析各关键词的互动天花板和竞争密度 |\n| B. 跨话题热力图 | 发现话题 × 场景的内容空白 |\n| C. 互动信号分析 | 分类内容类型（工具型 / 认知型 / 娱乐型） |\n| D. 博主画像 | 对比头部博主的粉丝、互动、风格 |\n| E. 内容形式分析 | 图文 vs. 视频的表现对比 |\n| F. 机会评分 | 按性价比排序关键词 |\n| G. 受众推断 | 从互动信号推断用户画像 |\n| H. 选题策划 | 数据驱动的内容创意 |\n| I. 评论运营 | 按策略筛选和批量回复评论 |\n| J. 爆款复刻 | 从爆款笔记提取内容模板 |\n| K. 互动自动化 | 组合 I + J 的自动化运营工作流 |\n| L. 图文卡片 | Markdown → 小红书风格 PNG 图文卡片（7 种配色） |\n| M. 限流检测 | 通过创作者后台隐藏 level 字段检测笔记限流状态 |\n\n详见 [SKILL.md](SKILL.md) 的模块文档和组合工作流。\n\n## AI 助手集成\n\n### Claude Code\n\n安装后自动注册为 Claude Code 技能。在 Claude Code 中使用 `/redbook` 命令：\n\n```\n/redbook search \"AI编程\"                        # 搜索笔记\n/redbook read <url>                             # 阅读笔记\n/redbook user <profileUrl>                      # 查看博主\n/redbook analyze-viral <url>                    # 分析爆款笔记\n```\n\n你可以直接用自然语言下达复杂任务：\n\n- *\"分析'AI编程'在小红书的竞争格局，找出蓝海关键词\"*\n- *\"对比这三个博主的内容策略和互动数据\"*\n- *\"拆解这篇爆款笔记，告诉我为什么火了\"*\n- *\"帮我回复这篇笔记下面的提问评论\"*\n\nClaude 会自动组合多个命令，解析 JSON 数据，输出结构化分析报告。\n\n### OpenClaw / ClawHub\n\n官方支持 [OpenClaw](https://openclaw.ai) 和 [ClawHub](https://docs.openclaw.ai/tools/clawhub) 生态。通过 ClawHub 安装：\n\n```bash\nclawhub install redbook\n```\n\n安装后在 OpenClaw 中可直接使用所有 `redbook` 命令。SKILL.md 同时兼容 Claude Code 和 OpenClaw 两个生态。\n\n## 编程接口\n\n```typescript\nimport { XhsClient } from \"@lucasygu/redbook\";\nimport { loadCookies } from \"@lucasygu/redbook/cookies\";\n\nconst cookies = await loadCookies(\"chrome\");\nconst client = new XhsClient(cookies);\n\nconst results = await client.searchNotes(\"AI编程\", 1, 20, \"popular\");\nconst topics = await client.searchTopics(\"Claude Code\");\n```\n\n## 致谢\n\n签名算法移植自以下开源项目（MIT 协议）：\n\n- [Cloxl/xhshow](https://github.com/Cloxl/xhshow) — 主 API 签名（x-s, x-s-common）\n- [Spider_XHS](https://github.com/JoeanAmier/XHS-Downloader) — 创作者 API 签名\n- [ReaJason/xhs](https://github.com/ReaJason/xhs) — API 端点参考\n\nCookie 提取使用 [@steipete/sweet-cookie](https://github.com/nicklockwood/sweet-cookie)。\n\n限流检测灵感来自 [jzOcb/xhs-note-health-checker](https://github.com/jzOcb/xhs-note-health-checker)（[@xxx111god](https://x.com/xxx111god) 发现了创作者后台 API 的隐藏 level 字段）。\n\n## 免责声明\n\n本工具使用非官方 API。小红书可能随时更改或封锁这些接口。请合理使用，风险自负。本项目与小红书无任何关联。\n\n---\n\n<a id=\"english\"></a>\n\n# English\n\nA fast CLI tool for [Xiaohongshu (小红书 / RED)](https://www.xiaohongshu.com) — search notes, read content, analyze creators, and publish posts. Uses browser cookie auth (no API key needed).\n\n> ### Easiest way to get started\n>\n> Paste this to your AI coding agent (Claude Code, Cursor, Codex, Windsurf, OpenClaw, etc.):\n>\n> **\"Install the `@lucasygu/redbook` Xiaohongshu CLI tool via npm and run `redbook whoami` to verify it works. Repo: https://github.com/lucasygu/redbook\"**\n>\n> OpenClaw users can also run: **`clawhub install redbook`**\n>\n> The agent will handle installation, verify the connection, and troubleshoot any cookie issues. Just make sure you're logged into xiaohongshu.com in Chrome first.\n>\n> Once installed, try: **\"Analyze the competitive landscape for 'AI编程' on Xiaohongshu\"** — the agent will search keywords, analyze engagement data, profile top creators, and suggest content opportunities.\n\n## Install\n\n```bash\nnpm install -g @lucasygu/redbook\n# Or via ClawHub (OpenClaw ecosystem)\nclawhub install redbook\n```\n\nRequires Node.js >= 22. Supports **macOS, Windows, and Linux**. Uses cookies from your Chrome browser session — you must be logged into xiaohongshu.com in Chrome.\n\nAfter installing, run `redbook whoami` to verify the connection. The CLI auto-detects all Chrome profiles to find your XHS session.\n\n- **macOS** — If Keychain prompt appears, click \"Always Allow\"\n- **Windows** — Chrome 127+ uses App-Bound Encryption. The CLI auto-launches Chrome headless to read cookies (close Chrome first). If auto-extraction fails, use `--cookie-string` as fallback\n\n## What You Can Do\n\n- **Topic research** — Search keywords, analyze which topics have demand vs. gaps\n- **Competitive analysis** — Find top creators, compare followers, engagement, content style\n- **Viral note breakdown** — Analyze title hooks, engagement ratios, comment themes\n- **Viral templates** — Extract content templates from multiple viral notes (hook patterns, body structure, engagement profile)\n- **Rate-limit detection** — Detect hidden throttling on your notes via the creator API's secret `level` field\n- **Collection albums** — List notes in a collection album (收藏专辑) for batch analysis\n- **Favorites management** — List collected notes, collect/uncollect notes (own and other users' public collections)\n- **Comment management** — Post comments, reply to comments, batch-reply with strategies (questions / top-engaged / unanswered)\n- **Image cards** — Render markdown to styled PNG cards for XHS posts (7 color themes)\n- **Content planning** — Discover content opportunities with data-backed topic suggestions\n- **Audience insights** — Infer target audience from engagement signals\n\nWhen used through an AI agent, these workflows chain together automatically. Each CLI command also works standalone.\n\n## Quick Start\n\n```bash\n# Check connection\nredbook whoami\n\n# Search notes\nredbook search \"AI编程\" --sort popular\n\n# Read a note\nredbook read https://www.xiaohongshu.com/explore/abc123\n\n# Get comments\nredbook comments https://www.xiaohongshu.com/explore/abc123 --all\n\n# Browse your feed\nredbook feed\n\n# Look up a creator\nredbook user \"<profileUrl>\"\nredbook user-posts \"<profileUrl>\"\nredbook account-report --file kos-accounts.txt --month 2026-07 --json\n\n# Search hashtags\nredbook topics \"Claude Code\"\n\n# List favorites (defaults to current user)\nredbook favorites --json\nredbook favorites <userId> --json --all\n\n# Collect/uncollect notes\nredbook collect \"<noteUrl>\"\nredbook uncollect \"<noteUrl>\"\n\n# Analyze a viral note\nredbook analyze-viral https://www.xiaohongshu.com/explore/abc123\n\n# Extract content template from viral notes\nredbook viral-template \"<url1>\" \"<url2>\" \"<url3>\" --json\n\n# Post a comment\nredbook comment \"<noteUrl>\" --content \"Great post!\"\n\n# Reply to a comment\nredbook reply \"<noteUrl>\" --comment-id \"<id>\" --content \"Thanks for asking!\"\n\n# Batch reply with strategy (preview first, then execute)\nredbook batch-reply \"<noteUrl>\" --strategy questions --dry-run\nredbook batch-reply \"<noteUrl>\" --strategy questions --template \"Thanks! {content}\" --max 10\n\n# List user's collection boards\nredbook boards                          # your own boards\nredbook boards <userId>                 # another user's boards\nredbook board \"https://www.xiaohongshu.com/board/abc123\" --json\n\n# Check note health / rate-limiting status\nredbook health\nredbook health --all --json\n\n# Render markdown to image cards (requires optional deps)\nredbook render content.md --style xiaohongshu\nredbook render content.md --style dark --output-dir ./cards\n\n# Publish (requires image)\nredbook post --title \"标题\" --body \"正文\" --images cover.png\nredbook post --title \"测试\" --body \"...\" --images img.png --private\n```\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `whoami` | Check connection and show current user info |\n| `search <keyword>` | Search notes by keyword |\n| `read <url>` | Read a note by URL |\n| `comments <url>` | Get comments on a note |\n| `user <userId\\|profileUrl>` | Get user profile info |\n| `user-posts <userId\\|profileUrl>` | List a user's posted notes |\n| `account-report <user...>` | Batch summarize account posting and engagement |\n| `feed` | Get homepage feed |\n| `post` | Publish an image note (captcha-prone, see below) |\n| `topics <keyword>` | Search for topics/hashtags |\n| `favorites [userId]` | List collected/favorited notes (defaults to current user) |\n| `collect <url>` | Collect (bookmark) a note |\n| `uncollect <url>` | Remove a note from your collection |\n| `health` | Detect hidden rate-limiting on your notes (via creator API's secret level field) |\n| `boards [userId]` | List user's collection boards (defaults to current user) |\n| `board <url>` | List notes in a collection album (accepts board URL or ID) |\n| `analyze-viral <url>` | Analyze why a viral note works (hooks, engagement, structure) |\n| `viral-template <url...>` | Extract a content template from 1-3 viral notes |\n| `comment <url>` | Post a top-level comment |\n| `reply <url>` | Reply to a specific comment |\n| `batch-reply <url>` | Batch reply to comments with filtering strategy (supports dry-run) |\n| `render <file>` | Render markdown to styled PNG image cards for XHS posts (optional deps) |\n| `auth` | Save, export, inspect, and clear reusable cookie files for cloud/OpenClaw runs |\n\n### Global Options\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `--cookie-source <browser>` | Browser to read cookies from (chrome, safari, firefox) | `chrome` |\n| `--chrome-profile <name>` | Chrome profile directory name (e.g., \"Profile 1\"). Auto-detected if omitted. | auto |\n| `--cookie-string <cookies>` | Manual cookie string: `\"a1=VALUE; web_session=VALUE\"` (from Chrome DevTools) | none |\n| `--platform <name>` | Force backend: `xhs` (mainland) or `rednote` (global). Omit to auto-detect. | auto |\n| `--global` | Force the global RedNote backend (= `--platform rednote`) | — |\n| `--json` | Output as JSON | `false` |\n\n> **Mainland 小红书 vs global RedNote — handled automatically.** These are two separate backends (`xiaohongshu.com` / `edith.xiaohongshu.com` vs `rednote.com` / `webapi.rednote.com`) with separate sessions and cookie domains; RedNote routes you to one by IP/region and you can only be signed into one at a time. The CLI **auto-detects which one you're logged into** (probing both cookie domains, verifying with one `/user/me` call when both have cookies, then caching the result in `~/.redbook/`), so you normally pass **no flag**. Use `--global` / `--platform xhs` only to force one.\n\n### Saved Cookies / Cloud Use\n\nFor OpenClaw, cloud servers, or CI, save cookies once so every command does not need `--cookie-string`. Normal commands resolve cookies in this order: `--cookie-string` → `REDBOOK_COOKIE_STRING` → `REDBOOK_COOKIE_FILE` → `~/.redbook/cookies.json` → local browser extraction.\n\n```bash\n# Export from a logged-in local browser to ~/.redbook/cookies.json\nredbook auth export\n\n# Or save a cookie string copied from DevTools\nredbook auth save --cookie-string \"a1=VALUE; web_session=VALUE\"\n\n# Inspect path/keys without printing secret values\nredbook auth path\nredbook auth inspect\n\n# After uploading ~/.redbook/cookies.json to the cloud, commands auto-load it\nredbook whoami\n\n# For a custom location\nexport REDBOOK_COOKIE_FILE=/secure/path/redbook-cookies.json\nredbook search \"AI编程\" --json\n```\n\nThe cookie file is a plaintext login credential and is written with `0600` permissions by default. Do not commit it or print it in logs. To revoke local reuse, remove it with `redbook auth clear`, then log out/in from the browser to rotate the session.\n\n### User Profile Options\n\n`user` and `user-posts` accept full profile URLs such as `https://www.xiaohongshu.com/user/profile/<id>?xsec_token=...&xsec_source=pc_search`. If a bare user ID returns `code=-1`, copy a fresh profile URL from search results or the browser address bar, or pass the token explicitly:\n\n```bash\nredbook user \"<userId>\" --xsec-token \"<token>\" --xsec-source pc_search --json\nredbook user-posts \"<userId>\" --xsec-token \"<token>\" --xsec-source pc_search --json\n```\n\n### Account Report Options\n\n`account-report` summarizes posting activity and engagement by account ID/profile URL, useful for KOS/KOC account checks. A file can contain one user ID or tokenized profile URL per line; blank lines and `#` comments are ignored.\n\n```bash\nredbook account-report --file kos-accounts.txt --month 2026-07 --json\nredbook account-report \"<profileUrl1>\" \"<profileUrl2>\" --max-pages 2 --json\n```\n\nBy default it fetches the first page per account. `complete: false` means more pages exist; use `--all` for full history or `--max-pages <n>` to cap page reads. JSON includes account summaries plus per-note likes, comments, collects, shares, total engagement, publish time, and `webUrl`.\n\n### Search Options\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `--sort <type>` | `general`, `popular`, `latest` | `general` |\n| `--type <type>` | `all`, `video`, `image` | `all` |\n| `--page <n>` | Page number | `1` |\n\n### Analyze-Viral / Viral-Template Options\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `--comment-pages <n>` | Number of comment pages to fetch | `3` |\n\n### Batch-Reply Options\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `--strategy <name>` | `questions`, `top-engaged`, `all-unanswered` | `questions` |\n| `--template <text>` | Reply template with `{author}`, `{content}` placeholders | none (dry-run) |\n| `--max <n>` | Max replies to send (hard cap: 30) | `10` |\n| `--delay <ms>` | Delay between replies in ms (min: 180000 / 3 min), ±30% random jitter applied automatically | `300000` (5 min) |\n| `--dry-run` | Preview candidates without posting | auto when no template |\n\n> ⚠️ **Rate limit safety:** XHS detects uniform timing patterns as bot behavior. Reply delays include ±30% random jitter automatically. Limit to 1-2 batch runs per note per day. See SKILL.md for full rate limit guidance.\n\n### Render Options\n\nRender a markdown file to styled PNG image cards. Uses your existing Chrome for rendering — no browser download needed.\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `--style <name>` | Color style: purple, xiaohongshu, mint, sunset, ocean, elegant, dark | `xiaohongshu` |\n| `--pagination <mode>` | Pagination: auto, separator | `auto` |\n| `--output-dir <dir>` | Output directory | same as input |\n| `--width <n>` | Card width in pixels | `1080` |\n| `--height <n>` | Card height in pixels | `1440` |\n| `--dpr <n>` | Device pixel ratio | `2` |\n\n**Optional dependencies:** Requires `puppeteer-core` and `marked`:\n```bash\nnpm install -g puppeteer-core marked\n```\n\n### Post Options\n\nPublishing **frequently triggers captcha** (type=124). Image upload works, but the publish step is unreliable. For posting, consider using browser automation instead.\n\n| Option | Description |\n|--------|-------------|\n| `--title <title>` | Note title (required) |\n| `--body <body>` | Note body text (required) |\n| `--images <paths...>` | Image file paths (required) |\n| `--topic <keyword>` | Topic/hashtag to search and attach |\n| `--private` | Publish as private note |\n\n## Troubleshooting\n\n| Problem | Solution |\n|---------|----------|\n| `No 'a1' cookie found` | Log into xiaohongshu.com in Chrome, then retry |\n| Windows `-101` error | Chrome 127+ App-Bound Encryption. **Close Chrome first**, then re-run (CLI auto-launches Chrome headless to read cookies). If it still fails, use `--cookie-string` |\n| Windows `--cookie-string` | Press F12 in Chrome → Application → Cookies → xiaohongshu.com. Copy `a1` and `web_session` values: `redbook whoami --cookie-string \"a1=VALUE; web_session=VALUE\"` |\n| macOS Keychain prompt | Enter your password and click \"Always Allow\" — the CLI needs to decrypt Chrome's cookies |\n| Multiple Chrome profiles | The CLI auto-scans all profiles (macOS / Windows / Linux). To pick one: `--chrome-profile \"Profile 1\"` |\n| Using Brave/Arc/other | Try `--cookie-source safari`, or log into xiaohongshu.com in Chrome |\n| `user` / `user-posts` / `comments` return `code=-1` (HTTP 406) | XHS rejected the request signature, usually after a web signing update. Upgrade: `npm i -g @lucasygu/redbook@latest` |\n| `search` returns `-104` (\"no permission for this account\") | An account-level API restriction from XHS, not a cookie or signing bug. If `whoami` / `feed` / `read` work but `search` returns `-104`, try another account or search in the browser. New or barely used accounts, and accounts that made heavy API calls or tripped risk control, can both hit this |\n| Looking up a user by Red ID (all digits) fails | `user` / `user-posts` need the 24-character user ID from the profile URL (`/user/profile/<id>`), not the 小红书号. Passing the full profile URL is safest |\n\n## How It Works\n\n`redbook` reads your XHS session cookies from Chrome and signs API requests using a TypeScript port of the XHS signing algorithm.\n\n**Three-tier cookie extraction:**\n1. **sweet-cookie** (fast path) — reads Chrome's SQLite cookie database directly. Works instantly on macOS\n2. **CDP fallback** (auto on Windows) — launches Chrome headless and reads cookies via DevTools Protocol, bypassing Chrome 127+ App-Bound Encryption\n3. **`--cookie-string`** (manual fallback) — paste cookie values from Chrome DevTools. Works on any platform\n\n**Two signing systems:**\n- **Main API** (`edith.xiaohongshu.com`) — for reading: search, feed, notes, comments, user profiles. Uses x-s signature with 144-byte payload (v4.3.1).\n- **Creator API** (`creator.xiaohongshu.com`) — for writing: upload images, publish notes. Uses simpler AES-128-CBC signing.\n\n## Analysis Modules (A-M)\n\n13 composable analysis modules covering the full workflow from keyword research to content publishing:\n\n| Module | Purpose |\n|--------|---------|\n| A. Keyword Matrix | Analyze engagement ceiling and competition density per keyword |\n| B. Cross-Topic Heatmap | Find topic × scene content gaps |\n| C. Engagement Signals | Classify content type (reference / insight / entertainment) |\n| D. Creator Profiling | Compare top creators' followers, engagement, style |\n| E. Content Form | Image-text vs. video performance comparison |\n| F. Opportunity Scoring | Rank keywords by effort-to-reward ratio |\n| G. Audience Inference | Infer user persona from engagement signals |\n| H. Content Brainstorm | Data-backed content ideas |\n| I. Comment Operations | Filter and batch-reply to comments by strategy |\n| J. Viral Replication | Extract content templates from viral notes |\n| K. Engagement Automation | Combined I + J workflow for operations |\n| L. Card Rendering | Markdown → styled PNG image cards for XHS posts (7 color themes) |\n| M. Note Health Check | Detect hidden rate-limiting via creator API's secret level field |\n\nSee [SKILL.md](SKILL.md) for full module documentation and composed workflows.\n\n## AI Agent Integration\n\n### Claude Code\n\nInstalls automatically as a Claude Code skill. Use `/redbook` in Claude Code:\n\n```\n/redbook search \"AI编程\"                        # Search notes\n/redbook read <url>                             # Read a note\n/redbook user <profileUrl>                      # Creator profile\n/redbook analyze-viral <url>                    # Analyze a viral note\n```\n\nYou can give natural language instructions for complex tasks:\n\n- *\"Analyze the competitive landscape for 'AI编程' on Xiaohongshu and find blue ocean keywords\"*\n- *\"Compare the content strategies of these three creators\"*\n- *\"Break down this viral note and tell me why it worked\"*\n- *\"Reply to the question comments on my latest post\"*\n\nClaude will automatically combine multiple commands, parse JSON data, and produce structured analysis reports.\n\n### OpenClaw / ClawHub\n\nOfficially supports [OpenClaw](https://openclaw.ai) and [ClawHub](https://docs.openclaw.ai/tools/clawhub). Install via ClawHub:\n\n```bash\nclawhub install redbook\n```\n\nAll `redbook` commands are available in OpenClaw after installation. The SKILL.md is compatible with both Claude Code and OpenClaw ecosystems.\n\n## Programmatic Usage\n\n```typescript\nimport { XhsClient } from \"@lucasygu/redbook\";\nimport { loadCookies } from \"@lucasygu/redbook/cookies\";\n\nconst cookies = await loadCookies(\"chrome\");\nconst client = new XhsClient(cookies);\n\nconst results = await client.searchNotes(\"AI编程\", 1, 20, \"popular\");\nconst topics = await client.searchTopics(\"Claude Code\");\n```\n\n## Acknowledgments\n\nSigning algorithms ported from these open-source projects (MIT licensed):\n\n- [Cloxl/xhshow](https://github.com/Cloxl/xhshow) — Main API signing (x-s, x-s-common)\n- [Spider_XHS](https://github.com/JoeanAmier/XHS-Downloader) — Creator API signing\n- [ReaJason/xhs](https://github.com/ReaJason/xhs) — API endpoint reference\n\nCookie extraction via [@steipete/sweet-cookie](https://github.com/nicklockwood/sweet-cookie).\n\nRate-limit detection inspired by [jzOcb/xhs-note-health-checker](https://github.com/jzOcb/xhs-note-health-checker) ([@xxx111god](https://x.com/xxx111god) discovered the hidden `level` field in the creator backend API).\n\n## Disclaimer\n\nThis tool uses unofficial/private APIs. Xiaohongshu may change or block these APIs at any time. Use responsibly and at your own risk. This project is not affiliated with Xiaohongshu.\n\n## License\n\nMIT\n\nFile v0.8.2:_meta.json\n\n{\n  \"ownerId\": \"kn7609awkk9yh67wv7fmgtvkxn7zzm6q\",\n  \"slug\": \"redbook\",\n  \"version\": \"0.8.2\",\n  \"publishedAt\": 1789236488283\n}\n\nFile v0.8.2:CLAUDE.md\n\n# CLAUDE.md — redbook CLI\n\n## Publishing\n\n**NEVER publish npm packages directly from local.** Always use the `npm-publish-cli` agent to bump version and publish via CI. The GitHub Actions workflow (`Publish to npm`) handles publishing on push to main. Publishing locally races CI and causes workflow failures.\n\n**Dual publishing (automated):**\n- **npm** — publishes when `package.json` version changes on push to main\n- **ClawHub** — publishes when `SKILL.md` changes on push to main (uses `CLAWHUB_TOKEN` secret)\n\nBoth are conditional jobs in `.github/workflows/npm-publish.yml`. Manual trigger via `workflow_dispatch` is also available.\n\n## Build & Test\n\n- `npm run build` — TypeScript compile + chmod\n- No test suite yet — verify manually with `redbook whoami`\n\n## Project Structure\n\n- `src/cli.ts` — CLI entry point, 21 commands, `getClient()` is the single cookie→client funnel\n- `src/lib/client.ts` — XHS API client (`postComment`, `replyComment`, etc.)\n- `src/lib/cookies.ts` — Cookie extraction with Chrome profile auto-discovery\n- `src/lib/signing.ts` — Request signing\n- `src/lib/analyze.ts` — Viral note analysis and question detection\n- `src/lib/reply-strategy.ts` — Batch reply filtering, templating, rate-limited execution\n- `src/lib/template.ts` — Viral content template extraction\n- `src/lib/health.ts` — Note health check: level detection, sensitive words, tag count\n- `src/lib/render.ts` — Card rendering (markdown → PNG via puppeteer-core, optional dep)\n- `SKILL.md` — Skill documentation (serves both Claude Code and OpenClaw/ClawHub)\n- `.github/workflows/npm-publish.yml` — CI: build, npm publish, ClawHub publish\n\n## Render Command (Optional)\n\n- `redbook render <file>` — markdown → styled PNG cards using user's existing Chrome\n- Requires `puppeteer-core` and `marked` (optional peer deps, lazy imported)\n- Uses Chrome at `/Applications/Google Chrome.app/...` or `CHROME_PATH` env var\n- No cookies/XHS API needed — purely offline\n- HTML/CSS templates embedded as TypeScript template literals (no external files)\n\n## Cookie Architecture\n\n- Uses `@steipete/sweet-cookie` to read browser cookies\n- Auto-discovers Chrome profiles via `~/Library/Application Support/Google/Chrome/Local State`\n- Keychain timeout patched to 30s in node_modules (upstream bug: hardcoded 3s)\n- `--chrome-profile` flag available as escape hatch, but auto-discovery handles most cases\n\nFile v0.8.2:docs/content-language-strategy.md\n\n# Content Language Strategy: English First\n\n**Decided**: 2026-03-22\n**Source**: [@Jiaxi_Cui tweet](https://x.com/Jiaxi_Cui/status/2035415033149264083)\n\n---\n\n## Decision\n\n**Use English for X and LinkedIn. Do not build a Chinese X account.**\n\nThis resolves the long-running struggle over language choice.\n\n---\n\n## Reasoning (from @Jiaxi_Cui / Panda)\n\nChinese X is drifting toward an early Weibo atmosphere — flooded with marketing accounts. Too much noise, diminishing signal.\n\nEnglish X and LinkedIn have better conversion and are worth sustained effort.\n\nXHS is different — high community quality, very vertical. But treat it separately:\n- **Personal brand account** (high quality, curated): worth building\n- **Customer acquisition / promotional accounts**: different strategy entirely\n\n---\n\n## Platform Strategy Summary\n\n| Platform | Language | Strategy |\n|----------|----------|---------|\n| X / Twitter | **English** | Main personal brand channel |\n| LinkedIn | **English** | Professional + longer-form |\n| XHS (小红书) | Chinese | Separate vertical communities — high quality personal account |\n| YouTube | TBD | Likely English-first |\n\n---\n\n## Implications for Redbook CLI\n\nThe `redbook` tool is still valuable for:\n- XHS content creation and posting\n- XHS community research and engagement\n- Monitoring Chinese-language conversations about products/topics\n\nXHS is a distinct channel with different rules — not \"Chinese version of X\" but its own high-quality vertical community platform.\n\n---\n\n## Previous Struggle (Resolved)\n\nThe prior back-and-forth about \"中文还是英文\" is now settled:\n- Building a Chinese X account → **not worth it**\n- Building English X + LinkedIn → **do this**\n- XHS → **yes, but as its own track**\n\n---\n\n*Saved: 2026-03-22*\n\nFile v0.8.2:docs/research-task-1789.md\n\n# Research: Automation, OpenClaw, ClawHub, and Gemini Integration\n\n**Task #1789** — Research findings for integrating automation features, OpenClaw/ClawHub support, and Gemini API into the `redbook` CLI.\n\n---\n\n## 1. Reference Repo Analysis: `xiaohongshu-ops-skill`\n\n**Repo:** [Xiangyu-CAS/xiaohongshu-ops-skill](https://github.com/Xiangyu-CAS/xiaohongshu-ops-skill)\n\n### Architecture\n\nThe reference skill is a **pure-SKILL.md skill** — no npm package, no compiled code. It relies entirely on:\n\n- **Browser automation** via OpenClaw's built-in CDP (Chrome DevTools Protocol) agent\n- **Persona-driven replies** defined in `persona.md`\n- **Reference docs** for SOPs (publish flows, comment strategies)\n\n```\nxiaohongshu-ops-skill/\n├── SKILL.md              # Core logic, SOPs, execution rules\n├── persona.md            # Account voice, tone, reply style\n├── examples/             # Scenario-specific implementations\n│   ├── drama-watch/case.md\n│   └── reply-examples.md\n├── references/           # Operational playbooks\n│   ├── xhs-comment-ops.md\n│   └── xhs-publish-flows.md\n└── README.md\n```\n\n### Key Differentiators from `redbook`\n\n| Aspect | `xiaohongshu-ops-skill` | `redbook` |\n|--------|------------------------|-----------|\n| **Execution** | Browser automation (CDP) | API-based CLI |\n| **Authentication** | QR code login, session persists | Cookie extraction from browser |\n| **Cover images** | Gemini API generation | `render` command (markdown→PNG) |\n| **Comment replies** | AI-generated via persona | Template-based batch reply |\n| **Publishing** | Browser automation (reliable) | API (captcha-prone) |\n| **Distribution** | ClawHub only | npm + ClawHub |\n| **Dependencies** | None (pure text skill) | Node.js ≥ 22, npm packages |\n\n### What We Can Learn\n\n1. **Persona system** — Their `persona.md` approach is elegant. We could add a `--persona <file>` option to `batch-reply` that uses an LLM to generate contextual replies instead of templates.\n2. **Browser automation for publishing** — Their CDP approach avoids the captcha issues we face with the API. However, this requires OpenClaw's browser agent, not something we can replicate in a CLI.\n3. **Modular reference docs** — Their `references/` directory pattern is useful for teaching the skill complex workflows.\n\n---\n\n## 2. OpenClaw / ClawHub Ecosystem\n\n### How Skills Work\n\nSkills are **text-based instruction bundles** centered around a `SKILL.md` file. OpenClaw loads them and uses the instructions to guide its agent. Skills can:\n\n- Declare required CLI binaries (`requires.bins`)\n- Declare required environment variables (`requires.env`)\n- Specify installation steps for dependencies (`install` block)\n- Restrict to specific OSes (`os`)\n\n### SKILL.md Frontmatter Specification\n\n```yaml\n---\nname: redbook                           # Skill identifier (slug)\ndescription: \"Description here\"         # Summary for UI/search\nversion: 0.2.0                         # Semver\nallowed-tools: Bash, Read, Write       # Claude Code tool restrictions\nmetadata:\n  openclaw:\n    requires:\n      bins:                             # ALL must be on PATH\n        - redbook\n      env:                              # ALL must be set\n        - SOME_API_KEY\n      anyBins:                          # At least ONE must exist\n        - python\n        - python3\n      config:                           # Config files the skill reads\n        - ~/.config/redbook/config.json\n    primaryEnv: SOME_API_KEY            # Main credential env var\n    install:\n      - kind: node                      # brew | node | go | uv\n        package: \"@lucasygu/redbook\"\n        bins: [redbook]\n    os: [macos]                         # OS restrictions\n    homepage: https://github.com/lucasygu/redbook\n    emoji: \"📕\"\n    always: false                       # If true, always active\n    skillKey: redbook                   # Override invocation key\ntags:\n  - xiaohongshu\n  - social-media\n---\n```\n\n### Current `redbook` SKILL.md Status\n\nOur SKILL.md already has correct ClawHub metadata:\n\n```yaml\nmetadata:\n  openclaw:\n    requires:\n      bins:\n        - redbook\n    install:\n      - kind: node\n        package: \"@lucasygu/redbook\"\n        bins: [redbook]\n    os: [macos]\n    homepage: https://github.com/lucasygu/redbook\n```\n\n**What's missing:**\n- `emoji` field (cosmetic)\n- `requires.env` if we add Gemini API support\n- `primaryEnv` for the main API key\n\n### ClawHub Publishing\n\nPublishing happens via CI (already set up in `.github/workflows/npm-publish.yml`):\n\n```bash\nclawhub login --token \"$CLAWHUB_TOKEN\" --no-browser\nclawhub publish . --slug redbook --name \"redbook\" --version \"$SKILL_VERSION\"\n```\n\nThe workflow triggers when `SKILL.md` changes on push to main.\n\n### CLI → Skill Invocation Relationship\n\n```\n┌──────────────────────────────────────────────┐\n│  User (in Claude Code / OpenClaw)            │\n│  \"Analyze this XHS creator's account\"        │\n└──────────────┬───────────────────────────────┘\n               │\n               ▼\n┌──────────────────────────────────────────────┐\n│  SKILL.md (loaded by agent)                  │\n│  - Reads instructions & analysis modules     │\n│  - Knows which `redbook` CLI commands to use │\n│  - Has allowed-tools: Bash, Read, Write      │\n└──────────────┬───────────────────────────────┘\n               │  (dispatches via Bash tool)\n               ▼\n┌──────────────────────────────────────────────┐\n│  `redbook` CLI binary (npm package)          │\n│  - redbook search \"keyword\" --json           │\n│  - redbook analyze-viral <url> --json        │\n│  - redbook batch-reply <url> --dry-run --json│\n└──────────────────────────────────────────────┘\n```\n\nThe Skill (SKILL.md) is the **brain** — it knows the analysis modules, workflows, and how to interpret results. The CLI is the **hands** — it executes the actual API calls. They are complementary:\n\n- **SKILL.md** tells the agent *what to do and why*\n- **CLI binary** does the *how* (API calls, cookie management, signing)\n- The agent uses `Bash` tool to invoke CLI commands and parses `--json` output\n\nThis is the correct architecture for a CLI-based skill. The reference repo (`xiaohongshu-ops-skill`) takes a different approach — it uses browser automation directly, with no CLI layer.\n\n---\n\n## 3. Gemini API Integration Assessment\n\n### What the Reference Repo Does\n\nThe `xiaohongshu-ops-skill` uses Gemini (specifically \"Nano Banana\" / Gemini 3 Pro Image Preview) for **cover image generation**. The flow:\n\n1. User provides a topic/content\n2. Skill generates a prompt for cover image\n3. Gemini API generates a 2048×2048 image\n4. Browser automation uploads the image to XHS\n\n### Current Gemini API Capabilities\n\n| Model | Resolution | Free Tier | Best For |\n|-------|-----------|-----------|----------|\n| `gemini-3.1-flash-image-preview` | Up to 4K | ~500 req/day | Fast generation |\n| `gemini-3-pro-image-preview` | Up to 4K | Limited | Higher quality |\n| Nano Banana 2 | Up to 4K | Via Gemini app | Best text rendering |\n\n**API call (TypeScript):**\n```typescript\nimport { GoogleGenAI } from \"@google/genai\";\n\nconst ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });\nconst response = await ai.models.generateContent({\n  model: \"gemini-3.1-flash-image-preview\",\n  contents: \"Generate a Xiaohongshu cover image for: [topic]\",\n  config: {\n    responseModalities: [\"TEXT\", \"IMAGE\"],\n    imageConfig: { aspectRatio: \"1:1\", imageSize: \"2K\" }\n  }\n});\n// Image returned as base64-encoded PNG in response parts\n```\n\n### Should We Integrate Gemini?\n\n**Recommendation: Yes, but as an optional enhancement (Phase 2)**\n\n| Pro | Con |\n|-----|-----|\n| Free tier (500 req/day) covers casual use | Adds a dependency (`@google/genai`) |\n| Chinese text rendering is strong in Nano Banana | Requires `GEMINI_API_KEY` setup |\n| Complements existing `render` command | Publishing via API still triggers captcha |\n| Reference repo validates the approach | Image style preferences are subjective |\n\n**Proposed integration path:**\n\n1. **New command: `redbook generate-cover`**\n   - Input: topic, style keywords, optional reference image\n   - Output: PNG file saved locally\n   - Uses Gemini API for generation\n   - Requires `GEMINI_API_KEY` env var\n\n2. **Enhance `redbook post` workflow:**\n   - If `--generate-cover` flag is set, auto-generate cover before publishing\n   - Still use local image files as fallback\n\n3. **SKILL.md updates:**\n   ```yaml\n   metadata:\n     openclaw:\n       requires:\n         env:\n           - GEMINI_API_KEY    # Optional, for cover generation\n       primaryEnv: GEMINI_API_KEY\n   ```\n\n4. **New Module L: AI Cover Generation**\n   - Composable with Module J (Viral Replication) and Module H (Content Brainstorm)\n   - Extracts visual style from viral notes → generates matching covers\n\n---\n\n## 4. Automation Feature Recommendations\n\n### Near-term (can build now)\n\n| Feature | Approach | Effort |\n|---------|----------|--------|\n| **Persona-based replies** | `--persona <file>` for batch-reply, LLM generates replies | Medium |\n| **Scheduled monitoring** | `redbook monitor <noteUrl>` — polls for new comments | Low |\n| **Content calendar** | Module L in SKILL.md — workflow for daily content planning | Low (docs only) |\n\n### Medium-term (needs more research)\n\n| Feature | Approach | Blocker |\n|---------|----------|---------|\n| **Gemini cover generation** | `redbook generate-cover` command | Needs `@google/genai` dep |\n| **Auto-publish pipeline** | generate cover → compose post → publish | Captcha on publish API |\n| **Comment sentiment analysis** | Classify comments before replying | Needs LLM API |\n\n### Not recommended (yet)\n\n| Feature | Why Not |\n|---------|---------|\n| **Browser automation** | Requires CDP setup, OpenClaw-specific. Our CLI approach is more portable. |\n| **Like/collect/follow automation** | Heavy anti-automation enforcement on XHS. High ban risk. |\n| **DM automation** | Not supported by any known API approach. |\n\n---\n\n## 5. Action Items\n\n### Immediate (this PR)\n- [x] Research completed and documented\n\n### Next Steps\n1. **Add `emoji` field** to SKILL.md frontmatter (`📕` or `📗`)\n2. **Add persona-based reply** — extend `batch-reply` with `--persona <file>` option\n3. **Add Gemini cover generation** — new `generate-cover` command with optional `@google/genai` dep\n4. **Add Module L** to SKILL.md — AI Cover Generation analysis module\n5. **Update SKILL.md metadata** — add `requires.env` for `GEMINI_API_KEY` (optional)\n6. **Add `redbook monitor`** — simple comment monitoring loop with configurable interval\n\n---\n\n## Sources\n\n- [Xiangyu-CAS/xiaohongshu-ops-skill](https://github.com/Xiangyu-CAS/xiaohongshu-ops-skill) — Reference skill repo\n- [ClawHub Skill Format](https://github.com/openclaw/clawhub/blob/main/docs/skill-format.md) — SKILL.md specification\n- [OpenClaw Skills Docs](https://docs.openclaw.ai/tools/skills) — How skills work\n- [ClawHub Registry](https://github.com/openclaw/clawhub) — Skill registry README\n- [Gemini Image Generation API](https://ai.google.dev/gemini-api/docs/image-generation) — Nano Banana / Gemini 3.1 Flash Image\n- [RedInk + Nano Banana Integration](https://help.apiyi.com/en/redink-nano-banana-pro-integration-tutorial-en.html) — XHS cover generation case study\n- [OpenClaw Skills Guide](https://openclawpulse.com/openclaw-skills-guide/) — Installation and usage\n\nFile v0.8.2:skill-card.md\n\n## Description:\n\nSearch, read, analyze, and automate Xiaohongshu content through a CLI.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[lucasygu](https://clawhub.ai/user/lucasygu)\n\n### License/Terms of Use:\n\nMIT\n\n## Use Case:\n\nExternal creators, marketers, and developers use redbook to research Xiaohongshu content, analyze creator and engagement signals, manage comments and collections, and prepare or publish image-note content through a CLI.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The CLI can access live Xiaohongshu or RedNote session cookies and perform account actions.\n\nMitigation: Use it only with accounts and environments where this access is intended, and avoid saving cookie files on shared or cloud systems.\n\nRisk: Install-time behavior modifies a Claude Code skill path and patches an installed dependency.\n\nMitigation: Review or back up ~/.claude/skills/redbook before npm installation and inspect install scripts when deploying in managed environments.\n\nRisk: Host override environment variables can route credentialed API traffic to alternate endpoints.\n\nMitigation: Keep REDBOOK_EDITH_HOST and REDBOOK_CREATOR_HOST unset unless the endpoint is explicitly trusted.\n\nRisk: Rendering untrusted markdown may expose users to unsafe local rendering behavior.\n\nMitigation: Render only trusted markdown content with the card renderer.\n\nRisk: High-frequency reads, comments, or posting actions can trigger captcha, IP blocks, or account degradation.\n\nMitigation: Use paced research loops, avoid parallel reads, keep fast mode as explicit opt-in only, and stop on captcha or other risk-control signals.\n\n## Reference(s):\n\n- [redbook repository](https://github.com/lucasygu/redbook)\n- [ClawHub skill page](https://clawhub.ai/lucasygu/skills/redbook)\n- [Content Language Strategy](docs/content-language-strategy.md)\n- [Research: Automation, OpenClaw, ClawHub, and Gemini Integration](docs/research-task-1789.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Code, Shell commands, Configuration, Guidance]\n\n**Output Format:** [Markdown guidance with CLI commands and optional JSON or PNG file outputs]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Programmatic workflows should use --json when parsing CLI output.]\n\n## Skill Version(s):\n\n0.8.2 (source: package.json)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v0.8.2:package-lock.json\n\n{\n  \"name\": \"@lucasygu/redbook\",\n  \"version\": \"0.8.2\",\n  \"lockfileVersion\": 3,\n  \"requires\": true,\n  \"packages\": {\n    \"\": {\n      \"name\": \"@lucasygu/redbook\",\n      \"version\": \"0.8.2\",\n      \"hasInstallScript\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"@steipete/sweet-cookie\": \"^0.1.0\",\n        \"commander\": \"^13.1.0\",\n        \"kleur\": \"^4.1.5\"\n      },\n      \"bin\": {\n        \"redbook\": \"dist/cli.js\"\n      },\n      \"devDependencies\": {\n        \"@types/node\": \"^22.0.0\",\n        \"marked\": \"^15.0.0\",\n        \"puppeteer-core\": \"^24.0.0\",\n        \"typescript\": \"^5.7.0\"\n      },\n      \"engines\": {\n        \"node\": \">=22\"\n      },\n      \"peerDependencies\": {\n        \"marked\": \">=9.0.0\",\n        \"puppeteer-core\": \">=21.0.0\"\n      },\n      \"peerDependenciesMeta\": {\n        \"marked\": {\n          \"optional\": true\n        },\n        \"puppeteer-core\": {\n          \"optional\": true\n        }\n      }\n    },\n    \"node_modules/@puppeteer/browsers\": {\n      \"version\": \"2.13.0\",\n      \"resolved\": \"https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.13.0.tgz\",\n      \"integrity\": \"sha512-46BZJYJjc/WwmKjsvDFykHtXrtomsCIrwYQPOP7VfMJoZY2bsDF9oROBABR3paDjDcmkUye1Pb1BqdcdiipaWA==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"debug\": \"^4.4.3\",\n        \"extract-zip\": \"^2.0.1\",\n        \"progress\": \"^2.0.3\",\n        \"proxy-agent\": \"^6.5.0\",\n        \"semver\": \"^7.7.4\",\n        \"tar-fs\": \"^3.1.1\",\n        \"yargs\": \"^17.7.2\"\n      },\n      \"bin\": {\n        \"browsers\": \"lib/cjs/main-cli.js\"\n      },\n      \"engines\": {\n        \"node\": \">=18\"\n      }\n    },\n    \"node_modules/@steipete/sweet-cookie\": {\n      \"version\": \"0.1.0\",\n      \"resolved\": \"https://registry.npmjs.org/@steipete/sweet-cookie/-/sweet-cookie-0.1.0.tgz\",\n      \"integrity\": \"sha512-cF8hS6rTohAFI1NAm2/HM9omBlw6V1DpwF6q5e9FB+l274HjtyirCgCc6QK2Rtuh7uDoqWHshFQZPsceyJuVgw==\",\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=22\"\n      }\n    },\n    \"node_modules/@tootallnate/quickjs-emscripten\": {\n      \"version\": \"0.23.0\",\n      \"resolved\": \"https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz\",\n      \"integrity\": \"sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/@types/node\": {\n      \"version\": \"22.19.11\",\n      \"resolved\": \"https://registry.npmjs.org/@types/node/-/node-22.19.11.tgz\",\n      \"integrity\": \"sha512-BH7YwL6rA93ReqeQS1c4bsPpcfOmJasG+Fkr6Y59q83f9M1WcBRHR2vM+P9eOisYRcN3ujQoiZY8uk5W+1WL8w==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"undici-types\": \"~6.21.0\"\n      }\n    },\n    \"node_modules/@types/yauzl\": {\n      \"version\": \"2.10.3\",\n      \"resolved\": \"https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz\",\n      \"integrity\": \"sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"optional\": true,\n      \"dependencies\": {\n        \"@types/node\": \"*\"\n      }\n    },\n    \"node_modules/agent-base\": {\n      \"version\": \"7.1.4\",\n      \"resolved\": \"https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz\",\n      \"integrity\": \"sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/ansi-regex\": {\n      \"version\": \"5.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz\",\n      \"integrity\": \"sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=8\"\n      }\n    },\n    \"node_modules/ansi-styles\": {\n      \"version\": \"4.3.0\",\n      \"resolved\": \"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz\",\n      \"integrity\": \"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"color-convert\": \"^2.0.1\"\n      },\n      \"engines\": {\n        \"node\": \">=8\"\n      },\n      \"funding\": {\n        \"url\": \"https://github.com/chalk/ansi-styles?sponsor=1\"\n      }\n    },\n    \"node_modules/ast-types\": {\n      \"version\": \"0.13.4\",\n      \"resolved\": \"https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz\",\n      \"integrity\": \"sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"tslib\": \"^2.0.1\"\n      },\n      \"engines\": {\n        \"node\": \">=4\"\n      }\n    },\n    \"node_modules/b4a\": {\n      \"version\": \"1.8.0\",\n      \"resolved\": \"https://registry.npmjs.org/b4a/-/b4a-1.8.0.tgz\",\n      \"integrity\": \"sha512-qRuSmNSkGQaHwNbM7J78Wwy+ghLEYF1zNrSeMxj4Kgw6y33O3mXcQ6Ie9fRvfU/YnxWkOchPXbaLb73TkIsfdg==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"peerDependencies\": {\n        \"react-native-b4a\": \"*\"\n      },\n      \"peerDependenciesMeta\": {\n        \"react-native-b4a\": {\n          \"optional\": true\n        }\n      }\n    },\n    \"node_modules/bare-events\": {\n      \"version\": \"2.8.2\",\n      \"resolved\": \"https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz\",\n      \"integrity\": \"sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"peerDependencies\": {\n        \"bare-abort-controller\": \"*\"\n      },\n      \"peerDependenciesMeta\": {\n        \"bare-abort-controller\": {\n          \"optional\": true\n        }\n      }\n    },\n    \"node_modules/bare-fs\": {\n      \"version\": \"4.5.5\",\n      \"resolved\": \"https://registry.npmjs.org/bare-fs/-/bare-fs-4.5.5.tgz\",\n      \"integrity\": \"sha512-XvwYM6VZqKoqDll8BmSww5luA5eflDzY0uEFfBJtFKe4PAAtxBjU3YIxzIBzhyaEQBy1VXEQBto4cpN5RZJw+w==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"bare-events\": \"^2.5.4\",\n        \"bare-path\": \"^3.0.0\",\n        \"bare-stream\": \"^2.6.4\",\n        \"bare-url\": \"^2.2.2\",\n        \"fast-fifo\": \"^1.3.2\"\n      },\n      \"engines\": {\n        \"bare\": \">=1.16.0\"\n      },\n      \"peerDependencies\": {\n        \"bare-buffer\": \"*\"\n      },\n      \"peerDependenciesMeta\": {\n        \"bare-buffer\": {\n          \"optional\": true\n        }\n      }\n    },\n    \"node_modules/bare-os\": {\n      \"version\": \"3.7.0\",\n      \"resolved\": \"https://registry.npmjs.org/bare-os/-/bare-os-3.7.0.tgz\",\n      \"integrity\": \"sha512-64Rcwj8qlnTZU8Ps6JJEdSmxBEUGgI7g8l+lMtsJLl4IsfTcHMTfJ188u2iGV6P6YPRZrtv72B2kjn+hp+Yv3g==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"engines\": {\n        \"bare\": \">=1.14.0\"\n      }\n    },\n    \"node_modules/bare-path\": {\n      \"version\": \"3.0.0\",\n      \"resolved\": \"https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz\",\n      \"integrity\": \"sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"bare-os\": \"^3.0.1\"\n      }\n    },\n    \"node_modules/bare-stream\": {\n      \"version\": \"2.8.0\",\n      \"resolved\": \"https://registry.npmjs.org/bare-stream/-/bare-stream-2.8.0.tgz\",\n      \"integrity\": \"sha512-reUN0M2sHRqCdG4lUK3Fw8w98eeUIZHL5c3H7Mbhk2yVBL+oofgaIp0ieLfD5QXwPCypBpmEEKU2WZKzbAk8GA==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"streamx\": \"^2.21.0\",\n        \"teex\": \"^1.0.1\"\n      },\n      \"peerDependencies\": {\n        \"bare-buffer\": \"*\",\n        \"bare-events\": \"*\"\n      },\n      \"peerDependenciesMeta\": {\n        \"bare-buffer\": {\n          \"optional\": true\n        },\n        \"bare-events\": {\n          \"optional\": true\n        }\n      }\n    },\n    \"node_modules/bare-url\": {\n      \"version\": \"2.3.2\",\n      \"resolved\": \"https://registry.npmjs.org/bare-url/-/bare-url-2.3.2.tgz\",\n      \"integrity\": \"sha512-ZMq4gd9ngV5aTMa5p9+UfY0b3skwhHELaDkhEHetMdX0LRkW9kzaym4oo/Eh+Ghm0CCDuMTsRIGM/ytUc1ZYmw==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"bare-path\": \"^3.0.0\"\n      }\n    },\n    \"node_modules/basic-ftp\": {\n      \"version\": \"5.2.0\",\n      \"resolved\": \"https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.2.0.tgz\",\n      \"integrity\": \"sha512-VoMINM2rqJwJgfdHq6RiUudKt2BV+FY5ZFezP/ypmwayk68+NzzAQy4XXLlqsGD4MCzq3DrmNFD/uUmBJuGoXw==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=10.0.0\"\n      }\n    },\n    \"node_modules/buffer-crc32\": {\n      \"version\": \"0.2.13\",\n      \"resolved\": \"https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz\",\n      \"integrity\": \"sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \"*\"\n      }\n    },\n    \"node_modules/chromium-bidi\": {\n      \"version\": \"14.0.0\",\n      \"resolved\": \"https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-14.0.0.tgz\",\n      \"integrity\": \"sha512-9gYlLtS6tStdRWzrtXaTMnqcM4dudNegMXJxkR0I/CXObHalYeYcAMPrL19eroNZHtJ8DQmu1E+ZNOYu/IXMXw==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"mitt\": \"^3.0.1\",\n        \"zod\": \"^3.24.1\"\n      },\n      \"peerDependencies\": {\n        \"devtools-protocol\": \"*\"\n      }\n    },\n    \"node_modules/cliui\": {\n      \"version\": \"8.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz\",\n      \"integrity\": \"sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==\",\n      \"dev\": true,\n      \"license\": \"ISC\",\n      \"dependencies\": {\n        \"string-width\": \"^4.2.0\",\n        \"strip-ansi\": \"^6.0.1\",\n        \"wrap-ansi\": \"^7.0.0\"\n      },\n      \"engines\": {\n        \"node\": \">=12\"\n      }\n    },\n    \"node_modules/color-convert\": {\n      \"version\": \"2.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz\",\n      \"integrity\": \"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"color-name\": \"~1.1.4\"\n      },\n      \"engines\": {\n        \"node\": \">=7.0.0\"\n      }\n    },\n    \"node_modules/color-name\": {\n      \"version\": \"1.1.4\",\n      \"resolved\": \"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz\",\n      \"integrity\": \"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/commander\": {\n      \"version\": \"13.1.0\",\n      \"resolved\": \"https://registry.npmjs.org/commander/-/commander-13.1.0.tgz\",\n      \"integrity\": \"sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==\",\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=18\"\n      }\n    },\n    \"node_modules/data-uri-to-buffer\": {\n      \"version\": \"6.0.2\",\n      \"resolved\": \"https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz\",\n      \"integrity\": \"sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/debug\": {\n      \"version\": \"4.4.3\",\n      \"resolved\": \"https://registry.npmjs.org/debug/-/debug-4.4.3.tgz\",\n      \"integrity\": \"sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"ms\": \"^2.1.3\"\n      },\n      \"engines\": {\n        \"node\": \">=6.0\"\n      },\n      \"peerDependenciesMeta\": {\n        \"supports-color\": {\n          \"optional\": true\n        }\n      }\n    },\n    \"node_modules/degenerator\": {\n      \"version\": \"5.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz\",\n      \"integrity\": \"sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"ast-types\": \"^0.13.4\",\n        \"escodegen\": \"^2.1.0\",\n        \"esprima\": \"^4.0.1\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/devtools-protocol\": {\n      \"version\": \"0.0.1566079\",\n      \"resolved\": \"https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1566079.tgz\",\n      \"integrity\": \"sha512-MJfAEA1UfVhSs7fbSQOG4czavUp1ajfg6prlAN0+cmfa2zNjaIbvq8VneP7do1WAQQIvgNJWSMeP6UyI90gIlQ==\",\n      \"dev\": true,\n      \"license\": \"BSD-3-Clause\"\n    },\n    \"node_modules/emoji-regex\": {\n      \"version\": \"8.0.0\",\n      \"resolved\": \"https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz\",\n      \"integrity\": \"sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/end-of-stream\": {\n      \"version\": \"1.4.5\",\n      \"resolved\": \"https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz\",\n      \"integrity\": \"sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"once\": \"^1.4.0\"\n      }\n    },\n    \"node_modules/escalade\": {\n      \"version\": \"3.2.0\",\n      \"resolved\": \"https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz\",\n      \"integrity\": \"sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=6\"\n      }\n    },\n    \"node_modules/escodegen\": {\n      \"version\": \"2.1.0\",\n      \"resolved\": \"https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz\",\n      \"integrity\": \"sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==\",\n      \"dev\": true,\n      \"license\": \"BSD-2-Clause\",\n      \"dependencies\": {\n        \"esprima\": \"^4.0.1\",\n        \"estraverse\": \"^5.2.0\",\n        \"esutils\": \"^2.0.2\"\n      },\n      \"bin\": {\n        \"escodegen\": \"bin/escodegen.js\",\n        \"esgenerate\": \"bin/esgenerate.js\"\n      },\n      \"engines\": {\n        \"node\": \">=6.0\"\n      },\n      \"optionalDependencies\": {\n        \"source-map\": \"~0.6.1\"\n      }\n    },\n    \"node_modules/esprima\": {\n      \"version\": \"4.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz\",\n      \"integrity\": \"sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==\",\n      \"dev\": true,\n      \"license\": \"BSD-2-Clause\",\n      \"bin\": {\n        \"esparse\": \"bin/esparse.js\",\n        \"esvalidate\": \"bin/esvalidate.js\"\n      },\n      \"engines\": {\n        \"node\": \">=4\"\n      }\n    },\n    \"node_modules/estraverse\": {\n      \"version\": \"5.3.0\",\n      \"resolved\": \"https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz\",\n      \"integrity\": \"sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==\",\n      \"dev\": true,\n      \"license\": \"BSD-2-Clause\",\n      \"engines\": {\n        \"node\": \">=4.0\"\n      }\n    },\n    \"node_modules/esutils\": {\n      \"version\": \"2.0.3\",\n      \"resolved\": \"https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz\",\n      \"integrity\": \"sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==\",\n      \"dev\": true,\n      \"license\": \"BSD-2-Clause\",\n      \"engines\": {\n        \"node\": \">=0.10.0\"\n      }\n    },\n    \"node_modules/events-universal\": {\n      \"version\": \"1.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz\",\n      \"integrity\": \"sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"bare-events\": \"^2.7.0\"\n      }\n    },\n    \"node_modules/extract-zip\": {\n      \"version\": \"2.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz\",\n      \"integrity\": \"sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==\",\n      \"dev\": true,\n      \"license\": \"BSD-2-Clause\",\n      \"dependencies\": {\n        \"debug\": \"^4.1.1\",\n        \"get-stream\": \"^5.1.0\",\n        \"yauzl\": \"^2.10.0\"\n      },\n      \"bin\": {\n        \"extract-zip\": \"cli.js\"\n      },\n      \"engines\": {\n        \"node\": \">= 10.17.0\"\n      },\n      \"optionalDependencies\": {\n        \"@types/yauzl\": \"^2.9.1\"\n      }\n    },\n    \"node_modules/fast-fifo\": {\n      \"version\": \"1.3.2\",\n      \"resolved\": \"https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz\",\n      \"integrity\": \"sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/fd-slicer\": {\n      \"version\": \"1.1.0\",\n      \"resolved\": \"https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz\",\n      \"integrity\": \"sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"pend\": \"~1.2.0\"\n      }\n    },\n    \"node_modules/get-caller-file\": {\n      \"version\": \"2.0.5\",\n      \"resolved\": \"https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz\",\n      \"integrity\": \"sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==\",\n      \"dev\": true,\n      \"license\": \"ISC\",\n      \"engines\": {\n        \"node\": \"6.* || 8.* || >= 10.*\"\n      }\n    },\n    \"node_modules/get-stream\": {\n      \"version\": \"5.2.0\",\n      \"resolved\": \"https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz\",\n      \"integrity\": \"sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"pump\": \"^3.0.0\"\n      },\n      \"engines\": {\n        \"node\": \">=8\"\n      },\n      \"funding\": {\n        \"url\": \"https://github.com/sponsors/sindresorhus\"\n      }\n    },\n    \"node_modules/get-uri\": {\n      \"version\": \"6.0.5\",\n      \"resolved\": \"https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz\",\n      \"integrity\": \"sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"basic-ftp\": \"^5.0.2\",\n        \"data-uri-to-buffer\": \"^6.0.2\",\n        \"debug\": \"^4.3.4\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/http-proxy-agent\": {\n      \"version\": \"7.0.2\",\n      \"resolved\": \"https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz\",\n      \"integrity\": \"sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"agent-base\": \"^7.1.0\",\n        \"debug\": \"^4.3.4\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/https-proxy-agent\": {\n      \"version\": \"7.0.6\",\n      \"resolved\": \"https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz\",\n      \"integrity\": \"sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"agent-base\": \"^7.1.2\",\n        \"debug\": \"4\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/ip-address\": {\n      \"version\": \"10.1.0\",\n      \"resolved\": \"https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz\",\n      \"integrity\": \"sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">= 12\"\n      }\n    },\n    \"node_modules/is-fullwidth-code-point\": {\n      \"version\": \"3.0.0\",\n      \"resolved\": \"https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz\",\n      \"integrity\": \"sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=8\"\n      }\n    },\n    \"node_modules/kleur\": {\n      \"version\": \"4.1.5\",\n      \"resolved\": \"https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz\",\n      \"integrity\": \"sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==\",\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=6\"\n      }\n    },\n    \"node_modules/lru-cache\": {\n      \"version\": \"7.18.3\",\n      \"resolved\": \"https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz\",\n      \"integrity\": \"sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==\",\n      \"dev\": true,\n      \"license\": \"ISC\",\n      \"engines\": {\n        \"node\": \">=12\"\n      }\n    },\n    \"node_modules/marked\": {\n      \"version\": \"15.0.12\",\n      \"resolved\": \"https://registry.npmjs.org/marked/-/marked-15.0.12.tgz\",\n      \"integrity\": \"sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"bin\": {\n        \"marked\": \"bin/marked.js\"\n      },\n      \"engines\": {\n        \"node\": \">= 18\"\n      }\n    },\n    \"node_modules/mitt\": {\n      \"version\": \"3.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz\",\n      \"integrity\": \"sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/ms\": {\n      \"version\": \"2.1.3\",\n      \"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.1.3.tgz\",\n      \"integrity\": \"sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/netmask\": {\n      \"version\": \"2.0.2\",\n      \"resolved\": \"https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz\",\n      \"integrity\": \"sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">= 0.4.0\"\n      }\n    },\n    \"node_modules/once\": {\n      \"version\": \"1.4.0\",\n      \"resolved\": \"https://registry.npmjs.org/once/-/once-1.4.0.tgz\",\n      \"integrity\": \"sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==\",\n      \"dev\": true,\n      \"license\": \"ISC\",\n      \"dependencies\": {\n        \"wrappy\": \"1\"\n      }\n    },\n    \"node_modules/pac-proxy-agent\": {\n      \"version\": \"7.2.0\",\n      \"resolved\": \"https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz\",\n      \"integrity\": \"sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"@tootallnate/quickjs-emscripten\": \"^0.23.0\",\n        \"agent-base\": \"^7.1.2\",\n        \"debug\": \"^4.3.4\",\n        \"get-uri\": \"^6.0.1\",\n        \"http-proxy-agent\": \"^7.0.0\",\n        \"https-proxy-agent\": \"^7.0.6\",\n        \"pac-resolver\": \"^7.0.1\",\n        \"socks-proxy-agent\": \"^8.0.5\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/pac-resolver\": {\n      \"version\": \"7.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz\",\n      \"integrity\": \"sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"degenerator\": \"^5.0.0\",\n        \"netmask\": \"^2.0.2\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/pend\": {\n      \"version\": \"1.2.0\",\n      \"resolved\": \"https://registry.npmjs.org/pend/-/pend-1.2.0.tgz\",\n      \"integrity\": \"sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/progress\": {\n      \"version\": \"2.0.3\",\n      \"resolved\": \"https://registry.npmjs.org/progress/-/progress-2.0.3.tgz\",\n      \"integrity\": \"sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=0.4.0\"\n      }\n    },\n    \"node_modules/proxy-agent\": {\n      \"version\": \"6.5.0\",\n      \"resolved\": \"https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz\",\n      \"integrity\": \"sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"agent-base\": \"^7.1.2\",\n        \"debug\": \"^4.3.4\",\n        \"http-proxy-agent\": \"^7.0.1\",\n        \"https-proxy-agent\": \"^7.0.6\",\n        \"lru-cache\": \"^7.14.1\",\n        \"pac-proxy-agent\": \"^7.1.0\",\n        \"proxy-from-env\": \"^1.1.0\",\n        \"socks-proxy-agent\": \"^8.0.5\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/proxy-from-env\": {\n      \"version\": \"1.1.0\",\n      \"resolved\": \"https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz\",\n      \"integrity\": \"sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/pump\": {\n      \"version\": \"3.0.4\",\n      \"resolved\": \"https://registry.npmjs.org/pump/-/pump-3.0.4.tgz\",\n      \"integrity\": \"sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"end-of-stream\": \"^1.1.0\",\n        \"once\": \"^1.3.1\"\n      }\n    },\n    \"node_modules/puppeteer-core\": {\n      \"version\": \"24.37.5\",\n      \"resolved\": \"https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.37.5.tgz\",\n      \"integrity\": \"sha512-ybL7iE78YPN4T6J+sPLO7r0lSByp/0NN6PvfBEql219cOnttoTFzCWKiBOjstXSqi/OKpwae623DWAsL7cn2MQ==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"@puppeteer/browsers\": \"2.13.0\",\n        \"chromium-bidi\": \"14.0.0\",\n        \"debug\": \"^4.4.3\",\n        \"devtools-protocol\": \"0.0.1566079\",\n        \"typed-query-selector\": \"^2.12.0\",\n        \"webdriver-bidi-protocol\": \"0.4.1\",\n        \"ws\": \"^8.19.0\"\n      },\n      \"engines\": {\n        \"node\": \">=18\"\n      }\n    },\n    \"node_modules/require-directory\": {\n      \"version\": \"2.1.1\",\n      \"resolved\": \"https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz\",\n      \"integrity\": \"sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=0.10.0\"\n      }\n    },\n    \"node_modules/semver\": {\n      \"version\": \"7.7.4\",\n      \"resolved\": \"https://registry.npmjs.org/semver/-/semver-7.7.4.tgz\",\n      \"integrity\": \"sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==\",\n      \"dev\": true,\n      \"license\": \"ISC\",\n      \"bin\": {\n        \"semver\": \"bin/semver.js\"\n      },\n      \"engines\": {\n        \"node\": \">=10\"\n      }\n    },\n    \"node_modules/smart-buffer\": {\n      \"version\": \"4.2.0\",\n      \"resolved\": \"https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz\",\n      \"integrity\": \"sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">= 6.0.0\",\n        \"npm\": \">= 3.0.0\"\n      }\n    },\n    \"node_modules/socks\": {\n      \"version\": \"2.8.7\",\n      \"resolved\": \"https://registry.npmjs.org/socks/-/socks-2.8.7.tgz\",\n      \"integrity\": \"sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"ip-address\": \"^10.0.1\",\n        \"smart-buffer\": \"^4.2.0\"\n      },\n      \"engines\": {\n        \"node\": \">= 10.0.0\",\n        \"npm\": \">= 3.0.0\"\n      }\n    },\n    \"node_modules/socks-proxy-agent\": {\n      \"version\": \"8.0.5\",\n      \"resolved\": \"https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz\",\n      \"integrity\": \"sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"agent-base\": \"^7.1.2\",\n        \"debug\": \"^4.3.4\",\n        \"socks\": \"^2.8.3\"\n      },\n      \"engines\": {\n        \"node\": \">= 14\"\n      }\n    },\n    \"node_modules/source-map\": {\n      \"version\": \"0.6.1\",\n      \"resolved\": \"https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz\",\n      \"integrity\": \"sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==\",\n      \"dev\": true,\n      \"license\": \"BSD-3-Clause\",\n      \"optional\": true,\n      \"engines\": {\n        \"node\": \">=0.10.0\"\n      }\n    },\n    \"node_modules/streamx\": {\n      \"version\": \"2.23.0\",\n      \"resolved\": \"https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz\",\n      \"integrity\": \"sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"events-universal\": \"^1.0.0\",\n        \"fast-fifo\": \"^1.3.2\",\n        \"text-decoder\": \"^1.1.0\"\n      }\n    },\n    \"node_modules/string-width\": {\n      \"version\": \"4.2.3\",\n      \"resolved\": \"https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz\",\n      \"integrity\": \"sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"emoji-regex\": \"^8.0.0\",\n        \"is-fullwidth-code-point\": \"^3.0.0\",\n        \"strip-ansi\": \"^6.0.1\"\n      },\n      \"engines\": {\n        \"node\": \">=8\"\n      }\n    },\n    \"node_modules/strip-ansi\": {\n      \"version\": \"6.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz\",\n      \"integrity\": \"sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"ansi-regex\": \"^5.0.1\"\n      },\n      \"engines\": {\n        \"node\": \">=8\"\n      }\n    },\n    \"node_modules/tar-fs\": {\n      \"version\": \"3.1.1\",\n      \"resolved\": \"https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz\",\n      \"integrity\": \"sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"pump\": \"^3.0.0\",\n        \"tar-stream\": \"^3.1.5\"\n      },\n      \"optionalDependencies\": {\n        \"bare-fs\": \"^4.0.1\",\n        \"bare-path\": \"^3.0.0\"\n      }\n    },\n    \"node_modules/tar-stream\": {\n      \"version\": \"3.1.8\",\n      \"resolved\": \"https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.8.tgz\",\n      \"integrity\": \"sha512-U6QpVRyCGHva435KoNWy9PRoi2IFYCgtEhq9nmrPPpbRacPs9IH4aJ3gbrFC8dPcXvdSZ4XXfXT5Fshbp2MtlQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"b4a\": \"^1.6.4\",\n        \"bare-fs\": \"^4.5.5\",\n        \"fast-fifo\": \"^1.2.0\",\n        \"streamx\": \"^2.15.0\"\n      }\n    },\n    \"node_modules/teex\": {\n      \"version\": \"1.0.1\",\n      \"resolved\": \"https://registry.npmjs.org/teex/-/teex-1.0.1.tgz\",\n      \"integrity\": \"sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"streamx\": \"^2.12.5\"\n      }\n    },\n    \"node_modules/text-decoder\": {\n      \"version\": \"1.2.7\",\n      \"resolved\": \"https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz\",\n      \"integrity\": \"sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"dependencies\": {\n        \"b4a\": \"^1.6.4\"\n      }\n    },\n    \"node_modules/tslib\": {\n      \"version\": \"2.8.1\",\n      \"resolved\": \"https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz\",\n      \"integrity\": \"sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==\",\n      \"dev\": true,\n      \"license\": \"0BSD\"\n    },\n    \"node_modules/typed-query-selector\": {\n      \"version\": \"2.12.1\",\n      \"resolved\": \"https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.1.tgz\",\n      \"integrity\": \"sha512-uzR+FzI8qrUEIu96oaeBJmd9E7CFEiQ3goA5qCVgc4s5llSubcfGHq9yUstZx/k4s9dXHVKsE35YWoFyvEqEHA==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/typescript\": {\n      \"version\": \"5.9.3\",\n      \"resolved\": \"https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz\",\n      \"integrity\": \"sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\",\n      \"bin\": {\n        \"tsc\": \"bin/tsc\",\n        \"tsserver\": \"bin/tsserver\"\n      },\n      \"engines\": {\n        \"node\": \">=14.17\"\n      }\n    },\n    \"node_modules/undici-types\": {\n      \"version\": \"6.21.0\",\n      \"resolved\": \"https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz\",\n      \"integrity\": \"sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\"\n    },\n    \"node_modules/webdriver-bidi-protocol\": {\n      \"version\": \"0.4.1\",\n      \"resolved\": \"https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.1.tgz\",\n      \"integrity\": \"sha512-ARrjNjtWRRs2w4Tk7nqrf2gBI0QXWuOmMCx2hU+1jUt6d00MjMxURrhxhGbrsoiZKJrhTSTzbIrc554iKI10qw==\",\n      \"dev\": true,\n      \"license\": \"Apache-2.0\"\n    },\n    \"node_modules/wrap-ansi\": {\n      \"version\": \"7.0.0\",\n      \"resolved\": \"https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz\",\n      \"integrity\": \"sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"ansi-styles\": \"^4.0.0\",\n        \"string-width\": \"^4.1.0\",\n        \"strip-ansi\": \"^6.0.0\"\n      },\n      \"engines\": {\n        \"node\": \">=10\"\n      },\n      \"funding\": {\n        \"url\": \"https://github.com/chalk/wrap-ansi?sponsor=1\"\n      }\n    },\n    \"node_modules/wrappy\": {\n      \"version\": \"1.0.2\",\n      \"resolved\": \"https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz\",\n      \"integrity\": \"sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==\",\n      \"dev\": true,\n      \"license\": \"ISC\"\n    },\n    \"node_modules/ws\": {\n      \"version\": \"8.19.0\",\n      \"resolved\": \"https://registry.npmjs.org/ws/-/ws-8.19.0.tgz\",\n      \"integrity\": \"sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"engines\": {\n        \"node\": \">=10.0.0\"\n      },\n      \"peerDependencies\": {\n        \"bufferutil\": \"^4.0.1\",\n        \"utf-8-validate\": \">=5.0.2\"\n      },\n      \"peerDependenciesMeta\": {\n        \"bufferutil\": {\n          \"optional\": true\n        },\n        \"utf-8-validate\": {\n          \"optional\": true\n        }\n      }\n    },\n    \"node_modules/y18n\": {\n      \"version\": \"5.0.8\",\n      \"resolved\": \"https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz\",\n      \"integrity\": \"sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==\",\n      \"dev\": true,\n      \"license\": \"ISC\",\n      \"engines\": {\n        \"node\": \">=10\"\n      }\n    },\n    \"node_modules/yargs\": {\n      \"version\": \"17.7.2\",\n      \"resolved\": \"https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz\",\n      \"integrity\": \"sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"cliui\": \"^8.0.1\",\n        \"escalade\": \"^3.1.1\",\n        \"get-caller-file\": \"^2.0.5\",\n        \"require-directory\": \"^2.1.1\",\n        \"string-width\": \"^4.2.3\",\n        \"y18n\": \"^5.0.5\",\n        \"yargs-parser\": \"^21.1.1\"\n      },\n      \"engines\": {\n        \"node\": \">=12\"\n      }\n    },\n    \"node_modules/yargs-parser\": {\n      \"version\": \"21.1.1\",\n      \"resolved\": \"https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz\",\n      \"integrity\": \"sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==\",\n      \"dev\": true,\n      \"license\": \"ISC\",\n      \"engines\": {\n        \"node\": \">=12\"\n      }\n    },\n    \"node_modules/yauzl\": {\n      \"version\": \"2.10.0\",\n      \"resolved\": \"https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz\",\n      \"integrity\": \"sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"dependencies\": {\n        \"buffer-crc32\": \"~0.2.3\",\n        \"fd-slicer\": \"~1.1.0\"\n      }\n    },\n    \"node_modules/zod\": {\n      \"version\": \"3.25.76\",\n      \"resolved\": \"https://registry.npmjs.org/zod/-/zod-3.25.76.tgz\",\n      \"integrity\": \"sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==\",\n      \"dev\": true,\n      \"license\": \"MIT\",\n      \"funding\": {\n        \"url\": \"https://github.com/sponsors/colinhacks\"\n      }\n    }\n  }\n}\n\nFile v0.8.2:package.json\n\n{\n  \"name\": \"@lucasygu/redbook\",\n  \"version\": \"0.8.2\",\n  \"description\": \"CLI tool for Xiaohongshu (Red Note) - read and post via private API\",\n  \"type\": \"module\",\n  \"main\": \"./dist/lib/client.js\",\n  \"exports\": {\n    \".\": \"./dist/lib/client.js\",\n    \"./cookies\": \"./dist/lib/cookies.js\",\n    \"./signing\": \"./dist/lib/signing.js\",\n    \"./render\": \"./dist/lib/render.js\"\n  },\n  \"bin\": {\n    \"redbook\": \"dist/cli.js\"\n  },\n  \"files\": [\n    \"dist/\",\n    \"scripts/\",\n    \"SKILL.md\",\n    \"LICENSE\",\n    \"README.md\"\n  ],\n  \"scripts\": {\n    \"build\": \"tsc && chmod +x dist/cli.js\",\n    \"dev\": \"tsc --watch\",\n    \"prepublishOnly\": \"npm run build\",\n    \"postinstall\": \"node scripts/postinstall.js\",\n    \"preuninstall\": \"node scripts/preuninstall.js\",\n    \"start\": \"node dist/cli.js\"\n  },\n  \"engines\": {\n    \"node\": \">=22\"\n  },\n  \"keywords\": [\n    \"xiaohongshu\",\n    \"redbook\",\n    \"xhs\",\n    \"red-note\",\n    \"cli\",\n    \"claude-code\",\n    \"claude-code-skill\"\n  ],\n  \"author\": \"lucasygu\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/lucasygu/redbook.git\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/lucasygu/redbook/issues\"\n  },\n  \"dependencies\": {\n    \"@steipete/sweet-cookie\": \"^0.1.0\",\n    \"commander\": \"^13.1.0\",\n    \"kleur\": \"^4.1.5\"\n  },\n  \"peerDependencies\": {\n    \"puppeteer-core\": \">=21.0.0\",\n    \"marked\": \">=9.0.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"puppeteer-core\": {\n      \"optional\": true\n    },\n    \"marked\": {\n      \"optional\": true\n    }\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.0.0\",\n    \"puppeteer-core\": \"^24.0.0\",\n    \"marked\": \"^15.0.0\",\n    \"typescript\": \"^5.7.0\"\n  }\n}\n\nFile v0.8.2:tsconfig.json\n\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"outDir\": \"./dist\",\n    \"rootDir\": \"./src\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"resolveJsonModule\": true,\n    \"declaration\": true,\n    \"declarationMap\": true,\n    \"sourceMap\": true\n  },\n  \"include\": [\"src/**/*\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n\nFile v0.8.2:LICENSE\n\nMIT License\n\nCopyright (c) 2026 Lucas Gu\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nArchive v0.8.1: 29 files, 127718 bytes\n\nFiles: CLAUDE.md (2423b), docs/content-language-strategy.md (1776b), docs/research-task-1789.md (12027b), LICENSE (1065b), package-lock.json (37516b), package.json (1644b), README.md (34557b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), skill-card.md (2745b), SKILL.md (60555b), social-preview.html (5184b), src/cli.ts (78675b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (22781b), src/lib/cookies.ts (13605b), src/lib/creator-signing.ts (1805b), src/lib/detect.ts (6769b), src/lib/fingerprint-data.ts (2376b), src/lib/health.ts (5631b), src/lib/platform.ts (2751b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21612b), src/lib/template.ts (8176b), src/lib/url.ts (1826b), tsconfig.json (458b), _meta.json (126b)\n\nFile v0.8.1:SKILL.md\n\n---\ndescription: Search, read, analyze, and automate Xiaohongshu (小红书) content via CLI\nallowed-tools: Bash, Read, Write, Glob, Grep\n# OpenClaw / ClawHub metadata (clawhub install redbook)\nname: redbook\nversion: 0.5.0\nmetadata:\n  openclaw:\n    requires:\n      bins:\n        - redbook\n    install:\n      - kind: node\n        package: \"@lucasygu/redbook\"\n        bins: [redbook]\n    os: [macos]\n    homepage: https://github.com/lucasygu/redbook\ntags:\n  - xiaohongshu\n  - social-media\n  - analytics\n  - content-ops\n---\n\n# Redbook — Xiaohongshu CLI\n\nUse the `redbook` CLI to search notes, read content, analyze creators, automate engagement, and research topics on Xiaohongshu (小红书/RED).\n\n**OpenClaw users:** Install via `clawhub install redbook` or `npm install -g @lucasygu/redbook`.\n\n> **⚠️ Research discipline (read this first).** XHS 风控 throttles *reading*, not just writing. Any research that reads more than a handful of notes MUST run through the **[Research Loop](#research-loop--rate-limit-safe-long-running-research)** — **human-paced by default** (~20 s/note, one at a time; a typical job finishes in tens of minutes, large ones spread across the day). Hammering `read` / `comments` / `analyze-viral` in a tight loop trips captcha / IP block (300012) within a few dozen hits and degrades the account for hours. ⚡ Fast mode is **emergency-only** and requires a printed warning + explicit user opt-in. Never fire reads in parallel or with zero delay.\n\n## Usage\n\n```\n/redbook search \"AI编程\"              # Search notes\n/redbook read <url>       \n\nArchive v0.8.0: 27 files, 111581 bytes\n\nFiles: CLAUDE.md (2423b), docs/content-language-strategy.md (1776b), docs/research-task-1789.md (12027b), LICENSE (1065b), package-lock.json (37516b), package.json (1644b), README.md (28412b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), skill-card.md (2965b), SKILL.md (54732b), social-preview.html (5184b), src/cli.ts (52084b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (21236b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/health.ts (5631b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), src/lib/url.ts (1826b), tsconfig.json (458b), _meta.json (126b)\n\nArchive v0.7.2: 26 files, 103973 bytes\n\nFiles: CLAUDE.md (2423b), docs/content-language-strategy.md (1776b), docs/research-task-1789.md (12027b), package-lock.json (37516b), package.json (1644b), README.md (28412b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), skill-card.md (2300b), SKILL.md (39860b), social-preview.html (5184b), src/cli.ts (52084b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (21236b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/health.ts (5631b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), src/lib/url.ts (1826b), tsconfig.json (458b), _meta.json (126b)\n\nArchive v0.7.1: 25 files, 102728 bytes\n\nFiles: CLAUDE.md (2423b), docs/content-language-strategy.md (1776b), docs/research-task-1789.md (12027b), package-lock.json (37516b), package.json (1644b), README.md (28412b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), SKILL.md (39860b), social-preview.html (5184b), src/cli.ts (52084b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (21236b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/health.ts (5631b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), src/lib/url.ts (1826b), tsconfig.json (458b), _meta.json (126b)\n\nArchive v0.7.0: 25 files, 102728 bytes\n\nFiles: CLAUDE.md (2423b), docs/content-language-strategy.md (1776b), docs/research-task-1789.md (12027b), package-lock.json (37516b), package.json (1644b), README.md (28412b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), SKILL.md (39860b), social-preview.html (5184b), src/cli.ts (52084b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (21236b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/health.ts (5631b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), src/lib/url.ts (1826b), tsconfig.json (458b), _meta.json (126b)\n\nArchive v0.6.0: 23 files, 99957 bytes\n\nFiles: CLAUDE.md (2423b), docs/research-task-1789.md (12027b), package-lock.json (37516b), package.json (1644b), README.md (28412b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), SKILL.md (39295b), social-preview.html (5184b), src/cli.ts (50966b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (21236b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/health.ts (5631b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), tsconfig.json (458b), _meta.json (126b)\n\nArchive v0.5.1: 22 files, 92429 bytes\n\nFiles: CLAUDE.md (2334b), docs/research-task-1789.md (12027b), package-lock.json (37516b), package.json (1644b), README.md (26303b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), SKILL.md (36628b), social-preview.html (5184b), src/cli.ts (36283b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (13405b), src/lib/client.ts (14336b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), tsconfig.json (458b), _meta.json (126b)\n\nArchive v0.5.0: 22 files, 91434 bytes\n\nFiles: CLAUDE.md (2334b), docs/research-task-1789.md (12027b), package-lock.json (37516b), package.json (1644b), README.md (26303b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), SKILL.md (36628b), social-preview.html (5184b), src/cli.ts (36283b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (9860b), src/lib/client.ts (14336b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), tsconfig.json (458b), _meta.json (126b)\n\nArchive v0.4.0: 22 files, 89620 bytes\n\nFiles: CLAUDE.md (2334b), docs/research-task-1789.md (12027b), package-lock.json (37516b), package.json (1644b), README.md (23168b), scripts/postinstall.js (4634b), scripts/preuninstall.js (1448b), SKILL.md (35570b), social-preview.html (5184b), src/cli.ts (32697b), src/lib/analyze.ts (20458b), src/lib/cdp-cookies.ts (9860b), src/lib/client.ts (13620b), src/lib/cookies.ts (12860b), src/lib/creator-signing.ts (1805b), src/lib/fingerprint-data.ts (2376b), src/lib/render.ts (19962b), src/lib/reply-strategy.ts (6099b), src/lib/signing.ts (21536b), src/lib/template.ts (8176b), tsconfig.json (458b), _meta.json (126b)","readmeExcerpt":"Skill: redbook Owner: lucasygu Summary: Search, read, analyze, and automate Xiaohongshu (小红书) content via CLI Tags: latest:0.8.2 Version history: v0.8.2 | 2026-09-12T18:08:08.283Z | auto redbook v0.8.2 - Added social-preview.png for improved sharing and visual identity. - Updated dependencies in package.json and package-lock.json. - Improved CLI and library logic in src/cli.ts, src/lib/client.ts, and src/lib/signing.","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"/redbook search \"AI编程\"              # Search notes\n/redbook read <url>                   # Read a note\n/redbook user <profileUrl>            # Creator profile\n/redbook account-report --file ids.txt --json  # Batch account metrics\n/redbook analyze <userId>             # Full creator analysis (profile + posts)"},{"language":"bash","snippet":"redbook search \"keyword1\" --sort popular --json\nredbook search \"keyword2\" --sort popular --json\n# Repeat for each keyword in your list"},{"language":"bash","snippet":"# Combine base topic with scene/angle keywords\nredbook search \"base topic + scene1\" --sort popular --json\nredbook search \"base topic + scene2\" --sort popular --json\nredbook search \"base topic + scene3\" --sort popular --json"},{"language":"text","snippet":"scene1    scene2    scene3    scene4\nbase topic   ████ 8K   ██ 2K     ████ 12K  ░░ 200"},{"language":"bash","snippet":"redbook analyze-viral \"<noteUrl>\" --json"},{"language":"bash","snippet":"# 1. Collect unique user_ids from search results across keywords\n#    Extract from items[].note_card.user.user_id\n\n# 2. For each creator:\nredbook user \"<userId>\" --json\nredbook user-posts \"<userId>\" --json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\ndescription: Search, read, analyze, and automate Xiaohongshu (小红书) content via CLI\nallowed-tools: Bash, Read, Write, Glob, Grep\n# OpenClaw / ClawHub metadata (clawhub install redbook)\nname: redbook\nversion: 0.5.0\nmetadata:\n  openclaw:\n    requires:\n      bins:\n        - redbook\n    install:\n      - kind: node\n        package: \"@lucasygu/redbook\"\n        bins: [redbook]\n    os: [macos]\n    homepage: https://github.com/lucasygu/redbook\ntags:\n  - xiaohongshu\n  - social-media\n  - analytics\n  - content-ops\n---\n\n# Redbook — Xiaohongshu CLI\n\nUse the `redbook` CLI to search notes, read content, analyze creators, automate engagement, and research topics on Xiaohongshu (小红书/RED).\n\n**OpenClaw users:** Install via `clawhub install redbook` or `npm install -g @lucasygu/redbook`.\n\n> **⚠️ Research discipline (read this first).** XHS 风控 throttles *reading*, not just writing. Any research that reads more than a handful of notes MUST run through the **[Research Loop](#research-loop--rate-limit-safe-long-running-research)** — **human-paced by default** (~20 s/note, one at a time; a typical job finishes in tens of minutes, large ones spread across the day). Hammering `read` / `comments` / `analyze-viral` in a tight loop trips captcha / IP block (300012) within a few dozen hits and degrades the account for hours. ⚡ Fast mode is **emergency-only** and requires a printed warning + explicit user opt-in. Never fire reads in parallel or with zero delay.\n\n## Usage\n\n```\n/redbook search \"AI编程\"              # Search notes\n/redbook read <url>                   # Read a note\n/redbook user <profileUrl>            # Creator profile\n/redbook account-report --file ids.txt --json  # Batch account metrics\n/redbook analyze <userId>             # Full creator analysis (profile + posts)\n```\n\n## Quick Reference\n\n| Intent | Command |\n|--------|---------|\n| Search notes | `redbook search \"keyword\" --json` |\n| Read a note | `redbook read <url> --json` |\n| Get comments | `redbook comments <url> --json --all` |\n| Creator profile | `redbook user <userId-or-profileUrl> --json` |\n| Creator's posts | `redbook user-posts <userId-or-profileUrl> --json` |\n| Batch account report | `redbook account-report --file accounts.txt --month YYYY-MM --json` |\n| Browse feed | `redbook feed --json` |\n| Search hashtags | `redbook topics \"keyword\" --json` |\n| Analyze viral note | `redbook analyze-viral <url> --json` |\n| Extract content template | `redbook viral-template <url1> <url2> --json` |\n| Post a comment | `redbook comment <url> --content \"text\"` |\n| Reply to comment | `redbook reply <url> --comment-id <id> --content \"text\"` |\n| Batch reply (preview) | `redbook batch-reply <url> --strategy questions --dry-run` |\n| Like a note | `redbook like <url>` |\n| Unlike a note | `redbook like <url> --undo` |\n| List favorites | `redbook favorites --json` or `redbook favorites <userId> --json` |\n| Collect a note | `redbook collect <url>` |\n| Remove from collection | `redbook uncollect <url>` |\n| List followers | `red"},{"path":"README.md","content":"# redbook — 小红书命令行工具\n\n小红书 CLI 工具：搜索笔记、阅读内容、分析博主、发布图文。使用浏览器 Cookie 认证，无需 API Key。\n\n[English](#english) | 中文\n\n> ### 最快上手方式\n>\n> 把这段话发给你的 AI 助手（Claude Code、Cursor、Codex、Windsurf、OpenClaw 等）：\n>\n> **\"帮我用 npm 安装 `@lucasygu/redbook` 这个小红书 CLI 工具，然后运行 `redbook whoami` 验证是否能正常连接。GitHub 地址：https://github.com/lucasygu/redbook\"**\n>\n> OpenClaw 用户也可以直接：**`clawhub install redbook`**\n>\n> AI 会自动完成安装、验证连接、处理可能的 Cookie 问题。你只需要确保已在 Chrome 中登录 xiaohongshu.com。\n>\n> 安装完成后，试试：**\"帮我分析'AI编程'这个话题在小红书上的竞争格局\"** —— AI 会自动搜索关键词、分析互动数据、发现头部博主、给出内容建议。\n\n## 安装\n\n```bash\nnpm install -g @lucasygu/redbook\n# 或通过 ClawHub（OpenClaw 生态）\nclawhub install redbook\n```\n\n需要 Node.js >= 22。支持 **macOS、Windows、Linux**。使用 Chrome 浏览器的 Cookie —— 请先在 Chrome 中登录 xiaohongshu.com。\n\n安装后运行 `redbook whoami` 验证连接。CLI 会自动检测所有 Chrome 配置文件，找到你的小红书登录状态。\n\n- **macOS** —— 如果遇到钥匙串弹窗，请点击\"始终允许\"\n- **Windows** —— Chrome 127+ 使用了 App-Bound Encryption，CLI 会自动启动 Chrome headless 模式读取 Cookie（需要先关闭 Chrome）。如果自动提取失败，可以用 `--cookie-string` 手动传入\n\n## 能做什么\n\n- **话题研究** —— 搜索关键词，分析哪些话题有流量、哪些是蓝海\n- **竞品分析** —— 找到头部博主，对比粉丝量、互动数据、内容风格\n- **爆款拆解** —— 分析爆款笔记的标题钩子、互动比例、评论主题\n- **爆款模板** —— 从多篇爆款笔记提取内容模板（标题结构、正文结构、钩子模式）\n- **限流检测** —— 检测笔记是否被隐形限流（通过创作者后台 API 的隐藏 level 字段）\n- **收藏专辑** —— 查看收藏专辑内容，分析专辑内的笔记\n- **收藏管理** —— 查看收藏列表、收藏/取消收藏笔记（支持自己和其他用户的公开收藏）\n- **评论管理** —— 发评论、回复评论、按策略批量回复（问题优先 / 高赞优先 / 未回复优先）\n- **图文卡片** —— Markdown 渲染为小红书风格的 PNG 图文卡片（7 种配色主题）\n- **内容策划** —— 基于数据发现内容机会，生成有数据支撑的选题建议\n- **受众洞察** —— 从互动信号推断目标用户画像\n\n通过 AI 助手使用时，这些工作流可以自动串联完成。直接使用 CLI 时，每个命令也可以独立运行。\n\n## 快速开始\n\n```bash\n# 检查连接\nredbook whoami\n\n# 搜索笔记\nredbook search \"AI编程\" --sort popular\n\n# 阅读笔记\nredbook read https://www.xiaohongshu.com/explore/abc123\n\n# 获取评论\nredbook comments https://www.xiaohongshu.com/explore/abc123 --all\n\n# 浏览推荐页\nredbook feed\n\n# 查看博主信息\nredbook user \"<profileUrl>\"\nredbook user-posts \"<profileUrl>\"\nredbook account-report --file kos-accounts.txt --month 2026-07 --json\n\n# 搜索话题标签\nredbook topics \"Claude Code\"\n\n# 查看收藏（默认当前用户）\nredbook favorites --json\nredbook favorites <userId> --json --all\n\n# 收藏/取消收藏\nredbook collect \"<noteUrl>\"\nredbook uncollect \"<noteUrl>\"\n\n# 分析爆款笔记\nredbook analyze-viral https://www.xiaohongshu.com/explore/abc123\n\n# 从多篇爆款提取内容模板\nredbook viral-template \"<url1>\" \"<url2>\" \"<url3>\" --json\n\n# 发评论\nredbook comment \"<noteUrl>\" --content \"写得好！\"\n\n# 回复评论\nredbook reply \"<noteUrl>\" --comment-id \"<id>\" --content \"感谢提问！\"\n\n# 按策略批量回复（先预览再执行）\nredbook batch-reply \"<noteUrl>\" --strategy questions --dry-run\nredbook batch-reply \"<noteUrl>\" --strategy questions --template \"感谢！{content}\" --max 10\n\n# 查看收藏专辑\nredbook boards                          # 列出自己的专辑\nredbook boards <userId>                 # 列出他人的专辑\nredbook board \"https://www.xiaohongshu.com/board/abc123\"\nredbook board abc123 --json\n\n# 检测笔记限流状态\nredbook health\nredbook health --all --json\n\n# 将 Markdown 渲染为图文卡片（需要可选依赖）\nredbook render content.md --style xiaohongshu\nredbook render content.md --style dark --output-dir ./cards\n\n# 发布图文笔记\nredbook post --title \"标题\" --body \"正文内容\" --images cover.png\nredbook post --title \"测试\" --body \"...\" -"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7609awkk9yh67wv7fmgtvkxn7zzm6q\",\n  \"slug\": \"redbook\",\n  \"version\": \"0.8.2\",\n  \"publishedAt\": 1789236488283\n}"},{"path":"CLAUDE.md","content":"# CLAUDE.md — redbook CLI\n\n## Publishing\n\n**NEVER publish npm packages directly from local.** Always use the `npm-publish-cli` agent to bump version and publish via CI. The GitHub Actions workflow (`Publish to npm`) handles publishing on push to main. Publishing locally races CI and causes workflow failures.\n\n**Dual publishing (automated):**\n- **npm** — publishes when `package.json` version changes on push to main\n- **ClawHub** — publishes when `SKILL.md` changes on push to main (uses `CLAWHUB_TOKEN` secret)\n\nBoth are conditional jobs in `.github/workflows/npm-publish.yml`. Manual trigger via `workflow_dispatch` is also available.\n\n## Build & Test\n\n- `npm run build` — TypeScript compile + chmod\n- No test suite yet — verify manually with `redbook whoami`\n\n## Project Structure\n\n- `src/cli.ts` — CLI entry point, 21 commands, `getClient()` is the single cookie→client funnel\n- `src/lib/client.ts` — XHS API client (`postComment`, `replyComment`, etc.)\n- `src/lib/cookies.ts` — Cookie extraction with Chrome profile auto-discovery\n- `src/lib/signing.ts` — Request signing\n- `src/lib/analyze.ts` — Viral note analysis and question detection\n- `src/lib/reply-strategy.ts` — Batch reply filtering, templating, rate-limited execution\n- `src/lib/template.ts` — Viral content template extraction\n- `src/lib/health.ts` — Note health check: level detection, sensitive words, tag count\n- `src/lib/render.ts` — Card rendering (markdown → PNG via puppeteer-core, optional dep)\n- `SKILL.md` — Skill documentation (serves both Claude Code and OpenClaw/ClawHub)\n- `.github/workflows/npm-publish.yml` — CI: build, npm publish, ClawHub publish\n\n## Render Command (Optional)\n\n- `redbook render <file>` — markdown → styled PNG cards using user's existing Chrome\n- Requires `puppeteer-core` and `marked` (optional peer deps, lazy imported)\n- Uses Chrome at `/Applications/Google Chrome.app/...` or `CHROME_PATH` env var\n- No cookies/XHS API needed — purely offline\n- HTML/CSS templates embedded as TypeScript template literals (no external files)\n\n## Cookie Architecture\n\n- Uses `@steipete/sweet-cookie` to read browser cookies\n- Auto-discovers Chrome profiles via `~/Library/Application Support/Google/Chrome/Local State`\n- Keychain timeout patched to 30s in node_modules (upstream bug: hardcoded 3s)\n- `--chrome-profile` flag available as escape hatch, but auto-discovery handles most cases"},{"path":"docs/content-language-strategy.md","content":"# Content Language Strategy: English First\n\n**Decided**: 2026-03-22\n**Source**: [@Jiaxi_Cui tweet](https://x.com/Jiaxi_Cui/status/2035415033149264083)\n\n---\n\n## Decision\n\n**Use English for X and LinkedIn. Do not build a Chinese X account.**\n\nThis resolves the long-running struggle over language choice.\n\n---\n\n## Reasoning (from @Jiaxi_Cui / Panda)\n\nChinese X is drifting toward an early Weibo atmosphere — flooded with marketing accounts. Too much noise, diminishing signal.\n\nEnglish X and LinkedIn have better conversion and are worth sustained effort.\n\nXHS is different — high community quality, very vertical. But treat it separately:\n- **Personal brand account** (high quality, curated): worth building\n- **Customer acquisition / promotional accounts**: different strategy entirely\n\n---\n\n## Platform Strategy Summary\n\n| Platform | Language | Strategy |\n|----------|----------|---------|\n| X / Twitter | **English** | Main personal brand channel |\n| LinkedIn | **English** | Professional + longer-form |\n| XHS (小红书) | Chinese | Separate vertical communities — high quality personal account |\n| YouTube | TBD | Likely English-first |\n\n---\n\n## Implications for Redbook CLI\n\nThe `redbook` tool is still valuable for:\n- XHS content creation and posting\n- XHS community research and engagement\n- Monitoring Chinese-language conversations about products/topics\n\nXHS is a distinct channel with different rules — not \"Chinese version of X\" but its own high-quality vertical community platform.\n\n---\n\n## Previous Struggle (Resolved)\n\nThe prior back-and-forth about \"中文还是英文\" is now settled:\n- Building a Chinese X account → **not worth it**\n- Building English X + LinkedIn → **do this**\n- XHS → **yes, but as its own track**\n\n---\n\n*Saved: 2026-03-22*"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1856,"uniquenessScore":44,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T09:37:07.683Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-09T09:37:07.683Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-09T20:53:47.225Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}