codex-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodex Audit Skill
Codex审计技能
LIBRARY-FIRST PROTOCOL (MANDATORY)
库优先协议(强制性)
Before writing ANY code, you MUST check:
在编写任何代码之前,你必须检查:
Step 1: Library Catalog
步骤1:库目录
- Location:
.claude/library/catalog.json - If match >70%: REUSE or ADAPT
- 位置:
.claude/library/catalog.json - 如果匹配度>70%:复用或适配
Step 2: Patterns Guide
步骤2:模式指南
- Location:
.claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md - If pattern exists: FOLLOW documented approach
- 位置:
.claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md - 如果模式已存在:遵循文档记录的方法
Step 3: Existing Projects
步骤3:现有项目
- Location:
D:\Projects\* - If found: EXTRACT and adapt
- 位置:
D:\Projects\* - 如果找到:提取并适配
Decision Matrix
决策矩阵
| Match | Action |
|---|---|
| Library >90% | REUSE directly |
| Library 70-90% | ADAPT minimally |
| Pattern exists | FOLLOW pattern |
| In project | EXTRACT |
| No match | BUILD (add to library after) |
| 匹配度 | 操作 |
|---|---|
| 库匹配度>90% | 直接复用 |
| 库匹配度70-90% | 最小程度适配 |
| 模式已存在 | 遵循模式 |
| 存在于项目中 | 提取 |
| 无匹配项 | 构建(之后添加到库中) |
Purpose
用途
Route auditing and debugging tasks to Codex CLI when:
- Autonomous iteration is needed (test-fix-retest loops)
- Sandboxed execution required for safety
- Rapid prototyping without approval overhead
在以下场景将审计和调试任务路由至Codex CLI:
- 需要自主迭代(测试-修复-重测循环)
- 出于安全考虑需要沙箱执行
- 无需审批流程的快速原型开发
Unique Capability
独特能力
What Codex Does Better:
- Fully autonomous execution (no approval needed mid-task)
- Sandboxed isolation (no network, CWD only)
- Iterative debugging loops
- GPT-5-Codex optimized for agentic coding
Codex的优势:
- 完全自主执行(任务中途无需审批)
- 沙箱隔离(无网络访问,仅当前工作目录)
- 迭代式调试循环
- GPT-5-Codex针对智能体编码优化
When to Use
使用场景
Perfect For:
适用场景:
- Automated test fixing
- Code auditing in isolation
- Rapid prototyping of features
- Refactoring with test verification
- Build failure recovery
- Security scanning in sandbox
- 自动化测试修复
- 隔离环境下的代码审计
- 功能快速原型开发
- 带测试验证的重构
- 构建失败恢复
- 沙箱内安全扫描
Don't Use When:
不适用场景:
- Need network access (sandbox disables it)
- Need to access files outside CWD
- Production debugging (use Claude with oversight)
- Complex multi-file coordination
- 需要网络访问(沙箱已禁用)
- 需要访问当前工作目录(CWD)以外的文件
- 生产环境调试(使用带监督的Claude)
- 复杂多文件协调
Usage
使用方法
Basic Audit
基础审计
bash
/codex-audit "Find and fix all type errors" --context src/bash
/codex-audit "Find and fix all type errors" --context src/Test Fixing
测试修复
bash
/codex-audit "Fix failing tests" --context tests/ --max-iterations 10bash
/codex-audit "Fix failing tests" --context tests/ --max-iterations 10Prototyping
原型开发
bash
/codex-audit "Build REST API with CRUD endpoints" --context .bash
/codex-audit "Build REST API with CRUD endpoints" --context .Command Pattern
命令格式
bash
bash scripts/multi-model/codex-audit.sh "<task>" "<context>" "<task_id>" "<max_iterations>"bash
bash scripts/multi-model/codex-audit.sh "<task>" "<context>" "<task_id>" "<max_iterations>"Safety Constraints
安全限制
| Constraint | Value |
|---|---|
| Network | DISABLED |
| File Access | CWD only |
| Isolation | macOS Seatbelt / Docker |
| Max Iterations | 5 (configurable) |
| 限制项 | 值 |
|---|---|
| 网络 | 禁用 |
| 文件访问 | 仅当前工作目录(CWD) |
| 隔离方式 | macOS Seatbelt / Docker |
| 最大迭代次数 | 5(可配置) |
Memory Integration
内存集成
Results stored to Memory-MCP:
- Key:
multi-model/codex/audit/{task_id} - Tags: WHO=codex-cli, WHY=audit
结果存储至Memory-MCP:
- 键:
multi-model/codex/audit/{task_id} - 标签:WHO=codex-cli, WHY=audit
Output Format
输出格式
json
{
"raw_output": "Audit findings...",
"metrics": {
"files_analyzed": 15,
"findings_count": 7,
"fixes_applied": 5
},
"context_path": "src/",
"sandbox_mode": true
}json
{
"raw_output": "Audit findings...",
"metrics": {
"files_analyzed": 15,
"findings_count": 7,
"fixes_applied": 5
},
"context_path": "src/",
"sandbox_mode": true
}Handoff to Claude
交接至Claude
After Codex audit completes:
- Findings stored in Memory-MCP
- Claude agents review findings
- Apply or escalate based on severity
javascript
// Claude agent reads Codex audit
const audit = memory_retrieve("multi-model/codex/audit/{task_id}");
if (audit.metrics.findings_count > 0) {
Task("Reviewer", `Review findings: ${audit.raw_output}`, "reviewer");
}Codex审计完成后:
- 审计结果存储至Memory-MCP
- Claude智能体审核结果
- 根据严重程度应用修复或升级处理
javascript
// Claude agent reads Codex audit
const audit = memory_retrieve("multi-model/codex/audit/{task_id}");
if (audit.metrics.findings_count > 0) {
Task("Reviewer", `Review findings: ${audit.raw_output}`, "reviewer");
}Integration with Audit Pipeline
与审计流水线集成
bash
undefinedbash
undefinedPhase 1: Theater detection (Claude)
Phase 1: Theater detection (Claude)
/theater-detection-audit
/theater-detection-audit
Phase 2: Functionality audit (Codex)
Phase 2: Functionality audit (Codex)
/codex-audit "Verify all functions work" --context src/
/codex-audit "Verify all functions work" --context src/
Phase 3: Style audit (Claude)
Phase 3: Style audit (Claude)
/style-audit
undefined/style-audit
undefined