roadmap-with-file
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAuto Mode
自动模式
When or : Auto-confirm strategy selection, use recommended mode, skip interactive rounds.
--yes-y当使用或参数时:自动确认策略选择,使用推荐模式,跳过交互环节。
--yes-yRoadmap-with-file Skill
Roadmap-with-file Skill
Usage
使用方法
bash
$roadmap-with-file "Implement user authentication system with OAuth and 2FA"
$roadmap-with-file -m progressive "Build real-time notification system"
$roadmap-with-file -m direct "Refactor payment module"
$roadmap-with-file -m auto "Add data export feature"
$roadmap-with-file --continue "auth system"
$roadmap-with-file -y "Implement caching layer"Flags:
- : Skip all confirmations (auto mode)
-y, --yes - : Continue existing session
-c, --continue - : Strategy selection (progressive / direct / auto)
-m, --mode
Context Source: cli-explore-agent (optional) + requirement analysis
Output Directory:
Core Output: (single source, human-readable) + (global, machine-executable)
.workflow/.roadmap/{session-id}/roadmap.mdissues.jsonlbash
$roadmap-with-file "实现基于OAuth和2FA的用户认证系统"
$roadmap-with-file -m progressive "构建实时通知系统"
$roadmap-with-file -m direct "重构支付模块"
$roadmap-with-file -m auto "添加数据导出功能"
$roadmap-with-file --continue "auth system"
$roadmap-with-file -y "实现缓存层"参数标记:
- : 跳过所有确认步骤(自动模式)
-y, --yes - : 继续现有会话
-c, --continue - : 选择策略(progressive / direct / auto)
-m, --mode
上下文来源: cli-explore-agent(可选)+ 需求分析
输出目录:
核心输出: (单一数据源,人类可读)+ (全局,机器可执行)
.workflow/.roadmap/{session-id}/roadmap.mdissues.jsonlSubagent 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
任务分配
MANDATORY FIRST STEPS (Agent Execute)
必须执行的第一步(Agent执行)
- Read role definition: ~/.codex/agents/{agent-type}.md (MUST read first)
- Read: .workflow/project-tech.json
- Read: .workflow/project-guidelines.json
- 阅读角色定义: ~/.codex/agents/{agent-type}.md(必须首先阅读)
- 读取: .workflow/project-tech.json
- 读取: .workflow/project-guidelines.json
TASK CONTEXT
任务上下文
${taskContext}
${taskContext}
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分钟
})
if (result.timed_out) {
// 处理超时 - 可继续等待或发送输入以提示完成
}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
澄清答案
${answers}
${answers}
NEXT STEP
下一步
Continue with plan generation.
`
})
undefined继续生成计划。
`
})
undefinedclose_agent
close_agent
Clean up subagent resources (irreversible).
javascript
close_agent({ id: agentId })清理子Agent资源(不可逆操作)。
javascript
close_agent({ id: agentId })Output Artifacts
输出工件
Single Source of Truth
唯一可信数据源
| Artifact | Purpose | Consumer |
|---|---|---|
| ⭐ Human-readable strategic roadmap with all context | Human review, team-planex handoff |
| Global issue store (appended) | team-planex, issue commands |
| 工件 | 用途 | 使用者 |
|---|---|---|
| ⭐ 包含所有上下文的人类可读战略路线图 | 人工审核、交接至team-planex |
| 全局Issue存储(追加模式) | team-planex、Issue命令 |
Why No Separate JSON Files?
为何不使用单独的JSON文件?
| Original File | Why Removed | Where Content Goes |
|---|---|---|
| Duplicates roadmap.md content | Embedded in |
| Single-use intermediate | Embedded in |
| 原文件 | 移除原因 | 内容去向 |
|---|---|---|
| 与roadmap.md内容重复 | 嵌入到 |
| 一次性中间文件 | 嵌入到 |
Overview
概述
Strategic requirement roadmap with iterative decomposition. Creates a single that evolves through discussion, with issues persisted to global for execution.
roadmap.mdissues.jsonlCore workflow: Understand → Decompose → Iterate → Validate → Handoff
┌─────────────────────────────────────────────────────────────────────────┐
│ ROADMAP ITERATIVE WORKFLOW │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Phase 1: Requirement Understanding & Strategy │
│ ├─ Parse requirement: goal / constraints / stakeholders │
│ ├─ Assess uncertainty level → recommend mode │
│ ├─ User confirms strategy (-m skips, -y auto-selects) │
│ └─ Initialize roadmap.md with Strategy Assessment │
│ │
│ Phase 2: Decomposition & Issue Creation │
│ ├─ cli-roadmap-plan-agent executes decomposition │
│ ├─ Progressive: 2-4 layers (MVP→Optimized) with convergence │
│ ├─ Direct: Topological task sequence with convergence │
│ ├─ Create issues via ccw issue create → issues.jsonl │
│ └─ Update roadmap.md with Roadmap table + Issue references │
│ │
│ Phase 3: Iterative Refinement (Multi-Round) │
│ ├─ Present roadmap to user │
│ ├─ Feedback: Approve | Adjust Scope | Modify Convergence | Replan │
│ ├─ Update roadmap.md with each round │
│ └─ Repeat until approved (max 5 rounds) │
│ │
│ Phase 4: Handoff │
│ ├─ Final roadmap.md with Issue ID references │
│ ├─ Options: team-planex | first wave | view issues | done │
│ └─ Issues ready in .workflow/issues/issues.jsonl │
│ │
└─────────────────────────────────────────────────────────────────────────┘具备迭代分解功能的战略需求路线图工具。创建可通过讨论不断演进的单一文件,同时将Issue持久化到全局中以便执行。
roadmap.mdissues.jsonl核心工作流: 理解 → 分解 → 迭代 → 验证 → 交接
┌─────────────────────────────────────────────────────────────────────────┐
│ 路线图迭代工作流 │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ 阶段1: 需求理解与策略制定 │
│ ├─ 解析需求:目标 / 约束 / 相关方 │
│ ├─ 评估不确定性水平 → 推荐模式 │
│ ├─ 用户确认策略(-m参数可跳过,-y参数自动选择) │
│ └─ 初始化包含策略评估的roadmap.md │
│ │
│ 阶段2: 分解与Issue创建 │
│ ├─ cli-roadmap-plan-agent执行分解操作 │
│ ├─ Progressive模式:2-4层(MVP→优化版),每层完成后收敛 │
│ ├─ Direct模式:拓扑任务序列,完成后收敛 │
│ ├─ 通过ccw issue create创建Issue → 写入issues.jsonl │
│ └─ 更新roadmap.md,添加路线图表格 + Issue引用 │
│ │
│ 阶段3: 迭代优化(多轮) │
│ ├─ 向用户展示路线图 │
│ ├─ 反馈:批准 | 调整范围 | 修改收敛条件 | 重新规划 │
│ ├─ 每轮更新roadmap.md │
│ └─ 重复直至批准(最多5轮) │
│ │
│ 阶段4: 交接 │
│ ├─ 包含Issue ID引用的最终roadmap.md │
│ ├─ 选项:team-planex | 执行第一波任务 | 查看Issue | 完成 │
│ └─ Issue已准备好,存储在.workflow/issues/issues.jsonl中 │
│ │
└─────────────────────────────────────────────────────────────────────────┘Dual Modes
双模式
| Mode | Strategy | Best For | Decomposition |
|---|---|---|---|
| Progressive | MVP → Usable → Refined → Optimized | High uncertainty, need validation | 2-4 layers, each with full convergence |
| Direct | Topological task sequence | Clear requirements, confirmed tech | Tasks with explicit inputs/outputs |
Auto-selection logic:
- ≥3 high uncertainty factors → Progressive
- ≥3 low uncertainty factors → Direct
- Otherwise → Ask user preference
| 模式 | 策略 | 最佳适用场景 | 分解方式 |
|---|---|---|---|
| Progressive | MVP → 可用版 → 优化版 → 最终版 | 不确定性高、需要验证的需求 | 2-4层,每层完成后收敛 |
| Direct | 拓扑排序的任务序列 | 需求明确、技术方案已确认 | 具有明确输入/输出的任务 |
自动选择逻辑:
- ≥3个高不确定性因素 → Progressive模式
- ≥3个低不确定性因素 → Direct模式
- 其他情况 → 询问用户偏好
Output Structure
输出结构
.workflow/.roadmap/RMAP-{slug}-{date}/
└── roadmap.md # ⭐ Single source of truth
# - Strategy Assessment (embedded)
# - Roadmap Table
# - Convergence Criteria per Issue
# - Codebase Context (appendix, if applicable)
# - Iteration History
.workflow/issues/issues.jsonl # Global issue store (appended)
# - One JSON object per line
# - Consumed by team-planex, issue commands.workflow/.roadmap/RMAP-{slug}-{date}/
└── roadmap.md # ⭐ 唯一可信数据源
# - 策略评估(嵌入)
# - 路线图表格
# - 每个Issue的收敛条件
# - 代码库上下文(附录,可选)
# - 迭代历史
.workflow/issues/issues.jsonl # 全局Issue存储(追加模式)
# - 每行一个JSON对象
# - 供team-planex、Issue命令使用roadmap.md Template
roadmap.md模板
markdown
undefinedmarkdown
undefinedRequirement Roadmap
需求路线图
Session: RMAP-{slug}-{date}
Requirement: {requirement}
Strategy: {progressive|direct}
Status: {Planning|Refining|Ready}
Created: {timestamp}
会话: RMAP-{slug}-{date}
需求: {requirement}
策略: {progressive|direct}
状态: {规划中|优化中|已就绪}
创建时间: {timestamp}
Strategy Assessment
策略评估
- Uncertainty Level: {high|medium|low}
- Decomposition Mode: {progressive|direct}
- Assessment Basis: {factors summary}
- Goal: {extracted goal}
- Constraints: {extracted constraints}
- Stakeholders: {extracted stakeholders}
- 不确定性水平: {高|中|低}
- 分解模式: {progressive|direct}
- 评估依据: {因素摘要}
- 目标: {提取的目标}
- 约束: {提取的约束}
- 相关方: {提取的相关方}
Roadmap
路线图
Progressive Mode
Progressive模式
| Wave | Issue ID | Layer | Goal | Priority | Dependencies |
|---|---|---|---|---|---|
| 1 | ISS-xxx | MVP | ... | 2 | - |
| 2 | ISS-yyy | Usable | ... | 3 | ISS-xxx |
| 阶段 | Issue ID | 层级 | 目标 | 优先级 | 依赖 |
|---|---|---|---|---|---|
| 1 | ISS-xxx | MVP | ... | 2 | - |
| 2 | ISS-yyy | 可用版 | ... | 3 | ISS-xxx |
Direct Mode
Direct模式
| Wave | Issue ID | Title | Type | Dependencies |
|---|---|---|---|---|
| 1 | ISS-xxx | ... | infrastructure | - |
| 2 | ISS-yyy | ... | feature | ISS-xxx |
| 阶段 | Issue ID | 标题 | 类型 | 依赖 |
|---|---|---|---|---|
| 1 | ISS-xxx | ... | 基础设施 | - |
| 2 | ISS-yyy | ... | 功能特性 | ISS-xxx |
Convergence Criteria
收敛条件
ISS-xxx: {Issue Title}
ISS-xxx: {Issue标题}
- Criteria: [testable conditions]
- Verification: [executable steps/commands]
- Definition of Done: [business language, non-technical]
- 条件: [可测试的场景]
- 验证方式: [可执行的步骤/命令]
- 完成定义: [业务语言,非技术术语]
ISS-yyy: {Issue Title}
ISS-yyy: {Issue标题}
...
...
Risks
风险
| Risk | Severity | Mitigation |
|---|---|---|
| ... | ... | ... |
| 风险 | 严重程度 | 缓解措施 |
|---|---|---|
| ... | ... | ... |
Iteration History
迭代历史
Round 1 - {timestamp}
第1轮 - {timestamp}
User Feedback: {feedback summary}
Changes Made: {adjustments}
Status: {approved|continue iteration}
用户反馈: {反馈摘要}
修改内容: {调整项}
状态: {已批准|继续迭代}
Codebase Context (Optional)
代码库上下文(可选)
Included when codebase exploration was performed
- Relevant Modules: [...]
- Existing Patterns: [...]
- Integration Points: [...]
---仅在执行代码库探索后包含
- 相关模块: [...]
- 现有模式: [...]
- 集成点: [...]
---Issues JSONL Specification
Issues JSONL规范
Location & Format
位置与格式
Path: .workflow/issues/issues.jsonl
Format: JSONL (one complete JSON object per line)
Encoding: UTF-8
Mode: Append-only (new issues appended to end)路径: .workflow/issues/issues.jsonl
格式: JSONL(每行一个完整的JSON对象)
编码: UTF-8
模式: 仅追加(新Issue追加到末尾)Record Schema
记录 schema
json
{
"id": "ISS-YYYYMMDD-NNN",
"title": "[LayerName] goal or [TaskType] title",
"status": "pending",
"priority": 2,
"context": "Markdown with goal, scope, convergence, verification, DoD",
"source": "text",
"tags": ["roadmap", "progressive|direct", "wave-N", "layer-name"],
"extended_context": {
"notes": {
"session": "RMAP-{slug}-{date}",
"strategy": "progressive|direct",
"wave": 1,
"depends_on_issues": []
}
},
"lifecycle_requirements": {
"test_strategy": "unit",
"regression_scope": "affected",
"acceptance_type": "automated",
"commit_strategy": "per-issue"
}
}json
{
"id": "ISS-YYYYMMDD-NNN",
"title": "[层级名称] 目标 或 [任务类型] 标题",
"status": "pending",
"priority": 2,
"context": "包含目标、范围、收敛条件、验证方式、完成定义的Markdown",
"source": "text",
"tags": ["roadmap", "progressive|direct", "wave-N", "layer-name"],
"extended_context": {
"notes": {
"session": "RMAP-{slug}-{date}",
"strategy": "progressive|direct",
"wave": 1,
"depends_on_issues": []
}
},
"lifecycle_requirements": {
"test_strategy": "unit",
"regression_scope": "affected",
"acceptance_type": "automated",
"commit_strategy": "per-issue"
}
}Query Interface
查询接口
bash
undefinedbash
undefinedBy ID (detail view)
通过ID查询(详情视图)
ccw issue list ISS-20260227-001
ccw issue list ISS-20260227-001
List all with status filter
按状态过滤列出所有Issue
ccw issue list --status planned,queued
ccw issue list --brief # JSON minimal output
ccw issue list --status planned,queued
ccw issue list --brief # 极简JSON输出
Queue operations (wave-based execution)
队列操作(基于阶段的执行)
ccw issue queue list # List all queues
ccw issue queue dag # Get dependency graph (JSON)
ccw issue next --queue <queue-id> # Get next task
ccw issue queue list # 列出所有队列
ccw issue queue dag # 获取依赖图(JSON格式)
ccw issue next --queue <queue-id> # 获取下一个任务
Execute
执行
ccw issue queue add <issue-id> # Add to active queue
ccw issue done <item-id> # Mark completed
> **Note**: Issues are tagged with `wave-N` in `tags[]` field for filtering. Use `--brief` for programmatic parsing.
---ccw issue queue add <issue-id> # 添加到活跃队列
ccw issue done <item-id> # 标记为已完成
> **注意**: Issue的`tags[]`字段中包含`wave-N`标签用于过滤。使用`--brief`参数供程序解析。
---Implementation
实现细节
Session Initialization
会话初始化
javascript
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// Parse flags
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
const continueMode = $ARGUMENTS.includes('--continue') || $ARGUMENTS.includes('-c')
const modeMatch = $ARGUMENTS.match(/(?:--mode|-m)\s+(progressive|direct|auto)/)
const requestedMode = modeMatch ? modeMatch[1] : 'auto'
// Clean requirement text (remove flags)
const requirement = $ARGUMENTS
.replace(/--yes|-y|--continue|-c|--mode\s+\w+|-m\s+\w+/g, '')
.trim()
const slug = requirement.toLowerCase()
.replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
.substring(0, 40)
const dateStr = getUtc8ISOString().substring(0, 10)
const sessionId = `RMAP-${slug}-${dateStr}`
const sessionFolder = `.workflow/.roadmap/${sessionId}`
// Auto-detect continue mode
if (continueMode || file_exists(`${sessionFolder}/roadmap.md`)) {
// Resume existing session
const existingRoadmap = Read(`${sessionFolder}/roadmap.md`)
// Extract current phase and continue from there
}
Bash(`mkdir -p ${sessionFolder}`)javascript
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// 解析参数
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
const continueMode = $ARGUMENTS.includes('--continue') || $ARGUMENTS.includes('-c')
const modeMatch = $ARGUMENTS.match(/(?:--mode|-m)\s+(progressive|direct|auto)/)
const requestedMode = modeMatch ? modeMatch[1] : 'auto'
// 清理需求文本(移除参数标记)
const requirement = $ARGUMENTS
.replace(/--yes|-y|--continue|-c|--mode\s+\w+|-m\s+\w+/g, '')
.trim()
const slug = requirement.toLowerCase()
.replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
.substring(0, 40)
const dateStr = getUtc8ISOString().substring(0, 10)
const sessionId = `RMAP-${slug}-${dateStr}`
const sessionFolder = `.workflow/.roadmap/${sessionId}`
// 自动检测继续模式
if (continueMode || file_exists(`${sessionFolder}/roadmap.md`)) {
// 恢复现有会话
const existingRoadmap = Read(`${sessionFolder}/roadmap.md`)
// 提取当前阶段并继续执行
}
Bash(`mkdir -p ${sessionFolder}`)Phase 1: Requirement Understanding & Strategy
阶段1: 需求理解与策略制定
Objective: Parse requirement, assess uncertainty, select decomposition strategy, initialize roadmap.md.
Steps:
-
Parse Requirement
- Extract: goal, constraints, stakeholders, keywords
-
Assess Uncertaintyjavascript
const uncertaintyFactors = { scope_clarity: 'low|medium|high', technical_risk: 'low|medium|high', dependency_unknown: 'low|medium|high', domain_familiarity: 'low|medium|high', requirement_stability: 'low|medium|high' } // Calculate recommendation const highCount = Object.values(uncertaintyFactors).filter(v => v === 'high').length const lowCount = Object.values(uncertaintyFactors).filter(v => v === 'low').length let recommendedMode if (highCount >= 3) recommendedMode = 'progressive' else if (lowCount >= 3) recommendedMode = 'direct' else recommendedMode = 'progressive' // default safer choice -
Strategy Selection (skip ifspecified or AUTO_YES)
-mjavascriptlet selectedMode if (requestedMode !== 'auto') { selectedMode = requestedMode } else if (AUTO_YES) { selectedMode = recommendedMode } else { const answer = ASK_USER([ { id: "strategy", type: "choice", prompt: `Decomposition strategy:\nUncertainty: ${uncertaintyLevel}\nRecommended: ${recommendedMode}`, options: [ { value: "progressive", label: recommendedMode === 'progressive' ? "Progressive (Recommended)" : "Progressive" }, { value: "direct", label: recommendedMode === 'direct' ? "Direct (Recommended)" : "Direct" } ], default: recommendedMode } ]) // BLOCKS (wait for user response) selectedMode = answer.strategy } -
Initialize roadmap.mdjavascript
const roadmapContent = `# Requirement Roadmap
Session: ${sessionId}
Requirement: ${requirement}
Strategy: ${selectedMode}
Status: Planning
Created: ${getUtc8ISOString()}
目标: 解析需求,评估不确定性,选择分解策略,初始化roadmap.md。
步骤:
-
解析需求
- 提取:目标、约束、相关方、关键词
-
评估不确定性javascript
const uncertaintyFactors = { scope_clarity: 'low|medium|high', technical_risk: 'low|medium|high', dependency_unknown: 'low|medium|high', domain_familiarity: 'low|medium|high', requirement_stability: 'low|medium|high' } // 计算推荐模式 const highCount = Object.values(uncertaintyFactors).filter(v => v === 'high').length const lowCount = Object.values(uncertaintyFactors).filter(v => v === 'low').length let recommendedMode if (highCount >= 3) recommendedMode = 'progressive' else if (lowCount >= 3) recommendedMode = 'direct' else recommendedMode = 'progressive' // 默认更安全的选择 -
选择策略(如果指定了参数或启用AUTO_YES则跳过)
-mjavascriptlet selectedMode if (requestedMode !== 'auto') { selectedMode = requestedMode } else if (AUTO_YES) { selectedMode = recommendedMode } else { const answer = ASK_USER([ { id: "strategy", type: "choice", prompt: `分解策略:\n不确定性: ${uncertaintyLevel}\n推荐: ${recommendedMode}`, options: [ { value: "progressive", label: recommendedMode === 'progressive' ? "Progressive (推荐)" : "Progressive" }, { value: "direct", label: recommendedMode === 'direct' ? "Direct (推荐)" : "Direct" } ], default: recommendedMode } ]) // 阻塞(等待用户响应) selectedMode = answer.strategy } -
初始化roadmap.mdjavascript
const roadmapContent = `# 需求路线图
会话: ${sessionId}
需求: ${requirement}
策略: ${selectedMode}
状态: 规划中
创建时间: ${getUtc8ISOString()}
Strategy Assessment
策略评估
- Uncertainty Level: ${uncertaintyLevel}
- Decomposition Mode: ${selectedMode}
- Assessment Basis: ${factorsSummary}
- Goal: ${extractedGoal}
- Constraints: ${extractedConstraints}
- Stakeholders: ${extractedStakeholders}
- 不确定性水平: ${uncertaintyLevel}
- 分解模式: ${selectedMode}
- 评估依据: ${factorsSummary}
- 目标: ${extractedGoal}
- 约束: ${extractedConstraints}
- 相关方: ${extractedStakeholders}
Roadmap
路线图
To be populated after Phase 2 decomposition
阶段2分解完成后填充
Convergence Criteria Details
收敛条件详情
To be populated after Phase 2 decomposition
阶段2分解完成后填充
Risks
风险
To be populated after Phase 2 decomposition
阶段2分解完成后填充
Iteration History
迭代历史
To be populated during Phase 3 refinement
阶段3优化过程中填充
Codebase Context (Optional)
代码库上下文(可选)
To be populated if codebase exploration was performed `
Write(, roadmapContent)
${sessionFolder}/roadmap.md
**Success Criteria**:
- roadmap.md created with Strategy Assessment
- Strategy selected (progressive or direct)
- Uncertainty factors documented
---若执行了代码库探索则填充 `
Write(, roadmapContent)
${sessionFolder}/roadmap.md
**成功标准**:
- 创建包含策略评估的roadmap.md
- 已选择策略(progressive或direct)
- 已记录不确定性因素
---Phase 2: Decomposition & Issue Creation
阶段2: 分解与Issue创建
Objective: Execute decomposition via , create issues, update roadmap.md.
cli-roadmap-plan-agentSteps:
- Optional Codebase Exploration (if codebase detected)
javascript
const hasCodebase = Bash(` test -f package.json && echo "nodejs" || test -f go.mod && echo "golang" || test -f Cargo.toml && echo "rust" || test -f pyproject.toml && echo "python" || test -d src && echo "generic" || echo "none" `).trim() let codebaseContext = null if (hasCodebase !== 'none') { const exploreAgentId = spawn_agent({ message: `
目标: 通过执行分解操作,创建Issue,更新roadmap.md。
cli-roadmap-plan-agent步骤:
- 可选代码库探索(如果检测到代码库)
javascript
const hasCodebase = Bash(` test -f package.json && echo "nodejs" || test -f go.mod && echo "golang" || test -f Cargo.toml && echo "rust" || test -f pyproject.toml && echo "python" || test -d src && echo "generic" || echo "none" `).trim() let codebaseContext = null if (hasCodebase !== 'none') { const exploreAgentId = spawn_agent({ message: `
TASK ASSIGNMENT
任务分配
MANDATORY FIRST STEPS (Agent Execute)
必须执行的第一步(Agent执行)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: .workflow/project-tech.json
- Read: .workflow/project-guidelines.json
- 阅读角色定义: ~/.codex/agents/cli-explore-agent.md(必须首先阅读)
- 读取: .workflow/project-tech.json
- 读取: .workflow/project-guidelines.json
Exploration Context
探索上下文
- Requirement: ${requirement}
- Strategy: ${selectedMode}
- Project Type: ${hasCodebase}
- Session: ${sessionFolder}
- 需求: ${requirement}
- 策略: ${selectedMode}
- 项目类型: ${hasCodebase}
- 会话: ${sessionFolder}
Exploration Focus
探索重点
- Identify modules/components related to the requirement
- Find existing patterns that should be followed
- Locate integration points for new functionality
- Assess current architecture constraints
- 识别与需求相关的模块/组件
- 查找应遵循的现有模式
- 定位新功能的集成点
- 评估当前架构约束
Output
输出
Return findings as JSON with schema:
{
"project_type": "${hasCodebase}",
"relevant_modules": [{name, path, relevance}],
"existing_patterns": [{pattern, files, description}],
"integration_points": [{location, description, risk}],
"architecture_constraints": [string],
"tech_stack": {languages, frameworks, tools}
}
`
})
const exploreResult = wait({
ids: [exploreAgentId],
timeout_ms: 120000
})
close_agent({ id: exploreAgentId })
if (exploreResult.status[exploreAgentId].completed) {
codebaseContext = exploreResult.status[exploreAgentId].completed
}}
2. **Execute Decomposition Agent**
```javascript
const decompositionAgentId = spawn_agent({
message: `以JSON格式返回发现结果,schema如下:
{
"project_type": "${hasCodebase}",
"relevant_modules": [{name, path, relevance}],
"existing_patterns": [{pattern, files, description}],
"integration_points": [{location, description, risk}],
"architecture_constraints": [string],
"tech_stack": {languages, frameworks, tools}
}
`
})
const exploreResult = wait({
ids: [exploreAgentId],
timeout_ms: 120000
})
close_agent({ id: exploreAgentId })
if (exploreResult.status[exploreAgentId].completed) {
codebaseContext = exploreResult.status[exploreAgentId].completed
}}
2. **执行分解Agent**
```javascript
const decompositionAgentId = spawn_agent({
message: `TASK ASSIGNMENT
任务分配
MANDATORY FIRST STEPS (Agent Execute)
必须执行的第一步(Agent执行)
- Read role definition: ~/.codex/agents/cli-roadmap-plan-agent.md (MUST read first)
- Read: .workflow/project-tech.json
- Read: .workflow/project-guidelines.json
- 阅读角色定义: ~/.codex/agents/cli-roadmap-plan-agent.md(必须首先阅读)
- 读取: .workflow/project-tech.json
- 读取: .workflow/project-guidelines.json
Roadmap Decomposition Task
路线图分解任务
Input Context
输入上下文
- Requirement: ${requirement}
- Selected Mode: ${selectedMode}
- Session ID: ${sessionId}
- Session Folder: ${sessionFolder}
- 需求: ${requirement}
- 选择的模式: ${selectedMode}
- 会话ID: ${sessionId}
- 会话目录: ${sessionFolder}
Strategy Assessment
策略评估
${JSON.stringify(strategyAssessment, null, 2)}
${JSON.stringify(strategyAssessment, null, 2)}
Codebase Context
代码库上下文
${codebaseContext
? JSON.stringify(codebaseContext, null, 2)
: 'No codebase detected - pure requirement decomposition'}
${codebaseContext
? JSON.stringify(codebaseContext, null, 2)
: '未检测到代码库 - 纯需求分解'}
Mode-Specific Requirements
模式特定要求
${selectedMode === 'progressive' ? `Progressive Mode:
- 2-4 layers from MVP to full implementation
- Each layer: id (L0-L3), name, goal, scope, excludes, convergence, risks, effort, depends_on
- L0 (MVP) must be a self-contained closed loop with no dependencies
- Scope: each feature belongs to exactly ONE layer (no overlap)
- Layer names: MVP / Usable / Refined / Optimized` :
`Direct Mode:
- Topologically-sorted task sequence
- Each task: id (T1-Tn), title, type, scope, inputs, outputs, convergence, depends_on, parallel_group
- Inputs must come from preceding task outputs or existing resources
- Tasks in same parallel_group must be truly independent`}
${selectedMode === 'progressive' ? `Progressive模式:
- 从MVP到完整实现分为2-4层
- 每层:id(L0-L3)、名称、目标、范围、排除项、收敛条件、风险、工作量、依赖
- L0(MVP)必须是独立的闭环,无依赖
- 范围:每个功能仅属于一个层级(无重叠)
- 层级名称:MVP / 可用版 / 优化版 / 最终版` :
`Direct模式:
- 拓扑排序的任务序列
- 每个任务:id(T1-Tn)、标题、类型、范围、输入、输出、收敛条件、依赖、并行组
- 输入必须来自前置任务的输出或现有资源
- 同一并行组中的任务必须真正独立`}
Convergence Quality Requirements
收敛质量要求
- criteria[]: MUST be testable (can write assertions or manual verification steps)
- verification: MUST be executable (command, script, or explicit steps)
- definition_of_done: MUST use business language (non-technical person can judge)
- criteria[]: 必须可测试(可编写断言或手动验证步骤)
- verification: 必须可执行(命令、脚本或明确步骤)
- definition_of_done: 必须使用业务语言(非技术人员可判断)
Expected Output
预期输出
- Update ${sessionFolder}/roadmap.md with Roadmap table + Convergence sections
- Create issues via ccw issue create - append to .workflow/issues/issues.jsonl
- 更新${sessionFolder}/roadmap.md,添加路线图表格 + 收敛条件部分
- 通过ccw issue create创建Issue - 追加到.workflow/issues/issues.jsonl
Issue Format (for ccw issue create)
Issue格式(供ccw issue create使用)
- id: ISS-YYYYMMDD-NNN (auto-generated)
- title: [LayerName] goal or [TaskType] title
- context: Markdown with goal, scope, convergence criteria, verification, DoD
- priority: small→4, medium→3, large→2
- tags: ["roadmap", mode, wave-N, layer-name]
- extended_context.notes: {session, strategy, wave, depends_on_issues}
- id: ISS-YYYYMMDD-NNN(自动生成)
- title: [层级名称] 目标 或 [任务类型] 标题
- context: 包含目标、范围、收敛条件、验证方式、完成定义的Markdown
- priority: 小型→4,中型→3,大型→2
- tags: ["roadmap", mode, wave-N, layer-name]
- extended_context.notes: {session, strategy, wave, depends_on_issues}
Execution Steps
执行步骤
-
Analyze requirement and build decomposition context
-
Execute decomposition (internal reasoning)
-
Validate records, check convergence quality
-
For each decomposed item:
- Run: ccw issue create --title "..." --context "..." --tags "..." --priority N
- Record returned Issue ID
-
Update roadmap.md with Issue ID references
-
Return brief completion summary with Issue IDs ` })const decompositionResult = wait({ ids: [decompositionAgentId], timeout_ms: 300000 // 5 minutes for complex decomposition })close_agent({ id: decompositionAgentId })if (!decompositionResult.status[decompositionAgentId].completed) { throw new Error('Decomposition agent failed to complete') }const issueIds = decompositionResult.status[decompositionAgentId].completed.issueIds || []
undefined
Success Criteria:
- Issues created in
.workflow/issues/issues.jsonl - roadmap.md updated with Issue references
- No circular dependencies
- Convergence criteria testable
-
分析需求并构建分解上下文
-
执行分解(内部推理)
-
验证记录,检查收敛质量
-
对于每个分解项:
- 执行: ccw issue create --title "..." --context "..." --tags "..." --priority N
- 记录返回的Issue ID
-
更新roadmap.md,添加Issue ID引用
-
返回包含Issue ID的简要完成摘要 ` })const decompositionResult = wait({ ids: [decompositionAgentId], timeout_ms: 300000 // 复杂分解最多5分钟 })close_agent({ id: decompositionAgentId })if (!decompositionResult.status[decompositionAgentId].completed) { throw new Error('分解Agent执行失败') }const issueIds = decompositionResult.status[decompositionAgentId].completed.issueIds || []
undefined
成功标准:
- 已在中创建Issue
.workflow/issues/issues.jsonl - roadmap.md已更新Issue引用
- 无循环依赖
- 收敛条件可测试
Phase 3: Iterative Refinement
阶段3: 迭代优化
Objective: Multi-round user feedback to refine roadmap.
Steps:
-
Display Current Roadmap
- Read and display Roadmap table + key Convergence criteria
- Show issue count and wave breakdown
-
Feedback Loop (skip if AUTO_YES)javascript
let round = 0 let approved = false while (!approved && round < 5) { round++ const feedback = ASK_USER([ { id: "feedback", type: "choice", prompt: `Roadmap validation (round ${round}):\n${issueIds.length} issues across ${waveCount} waves. Feedback?`, options: [ { value: "approve", label: "Approve", description: "Proceed to handoff" }, { value: "scope", label: "Adjust Scope", description: "Modify issue scopes" }, { value: "convergence", label: "Modify Convergence", description: "Refine criteria/verification" }, { value: "replan", label: "Re-decompose", description: "Change strategy/layering" } ] } ]) // BLOCKS (wait for user response) if (feedback.feedback === 'approve') { approved = true } else { // CONSTRAINT: All modifications below ONLY touch roadmap.md and issues.jsonl // NEVER modify source code or project files during interactive rounds switch (feedback.feedback) { case 'scope': // Collect scope adjustments const scopeAdjustments = ASK_USER([ { id: "adjustments", type: "text", prompt: "Describe scope adjustments needed:" } ]) // BLOCKS // Update ONLY roadmap.md Roadmap table + Convergence sections Edit({ path: `${sessionFolder}/roadmap.md`, /* scope changes */ }) // Update ONLY issues.jsonl entries (scope/context fields) break case 'convergence': // Collect convergence refinements const convergenceRefinements = ASK_USER([ { id: "refinements", type: "text", prompt: "Describe convergence refinements needed:" } ]) // BLOCKS // Update ONLY roadmap.md Convergence Criteria section Edit({ path: `${sessionFolder}/roadmap.md`, /* convergence changes */ }) break case 'replan': // Return to Phase 2 with new strategy const newStrategy = ASK_USER([ { id: "strategy", type: "choice", prompt: "Select new decomposition strategy:", options: [ { value: "progressive", label: "Progressive" }, { value: "direct", label: "Direct" } ] } ]) // BLOCKS selectedMode = newStrategy.strategy // Re-execute Phase 2 (updates roadmap.md + issues.jsonl only) break } // Update Iteration History in roadmap.md const iterationEntry = `
目标: 通过多轮用户反馈优化路线图。
步骤:
-
展示当前路线图
- 读取并展示路线图表格 + 关键收敛条件
- 显示Issue数量和阶段划分
-
反馈循环(启用AUTO_YES则跳过)javascript
let round = 0 let approved = false while (!approved && round < 5) { round++ const feedback = ASK_USER([ { id: "feedback", type: "choice", prompt: `路线图验证(第${round}轮):\n共${issueIds.length}个Issue,分为${waveCount}个阶段。请提供反馈?`, options: [ { value: "approve", label: "批准", description: "进入交接环节" }, { value: "scope", label: "调整范围", description: "修改Issue范围" }, { value: "convergence", label: "修改收敛条件", description: "优化条件/验证方式" }, { value: "replan", label: "重新分解", description: "更改策略/层级划分" } ] } ]) // 阻塞(等待用户响应) if (feedback.feedback === 'approve') { approved = true } else { // 约束:以下所有修改仅允许修改roadmap.md和issues.jsonl // 交互轮次中绝不允许修改源代码或项目文件 switch (feedback.feedback) { case 'scope': // 收集范围调整内容 const scopeAdjustments = ASK_USER([ { id: "adjustments", type: "text", prompt: "请描述需要调整的范围:" } ]) // 阻塞 // 仅更新roadmap.md的路线图表格 + 收敛条件部分 Edit({ path: `${sessionFolder}/roadmap.md`, /* 范围修改 */ }) // 仅更新issues.jsonl中的条目(范围/上下文字段) break case 'convergence': // 收集收敛条件优化内容 const convergenceRefinements = ASK_USER([ { id: "refinements", type: "text", prompt: "请描述需要优化的收敛条件:" } ]) // 阻塞 // 仅更新roadmap.md的收敛条件部分 Edit({ path: `${sessionFolder}/roadmap.md`, /* 收敛条件修改 */ }) break case 'replan': // 返回阶段2,使用新策略 const newStrategy = ASK_USER([ { id: "strategy", type: "choice", prompt: "选择新的分解策略:", options: [ { value: "progressive", label: "Progressive" }, { value: "direct", label: "Direct" } ] } ]) // 阻塞 selectedMode = newStrategy.strategy // 重新执行阶段2(仅更新roadmap.md + issues.jsonl) break } // 更新roadmap.md中的迭代历史 const iterationEntry = `
Round ${round} - ${getUtc8ISOString()}
第${round}轮 - ${getUtc8ISOString()}
User Feedback: ${feedback.feedback}
Changes Made: ${changesMade}
Status: continue iteration
${sessionFolder}/roadmap.md## Iteration History\n${iterationEntry}`
})
}
}
Edit({ path:, old_string: "## Iteration History\n\n> To be populated during Phase 3 refinement", new_string:
3. **Finalize Iteration History**
```javascript
// Update final status in roadmap.md
Edit({
path: `${sessionFolder}/roadmap.md`,
old_string: "**Status**: Planning",
new_string: "**Status**: Ready"
})Success Criteria:
- User approved OR max rounds reached
- All changes recorded in Iteration History
- roadmap.md reflects final state
用户反馈: ${feedback.feedback}
修改内容: ${changesMade}
状态: 继续迭代
${sessionFolder}/roadmap.md## 迭代历史\n${iterationEntry}`
})
}
}
Edit({ path:, old_string: "## 迭代历史\n\n> 阶段3优化过程中填充", new_string:
3. **最终确定迭代历史**
```javascript
// 更新roadmap.md中的最终状态
Edit({
path: `${sessionFolder}/roadmap.md`,
old_string: "**状态**: 规划中",
new_string: "**状态**: 已就绪"
})成功标准:
- 用户已批准或达到最大轮次
- 所有修改已记录在迭代历史中
- roadmap.md反映最终状态
Phase 4: Handoff
阶段4: 交接
Objective: Present final roadmap, offer execution options.
Steps:
-
Display Summarymarkdown
## Roadmap Complete - **Session**: RMAP-{slug}-{date} - **Strategy**: {progressive|direct} - **Issues Created**: {count} across {waves} waves - **Roadmap**: .workflow/.roadmap/RMAP-{slug}-{date}/roadmap.md | Wave | Issue Count | Layer/Type | |------|-------------|------------| | 1 | 2 | MVP / infrastructure | | 2 | 3 | Usable / feature | -
Offer Options (skip if AUTO_YES)javascript
let nextStep if (AUTO_YES) { nextStep = "done" // Default to done in auto mode } else { const answer = ASK_USER([ { id: "next", type: "choice", prompt: `${issueIds.length} issues ready. Next step:`, options: [ { value: "planex", label: "Execute with team-planex (Recommended)", description: `Run all ${issueIds.length} issues via team-planex` }, { value: "wave1", label: "Execute first wave", description: "Run wave-1 issues only" }, { value: "view", label: "View issues", description: "Display issue details" }, { value: "done", label: "Done", description: "Save and exit" } ] } ]) // BLOCKS (wait for user response) nextStep = answer.next } -
Execute Selectionjavascript
switch (nextStep) { case 'planex': // Launch team-planex with all issue IDs Bash(`ccw skill team-planex ${issueIds.join(' ')}`) break case 'wave1': // Filter issues by wave-1 tag Bash(`ccw skill team-planex --tag wave-1 --session ${sessionId}`) break case 'view': // Display issues from issues.jsonl Bash(`ccw issue list --session ${sessionId}`) break case 'done': // Output paths and end console.log([ `Roadmap saved: ${sessionFolder}/roadmap.md`, `Issues created: ${issueIds.length}`, '', 'To execute later:', ` $team-planex ${issueIds.slice(0, 3).join(' ')}...`, ` ccw issue list --session ${sessionId}` ].join('\n')) break }
Success Criteria:
- User selection executed
- Session complete
- All artifacts accessible
目标: 展示最终路线图,提供执行选项。
步骤:
-
展示摘要markdown
## 路线图已完成 - **会话**: RMAP-{slug}-{date} - **策略**: {progressive|direct} - **已创建Issue**: {count}个,分为{waves}个阶段 - **路线图**: .workflow/.roadmap/RMAP-{slug}-{date}/roadmap.md | 阶段 | Issue数量 | 层级/类型 | |------|-------------|------------| | 1 | 2 | MVP / 基础设施 | | 2 | 3 | 可用版 / 功能特性 | -
提供选项(启用AUTO_YES则跳过)javascript
let nextStep if (AUTO_YES) { nextStep = "done" // 自动模式下默认完成 } else { const answer = ASK_USER([ { id: "next", type: "choice", prompt: `${issueIds.length}个Issue已准备好。下一步:`, options: [ { value: "planex", label: "通过team-planex执行(推荐)", description: `通过team-planex运行全部${issueIds.length}个Issue` }, { value: "wave1", label: "执行第一阶段", description: "仅运行第一阶段的Issue" }, { value: "view", label: "查看Issue", description: "显示Issue详情" }, { value: "done", label: "完成", description: "保存并退出" } ] } ]) // 阻塞(等待用户响应) nextStep = answer.next } -
执行选择的操作javascript
switch (nextStep) { case 'planex': // 启动team-planex,传入所有Issue ID Bash(`ccw skill team-planex ${issueIds.join(' ')}`) break case 'wave1': // 按wave-1标签过滤Issue Bash(`ccw skill team-planex --tag wave-1 --session ${sessionId}`) break case 'view': // 从issues.jsonl中显示Issue Bash(`ccw issue list --session ${sessionId}`) break case 'done': // 输出路径并结束 console.log([ `路线图已保存: ${sessionFolder}/roadmap.md`, `已创建Issue: ${issueIds.length}个`, '', '后续执行命令:', ` $team-planex ${issueIds.slice(0, 3).join(' ')}...`, ` ccw issue list --session ${sessionId}` ].join('\n')) break }
成功标准:
- 已执行用户选择的操作
- 会话已完成
- 所有工件可访问
Error Handling
错误处理
| Error | Resolution |
|---|---|
| cli-explore-agent fails | Skip code exploration, proceed with pure requirement decomposition |
| cli-roadmap-plan-agent fails | Retry once, fallback to manual decomposition prompt |
| No codebase | Normal flow, skip exploration step |
| Circular dependency detected | Prompt user, re-decompose |
| User timeout in feedback loop | Save roadmap.md, show |
| Max rounds reached | Force proceed with current roadmap |
| Session folder conflict | Append timestamp suffix |
| 错误 | 解决方法 |
|---|---|
| cli-explore-agent执行失败 | 跳过代码探索,继续纯需求分解 |
| cli-roadmap-plan-agent执行失败 | 重试一次,若失败则回退到手动分解提示 |
| 无代码库 | 正常流程,跳过探索步骤 |
| 检测到循环依赖 | 提示用户,重新分解 |
| 反馈循环中用户超时 | 保存roadmap.md,显示 |
| 达到最大轮次 | 强制使用当前路线图继续 |
| 会话目录冲突 | 追加时间戳后缀 |
Core Rules
核心规则
- Start Immediately: First action is session initialization, then Phase 1 execution
- Single Source: All context embedded in roadmap.md, no separate JSON files
- Iterate on Roadmap: Use feedback rounds to refine, not recreate
- Testable Convergence: criteria = assertions, DoD = business language
- Explicit Lifecycle: Always close_agent after wait completes to free resources
- DO NOT STOP: Continuous workflow until handoff complete
- Plan-Only Modifications: Interactive feedback (Phase 3) MUST only update and
roadmap.md. NEVER modify source code, configuration files, or any project files during interactive rounds. Code changes happen only after handoff (Phase 4) via team-planex or other execution skillsissues.jsonl
- 立即启动: 第一个操作是会话初始化,然后执行阶段1
- 单一数据源: 所有上下文嵌入到roadmap.md中,无单独JSON文件
- 迭代优化路线图: 使用反馈轮次优化,而非重新创建
- 可测试的收敛条件: criteria = 断言,完成定义 = 业务语言
- 明确生命周期: wait完成后必须调用close_agent以释放资源
- 不要停止: 持续执行工作流直至交接完成
- 仅修改计划: 交互反馈(阶段3)仅允许更新和
roadmap.md。交互轮次中绝不允许修改源代码、配置文件或任何项目文件。代码修改仅在交接后(阶段4)通过team-planex或其他执行Skill进行issues.jsonl
Best Practices
最佳实践
- Clear Requirements: Detailed description → better decomposition
- Iterate on Roadmap: Use feedback rounds to refine convergence criteria
- Testable Convergence: criteria = assertions, DoD = business language
- Use Continue Mode: Resume to iterate on existing roadmap
- Wave Execution: Start with wave-1 (MVP) to validate before full execution
- 清晰的需求: 详细的描述 → 更好的分解结果
- 迭代优化路线图: 使用反馈轮次优化收敛条件
- 可测试的收敛条件: criteria = 断言,完成定义 = 业务语言
- 使用继续模式: 恢复现有会话以迭代优化路线图
- 分阶段执行: 先执行第一阶段(MVP),验证后再全面执行
Usage Recommendations
使用建议
When to Use Roadmap vs Other Skills:
| Scenario | Recommended Skill |
|---|---|
| Strategic planning, need issue tracking | |
| Quick task breakdown, immediate execution | |
| Collaborative multi-agent planning | |
| Full specification documents | |
| Code implementation from existing plan | |
Now execute roadmap-with-file for: $ARGUMENTS
何时使用Roadmap工具 vs 其他Skill:
| 场景 | 推荐Skill |
|---|---|
| 战略规划、需要Issue追踪 | |
| 快速任务分解、立即执行 | |
| 多Agent协作规划 | |
| 完整规格文档生成 | |
| 根据现有计划实现代码 | |
现在为以下内容执行roadmap-with-file: $ARGUMENTS