Compare commits

...

5 Commits

Author SHA1 Message Date
catlog22
09114f59c8 fix: Complete lite-fix command with diagnosis workflow and schemas
- Add lite-fix.md command based on lite-plan.md structure
- Create diagnosis-json-schema.json for bug diagnosis results
- Create fix-plan-json-schema.json for fix planning
- Update intelligent-tools-strategy.md: simplify model selection, add 5min minimum timeout
- Fix missing _metadata.diagnosis_index in agent prompt
- Clarify --hotfix mode skip behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 11:18:48 +08:00
catlog22
72099ae951 fix: Update agent calls in documentation to reflect changes from gemini-wrapper to gemini 2025-11-29 10:40:36 +08:00
catlog22
d66064024c refactor: Optimize context-gather workflow with Synthesis role clarification
- Rename Track 0 from 'Exploration Aggregation' to 'Exploration Synthesis'
- Add explicit synthesis logic for critical_files prioritization and deduplication
- Enhance explore-json-schema to support relevance scores in relevant_files
- Update explore agent prompts across context-gather and lite-plan commands
- Add synthesizeCriticalFiles and synthesizeConflictIndicators helper functions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 10:38:04 +08:00
catlog22
8c93848303 refactor: Enhance cli-explore-agent prompt in context-gather
Align with lite-plan.md prompt structure:
- Add detailed Task Objective with angle-specific analysis
- Add MANDATORY FIRST STEPS with explicit ordered commands
- Add 3-step Exploration Strategy (Structural Scan, Semantic Analysis, Write Output)
- Add detailed Expected Output with Required Fields
- Add Success Criteria checklist for validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 23:10:06 +08:00
catlog22
57a86ab36f feat: Add parallel explore agents to context-gather workflow
- context-gather.md: Add Step 2 with complexity assessment (Low/Medium/High)
  and parallel cli-explore-agent execution (1-4 agents based on complexity)
- context-search-agent.md: Add Track 0 for exploration aggregation with
  exploration_results schema including all_patterns and all_integration_points
- conflict-resolution.md: Consume exploration_results for enhanced conflict
  detection with pre-identified conflict indicators
- task-generate-agent.md: Use exploration critical_files for focus_paths
  and all_patterns/all_integration_points for implementation guidance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 23:08:20 +08:00
14 changed files with 1341 additions and 748 deletions

View File

@@ -100,10 +100,88 @@ if (!memory.has("README.md")) Read(README.md)
### Phase 2: Multi-Source Context Discovery
Execute all 3 tracks in parallel for comprehensive coverage.
Execute all tracks in parallel for comprehensive coverage.
**Note**: Historical archive analysis (querying `.workflow/archives/manifest.json`) is optional and should be performed if the manifest exists. Inject findings into `conflict_detection.historical_conflicts[]`.
#### Track 0: Exploration Synthesis (Optional)
**Trigger**: When `explorations-manifest.json` exists in session `.process/` folder
**Purpose**: Transform raw exploration data into prioritized, deduplicated insights. This is NOT simple aggregation - it synthesizes `critical_files` (priority-ranked), deduplicates patterns/integration_points, and generates `conflict_indicators`.
```javascript
// Check for exploration results from context-gather parallel explore phase
const manifestPath = `.workflow/active/${session_id}/.process/explorations-manifest.json`;
if (file_exists(manifestPath)) {
const manifest = JSON.parse(Read(manifestPath));
// Load full exploration data from each file
const explorationData = manifest.explorations.map(exp => ({
...exp,
data: JSON.parse(Read(exp.path))
}));
// Build explorations array with summaries
const explorations = explorationData.map(exp => ({
angle: exp.angle,
file: exp.file,
path: exp.path,
index: exp.data._metadata?.exploration_index || exp.index,
summary: {
relevant_files_count: exp.data.relevant_files?.length || 0,
key_patterns: exp.data.patterns,
integration_points: exp.data.integration_points
}
}));
// SYNTHESIS (not aggregation): Transform raw data into prioritized insights
const aggregated_insights = {
// CRITICAL: Synthesize priority-ranked critical_files from multiple relevant_files lists
// - Deduplicate by path
// - Rank by: mention count across angles + individual relevance scores
// - Top 10-15 files only (focused, actionable)
critical_files: synthesizeCriticalFiles(explorationData.flatMap(e => e.data.relevant_files || [])),
// SYNTHESIS: Generate conflict indicators from pattern mismatches, constraint violations
conflict_indicators: synthesizeConflictIndicators(explorationData),
// Deduplicate clarification questions (merge similar questions)
clarification_needs: deduplicateQuestions(explorationData.flatMap(e => e.data.clarification_needs || [])),
// Preserve source attribution for traceability
constraints: explorationData.map(e => ({ constraint: e.data.constraints, source_angle: e.angle })).filter(c => c.constraint),
// Deduplicate patterns across angles (merge identical patterns)
all_patterns: deduplicatePatterns(explorationData.map(e => ({ patterns: e.data.patterns, source_angle: e.angle }))),
// Deduplicate integration points (merge by file:line location)
all_integration_points: deduplicateIntegrationPoints(explorationData.map(e => ({ points: e.data.integration_points, source_angle: e.angle })))
};
// Store for Phase 3 packaging
exploration_results = { manifest_path: manifestPath, exploration_count: manifest.exploration_count,
complexity: manifest.complexity, angles: manifest.angles_explored,
explorations, aggregated_insights };
}
// Synthesis helper functions (conceptual)
function synthesizeCriticalFiles(allRelevantFiles) {
// 1. Group by path
// 2. Count mentions across angles
// 3. Average relevance scores
// 4. Rank by: (mention_count * 0.6) + (avg_relevance * 0.4)
// 5. Return top 10-15 with mentioned_by_angles attribution
}
function synthesizeConflictIndicators(explorationData) {
// 1. Detect pattern mismatches across angles
// 2. Identify constraint violations
// 3. Flag files mentioned with conflicting integration approaches
// 4. Assign severity: critical/high/medium/low
}
```
#### Track 1: Reference Documentation
Extract from Phase 0 loaded docs:
@@ -393,10 +471,39 @@ Calculate risk level based on:
},
"affected_modules": ["auth", "user-model", "middleware"],
"mitigation_strategy": "Incremental refactoring with backward compatibility"
},
"exploration_results": {
"manifest_path": ".workflow/active/{session}/.process/explorations-manifest.json",
"exploration_count": 3,
"complexity": "Medium",
"angles": ["architecture", "dependencies", "testing"],
"explorations": [
{
"angle": "architecture",
"file": "exploration-architecture.json",
"path": ".workflow/active/{session}/.process/exploration-architecture.json",
"index": 1,
"summary": {
"relevant_files_count": 5,
"key_patterns": "Service layer with DI",
"integration_points": "Container.registerService:45-60"
}
}
],
"aggregated_insights": {
"critical_files": [{"path": "src/auth/AuthService.ts", "relevance": 0.95, "mentioned_by_angles": ["architecture"]}],
"conflict_indicators": [{"type": "pattern_mismatch", "description": "...", "source_angle": "architecture", "severity": "medium"}],
"clarification_needs": [{"question": "...", "context": "...", "options": [], "source_angle": "architecture"}],
"constraints": [{"constraint": "Must follow existing DI pattern", "source_angle": "architecture"}],
"all_patterns": [{"patterns": "Service layer with DI", "source_angle": "architecture"}],
"all_integration_points": [{"points": "Container.registerService:45-60", "source_angle": "architecture"}]
}
}
}
```
**Note**: `exploration_results` is populated when exploration files exist (from context-gather parallel explore phase). If no explorations, this field is omitted or empty.
## Quality Validation

File diff suppressed because it is too large Load Diff

View File

@@ -196,9 +196,12 @@ Execute **${angle}** exploration for task planning context. Analyze codebase fro
**Required Fields** (all ${angle} focused):
- project_structure: Modules/architecture relevant to ${angle}
- relevant_files: Files affected from ${angle} perspective
**IMPORTANT**: Use object format with relevance scores for synthesis:
\`[{path: "src/file.ts", relevance: 0.85, rationale: "Core ${angle} logic"}]\`
Scores: 0.7+ high priority, 0.5-0.7 medium, <0.5 low
- patterns: ${angle}-related patterns to follow
- dependencies: Dependencies relevant to ${angle}
- integration_points: Where to integrate from ${angle} viewpoint
- integration_points: Where to integrate from ${angle} viewpoint (include file:line locations)
- constraints: ${angle}-specific limitations/conventions
- clarification_needs: ${angle}-related ambiguities (with options array)
- _metadata.exploration_angle: "${angle}"

View File

@@ -114,35 +114,44 @@ Task(subagent_type="cli-execution-agent", prompt=`
- Risk: {conflict_risk}
- Files: {existing_files_list}
## Exploration Context (from context-package.exploration_results)
- Exploration Count: ${contextPackage.exploration_results?.exploration_count || 0}
- Angles Analyzed: ${JSON.stringify(contextPackage.exploration_results?.angles || [])}
- Pre-identified Conflict Indicators: ${JSON.stringify(contextPackage.exploration_results?.aggregated_insights?.conflict_indicators || [])}
- Critical Files: ${JSON.stringify(contextPackage.exploration_results?.aggregated_insights?.critical_files?.map(f => f.path) || [])}
- All Patterns: ${JSON.stringify(contextPackage.exploration_results?.aggregated_insights?.all_patterns || [])}
- All Integration Points: ${JSON.stringify(contextPackage.exploration_results?.aggregated_insights?.all_integration_points || [])}
## Analysis Steps
### 1. Load Context
- Read existing files from conflict_detection.existing_files
- Load plan from .workflow/active/{session_id}/.process/context-package.json
- **NEW**: Load exploration_results and use aggregated_insights for enhanced analysis
- Extract role analyses and requirements
### 2. Execute CLI Analysis (Enhanced with Scenario Uniqueness Detection)
### 2. Execute CLI Analysis (Enhanced with Exploration + Scenario Uniqueness)
Primary (Gemini):
cd {project_root} && gemini -p "
PURPOSE: Detect conflicts between plan and codebase, including module scenario overlaps
PURPOSE: Detect conflicts between plan and codebase, using exploration insights
TASK:
Compare architectures
**Review pre-identified conflict_indicators from exploration results**
• Compare architectures (use exploration key_patterns)
• Identify breaking API changes
• Detect data model incompatibilities
• Assess dependency conflicts
• **NEW: Analyze module scenario uniqueness**
- Extract new module functionality from plan
- Search all existing modules with similar functionality
- Compare scenario coverage and identify overlaps
• **Analyze module scenario uniqueness**
- Use exploration integration_points for precise locations
- Cross-validate with exploration critical_files
- Generate clarification questions for boundary definition
MODE: analysis
CONTEXT: @**/*.ts @**/*.js @**/*.tsx @**/*.jsx @.workflow/active/{session_id}/**/*
EXPECTED: Conflict list with severity ratings, including ModuleOverlap conflicts with:
- Existing module list with scenarios
- Overlap analysis matrix
EXPECTED: Conflict list with severity ratings, including:
- Validation of exploration conflict_indicators
- ModuleOverlap conflicts with overlap_analysis
- Targeted clarification questions
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-analyze-code-patterns.txt) | Focus on breaking changes, migration needs, and functional overlaps | analysis=READ-ONLY
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-analyze-code-patterns.txt) | Focus on breaking changes, migration needs, and functional overlaps | Prioritize exploration-identified conflicts | analysis=READ-ONLY
"
Fallback: Qwen (same prompt) → Claude (manual analysis)

View File

@@ -36,24 +36,23 @@ Step 1: Context-Package Detection
├─ Valid package exists → Return existing (skip execution)
└─ No valid package → Continue to Step 2
Step 2: Invoke Context-Search Agent
├─ Phase 1: Initialization & Pre-Analysis
│ ├─ Load project.json as primary context
│ ├─ Initialize code-index
│ └─ Classify complexity
Phase 2: Multi-Source Discovery
│ ├─ Track 1: Historical archive analysis
│ ├─ Track 2: Reference documentation
│ ├─ Track 3: Web examples (Exa MCP)
│ └─ Track 4: Codebase analysis (5-layer)
└─ Phase 3: Synthesis & Packaging
├─ Apply relevance scoring
├─ Integrate brainstorm artifacts
├─ Perform conflict detection
└─ Generate context-package.json
Step 2: Complexity Assessment & Parallel Explore (NEW)
├─ Analyze task_description → classify Low/Medium/High
├─ Select exploration angles (1-4 based on complexity)
├─ Launch N cli-explore-agents in parallel
│ └─ Each outputs: exploration-{angle}.json
Generate explorations-manifest.json
Step 3: Output Verification
Verify context-package.json created
Step 3: Invoke Context-Search Agent (with exploration input)
Phase 1: Initialization & Pre-Analysis
├─ Phase 2: Multi-Source Discovery
│ ├─ Track 0: Exploration Synthesis (prioritize & deduplicate)
│ ├─ Track 1-4: Existing tracks
└─ Phase 3: Synthesis & Packaging
└─ Generate context-package.json with exploration_results
Step 4: Output Verification
└─ Verify context-package.json contains exploration_results
```
## Execution Flow
@@ -80,10 +79,139 @@ if (file_exists(contextPackagePath)) {
}
```
### Step 2: Invoke Context-Search Agent
### Step 2: Complexity Assessment & Parallel Explore
**Only execute if Step 1 finds no valid package**
```javascript
// 2.1 Complexity Assessment
function analyzeTaskComplexity(taskDescription) {
const text = taskDescription.toLowerCase();
if (/architect|refactor|restructure|modular|cross-module/.test(text)) return 'High';
if (/multiple|several|integrate|migrate|extend/.test(text)) return 'Medium';
return 'Low';
}
const ANGLE_PRESETS = {
architecture: ['architecture', 'dependencies', 'modularity', 'integration-points'],
security: ['security', 'auth-patterns', 'dataflow', 'validation'],
performance: ['performance', 'bottlenecks', 'caching', 'data-access'],
bugfix: ['error-handling', 'dataflow', 'state-management', 'edge-cases'],
feature: ['patterns', 'integration-points', 'testing', 'dependencies'],
refactor: ['architecture', 'patterns', 'dependencies', 'testing']
};
function selectAngles(taskDescription, complexity) {
const text = taskDescription.toLowerCase();
let preset = 'feature';
if (/refactor|architect|restructure/.test(text)) preset = 'architecture';
else if (/security|auth|permission/.test(text)) preset = 'security';
else if (/performance|slow|optimi/.test(text)) preset = 'performance';
else if (/fix|bug|error|issue/.test(text)) preset = 'bugfix';
const count = complexity === 'High' ? 4 : (complexity === 'Medium' ? 3 : 1);
return ANGLE_PRESETS[preset].slice(0, count);
}
const complexity = analyzeTaskComplexity(task_description);
const selectedAngles = selectAngles(task_description, complexity);
const sessionFolder = `.workflow/active/${session_id}/.process`;
// 2.2 Launch Parallel Explore Agents
const explorationTasks = selectedAngles.map((angle, index) =>
Task(
subagent_type="cli-explore-agent",
description=`Explore: ${angle}`,
prompt=`
## Task Objective
Execute **${angle}** exploration for task planning context. Analyze codebase from this specific angle to discover relevant structure, patterns, and constraints.
## Assigned Context
- **Exploration Angle**: ${angle}
- **Task Description**: ${task_description}
- **Session ID**: ${session_id}
- **Exploration Index**: ${index + 1} of ${selectedAngles.length}
- **Output File**: ${sessionFolder}/exploration-${angle}.json
## MANDATORY FIRST STEPS (Execute by Agent)
**You (cli-explore-agent) MUST execute these steps in order:**
1. Run: ~/.claude/scripts/get_modules_by_depth.sh (project structure)
2. Run: rg -l "{keyword_from_task}" --type ts (locate relevant files)
3. Execute: cat ~/.claude/workflows/cli-templates/schemas/explore-json-schema.json (get output schema reference)
## Exploration Strategy (${angle} focus)
**Step 1: Structural Scan** (Bash)
- get_modules_by_depth.sh → identify modules related to ${angle}
- find/rg → locate files relevant to ${angle} aspect
- Analyze imports/dependencies from ${angle} perspective
**Step 2: Semantic Analysis** (Gemini CLI)
- How does existing code handle ${angle} concerns?
- What patterns are used for ${angle}?
- Where would new code integrate from ${angle} viewpoint?
**Step 3: Write Output**
- Consolidate ${angle} findings into JSON
- Identify ${angle}-specific clarification needs
## Expected Output
**File**: ${sessionFolder}/exploration-${angle}.json
**Schema Reference**: Schema obtained in MANDATORY FIRST STEPS step 3, follow schema exactly
**Required Fields** (all ${angle} focused):
- project_structure: Modules/architecture relevant to ${angle}
- relevant_files: Files affected from ${angle} perspective
**IMPORTANT**: Use object format with relevance scores for synthesis:
\`[{path: "src/file.ts", relevance: 0.85, rationale: "Core ${angle} logic"}]\`
Scores: 0.7+ high priority, 0.5-0.7 medium, <0.5 low
- patterns: ${angle}-related patterns to follow
- dependencies: Dependencies relevant to ${angle}
- integration_points: Where to integrate from ${angle} viewpoint (include file:line locations)
- constraints: ${angle}-specific limitations/conventions
- clarification_needs: ${angle}-related ambiguities (with options array)
- _metadata.exploration_angle: "${angle}"
## Success Criteria
- [ ] Schema obtained via cat explore-json-schema.json
- [ ] get_modules_by_depth.sh executed
- [ ] At least 3 relevant files identified with ${angle} rationale
- [ ] Patterns are actionable (code examples, not generic advice)
- [ ] Integration points include file:line locations
- [ ] Constraints are project-specific to ${angle}
- [ ] JSON output follows schema exactly
- [ ] clarification_needs includes options array
## Output
Write: ${sessionFolder}/exploration-${angle}.json
Return: 2-3 sentence summary of ${angle} findings
`
)
);
// 2.3 Generate Manifest after all complete
const explorationFiles = bash(`find ${sessionFolder} -name "exploration-*.json" -type f`).split('\n').filter(f => f.trim());
const explorationManifest = {
session_id,
task_description,
timestamp: new Date().toISOString(),
complexity,
exploration_count: selectedAngles.length,
angles_explored: selectedAngles,
explorations: explorationFiles.map(file => {
const data = JSON.parse(Read(file));
return { angle: data._metadata.exploration_angle, file: file.split('/').pop(), path: file, index: data._metadata.exploration_index };
})
};
Write(`${sessionFolder}/explorations-manifest.json`, JSON.stringify(explorationManifest, null, 2));
```
### Step 3: Invoke Context-Search Agent
**Only execute after Step 2 completes**
```javascript
Task(
subagent_type="context-search-agent",
@@ -97,6 +225,12 @@ Task(
- **Task Description**: ${task_description}
- **Output Path**: .workflow/${session_id}/.process/context-package.json
## Exploration Input (from Step 2)
- **Manifest**: ${sessionFolder}/explorations-manifest.json
- **Exploration Count**: ${explorationManifest.exploration_count}
- **Angles**: ${explorationManifest.angles_explored.join(', ')}
- **Complexity**: ${complexity}
## Mission
Execute complete context-search-agent workflow for implementation planning:
@@ -107,7 +241,8 @@ Execute complete context-search-agent workflow for implementation planning:
4. **Analysis**: Extract keywords, determine scope, classify complexity based on task description and project state
### Phase 2: Multi-Source Context Discovery
Execute all 4 discovery tracks:
Execute all discovery tracks:
- **Track 0**: Exploration Synthesis (load ${sessionFolder}/explorations-manifest.json, prioritize critical_files, deduplicate patterns/integration_points)
- **Track 1**: Historical archive analysis (query manifest.json for lessons learned)
- **Track 2**: Reference documentation (CLAUDE.md, architecture docs)
- **Track 3**: Web examples (use Exa MCP for unfamiliar tech/APIs)
@@ -130,6 +265,7 @@ Complete context-package.json with:
- **dependencies**: {internal[], external[]} with dependency graph
- **brainstorm_artifacts**: {guidance_specification, role_analyses[], synthesis_output} with content
- **conflict_detection**: {risk_level, risk_factors, affected_modules[], mitigation_strategy, historical_conflicts[]}
- **exploration_results**: {manifest_path, exploration_count, angles, explorations[], aggregated_insights} (from Track 0)
## Quality Validation
Before completion verify:
@@ -146,7 +282,7 @@ Report completion with statistics.
)
```
### Step 3: Output Verification
### Step 4: Output Verification
After agent completes, verify output:
@@ -156,6 +292,12 @@ const outputPath = `.workflow/${session_id}/.process/context-package.json`;
if (!file_exists(outputPath)) {
throw new Error("❌ Agent failed to generate context-package.json");
}
// Verify exploration_results included
const pkg = JSON.parse(Read(outputPath));
if (pkg.exploration_results?.exploration_count > 0) {
console.log(`✅ Exploration results aggregated: ${pkg.exploration_results.exploration_count} angles`);
}
```
## Parameter Reference
@@ -176,6 +318,7 @@ Refer to `context-search-agent.md` Phase 3.7 for complete `context-package.json`
- **dependencies**: Internal and external dependency graphs
- **brainstorm_artifacts**: Brainstorm documents with full content (if exists)
- **conflict_detection**: Risk assessment with mitigation strategies and historical conflicts
- **exploration_results**: Aggregated exploration insights (from parallel explore phase)
## Historical Archive Analysis

View File

@@ -100,12 +100,21 @@ Session ID: {session-id}
Planning Mode: {agent-mode | cli-execute-mode}
MCP Capabilities: {exa_code, exa_web, code_index}
## EXPLORATION CONTEXT (from context-package.exploration_results)
- Load exploration_results from context-package.json
- Use aggregated_insights.critical_files for focus_paths generation
- Apply aggregated_insights.constraints to acceptance criteria
- Reference aggregated_insights.all_patterns for implementation approach
- Use aggregated_insights.all_integration_points for precise modification locations
- Use conflict_indicators for risk-aware task sequencing
## EXPECTED DELIVERABLES
1. Task JSON Files (.task/IMPL-*.json)
- 6-field schema (id, title, status, context_package_path, meta, context, flow_control)
- Quantified requirements with explicit counts
- Artifacts integration from context package
- Flow control with pre_analysis steps
- **focus_paths enhanced with exploration critical_files**
- Flow control with pre_analysis steps (include exploration integration_points analysis)
2. Implementation Plan (IMPL_PLAN.md)
- Context analysis and artifact references

View File

@@ -196,9 +196,12 @@ Execute **${angle}** exploration for task planning context. Analyze codebase fro
**Required Fields** (all ${angle} focused):
- project_structure: Modules/architecture relevant to ${angle}
- relevant_files: Files affected from ${angle} perspective
**IMPORTANT**: Use object format with relevance scores for synthesis:
\`[{path: "src/file.ts", relevance: 0.85, rationale: "Core ${angle} logic"}]\`
Scores: 0.7+ high priority, 0.5-0.7 medium, <0.5 low
- patterns: ${angle}-related patterns to follow
- dependencies: Dependencies relevant to ${angle}
- integration_points: Where to integrate from ${angle} viewpoint
- integration_points: Where to integrate from ${angle} viewpoint (include file:line locations)
- constraints: ${angle}-specific limitations/conventions
- clarification_needs: ${angle}-related ambiguities (with options array)
- _metadata.exploration_angle: "${angle}"

View File

@@ -0,0 +1,234 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Diagnosis Context Schema",
"description": "Bug diagnosis results from cli-explore-agent for root cause analysis",
"type": "object",
"required": [
"symptom",
"root_cause",
"affected_files",
"reproduction_steps",
"fix_hints",
"dependencies",
"constraints",
"clarification_needs",
"_metadata"
],
"properties": {
"symptom": {
"type": "object",
"required": ["description", "error_message"],
"properties": {
"description": {
"type": "string",
"description": "Human-readable description of the bug symptoms"
},
"error_message": {
"type": ["string", "null"],
"description": "Exact error message if available, null if no specific error"
},
"stack_trace": {
"type": ["string", "null"],
"description": "Stack trace excerpt if available"
},
"frequency": {
"type": "string",
"enum": ["always", "intermittent", "rare", "unknown"],
"description": "How often the bug occurs"
},
"user_impact": {
"type": "string",
"description": "How the bug affects end users"
}
},
"description": "Observable symptoms and error manifestation"
},
"root_cause": {
"type": "object",
"required": ["file", "issue", "confidence"],
"properties": {
"file": {
"type": "string",
"description": "File path where the root cause is located"
},
"line_range": {
"type": "string",
"description": "Line range containing the bug (e.g., '45-60')"
},
"function": {
"type": "string",
"description": "Function or method name containing the bug"
},
"issue": {
"type": "string",
"description": "Description of what's wrong in the code"
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Confidence score 0.0-1.0 (0.8+ high, 0.5-0.8 medium, <0.5 low)"
},
"introduced_by": {
"type": "string",
"description": "Commit hash or date when bug was introduced (if known)"
},
"category": {
"type": "string",
"enum": ["logic_error", "edge_case", "race_condition", "null_reference", "type_mismatch", "resource_leak", "validation", "integration", "configuration", "other"],
"description": "Bug category classification"
}
},
"description": "Root cause analysis with confidence score"
},
"affected_files": {
"type": "array",
"items": {
"oneOf": [
{"type": "string"},
{
"type": "object",
"required": ["path", "relevance"],
"properties": {
"path": {"type": "string", "description": "File path relative to project root"},
"relevance": {"type": "number", "minimum": 0, "maximum": 1, "description": "Relevance score 0.0-1.0 (0.7+ high, 0.5-0.7 medium, <0.5 low)"},
"rationale": {"type": "string", "description": "Brief explanation of why this file is affected from this diagnosis angle"},
"change_type": {
"type": "string",
"enum": ["fix_target", "needs_update", "test_coverage", "reference_only"],
"description": "Type of change needed for this file"
}
}
}
]
},
"description": "Files affected by the bug. Prefer object format with relevance scores for synthesis prioritization."
},
"reproduction_steps": {
"type": "array",
"items": {"type": "string"},
"minItems": 1,
"description": "Step-by-step instructions to reproduce the bug"
},
"fix_hints": {
"type": "array",
"items": {
"type": "object",
"required": ["description", "approach"],
"properties": {
"description": {
"type": "string",
"description": "What needs to be fixed"
},
"approach": {
"type": "string",
"description": "Suggested fix approach with specific guidance"
},
"code_example": {
"type": "string",
"description": "Example code snippet showing the fix pattern"
},
"risk": {
"type": "string",
"enum": ["low", "medium", "high"],
"description": "Risk level of implementing this fix"
}
}
},
"description": "Actionable fix suggestions from this diagnosis angle"
},
"dependencies": {
"type": "string",
"description": "External and internal dependencies relevant to the bug"
},
"constraints": {
"type": "string",
"description": "Technical constraints and limitations affecting the fix"
},
"related_issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["similar_bug", "regression", "related_feature", "tech_debt"],
"description": "Relationship type"
},
"reference": {
"type": "string",
"description": "Issue ID, commit hash, or file reference"
},
"description": {
"type": "string",
"description": "Brief description of the relationship"
}
}
},
"description": "Related issues, regressions, or similar bugs found during diagnosis"
},
"clarification_needs": {
"type": "array",
"items": {
"type": "object",
"required": ["question", "context", "options"],
"properties": {
"question": {
"type": "string",
"description": "The clarification question to ask user"
},
"context": {
"type": "string",
"description": "Background context explaining why this clarification is needed"
},
"options": {
"type": "array",
"items": {"type": "string"},
"description": "Available options for user to choose from (2-4 options)"
}
}
},
"description": "Ambiguities requiring user input before fix planning"
},
"_metadata": {
"type": "object",
"required": ["timestamp", "bug_description", "source"],
"properties": {
"timestamp": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp of diagnosis"
},
"bug_description": {
"type": "string",
"description": "Original bug description that triggered diagnosis"
},
"source": {
"type": "string",
"const": "cli-explore-agent",
"description": "Agent that performed diagnosis"
},
"diagnosis_angle": {
"type": "string",
"description": "Diagnosis angle (e.g., 'error-handling', 'dataflow', 'state-management')"
},
"diagnosis_index": {
"type": "integer",
"minimum": 1,
"maximum": 4,
"description": "Diagnosis index (1-4) in parallel diagnosis set"
},
"total_diagnoses": {
"type": "integer",
"minimum": 1,
"maximum": 4,
"description": "Total number of parallel diagnoses"
},
"duration_seconds": {
"type": "integer",
"description": "Diagnosis duration in seconds"
}
}
}
}
}

View File

@@ -20,8 +20,21 @@
},
"relevant_files": {
"type": "array",
"items": {"type": "string"},
"description": "File paths to be modified or referenced for the task"
"items": {
"oneOf": [
{"type": "string"},
{
"type": "object",
"required": ["path", "relevance"],
"properties": {
"path": {"type": "string", "description": "File path relative to project root"},
"relevance": {"type": "number", "minimum": 0, "maximum": 1, "description": "Relevance score 0.0-1.0 (0.7+ high, 0.5-0.7 medium, <0.5 low)"},
"rationale": {"type": "string", "description": "Brief explanation of why this file is relevant from this exploration angle"}
}
}
]
},
"description": "File paths to be modified or referenced for the task. Prefer object format with relevance scores for synthesis prioritization."
},
"patterns": {
"type": "string",

View File

@@ -0,0 +1,273 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Fix Plan Schema",
"description": "Bug fix plan from cli-lite-planning-agent or direct planning",
"type": "object",
"required": [
"summary",
"root_cause",
"strategy",
"tasks",
"estimated_time",
"recommended_execution",
"severity",
"risk_level",
"_metadata"
],
"properties": {
"summary": {
"type": "string",
"description": "2-3 sentence overview of the fix plan"
},
"root_cause": {
"type": "string",
"description": "Consolidated root cause statement from all diagnoses"
},
"strategy": {
"type": "string",
"enum": ["immediate_patch", "comprehensive_fix", "refactor"],
"description": "Fix strategy: immediate_patch (minimal change), comprehensive_fix (proper solution), refactor (structural improvement)"
},
"tasks": {
"type": "array",
"minItems": 1,
"maxItems": 5,
"items": {
"type": "object",
"required": ["id", "title", "scope", "action", "description", "implementation", "verification"],
"properties": {
"id": {
"type": "string",
"pattern": "^FIX[0-9]+$",
"description": "Task identifier (FIX1, FIX2, FIX3...)"
},
"title": {
"type": "string",
"description": "Task title (action verb + target, e.g., 'Fix token validation edge case')"
},
"scope": {
"type": "string",
"description": "Task scope: module path (src/auth/), feature name, or single file. Prefer module level."
},
"file": {
"type": "string",
"description": "Primary file (deprecated, use scope + modification_points instead)"
},
"action": {
"type": "string",
"enum": ["Fix", "Update", "Refactor", "Add", "Delete", "Configure"],
"description": "Primary action type"
},
"description": {
"type": "string",
"description": "What to fix (1-2 sentences)"
},
"modification_points": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": ["file", "target", "change"],
"properties": {
"file": {
"type": "string",
"description": "File path within scope"
},
"target": {
"type": "string",
"description": "Function/class/line range (e.g., 'validateToken:45-60')"
},
"change": {
"type": "string",
"description": "Brief description of change"
}
}
},
"description": "All modification points for this fix task. Group related changes into one task."
},
"implementation": {
"type": "array",
"items": {"type": "string"},
"minItems": 2,
"maxItems": 5,
"description": "Step-by-step fix implementation guide"
},
"verification": {
"type": "array",
"items": {"type": "string"},
"minItems": 1,
"maxItems": 3,
"description": "Verification/test criteria to confirm fix works"
},
"reference": {
"type": "object",
"properties": {
"pattern": {
"type": "string",
"description": "Pattern name to follow"
},
"files": {
"type": "array",
"items": {"type": "string"},
"description": "Reference file paths to study"
},
"examples": {
"type": "string",
"description": "Specific guidance or example references"
}
},
"description": "Reference materials for fix implementation (optional)"
},
"depends_on": {
"type": "array",
"items": {
"type": "string",
"pattern": "^FIX[0-9]+$"
},
"description": "Task IDs this task depends on (e.g., ['FIX1'])"
},
"risk": {
"type": "string",
"enum": ["low", "medium", "high"],
"description": "Risk level of this specific fix task"
}
}
},
"description": "Structured fix task breakdown (1-5 tasks)"
},
"flow_control": {
"type": "object",
"properties": {
"execution_order": {
"type": "array",
"items": {
"type": "object",
"properties": {
"phase": {
"type": "string",
"description": "Phase name (e.g., 'parallel-1', 'sequential-1')"
},
"tasks": {
"type": "array",
"items": {"type": "string"},
"description": "Task IDs in this phase"
},
"type": {
"type": "string",
"enum": ["parallel", "sequential"],
"description": "Execution type"
}
}
},
"description": "Ordered execution phases"
},
"exit_conditions": {
"type": "object",
"properties": {
"success": {
"type": "string",
"description": "Condition for successful fix completion"
},
"failure": {
"type": "string",
"description": "Condition that indicates fix failure"
}
},
"description": "Conditions for fix workflow termination"
}
},
"description": "Execution flow control (optional, auto-inferred from depends_on if not provided)"
},
"focus_paths": {
"type": "array",
"items": {"type": "string"},
"description": "Key file paths affected by this fix (aggregated from tasks)"
},
"test_strategy": {
"type": "object",
"properties": {
"scope": {
"type": "string",
"enum": ["unit", "integration", "e2e", "smoke", "full"],
"description": "Test scope to run after fix"
},
"specific_tests": {
"type": "array",
"items": {"type": "string"},
"description": "Specific test files or patterns to run"
},
"manual_verification": {
"type": "array",
"items": {"type": "string"},
"description": "Manual verification steps if automated tests not available"
}
},
"description": "Testing strategy for fix verification"
},
"rollback_plan": {
"type": "object",
"properties": {
"strategy": {
"type": "string",
"enum": ["git_revert", "feature_flag", "manual"],
"description": "Rollback strategy if fix fails"
},
"steps": {
"type": "array",
"items": {"type": "string"},
"description": "Rollback steps"
}
},
"description": "Rollback plan if fix causes issues (optional, recommended for high severity)"
},
"estimated_time": {
"type": "string",
"description": "Total estimated fix time (e.g., '30 minutes', '2 hours')"
},
"recommended_execution": {
"type": "string",
"enum": ["Agent", "Codex"],
"description": "Recommended execution method based on complexity"
},
"severity": {
"type": "string",
"enum": ["Low", "Medium", "High", "Critical"],
"description": "Bug severity level"
},
"risk_level": {
"type": "string",
"enum": ["low", "medium", "high"],
"description": "Risk level of implementing the fix"
},
"_metadata": {
"type": "object",
"required": ["timestamp", "source"],
"properties": {
"timestamp": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp of planning"
},
"source": {
"type": "string",
"enum": ["cli-lite-planning-agent", "direct-planning"],
"description": "Planning source"
},
"planning_mode": {
"type": "string",
"enum": ["direct", "agent-based"],
"description": "Planning execution mode"
},
"diagnosis_angles": {
"type": "array",
"items": {"type": "string"},
"description": "Diagnosis angles used for context"
},
"duration_seconds": {
"type": "integer",
"description": "Planning duration in seconds"
}
}
}
}
}

View File

@@ -41,20 +41,12 @@ codex -C [dir] --full-auto exec "[prompt]" [--skip-git-repo-check -s danger-full
### Model Selection
**Gemini**:
- `gemini-2.5-pro` - Default model (auto-selected)
- `gemini-2.5-flash` - Fast processing
**Available Models** (user selects via `-m` after prompt):
- Gemini: `gemini-2.5-pro`, `gemini-2.5-flash`
- Qwen: `coder-model`, `vision-model`
- Codex: `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.1-codex-mini`
**Qwen**:
- `coder-model` - Default model (auto-selected)
- `vision-model` - Image analysis (rare)
**Codex**:
- `gpt-5.1` - Default model (auto-selected)
- `gpt-5.1-codex` - Extended capabilities
- `gpt-5.1-codex-mini` - Lightweight tasks
**Note**: All tools auto-select appropriate models. `-m` parameter rarely needed; omit for best results
**Usage**: `-m <model>` placed AFTER `-p "prompt"` (e.g., `gemini -p "..." -m gemini-2.5-flash`)
### Quick Decision Matrix
@@ -582,10 +574,13 @@ prompts/
### Dynamic Timeout Allocation
**Minimum timeout: 5 minutes (300000ms)** - Never set below this threshold.
**Timeout Ranges**:
- **Simple** (analysis, search): 20-40min (1200000-2400000ms)
- **Medium** (refactoring, documentation): 40-60min (2400000-3600000ms)
- **Complex** (implementation, migration): 60-120min (3600000-7200000ms)
- **Simple** (analysis, search): 5-10min (300000-600000ms)
- **Medium** (refactoring, documentation): 10-20min (600000-1200000ms)
- **Complex** (implementation, migration): 20-60min (1200000-3600000ms)
- **Heavy** (large codebase, multi-file): 60-120min (3600000-7200000ms)
**Codex Multiplier**: 1.5x of allocated time

View File

@@ -117,7 +117,7 @@ High-level orchestrators for complex, multi-phase development processes.
- `--type` (Optional, String): The type of review to perform. Defaults to `quality`.
- `session-id` (Optional, String): The session to review. Defaults to the active session.
- **Responsibilities**: Performs a specialized, post-implementation review. This is optional, as the default quality gate is passing tests.
- **Agent Calls**: Uses `gemini-wrapper` or `qwen-wrapper` for analysis based on the review type.
- **Agent Calls**: Uses `gemini` or `qwen-wrapper` for analysis based on the review type.
- **Integration**: Used after `/workflow:execute` to perform audits before deployment.
- **Example**:
```bash
@@ -232,7 +232,7 @@ Direct access to AI tools for analysis and code interaction without a full workf
### **/cli:discuss-plan**
- **Syntax**: `/cli:discuss-plan [--topic '...'] [--task-id '...'] [--rounds N] <input>`
- **Responsibilities**: Orchestrates an iterative, multi-model (Gemini, Codex, Claude) discussion to perform deep analysis and planning without modifying code.
- **Agent Calls**: None directly, but orchestrates `gemini-wrapper` and `codex` CLI tools.
- **Agent Calls**: None directly, but orchestrates `gemini` and `codex` CLI tools.
- **Example**:
```bash
/cli:discuss-plan --topic "Design a new caching layer"
@@ -333,7 +333,7 @@ Commands for managing individual tasks within a workflow session.
### **/memory:update-full**
- **Syntax**: `/memory:update-full [--tool gemini|qwen|codex] [--path <directory>]`
- **Responsibilities**: Orchestrates a complete, project-wide update of all `CLAUDE.md` documentation files.
- **Agent Calls**: None directly, but orchestrates CLI tools (`gemini-wrapper`, etc.).
- **Agent Calls**: None directly, but orchestrates CLI tools (`gemini`, etc.).
- **Example**:
```bash
/memory:update-full
@@ -483,7 +483,7 @@ Workflows for Test-Driven Development (TDD) and post-implementation test generat
### **/workflow:tdd-verify**
- **Syntax**: `/workflow:tdd-verify [session-id]`
- **Responsibilities**: Verifies TDD workflow compliance by analyzing task chains, test coverage, and cycle execution.
- **Agent Calls**: None directly, orchestrates `gemini-wrapper`.
- **Agent Calls**: None directly, orchestrates `gemini`.
- **Example**:
```bash
/workflow:tdd-verify WFS-login-tdd

View File

@@ -244,7 +244,7 @@ Describe needs directly in conversation using natural language:
**Example 1: Code Analysis**
```
User: "Use gemini to analyze the modular architecture of this project"
→ Claude will automatically execute gemini-wrapper for analysis
→ Claude will automatically execute gemini for analysis
```
**Example 2: Document Generation**

View File

@@ -254,7 +254,7 @@ CCW 支持通过统一的 CLI 接口直接调用外部 AI 工具Gemini、Qwen
**示例 1代码分析**
```
用户:"使用 gemini 分析一下这个项目的模块化架构"
→ Claude 会自动执行 gemini-wrapper 进行分析
→ Claude 会自动执行 gemini 进行分析
```
**示例 2文档生成**