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>
This commit is contained in:
catlog22
2025-11-29 11:18:48 +08:00
parent 72099ae951
commit 09114f59c8
4 changed files with 1011 additions and 705 deletions

File diff suppressed because it is too large Load Diff

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

@@ -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