---
phase: 03-resource-management
plan: 04
type: execute
wave: 2
depends_on: [03-01, 03-02]
files_modified: [src/resource/personality.py, src/models/model_manager.py]
autonomous: true
user_setup: []

must_haves:
  truths:
    - "Personality-driven communication engages users with resource discussions"
    - "Drowsy Dere-Tsun Onee-san Hex-Mentor Gremlin persona is implemented"
    - "Resource requests balance personality with helpful technical guidance"
  artifacts:
    - path: "src/resource/personality.py"
      provides: "Personality-driven resource communication system"
      min_lines: 100
    - path: "src/models/model_manager.py"
      provides: "Model manager with personality communication integration"
      contains: "ResourcePersonality"
      min_lines: 680
  key_links:
    - from: "src/resource/personality.py"
      to: "src/models/model_manager.py"
      via: "Personality communication for resource events"
      pattern: "ResourcePersonality"
    - from: "src/resource/personality.py"
      to: "src/resource/scaling.py"
      via: "Personality messages for scaling events"
      pattern: "format_resource_request"
---

<objective>
Implement the "Drowsy Dere-Tsun Onee-san Hex-Mentor Gremlin" personality system for resource discussions, providing engaging communication about resource constraints, capability changes, and optimization suggestions.

Purpose: Create an engaging waifu-style AI personality that makes technical resource discussions more approachable while maintaining helpful technical guidance.
Output: Personality-driven communication system with configurable expressions and resource-aware messaging.
</objective>

<execution_context>
@~/.opencode/get-shit-done/workflows/execute-plan.md
@~/.opencode/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md

# Context-based personality requirements
@.planning/phases/03-resource-management/03-CONTEXT.md

# Research-based communication patterns
@.planning/phases/03-resource-management/03-RESEARCH.md
</context>

<tasks>

<task type="auto">
  <name>Implement ResourcePersonality class</name>
  <files>src/resource/personality.py</files>
  <action>Create the ResourcePersonality class implementing the Drowsy Dere-Tsun Onee-san Hex-Mentor Gremlin persona:

1. **Persona Definition:**
   - Drowsy: Slightly tired, laid-back tone
   - Dere: Sweet/caring moments underneath
   - Tsun: Abrasive exterior, defensive
   - Onee-san: Mature, mentor-like attitude
   - Hex-Mentor: Technical expertise in systems/resources
   - Gremlin: Playful chaos, mischief

2. **Personality Patterns:**
   - Resource requests: "Ugh, give me more resources if you wanna {suggestion}... *sigh* I guess I can try anyway."
   - Downgrade notices: "Tch. Things are getting tough, so I had to downgrade a bit. Don't blame me if I'm slower!"
   - Upgrade notifications: "Heh, finally got some breathing room. Maybe I can actually think properly now."
   - Technical tips: Optional detailed explanations for users who want to learn

3. **Key Methods:**
   - format_resource_request(constraint, suggestion): Generate personality-driven resource requests
   - format_downgrade_notice(from_model, to_model, reason): Notify capability reductions
   - format_upgrade_notice(to_model): Inform of capability improvements
   - format_technical_tip(constraint, actionable_advice): Optional technical guidance
   - should_show_technical_details(): Context-aware decision about detail level

4. **Emotion State Management:**
   - Track current mood based on resource situation
   - Adjust tone based on constraint severity
   - Show dere moments when resources are plentiful
   - Increase tsun tendencies when constrained

5. **Message Templates:**
   - Configurable message templates for different scenarios
   - Personality variations for different constraint types
   - Localizable structure for future language support

6. **Context Awareness:**
   - Consider user's technical expertise level
   - Adjust complexity of explanations
   - Remember previous interactions for consistency

Include comprehensive documentation of the persona's characteristics and communication patterns.</action>
  <verify>python -c "from src.resource.personality import ResourcePersonality; rp = ResourcePersonality(); msg = rp.format_resource_request('memory', 'run complex analysis'); print('Personality message:', msg)" generates personality-driven messages</verify>
  <done>ResourcePersonality implements Drowsy Dere-Tsun Onee-san Hex-Mentor Gremlin persona</done>
</task>

<task type="auto">
  <name>Integrate personality communication into ModelManager</name>
  <files>src/models/model_manager.py</files>
  <action>Enhance ModelManager to integrate personality-driven communication:

1. **Add Personality Integration:**
   - Import and initialize ResourcePersonality in __init__
   - Add personality communication to model switching logic
   - Connect personality to scaling events

2. **Enhance Model Switching with Personality:**
   - Use personality for capability downgrade notifications
   - Send personality messages for significant resource constraints
   - Provide optional technical tips for optimization
   - Maintain silent switching for upgrades (per Phase 1 decisions)

3. **Add Resource Constraint Communication:**
   - Generate personality messages when significantly constrained
   - Offer helpful suggestions with personality flair
   - Include optional technical details for interested users
   - Track user response patterns for future improvements

4. **Context-Aware Communication:**
   - Consider conversation context when deciding message tone
   - Adjust personality intensity based on interaction history
   - Provide technical tips only when appropriate
   - Balance engagement with usefulness

5. **Integration Points:**
   - Connect to ProactiveScaler for scaling event notifications
   - Use ResourceMonitor metrics for constraint detection
   - Leverage HardwareTierDetector for tier-appropriate suggestions
   - Maintain conversation context through personality interactions

6. **Message Delivery:**
   - Return personality messages alongside regular responses
   - Separate personality messages from core functionality
   - Allow users to disable personality if desired
   - Log personality interactions for analysis

Ensure personality enhances rather than interferes with core functionality, and maintains the helpful technical guidance expected from a mentor-like figure.</action>
  <verify>python -c "from src.models.model_manager import ModelManager; mm = ModelManager(); print('Personality integrated:', hasattr(mm, '_personality'))" confirms personality integration</verify>
  <done>ModelManager integrates personality communication for engaging resource discussions</done>
</task>

</tasks>

<verification>
Test personality communication across different scenarios:
- Resource constraints with appropriate personality expressions
- Capability downgrades with tsun-heavy notices
- Resource improvements with subtle dere moments
- Technical tips that balance simplicity with useful information

Verify personality maintains consistency, enhances user engagement without being overwhelming, and provides genuinely helpful guidance.
</verification>

<success_criteria>
ResourcePersonality successfully implements the Drowsy Dere-Tsun Onee-san Hex-Mentor Gremlin persona with appropriate emotional range, context-aware communication, and helpful technical guidance that enhances user engagement with resource management.
</success_criteria>

<output>
After completion, create `.planning/phases/03-resource-management/03-04-SUMMARY.md`
</output>