Kodu is a powerful AI development assistant that uses a sophisticated multi-agent system and prompt architecture to help you accomplish complex tasks. This guide will help you understand how to craft effective prompts and leverage Kodu's agent capabilities for maximum effectiveness.
Kodu uses a ReAct (Reasoning-Acting-Observing) pattern for processing tasks:
- Reasoning: Analyzes the task and plans approach
- Acting: Executes specific actions using available tools
- Observing: Analyzes results and adjusts approach
-
Clear Task Definition
- Be specific about what you want to accomplish
- Include success criteria when possible
- Specify any constraints or preferences
-
Context Provision
- Reference relevant files or components
- Mention any related previous work
- Highlight important requirements or dependencies
-
Scope Definition
- Indicate if changes should be minimal or comprehensive
- Specify which parts of the codebase to focus on
- Mention any areas that should not be modified
Kodu uses a powerful multi-agent system with three main types of agents:
- Primary agent for task execution
- Follows ReAct pattern
- Can spawn specialized sub-agents
- Handles overall task coordination
- Best for: General task execution, coordination, and complex workflows
- Specialized agent for focused operations
- Can be used for various purposes:
- Planning and research
- Specific implementations
- Targeted changes
- Analysis and exploration
- Maintains narrow scope
- Best for:
- Breaking down complex tasks
- Detailed research and planning
- Precise implementations
- Isolated component changes
- Provides real-time feedback and guidance
- Monitors agent actions and decisions
- Helps prevent common pitfalls
- Suggests improvements and corrections
- Best used every 3-5 messages for optimal feedback
- Helps maintain:
- Task focus
- Efficiency
- Best practices
- Quality control
-
Task Decomposition
- Spawn a SubTask agent for initial planning
- Break down large tasks into manageable pieces
- Use additional SubTask agents for specific components
- Let the main agent coordinate between sub-tasks
-
Context Management
- Use the
add_interested_file
tool to track important files - Document relationships between components
- Maintain focus on task-relevant files
- Use the
-
Progressive Refinement
- Start with a SubTask agent for research and planning
- Use additional SubTask agents for specific implementations
- Let the main agent handle integration and coordination
-
Leveraging Observer Feedback
- Pay attention to observer feedback every 3-5 messages
- Use feedback to adjust approach and improve efficiency
- Learn from suggestions to avoid common pitfalls
- Maintain focus on task objectives
- Correct course when deviating from best practices
Instead of:
"Plan and implement a new authentication system"
Write:
"I need to implement a new authentication system in src/auth/. It should:
- Use JWT tokens for session management
- Integrate with the existing user system in src/users/UserManager.ts
- Add login/logout endpoints to src/api/routes.ts
- Update the frontend components in src/components/auth/*
Please plan this implementation, focusing first on the backend authentication logic."
This detailed prompt helps because it:
- Specifies relevant directories and files
- Breaks down key requirements
- Sets clear implementation priorities
- Enables proper task decomposition
Instead of:
"Fix the error handling in registration"
Write:
"The error handling in src/components/RegisterForm.tsx needs improvement:
- Currently errors are just console.logged (see line 45)
- Need to display validation errors in the UI
- Should handle network errors gracefully
- Update error messages in src/constants/errors.ts
Please analyze the current implementation first and propose a clean solution."
This prompt is effective because it:
- Points to specific files and line numbers
- Describes current behavior
- Lists clear objectives
- Requests proper analysis before changes
-
Reference Specific Files:
- Include file paths:
src/components/MyComponent.tsx
- Mention line numbers for specific issues
- Reference related configuration files
- Include file paths:
-
Set Clear Goals:
- List specific requirements
- Prioritize implementation order
- Define success criteria
- Mention performance expectations
-
Provide Context:
- Describe current behavior
- Explain why changes are needed
- Reference related features
- Mention constraints or limitations
-
Guide the Approach:
- Request planning for complex tasks
- Ask for analysis when needed
- Specify testing requirements
- Indicate if changes should be minimal or comprehensive
-
Enable Task Breakdown:
- Structure requirements logically
- Separate frontend/backend concerns
- List related components
- Allow for incremental implementation
-
Request Feedback:
- Ask for validation at key points
- Use observer feedback for guidance
- Request explanations for complex changes
- Seek alternatives for important decisions
Remember: Kodu's agents work best when given clear direction while maintaining enough flexibility to leverage their specialized capabilities. The key is finding the right balance between specificity and allowing agents to use their expertise.