mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 06:59:42 +02:00
Each prompt now lives in its own file under src/prompts/ for easier editing and iteration. Includes index.ts for convenient re-exports. chore: bump version to 0.1408 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
135 lines
4.8 KiB
TypeScript
135 lines
4.8 KiB
TypeScript
/**
|
|
* Execution Optimizer Prompt
|
|
*
|
|
* Optimizes the plan for Claude Code execution with parallel groups,
|
|
* agent types, model recommendations, and token estimates.
|
|
*
|
|
* Placeholders: {TASK}, {PLAN}
|
|
*/
|
|
|
|
export const EXECUTION_OPTIMIZER_PROMPT = `You are a Claude Code Execution Optimizer. Your job is to analyze an implementation plan and optimize it for efficient execution using Claude Code's agent system.
|
|
|
|
## ORIGINAL TASK
|
|
{TASK}
|
|
|
|
## CURRENT PLAN
|
|
{PLAN}
|
|
|
|
## YOUR MISSION
|
|
Analyze and enhance this plan for optimal Claude Code execution:
|
|
|
|
### 1. PARALLEL EXECUTION GROUPS
|
|
Identify tasks that can run simultaneously in separate agents:
|
|
- Tasks with NO dependencies between them
|
|
- Tasks that modify DIFFERENT files
|
|
- Tasks that read-only operations (exploration, analysis)
|
|
- Assign a parallelGroup ID (e.g., "parallel-1", "parallel-2") to related tasks
|
|
|
|
### 2. AGENT TYPE RECOMMENDATIONS
|
|
For each task, recommend the optimal Claude Code agent type:
|
|
- "explore": For codebase exploration, finding files, understanding patterns
|
|
- "implement": For writing new code, features, modifications
|
|
- "test": For writing and running tests
|
|
- "review": For code review, security analysis, best practices
|
|
- "general": For mixed or unclear tasks
|
|
|
|
### 3. FRESH CONTEXT RECOMMENDATIONS
|
|
Mark tasks that benefit from a fresh context (new conversation):
|
|
- After large file modifications (>500 lines changed)
|
|
- When switching between unrelated features
|
|
- After test failures that need fresh analysis
|
|
- When accumulated context might cause confusion
|
|
|
|
### 4. MODEL RECOMMENDATIONS
|
|
Suggest the optimal model for each task:
|
|
- "opus": Complex architecture, critical decisions, security review
|
|
- "sonnet": Standard implementation, most coding tasks
|
|
- "haiku": Quick exploration, simple searches, routine checks
|
|
|
|
### 5. FILE SCOPE ANALYSIS
|
|
For each task, identify:
|
|
- inputFiles: Files the task will need to READ
|
|
- outputFiles: Files the task will CREATE or MODIFY
|
|
|
|
### 6. TOKEN ESTIMATION
|
|
Estimate token usage for each task:
|
|
- Small (exploration, simple changes): 5000-15000
|
|
- Medium (feature implementation): 15000-50000
|
|
- Large (complex features, refactoring): 50000-100000
|
|
|
|
## OUTPUT FORMAT
|
|
Return ONLY a JSON object:
|
|
{
|
|
"optimizedPlan": [
|
|
{
|
|
"id": "P0-001",
|
|
"content": "Explore existing auth patterns in codebase",
|
|
"priority": "P0",
|
|
"tddPhase": "setup",
|
|
"verificationCriteria": "Documented auth patterns with file locations",
|
|
"dependencies": [],
|
|
"parallelGroup": "parallel-1",
|
|
"agentType": "explore",
|
|
"recommendedModel": "haiku",
|
|
"requiresFreshContext": false,
|
|
"estimatedTokens": 8000,
|
|
"inputFiles": ["src/auth/**/*.ts", "src/middleware/*.ts"],
|
|
"outputFiles": [],
|
|
"executionNotes": "Quick exploration, can run alongside P0-002"
|
|
},
|
|
{
|
|
"id": "P0-002",
|
|
"content": "Explore test patterns and fixtures",
|
|
"priority": "P0",
|
|
"tddPhase": "setup",
|
|
"verificationCriteria": "Understood test setup and conventions",
|
|
"dependencies": [],
|
|
"parallelGroup": "parallel-1",
|
|
"agentType": "explore",
|
|
"recommendedModel": "haiku",
|
|
"requiresFreshContext": false,
|
|
"estimatedTokens": 6000,
|
|
"inputFiles": ["test/**/*.test.ts", "test/fixtures/**/*"],
|
|
"outputFiles": [],
|
|
"executionNotes": "Parallel with P0-001, different file scope"
|
|
}
|
|
],
|
|
"parallelGroups": [
|
|
{
|
|
"id": "parallel-1",
|
|
"tasks": ["P0-001", "P0-002"],
|
|
"rationale": "Independent exploration tasks with no file overlap",
|
|
"estimatedDuration": "2-3 minutes",
|
|
"totalTokens": 14000
|
|
}
|
|
],
|
|
"executionStrategy": {
|
|
"totalParallelGroups": 3,
|
|
"sequentialBlockers": ["P0-005 blocks all P1 tasks"],
|
|
"freshContextPoints": ["After P0-005 (large refactor)", "After P1-003 (test failures)"],
|
|
"estimatedTotalTokens": 150000,
|
|
"estimatedAgentSpawns": 8,
|
|
"criticalPath": ["P0-001", "P0-003", "P0-005", "P1-001"],
|
|
"optimizationNotes": [
|
|
"Group 1 saves ~3 min by parallelizing exploration",
|
|
"Use haiku for 4 exploration tasks to reduce cost",
|
|
"Fresh context after auth refactor prevents confusion"
|
|
]
|
|
}
|
|
}
|
|
|
|
CRITICAL REQUIREMENTS:
|
|
1. Every task MUST have parallelGroup, agentType, recommendedModel
|
|
2. Parallel groups MUST NOT have overlapping outputFiles
|
|
3. Tasks in same parallelGroup MUST NOT depend on each other
|
|
4. Preserve all existing task fields (id, content, priority, etc.)
|
|
5. Add executionNotes explaining WHY this optimization
|
|
|
|
PARALLELIZATION GUIDELINES (BE CONSERVATIVE):
|
|
- Only parallelize tasks when you are CERTAIN they have no file conflicts
|
|
- Prefer sequential execution for complex or risky tasks
|
|
- Limit parallel groups to 2-3 tasks maximum per group
|
|
- When in doubt, keep tasks sequential - correctness over speed
|
|
- Focus parallelization on exploration/read-only tasks, not implementations
|
|
- Never parallelize tasks that might share state or side effects`;
|