codexsaver-cost-router

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CodexSaver Cost Router

CodexSaver 成本路由工具

Skill by ara.so — Codex Skills collection.
CodexSaver is an MCP tool that makes Codex cost-aware by routing low-risk development work (tests, docs, search, explanation) to cheaper worker LLMs while keeping Codex responsible for architecture, security, and final review. It supports DeepSeek by default with presets for OpenAI, Anthropic, Gemini, Qwen, Ollama, and LM Studio.
ara.so开发的Skill — 属于Codex Skills系列。
CodexSaver是一款MCP工具,它能让Codex具备成本感知能力:将低风险开发工作(测试、文档、搜索、代码解释)路由至更经济的Worker LLM,同时让Codex负责架构设计、安全保障和最终审核。默认支持DeepSeek,还预置了OpenAI、Anthropic、Gemini、Qwen、Ollama和LM Studio的配置。

Core Concepts

核心概念

CodexSaver operates in three modes:
  • Preview Mode: Shows routing decision without executing
  • V2 Bounded Work Packets: Single-task delegation with sandboxed patch application and verification
  • V3 Orchestrated Specialists: Parallel readonly specialists (explainer, perf_reviewer) and mixed graphs for docs/tests/impl
Key principle: Codex handles judgment and risk, worker models handle volume and repetition.
CodexSaver支持三种运行模式:
  • 预览模式:仅展示路由决策,不执行任务
  • V2 限定工作包:单任务分配,附带沙箱化补丁应用和验证机制
  • V3 编排式专家:并行只读专家(代码解释器、性能审核器),以及用于文档/测试/实现的混合任务图
核心原则:Codex负责判断和风险管控,Worker模型负责处理大量重复性工作。

Installation

安装

Global MCP Tool Setup

全局MCP工具配置

bash
undefined
bash
undefined

Clone repository

克隆仓库

Install globally

全局安装

pip install -e .
pip install -e .

Initialize config

初始化配置

codexsaver init
codexsaver init

Add to Codex MCP config (~/.config/codex/mcp.json or workspace .codex/mcp.json)

添加至Codex MCP配置文件(~/.config/codex/mcp.json 或工作区 .codex/mcp.json)


Add to `mcp.json`:

```json
{
  "mcpServers": {
    "codexsaver": {
      "command": "python",
      "args": ["-m", "codexsaver.mcp_server"],
      "env": {}
    }
  }
}

添加至`mcp.json`:

```json
{
  "mcpServers": {
    "codexsaver": {
      "command": "python",
      "args": ["-m", "codexsaver.mcp_server"],
      "env": {}
    }
  }
}

Configuration

配置说明

Edit
~/.codexsaver/config.json
:
json
{
  "provider": "deepseek",
  "deepseek": {
    "api_key_env": "DEEPSEEK_API_KEY",
    "model": "deepseek-chat",
    "base_url": "https://api.deepseek.com"
  },
  "openai": {
    "api_key_env": "OPENAI_API_KEY",
    "model": "gpt-4o-mini"
  },
  "worker_compression": {
    "enabled": true,
    "level": "medium"
  },
  "routing": {
    "protected_paths": ["src/auth/", "payment/", ".env"],
    "risk_threshold": "medium"
  }
}
Set environment variable:
bash
export DEEPSEEK_API_KEY="your-key-here"
编辑
~/.codexsaver/config.json
json
{
  "provider": "deepseek",
  "deepseek": {
    "api_key_env": "DEEPSEEK_API_KEY",
    "model": "deepseek-chat",
    "base_url": "https://api.deepseek.com"
  },
  "openai": {
    "api_key_env": "OPENAI_API_KEY",
    "model": "gpt-4o-mini"
  },
  "worker_compression": {
    "enabled": true,
    "level": "medium"
  },
  "routing": {
    "protected_paths": ["src/auth/", "payment/", ".env"],
    "risk_threshold": "medium"
  }
}
设置环境变量:
bash
export DEEPSEEK_API_KEY="your-key-here"

MCP Tools Reference

MCP工具参考

1.
codexsaver.delegate_task

1.
codexsaver.delegate_task

Route a task to the worker model with automatic risk assessment.
Parameters:
  • task_description
    (required): Task to delegate
  • files
    (optional): List of file paths for context
  • mode
    (optional):
    preview
    or
    execute
    (default:
    execute
    )
Example call from Codex:
python
undefined
通过自动风险评估将任务路由至Worker模型。
参数:
  • task_description
    (必填):待分配的任务描述
  • files
    (可选):提供上下文的文件路径列表
  • mode
    (可选):
    preview
    execute
    (默认值:
    execute
Codex调用示例:
python
undefined

Codex calls this internally via MCP

Codex通过MCP内部调用此工具

{ "tool": "codexsaver.delegate_task", "arguments": { "task_description": "Write docstrings for all public functions", "files": ["src/utils.py"], "mode": "execute" } }

**Response structure**:

```json
{
  "interaction": {
    "tool": "codexsaver.delegate_task",
    "mode": "delegated_execution",
    "headline": "CodexSaver delegated this task to DeepSeek",
    "route_label": "[CodexSaver] route=deepseek task_type=write_docs risk=low",
    "next_step": "Review the worker result and apply if safe"
  },
  "result": "Delegated task output...",
  "cost_savings": "45%",
  "provider": "deepseek"
}
{ "tool": "codexsaver.delegate_task", "arguments": { "task_description": "为所有公共函数编写文档字符串", "files": ["src/utils.py"], "mode": "execute" } }

**响应结构**:

```json
{
  "interaction": {
    "tool": "codexsaver.delegate_task",
    "mode": "delegated_execution",
    "headline": "CodexSaver已将此任务分配给DeepSeek",
    "route_label": "[CodexSaver] route=deepseek task_type=write_docs risk=low",
    "next_step": "审核Worker模型的结果,确认安全后应用"
  },
  "result": "分配任务的输出内容...",
  "cost_savings": "45%",
  "provider": "deepseek"
}

2.
codexsaver.delegate_work_packet

2.
codexsaver.delegate_work_packet

V2: Execute bounded work with sandbox verification.
Parameters:
  • goal
    (required): Clear task goal
  • files
    (optional): Context files
  • allowed_files
    (required): Globs for writable files
  • forbidden_paths
    (optional): Protected paths
  • acceptance_criteria
    (required): Success conditions
  • allowed_commands
    (required): Verification commands
  • max_iterations
    (optional): Default 3
  • max_diff_lines
    (optional): Default 500
Example:
python
{
  "tool": "codexsaver.delegate_work_packet",
  "arguments": {
    "goal": "Add type hints to config loader",
    "files": ["codexsaver/config.py"],
    "allowed_files": ["codexsaver/config.py"],
    "forbidden_paths": ["codexsaver/auth/"],
    "acceptance_criteria": "All public functions have type hints",
    "allowed_commands": ["mypy codexsaver/config.py"],
    "max_iterations": 3,
    "max_diff_lines": 200
  }
}
V2版本:执行限定范围的工作并附带沙箱验证。
参数:
  • goal
    (必填):明确的任务目标
  • files
    (可选):上下文文件
  • allowed_files
    (必填):可写入文件的Glob模式
  • forbidden_paths
    (可选):受保护的路径
  • acceptance_criteria
    (必填):任务成功的判定条件
  • allowed_commands
    (必填):验证命令
  • max_iterations
    (可选):默认值为3
  • max_diff_lines
    (可选):默认值为500
示例:
python
{
  "tool": "codexsaver.delegate_work_packet",
  "arguments": {
    "goal": "为配置加载器添加类型提示",
    "files": ["codexsaver/config.py"],
    "allowed_files": ["codexsaver/config.py"],
    "forbidden_paths": ["codexsaver/auth/"],
    "acceptance_criteria": "所有公共函数均包含类型提示",
    "allowed_commands": ["mypy codexsaver/config.py"],
    "max_iterations": 3,
    "max_diff_lines": 200
  }
}

3.
codexsaver.orchestrate

3.
codexsaver.orchestrate

V3: Orchestrate specialists for complex tasks.
Parameters:
  • task_description
    (required): High-level task
  • files
    (optional): Context files
  • mode
    (optional):
    preview
    or
    execute
Example:
python
{
  "tool": "codexsaver.orchestrate",
  "arguments": {
    "task_description": "Explain config module and review performance",
    "files": ["codexsaver/config.py"],
    "mode": "execute"
  }
}
Response for readonly_swarm:
json
{
  "status": "success",
  "graph_type": "readonly_swarm",
  "findings": 10,
  "quality_score": 0.75,
  "latency_seconds": 6.45,
  "cost_savings": "52%",
  "results": {
    "explainer": "Config module loads from ~/.codexsaver/config.json...",
    "perf_reviewer": "No blocking I/O, caching recommended..."
  }
}
V3版本:为复杂任务编排专家模型。
参数:
  • task_description
    (必填):高级任务描述
  • files
    (可选):上下文文件
  • mode
    (可选):
    preview
    execute
示例:
python
{
  "tool": "codexsaver.orchestrate",
  "arguments": {
    "task_description": "解释配置模块并审核性能",
    "files": ["codexsaver/config.py"],
    "mode": "execute"
  }
}
readonly_swarm模式响应:
json
{
  "status": "success",
  "graph_type": "readonly_swarm",
  "findings": 10,
  "quality_score": 0.75,
  "latency_seconds": 6.45,
  "cost_savings": "52%",
  "results": {
    "explainer": "配置模块从~/.codexsaver/config.json加载...",
    "perf_reviewer": "无阻塞I/O,建议添加缓存..."
  }
}

CLI Commands

CLI命令

Initialize Configuration

初始化配置

bash
codexsaver init
Creates
~/.codexsaver/config.json
with DeepSeek defaults.
bash
codexsaver init
创建带有DeepSeek默认配置的
~/.codexsaver/config.json
文件。

Preview Routing Decision

预览路由决策

bash
codexsaver preview "Write unit tests for auth module" --files src/auth.py
Shows routing decision without executing.
bash
codexsaver preview "为认证模块编写单元测试" --files src/auth.py
仅展示路由决策,不执行任务。

Execute Work Packet

执行工作包

bash
codexsaver work-packet \
  "Add docstrings to public functions" \
  --files src/utils.py \
  --allowed-file src/utils.py \
  --acceptance "All functions have docstrings" \
  --allowed-command "python -m pydoc src.utils" \
  --workspace .
bash
codexsaver work-packet \
  "为公共函数添加文档字符串" \
  --files src/utils.py \
  --allowed-file src/utils.py \
  --acceptance "所有函数均包含文档字符串" \
  --allowed-command "python -m pydoc src.utils" \
  --workspace .

Orchestrate Specialists

编排专家模型

bash
undefined
bash
undefined

Readonly specialists (fastest, most reliable)

只读专家模型(最快、最可靠)

codexsaver orchestrate "Explain installer flow and review performance"
--files codexsaver/install.py
codexsaver orchestrate "解释安装流程并审核性能"
--files codexsaver/install.py

Mixed graph (docs + explain)

混合任务图(文档 + 解释)

codexsaver orchestrate "Document API and explain usage patterns"
--files codexsaver/api.py
codexsaver orchestrate "为API编写文档并解释使用模式"
--files codexsaver/api.py

Dry run

试运行

codexsaver orchestrate "Implement login and add tests"
--files src/auth.py
--dry-run
undefined
codexsaver orchestrate "实现登录功能并添加测试"
--files src/auth.py
--dry-run
undefined

Run Single Specialist

运行单个专家模型

bash
undefined
bash
undefined

Explainer

代码解释器

codexsaver specialist explainer "Explain this module"
--files codexsaver/router.py
codexsaver specialist explainer "解释此模块"
--files codexsaver/router.py

Performance Reviewer

性能审核器

codexsaver specialist perf_reviewer "Review performance"
--files codexsaver/delegate.py
undefined
codexsaver specialist perf_reviewer "审核性能"
--files codexsaver/delegate.py
undefined

Install Project Guidance

安装项目引导

bash
undefined
bash
undefined

Basic: AGENTS.md guidance only

基础版:仅安装AGENTS.md引导文档

codexsaver superpower install --profile basic --workspace .
codexsaver superpower install --profile basic --workspace .

Full: AGENTS.md + hooks + local config

完整版:安装AGENTS.md + 钩子 + 本地配置

codexsaver superpower install --profile full --workspace .
undefined
codexsaver superpower install --profile full --workspace .
undefined

Python API

Python API

Direct Delegation

直接分配任务

python
from codexsaver.delegate import delegate_task

result = delegate_task(
    task_description="Write docstrings for utils module",
    files=["src/utils.py"],
    mode="execute"
)

print(result["interaction"]["route_label"])
print(result["result"])
python
from codexsaver.delegate import delegate_task

result = delegate_task(
    task_description="为工具模块编写文档字符串",
    files=["src/utils.py"],
    mode="execute"
)

print(result["interaction"]["route_label"])
print(result["result"])

Work Packet Execution

执行工作包

python
from codexsaver.work_packet import execute_work_packet

result = execute_work_packet(
    goal="Add type hints to config loader",
    files=["codexsaver/config.py"],
    allowed_files=["codexsaver/config.py"],
    acceptance_criteria="All functions have type hints",
    allowed_commands=["mypy codexsaver/config.py"],
    workspace_root="."
)

if result["status"] == "success":
    print(f"Patch applied: {result['changed_files']}")
elif result["preflight_satisfied"]:
    print("Task already satisfied, no work needed")
python
from codexsaver.work_packet import execute_work_packet

result = execute_work_packet(
    goal="为配置加载器添加类型提示",
    files=["codexsaver/config.py"],
    allowed_files=["codexsaver/config.py"],
    acceptance_criteria="所有函数均包含类型提示",
    allowed_commands=["mypy codexsaver/config.py"],
    workspace_root="."
)

if result["status"] == "success":
    print(f"补丁已应用: {result['changed_files']}")
elif result["preflight_satisfied"]:
    print("任务已满足,无需执行工作")

Specialist Orchestration

专家模型编排

python
from codexsaver.orchestrate import orchestrate_task

result = orchestrate_task(
    task_description="Explain config module and review performance",
    files=["codexsaver/config.py"],
    mode="execute"
)

if result["status"] == "success":
    print(f"Graph type: {result['graph_type']}")
    print(f"Findings: {result['findings']}")
    print(f"Quality score: {result['quality_score']}")
    for specialist, output in result["results"].items():
        print(f"\n{specialist}:\n{output}")
python
from codexsaver.orchestrate import orchestrate_task

result = orchestrate_task(
    task_description="解释配置模块并审核性能",
    files=["codexsaver/config.py"],
    mode="execute"
)

if result["status"] == "success":
    print(f"任务图类型: {result['graph_type']}")
    print(f"发现问题数: {result['findings']}")
    print(f"质量评分: {result['quality_score']}")
    for specialist, output in result["results"].items():
        print(f"\n{specialist}:\n{output}")

Router Configuration

路由配置

python
from codexsaver.router import Router

router = Router()
python
from codexsaver.router import Router

router = Router()

Check if task is safe to delegate

检查任务是否可安全分配

decision = router.should_delegate( task_description="Write unit tests", files=["src/utils.py"] )
print(f"Route: {decision['route']}") # 'deepseek' or 'codex' print(f"Risk: {decision['risk_level']}") # 'low', 'medium', 'high' print(f"Task type: {decision['task_type']}") # 'write_tests', 'explain', etc.
undefined
decision = router.should_delegate( task_description="编写单元测试", files=["src/utils.py"] )
print(f"路由目标: {decision['route']}") # 'deepseek' 或 'codex' print(f"风险等级: {decision['risk_level']}") # 'low', 'medium', 'high' print(f"任务类型: {decision['task_type']}") # 'write_tests', 'explain'等
undefined

Common Patterns

常见使用模式

Pattern 1: Low-Risk Documentation Work

模式1:低风险文档工作

When to use: Adding or updating docs, docstrings, README sections
python
undefined
适用场景: 添加或更新文档、文档字符串、README章节
python
undefined

Via MCP tool

通过MCP工具调用

{ "tool": "codexsaver.delegate_task", "arguments": { "task_description": "Add docstrings to all public functions in utils", "files": ["src/utils.py"], "mode": "execute" } }

**Expected route**: `deepseek` (low risk, high volume)
{ "tool": "codexsaver.delegate_task", "arguments": { "task_description": "为utils模块中的所有公共函数添加文档字符串", "files": ["src/utils.py"], "mode": "execute" } }

**预期路由**: `deepseek`(低风险、高工作量)

Pattern 2: Bounded Test Generation

模式2:限定范围的测试生成

When to use: Creating tests for well-defined modules
bash
codexsaver work-packet \
  "Write pytest tests for config loader" \
  --files codexsaver/config.py \
  --allowed-file tests/test_config.py \
  --acceptance "tests/test_config.py exists and pytest passes" \
  --allowed-command "pytest tests/test_config.py -v" \
  --workspace .
Expected route:
deepseek
with sandbox verification
适用场景: 为定义明确的模块创建测试
bash
codexsaver work-packet \
  "为配置加载器编写pytest测试用例" \
  --files codexsaver/config.py \
  --allowed-file tests/test_config.py \
  --acceptance "tests/test_config.py已存在且pytest执行通过" \
  --allowed-command "pytest tests/test_config.py -v" \
  --workspace .
预期路由:
deepseek
并附带沙箱验证

Pattern 3: Readonly Analysis

模式3:只读分析

When to use: Code explanation, performance hints, security scan (no patches)
bash
codexsaver orchestrate "Explain auth flow and review performance" \
  --files src/auth.py
Expected route:
readonly_swarm
(parallel explainer + perf_reviewer)
适用场景: 代码解释、性能提示、安全扫描(不修改代码)
bash
codexsaver orchestrate "解释认证流程并审核性能" \
  --files src/auth.py
预期路由:
readonly_swarm
(并行代码解释器 + 性能审核器)

Pattern 4: Codex Takeover for High-Risk Work

模式4:Codex接管高风险工作

When to use: Auth, payment, destructive migrations, ambiguous architecture
python
{
  "tool": "codexsaver.delegate_task",
  "arguments": {
    "task_description": "Refactor authentication middleware",
    "files": ["src/auth/middleware.py"],
    "mode": "execute"
  }
}
Expected route:
codex
(protected path detected)
Response includes:
json
{
  "interaction": {
    "mode": "codex_takeover",
    "headline": "CodexSaver kept this task with Codex",
    "route_label": "[CodexSaver] route=codex reason=protected_path"
  }
}
适用场景: 认证、支付、破坏性迁移、模糊的架构设计
python
{
  "tool": "codexsaver.delegate_task",
  "arguments": {
    "task_description": "重构认证中间件",
    "files": ["src/auth/middleware.py"],
    "mode": "execute"
  }
}
预期路由:
codex
(检测到受保护路径)
响应包含:
json
{
  "interaction": {
    "mode": "codex_takeover",
    "headline": "CodexSaver将此任务保留给Codex处理",
    "route_label": "[CodexSaver] route=codex reason=protected_path"
  }
}

Pattern 5: Mixed Graph Orchestration

模式5:混合任务图编排

When to use: Docs + explanation + small impl changes
bash
codexsaver orchestrate "Document API, explain usage, and add examples" \
  --files codexsaver/api.py
Expected graph:
docs + explain
(mixed readonly + bounded patch)
适用场景: 文档 + 解释 + 小型实现修改
bash
codexsaver orchestrate "为API编写文档、解释使用方式并添加示例" \
  --files codexsaver/api.py
预期任务图:
docs + explain
(混合只读任务 + 限定范围补丁)

Risk Assessment Rules

风险评估规则

CodexSaver routes tasks based on:
CodexSaver基于以下规则路由任务:

Automatic Codex Takeover

Codex自动接管的场景

  • Files match
    protected_paths
    (auth, payment, .env)
  • Task mentions security, permissions, migration
  • Ambiguous requirements
  • Multi-file behavioral changes without verification
  • 文件匹配
    protected_paths
    (认证、支付、.env)
  • 任务涉及安全、权限、迁移
  • 需求模糊不清
  • 无验证机制的多文件行为变更

Safe Delegation to Worker

可安全分配给Worker模型的场景

  • Task type:
    write_tests
    ,
    write_docs
    ,
    explain
    ,
    search
  • Files outside protected paths
  • Clear acceptance criteria
  • Bounded scope with verification commands
  • 任务类型:
    write_tests
    write_docs
    explain
    search
  • 文件位于受保护路径之外
  • 具备明确的验收标准
  • 范围限定且带有验证命令

Configuration Override

配置覆盖

json
{
  "routing": {
    "protected_paths": ["src/auth/", "billing/", "*.key"],
    "risk_threshold": "medium",
    "force_codex_patterns": ["payment", "security", "migrate"]
  }
}
json
{
  "routing": {
    "protected_paths": ["src/auth/", "billing/", "*.key"],
    "risk_threshold": "medium",
    "force_codex_patterns": ["payment", "security", "migrate"]
  }
}

Worker Output Compression

Worker输出压缩

Reduce delegated output length for faster Codex review:
json
{
  "worker_compression": {
    "enabled": true,
    "level": "medium"
  }
}
Levels:
  • low
    : Minor trimming
  • medium
    : Remove verbose explanations, keep facts
  • high
    : Maximum compression, essential info only
Response includes compression notice:
json
{
  "interaction": {
    "compression": {
      "active": true,
      "level": "medium",
      "notice": "Worker output compressed to medium level"
    }
  }
}
减少分配任务的输出长度,加快Codex审核速度:
json
{
  "worker_compression": {
    "enabled": true,
    "level": "medium"
  }
}
压缩级别:
  • low
    : 轻微修剪
  • medium
    : 移除冗长解释,保留核心信息
  • high
    : 最大程度压缩,仅保留必要信息
响应包含压缩通知:
json
{
  "interaction": {
    "compression": {
      "active": true,
      "level": "medium",
      "notice": "Worker输出已压缩至中等级别"
    }
  }
}

Troubleshooting

故障排查

MCP Tool Not Found

MCP工具未找到

Symptom: Codex doesn't recognize
codexsaver.*
tools
Fix:
bash
undefined
症状: Codex无法识别
codexsaver.*
工具
解决方法:
bash
undefined

Verify MCP server config

验证MCP服务器配置

cat ~/.config/codex/mcp.json
cat ~/.config/codex/mcp.json

Test MCP server manually

手动测试MCP服务器

python -m codexsaver.mcp_server
python -m codexsaver.mcp_server

Restart Codex after config changes

修改配置后重启Codex

undefined
undefined

Worker Provider Authentication Failed

Worker提供商认证失败

Symptom:
Authentication error: DEEPSEEK_API_KEY not found
Fix:
bash
undefined
症状:
Authentication error: DEEPSEEK_API_KEY not found
解决方法:
bash
undefined

Set environment variable

设置环境变量

export DEEPSEEK_API_KEY="sk-..."
export DEEPSEEK_API_KEY="sk-..."

Verify config

验证配置

cat ~/.codexsaver/config.json
cat ~/.codexsaver/config.json

Test provider directly

直接测试提供商

codexsaver preview "test task" --files README.md
undefined
codexsaver preview "测试任务" --files README.md
undefined

Sandbox Verification Failed

沙箱验证失败

Symptom: Work packet returns
verification_failed
Fix:
bash
undefined
症状: 工作包返回
verification_failed
解决方法:
bash
undefined

Check allowed commands are valid

检查验证命令是否有效

codexsaver work-packet
"test task"
--allowed-command "python -c 'import sys; sys.exit(0)'"
--acceptance "passes basic check"
--workspace .
--verbose
codexsaver work-packet
"测试任务"
--allowed-command "python -c 'import sys; sys.exit(0)'"
--acceptance "通过基础检查"
--workspace .
--verbose

Increase max iterations

增加最大迭代次数

codexsaver work-packet
"complex task"
--max-iterations 5
--workspace .
undefined
codexsaver work-packet
"复杂任务"
--max-iterations 5
--workspace .
undefined

All Tasks Route to Codex

所有任务均路由至Codex

Symptom: No cost savings, everything stays with Codex
Fix:
json
{
  "routing": {
    "risk_threshold": "low",
    "protected_paths": []
  }
}
Or use explicit work packets for guaranteed delegation.
症状: 无成本节省,所有任务均由Codex处理
解决方法:
json
{
  "routing": {
    "risk_threshold": "low",
    "protected_paths": []
  }
}
或使用明确的工作包确保任务被分配。

V3 Orchestration Returns
needs_codex

V3编排返回
needs_codex

Symptom: Complex graphs fall back conservatively
Expected behavior: V3 patch orchestration is still maturing. Use for:
  • ✅ Readonly specialist swarms (established)
  • ✅ Single bounded patches (v2 mature)
  • ⚠️ Multi-patch graphs (promising but conservative)
Workaround: Break complex tasks into separate work packets.
症状: 复杂任务图保守地回退至Codex
预期行为: V3补丁编排仍在完善中。建议用于:
  • ✅ 只读专家集群(已成熟)
  • ✅ 单个限定范围补丁(V2已成熟)
  • ⚠️ 多补丁任务图(前景良好但仍保守)
替代方案: 将复杂任务拆分为多个独立工作包。

Best Practices

最佳实践

  1. Start with preview mode to understand routing decisions
  2. Use work packets for implementation to get sandbox verification
  3. Use orchestration for analysis (readonly swarms are fastest)
  4. Keep Codex for ambiguity - don't force delegation on unclear tasks
  5. Monitor cost savings - review interaction blocks in responses
  6. Set realistic acceptance criteria - make verification commands specific
  7. Protect sensitive paths - add to
    protected_paths
    config
  8. Enable compression for faster Codex review of delegated output
  1. 从预览模式开始,了解路由决策逻辑
  2. 使用工作包实现功能,获取沙箱验证保障
  3. 使用编排进行分析(只读专家集群速度最快)
  4. 让Codex处理模糊需求 - 不要强制分配不明确的任务
  5. 监控成本节省 - 查看响应中的交互模块
  6. 设置现实的验收标准 - 让验证命令具体化
  7. 保护敏感路径 - 添加至
    protected_paths
    配置
  8. 启用压缩,加快Codex对分配任务输出的审核速度

Environment Variables

环境变量

bash
undefined
bash
undefined

Required for DeepSeek (default provider)

DeepSeek(默认提供商)必填

export DEEPSEEK_API_KEY="sk-..."
export DEEPSEEK_API_KEY="sk-..."

Optional alternative providers

可选替代提供商

export OPENAI_API_KEY="sk-..." export ANTHROPIC_API_KEY="sk-ant-..." export GEMINI_API_KEY="..." export QWEN_API_KEY="..."
export OPENAI_API_KEY="sk-..." export ANTHROPIC_API_KEY="sk-ant-..." export GEMINI_API_KEY="..." export QWEN_API_KEY="..."

Optional: override config path

可选:覆盖配置文件路径

export CODEXSAVER_CONFIG_PATH="/custom/path/config.json"
undefined
export CODEXSAVER_CONFIG_PATH="/custom/path/config.json"
undefined

Provider Presets

提供商预置配置

Switch providers in
~/.codexsaver/config.json
:
json
{
  "provider": "openai",
  "openai": {
    "api_key_env": "OPENAI_API_KEY",
    "model": "gpt-4o-mini"
  }
}
Supported:
deepseek
,
openai
,
anthropic
,
gemini
,
qwen
,
ollama
,
lmstudio
~/.codexsaver/config.json
中切换提供商:
json
{
  "provider": "openai",
  "openai": {
    "api_key_env": "OPENAI_API_KEY",
    "model": "gpt-4o-mini"
  }
}
支持的提供商:
deepseek
,
openai
,
anthropic
,
gemini
,
qwen
,
ollama
,
lmstudio