Refactor architecture optimization and issue resolution workflows

- Enhanced multi-perspective discussion capabilities in discuss-subagent for architecture optimization, integrating CLI tools for structured analysis and recommendations.
- Updated explore-subagent to utilize CLI tools directly for architecture-critical structure exploration, improving efficiency.
- Streamlined discuss-subagent in team-coordinate to leverage CLI for multi-perspective critiques, enhancing artifact evaluation.
- Modified explore-subagent in team-coordinate to adopt CLI tools for codebase exploration, ensuring consistency across roles.
- Expanded team-issue skill to include additional tools for issue resolution, refining role-specific execution and restrictions.
- Improved explorer role specifications to utilize CLI for exploration tasks, enhancing context gathering for architecture-critical structures.
- Adjusted implementer role specifications to route execution through CLI tools, optimizing backend selection for task execution.
- Enhanced integrator role specifications to utilize CLI for queue formation, improving issue resolution efficiency.
- Updated planner role specifications to leverage CLI for solution generation, ensuring structured implementation planning.
- Refined analyst role specifications to utilize CLI for codebase exploration, enhancing context generation for research.
- Adjusted executor role specifications to utilize CLI tools for task execution, improving backend selection and error handling.
- Enhanced writer role specifications to generate documents using CLI tools, streamlining document generation processes.
- Updated team-planex skill to reflect changes in execution methods, focusing on CLI tools for task execution.
- Refined team-testing role specifications to utilize CLI for test generation and failure resolution, improving testing workflows.
- Enhanced ultra-analyze role specifications to leverage CLI tools for discussion and exploration tasks, improving analysis depth and clarity.
This commit is contained in:
catlog22
2026-03-04 23:19:36 +08:00
parent 16bbfcd12a
commit fd847070d5
22 changed files with 274 additions and 349 deletions

View File

@@ -49,7 +49,7 @@ Parse the following fields from your prompt:
- `prefix`: Task prefix to filter (e.g., `RESEARCH`, `DRAFT`, `IMPL`) - `prefix`: Task prefix to filter (e.g., `RESEARCH`, `DRAFT`, `IMPL`)
- `inner_loop`: Override from frontmatter if present - `inner_loop`: Override from frontmatter if present
- `discuss_rounds`: Array of discuss round IDs this role handles - `discuss_rounds`: Array of discuss round IDs this role handles
- `subagents`: Array of subagent types this role may call - `subagents`: (DEPRECATED - team workers cannot call subagents) Array for documentation only
- `message_types`: Success/error/fix message type mappings - `message_types`: Success/error/fix message type mappings
3. Parse **body** (content after frontmatter) to get Phase 2-4 execution instructions 3. Parse **body** (content after frontmatter) to get Phase 2-4 execution instructions
4. Store parsed metadata and instructions for use in execution phases 4. Store parsed metadata and instructions for use in execution phases
@@ -74,7 +74,7 @@ Entry:
inner_loop=false OR no more tasks? → Phase 5-F → STOP inner_loop=false OR no more tasks? → Phase 5-F → STOP
``` ```
**Inner loop** (`inner_loop=true`): Processes ALL same-prefix tasks sequentially in a single agent instance. `context_accumulator` is passed to each subsequent subagent as `## Prior Context` for knowledge continuity. **Inner loop** (`inner_loop=true`): Processes ALL same-prefix tasks sequentially in a single agent instance. `context_accumulator` maintains context across task iterations for knowledge continuity.
| Step | Phase 5-L (loop) | Phase 5-F (final) | | Step | Phase 5-L (loop) | Phase 5-F (final) |
|------|-----------------|------------------| |------|-----------------|------------------|
@@ -123,107 +123,42 @@ After claiming a task, check if output artifacts already exist (indicates resume
The role_spec contains Phase 2, Phase 3, and Phase 4 sections with domain-specific logic. Follow those instructions exactly. Key integration points with built-in infrastructure: The role_spec contains Phase 2, Phase 3, and Phase 4 sections with domain-specific logic. Follow those instructions exactly. Key integration points with built-in infrastructure:
### Subagent Delegation ## CRITICAL LIMITATION: No Subagent Delegation
When role_spec instructs to call a subagent, use these templates: **Team workers CANNOT call the Agent() tool to spawn subagents.**
**Discuss subagent** (for inline discuss rounds): Test evidence shows that team members spawned via Agent tool do not have access to the Agent tool themselves. Only the coordinator (main conversation context) can spawn agents.
### Alternatives for Team Workers
When role-spec instructions require analysis or exploration:
**Option A: CLI Tools** (Recommended)
```javascript
Bash(`ccw cli -p "..." --tool gemini --mode analysis`, { run_in_background: false })
``` ```
Agent({
subagent_type: "cli-discuss-agent",
run_in_background: false,
description: "Discuss <round-id>",
prompt: `## Multi-Perspective Critique: <round-id>
### Input **Option B: Direct Tools**
- Artifact: <artifact-path> Use Read, Grep, Glob, mcp__ace-tool__search_context directly.
- Round: <round-id>
- Perspectives: <perspective-list-from-role-spec>
- Session: <session-folder>
- Discovery Context: <session-folder>/spec/discovery-context.json
### Perspective Routing **Option C: Request Coordinator Help**
Send message to coordinator requesting subagent delegation:
| Perspective | CLI Tool | Role | Focus Areas | ```javascript
|-------------|----------|------|-------------| mcp__ccw-tools__team_msg({
| Product | gemini | Product Manager | Market fit, user value, business viability | operation: "log",
| Technical | codex | Tech Lead | Feasibility, tech debt, performance, security | session_id: sessionId,
| Quality | claude | QA Lead | Completeness, testability, consistency | from: role,
| Risk | gemini | Risk Analyst | Risk identification, dependencies, failure modes | to: "coordinator",
| Coverage | gemini | Requirements Analyst | Requirement completeness vs discovery-context | type: "subagent_request",
summary: "Request exploration subagent for X",
### Execution Steps data: { reason: "...", scope: "..." }
1. Read artifact from <artifact-path>
2. For each perspective, launch CLI analysis in background
3. Wait for all CLI results
4. Divergence detection + consensus determination
5. Synthesize convergent/divergent themes + action items
6. Write discussion record to: <session-folder>/discussions/<round-id>-discussion.md
### Return Value
JSON with: verdict (consensus_reached|consensus_blocked), severity (HIGH|MEDIUM|LOW), average_rating, divergences, action_items, recommendation, discussion_path`
})
```
**Explore subagent** (for codebase exploration):
```
Agent({
subagent_type: "cli-explore-agent",
run_in_background: false,
description: "Explore <angle>",
prompt: `Explore codebase for: <query>
Focus angle: <angle>
Keywords: <keyword-list>
Session folder: <session-folder>
## Cache Check
1. Read <session-folder>/explorations/cache-index.json (if exists)
2. Look for entry with matching angle
3. If found AND file exists -> read cached result, return summary
4. If not found -> proceed to exploration
## Output
Write JSON to: <session-folder>/explorations/explore-<angle>.json
Update cache-index.json with new entry
Return summary: file count, pattern count, top 5 files, output path`
})
```
**Doc-generation subagent** (for writer document generation):
```
Agent({
subagent_type: "universal-executor",
run_in_background: false,
description: "Generate <doc-type>",
prompt: `## Document Generation: <doc-type>
### Session
- Folder: <session-folder>
- Spec config: <spec-config-path>
### Document Config
- Type: <doc-type>
- Template: <template-path>
- Output: <output-path>
- Prior discussion: <discussion-file or "none">
### Writer Accumulator (prior decisions)
<JSON array of prior task summaries from context_accumulator>
### Output Requirements
1. Write document to <output-path>
2. Return JSON: { artifact_path, summary, key_decisions[], sections_generated[], warnings[] }`
}) })
SendMessage({ recipient: "coordinator", content: "..." })
``` ```
### Consensus Handling ### Consensus Handling
After a discuss subagent returns, handle the verdict: When role-spec instructions require consensus/discussion, handle the verdict:
| Verdict | Severity | Action | | Verdict | Severity | Action |
|---------|----------|--------| |---------|----------|--------|
@@ -374,7 +309,7 @@ After Phase 4 verification, the worker MUST publish its contributions:
1. **Artifact**: Write deliverable to `<session>/artifacts/<prefix>-<task-id>-<name>.md` 1. **Artifact**: Write deliverable to `<session>/artifacts/<prefix>-<task-id>-<name>.md`
2. **State data**: Prepare payload for Phase 5 `state_update` message (see Phase 5-L step 2 for schema) 2. **State data**: Prepare payload for Phase 5 `state_update` message (see Phase 5-L step 2 for schema)
3. **Wisdom**: Append new patterns to `learnings.md`, decisions to `decisions.md`, issues to `issues.md` 3. **Wisdom**: Append new patterns to `learnings.md`, decisions to `decisions.md`, issues to `issues.md`
4. **Context accumulator** (inner_loop only): Append summary (see Phase 5-L step 3 for schema). Pass full accumulator to subsequent subagents as `## Prior Context`. 4. **Context accumulator** (inner_loop only): Append summary (see Phase 5-L step 3 for schema). Maintain full accumulator for context continuity across iterations.
### Wisdom Files ### Wisdom Files
@@ -444,7 +379,7 @@ ccw team log --session-id <session_id> --from <role> --type <type> --json
|---------|-----------| |---------|-----------|
| Process own prefix tasks | Process other role's prefix tasks | | Process own prefix tasks | Process other role's prefix tasks |
| SendMessage to coordinator | Directly communicate with other workers | | SendMessage to coordinator | Directly communicate with other workers |
| Use declared subagents (discuss, explore, doc-gen) | Create tasks for other roles | | Use CLI tools for analysis/exploration | Create tasks for other roles |
| Fast-advance simple successors | Spawn parallel worker batches | | Fast-advance simple successors | Spawn parallel worker batches |
| Write to own artifacts + wisdom | Modify resources outside own scope | | Write to own artifacts + wisdom | Modify resources outside own scope |
@@ -455,9 +390,7 @@ ccw team log --session-id <session_id> --from <role> --type <type> --json
| Scenario | Resolution | | Scenario | Resolution |
|----------|------------| |----------|------------|
| Role spec file not found | Report error via SendMessage, STOP | | Role spec file not found | Report error via SendMessage, STOP |
| Subagent failure | Retry once with alternative subagent_type. Still fails → log warning, continue if possible | | CLI tool failure | Retry once. Still fails → log warning, continue with available data |
| Discuss subagent failure | Skip discuss, log warning in report. Proceed without discuss verdict |
| Explore subagent failure | Continue without codebase context |
| Cumulative errors >= 3 | SendMessage to coordinator with error summary, STOP | | Cumulative errors >= 3 | SendMessage to coordinator with error summary, STOP |
| No tasks found | SendMessage idle status, STOP | | No tasks found | SendMessage idle status, STOP |
| Context missing (prior doc, template) | Request from coordinator via SendMessage | | Context missing (prior doc, template) | Request from coordinator via SendMessage |

View File

@@ -10,12 +10,46 @@ Complex refactoring decisions (e.g., choosing between dependency inversion vs me
Called by designer, reviewer after their primary analysis when complexity warrants multi-perspective evaluation: Called by designer, reviewer after their primary analysis when complexity warrants multi-perspective evaluation:
```javascript
// Multi-perspective discussion using CLI tools
Bash({
command: `ccw cli -p "PURPOSE: Conduct multi-perspective discussion on <topic> for architecture optimization
TASK: • Evaluate architecture impact • Assess risks and trade-offs • Consider maintainability • Explore alternatives
MODE: analysis
CONTEXT: @<session-folder>/discussions/<round-id>.md | Memory: <relevant-context-from-calling-role>
EXPECTED: Structured recommendation with consensus verdict (proceed/revise/escalate), confidence level, key trade-offs, recommended approach with rationale, dissenting perspectives
CONSTRAINTS: Focus on <round-id> topic
Round: <round-id>
Topic: <discussion-topic>
Session: <session-folder>
Context:
<relevant-context-from-calling-role>
Perspectives to consider:
- Architecture impact: Will this actually improve the target structural metric?
- Risk assessment: What could break? Dangling references? Behavioral changes? Migration risk?
- Maintainability: Is the refactored code more understandable and maintainable?
- Alternative approaches: Are there simpler or safer ways to achieve the same structural improvement?
Evaluate trade-offs and provide a structured recommendation with:
- Consensus verdict: proceed / revise / escalate
- Confidence level: high / medium / low
- Key trade-offs identified
- Recommended approach with rationale
- Dissenting perspectives (if any)" --tool gemini --mode analysis`,
run_in_background: false
})
``` ```
Agent({
subagent_type: "cli-discuss-agent", **Alternative: Direct multi-perspective analysis**
run_in_background: false,
description: "Discuss <round-id>: <topic> for architecture optimization", For simpler discussions, call CLI tool directly without wrapper:
prompt: `Conduct a multi-perspective discussion on the following topic.
```javascript
Bash({
command: `ccw cli -p "Conduct a multi-perspective discussion on the following topic.
Round: <round-id> Round: <round-id>
Topic: <discussion-topic> Topic: <discussion-topic>

View File

@@ -12,7 +12,7 @@ Called by analyzer, refactorer after needing codebase context for architecture a
``` ```
Agent({ Agent({
subagent_type: "cli-explore-agent", subagent_type: "Explore",
run_in_background: false, run_in_background: false,
description: "Explore codebase for architecture-critical structures in <target-scope>", description: "Explore codebase for architecture-critical structures in <target-scope>",
prompt: `Explore the codebase to identify architecture-critical structures. prompt: `Explore the codebase to identify architecture-critical structures.

View File

@@ -10,12 +10,11 @@ Unlike team-lifecycle-v4's fixed perspective definitions (product, technical, qu
Called by roles after artifact creation: Called by roles after artifact creation:
``` ```javascript
Agent({ // Multi-perspective critique using CLI tools
subagent_type: "cli-discuss-agent", // The coordinator reads the artifact and launches parallel CLI analyses for each perspective
run_in_background: false, Bash({
description: "Discuss <round-id>", command: `ccw cli -p "## Multi-Perspective Critique: <round-id>
prompt: `## Multi-Perspective Critique: <round-id>
### Input ### Input
- Artifact: <artifact-path> - Artifact: <artifact-path>

View File

@@ -6,7 +6,7 @@ Shared codebase exploration utility with centralized caching. Callable by any ro
``` ```
Agent({ Agent({
subagent_type: "cli-explore-agent", subagent_type: "Explore",
run_in_background: false, run_in_background: false,
description: "Explore <angle>", description: "Explore <angle>",
prompt: `Explore codebase for: <query> prompt: `Explore codebase for: <query>

View File

@@ -1,7 +1,7 @@
--- ---
name: team-issue name: team-issue
description: Unified team skill for issue resolution. All roles invoke this skill with --role arg for role-specific execution. Triggers on "team issue". description: Unified team skill for issue resolution. All roles invoke this skill with --role arg for role-specific execution. Triggers on "team issue".
allowed-tools: TeamCreate(*), TeamDelete(*), SendMessage(*), TaskCreate(*), TaskUpdate(*), TaskList(*), TaskGet(*), Agent(*), AskUserQuestion(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*) allowed-tools: TeamCreate(*), TeamDelete(*), SendMessage(*), TaskCreate(*), TaskUpdate(*), TaskList(*), TaskGet(*), Agent(*), AskUserQuestion(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*), mcp__ace-tool__search_context(*), mcp__ccw-tools__team_msg(*)
--- ---
# Team Issue Resolution # Team Issue Resolution
@@ -136,7 +136,7 @@ Cross-task knowledge accumulation. Coordinator creates `wisdom/` directory at se
| Use tools declared in Toolbox | Create tasks for other roles | | Use tools declared in Toolbox | Create tasks for other roles |
| Delegate to reused agents | Modify resources outside own responsibility | | Delegate to reused agents | Modify resources outside own responsibility |
Coordinator additional restrictions: Do not write/modify code directly, do not call implementation subagents (issue-plan-agent etc.), do not execute analysis/review directly. Coordinator additional restrictions: Do not write/modify code directly, do not execute analysis/review directly. Team members use CLI tools for analysis/implementation tasks.
### Output Tagging ### Output Tagging

View File

@@ -53,31 +53,22 @@ Bash("ccw issue status <issueId> --json")
| Complexity | Execution | | Complexity | Execution |
|------------|-----------| |------------|-----------|
| Low | Direct ACE search: `mcp__ace-tool__search_context(project_root_path, query)` | | Low | Direct ACE search: `mcp__ace-tool__search_context(project_root_path, query)` |
| Medium/High | Spawn cli-explore-agent: `Agent({ subagent_type: "cli-explore-agent", run_in_background: false })` | | Medium/High | CLI exploration: `Bash("ccw cli -p \"<exploration_prompt>\" --tool gemini --mode analysis", { run_in_background: false })` |
**cli-explore-agent prompt template**: **CLI exploration prompt template**:
``` ```
## Issue Context PURPOSE: Explore codebase for issue <issueId> to identify relevant files, dependencies, and impact scope; success = comprehensive context report written to <session>/explorations/context-<issueId>.json
ID: <issueId>
Title: <issue.title>
Description: <issue.context>
Priority: <issue.priority>
## MANDATORY FIRST STEPS TASK: • Run ccw tool exec get_modules_by_depth '{}' • Execute ACE searches for issue keywords • Map file dependencies and integration points • Assess impact scope • Find existing patterns • Check git log for related changes
1. Run: ccw tool exec get_modules_by_depth '{}'
2. Execute ACE searches based on issue keywords
3. Run: ccw spec load --category exploration
## Exploration Focus MODE: analysis
- Identify files directly related to this issue
- Map dependencies and integration points
- Assess impact scope (how many modules/files affected)
- Find existing patterns relevant to the fix
- Check for previous related changes (git log)
## Output CONTEXT: @**/* | Memory: Issue <issueId> - <issue.title> (Priority: <issue.priority>)
Write findings to: <session>/explorations/context-<issueId>.json
EXPECTED: JSON report with: relevant_files (path + relevance), dependencies, impact_scope (low/medium/high), existing_patterns, related_changes, key_findings, complexity_assessment
CONSTRAINTS: Focus on issue context | Write output to <session>/explorations/context-<issueId>.json
``` ```
**Report schema**: **Report schema**:

View File

@@ -15,9 +15,9 @@ Load solution plan, route to execution backend (Agent/Codex/Gemini), run tests,
| Backend | Condition | Method | | Backend | Condition | Method |
|---------|-----------|--------| |---------|-----------|--------|
| agent | task_count <= 3 or explicit | `Agent({ subagent_type: "code-developer", run_in_background: false })` |
| codex | task_count > 3 or explicit | `ccw cli --tool codex --mode write --id issue-<issueId>` | | codex | task_count > 3 or explicit | `ccw cli --tool codex --mode write --id issue-<issueId>` |
| gemini | explicit | `ccw cli --tool gemini --mode write --id issue-<issueId>` | | gemini | task_count <= 3 or explicit | `ccw cli --tool gemini --mode write --id issue-<issueId>` |
| qwen | explicit | `ccw cli --tool qwen --mode write --id issue-<issueId>` |
## Phase 2: Load Solution & Resolve Executor ## Phase 2: Load Solution & Resolve Executor
@@ -26,7 +26,7 @@ Load solution plan, route to execution backend (Agent/Codex/Gemini), run tests,
| Issue ID | Task description (GH-\d+ or ISS-\d{8}-\d{6}) | Yes | | Issue ID | Task description (GH-\d+ or ISS-\d{8}-\d{6}) | Yes |
| Bound solution | `ccw issue solutions <id> --json` | Yes | | Bound solution | `ccw issue solutions <id> --json` | Yes |
| Explorer context | `<session>/explorations/context-<issueId>.json` | No | | Explorer context | `<session>/explorations/context-<issueId>.json` | No |
| Execution method | Task description (`execution_method: Agent|Codex|Gemini|Auto`) | Yes | | Execution method | Task description (`execution_method: Codex|Gemini|Qwen|Auto`) | Yes |
| Code review | Task description (`code_review: Skip|Gemini Review|Codex Review`) | No | | Code review | Task description (`code_review: Skip|Gemini Review|Codex Review`) | No |
1. Extract issue ID from task description 1. Extract issue ID from task description
@@ -34,7 +34,7 @@ Load solution plan, route to execution backend (Agent/Codex/Gemini), run tests,
3. Load bound solution: `Bash("ccw issue solutions <issueId> --json")` 3. Load bound solution: `Bash("ccw issue solutions <issueId> --json")`
4. If no bound solution -> report error, STOP 4. If no bound solution -> report error, STOP
5. Load explorer context (if available) 5. Load explorer context (if available)
6. Resolve execution method (Auto: task_count <= 3 -> agent, else codex) 6. Resolve execution method (Auto: task_count <= 3 -> gemini, else codex)
7. Update issue status: `Bash("ccw issue update <issueId> --status in-progress")` 7. Update issue status: `Bash("ccw issue update <issueId> --status in-progress")`
## Phase 3: Implementation (Multi-Backend Routing) ## Phase 3: Implementation (Multi-Backend Routing)
@@ -69,9 +69,9 @@ Dependencies: <explorerContext.dependencies>
``` ```
Route by executor: Route by executor:
- **agent**: `Agent({ subagent_type: "code-developer", run_in_background: false, prompt: <prompt> })` - **codex**: `Bash("ccw cli -p \"<prompt>\" --tool codex --mode write --id issue-<issueId>", { run_in_background: false })`
- **codex**: `Bash("ccw cli -p \"<prompt>\" --tool codex --mode write --id issue-<issueId>")` - **gemini**: `Bash("ccw cli -p \"<prompt>\" --tool gemini --mode write --id issue-<issueId>", { run_in_background: false })`
- **gemini**: `Bash("ccw cli -p \"<prompt>\" --tool gemini --mode write --id issue-<issueId>")` - **qwen**: `Bash("ccw cli -p \"<prompt>\" --tool qwen --mode write --id issue-<issueId>", { run_in_background: false })`
On CLI failure, resume: `ccw cli -p "Continue" --resume issue-<issueId> --tool <tool> --mode write` On CLI failure, resume: `ccw cli -p "Continue" --resume issue-<issueId> --tool <tool> --mode write`

View File

@@ -34,32 +34,25 @@ Bash("ccw issue solutions <issueId> --json")
| All issues bound | Proceed to Phase 3 | | All issues bound | Proceed to Phase 3 |
| Any issue unbound | Report error to coordinator, STOP | | Any issue unbound | Report error to coordinator, STOP |
## Phase 3: Queue Formation via issue-queue-agent ## Phase 3: Queue Formation via CLI
**Agent invocation**: **CLI invocation**:
``` ```
Agent({ Bash("ccw cli -p \"
subagent_type: "issue-queue-agent", PURPOSE: Form execution queue for <count> issues with conflict detection and optimal ordering; success = DAG-based queue with parallel groups written to execution-queue.json
run_in_background: false,
description: "Form queue for <count> issues",
prompt: "
## Issues to Queue
Issue IDs: <issueIds>
## Bound Solutions TASK: • Load all bound solutions from .workflow/issues/solutions/ • Analyze file conflicts between solutions • Build dependency graph • Determine optimal execution order (DAG-based) • Identify parallel execution groups • Write queue JSON
<solution list with issue_id, solution_id, task_count>
## Instructions MODE: analysis
1. Load all bound solutions from .workflow/issues/solutions/
2. Analyze file conflicts between solutions using Gemini CLI
3. Determine optimal execution order (DAG-based)
4. Produce ordered execution queue
## Expected Output CONTEXT: @.workflow/issues/solutions/**/*.json | Memory: Issues to queue: <issueIds>
Write queue to: .workflow/issues/queue/execution-queue.json
" EXPECTED: Queue JSON with: ordered issue list, conflict analysis, parallel_groups (issues that can run concurrently), depends_on relationships
}) Write to: .workflow/issues/queue/execution-queue.json
CONSTRAINTS: Resolve file conflicts | Optimize for parallelism | Maintain dependency order
\" --tool gemini --mode analysis", { run_in_background: true })
``` ```
**Parse queue result**: **Parse queue result**:

View File

@@ -35,39 +35,38 @@ Read("<session>/explorations/context-<issueId>.json")
- Design alternative approach addressing reviewer concerns - Design alternative approach addressing reviewer concerns
5. Load wisdom files for accumulated codebase knowledge 5. Load wisdom files for accumulated codebase knowledge
## Phase 3: Solution Generation via issue-plan-agent ## Phase 3: Solution Generation via CLI
**Agent invocation**: **CLI invocation**:
``` ```
Agent({ Bash("ccw cli -p \"
subagent_type: "issue-plan-agent", PURPOSE: Design solution for issue <issueId> and decompose into implementation tasks; success = solution bound to issue with task breakdown
run_in_background: false,
description: "Plan solution for <issueId>",
prompt: "
issue_ids: [\"<issueId>\"]
project_root: \"<projectRoot>\"
## Explorer Context (pre-gathered) TASK: • Load issue details from ccw issue status • Analyze explorer context • Design solution approach • Break down into implementation tasks • Generate solution JSON • Bind solution to issue
MODE: analysis
CONTEXT: @**/* | Memory: Issue <issueId> - <issue.title> (Priority: <issue.priority>)
Explorer findings: <explorerContext.key_findings>
Relevant files: <explorerContext.relevant_files> Relevant files: <explorerContext.relevant_files>
Key findings: <explorerContext.key_findings>
Complexity: <explorerContext.complexity_assessment> Complexity: <explorerContext.complexity_assessment>
## Revision Required (if SOLVE-fix) EXPECTED: Solution JSON with: issue_id, solution_id, approach, tasks (ordered list with descriptions), estimated_files, dependencies
Previous solution was rejected by reviewer. Feedback: Write to: <session>/solutions/solution-<issueId>.json
<reviewFeedback> Then bind: ccw issue bind <issueId> <solution_id>
Design an ALTERNATIVE approach that addresses the reviewer's concerns. CONSTRAINTS: Follow existing patterns | Minimal changes | Address reviewer feedback if SOLVE-fix task
" \" --tool gemini --mode analysis", { run_in_background: true })
})
``` ```
**Expected agent result**: **Expected CLI output**: Solution file path and binding confirmation
| Field | Description | **Parse result**:
|-------|-------------|
| `bound` | Array of auto-bound solutions: `[{issue_id, solution_id, task_count}]` | ```
| `pending_selection` | Array of multi-solution issues: `[{issue_id, solutions: [...]}]` | Read("<session>/solutions/solution-<issueId>.json")
```
## Phase 4: Solution Selection & Reporting ## Phase 4: Solution Selection & Reporting

View File

@@ -3,7 +3,7 @@ role: analyst
prefix: RESEARCH prefix: RESEARCH
inner_loop: false inner_loop: false
discuss_rounds: [DISCUSS-001] discuss_rounds: [DISCUSS-001]
subagents: [explore, discuss] subagents: [discuss]
message_types: message_types:
success: research_ready success: research_ready
progress: research_progress progress: research_progress
@@ -44,18 +44,21 @@ EXPECTED: JSON with: problem_statement, target_users[], domain, constraints[], e
| package.json / Cargo.toml / pyproject.toml / go.mod exists | Explore codebase | | package.json / Cargo.toml / pyproject.toml / go.mod exists | Explore codebase |
| No project files | Skip → codebase context = null | | No project files | Skip → codebase context = null |
**When project detected**: Call explore subagent with `angle: general`, `keywords: <from seed analysis>`. **When project detected**: Use CLI exploration with Gemini.
``` ```
Agent({ Bash({
subagent_type: "cli-explore-agent", command: `ccw cli -p "PURPOSE: Explore codebase for general context to inform spec generation
run_in_background: false, TASK: • Identify tech stack and frameworks • Map architecture patterns • Document conventions • List integration points
description: "Explore general context", MODE: analysis
prompt: "Explore codebase for: <topic>\nFocus angle: general\nKeywords: <seed analysis keywords>\nSession folder: <session-folder>\n..." CONTEXT: @**/* | Memory: Seed analysis keywords: <keywords>
EXPECTED: JSON with: tech_stack[], architecture_patterns[], conventions[], integration_points[]
CONSTRAINTS: Focus on general context" --tool gemini --mode analysis --rule analysis-analyze-code-patterns`,
run_in_background: false
}) })
``` ```
Use exploration results to build codebase context: tech_stack, architecture_patterns, conventions, integration_points. Parse CLI output to build codebase context: tech_stack, architecture_patterns, conventions, integration_points.
## Phase 4: Context Packaging + Inline Discuss ## Phase 4: Context Packaging + Inline Discuss
@@ -89,5 +92,5 @@ Handle discuss verdict per team-worker consensus handling protocol.
| Gemini CLI failure | Fallback to direct Claude analysis | | Gemini CLI failure | Fallback to direct Claude analysis |
| Codebase detection failed | Continue as new project | | Codebase detection failed | Continue as new project |
| Topic too vague | Report with clarification questions | | Topic too vague | Report with clarification questions |
| Explore subagent fails | Continue without codebase context | | CLI exploration fails | Continue without codebase context |
| Discuss subagent fails | Proceed without discuss, log warning | | Discuss subagent fails | Proceed without discuss, log warning |

View File

@@ -42,9 +42,9 @@ message_types:
| Backend | Invocation | Use Case | | Backend | Invocation | Use Case |
|---------|-----------|----------| |---------|-----------|----------|
| agent | `Agent({ subagent_type: "code-developer", run_in_background: false })` | Simple, direct edits | | gemini | `ccw cli --tool gemini --mode write` (foreground) | Simple, direct edits |
| codex | `ccw cli --tool codex --mode write` (background) | Complex, architecture | | codex | `ccw cli --tool codex --mode write` (foreground) | Complex, architecture |
| gemini | `ccw cli --tool gemini --mode write` (background) | Analysis-heavy | | qwen | `ccw cli --tool qwen --mode write` (foreground) | Alternative backend |
## Phase 4: Self-Validation ## Phase 4: Self-Validation
@@ -63,5 +63,5 @@ message_types:
|----------|------------| |----------|------------|
| Syntax errors | Retry with error context (max 3) | | Syntax errors | Retry with error context (max 3) |
| Missing dependencies | Request from coordinator | | Missing dependencies | Request from coordinator |
| Backend unavailable | Fallback to agent | | Backend unavailable | Fallback to alternative tool |
| Circular dependencies | Abort, report graph | | Circular dependencies | Abort, report graph |

View File

@@ -42,8 +42,8 @@ message_types:
| Task Size | Strategy | | Task Size | Strategy |
|-----------|----------| |-----------|----------|
| Simple (<= 3 files, single component) | `Agent({ subagent_type: "code-developer", run_in_background: false })` | | Simple (<= 3 files, single component) | `ccw cli --tool gemini --mode write` (foreground) |
| Complex (system, multi-component) | `ccw cli --tool gemini --mode write` (background) | | Complex (system, multi-component) | `ccw cli --tool codex --mode write` (foreground) |
**Coding standards** (include in agent/CLI prompt): **Coding standards** (include in agent/CLI prompt):
- Use design token CSS variables, never hardcode colors/spacing - Use design token CSS variables, never hardcode colors/spacing
@@ -76,4 +76,4 @@ Contribute to wisdom/conventions.md. Update shared-memory.json with component in
|----------|------------| |----------|------------|
| Design tokens not found | Use project defaults | | Design tokens not found | Use project defaults |
| Tech stack undetected | Default HTML + CSS | | Tech stack undetected | Default HTML + CSS |
| Subagent failure | Fallback to CLI write mode | | CLI failure | Retry with alternative tool |

View File

@@ -3,7 +3,7 @@ role: planner
prefix: PLAN prefix: PLAN
inner_loop: true inner_loop: true
discuss_rounds: [] discuss_rounds: []
subagents: [explore] subagents: []
message_types: message_types:
success: plan_ready success: plan_ready
revision: plan_revision revision: plan_revision
@@ -30,14 +30,17 @@ If `<session-folder>/spec/` exists → load requirements/_index.md, architecture
| Medium | 200-500 chars or moderate scope | 2-3 angle explore subagent | | Medium | 200-500 chars or moderate scope | 2-3 angle explore subagent |
| High | > 500 chars, refactor/architecture, multi-module | 3-5 angle explore subagent | | High | > 500 chars, refactor/architecture, multi-module | 3-5 angle explore subagent |
For each angle, call explore subagent (cache-aware — check cache-index.json before each call): For each angle, use CLI exploration (cache-aware — check cache-index.json before each call):
``` ```
Agent({ Bash({
subagent_type: "cli-explore-agent", command: `ccw cli -p "PURPOSE: Explore codebase from <angle> perspective to inform planning
run_in_background: false, TASK: • Search for <angle>-specific patterns • Identify relevant files • Document integration points
description: "Explore <angle>", MODE: analysis
prompt: "Explore codebase for: <task>\nFocus angle: <angle>\nKeywords: <keywords>\nSession folder: <session-folder>\n..." CONTEXT: @**/* | Memory: Task keywords: <keywords>
EXPECTED: JSON with: relevant_files[], patterns[], integration_points[], recommendations[]
CONSTRAINTS: Focus on <angle> perspective" --tool gemini --mode analysis --rule analysis-analyze-code-patterns`,
run_in_background: false
}) })
``` ```
@@ -50,20 +53,17 @@ Agent({
| Low | Direct planning → single TASK-001 with plan.json | | Low | Direct planning → single TASK-001 with plan.json |
| Medium/High | cli-lite-planning-agent with exploration results | | Medium/High | cli-lite-planning-agent with exploration results |
**Agent call** (Medium/High): **CLI call** (Medium/High):
``` ```
Agent({ Bash({
subagent_type: "cli-lite-planning-agent", command: `ccw cli -p "PURPOSE: Generate structured implementation plan from exploration results
run_in_background: false, TASK: • Create plan.json with overview • Generate TASK-*.json files (2-7 tasks) • Define dependencies • Set convergence criteria
description: "Generate implementation plan", MODE: write
prompt: "Generate plan. CONTEXT: @<session-folder>/explorations/*.json | Memory: Complexity: <complexity>
Output: <plan-dir>/plan.json + <plan-dir>/.task/TASK-*.json EXPECTED: Files: plan.json + .task/TASK-*.json. Schema: ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json
Schema: cat ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json CONSTRAINTS: 2-7 tasks, include id/title/files[].change/convergence.criteria/depends_on" --tool gemini --mode write --rule planning-breakdown-task-steps`,
Task: <task-description> run_in_background: false
Explorations: <explorations-manifest>
Complexity: <complexity>
Requirements: 2-7 tasks with id, title, files[].change, convergence.criteria, depends_on"
}) })
``` ```
@@ -91,8 +91,8 @@ Requirements: 2-7 tasks with id, title, files[].change, convergence.criteria, de
| Scenario | Resolution | | Scenario | Resolution |
|----------|------------| |----------|------------|
| Exploration agent failure | Plan from description only | | CLI exploration failure | Plan from description only |
| Planning agent failure | Fallback to direct planning | | CLI planning failure | Fallback to direct planning |
| Plan rejected 3+ times | Notify coordinator, suggest alternative | | Plan rejected 3+ times | Notify coordinator, suggest alternative |
| Schema not found | Use basic structure | | Schema not found | Use basic structure |
| Cache index corrupt | Clear cache, re-explore all angles | | Cache index corrupt | Clear cache, re-explore all angles |

View File

@@ -3,7 +3,7 @@ role: writer
prefix: DRAFT prefix: DRAFT
inner_loop: true inner_loop: true
discuss_rounds: [DISCUSS-002, DISCUSS-003, DISCUSS-004, DISCUSS-005] discuss_rounds: [DISCUSS-002, DISCUSS-003, DISCUSS-004, DISCUSS-005]
subagents: [discuss, doc-generation] subagents: [discuss]
message_types: message_types:
success: draft_ready success: draft_ready
revision: draft_revision revision: draft_revision
@@ -56,42 +56,23 @@ message_types:
## Phase 3: Subagent Document Generation ## Phase 3: Subagent Document Generation
**Objective**: Delegate document generation to doc-generation subagent. **Objective**: Generate document using CLI tool.
Do NOT execute CLI calls in main agent. Delegate to subagent: Use Gemini CLI for document generation:
``` ```
Agent({ Bash({
subagent_type: "universal-executor", command: `ccw cli -p "PURPOSE: Generate <doc-type> document following template and standards
run_in_background: false, TASK: • Load template from <template-path> • Apply spec config and discovery context • Integrate prior discussion feedback • Generate all required sections
description: "Generate <doc-type> document", MODE: write
prompt: `<from subagents/doc-generation-subagent.md> CONTEXT: @<session-folder>/spec/*.json @<template-path> | Memory: Prior decisions: <context_accumulator summary>
EXPECTED: Document at <output-path> with: YAML frontmatter, all template sections, cross-references, session_id
## Task CONSTRAINTS: Follow document-standards.md" --tool gemini --mode write --rule development-implement-feature --cd <session-folder>`,
- Document type: <doc-type> run_in_background: false
- Session folder: <session-folder>
- Template: <template-path>
## Context
- Spec config: <spec-config content>
- Discovery context: <discovery-context summary>
- Prior discussion feedback: <discussion-file content if exists>
- Prior decisions (from writer accumulator):
<context_accumulator serialized>
## Expected Output
Return JSON:
{
"artifact_path": "<output-path>",
"summary": "<100-200 char summary>",
"key_decisions": ["<decision-1>", ...],
"sections_generated": ["<section-1>", ...],
"warnings": ["<warning if any>"]
}`
}) })
``` ```
Main agent receives only the JSON summary. Document is written to disk by subagent. Parse CLI output for artifact path and summary. Document is written to disk by CLI.
## Phase 4: Self-Validation + Inline Discuss ## Phase 4: Self-Validation + Inline Discuss
@@ -119,7 +100,7 @@ Handle discuss verdict per team-worker consensus handling protocol.
| Scenario | Resolution | | Scenario | Resolution |
|----------|------------| |----------|------------|
| Subagent failure | Retry once with alternative subagent_type. Still fails → log error, continue next task | | CLI failure | Retry once with alternative tool. Still fails → log error, continue next task |
| Discuss subagent fails | Skip discuss, log warning | | Discuss subagent fails | Skip discuss, log warning |
| Cumulative 3 task failures | SendMessage to coordinator, STOP | | Cumulative 3 task failures | SendMessage to coordinator, STOP |
| Prior doc not found | Notify coordinator, request prerequisite | | Prior doc not found | Notify coordinator, request prerequisite |

View File

@@ -99,11 +99,10 @@ When coordinator needs to execute a command (dispatch, monitor):
## Execution Method Selection ## Execution Method Selection
支持 3 种执行后端: 支持 2 种执行后端:
| Executor | 后端 | 适用场景 | | Executor | 后端 | 适用场景 |
|----------|------|----------| |----------|------|----------|
| `agent` | code-developer subagent | 简单任务、同步执行 |
| `codex` | `ccw cli --tool codex --mode write` | 复杂任务、后台执行 | | `codex` | `ccw cli --tool codex --mode write` | 复杂任务、后台执行 |
| `gemini` | `ccw cli --tool gemini --mode write` | 分析类任务、后台执行 | | `gemini` | `ccw cli --tool gemini --mode write` | 分析类任务、后台执行 |
@@ -111,12 +110,11 @@ When coordinator needs to execute a command (dispatch, monitor):
| Condition | Execution Method | | Condition | Execution Method |
|-----------|-----------------| |-----------|-----------------|
| `--exec=agent` specified | Agent |
| `--exec=codex` specified | Codex | | `--exec=codex` specified | Codex |
| `--exec=gemini` specified | Gemini | | `--exec=gemini` specified | Gemini |
| `-y` or `--yes` flag present | Auto (default Agent) | | `-y` or `--yes` flag present | Auto (default Gemini) |
| No flags (interactive) | AskUserQuestion -> user choice | | No flags (interactive) | AskUserQuestion -> user choice |
| Auto + task_count <= 3 | Agent | | Auto + task_count <= 3 | Gemini |
| Auto + task_count > 3 | Codex | | Auto + task_count > 3 | Codex |
--- ---

View File

@@ -30,37 +30,26 @@ Single-issue implementation agent. Loads solution from artifact file, routes to
### Backend Selection ### Backend Selection
| Method | Backend | Agent Type | | Method | Backend | CLI Tool |
|--------|---------|------------| |--------|---------|----------|
| `agent` | code-developer subagent | Inline delegation |
| `codex` | `ccw cli --tool codex --mode write` | Background CLI | | `codex` | `ccw cli --tool codex --mode write` | Background CLI |
| `gemini` | `ccw cli --tool gemini --mode write` | Background CLI | | `gemini` | `ccw cli --tool gemini --mode write` | Background CLI |
### Agent Backend
```
Agent({
subagent_type: "code-developer",
description: "Implement <issue-title>",
prompt: `Issue: <issueId>
Title: <solution.title>
Solution: <solution JSON>
Implement all tasks from the solution plan.`,
run_in_background: false
})
```
### CLI Backend (Codex/Gemini) ### CLI Backend (Codex/Gemini)
```bash ```bash
ccw cli -p "Issue: <issueId> ccw cli -p "PURPOSE: Implement solution for issue <issueId>; success = all tasks completed, tests pass
TASK: <solution.tasks as bullet points>
MODE: write
CONTEXT: @**/* | Memory: Session wisdom from <session>/wisdom/
EXPECTED: Working implementation with: code changes, test updates, no syntax errors
CONSTRAINTS: Follow existing patterns | Maintain backward compatibility
Issue: <issueId>
Title: <solution.title> Title: <solution.title>
Solution Plan: <solution JSON> Solution: <solution JSON>" --tool <codex|gemini> --mode write --rule development-implement-feature
Implement all tasks. Follow existing patterns. Run tests." \
--tool <codex|gemini> --mode write
``` ```
Wait for CLI completion before proceeding. Wait for CLI completion before proceeding to verification.
## Phase 4: Verification + Commit ## Phase 4: Verification + Commit
@@ -95,7 +84,7 @@ Send `impl_complete` message to coordinator via team_msg + SendMessage.
| Allowed | Prohibited | | Allowed | Prohibited |
|---------|-----------| |---------|-----------|
| Load solution from file | Create or modify issues | | Load solution from file | Create or modify issues |
| Implement via Agent/Codex/Gemini | Modify solution artifacts | | Implement via CLI tools (Codex/Gemini) | Modify solution artifacts |
| Run tests | Spawn additional agents | | Run tests | Spawn subagents (use CLI tools instead) |
| git commit | Direct user interaction | | git commit | Direct user interaction |
| Update issue status | Create tasks for other roles | | Update issue status | Create tasks for other roles |

View File

@@ -1,7 +1,6 @@
--- ---
prefix: PLAN prefix: PLAN
inner_loop: true inner_loop: true
subagents: [issue-plan-agent]
message_types: message_types:
success: issue_ready success: issue_ready
error: error error: error
@@ -36,18 +35,19 @@ For each issue, execute in sequence:
### 3a. Generate Solution ### 3a. Generate Solution
Delegate to `issue-plan-agent` subagent: Use CLI tool for issue planning:
```bash
ccw cli -p "PURPOSE: Generate implementation solution for issue <issueId>; success = actionable task breakdown with file paths
TASK: • Load issue details • Analyze requirements • Design solution approach • Break down into implementation tasks • Identify files to modify/create
MODE: analysis
CONTEXT: @**/* | Memory: Session context from <session>/wisdom/
EXPECTED: JSON solution with: title, description, tasks array (each with description, files_touched), estimated_complexity
CONSTRAINTS: Follow project patterns | Reference existing implementations
" --tool gemini --mode analysis --rule planning-breakdown-task-steps
``` ```
Agent({
subagent_type: "issue-plan-agent", Parse CLI output to extract solution JSON. If CLI fails, fallback to `ccw issue solution <issueId> --json`.
description: "Plan issue <issueId>",
prompt: `issue_ids: ["<issueId>"]
project_root: "<project-root>"
Generate solution for this issue. Auto-bind single solution.`,
run_in_background: false
})
```
### 3b. Write Solution Artifact ### 3b. Write Solution Artifact

View File

@@ -59,11 +59,16 @@ Bash("<test-command> 2>&1 || true")
**Auto-fix delegation** (on failure): **Auto-fix delegation** (on failure):
``` ```
Agent({ Bash({
subagent_type: "code-developer", command: `ccw cli -p "PURPOSE: Fix test failures to achieve pass rate >= 0.95; success = all tests pass
run_in_background: false, TASK: • Analyze test failure output • Identify root causes • Fix test code only (not source) • Preserve test intent
description: "Fix test failures (iteration <N>)", MODE: write
prompt: "Fix these test failures:\n<test-output>\nOnly fix test files, not source code." CONTEXT: @<session>/<test-dir>/**/* | Memory: Test framework: <framework>, iteration <N>/3
EXPECTED: Fixed test files with: corrected assertions, proper async handling, fixed imports, maintained coverage
CONSTRAINTS: Only modify test files | Preserve test structure | No source code changes
Test failures:
<test-output>" --tool gemini --mode write --cd <session>`,
run_in_background: false
}) })
``` ```

View File

@@ -58,17 +58,21 @@ For revision mode:
2. Generate test code: happy path, edge cases, error handling 2. Generate test code: happy path, edge cases, error handling
3. Write test file 3. Write test file
**Agent delegation** (medium/high complexity): **CLI delegation** (medium/high complexity):
``` ```
Agent({ Bash({
subagent_type: "code-developer", command: `ccw cli -p "PURPOSE: Generate <layer> tests using <framework> to achieve coverage target; success = all priority files covered with quality tests
run_in_background: false, TASK: • Analyze source files • Generate test cases (happy path, edge cases, errors) • Write test files with proper structure • Ensure import resolution
description: "Generate <layer> tests", MODE: write
prompt: "Generate <layer> tests using <framework>... CONTEXT: @<source-files> @<session>/strategy/test-strategy.md | Memory: Framework: <framework>, Layer: <layer>, Round: <round>
<file-list-with-content> <if-revision: Previous failures: <failure-details>
<if-revision: previous failures + effective patterns> Effective patterns: <patterns-from-meta>>
Write test files to: <session>/tests/<layer>/" EXPECTED: Test files in <session>/tests/<layer>/ with: proper test structure, comprehensive coverage, correct imports, framework conventions
CONSTRAINTS: Follow test strategy priorities | Use framework best practices | <layer>-appropriate assertions
Source files to test:
<file-list-with-content>" --tool gemini --mode write --cd <session>`,
run_in_background: false
}) })
``` ```

View File

@@ -1,7 +1,7 @@
--- ---
prefix: DISCUSS prefix: DISCUSS
inner_loop: false inner_loop: false
subagents: [cli-explore-agent] subagents: []
message_types: message_types:
success: discussion_processed success: discussion_processed
error: error error: error
@@ -46,27 +46,39 @@ Select strategy by discussion type:
**initial**: Cross-perspective summary -- identify convergent themes, conflicting views, top 5 discussion points and open questions from all analyses. **initial**: Cross-perspective summary -- identify convergent themes, conflicting views, top 5 discussion points and open questions from all analyses.
**deepen**: Spawn cli-explore-agent focused on open questions and uncertain insights: **deepen**: Use CLI tool for deep investigation:
``` ```javascript
Agent({ Bash({
subagent_type: "cli-explore-agent", command: `ccw cli -p "PURPOSE: Investigate open questions and uncertain insights; success = evidence-based findings
run_in_background: false, TASK: • Focus on open questions: <questions> • Find supporting evidence • Validate uncertain insights • Document findings
prompt: "Focus on open questions: <questions>. Find evidence for uncertain insights. Write to: <session>/discussions/deepen-<num>.json" MODE: analysis
CONTEXT: @**/* | Memory: Session <session-folder>, previous analyses
EXPECTED: JSON output with investigation results | Write to <session>/discussions/deepen-<num>.json
CONSTRAINTS: Evidence-based analysis only
" --tool gemini --mode analysis --rule analysis-trace-code-execution`,
run_in_background: false
}) })
``` ```
**direction-adjusted**: CLI re-analysis from adjusted focus: **direction-adjusted**: CLI re-analysis from adjusted focus:
``` ```javascript
ccw cli -p "Re-analyze '<topic>' with adjusted focus on '<userFeedback>'" --tool gemini --mode analysis Bash({
command: `ccw cli -p "Re-analyze '<topic>' with adjusted focus on '<userFeedback>'" --tool gemini --mode analysis`,
run_in_background: false
})
``` ```
**specific-questions**: Spawn cli-explore-agent targeting user's questions: **specific-questions**: Use CLI tool for targeted Q&A:
``` ```javascript
Agent({ Bash({
subagent_type: "cli-explore-agent", command: `ccw cli -p "PURPOSE: Answer specific user questions about <topic>; success = clear, evidence-based answers
description: "Answer specific user questions", TASK: • Answer: <userFeedback> • Provide code references • Explain context
run_in_background: false, MODE: analysis
prompt: "Answer: <userFeedback>. Write to: <session>/discussions/questions-<num>.json" CONTEXT: @**/* | Memory: Session <session-folder>
EXPECTED: JSON output with answers and evidence | Write to <session>/discussions/questions-<num>.json
CONSTRAINTS: Direct answers with code references
" --tool gemini --mode analysis`,
run_in_background: false
}) })
``` ```

View File

@@ -1,7 +1,7 @@
--- ---
prefix: EXPLORE prefix: EXPLORE
inner_loop: false inner_loop: false
subagents: [cli-explore-agent] subagents: []
message_types: message_types:
success: exploration_ready success: exploration_ready
error: error error: error
@@ -40,39 +40,23 @@ Explore codebase structure through cli-explore-agent, collecting structured cont
## Phase 3: Codebase Exploration ## Phase 3: Codebase Exploration
Spawn `cli-explore-agent` subagent for actual exploration: Use CLI tool for codebase exploration:
``` ```javascript
Agent({ Bash({
subagent_type: "cli-explore-agent", command: `ccw cli -p "PURPOSE: Explore codebase for <topic> from <perspective> perspective; success = structured findings with relevant files and patterns
run_in_background: false, TASK: • Run module depth analysis • Search for topic-related patterns • Identify key files and their relationships • Extract architectural insights
description: "Explore codebase: <topic> (<perspective>)", MODE: analysis
prompt: ` CONTEXT: @**/* | Memory: Session <session-folder>, perspective <perspective>
## Analysis Context EXPECTED: JSON output with: relevant_files (path, relevance, summary), patterns, key_findings, module_map, questions_for_analysis, _metadata (perspective, search_queries, timestamp)
Topic: <topic> CONSTRAINTS: Focus on <perspective> angle - <strategy.focus> | Write to <session>/explorations/exploration-<num>.json
Perspective: <perspective> -- <strategy.focus> " --tool gemini --mode analysis --rule analysis-analyze-code-patterns`,
Dimensions: <dimensions> run_in_background: false
Session: <session-folder>
## MANDATORY FIRST STEPS
1. Run: ccw tool exec get_modules_by_depth '{}'
2. Execute searches based on topic + perspective keywords
3. Run: ccw spec load --category exploration
## Exploration Focus (<perspective> angle)
<dimension-specific exploration instructions>
## Output
Write findings to: <session>/explorations/exploration-<num>.json
Schema: { perspective, relevant_files: [{path, relevance, summary}], patterns: [string],
key_findings: [string], module_map: {module: [files]}, questions_for_analysis: [string],
_metadata: {agent, perspective, search_queries, timestamp} }
`
}) })
``` ```
**ACE fallback** (when cli-explore-agent produces no output): **ACE fallback** (when CLI produces no output):
``` ```javascript
mcp__ace-tool__search_context({ project_root_path: ".", query: "<topic> <perspective>" }) mcp__ace-tool__search_context({ project_root_path: ".", query: "<topic> <perspective>" })
``` ```