From fd847070d5fd876f6eb232690ef1bc3dead116f2 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Wed, 4 Mar 2026 23:19:36 +0800 Subject: [PATCH] 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. --- .claude/agents/team-worker.md | 127 +++++------------- .../subagents/discuss-subagent.md | 44 +++++- .../subagents/explore-subagent.md | 2 +- .../subagents/discuss-subagent.md | 11 +- .../subagents/explore-subagent.md | 2 +- .claude/skills/team-issue/SKILL.md | 4 +- .../skills/team-issue/role-specs/explorer.md | 29 ++-- .../team-issue/role-specs/implementer.md | 14 +- .../team-issue/role-specs/integrator.md | 33 ++--- .../skills/team-issue/role-specs/planner.md | 43 +++--- .../team-lifecycle/role-specs/analyst.md | 21 +-- .../team-lifecycle/role-specs/executor.md | 8 +- .../team-lifecycle/role-specs/fe-developer.md | 6 +- .../team-lifecycle/role-specs/planner.md | 42 +++--- .../team-lifecycle/role-specs/writer.md | 45 ++----- .claude/skills/team-planex/SKILL.md | 8 +- .../skills/team-planex/role-specs/executor.md | 37 ++--- .../skills/team-planex/role-specs/planner.md | 22 +-- .../team-testing/role-specs/executor.md | 15 ++- .../team-testing/role-specs/generator.md | 22 +-- .../role-specs/discussant.md | 44 +++--- .../team-ultra-analyze/role-specs/explorer.md | 44 ++---- 22 files changed, 274 insertions(+), 349 deletions(-) diff --git a/.claude/agents/team-worker.md b/.claude/agents/team-worker.md index ddc71d6a..b2bcd80d 100644 --- a/.claude/agents/team-worker.md +++ b/.claude/agents/team-worker.md @@ -49,7 +49,7 @@ Parse the following fields from your prompt: - `prefix`: Task prefix to filter (e.g., `RESEARCH`, `DRAFT`, `IMPL`) - `inner_loop`: Override from frontmatter if present - `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 3. Parse **body** (content after frontmatter) to get Phase 2-4 execution instructions 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** (`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) | |------|-----------------|------------------| @@ -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: -### 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 ", - prompt: `## Multi-Perspective Critique: -### Input -- Artifact: -- Round: -- Perspectives: -- Session: -- Discovery Context: /spec/discovery-context.json +**Option B: Direct Tools** +Use Read, Grep, Glob, mcp__ace-tool__search_context directly. -### Perspective Routing - -| Perspective | CLI Tool | Role | Focus Areas | -|-------------|----------|------|-------------| -| Product | gemini | Product Manager | Market fit, user value, business viability | -| Technical | codex | Tech Lead | Feasibility, tech debt, performance, security | -| Quality | claude | QA Lead | Completeness, testability, consistency | -| Risk | gemini | Risk Analyst | Risk identification, dependencies, failure modes | -| Coverage | gemini | Requirements Analyst | Requirement completeness vs discovery-context | - -### Execution Steps -1. Read artifact from -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: /discussions/-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 ", - prompt: `Explore codebase for: - -Focus angle: -Keywords: -Session folder: - -## Cache Check -1. Read /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: /explorations/explore-.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 ", - prompt: `## Document Generation: - -### Session -- Folder: -- Spec config: - -### Document Config -- Type: -- Template: -- Output: -- Prior discussion: - -### Writer Accumulator (prior decisions) - - -### Output Requirements -1. Write document to -2. Return JSON: { artifact_path, summary, key_decisions[], sections_generated[], warnings[] }` +**Option C: Request Coordinator Help** +Send message to coordinator requesting subagent delegation: +```javascript +mcp__ccw-tools__team_msg({ + operation: "log", + session_id: sessionId, + from: role, + to: "coordinator", + type: "subagent_request", + summary: "Request exploration subagent for X", + data: { reason: "...", scope: "..." } }) +SendMessage({ recipient: "coordinator", content: "..." }) ``` ### Consensus Handling -After a discuss subagent returns, handle the verdict: +When role-spec instructions require consensus/discussion, handle the verdict: | Verdict | Severity | Action | |---------|----------|--------| @@ -374,7 +309,7 @@ After Phase 4 verification, the worker MUST publish its contributions: 1. **Artifact**: Write deliverable to `/artifacts/--.md` 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` -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 @@ -444,7 +379,7 @@ ccw team log --session-id --from --type --json |---------|-----------| | Process own prefix tasks | Process other role's prefix tasks | | 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 | | Write to own artifacts + wisdom | Modify resources outside own scope | @@ -455,9 +390,7 @@ ccw team log --session-id --from --type --json | Scenario | Resolution | |----------|------------| | 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 | -| Discuss subagent failure | Skip discuss, log warning in report. Proceed without discuss verdict | -| Explore subagent failure | Continue without codebase context | +| CLI tool failure | Retry once. Still fails → log warning, continue with available data | | Cumulative errors >= 3 | SendMessage to coordinator with error summary, STOP | | No tasks found | SendMessage idle status, STOP | | Context missing (prior doc, template) | Request from coordinator via SendMessage | diff --git a/.claude/skills/team-arch-opt/subagents/discuss-subagent.md b/.claude/skills/team-arch-opt/subagents/discuss-subagent.md index 71df3b1c..340b721d 100644 --- a/.claude/skills/team-arch-opt/subagents/discuss-subagent.md +++ b/.claude/skills/team-arch-opt/subagents/discuss-subagent.md @@ -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: +```javascript +// Multi-perspective discussion using CLI tools +Bash({ + command: `ccw cli -p "PURPOSE: Conduct multi-perspective discussion on for architecture optimization +TASK: • Evaluate architecture impact • Assess risks and trade-offs • Consider maintainability • Explore alternatives +MODE: analysis +CONTEXT: @/discussions/.md | Memory: +EXPECTED: Structured recommendation with consensus verdict (proceed/revise/escalate), confidence level, key trade-offs, recommended approach with rationale, dissenting perspectives +CONSTRAINTS: Focus on topic + +Round: +Topic: +Session: + +Context: + + +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", - run_in_background: false, - description: "Discuss : for architecture optimization", - prompt: `Conduct a multi-perspective discussion on the following topic. + +**Alternative: Direct multi-perspective analysis** + +For simpler discussions, call CLI tool directly without wrapper: + +```javascript +Bash({ + command: `ccw cli -p "Conduct a multi-perspective discussion on the following topic. Round: Topic: diff --git a/.claude/skills/team-arch-opt/subagents/explore-subagent.md b/.claude/skills/team-arch-opt/subagents/explore-subagent.md index 8ab89eac..27e63d54 100644 --- a/.claude/skills/team-arch-opt/subagents/explore-subagent.md +++ b/.claude/skills/team-arch-opt/subagents/explore-subagent.md @@ -12,7 +12,7 @@ Called by analyzer, refactorer after needing codebase context for architecture a ``` Agent({ - subagent_type: "cli-explore-agent", + subagent_type: "Explore", run_in_background: false, description: "Explore codebase for architecture-critical structures in ", prompt: `Explore the codebase to identify architecture-critical structures. diff --git a/.claude/skills/team-coordinate/subagents/discuss-subagent.md b/.claude/skills/team-coordinate/subagents/discuss-subagent.md index e9bd026c..06b42848 100644 --- a/.claude/skills/team-coordinate/subagents/discuss-subagent.md +++ b/.claude/skills/team-coordinate/subagents/discuss-subagent.md @@ -10,12 +10,11 @@ Unlike team-lifecycle-v4's fixed perspective definitions (product, technical, qu Called by roles after artifact creation: -``` -Agent({ - subagent_type: "cli-discuss-agent", - run_in_background: false, - description: "Discuss ", - prompt: `## Multi-Perspective Critique: +```javascript +// Multi-perspective critique using CLI tools +// The coordinator reads the artifact and launches parallel CLI analyses for each perspective +Bash({ + command: `ccw cli -p "## Multi-Perspective Critique: ### Input - Artifact: diff --git a/.claude/skills/team-coordinate/subagents/explore-subagent.md b/.claude/skills/team-coordinate/subagents/explore-subagent.md index a6daad2b..95fddd8f 100644 --- a/.claude/skills/team-coordinate/subagents/explore-subagent.md +++ b/.claude/skills/team-coordinate/subagents/explore-subagent.md @@ -6,7 +6,7 @@ Shared codebase exploration utility with centralized caching. Callable by any ro ``` Agent({ - subagent_type: "cli-explore-agent", + subagent_type: "Explore", run_in_background: false, description: "Explore ", prompt: `Explore codebase for: diff --git a/.claude/skills/team-issue/SKILL.md b/.claude/skills/team-issue/SKILL.md index d29bd4b7..925576ee 100644 --- a/.claude/skills/team-issue/SKILL.md +++ b/.claude/skills/team-issue/SKILL.md @@ -1,7 +1,7 @@ --- 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". -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 @@ -136,7 +136,7 @@ Cross-task knowledge accumulation. Coordinator creates `wisdom/` directory at se | Use tools declared in Toolbox | Create tasks for other roles | | 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 diff --git a/.claude/skills/team-issue/role-specs/explorer.md b/.claude/skills/team-issue/role-specs/explorer.md index 18bd7934..d15a3528 100644 --- a/.claude/skills/team-issue/role-specs/explorer.md +++ b/.claude/skills/team-issue/role-specs/explorer.md @@ -53,31 +53,22 @@ Bash("ccw issue status --json") | Complexity | Execution | |------------|-----------| | 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 \"\" --tool gemini --mode analysis", { run_in_background: false })` | -**cli-explore-agent prompt template**: +**CLI exploration prompt template**: ``` -## Issue Context -ID: -Title: -Description: -Priority: +PURPOSE: Explore codebase for issue to identify relevant files, dependencies, and impact scope; success = comprehensive context report written to /explorations/context-.json -## MANDATORY FIRST STEPS -1. Run: ccw tool exec get_modules_by_depth '{}' -2. Execute ACE searches based on issue keywords -3. Run: ccw spec load --category exploration +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 -## Exploration Focus -- 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) +MODE: analysis -## Output -Write findings to: /explorations/context-.json +CONTEXT: @**/* | Memory: Issue - (Priority: ) + +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 /explorations/context-.json ``` **Report schema**: diff --git a/.claude/skills/team-issue/role-specs/implementer.md b/.claude/skills/team-issue/role-specs/implementer.md index 91d02fed..a5a06c7c 100644 --- a/.claude/skills/team-issue/role-specs/implementer.md +++ b/.claude/skills/team-issue/role-specs/implementer.md @@ -15,9 +15,9 @@ Load solution plan, route to execution backend (Agent/Codex/Gemini), run tests, | 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-` | -| gemini | explicit | `ccw cli --tool gemini --mode write --id issue-` | +| gemini | task_count <= 3 or explicit | `ccw cli --tool gemini --mode write --id issue-` | +| qwen | explicit | `ccw cli --tool qwen --mode write --id issue-` | ## 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 | | Bound solution | `ccw issue solutions --json` | Yes | | Explorer context | `/explorations/context-.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 | 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 --json")` 4. If no bound solution -> report error, STOP 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 --status in-progress")` ## Phase 3: Implementation (Multi-Backend Routing) @@ -69,9 +69,9 @@ Dependencies: ``` Route by executor: -- **agent**: `Agent({ subagent_type: "code-developer", run_in_background: false, prompt: })` -- **codex**: `Bash("ccw cli -p \"\" --tool codex --mode write --id issue-")` -- **gemini**: `Bash("ccw cli -p \"\" --tool gemini --mode write --id issue-")` +- **codex**: `Bash("ccw cli -p \"\" --tool codex --mode write --id issue-", { run_in_background: false })` +- **gemini**: `Bash("ccw cli -p \"\" --tool gemini --mode write --id issue-", { run_in_background: false })` +- **qwen**: `Bash("ccw cli -p \"\" --tool qwen --mode write --id issue-", { run_in_background: false })` On CLI failure, resume: `ccw cli -p "Continue" --resume issue- --tool --mode write` diff --git a/.claude/skills/team-issue/role-specs/integrator.md b/.claude/skills/team-issue/role-specs/integrator.md index 8cf7c28f..2e38f023 100644 --- a/.claude/skills/team-issue/role-specs/integrator.md +++ b/.claude/skills/team-issue/role-specs/integrator.md @@ -34,32 +34,25 @@ Bash("ccw issue solutions --json") | All issues bound | Proceed to Phase 3 | | 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({ - subagent_type: "issue-queue-agent", - run_in_background: false, - description: "Form queue for issues", - prompt: " -## Issues to Queue -Issue IDs: +Bash("ccw cli -p \" +PURPOSE: Form execution queue for issues with conflict detection and optimal ordering; success = DAG-based queue with parallel groups written to execution-queue.json -## 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 -## Instructions -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 +MODE: analysis -## Expected Output -Write queue to: .workflow/issues/queue/execution-queue.json -" -}) +CONTEXT: @.workflow/issues/solutions/**/*.json | Memory: Issues to queue: + +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**: diff --git a/.claude/skills/team-issue/role-specs/planner.md b/.claude/skills/team-issue/role-specs/planner.md index b30fc5cc..b92fa436 100644 --- a/.claude/skills/team-issue/role-specs/planner.md +++ b/.claude/skills/team-issue/role-specs/planner.md @@ -35,39 +35,38 @@ Read("/explorations/context-.json") - Design alternative approach addressing reviewer concerns 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({ - subagent_type: "issue-plan-agent", - run_in_background: false, - description: "Plan solution for ", - prompt: " -issue_ids: [\"\"] -project_root: \"\" +Bash("ccw cli -p \" +PURPOSE: Design solution for issue and decompose into implementation tasks; success = solution bound to issue with task breakdown -## 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 - (Priority: ) +Explorer findings: Relevant files: -Key findings: Complexity: -## Revision Required (if SOLVE-fix) -Previous solution was rejected by reviewer. Feedback: - +EXPECTED: Solution JSON with: issue_id, solution_id, approach, tasks (ordered list with descriptions), estimated_files, dependencies +Write to: /solutions/solution-.json +Then bind: ccw issue bind -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 | -|-------|-------------| -| `bound` | Array of auto-bound solutions: `[{issue_id, solution_id, task_count}]` | -| `pending_selection` | Array of multi-solution issues: `[{issue_id, solutions: [...]}]` | +**Parse result**: + +``` +Read("/solutions/solution-.json") +``` ## Phase 4: Solution Selection & Reporting diff --git a/.claude/skills/team-lifecycle/role-specs/analyst.md b/.claude/skills/team-lifecycle/role-specs/analyst.md index 49ac0055..95f2e710 100644 --- a/.claude/skills/team-lifecycle/role-specs/analyst.md +++ b/.claude/skills/team-lifecycle/role-specs/analyst.md @@ -3,7 +3,7 @@ role: analyst prefix: RESEARCH inner_loop: false discuss_rounds: [DISCUSS-001] -subagents: [explore, discuss] +subagents: [discuss] message_types: success: research_ready 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 | | No project files | Skip → codebase context = null | -**When project detected**: Call explore subagent with `angle: general`, `keywords: `. +**When project detected**: Use CLI exploration with Gemini. ``` -Agent({ - subagent_type: "cli-explore-agent", - run_in_background: false, - description: "Explore general context", - prompt: "Explore codebase for: \nFocus angle: general\nKeywords: \nSession folder: \n..." +Bash({ + command: `ccw cli -p "PURPOSE: Explore codebase for general context to inform spec generation +TASK: • Identify tech stack and frameworks • Map architecture patterns • Document conventions • List integration points +MODE: analysis +CONTEXT: @**/* | Memory: Seed analysis 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 @@ -89,5 +92,5 @@ Handle discuss verdict per team-worker consensus handling protocol. | Gemini CLI failure | Fallback to direct Claude analysis | | Codebase detection failed | Continue as new project | | 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 | diff --git a/.claude/skills/team-lifecycle/role-specs/executor.md b/.claude/skills/team-lifecycle/role-specs/executor.md index bb5d74ad..2bde3195 100644 --- a/.claude/skills/team-lifecycle/role-specs/executor.md +++ b/.claude/skills/team-lifecycle/role-specs/executor.md @@ -42,9 +42,9 @@ message_types: | Backend | Invocation | Use Case | |---------|-----------|----------| -| agent | `Agent({ subagent_type: "code-developer", run_in_background: false })` | Simple, direct edits | -| codex | `ccw cli --tool codex --mode write` (background) | Complex, architecture | -| gemini | `ccw cli --tool gemini --mode write` (background) | Analysis-heavy | +| gemini | `ccw cli --tool gemini --mode write` (foreground) | Simple, direct edits | +| codex | `ccw cli --tool codex --mode write` (foreground) | Complex, architecture | +| qwen | `ccw cli --tool qwen --mode write` (foreground) | Alternative backend | ## Phase 4: Self-Validation @@ -63,5 +63,5 @@ message_types: |----------|------------| | Syntax errors | Retry with error context (max 3) | | Missing dependencies | Request from coordinator | -| Backend unavailable | Fallback to agent | +| Backend unavailable | Fallback to alternative tool | | Circular dependencies | Abort, report graph | diff --git a/.claude/skills/team-lifecycle/role-specs/fe-developer.md b/.claude/skills/team-lifecycle/role-specs/fe-developer.md index 96aa878c..6bc6811d 100644 --- a/.claude/skills/team-lifecycle/role-specs/fe-developer.md +++ b/.claude/skills/team-lifecycle/role-specs/fe-developer.md @@ -42,8 +42,8 @@ message_types: | Task Size | Strategy | |-----------|----------| -| Simple (<= 3 files, single component) | `Agent({ subagent_type: "code-developer", run_in_background: false })` | -| Complex (system, multi-component) | `ccw cli --tool gemini --mode write` (background) | +| Simple (<= 3 files, single component) | `ccw cli --tool gemini --mode write` (foreground) | +| Complex (system, multi-component) | `ccw cli --tool codex --mode write` (foreground) | **Coding standards** (include in agent/CLI prompt): - 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 | | Tech stack undetected | Default HTML + CSS | -| Subagent failure | Fallback to CLI write mode | +| CLI failure | Retry with alternative tool | diff --git a/.claude/skills/team-lifecycle/role-specs/planner.md b/.claude/skills/team-lifecycle/role-specs/planner.md index c3781321..0514691e 100644 --- a/.claude/skills/team-lifecycle/role-specs/planner.md +++ b/.claude/skills/team-lifecycle/role-specs/planner.md @@ -3,7 +3,7 @@ role: planner prefix: PLAN inner_loop: true discuss_rounds: [] -subagents: [explore] +subagents: [] message_types: success: plan_ready revision: plan_revision @@ -30,14 +30,17 @@ If `/spec/` exists → load requirements/_index.md, architecture | Medium | 200-500 chars or moderate scope | 2-3 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({ - subagent_type: "cli-explore-agent", - run_in_background: false, - description: "Explore ", - prompt: "Explore codebase for: \nFocus angle: \nKeywords: \nSession folder: \n..." +Bash({ + command: `ccw cli -p "PURPOSE: Explore codebase from perspective to inform planning +TASK: • Search for -specific patterns • Identify relevant files • Document integration points +MODE: analysis +CONTEXT: @**/* | Memory: Task keywords: +EXPECTED: JSON with: relevant_files[], patterns[], integration_points[], recommendations[] +CONSTRAINTS: Focus on 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 | | Medium/High | cli-lite-planning-agent with exploration results | -**Agent call** (Medium/High): +**CLI call** (Medium/High): ``` -Agent({ - subagent_type: "cli-lite-planning-agent", - run_in_background: false, - description: "Generate implementation plan", - prompt: "Generate plan. -Output: /plan.json + /.task/TASK-*.json -Schema: cat ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json -Task: -Explorations: -Complexity: -Requirements: 2-7 tasks with id, title, files[].change, convergence.criteria, depends_on" +Bash({ + command: `ccw cli -p "PURPOSE: Generate structured implementation plan from exploration results +TASK: • Create plan.json with overview • Generate TASK-*.json files (2-7 tasks) • Define dependencies • Set convergence criteria +MODE: write +CONTEXT: @/explorations/*.json | Memory: Complexity: +EXPECTED: Files: plan.json + .task/TASK-*.json. Schema: ~/.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`, + run_in_background: false }) ``` @@ -91,8 +91,8 @@ Requirements: 2-7 tasks with id, title, files[].change, convergence.criteria, de | Scenario | Resolution | |----------|------------| -| Exploration agent failure | Plan from description only | -| Planning agent failure | Fallback to direct planning | +| CLI exploration failure | Plan from description only | +| CLI planning failure | Fallback to direct planning | | Plan rejected 3+ times | Notify coordinator, suggest alternative | | Schema not found | Use basic structure | | Cache index corrupt | Clear cache, re-explore all angles | diff --git a/.claude/skills/team-lifecycle/role-specs/writer.md b/.claude/skills/team-lifecycle/role-specs/writer.md index 51bd1fe6..22452e3c 100644 --- a/.claude/skills/team-lifecycle/role-specs/writer.md +++ b/.claude/skills/team-lifecycle/role-specs/writer.md @@ -3,7 +3,7 @@ role: writer prefix: DRAFT inner_loop: true discuss_rounds: [DISCUSS-002, DISCUSS-003, DISCUSS-004, DISCUSS-005] -subagents: [discuss, doc-generation] +subagents: [discuss] message_types: success: draft_ready revision: draft_revision @@ -56,42 +56,23 @@ message_types: ## 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({ - subagent_type: "universal-executor", - run_in_background: false, - description: "Generate document", - prompt: ` - -## Task -- Document type: -- Session folder: -- Template: - -## Context -- Spec config: -- Discovery context: -- Prior discussion feedback: -- Prior decisions (from writer accumulator): - - -## Expected Output -Return JSON: -{ - "artifact_path": "", - "summary": "<100-200 char summary>", - "key_decisions": ["", ...], - "sections_generated": ["", ...], - "warnings": [""] -}` +Bash({ + command: `ccw cli -p "PURPOSE: Generate document following template and standards +TASK: • Load template from • Apply spec config and discovery context • Integrate prior discussion feedback • Generate all required sections +MODE: write +CONTEXT: @/spec/*.json @ | Memory: Prior decisions: +EXPECTED: Document at with: YAML frontmatter, all template sections, cross-references, session_id +CONSTRAINTS: Follow document-standards.md" --tool gemini --mode write --rule development-implement-feature --cd `, + run_in_background: false }) ``` -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 @@ -119,7 +100,7 @@ Handle discuss verdict per team-worker consensus handling protocol. | 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 | | Cumulative 3 task failures | SendMessage to coordinator, STOP | | Prior doc not found | Notify coordinator, request prerequisite | diff --git a/.claude/skills/team-planex/SKILL.md b/.claude/skills/team-planex/SKILL.md index 77bc9afe..1acf304b 100644 --- a/.claude/skills/team-planex/SKILL.md +++ b/.claude/skills/team-planex/SKILL.md @@ -99,11 +99,10 @@ When coordinator needs to execute a command (dispatch, monitor): ## Execution Method Selection -支持 3 种执行后端: +支持 2 种执行后端: | Executor | 后端 | 适用场景 | |----------|------|----------| -| `agent` | code-developer subagent | 简单任务、同步执行 | | `codex` | `ccw cli --tool codex --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 | |-----------|-----------------| -| `--exec=agent` specified | Agent | | `--exec=codex` specified | Codex | | `--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 | -| Auto + task_count <= 3 | Agent | +| Auto + task_count <= 3 | Gemini | | Auto + task_count > 3 | Codex | --- diff --git a/.claude/skills/team-planex/role-specs/executor.md b/.claude/skills/team-planex/role-specs/executor.md index 6305168e..4af565ac 100644 --- a/.claude/skills/team-planex/role-specs/executor.md +++ b/.claude/skills/team-planex/role-specs/executor.md @@ -30,37 +30,26 @@ Single-issue implementation agent. Loads solution from artifact file, routes to ### Backend Selection -| Method | Backend | Agent Type | -|--------|---------|------------| -| `agent` | code-developer subagent | Inline delegation | +| Method | Backend | CLI Tool | +|--------|---------|----------| | `codex` | `ccw cli --tool codex --mode write` | Background CLI | | `gemini` | `ccw cli --tool gemini --mode write` | Background CLI | -### Agent Backend - -``` -Agent({ - subagent_type: "code-developer", - description: "Implement ", - prompt: `Issue: -Title: -Solution: -Implement all tasks from the solution plan.`, - run_in_background: false -}) -``` - ### CLI Backend (Codex/Gemini) ```bash -ccw cli -p "Issue: +ccw cli -p "PURPOSE: Implement solution for issue ; success = all tasks completed, tests pass +TASK: +MODE: write +CONTEXT: @**/* | Memory: Session wisdom from /wisdom/ +EXPECTED: Working implementation with: code changes, test updates, no syntax errors +CONSTRAINTS: Follow existing patterns | Maintain backward compatibility +Issue: Title: -Solution Plan: -Implement all tasks. Follow existing patterns. Run tests." \ - --tool --mode write +Solution: " --tool --mode write --rule development-implement-feature ``` -Wait for CLI completion before proceeding. +Wait for CLI completion before proceeding to verification. ## Phase 4: Verification + Commit @@ -95,7 +84,7 @@ Send `impl_complete` message to coordinator via team_msg + SendMessage. | Allowed | Prohibited | |---------|-----------| | Load solution from file | Create or modify issues | -| Implement via Agent/Codex/Gemini | Modify solution artifacts | -| Run tests | Spawn additional agents | +| Implement via CLI tools (Codex/Gemini) | Modify solution artifacts | +| Run tests | Spawn subagents (use CLI tools instead) | | git commit | Direct user interaction | | Update issue status | Create tasks for other roles | diff --git a/.claude/skills/team-planex/role-specs/planner.md b/.claude/skills/team-planex/role-specs/planner.md index 4ebfd40c..efe59ccb 100644 --- a/.claude/skills/team-planex/role-specs/planner.md +++ b/.claude/skills/team-planex/role-specs/planner.md @@ -1,7 +1,6 @@ --- prefix: PLAN inner_loop: true -subagents: [issue-plan-agent] message_types: success: issue_ready error: error @@ -36,18 +35,19 @@ For each issue, execute in sequence: ### 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 ; 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 /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", - description: "Plan issue ", - prompt: `issue_ids: [""] -project_root: "" -Generate solution for this issue. Auto-bind single solution.`, - run_in_background: false -}) -``` + +Parse CLI output to extract solution JSON. If CLI fails, fallback to `ccw issue solution --json`. ### 3b. Write Solution Artifact diff --git a/.claude/skills/team-testing/role-specs/executor.md b/.claude/skills/team-testing/role-specs/executor.md index 5209cf35..c22829d1 100644 --- a/.claude/skills/team-testing/role-specs/executor.md +++ b/.claude/skills/team-testing/role-specs/executor.md @@ -59,11 +59,16 @@ Bash(" 2>&1 || true") **Auto-fix delegation** (on failure): ``` -Agent({ - subagent_type: "code-developer", - run_in_background: false, - description: "Fix test failures (iteration )", - prompt: "Fix these test failures:\n\nOnly fix test files, not source code." +Bash({ + command: `ccw cli -p "PURPOSE: Fix test failures to achieve pass rate >= 0.95; success = all tests pass +TASK: • Analyze test failure output • Identify root causes • Fix test code only (not source) • Preserve test intent +MODE: write +CONTEXT: @//**/* | Memory: Test framework: , iteration /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: +" --tool gemini --mode write --cd `, + run_in_background: false }) ``` diff --git a/.claude/skills/team-testing/role-specs/generator.md b/.claude/skills/team-testing/role-specs/generator.md index 49665dbe..c70803fc 100644 --- a/.claude/skills/team-testing/role-specs/generator.md +++ b/.claude/skills/team-testing/role-specs/generator.md @@ -58,17 +58,21 @@ For revision mode: 2. Generate test code: happy path, edge cases, error handling 3. Write test file -**Agent delegation** (medium/high complexity): +**CLI delegation** (medium/high complexity): ``` -Agent({ - subagent_type: "code-developer", - run_in_background: false, - description: "Generate tests", - prompt: "Generate tests using ... - - - Write test files to: /tests//" +Bash({ + command: `ccw cli -p "PURPOSE: Generate tests using to achieve coverage target; success = all priority files covered with quality tests +TASK: • Analyze source files • Generate test cases (happy path, edge cases, errors) • Write test files with proper structure • Ensure import resolution +MODE: write +CONTEXT: @ @/strategy/test-strategy.md | Memory: Framework: , Layer: , Round: + +Effective patterns: > +EXPECTED: Test files in /tests// with: proper test structure, comprehensive coverage, correct imports, framework conventions +CONSTRAINTS: Follow test strategy priorities | Use framework best practices | -appropriate assertions +Source files to test: +" --tool gemini --mode write --cd `, + run_in_background: false }) ``` diff --git a/.claude/skills/team-ultra-analyze/role-specs/discussant.md b/.claude/skills/team-ultra-analyze/role-specs/discussant.md index efd20c76..d480dd3a 100644 --- a/.claude/skills/team-ultra-analyze/role-specs/discussant.md +++ b/.claude/skills/team-ultra-analyze/role-specs/discussant.md @@ -1,7 +1,7 @@ --- prefix: DISCUSS inner_loop: false -subagents: [cli-explore-agent] +subagents: [] message_types: success: discussion_processed 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. -**deepen**: Spawn cli-explore-agent focused on open questions and uncertain insights: -``` -Agent({ - subagent_type: "cli-explore-agent", - run_in_background: false, - prompt: "Focus on open questions: . Find evidence for uncertain insights. Write to: /discussions/deepen-.json" +**deepen**: Use CLI tool for deep investigation: +```javascript +Bash({ + command: `ccw cli -p "PURPOSE: Investigate open questions and uncertain insights; success = evidence-based findings +TASK: • Focus on open questions: • Find supporting evidence • Validate uncertain insights • Document findings +MODE: analysis +CONTEXT: @**/* | Memory: Session , previous analyses +EXPECTED: JSON output with investigation results | Write to /discussions/deepen-.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: -``` -ccw cli -p "Re-analyze '' with adjusted focus on ''" --tool gemini --mode analysis +```javascript +Bash({ + command: `ccw cli -p "Re-analyze '' with adjusted focus on ''" --tool gemini --mode analysis`, + run_in_background: false +}) ``` -**specific-questions**: Spawn cli-explore-agent targeting user's questions: -``` -Agent({ - subagent_type: "cli-explore-agent", - description: "Answer specific user questions", - run_in_background: false, - prompt: "Answer: . Write to: /discussions/questions-.json" +**specific-questions**: Use CLI tool for targeted Q&A: +```javascript +Bash({ + command: `ccw cli -p "PURPOSE: Answer specific user questions about ; success = clear, evidence-based answers +TASK: • Answer: • Provide code references • Explain context +MODE: analysis +CONTEXT: @**/* | Memory: Session +EXPECTED: JSON output with answers and evidence | Write to /discussions/questions-.json +CONSTRAINTS: Direct answers with code references +" --tool gemini --mode analysis`, + run_in_background: false }) ``` diff --git a/.claude/skills/team-ultra-analyze/role-specs/explorer.md b/.claude/skills/team-ultra-analyze/role-specs/explorer.md index bca28818..e42d9e8f 100644 --- a/.claude/skills/team-ultra-analyze/role-specs/explorer.md +++ b/.claude/skills/team-ultra-analyze/role-specs/explorer.md @@ -1,7 +1,7 @@ --- prefix: EXPLORE inner_loop: false -subagents: [cli-explore-agent] +subagents: [] message_types: success: exploration_ready error: error @@ -40,39 +40,23 @@ Explore codebase structure through cli-explore-agent, collecting structured cont ## Phase 3: Codebase Exploration -Spawn `cli-explore-agent` subagent for actual exploration: +Use CLI tool for codebase exploration: -``` -Agent({ - subagent_type: "cli-explore-agent", - run_in_background: false, - description: "Explore codebase: ()", - prompt: ` -## Analysis Context -Topic: -Perspective: -- -Dimensions: -Session: - -## 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 ( angle) - - -## Output -Write findings to: /explorations/exploration-.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} } -` +```javascript +Bash({ + command: `ccw cli -p "PURPOSE: Explore codebase for from perspective; success = structured findings with relevant files and patterns +TASK: • Run module depth analysis • Search for topic-related patterns • Identify key files and their relationships • Extract architectural insights +MODE: analysis +CONTEXT: @**/* | Memory: Session , perspective +EXPECTED: JSON output with: relevant_files (path, relevance, summary), patterns, key_findings, module_map, questions_for_analysis, _metadata (perspective, search_queries, timestamp) +CONSTRAINTS: Focus on angle - | Write to /explorations/exploration-.json +" --tool gemini --mode analysis --rule analysis-analyze-code-patterns`, + run_in_background: false }) ``` -**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: " " }) ```