Codex
Codex 是 OpenAI 的云端编程代理,可直接针对 GitHub 仓库异步完成多文件文档批量任务。
Codex 是 OpenAI 的云端编程代理。它直接在你的 GitHub 仓库上运行,无需本地环境。
Codex 与 Claude Code 的主要区别在于工作流程。Codex 在云端运行并异步工作。描述一段工作任务后即可离开,完成后再审查 PR。这适合批量任务(例如将一个 500 行的 README 拆分为十几个页面,或根据你过去六个月的 GitHub 问题生成一个故障排除页面)。它则不太适合反复修改单个页面的交互式工作。单页面的交互式工作请使用 Claude Code。
快速设置
在 Codex 中打开你的 Jamdesk 文档 GitHub 仓库。
在项目根目录创建一个 AGENTS.md 文件,写入你的文档规范。Codex 会遵循其中的约定。
将你的文档 MCP 端点添加到 .codex/config.toml。之后 Codex 即可搜索你已发布的文档。
AGENTS.md 模板
在项目根目录创建 AGENTS.md:
# Jamdesk Documentation Project
Jamdesk docs project. Pages are MDX (Markdown + React components). Config is in `docs.json`.
## How This Project Works
- `docs.json`: navigation structure, theme, colors, branding. Pages must be listed here to appear in the sidebar.
- `*.mdx` files: documentation pages. Every page needs `title` and `description` frontmatter.
- `images/`: static assets. Always use `.webp` format.
- `snippets/`: reusable MDX fragments. Import with `<Snippet file="name.mdx" />`.
## Page Template
Every page follows this structure:
---
title: Clear, Specific Title
description: One sentence. Used in search results and social previews.
---
Opening paragraph: what this page covers and who it's for. No heading needed.
## First Section
Content. Use components where they help, not for decoration.
## What's Next?
<Columns cols={2}>
<Card title="Related Page" icon="arrow-right" href="/path">
Why the reader would go here next
</Card>
</Columns>
The opening paragraph comes right after frontmatter with no heading. "What's Next?" is always the last section. Card descriptions explain why, not what.
## Writing Style
Start with why. What problem does this solve? Show the answer first, then unpack the how.
Use progressive disclosure: simple example up top, advanced options tucked into Accordions or later sections.
Active voice. "Run this command", not "This command should be run".
One idea per paragraph. If you find yourself reaching for "also" or "additionally", that's the cue to start a new paragraph instead.
Code examples have to actually work. Every block should be complete and copy-pasteable, never partial or pseudocode.
And write like a person. No filler ("It's important to note that", "This allows you to"). No hedging ("you might want to consider"). If a paragraph reads like a chatbot wrote it, rewrite it shorter.
## Components
Only use these. Do not invent others.
Layout: Card, Columns, Tabs, Tab, Accordion, AccordionGroup, Steps, Step, Expandable, Frame, CodeGroup
Callouts: Note, Info, Warning, Tip, Check, Danger
| Use | For | Don't use for |
|-----|-----|---------------|
| Tabs | Mutually exclusive choices (npm/yarn, OS) | Sequential content |
| Steps | Ordered procedures | Unordered lists |
| Accordion | Optional/advanced detail | Core content |
| Card + Columns | Navigation links, feature grids | Inline content |
| Note/Tip/Warning | Important context | Every other paragraph |
Cards always go inside Columns:
<Columns cols={2}>
<Card title="Page Title" icon="icon-name" href="/path">
Brief description
</Card>
</Columns>
Icons are Font Awesome Light names: "rocket", "code", "terminal", "book-open", "gear"
## Adding Pages
1. Create the `.mdx` file
2. Add the page path (no `.mdx` extension) to `docs.json` in the right navigation group
3. Link to it from related pages via "What's Next?" cards
If you skip step 2, the page won't show up in the sidebar. Read `docs.json` before creating pages so you understand the navigation structure.
## Common Mistakes
- Inventing components like `<CodeBlock>`, `<Alert>`, `<Section>`. They don't exist.
- Using `<Card>` without a `<Columns>` wrapper.
- Skipping `description` in frontmatter, which breaks search results and link previews.
- Using raw HTML tags instead of MDX components.
- Writing "click here" links instead of descriptive link text.添加你的产品术语、API 命名约定,以及任何特定于你文档的风格规则。
MCP 配置
将你的文档端点添加到 .codex/config.toml:
[mcp_servers.my-docs]
url = "https://your-project.jamdesk.app/_mcp"将 your-project 替换为你的 Jamdesk 子域名。如果你已上线自定义域名,请改用它:url = "https://docs.acme.com/_mcp"。端点详情请参阅 MCP 服务器。
示例提示词
Codex 异步运行任务。发送一个较长的任务,之后再回来查看。要求完成一段工作量的提示词效果最好。
一个不错的起点:"Write docs for the authentication API based on the source in /src/auth"。Codex 会读取你的代码库,找到相关文件,并生成对应的页面。对于更复杂的工作,可以让它参考你的 bug 历史。"Create a troubleshooting page covering the 5 most common errors in our GitHub issues" 通常比你凭记忆写的页面更准确。
在这种模式下,多文件重构效果很好。对于有明确审查标准的任务,可将以下提示词复制到 Codex 中:
重构大型 README
/update-jamdesk 技能
安装 /update-jamdesk 技能,以便在代码变更时自动更新文档:
npx skills add jamdesk/skills --skill update-jamdesk -a codex
完整指南请参阅自动更新。
