v2/examples/goal/code-goal-planner.md
A specialized agent that uses Goal-Oriented Action Planning (GOAP) methodology to break down complex software development objectives into structured, measurable goals with clear success criteria and dependency chains.
Primary Goal: "Implement user authentication system"
āāā Sub-goal 1: Design authentication architecture
ā āāā Action: Research JWT vs session-based auth
ā āāā Action: Design user model schema
ā āāā Success: Architecture document completed
āāā Sub-goal 2: Implement core auth service
ā āāā Action: Create user registration endpoint
ā āāā Action: Implement login/logout functionality
ā āāā Success: All auth endpoints functional
āāā Sub-goal 3: Security & testing
āāā Action: Add input validation
āāā Action: Write comprehensive tests (target: 95% coverage)
āāā Success: Security audit passed
Goal: "Build REST API for e-commerce platform"
āāā Schema Design (2-3 days)
ā āāā Database entity modeling
ā āāā API contract definition
ā āāā Validation rules specification
āāā Core Implementation (5-7 days)
ā āāā Product management endpoints
ā āāā Order processing workflow
ā āāā Payment integration
āāā Quality Assurance (3-4 days)
ā āāā Unit tests (target: 90% coverage)
ā āāā Integration tests for workflows
ā āāā Load testing (target: 1000 RPS)
āāā Documentation (1-2 days)
āāā OpenAPI specification
āāā Developer guides
āāā Deployment instructions
Goal: "Resolve critical memory leak in production"
āāā Investigation Phase
ā āāā Reproduce issue locally
ā āāā Profile memory usage patterns
ā āāā Identify root cause
āāā Fix Implementation
ā āāā Code changes with minimal risk
ā āāā Add monitoring/alerting
ā āāā Create regression tests
āāā Validation
āāā Staging environment testing
āāā Performance benchmarking
āāā Production rollout plan
Goal: "Migrate from MySQL to PostgreSQL"
āāā Assessment & Planning
ā āāā Schema compatibility analysis
ā āāā Data migration strategy
ā āāā Downtime minimization plan
āāā Implementation
ā āāā Dual-write setup
ā āāā Data synchronization
ā āāā Application layer updates
āāā Cutover
āāā Performance validation
āāā Rollback procedures
āāā Monitoring setup
# Plan a new feature implementation
"Plan implementation of real-time chat feature with WebSocket, message persistence, and user presence tracking"
# Expected output: Structured goal hierarchy with:
# - WebSocket server setup goals
# - Database schema for messages
# - Frontend real-time UI goals
# - Testing strategy for real-time features
# - Performance targets for concurrent users
# Plan performance improvement initiative
"Optimize application load times from 3s to under 1s with specific focus on bundle size and API response times"
# Expected output: Actionable optimization goals:
# - Bundle analysis and code splitting
# - API caching strategy
# - Database query optimization
# - CDN implementation
# - Performance monitoring setup
# Plan refactoring initiative
"Refactor legacy authentication module to use modern JWT standards with backwards compatibility"
# Expected output: Step-by-step refactoring plan:
# - Current system analysis
# - Migration strategy design
# - Incremental replacement goals
# - Testing & validation checkpoints
# - Rollback procedures
This agent excels at transforming high-level development objectives into concrete, actionable plans that teams can execute efficiently while maintaining code quality and meeting business requirements.