A Codex skill that adds verified links to recent owned content immediately before a website, Zhihu, or Toutiao draft is delivered.
publish-content-linking 在官网、知乎或今日头条文稿进入最终交付前运行。它会从已配置的官网、微信公众号、知乎和今日头条历史内容中检索高度相关的候选页面,在不改变文章主题、观点、事实、结论和结构的前提下,为现有句子添加平台适配的可点击链接。
微信公众号文稿不会触发本 Skill,但已配置的公众号文章可以作为官网或知乎文稿的候选链接来源。
- 只在发布平台明确且文稿处于定稿或交付前阶段时触发。
- 使用本地 JSON 元数据索引进行关键词初筛,再读取候选正文完成语义复核。
- 按最后更新时间或发布日期过滤六个自然月以前的内容;日期完全缺失时仍允许进入候选。
- 只使用配置中的自有内容,不添加第三方链接。
- 同一内容多平台发布时,按“官网 > 当前平台 > 其他自有平台”去重;平台合规规则优先。
- 只修改链接所在句,必要时最多再调整相邻一句。
- 不新增事实、案例、观点、标题、小标题、段落或相关阅读板块。
- 验证 HTTPS、可访问性、链接数量、来源归属和平台限制。
- 不添加 UTM 或其他追踪参数。
| 发布平台 | 链接规则 |
|---|---|
| 官网 | 最多 3 个链接;优先站内内容;所有链接在新标签页打开 |
| 知乎 | 最多 3 个链接,其中跨平台链接最多 1 个;禁止营销、私信、联系方式或资源领取式导流 |
| 今日头条 | 默认添加 1–2 个头条站内链接;默认不添加跨平台链接 |
| 微信公众号 | 不触发 Skill;文章只作为官网或知乎的候选来源 |
没有高度相关的候选内容时,允许不添加任何链接。详细规则见 platform-linking-rules.md。
git clone https://github.com/Stupides9169/codex-link-.git
cd codex-link-
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
cp -R publish-content-linking "${CODEX_HOME:-$HOME/.codex}/skills/"安装后的主文件位于:
${CODEX_HOME:-$HOME/.codex}/skills/publish-content-linking/SKILL.md
如果同名目录已经存在,请先审查差异,再决定如何更新;不要直接覆盖其中的来源配置和内容索引。
首次触发时,Skill 会在修改文稿前要求确认:
- 官网地址,默认值为
https://tranfu.com/。 - 微信公众号名称,以及微信号或一篇公开文章链接。
- 知乎账号名称和主页链接。
- 今日头条账号名称和主页链接。
来源确认完成后,内容索引仍不会自动刷新。请显式提出:
更新内容库
Skill 随后会读取官网 sitemap,尝试发现公共平台文章列表,并在自动发现失败时要求提供文章 URL 清单。
支持聊天正文、纯文本、Markdown 和 HTML,保持输入文稿的语言,并允许中英文跨语言链接。
示例:
这是官网文章,请完成定稿。
这是知乎稿,准备交付。
完成这篇今日头条稿。
在更大的内容生产 Skill 中,应在最终交付物提交前调用:
Use $publish-content-linking to finalize this platform draft with compliant owned-content links.
当用户明确提出“不添加链接”或“保持原稿不变”时,Skill 会跳过处理。
publish-content-linking/
├── SKILL.md
├── agents/openai.yaml
├── config/sources.json
├── data/content-index.json
├── data/platform-rule-cache.json
├── references/platform-linking-rules.md
├── scripts/linking.py
└── tests/test_linking.py
SKILL.md:触发条件、工作流、输出契约和失败路径。sources.json:官网与公共平台账号配置。content-index.json:标题、URL、平台、日期、摘要和关键词索引。platform-rule-cache.json:有效期 30 天的知乎与头条官方规则缓存。linking.py:索引更新、候选检索、日期过滤和 URL 校验工具。
运行确定性测试:
python3 -m unittest discover -s publish-content-linking/tests -v运行 Codex Skill 结构校验时,需要可导入 PyYAML:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install PyYAML
python "${CODEX_HOME:-$HOME/.codex}/skills/.system/skill-creator/scripts/quick_validate.py" publish-content-linking- 部分公共平台账号页依赖登录、动态渲染或反自动化策略,无法保证自动发现全部历史文章;此时需要人工 URL 清单。
- 知乎和今日头条的原生可点击链接需要相应编辑器或发布接口能力。没有该能力时,Skill 会输出精确的链接插入清单,不会声称原始 HTML 或 Markdown 一定能在发布后保留。
- 内容索引只保存元数据,不保存文章全文;入选候选的正文会在运行时读取。
- 内容库只在用户明确要求时更新,不会在每次定稿时自动刷新。
- 平台规则缓存有效期为 30 天;过期后会优先检索官方规则,查询失败时使用内置规则并标记未实时验证。
publish-content-linking runs immediately before a website, Zhihu, or Toutiao draft is delivered. It searches configured website, WeChat, Zhihu, and Toutiao history for highly relevant owned content, then adds platform-compatible links without changing the draft's topic, viewpoints, facts, conclusions, or structure.
WeChat drafts do not trigger the skill. Configured WeChat articles may still be candidate sources for website or Zhihu drafts.
- Triggers only when the publishing platform is explicit and the draft is at finalization or pre-delivery stage.
- Uses a local JSON metadata index for keyword retrieval, then reads candidate bodies for semantic review.
- Excludes content older than six calendar months using the last update date and then the publication date; records with neither date remain eligible.
- Uses only configured owned content and never adds third-party links.
- Deduplicates cross-posted content using website, current platform, then other owned platforms; platform policy takes precedence.
- Changes only the linked sentence and, when required, one adjacent sentence.
- Never adds facts, cases, viewpoints, titles, headings, paragraphs, or related-reading sections.
- Verifies HTTPS, accessibility, link counts, source ownership, and platform limits.
- Never adds UTM or other tracking parameters.
| Target platform | Link policy |
|---|---|
| Website | Up to 3 links; prefer internal pages; open every link in a new tab |
| Zhihu | Up to 3 links, including at most 1 cross-platform link; no marketing, private-message, contact-detail, or gated-resource diversion |
| Toutiao | Default to 1–2 Toutiao-internal links and zero cross-platform links |
| Does not trigger the skill; configured articles are source candidates only for website or Zhihu drafts |
Zero links is valid when no candidate is strongly relevant. See platform-linking-rules.md for the full policy.
git clone https://github.com/Stupides9169/codex-link-.git
cd codex-link-
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
cp -R publish-content-linking "${CODEX_HOME:-$HOME/.codex}/skills/"The installed entry point is:
${CODEX_HOME:-$HOME/.codex}/skills/publish-content-linking/SKILL.md
If the directory already exists, review the differences before updating it. Do not blindly overwrite source configuration or the content index.
Before changing a draft, the first invocation asks the user to confirm:
- The website URL, defaulting to
https://tranfu.com/. - The WeChat account name plus an account ID or one public article URL.
- The Zhihu account name and profile URL.
- The Toutiao account name and profile URL.
Source confirmation does not automatically refresh the content index. Explicitly request:
Update the content library.
The skill then reads the website sitemap, attempts to discover public-platform article lists, and requests a manual URL list when automatic discovery fails.
The skill accepts chat text, plain text, Markdown, and HTML. It preserves the input language and allows cross-language links between Chinese and English content.
Examples:
Finalize this website article for delivery.
This is a Zhihu draft and is ready to deliver.
Complete this Toutiao draft.
In a larger content-production workflow, invoke the skill immediately before the final artifact is submitted:
Use $publish-content-linking to finalize this platform draft with compliant owned-content links.
An explicit instruction not to add links or to preserve the draft unchanged overrides implicit invocation.
publish-content-linking/
├── SKILL.md
├── agents/openai.yaml
├── config/sources.json
├── data/content-index.json
├── data/platform-rule-cache.json
├── references/platform-linking-rules.md
├── scripts/linking.py
└── tests/test_linking.py
SKILL.md: triggers, workflow, output contract, and failure paths.sources.json: website and public-platform account configuration.content-index.json: title, URL, platform, date, summary, and keyword metadata.platform-rule-cache.json: 30-day official-policy cache for Zhihu and Toutiao.linking.py: index refresh, candidate search, date filtering, and URL validation.
Run deterministic tests:
python3 -m unittest discover -s publish-content-linking/tests -vCodex Skill structure validation requires an environment that can import PyYAML:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install PyYAML
python "${CODEX_HOME:-$HOME/.codex}/skills/.system/skill-creator/scripts/quick_validate.py" publish-content-linking- Some public profile pages require authentication, dynamic rendering, or block automation, so automatic discovery cannot guarantee complete history. Supply a manual URL list when this occurs.
- Native clickable links on Zhihu and Toutiao require a compatible editor or publishing API. Without that capability, the skill returns an exact insertion manifest and does not claim that raw HTML or Markdown will survive publication.
- The local index stores metadata, not full article bodies; selected candidate bodies are read at runtime.
- The content library refreshes only after an explicit user request, not during every finalization run.
- The platform-rule cache is valid for 30 days. After expiration, the skill prefers current official rules and falls back to embedded rules with a visible verification warning when lookup fails.