# Learning & Personalization System **Status**: ✅ Complete **Phase**: Phase 6 **Last Updated**: December 6, 2025 --- ## Overview The Learning & Personalization System enables RiceCoder to learn from your interactions and adapt its behavior to your preferences. As you use RiceCoder, the system tracks your actions, identifies patterns, and generates learned rules that improve your productivity over time. **Key Benefit**: RiceCoder becomes smarter and more personalized the more you use it. --- ## Key Features - **Automatic Learning**: System learns from your interactions without configuration - **Pattern Recognition**: Identifies common workflows and preferences - **Learned Rules**: Generates rules from patterns and applies them automatically - **Personalization**: Adapts agent behavior based on your profile - **Analytics**: Comprehensive analytics on usage patterns - **Rule Management**: Create, edit, enable/disable, and delete rules - **Continuous Improvement**: System improves over time with more usage --- ## How It Works ### 1. Interaction Tracking RiceCoder tracks your interactions: ``` User Action: ricecoder generate --domain frontend --template react-component ↓ System Records: - Action type: generate - Domain: frontend - Template: react-component - Timestamp: 2025-12-06T10:30:00Z - Duration: 2.5s - Success: true ``` ### 2. Pattern Recognition System identifies patterns from your interactions: ``` Pattern Detected: - You frequently use: ricecoder generate --domain frontend - You prefer: React components - You use: Tailwind CSS for styling - You test with: Jest - You deploy to: Vercel ``` ### 3. Rule Generation System generates rules from patterns: ``` Generated Rule: - Name: "Frontend Development Pattern" - Confidence: 0.92 - Applies to: frontend domain - Recommendations: - Use React for components - Use Tailwind for styling - Use Jest for testing - Deploy to Vercel ``` ### 4. Rule Application System applies learned rules automatically: ``` User Request: ricecoder generate --domain frontend ↓ System Applies Learned Rules: - Automatically suggests React - Automatically suggests Tailwind - Automatically suggests Jest - Automatically suggests Vercel ↓ User Gets Personalized Recommendations ``` --- ## Quick Start ### Automatic Learning Just use RiceCoder normally - the system learns automatically: ```bash # Use RiceCoder as usual ricecoder chat ricecoder generate --domain frontend ricecoder refactor --pattern microservices # System tracks all interactions and learns ``` ### View Learned Rules ```bash # List all learned rules ricecoder learning list-rules # Show specific rule ricecoder learning show-rule # View rule statistics ricecoder learning stats-rule ``` ### Manage Learned Rules ```bash # Enable/disable rules ricecoder learning enable-rule ricecoder learning disable-rule # Delete rule ricecoder learning delete-rule # Reset all learned rules ricecoder learning reset-all ``` ### View Analytics ```bash # Overall analytics ricecoder learning analytics # Analytics by domain ricecoder learning analytics --domain frontend # Analytics by time period ricecoder learning analytics --since 2025-12-01 # Export analytics ricecoder learning analytics --export json > analytics.json ``` --- ## Learning Features ### Code Style Learning System learns your preferred code style: ``` Learned Preferences: - Indentation: 2 spaces - Semicolons: yes - Quotes: double - Line length: 100 - Naming: camelCase ``` ### Workflow Optimization System identifies and optimizes your workflows: ``` Learned Workflow: 1. ricecoder generate --domain frontend 2. ricecoder review --domain frontend 3. ricecoder refactor --pattern hooks 4. ricecoder test --domain frontend Optimization: Combine into single command ricecoder workflow run frontend-dev ``` ### Tool Preferences System learns which tools you prefer: ``` Learned Preferences: - Preferred AI Provider: OpenAI - Preferred Model: GPT-4 - Preferred Domain: Frontend - Preferred Template: React Component - Preferred Refactoring Pattern: Hooks ``` ### Domain Expertise System tracks your expertise level: ``` Expertise Profile: - Frontend: Expert (90%) - Backend: Intermediate (60%) - DevOps: Beginner (30%) - Data: Beginner (20%) Recommendations Adjusted: - Frontend: Advanced patterns - Backend: Intermediate guidance - DevOps: Beginner-friendly explanations ``` ### Performance Patterns System learns performance-critical patterns: ``` Learned Patterns: - Frequently used components - Common performance bottlenecks - Optimization techniques you prefer - Testing patterns you use ``` --- ## Rule Management ### Creating Rules ```bash # Create rule from interaction ricecoder learning create-rule \ --name "Frontend Development" \ --domain frontend \ --pattern "react-component" \ --template "react-component" # Create rule from template ricecoder learning create-rule \ --from-template frontend-dev ``` ### Editing Rules ```bash # Edit rule ricecoder learning edit-rule \ --name "Updated Name" \ --confidence 0.95 # Update rule pattern ricecoder learning edit-rule \ --pattern "new-pattern" ``` ### Viewing Rules ```bash # List all rules ricecoder learning list-rules # List rules for domain ricecoder learning list-rules --domain frontend # List enabled rules ricecoder learning list-rules --enabled # List disabled rules ricecoder learning list-rules --disabled # Show rule details ricecoder learning show-rule ``` ### Enabling/Disabling Rules ```bash # Enable rule ricecoder learning enable-rule # Disable rule ricecoder learning disable-rule # Enable all rules ricecoder learning enable-all # Disable all rules ricecoder learning disable-all ``` ### Deleting Rules ```bash # Delete single rule ricecoder learning delete-rule # Delete rules for domain ricecoder learning delete-rules --domain frontend # Delete all rules ricecoder learning reset-all ``` --- ## Analytics ### Overall Analytics ```bash # View overall analytics ricecoder learning analytics # Output: # Total Interactions: 1,234 # Total Rules Generated: 45 # Average Rule Confidence: 0.87 # Most Used Domain: frontend # Most Used Action: generate # Average Session Duration: 15 minutes ``` ### Domain Analytics ```bash # Analytics for specific domain ricecoder learning analytics --domain frontend # Output: # Domain: frontend # Interactions: 456 # Rules: 12 # Average Confidence: 0.91 # Most Used Template: react-component # Most Used Pattern: hooks ``` ### Time-Based Analytics ```bash # Analytics for time period ricecoder learning analytics --since 2025-12-01 # Analytics for last 7 days ricecoder learning analytics --days 7 # Analytics for last 30 days ricecoder learning analytics --days 30 ``` ### Exporting Analytics ```bash # Export to JSON ricecoder learning analytics --export json > analytics.json # Export to CSV ricecoder learning analytics --export csv > analytics.csv # Export to HTML report ricecoder learning analytics --export html > report.html ``` --- ## Configuration ### Learning Configuration Add to `.ricecoder/config.yaml`: ```yaml learning: # Enable/disable learning system enabled: true # Track user interactions track_interactions: true # Automatically apply learned rules auto_apply_rules: true # Minimum confidence threshold for rules rule_confidence_threshold: 0.8 # Maximum number of rules to keep max_rules: 100 # Rule retention period (days) rule_retention_days: 90 # Analytics retention period (days) analytics_retention_days: 365 ``` ### Personalization Configuration ```yaml personalization: # Enable personalization enabled: true # Adapt recommendations based on expertise adapt_to_expertise: true # Adapt recommendations based on preferences adapt_to_preferences: true # Adapt recommendations based on history adapt_to_history: true # Personalization strength (0.0 - 1.0) strength: 0.8 ``` --- ## Common Workflows ### Workflow 1: Learning Your Preferences ```bash # Use RiceCoder normally for a week ricecoder chat ricecoder generate --domain frontend ricecoder refactor --pattern hooks ricecoder test --domain frontend # View what system learned ricecoder learning analytics # View generated rules ricecoder learning list-rules # System now personalizes recommendations ``` ### Workflow 2: Optimizing Your Workflow ```bash # Identify your common workflow ricecoder learning analytics # Create rule for workflow ricecoder learning create-rule \ --name "My Frontend Workflow" \ --domain frontend \ --pattern "react-component" # Enable rule ricecoder learning enable-rule # Use optimized workflow ricecoder workflow run my-frontend-workflow ``` ### Workflow 3: Improving Code Quality ```bash # Track your code patterns ricecoder learning analytics # Identify performance patterns ricecoder learning show-rule # Apply learned patterns ricecoder generate --domain frontend --apply-learned-rules # Review improvements ricecoder learning stats-rule ``` --- ## Best Practices ### For Learning 1. **Use Consistently**: Use RiceCoder consistently for better learning 2. **Provide Feedback**: Rate recommendations to improve learning 3. **Review Rules**: Periodically review generated rules 4. **Adjust Confidence**: Adjust rule confidence thresholds as needed ### For Personalization 1. **Enable Auto-Apply**: Enable automatic rule application for convenience 2. **Monitor Recommendations**: Monitor personalized recommendations 3. **Adjust Strength**: Adjust personalization strength to your preference 4. **Provide Feedback**: Provide feedback on recommendations ### For Privacy 1. **Review Tracking**: Review what interactions are tracked 2. **Disable Tracking**: Disable tracking if desired 3. **Export Data**: Export your data regularly 4. **Delete Data**: Delete old data to maintain privacy --- ## Troubleshooting ### Rules Not Being Applied **Problem**: Learned rules are not being applied **Solutions**: - Check if learning is enabled: `ricecoder learning status` - Check if rule is enabled: `ricecoder learning show-rule ` - Check rule confidence: `ricecoder learning stats-rule ` - Enable auto-apply: `ricecoder config set learning.auto_apply_rules true` ### Too Many Rules **Problem**: Too many learned rules generated **Solutions**: - Increase confidence threshold: `ricecoder config set learning.rule_confidence_threshold 0.9` - Delete low-confidence rules: `ricecoder learning delete-rules --confidence-below 0.7` - Reset all rules: `ricecoder learning reset-all` ### Inaccurate Recommendations **Problem**: Personalized recommendations are inaccurate **Solutions**: - Provide feedback on recommendations - Adjust personalization strength: `ricecoder config set personalization.strength 0.5` - Review and edit rules: `ricecoder learning edit-rule ` - Disable auto-apply: `ricecoder config set learning.auto_apply_rules false` ### Performance Issues **Problem**: Learning system is slow **Solutions**: - Reduce number of rules: `ricecoder learning delete-rules --old` - Disable tracking: `ricecoder config set learning.track_interactions false` - Clear analytics: `ricecoder learning clear-analytics` --- ## Advanced Topics ### Custom Learning Rules Create custom learning rules: ```yaml # In .ricecoder/learning-rules.yaml rules: - name: "My Custom Rule" domain: frontend pattern: "react-component" confidence: 0.95 recommendations: - use_template: "react-component" - use_styling: "tailwind" - use_testing: "jest" ``` ### Rule Chaining Chain multiple rules together: ```bash # Create rule that triggers other rules ricecoder learning create-rule \ --name "Full Stack Setup" \ --triggers ["frontend-setup", "backend-setup", "devops-setup"] ``` ### Integration with CI/CD Use learned rules in CI/CD: ```yaml # GitHub Actions example - name: Generate code with learned rules run: ricecoder generate --domain frontend --apply-learned-rules - name: Refactor with learned patterns run: ricecoder refactor --apply-learned-rules ``` --- ## See Also - [Domain-Specific Agents](./Domain-Agents.md) - Specialized agents for different domains - [Orchestration](./Orchestration.md) - Multi-project management - [Architecture Overview](./Architecture-Overview.md) - System architecture - [Configuration Guide](./Configuration.md) - Configuration reference - [CLI Commands](./CLI-Commands.md) - Command reference --- *Last updated: December 6, 2025*