issue-resolve
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIssue Resolve (Codex Version)
问题解决(Codex版本)
Unified issue resolution pipeline that orchestrates solution creation from multiple sources and queue formation for execution.
统一的问题解决流水线,可协调多来源的解决方案创建及执行队列的形成。
Architecture Overview
架构概述
┌─────────────────────────────────────────────────────────────────┐
│ Issue Resolve Orchestrator (SKILL.md) │
│ → Source selection → Route to phase → Execute → Summary │
└───────────────┬─────────────────────────────────────────────────┘
│
├─ ASK_USER: Select issue source
│
┌───────────┼───────────┬───────────┬───────────┐
↓ ↓ ↓ ↓ │
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ Phase 1 │ │ Phase 2 │ │ Phase 3 │ │ Phase 4 │ │
│ Explore │ │ Convert │ │ From │ │ Form │ │
│ & Plan │ │Artifact │ │Brainstorm│ │ Queue │ │
└─────────┘ └─────────┘ └─────────┘ └─────────┘ │
↓ ↓ ↓ ↓ │
Solutions Solutions Issue+Sol Exec Queue │
(bound) (bound) (bound) (ordered) │
│ │ │ │
└─────┬─────┘───────────┘ │
↓ (optional --export-tasks) │
.task/TASK-*.json │
│
┌────────────────────────────────┘
↓
/issue:execute┌─────────────────────────────────────────────────────────────────┐
│ Issue Resolve Orchestrator (SKILL.md) │
│ → Source selection → Route to phase → Execute → Summary │
└───────────────┬─────────────────────────────────────────────────┘
│
├─ ASK_USER: Select issue source
│
┌───────────┼───────────┬───────────┬───────────┐
↓ ↓ ↓ ↓ │
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ Phase 1 │ │ Phase 2 │ │ Phase 3 │ │ Phase 4 │ │
│ Explore │ │ Convert │ │ From │ │ Form │ │
│ & Plan │ │Artifact │ │Brainstorm│ │ Queue │ │
└─────────┘ └─────────┘ └─────────┘ └─────────┘ │
↓ ↓ ↓ ↓ │
Solutions Solutions Issue+Sol Exec Queue │
(bound) (bound) (bound) (ordered) │
│ │ │ │
└─────┬─────┘───────────┘ │
↓ (optional --export-tasks) │
.task/TASK-*.json │
│
┌────────────────────────────────┘
↓
/issue:executeKey Design Principles
核心设计原则
- Source-Driven Routing: ASK_USER selects workflow, then load single phase
- Progressive Phase Loading: Only read the selected phase document
- CLI-First Data Access: All issue/solution CRUD via CLI commands
ccw issue - Auto Mode Support: flag skips source selection (defaults to Explore & Plan)
-y
- 来源驱动路由:通过ASK_USER选择工作流,然后加载单个阶段
- 渐进式阶段加载:仅读取选中的阶段文档
- CLI优先数据访问:所有问题/解决方案的增删改查(CRUD)操作均通过CLI命令完成
ccw issue - 自动模式支持:标志可跳过来源选择(默认使用探索与规划阶段)
-y
Subagent API Reference
子Agent API参考
spawn_agent
spawn_agent
Create a new subagent with task assignment.
javascript
const agentId = spawn_agent({
message: `创建一个分配了任务的新子Agent。
javascript
const agentId = spawn_agent({
message: `TASK ASSIGNMENT
TASK ASSIGNMENT
MANDATORY FIRST STEPS (Agent Execute)
MANDATORY FIRST STEPS (Agent Execute)
- Read role definition: ~/.codex/agents/{agent-type}.md (MUST read first)
- Read: {projectRoot}/.workflow/project-tech.json
- Read: {projectRoot}/.workflow/project-guidelines.json
- Read role definition: ~/.codex/agents/{agent-type}.md (MUST read first)
- Read: {projectRoot}/.workflow/project-tech.json
- Read: {projectRoot}/.workflow/project-guidelines.json
TASK CONTEXT
TASK CONTEXT
${taskContext}
${taskContext}
DELIVERABLES
DELIVERABLES
${deliverables}
`
})
undefined${deliverables}
`
})
undefinedwait
wait
Get results from subagent (only way to retrieve results).
javascript
const result = wait({
ids: [agentId],
timeout_ms: 600000 // 10 minutes
})
if (result.timed_out) {
// Handle timeout - can continue waiting or send_input to prompt completion
}从子Agent获取结果(唯一的结果获取方式)。
javascript
const result = wait({
ids: [agentId],
timeout_ms: 600000 // 10 minutes
})
if (result.timed_out) {
// Handle timeout - can continue waiting or send_input to prompt completion
}send_input
send_input
Continue interaction with active subagent (for clarification or follow-up).
javascript
send_input({
id: agentId,
message: `与活跃的子Agent继续交互(用于澄清或后续操作)。
javascript
send_input({
id: agentId,
message: `CLARIFICATION ANSWERS
CLARIFICATION ANSWERS
${answers}
${answers}
NEXT STEP
NEXT STEP
Continue with updated analysis.
`
})
undefinedContinue with updated analysis.
`
})
undefinedclose_agent
close_agent
Clean up subagent resources (irreversible).
javascript
close_agent({ id: agentId })清理子Agent资源(操作不可逆)。
javascript
close_agent({ id: agentId })Auto Mode
自动模式
When or : Skip source selection, use Explore & Plan for issue IDs, or auto-detect source type for paths.
--yes-y当使用或标志时:跳过来源选择,对问题ID使用探索与规划阶段,或对路径自动检测来源类型。
--yes-yUsage
使用方法
codex -p "@.codex/prompts/issue-resolve.md <task description or issue IDs>"
codex -p "@.codex/prompts/issue-resolve.md [FLAGS] \"<input>\""codex -p "@.codex/prompts/issue-resolve.md <task description or issue IDs>"
codex -p "@.codex/prompts/issue-resolve.md [FLAGS] \"<input>\""Flags
Flags
-y, --yes Skip all confirmations (auto mode)
--source <type> Pre-select source: plan|convert|brainstorm|queue
--batch-size <n> Max issues per agent batch (plan mode, default: 3)
--issue <id> Bind to existing issue (convert mode)
--supplement Add tasks to existing solution (convert mode)
--queues <n> Number of parallel queues (queue mode, default: 1)
--export-tasks Export solution tasks to .task/TASK-*.json (task-schema.json format)
-y, --yes Skip all confirmations (auto mode)
--source <type> Pre-select source: plan|convert|brainstorm|queue
--batch-size <n> Max issues per agent batch (plan mode, default: 3)
--issue <id> Bind to existing issue (convert mode)
--supplement Add tasks to existing solution (convert mode)
--queues <n> Number of parallel queues (queue mode, default: 1)
--export-tasks Export solution tasks to .task/TASK-*.json (task-schema.json format)
Examples
Examples
codex -p "@.codex/prompts/issue-resolve.md GH-123,GH-124" # Explore & plan issues
codex -p "@.codex/prompts/issue-resolve.md --source plan --all-pending" # Plan all pending issues
codex -p "@.codex/prompts/issue-resolve.md --source convert ".workflow/.lite-plan/my-plan"" # Convert artifact
codex -p "@.codex/prompts/issue-resolve.md --source brainstorm SESSION="BS-rate-limiting"" # From brainstorm
codex -p "@.codex/prompts/issue-resolve.md --source queue" # Form execution queue
codex -p "@.codex/prompts/issue-resolve.md -y GH-123" # Auto mode, plan single issue
undefinedcodex -p "@.codex/prompts/issue-resolve.md GH-123,GH-124" # Explore & plan issues
codex -p "@.codex/prompts/issue-resolve.md --source plan --all-pending" # Plan all pending issues
codex -p "@.codex/prompts/issue-resolve.md --source convert ".workflow/.lite-plan/my-plan"" # Convert artifact
codex -p "@.codex/prompts/issue-resolve.md --source brainstorm SESSION="BS-rate-limiting"" # From brainstorm
codex -p "@.codex/prompts/issue-resolve.md --source queue" # Form execution queue
codex -p "@.codex/prompts/issue-resolve.md -y GH-123" # Auto mode, plan single issue
undefinedExecution Flow
执行流程
Input Parsing:
└─ Parse flags (--source, -y, --issue, etc.) and positional args
Source Selection:
├─ --source flag provided → Route directly
├─ Auto-detect from input:
│ ├─ Issue IDs (GH-xxx, ISS-xxx) → Explore & Plan
│ ├─ SESSION="..." → From Brainstorm
│ ├─ File/folder path → Convert from Artifact
│ └─ No input or --all-pending → Explore & Plan (all pending)
└─ Otherwise → ASK_USER to select source
Phase Execution (load one phase):
├─ Phase 1: Explore & Plan → phases/01-issue-plan.md
├─ Phase 2: Convert Artifact → phases/02-convert-to-plan.md
├─ Phase 3: From Brainstorm → phases/03-from-brainstorm.md
└─ Phase 4: Form Queue → phases/04-issue-queue.md
Post-Phase:
├─ Export to Task JSON (optional, with --export-tasks flag)
│ └─ For each solution.tasks[] → write .task/TASK-{T-id}.json
└─ Summary + Next steps recommendationInput Parsing:
└─ Parse flags (--source, -y, --issue, etc.) and positional args
Source Selection:
├─ --source flag provided → Route directly
├─ Auto-detect from input:
│ ├─ Issue IDs (GH-xxx, ISS-xxx) → Explore & Plan
│ ├─ SESSION="..." → From Brainstorm
│ ├─ File/folder path → Convert from Artifact
│ └─ No input or --all-pending → Explore & Plan (all pending)
└─ Otherwise → ASK_USER to select source
Phase Execution (load one phase):
├─ Phase 1: Explore & Plan → phases/01-issue-plan.md
├─ Phase 2: Convert Artifact → phases/02-convert-to-plan.md
├─ Phase 3: From Brainstorm → phases/03-from-brainstorm.md
└─ Phase 4: Form Queue → phases/04-issue-queue.md
Post-Phase:
├─ Export to Task JSON (optional, with --export-tasks flag)
│ └─ For each solution.tasks[] → write .task/TASK-{T-id}.json
└─ Summary + Next steps recommendationPhase Reference Documents
阶段参考文档
| Phase | Document | Load When | Purpose |
|---|---|---|---|
| Phase 1 | phases/01-issue-plan.md | Source = Explore & Plan | Batch plan issues via issue-plan-agent |
| Phase 2 | phases/02-convert-to-plan.md | Source = Convert Artifact | Convert lite-plan/session/markdown to solutions |
| Phase 3 | phases/03-from-brainstorm.md | Source = From Brainstorm | Convert brainstorm ideas to issue + solution |
| Phase 4 | phases/04-issue-queue.md | Source = Form Queue | Order bound solutions into execution queue |
| 阶段 | 文档 | 加载时机 | 用途 |
|---|---|---|---|
| 阶段1 | phases/01-issue-plan.md | 来源 = 探索与规划 | 通过issue-plan-agent批量规划问题 |
| 阶段2 | phases/02-convert-to-plan.md | 来源 = 从工件转换 | 将lite-plan/会话/Markdown转换为解决方案 |
| 阶段3 | phases/03-from-brainstorm.md | 来源 = 从头脑风暴 | 将头脑风暴想法转换为问题及解决方案 |
| 阶段4 | phases/04-issue-queue.md | 来源 = 形成队列 | 将绑定的解决方案排序为执行队列 |
Core Rules
核心规则
- Source Selection First: Always determine source before loading any phase
- Single Phase Load: Only read the selected phase document, never load all phases
- CLI Data Access: Use CLI for all issue/solution operations, NEVER read files directly
ccw issue - Content Preservation: Each phase contains complete execution logic from original commands
- Auto-Detect Input: Smart input parsing reduces need for explicit --source flag
- DO NOT STOP: Continuous multi-phase workflow. After completing each phase, immediately proceed to next
- Explicit Lifecycle: Always close_agent after wait completes to free resources
- 先选来源:在加载任何阶段前,必须先确定来源
- 单阶段加载:仅读取选中的阶段文档,绝不要加载所有阶段
- CLI数据访问:所有问题/解决方案操作均使用CLI命令,绝不要直接读取文件
ccw issue - 内容保留:每个阶段包含原始命令的完整执行逻辑
- 输入自动检测:智能输入解析减少显式--source标志的使用需求
- 持续执行:多阶段工作流需持续进行,完成每个阶段后立即进入下一阶段
- 明确生命周期:wait完成后必须调用close_agent以释放资源
Input Processing
输入处理
Auto-Detection Logic
自动检测逻辑
javascript
function detectSource(input, flags) {
// 1. Explicit --source flag
if (flags.source) return flags.source;
// 2. Auto-detect from input content
const trimmed = input.trim();
// Issue IDs pattern (GH-xxx, ISS-xxx, comma-separated)
if (trimmed.match(/^[A-Z]+-\d+/i) || trimmed.includes(',')) {
return 'plan';
}
// --all-pending or empty input → plan all pending
if (flags.allPending || trimmed === '') {
return 'plan';
}
// SESSION="..." pattern → brainstorm
if (trimmed.includes('SESSION=')) {
return 'brainstorm';
}
// File/folder path → convert
if (trimmed.match(/\.(md|json)$/) || trimmed.includes('.workflow/')) {
return 'convert';
}
// Cannot auto-detect → ask user
return null;
}javascript
function detectSource(input, flags) {
// 1. 显式--source标志
if (flags.source) return flags.source;
// 2. 从输入内容自动检测
const trimmed = input.trim();
// 问题ID格式(GH-xxx, ISS-xxx,逗号分隔)
if (trimmed.match(/^[A-Z]+-\d+/i) || trimmed.includes(',')) {
return 'plan';
}
// --all-pending或空输入 → 规划所有待处理问题
if (flags.allPending || trimmed === '') {
return 'plan';
}
// SESSION="..."格式 → 头脑风暴
if (trimmed.includes('SESSION=')) {
return 'brainstorm';
}
// 文件/文件夹路径 → 转换
if (trimmed.match(/\.(md|json)$/) || trimmed.includes('.workflow/')) {
return 'convert';
}
// 无法自动检测 → 询问用户
return null;
}Source Selection (ASK_USER)
来源选择(ASK_USER)
javascript
// When source cannot be auto-detected
const answer = ASK_USER([{
id: "source",
type: "select",
prompt: "How would you like to create/manage issue solutions?",
options: [
{
label: "Explore & Plan (Recommended)",
description: "AI explores codebase and generates solutions for issues"
},
{
label: "Convert from Artifact",
description: "Convert existing lite-plan, workflow session, or markdown to solution"
},
{
label: "From Brainstorm",
description: "Convert brainstorm session ideas into issue with solution"
},
{
label: "Form Execution Queue",
description: "Order bound solutions into execution queue for /issue:execute"
}
]
}]); // BLOCKS (wait for user response)
// Route based on selection
const sourceMap = {
"Explore & Plan": "plan",
"Convert from Artifact": "convert",
"From Brainstorm": "brainstorm",
"Form Execution Queue": "queue"
};javascript
// 当无法自动检测来源时
const answer = ASK_USER([{
id: "source",
type: "select",
prompt: "您希望如何创建/管理问题解决方案?",
options: [
{
label: "探索与规划(推荐)",
description: "AI探索代码库并生成问题解决方案"
},
{
label: "从工件转换",
description: "将现有lite-plan、工作流会话或Markdown转换为解决方案"
},
{
label: "从头脑风暴导入",
description: "将头脑风暴会话想法转换为带解决方案的问题"
},
{
label: "形成执行队列",
description: "将绑定的解决方案排序为执行队列,用于/issue:execute"
}
]
}]); // BLOCKS(等待用户响应)
// 根据选择路由
const sourceMap = {
"探索与规划(推荐)": "plan",
"从工件转换": "convert",
"从头脑风暴导入": "brainstorm",
"形成执行队列": "queue"
};Data Flow
数据流
User Input (issue IDs / artifact path / session ID / flags)
↓
[Parse Flags + Auto-Detect Source]
↓
[Source Selection] ← ASK_USER (if needed)
↓
[Read Selected Phase Document]
↓
[Execute Phase Logic]
↓
[Summary + Next Steps]
├─ After Plan/Convert/Brainstorm → Suggest /issue:queue or /issue:execute
└─ After Queue → Suggest /issue:execute
(Optional) Export to Task JSON (when --export-tasks flag is set):
├─ For each solution.tasks[] entry:
│ ├─ solution.task.id → id (prefixed as TASK-{T-id})
│ ├─ solution.task.title → title
│ ├─ solution.task.description → description
│ ├─ solution.task.action → action
│ ├─ solution.task.scope → scope
│ ├─ solution.task.modification_points[] → files[]
│ │ ├─ mp.file → files[].path
│ │ ├─ mp.target → files[].target
│ │ └─ mp.change → files[].changes[]
│ ├─ solution.task.acceptance → convergence
│ │ ├─ acceptance.criteria[] → convergence.criteria[]
│ │ └─ acceptance.verification[]→ convergence.verification (joined)
│ ├─ solution.task.implementation → implementation[]
│ ├─ solution.task.test → test
│ ├─ solution.task.depends_on → depends_on
│ ├─ solution.task.commit → commit
│ └─ solution.task.priority → priority (1→critical, 2→high, 3→medium, 4-5→low)
├─ Output path: .workflow/issues/{issue-id}/.task/TASK-{T-id}.json
├─ Each file follows task-schema.json (IDENTITY + CONVERGENCE + FILES required)
└─ source.tool = "issue-resolve", source.issue_id = {issue-id}用户输入(问题ID / 工件路径 / 会话ID / 标志)
↓
[解析标志 + 自动检测来源]
↓
[来源选择] ← 必要时调用ASK_USER
↓
[读取选中的阶段文档]
↓
[执行阶段逻辑]
↓
[总结 + 下一步建议]
├─ 规划/转换/头脑风暴阶段完成后 → 建议使用/issue:queue或/issue:execute
└─ 队列阶段完成后 → 建议使用/issue:execute
(可选)导出为任务JSON(当设置--export-tasks标志时):
├─ 针对每个solution.tasks[]条目:
│ ├─ solution.task.id → id(前缀为TASK-{T-id})
│ ├─ solution.task.title → 标题
│ ├─ solution.task.description → 描述
│ ├─ solution.task.action → 操作
│ ├─ solution.task.scope → 范围
│ ├─ solution.task.modification_points[] → files[]
│ │ ├─ mp.file → files[].path
│ │ ├─ mp.target → files[].target
│ │ └─ mp.change → files[].changes[]
│ ├─ solution.task.acceptance → convergence
│ │ ├─ acceptance.criteria[] → convergence.criteria[]
│ │ └─ acceptance.verification[]→ convergence.verification(拼接后)
│ ├─ solution.task.implementation → implementation[]
│ ├─ solution.task.test → 测试
│ ├─ solution.task.depends_on → 依赖项
│ ├─ solution.task.commit → 提交信息
│ └─ solution.task.priority → 优先级(1→关键,2→高,3→中,4-5→低)
├─ 输出路径:.workflow/issues/{issue-id}/.task/TASK-{T-id}.json
├─ 每个文件遵循task-schema.json格式(IDENTITY + CONVERGENCE + FILES为必填项)
└─ source.tool = "issue-resolve", source.issue_id = {issue-id}Task Tracking Pattern
任务跟踪模式
javascript
// Initialize plan with phase steps
update_plan({
explanation: "Issue resolve workflow started",
plan: [
{ step: "Select issue source", status: "completed" },
{ step: "Execute: [selected phase name]", status: "in_progress" },
{ step: "Summary & next steps", status: "pending" }
]
})Phase-specific sub-tasks are attached when the phase executes (see individual phase docs for details).
javascript
// 用阶段步骤初始化规划
update_plan({
explanation: "问题解决工作流已启动",
plan: [
{ step: "选择问题来源", status: "completed" },
{ step: "执行:[选中的阶段名称]", status: "in_progress" },
{ step: "总结与下一步", status: "pending" }
]
})阶段特定的子任务会在阶段执行时附加(详情请见各阶段文档)。
Core Guidelines
核心指南
Data Access Principle: Issues and solutions files can grow very large. To avoid context overflow:
| Operation | Correct | Incorrect |
|---|---|---|
| List issues (brief) | | |
| Read issue details | | |
| Update status | | Direct file edit |
| Bind solution | | Direct file edit |
| Batch solutions | | Loop individual queries |
Output Options:
- : JSON with minimal fields (orchestrator use)
--brief - : Full JSON (agent use only)
--json
ALWAYS use CLI commands for CRUD operations. NEVER read entire or directly.
issues.jsonlsolutions/*.jsonl数据访问原则:问题和解决方案文件可能会变得非常大。为避免上下文溢出:
| 操作 | 正确方式 | 错误方式 |
|---|---|---|
| 列出问题(简洁版) | | |
| 读取问题详情 | | |
| 更新状态 | | 直接编辑文件 |
| 绑定解决方案 | | 直接编辑文件 |
| 批量获取解决方案 | | 循环查询单个条目 |
输出选项:
- :仅包含最小字段的JSON(供编排器使用)
--brief - :完整JSON(仅供Agent使用)
--json
必须使用CLI命令执行CRUD操作。绝不要直接读取整个或文件。
issues.jsonlsolutions/*.jsonlError Handling
错误处理
| Error | Resolution |
|---|---|
| No source detected | Show ASK_USER with all 4 options |
| Invalid source type | Show available sources, re-prompt |
| Phase execution fails | Report error, suggest manual intervention |
| No pending issues (plan) | Suggest creating issues first |
| No bound solutions (queue) | Suggest running plan/convert/brainstorm first |
| 错误 | 解决方法 |
|---|---|
| 未检测到来源 | 显示包含全部4个选项的ASK_USER界面 |
| 无效的来源类型 | 显示可用来源并重新提示 |
| 阶段执行失败 | 报告错误并建议手动干预 |
| 无待处理问题(规划阶段) | 建议先创建问题 |
| 无绑定解决方案(队列阶段) | 建议先运行规划/转换/头脑风暴阶段 |
Post-Phase Next Steps
阶段完成后下一步建议
After successful phase execution, recommend next action:
javascript
// After Plan/Convert/Brainstorm (solutions created)
ASK_USER([{
id: "next_action",
type: "select",
prompt: "Solutions created. What next?",
options: [
{ label: "Form Queue", description: "Order solutions for execution (/issue:queue)" },
{ label: "Plan More Issues", description: "Continue creating solutions" },
{ label: "View Issues", description: "Review issue details" },
{ label: "Done", description: "Exit workflow" }
]
}]); // BLOCKS (wait for user response)
// After Queue (queue formed)
// → Suggest /issue:execute directly阶段执行成功后,推荐后续操作:
javascript
// 规划/转换/头脑风暴阶段完成后(已创建解决方案)
ASK_USER([{
id: "next_action",
type: "select",
prompt: "解决方案已创建。下一步操作?",
options: [
{ label: "形成队列", description: "将解决方案排序为执行队列(/issue:queue)" },
{ label: "规划更多问题", description: "继续创建解决方案" },
{ label: "查看问题", description: "查看问题详情" },
{ label: "完成", description: "退出工作流" }
]
}]); // BLOCKS(等待用户响应)
// 队列阶段完成后
// → 直接建议使用/issue:executeRelated Commands
相关命令
- - Interactive issue CRUD operations
issue-manage - - Execute queue with DAG-based parallel orchestration
/issue:execute - - List all issues
ccw issue list - - View issue details
ccw issue status <id>
- - 交互式问题CRUD操作
issue-manage - - 基于DAG的并行编排执行队列
/issue:execute - - 列出所有问题
ccw issue list - - 查看问题详情
ccw issue status <id>