WeChat Article Pipeline
Create local article packages or check existing drafts; run external draft creation or publishing only when requested.
Core Decisions
- For article "检查" or "检查一下", read Check Mode before drafting. Report findings and improvements; edit only when requested. Respect narrower checks.
- When the user asks to annotate a term, follow annotations.md: use “(注1)” in the text and numbered explanations in a final appendix.
- Read writing-donts.md before drafting or revising; check articles against it before delivery, repackaging, or publishing, preserving its contextual scope and user-text rules.
- The first Markdown H1 is the canonical title; rename it there and require it.
- Enable secretary mode only on explicit "打开秘书模式", for this request; read style-guide.md. Do not mention it unless asked.
- Infer briefs from rough ideas. Integrate additions and corrections as reader-facing prose per workflow.md, preserving explicit verbatim instructions and quotations.
- For "不配图", "只排版", or "直接格式化", use the no-image path. If image generation is unavailable, follow the capability fallback in image-production.md; do not silently drop requested images.
- For 补图, continuation, or missing assets, use the missing-image path; preserve finished images.
- If the user asks to导入草稿箱, create a WeChat draft through official APIs only. Never use browser automation or private
mp.weixin.qq.com endpoints for delivery.
- Toutiao: use Computer Use to operate the user's real Chrome end to end and follow publishing-toutiao.md. Do not use Browser/Chrome browser automation, Playwright, CDP, DOM evaluation, or background tab objects for any Toutiao UI step.
- Toutiao publish authorization: a user-authored instruction to “发头条”, “发布头条”, or schedule a Toutiao post is already the confirmation to submit that same content to Toutiao at the stated time. Do not ask for a second publish confirmation in the same workflow; pause only when a material choice is missing or changed, or for CAPTCHA, authentication, or a platform hard blocker.
- Xiaohongshu: use Chrome + Computer Use and publishing-xiaohongshu.md.
- Three-platform sync: read publishing-three-platform.md, initialize its state, then create WeChat → Toutiao → Xiaohongshu drafts.
Workspace Contract
Keep final artifacts in the current workspace unless the user names another location:
- markdown:
<workspace>/files/<slug>.md
- check report:
<workspace>/files/<slug>.check.md
- focused markdown:
<workspace>/files/<slug>.focused.md
- image jobs:
<workspace>/files/<slug>.image-jobs.json
- HTML workbench:
<workspace>/files/<slug>.html
- job:
<workspace>/files/<slug>.job.json
- optional publish manifest:
<workspace>/files/<slug>.publish-manifest.json
- images:
<workspace>/image/<slug>/cover.png, body-*.png, closing.png
Keep final assets out of temp directories and $CODEX_HOME/generated_images.
Default Article Path
- Inspect
files/ and image/ before choosing a slug.
- Draft in markdown first. Use workflow.md and style-guide.md.
- Place visual placeholders in the markdown only when images are desired:
cover, body-1, body-2, ..., closing.
- Run the orchestration script once for planning:
python3 <skill>/scripts/postprocess_wechat_article.py \
<workspace>/files/<slug>.md \
<workspace>/files/<slug>.html \
--workspace <workspace> \
--article-slug <slug> \
--jobs-out <workspace>/files/<slug>.image-jobs.json \
--focused-article-out <workspace>/files/<slug>.focused.md \
--support-dir <workspace>/files/wechat-article-pipeline/<slug> \
--plan-only
- Read image-production.md, run its single-pass queue with currently available worker slots, and enforce strict 3:2 visuals.
- Rerun without
--plan-only to build the package. Add --publish-manifest only for requested API draft handoff.
- Run
verify_wechat_article_package.py <workspace>/files/<slug>.html and fix any failures before delivery.
- Follow delivery.md: an editable workbench gets a verified running URL first, then its HTML file; static-file requests get files directly.
Mount only the active platform preview from the sole Markdown source. Cache semantic HTML; embed images only while copying.
Fast Paths
No-image formatting:
python3 <skill>/scripts/postprocess_wechat_article.py \
<workspace>/files/<slug>.md \
<workspace>/files/<slug>.html \
--no-images \
--support-dir <workspace>/files/wechat-article-pipeline/<slug>
No body images, but draft-box delivery:
python3 <skill>/scripts/postprocess_wechat_article.py \
<workspace>/files/<slug>.md \
<workspace>/files/<slug>.html \
--no-images \
--publish-manifest \
--cover-image <workspace>/image/<slug>/cover.png
No-image WeChat drafts still need one cover for thumb_media_id; keep it out of the body.
Missing-image jobs only:
python3 <skill>/scripts/postprocess_wechat_article.py \
<workspace>/files/<slug>.md \
<workspace>/files/<slug>.html \
--workspace <workspace> \
--article-slug <slug> \
--jobs-out <workspace>/files/<slug>.image-jobs.json \
--missing-only \
--plan-only
Generate only listed images, then package without --missing-only.
Publishing Path
Read publishing.md before WeChat API calls. Dry-run first. First draft consumes its issue. Later same-conversation, same-slug drafts use --same-session-revision: reuse its saved signature; no advance. Never publish/group-send by default.
Inspect every live WeChat API result immediately. On 40164 or an IP-allowlist error, stop the entire delivery chain: do not retry, upload, package, or continue to Toutiao/Xiaohongshu. Report the outbound IP, ask the user to allowlist it, end the turn, and resume only after acknowledgment.
For Toutiao and Xiaohongshu, load their publishing reference before the first browser write. Follow each platform’s handoff, verification, submission latch, and recovery limits. Never repeat a possible final submission.
Safety Rules
- Do not overwrite an existing package unless the user asked for that exact slug or file.
- Do not delete old markdown, images, jobs, manifests, or support files without explicit permission.
- Do not install dependencies, modify agent config, switch accounts, or edit
.env credentials unless the user explicitly approves that action.
- Do not start nested agent runtimes or custom image API runners for normal image work.
- Keep
cover.png as the hero; derived WeChat crop previews never replace it.
- Enable Toutiao
头条首发 only when the user confirms eligibility.
- Do not use Xiaohongshu creator-platform private APIs, Cookie export, localStorage export, token extraction, or request replay for delivery.
- Publish no external hyperlinks in WeChat, Toutiao, or Xiaohongshu bodies. Keep source names as plain text; evidence links belong in separate check reports or support files.
Acceptance Checklist
For article packages, confirm:
- artifacts stay under the workspace, share one slug, contain every requested 3:2 visual, and leave no unresolved
{{visual:*}}
verify_wechat_article_package.py reports status: ok; delivery matches delivery.md, including a reachable server for editable workbenches
- Markdown uses relative image paths; all previews derive from it and preserve semantic headings and image positions
- Toutiao manual copy must not require a WeChat draft: use complete HTTPS receipts when available, otherwise embed all original images (including GIF), never loopback image URLs. Verify target-editor uploads before claiming delivery; Xiaohongshu embeds images during copy
- Toutiao uses only Computer Use against the real foreground Chrome, with one workbench copy and one system paste; Xiaohongshu keeps its own documented handoff. On a hard gate, preserve the diagnostic draft and stop
- delivery reports result paths, status, verified structure/images, and any public URL; platform bodies contain no external links
- added or revised prose stands alone for readers without chat residue, respecting requested verbatim text and quotations
References
- Drafting: workflow.md, style-guide.md.
- Images: image-production.md, image-rules.json.
- Contracts: job-schema.md.
- Delivery: publishing.md, publishing-three-platform.md, publishing-toutiao.md, publishing-xiaohongshu.md.
- Debug workbench rendering only: wechat-md-workbench.template.v3.html.
- Read .env.example only for requested API setup.
1---2name: wechat-article-pipeline3description: Use when producing Chinese WeChat/公众号 article packages, checking articles on "检查" or "检查一下", editable workbenches, image planning, WeChat draft API delivery, Toutiao/Xiaohongshu Chrome sync, three-platform drafts, or explicit "打开秘书模式" requests.4---56# WeChat Article Pipeline78Create local article packages or check existing drafts; run external draft creation or publishing only when requested.910## Core Decisions1112- For article "检查" or "检查一下", read [Check Mode](references/article-check.md) before drafting. Report findings and improvements; edit only when requested. Respect narrower checks.13- When the user asks to annotate a term, follow [annotations.md](references/annotations.md): use “(注1)” in the text and numbered explanations in a final appendix.14- Read [writing-donts.md](references/writing-donts.md) before drafting or revising; check articles against it before delivery, repackaging, or publishing, preserving its contextual scope and user-text rules.15- The first Markdown H1 is the canonical title; rename it there and require it.16- Enable secretary mode only on explicit "打开秘书模式", for this request; read [style-guide.md](references/style-guide.md). Do not mention it unless asked.17- Infer briefs from rough ideas. Integrate additions and corrections as reader-facing prose per [workflow.md](references/workflow.md), preserving explicit verbatim instructions and quotations.18- For "不配图", "只排版", or "直接格式化", use the no-image path. If image generation is unavailable, follow the capability fallback in [image-production.md](references/image-production.md); do not silently drop requested images.19- For 补图, continuation, or missing assets, use the missing-image path; preserve finished images.20- If the user asks to导入草稿箱, create a WeChat draft through official APIs only. Never use browser automation or private `mp.weixin.qq.com` endpoints for delivery.21- Toutiao: use Computer Use to operate the user's real Chrome end to end and follow [publishing-toutiao.md](references/publishing-toutiao.md). Do not use Browser/Chrome browser automation, Playwright, CDP, DOM evaluation, or background tab objects for any Toutiao UI step.22- Toutiao publish authorization: a user-authored instruction to “发头条”, “发布头条”, or schedule a Toutiao post is already the confirmation to submit that same content to Toutiao at the stated time. Do not ask for a second publish confirmation in the same workflow; pause only when a material choice is missing or changed, or for CAPTCHA, authentication, or a platform hard blocker.23- Xiaohongshu: use Chrome + Computer Use and [publishing-xiaohongshu.md](references/publishing-xiaohongshu.md).24- Three-platform sync: read [publishing-three-platform.md](references/publishing-three-platform.md), initialize its state, then create WeChat → Toutiao → Xiaohongshu drafts.2526## Workspace Contract2728Keep final artifacts in the current workspace unless the user names another location:2930- markdown: `<workspace>/files/<slug>.md`31- check report: `<workspace>/files/<slug>.check.md`32- focused markdown: `<workspace>/files/<slug>.focused.md`33- image jobs: `<workspace>/files/<slug>.image-jobs.json`34- HTML workbench: `<workspace>/files/<slug>.html`35- job: `<workspace>/files/<slug>.job.json`36- optional publish manifest: `<workspace>/files/<slug>.publish-manifest.json`37- images: `<workspace>/image/<slug>/cover.png`, `body-*.png`, `closing.png`3839Keep final assets out of temp directories and `$CODEX_HOME/generated_images`.4041## Default Article Path42431. Inspect `files/` and `image/` before choosing a slug.442. Draft in markdown first. Use [workflow.md](references/workflow.md) and [style-guide.md](references/style-guide.md).453. Place visual placeholders in the markdown only when images are desired: `cover`, `body-1`, `body-2`, ..., `closing`.464. Run the orchestration script once for planning:4748```bash49python3 <skill>/scripts/postprocess_wechat_article.py \50 <workspace>/files/<slug>.md \51 <workspace>/files/<slug>.html \52 --workspace <workspace> \53 --article-slug <slug> \54 --jobs-out <workspace>/files/<slug>.image-jobs.json \55 --focused-article-out <workspace>/files/<slug>.focused.md \56 --support-dir <workspace>/files/wechat-article-pipeline/<slug> \57 --plan-only58```59605. Read [image-production.md](references/image-production.md), run its single-pass queue with currently available worker slots, and enforce strict 3:2 visuals.616. Rerun without `--plan-only` to build the package. Add `--publish-manifest` only for requested API draft handoff.627. Run `verify_wechat_article_package.py <workspace>/files/<slug>.html` and fix any failures before delivery.638. Follow [delivery.md](references/delivery.md): an editable workbench gets a verified running URL first, then its HTML file; static-file requests get files directly.6465Mount only the active platform preview from the sole Markdown source. Cache semantic HTML; embed images only while copying.6667## Fast Paths6869No-image formatting:7071```bash72python3 <skill>/scripts/postprocess_wechat_article.py \73 <workspace>/files/<slug>.md \74 <workspace>/files/<slug>.html \75 --no-images \76 --support-dir <workspace>/files/wechat-article-pipeline/<slug>77```7879No body images, but draft-box delivery:8081```bash82python3 <skill>/scripts/postprocess_wechat_article.py \83 <workspace>/files/<slug>.md \84 <workspace>/files/<slug>.html \85 --no-images \86 --publish-manifest \87 --cover-image <workspace>/image/<slug>/cover.png88```8990No-image WeChat drafts still need one cover for `thumb_media_id`; keep it out of the body.9192Missing-image jobs only:9394```bash95python3 <skill>/scripts/postprocess_wechat_article.py \96 <workspace>/files/<slug>.md \97 <workspace>/files/<slug>.html \98 --workspace <workspace> \99 --article-slug <slug> \100 --jobs-out <workspace>/files/<slug>.image-jobs.json \101 --missing-only \102 --plan-only103```104105Generate only listed images, then package without `--missing-only`.106107## Publishing Path108109Read [publishing.md](references/publishing.md) before WeChat API calls. Dry-run first. First draft consumes its issue. Later same-conversation, same-slug drafts use `--same-session-revision`: reuse its saved signature; no advance. Never publish/group-send by default.110111Inspect every live WeChat API result immediately. On `40164` or an IP-allowlist error, stop the entire delivery chain: do not retry, upload, package, or continue to Toutiao/Xiaohongshu. Report the outbound IP, ask the user to allowlist it, end the turn, and resume only after acknowledgment.112113For Toutiao and Xiaohongshu, load their publishing reference before the first browser write. Follow each platform’s handoff, verification, submission latch, and recovery limits. Never repeat a possible final submission.114115## Safety Rules116117- Do not overwrite an existing package unless the user asked for that exact slug or file.118- Do not delete old markdown, images, jobs, manifests, or support files without explicit permission.119- Do not install dependencies, modify agent config, switch accounts, or edit `.env` credentials unless the user explicitly approves that action.120- Do not start nested agent runtimes or custom image API runners for normal image work.121- Keep `cover.png` as the hero; derived WeChat crop previews never replace it.122- Enable Toutiao `头条首发` only when the user confirms eligibility.123- Do not use Xiaohongshu creator-platform private APIs, Cookie export, localStorage export, token extraction, or request replay for delivery.124- Publish no external hyperlinks in WeChat, Toutiao, or Xiaohongshu bodies. Keep source names as plain text; evidence links belong in separate check reports or support files.125126## Acceptance Checklist127128For article packages, confirm:129130- artifacts stay under the workspace, share one slug, contain every requested 3:2 visual, and leave no unresolved `{{visual:*}}`131- `verify_wechat_article_package.py` reports `status: ok`; delivery matches [delivery.md](references/delivery.md), including a reachable server for editable workbenches132- Markdown uses relative image paths; all previews derive from it and preserve semantic headings and image positions133- Toutiao manual copy must not require a WeChat draft: use complete HTTPS receipts when available, otherwise embed all original images (including GIF), never loopback image URLs. Verify target-editor uploads before claiming delivery; Xiaohongshu embeds images during copy134- Toutiao uses only Computer Use against the real foreground Chrome, with one workbench copy and one system paste; Xiaohongshu keeps its own documented handoff. On a hard gate, preserve the diagnostic draft and stop135- delivery reports result paths, status, verified structure/images, and any public URL; platform bodies contain no external links136- added or revised prose stands alone for readers without chat residue, respecting requested verbatim text and quotations137138## References139140- Drafting: [workflow.md](references/workflow.md), [style-guide.md](references/style-guide.md).141- Images: [image-production.md](references/image-production.md), [image-rules.json](references/image-rules.json).142- Contracts: [job-schema.md](references/job-schema.md).143- Delivery: [publishing.md](references/publishing.md), [publishing-three-platform.md](references/publishing-three-platform.md), [publishing-toutiao.md](references/publishing-toutiao.md), [publishing-xiaohongshu.md](references/publishing-xiaohongshu.md).144- Debug workbench rendering only: [wechat-md-workbench.template.v3.html](assets/templates/wechat-md-workbench.template.v3.html).145- Read [.env.example](.env.example) only for requested API setup.