当地法典

工程开发 社区

技能解读

当前原文的自动摘译,尚未人工审校。

何时使用

用户希望通过 Codex 生成、重构或审查代码 用户希望运行 codex exec 来执行非交互式任务 用户希望使用 Codex 的 GPT-5.5 代理功能 用户提及“codex”、“运行 codex”、“委托给 codex”

身份验证(OAuth / ChatGPT Pro)

关键:此技能使用来自~/.codex/auth.json(ChatGPT Pro 固定费率订阅)的 OAuth 身份验证。不要设置 OPENAI_API_KEY 或传递 API 密钥 - 这将切换到按使用付费计费。 Codex 桌面应用程序和 CLI 共享相同的身份验证缓存 如果身份验证失败,请在终端中运行codex login(浏览器 OAuth 流程) 对于身份验证问题,请参阅references/oauth-guide.md

Codex CLI 路径

该技能按以下顺序自动检测 Codex CLI: /Applications/Codex.app/Contents/Resources/codex(桌面应用程序)/usr/local/bin/codex(npm 全局)/opt/homebrew/bin/codex(自制软件)~/.npm-global/bin/codex

1. 基本exec(单任务)

示例:

2. 代码审查

示例:

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
工程开发
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@daymade · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
需要 · OpenAI
兼容的系统
macOS · Linux · Windows
运行环境要求
Python
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 命令执行
  • 读取环境变量
网络行为
允许外网请求
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Local Codex

Delegate coding tasks to the local OpenAI Codex CLI agent using your ChatGPT Pro subscription (OAuth, no API charges).

## When to Use

- User wants to generate, refactor, or review code via Codex
- User wants to run `codex exec` for non-interactive tasks
- User wants to use Codex's GPT-5.5 agent capabilities
- User mentions "codex", "run codex", "delegate to codex"

## Authentication (OAuth / ChatGPT Pro)

**CRITICAL**: This skill uses OAuth authentication from `~/.codex/auth.json` (ChatGPT Pro flat-rate subscription). **Do NOT set `OPENAI_API_KEY` or pass API keys** — that would switch to pay-per-use billing.

- Codex desktop app and CLI share the same auth cache
- If auth fails, run `codex login` in terminal (browser OAuth flow)
- For auth issues, see [references/oauth-guide.md](references/oauth-guide.md)

## Codex CLI Path

The skill auto-detects Codex CLI in this order:
1. `/Applications/Codex.app/Contents/Resources/codex` (desktop app)
2. `/usr/local/bin/codex` (npm global)
3. `/opt/homebrew/bin/codex` (Homebrew)
4. `~/.npm-global/bin/codex`
5. `which codex` fallback

## Usage Patterns

### 1. Basic exec (single task)

```bash
python3 scripts/codex_wrapper.py exec "<prompt>" [<workdir>] [<model>] [<sandbox>] [<timeout>]
```

Example:
```bash
python3 scripts/codex_wrapper.py exec \
  "Write a Python function to calculate fibonacci" \
  /tmp \
  gpt-5.5 \
  workspace-write \
  300
```

### 2. Code review

```bash
python3 scripts/codex_wrapper.py review [<workdir>] [<model>] [uncommitted:true] [<timeout>]
```

Example:
```bash
python3 scripts/codex_wrapper.py review \
  /path/to/repo \
  gpt-5.5 \
  true \
  300
```

### 3. Check status

```bash
python3 scripts/codex_wrapper.py status
```

## Output Format

The wrapper returns JSON with:
- `success`: bool
- `exit_code`: int
- `elapsed_seconds`: float
- `stdout`: raw output
- `stderr`: error stream (truncated)
- `parsed_jsonl`: parsed JSONL events (if --json)
- `final_message`: extracted assistant text (if available)

## Parameters

| Parameter | Default | Options |
|-----------|---------|---------|
| model | `gpt-5.5` | `gpt-5.5`, `gpt-5.5-pro`, `o4-mini`, etc. |
| sandbox | `workspace-write` | `read-only`, `workspace-write`, `danger-full-access` |
| timeout | 300 | seconds (increase for large tasks) |
| json_output | true | always true (wrapper parses JSONL) |

## Safety Notes

- `sandbox=read-only` for analysis/review tasks (no file writes)
- `sandbox=workspace-write` for code generation (writes to working dir)
- `sandbox=danger-full-access` only when explicitly needed (full system access)
- Always use `--skip-git-repo-check` when running outside git repos
- Use `--ephemeral` for one-off tasks (no session persistence)

## Session Management

For multi-step tasks, Codex supports session resume:
```bash
# First step
codex exec --ephemeral "Step 1..."
# Later
codex exec resume --last "Step 2..."
```

The wrapper currently runs single-shot exec. For multi-step workflows, use raw `codex exec` commands.

## Limitations

- Desktop app must be running for OAuth token refresh (or token must be fresh)
- `codex doctor` is buggy in current version (alpha), avoid using
- Environment variables are NOT inherited into Codex's sandbox; pass via config or prompt
- Large file operations may need increased timeout

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。