issue-discover

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Issue Discover

Issue Discover

Unified issue discovery and creation skill covering three entry points: manual issue creation, perspective-based discovery, and prompt-driven exploration.
一款统一的问题发现与创建工具,包含三个入口:手动创建问题、多视角发现问题以及提示词驱动的探索。

Architecture Overview

架构概述

┌─────────────────────────────────────────────────────────────────┐
│  Issue Discover Orchestrator (SKILL.md)                          │
│  → Action selection → Route to phase → Execute → Summary         │
└───────────────┬─────────────────────────────────────────────────┘
                ├─ ASK_USER: Select action
    ┌───────────┼───────────┬───────────┐
    ↓           ↓           ↓           │
┌─────────┐ ┌─────────┐ ┌─────────┐   │
│ Phase 1 │ │ Phase 2 │ │ Phase 3 │   │
│  Create │ │Discover │ │Discover │   │
│   New   │ │  Multi  │ │by Prompt│   │
└─────────┘ └─────────┘ └─────────┘   │
     ↓           ↓           ↓          │
  Issue      Discoveries  Discoveries   │
(registered)  (export)    (export)      │
     │           │           │          │
     │           ├───────────┤          │
     │           ↓                      │
     │     ┌───────────┐               │
     │     │  Phase 4  │               │
     │     │Quick Plan │               │
     │     │& Execute  │               │
     │     └─────┬─────┘               │
     │           ↓                      │
     │     .task/*.json                 │
     │           ↓                      │
     │     Direct Execution             │
     │           │                      │
     └───────────┴──────────────────────┘
                  ↓ (fallback/remaining)
          issue-resolve (plan/queue)
            /issue:execute
┌─────────────────────────────────────────────────────────────────┐
│  Issue Discover Orchestrator (SKILL.md)                          │
│  → 选择操作 → 路由至对应阶段 → 执行 → 总结         │
└───────────────┬─────────────────────────────────────────────────┘
                ├─ ASK_USER: 选择操作
    ┌───────────┼───────────┬───────────┐
    ↓           ↓           ↓           │
┌─────────┐ ┌─────────┐ ┌─────────┐   │
│ 阶段1 │ │ 阶段2 │ │ 阶段3 │   │
│  创建新问题  │ │ 多视角发现 │ │ 提示词驱动发现 │   │
└─────────┘ └─────────┘ └─────────┘   │
     ↓           ↓           ↓          │
  已注册的问题      可导出的发现结果  可导出的发现结果   │
     │           │           │          │
     │           ├───────────┤          │
     │           ↓                      │
     │     ┌───────────┐               │
     │     │  阶段4  │               │
     │     │快速规划与执行 │               │
     │     └─────┬─────┘               │
     │           ↓                      │
     │     .task/*.json                 │
     │           ↓                      │
     │     直接执行             │
     │           │                      │
     └───────────┴──────────────────────┘
                  ↓ (回退/剩余任务)
          issue-resolve (规划/排队)
            /issue:execute

Key Design Principles

核心设计原则

  1. Action-Driven Routing: ASK_USER selects action, then load single phase
  2. Progressive Phase Loading: Only read the selected phase document
  3. CLI-First Data Access: All issue CRUD via
    ccw issue
    CLI commands
  4. Auto Mode Support:
    -y
    flag skips action selection with auto-detection
  5. Subagent Lifecycle: Explicit lifecycle management with spawn_agent → wait → close_agent
  6. Role Path Loading: Subagent roles loaded via path reference in MANDATORY FIRST STEPS
  1. 操作驱动路由:通过ASK_USER选择操作,然后加载单个阶段
  2. 渐进式阶段加载:仅读取所选阶段的文档
  3. CLI优先的数据访问:所有问题的增删改查(CRUD)均通过
    ccw issue
    CLI命令完成
  4. 支持自动模式
    -y
    标志可跳过操作选择,启用自动检测
  5. 子代理生命周期:通过spawn_agent → wait → close_agent实现明确的生命周期管理
  6. 角色路径加载:子代理角色通过MANDATORY FIRST STEPS中的路径引用加载

Auto Mode

自动模式

When
--yes
or
-y
: Skip action selection, auto-detect action from input type.
当使用
--yes
-y
参数时:跳过操作选择,根据输入类型自动检测操作。

Usage

使用方法

issue-discover <input>
issue-discover [FLAGS] "<input>"
issue-discover <input>
issue-discover [FLAGS] "<input>"

Flags

标志

-y, --yes Skip all confirmations (auto mode) --action <type> Pre-select action: new|discover|discover-by-prompt
-y, --yes 跳过所有确认(自动模式) --action <type> 预先选择操作类型:new|discover|discover-by-prompt

Phase-specific flags

阶段专属标志

--priority <1-5> Issue priority (new mode) --perspectives <list> Comma-separated perspectives (discover mode) --external Enable Exa research (discover mode) --scope <pattern> File scope (discover/discover-by-prompt mode) --depth <level> standard|deep (discover-by-prompt mode) --max-iterations <n> Max exploration iterations (discover-by-prompt mode)
--priority <1-5> 问题优先级(创建新问题模式) --perspectives <list> 逗号分隔的视角列表(发现模式) --external 启用Exa调研(发现模式) --scope <pattern> 文件范围(发现/提示词驱动发现模式) --depth <level> standard|deep(提示词驱动发现模式) --max-iterations <n> 最大探索迭代次数(提示词驱动发现模式)

Examples

示例

issue-discover https://github.com/org/repo/issues/42 # Create from GitHub issue-discover "Login fails with special chars" # Create from text issue-discover --action discover src/auth/** # Multi-perspective discovery issue-discover --action discover src/api/** --perspectives=security,bug # Focused discovery issue-discover --action discover-by-prompt "Check API contracts" # Prompt-driven discovery issue-discover -y "auth broken" # Auto mode create
undefined
issue-discover https://github.com/org/repo/issues/42 # 从GitHub创建问题 issue-discover "登录时输入特殊字符失败" # 从文本创建问题 issue-discover --action discover src/auth/** # 多视角发现问题 issue-discover --action discover src/api/** --perspectives=security,bug # 定向发现问题 issue-discover --action discover-by-prompt "检查API契约" # 提示词驱动的问题发现 issue-discover -y "认证功能异常" # 自动模式创建问题
undefined

Execution Flow

执行流程

Input Parsing:
   └─ Parse flags (--action, -y, --perspectives, etc.) and positional args

Action Selection:
   ├─ --action flag provided → Route directly
   ├─ Auto-detect from input:
   │   ├─ GitHub URL or #number → Create New (Phase 1)
   │   ├─ Path pattern (src/**, *.ts) → Discover (Phase 2)
   │   ├─ Short text (< 80 chars) → Create New (Phase 1)
   │   └─ Long descriptive text (≥ 80 chars) → Discover by Prompt (Phase 3)
   └─ Otherwise → ASK_USER to select action

Phase Execution (load one phase):
   ├─ Phase 1: Create New          → phases/01-issue-new.md
   ├─ Phase 2: Discover            → phases/02-discover.md
   └─ Phase 3: Discover by Prompt  → phases/03-discover-by-prompt.md

Post-Phase:
   └─ Summary + Next steps recommendation
输入解析:
   └─ 解析标志(--action、-y、--perspectives等)和位置参数

操作选择:
   ├─ 若提供--action标志 → 直接路由至对应阶段
   ├─ 根据输入自动检测:
   │   ├─ GitHub链接或#数字 → 创建新问题(阶段1)
   │   ├─ 路径模式(src/**、*.ts) → 多视角发现(阶段2)
   │   ├─ 短文本(<80字符) → 创建新问题(阶段1)
   │   └─ 长描述文本(≥80字符) → 提示词驱动发现(阶段3)
   └─ 否则 → 调用ASK_USER让用户选择操作

阶段执行(加载单个阶段):
   ├─ 阶段1:创建新问题          → phases/01-issue-new.md
   ├─ 阶段2:多视角发现            → phases/02-discover.md
   └─ 阶段3:提示词驱动发现  → phases/03-discover-by-prompt.md

阶段后处理:
   └─ 总结 + 下一步操作建议

Phase Reference Documents

阶段参考文档

PhaseDocumentLoad WhenPurpose
Phase 1phases/01-issue-new.mdAction = Create NewCreate issue from GitHub URL or text description
Phase 2phases/02-discover.mdAction = DiscoverMulti-perspective issue discovery (bug, security, test, etc.)
Phase 3phases/03-discover-by-prompt.mdAction = Discover by PromptPrompt-driven iterative exploration with Gemini planning
Phase 4phases/04-quick-execute.mdPost-Phase = Quick Plan & ExecuteConvert high-confidence findings to tasks and execute directly
阶段文档加载时机用途
阶段1phases/01-issue-new.md操作 = 创建新问题从GitHub链接或文本描述创建问题
阶段2phases/02-discover.md操作 = 多视角发现多视角问题发现(漏洞、安全、测试等)
阶段3phases/03-discover-by-prompt.md操作 = 提示词驱动发现借助Gemini进行提示词驱动的迭代探索
阶段4phases/04-quick-execute.md阶段后处理 = 快速规划与执行将高可信度的发现结果转换为任务并直接执行

Core Rules

核心规则

  1. Action Selection First: Always determine action before loading any phase
  2. Single Phase Load: Only read the selected phase document, never load all phases
  3. CLI Data Access: Use
    ccw issue
    CLI for all issue operations, NEVER read files directly
  4. Content Preservation: Each phase contains complete execution logic from original commands
  5. Auto-Detect Input: Smart input parsing reduces need for explicit --action flag
  6. ⚠️ CRITICAL: DO NOT STOP: Continuous multi-phase workflow. After completing each phase, immediately proceed to next
  7. Progressive Phase Loading: Read phase docs ONLY when that phase is about to execute
  8. Explicit Lifecycle: Always close_agent after wait completes to free resources
  1. 先选择操作:在加载任何阶段之前,必须先确定操作类型
  2. 仅加载单个阶段:仅读取所选阶段的文档,绝不加载所有阶段
  3. CLI数据访问:所有问题操作均使用
    ccw issue
    CLI命令,绝不直接读取文件
  4. 内容保留:每个阶段包含原始命令的完整执行逻辑
  5. 自动检测输入:智能输入解析减少对显式--action标志的需求
  6. ⚠️ 重要:请勿中断:持续的多阶段工作流。完成每个阶段后,立即进入下一阶段
  7. 渐进式阶段加载:仅当即将执行该阶段时才读取阶段文档
  8. 明确的生命周期:在wait完成后必须调用close_agent以释放资源

Input Processing

输入处理

Auto-Detection Logic

自动检测逻辑

javascript
function detectAction(input, flags) {
  // 1. Explicit --action flag
  if (flags.action) return flags.action;

  const trimmed = input.trim();

  // 2. GitHub URL → new
  if (trimmed.match(/github\.com\/[\w-]+\/[\w-]+\/issues\/\d+/) || trimmed.match(/^#\d+$/)) {
    return 'new';
  }

  // 3. Path pattern (contains **, /, or --perspectives) → discover
  if (trimmed.match(/\*\*/) || trimmed.match(/^src\//) || flags.perspectives) {
    return 'discover';
  }

  // 4. Short text (< 80 chars, no special patterns) → new
  if (trimmed.length > 0 && trimmed.length < 80 && !trimmed.includes('--')) {
    return 'new';
  }

  // 5. Long descriptive text → discover-by-prompt
  if (trimmed.length >= 80) {
    return 'discover-by-prompt';
  }

  // Cannot auto-detect → ask user
  return null;
}
javascript
function detectAction(input, flags) {
  // 1. Explicit --action flag
  if (flags.action) return flags.action;

  const trimmed = input.trim();

  // 2. GitHub URL → new
  if (trimmed.match(/github\.com\/[\w-]+\/[\w-]+\/issues\/\d+/) || trimmed.match(/^#\d+$/)) {
    return 'new';
  }

  // 3. Path pattern (contains **, /, or --perspectives) → discover
  if (trimmed.match(/\*\*/) || trimmed.match(/^src\//) || flags.perspectives) {
    return 'discover';
  }

  // 4. Short text (< 80 chars, no special patterns) → new
  if (trimmed.length > 0 && trimmed.length < 80 && !trimmed.includes('--')) {
    return 'new';
  }

  // 5. Long descriptive text → discover-by-prompt
  if (trimmed.length >= 80) {
    return 'discover-by-prompt';
  }

  // Cannot auto-detect → ask user
  return null;
}

Action Selection (ASK_USER)

操作选择(ASK_USER)

javascript
// When action cannot be auto-detected
const answer = ASK_USER([{
  id: "action",
  type: "select",
  prompt: "What would you like to do?",
  options: [
    {
      label: "Create New Issue (Recommended)",
      description: "Create issue from GitHub URL, text description, or structured input"
    },
    {
      label: "Discover Issues",
      description: "Multi-perspective discovery: bug, security, test, quality, performance, etc."
    },
    {
      label: "Discover by Prompt",
      description: "Describe what to find — Gemini plans the exploration strategy iteratively"
    }
  ]
}]);  // BLOCKS (wait for user response)

// Route based on selection
const actionMap = {
  "Create New Issue": "new",
  "Discover Issues": "discover",
  "Discover by Prompt": "discover-by-prompt"
};
javascript
// When action cannot be auto-detected
const answer = ASK_USER([{
  id: "action",
  type: "select",
  prompt: "What would you like to do?",
  options: [
    {
      label: "Create New Issue (Recommended)",
      description: "Create issue from GitHub URL, text description, or structured input"
    },
    {
      label: "Discover Issues",
      description: "Multi-perspective discovery: bug, security, test, quality, performance, etc."
    },
    {
      label: "Discover by Prompt",
      description: "Describe what to find — Gemini plans the exploration strategy iteratively"
    }
  ]
}]);  // BLOCKS (wait for user response)

// Route based on selection
const actionMap = {
  "Create New Issue": "new",
  "Discover Issues": "discover",
  "Discover by Prompt": "discover-by-prompt"
};

Data Flow

数据流

User Input (URL / text / path pattern / descriptive prompt)
[Parse Flags + Auto-Detect Action]
[Action Selection] ← ASK_USER (if needed)
[Read Selected Phase Document]
[Execute Phase Logic]
[Summary + Next Steps]
    ├─ After Create → Suggest issue-resolve (plan solution)
    └─ After Discover → Suggest export to issues, then issue-resolve
用户输入(链接/文本/路径模式/描述性提示词)
[解析标志 + 自动检测操作]
[操作选择] ← 若需要则调用ASK_USER
[读取所选阶段的文档]
[执行阶段逻辑]
[总结 + 下一步操作建议]
    ├─ 创建问题后 → 建议使用issue-resolve(规划解决方案)
    └─ 发现问题后 → 建议导出为问题,然后使用issue-resolve

Subagent API Reference

子代理API参考

spawn_agent

spawn_agent

Create a new subagent with task assignment.
javascript
const agentId = spawn_agent({
  message: `
创建一个分配了任务的新子代理。
javascript
const agentId = spawn_agent({
  message: `

TASK ASSIGNMENT

TASK ASSIGNMENT

MANDATORY FIRST STEPS (Agent Execute)

MANDATORY FIRST STEPS (Agent Execute)

  1. Read role definition: ~/.codex/agents/{agent-type}.md (MUST read first)
  2. Execute: ccw spec load --category exploration
  1. Read role definition: ~/.codex/agents/{agent-type}.md (MUST read first)
  2. Execute: ccw spec load --category exploration

TASK CONTEXT

TASK CONTEXT

${taskContext}
${taskContext}

DELIVERABLES

DELIVERABLES

${deliverables} ` })
undefined
${deliverables} ` })
undefined

wait

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
}

// Check completion status
if (result.status[agentId].completed) {
  const output = result.status[agentId].completed;
}
获取子代理的执行结果(唯一的结果获取方式)。
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
}

// Check completion status
if (result.status[agentId].completed) {
  const output = result.status[agentId].completed;
}

send_input

send_input

Continue interaction with active subagent (for clarification or follow-up).
javascript
send_input({
  id: agentId,
  message: `
与活跃的子代理继续交互(用于澄清或后续操作)。
javascript
send_input({
  id: agentId,
  message: `

CLARIFICATION ANSWERS

CLARIFICATION ANSWERS

${answers}
${answers}

NEXT STEP

NEXT STEP

Continue with plan generation. ` })
undefined
Continue with plan generation. ` })
undefined

close_agent

close_agent

Clean up subagent resources (irreversible).
javascript
close_agent({ id: agentId })
清理子代理资源(不可逆操作)。
javascript
close_agent({ id: agentId })

Core Guidelines

核心指南

Data Access Principle: Issues files can grow very large. To avoid context overflow:
OperationCorrectIncorrect
List issues (brief)
ccw issue list --status pending --brief
Read('issues.jsonl')
Read issue details
ccw issue status <id> --json
Read('issues.jsonl')
Create issue
echo '...' | ccw issue create
Direct file write
Update status
ccw issue update <id> --status ...
Direct file edit
ALWAYS use CLI commands for CRUD operations. NEVER read entire
issues.jsonl
directly.
数据访问原则:问题文件可能会变得非常大。为避免上下文溢出:
操作正确方式错误方式
列出问题(简洁模式)
ccw issue list --status pending --brief
Read('issues.jsonl')
读取问题详情
ccw issue status <id> --json
Read('issues.jsonl')
创建问题
echo '...' | ccw issue create
直接写入文件
更新状态
ccw issue update <id> --status ...
直接编辑文件
必须使用CLI命令进行增删改查(CRUD)操作。绝不直接读取整个
issues.jsonl
文件。

Error Handling

错误处理

ErrorResolution
No action detectedShow ASK_USER with all 3 options
Invalid action typeShow available actions, re-prompt
Phase execution failsReport error, suggest manual intervention
No files matched (discover)Check target pattern, verify path exists
Gemini planning failed (discover-by-prompt)Retry with qwen fallback
Agent lifecycle errorsEnsure close_agent in error paths to prevent resource leaks
错误类型解决方法
无法检测操作类型显示ASK_USER界面,提供全部3个选项
无效的操作类型显示可用操作,重新提示用户选择
阶段执行失败报告错误,建议手动干预
未匹配到任何文件(发现模式)检查目标模式,验证路径是否存在
Gemini规划失败(提示词驱动发现)使用qwen作为回退方案重试
子代理生命周期错误确保在错误路径中调用close_agent以防止资源泄漏

Post-Phase Next Steps

阶段后下一步操作建议

After successful phase execution, recommend next action:
javascript
// After Create New (issue created)
ASK_USER([{
  id: "next_after_create",
  type: "select",
  prompt: "Issue created. What next?",
  options: [
    { label: "Plan Solution", description: "Generate solution via issue-resolve" },
    { label: "Create Another", description: "Create more issues" },
    { label: "View Issues", description: "Review all issues" },
    { label: "Done", description: "Exit workflow" }
  ]
}]);  // BLOCKS (wait for user response)

// After Discover / Discover by Prompt (discoveries generated)
ASK_USER([{
  id: "next_after_discover",
  type: "select",
  prompt: `Discovery complete: ${findings.length} findings, ${executableFindings.length} executable. What next?`,
  options: [
    { label: "Quick Plan & Execute (Recommended)", description: `Fix ${executableFindings.length} high-confidence findings directly` },
    { label: "Export to Issues", description: "Convert discoveries to issues" },
    { label: "Plan Solutions", description: "Plan solutions for exported issues via issue-resolve" },
    { label: "Done", description: "Exit workflow" }
  ]
}]);  // BLOCKS (wait for user response)
// If "Quick Plan & Execute" → Read phases/04-quick-execute.md, execute
成功执行阶段后,推荐以下操作:
javascript
// After Create New (issue created)
ASK_USER([{
  id: "next_after_create",
  type: "select",
  prompt: "Issue created. What next?",
  options: [
    { label: "Plan Solution", description: "Generate solution via issue-resolve" },
    { label: "Create Another", description: "Create more issues" },
    { label: "View Issues", description: "Review all issues" },
    { label: "Done", description: "Exit workflow" }
  ]
}]);  // BLOCKS (wait for user response)

// After Discover / Discover by Prompt (discoveries generated)
ASK_USER([{
  id: "next_after_discover",
  type: "select",
  prompt: `Discovery complete: ${findings.length} findings, ${executableFindings.length} executable. What next?`,
  options: [
    { label: "Quick Plan & Execute (Recommended)", description: `Fix ${executableFindings.length} high-confidence findings directly` },
    { label: "Export to Issues", description: "Convert discoveries to issues" },
    { label: "Plan Solutions", description: "Plan solutions for exported issues via issue-resolve" },
    { label: "Done", description: "Exit workflow" }
  ]
}]);  // BLOCKS (wait for user response)
// If "Quick Plan & Execute" → Read phases/04-quick-execute.md, execute

Related Skills & Commands

相关技能与命令

  • issue-resolve
    - Plan solutions, convert artifacts, form queues, from brainstorm
  • issue-manage
    - Interactive issue CRUD operations
  • /issue:execute
    - Execute queue with DAG-based parallel orchestration
  • ccw issue list
    - List all issues
  • ccw issue status <id>
    - View issue details
  • issue-resolve
    - 通过头脑风暴规划解决方案、转换工件、形成任务队列
  • issue-manage
    - 交互式问题增删改查操作
  • /issue:execute
    - 基于DAG的并行编排执行任务队列
  • ccw issue list
    - 列出所有问题
  • ccw issue status <id>
    - 查看问题详情