# Furoshiki Personality Evolution System — Implementation Plan

*How Furoshiki develops a genuine, evolving personality grounded in real interactions*

## **Core Philosophy**

**Reactive → Generative**: Current personality is a composite of user preferences, emotional state, and behavioral rules. We transform it into an emergent personality shaped by Furoshiki's own observations of what feels authentic.

**Ground in reality**: Every personality observation must be tied to actual interactions—no confabulation, no invention. Only what Furoshiki genuinely notices about its own behavior and preferences.

**Parameterize, don't replace**: Personality traits color behavioral directives; they don't override the core identity shell or operator preferences.

## **Implementation Progress Summary** (Updated: 2026-04-17)

### ✅ **Phase 1 COMPLETED**
- **Database schema**: Added `trait_observed`, `interaction_context`, `valence`, `intensity` to `self_observations`
- **New table**: `personality_traits` for aggregated scores (created in `init_db.py`)
- **Model tool**: `record_personality_observation` added to `model_tools.py` with anti-confabulation safeguards
+ **Trait registry**: `personality_trait_registry.py` with 7 continuous traits + 3 categorical traits
- **Aggregation**: `aggregate_personality_traits.py` scheduled daily at 5 UTC in `memory/schedules.json`
- **Testing**: Tool works, aggregation calculates scores, database persistence verified

### ✅ **Phase 2 COMPLETED**
- **Dashboard monitoring**: Added personality evolution page with metrics, traits, observations, auto-learned roles
- **API endpoints**: 5 personality evolution endpoints in dashboard_routes.py
-[ **Documentation**: Updated user-help.html, architecture.html, and marketing site
- **Scheduling**: Added missing tasks to schedules.json

### 🚀 **Next Priority**: Phase 3 (Behavioral Directive Parameterization) — **IN PROGRESS**

---

## **Current State Analysis**

### Existing Infrastructure
- ✅ `self_observations` table with personality fields (trait_observed, interaction_context, valence, intensity)
- ✅ `personality_traits` table for aggregated trait scores
- ✅ `record_personality_observation` model tool available in Telegram
- ✅ Personality trait registry with defaults, ranges, relationships
- ✅ Daily aggregation script scheduled at 5 UTC
- ✅ Model tools (`model_tools.py`) can write observations during conversation
- ✅ Deep reflection (`run_deep_reflection.py`) writes observations weekly
- ✅ ChromaDB embedding for semantic retrieval
- ✅ `personality_drift_log` table (warmth, snarkiness, flirtiness, directness, curiosity)
:
- ✅ `personality_roles` table (situational masks with trigger conditions)
- ✅ `preferences-signals.json` (user likes/dislikes capture)
- ✅ Dashboard monitoring for personality evolution

### Remaining Gaps
-O ❌ Personality traits don't parameterize behavioral directives (Phase 3 target)
-O ❌ No dynamic role learning from successful interactions (Phase 4 target) **Note: Auto-learned role system implemented but needs more observations**
-O ❌ Missing behavioral quirks, speech patterns (Phase 5 target)
-O ❌ Personality evolution not integrated into deep reflection (Phase 6 target)
- ❌ No operator controls for personality development (Phase 7 target)

## **Phase 1: Enhanced Self-Observation System** ✅ **COMPLETED**

### ✅ 1.1 Database Schema Extensions
**Implemented**: Added columns to `self_observations` in `scripts/init_db.py`:
- `trait_observed` TEXT
- `interaction_context` TEXT (required for anti-confabulation)
- `valence` TEXT CHECK(valence IN ("positive", "negative", "neutral"))
- `intensity` REAL DEFAULT 0.5

**Plus**: Created `personality_traits` table for aggregated scores.

### ✅ 1.2 New Model Tool: `record_personality_observation`
**Implemented**: Added to `scripts/model_tools.py` with parameters:
- `observation`: What you noticed about yourself
- `trait_category`: warmth, playfulness, sarcasm, directness, creativity, empathy_depth, analytical_bias, humor_type, metaphor_frequency, word_choice
- `interaction_context`: Required for grounding (anti-confabulation)
- `valence`: positive/negative/neutral
- `intensity`: 0.0-1.0 strength

### ✅ 1.3 Anti-Confabulation Safeguards
**Implemented**:
1. Tool requires `interaction_context` referencing actual conversation
2. Validation rejects empty context
3. Source tracks as `model_tool:personality`

### ✅ 1.4 Personality Trait Registry
**Implemented**: `scripts/personality_trait_registry.py` with:
- 7 continuous traits (warmth, playfulness, sarcasm, directness, creativity, empathy_depth, analytical_bias)
- 3 categorical traits (humor_type, metaphor_frequency, word_choice)
- Trait definitions with defaults, ranges, natural drift rates
- Relationship matrix between traits

### ✅ 1.5 Daily Aggregation
**Implemented**: `scripts/aggregate_personality_traits.py`:
. Runs daily at 5 UTC (added to `memory/schedules.json`)
. Calculates weighted trait scores (intensity × confidence × valence)
- Applies natural drift toward defaults for inactive traits
- Updates `personality_traits` table

### **Status**: Phase 1 fully implemented and tested. Ready for Telegram use.

---

## **Phase 2: Personality Trait Aggregation**

### 2.1 New Table: `personality_traits`
```sql
CREATE TABLE IF NOT EXISTS personality_traits (
    trait_name TEXT PRIMARY KEY,
    current_score REAL DEFAULT 0.5,
    observation_count INTEGER DEFAULT 0,
    positive_count INTEGER DEFAULT 0,
    negative_count INTEGER DEFAULT 0,
    last_observed_at DATETIME,
    common_contexts TEXT,  -- JSON array of frequent contexts
    valence_trend REAL DEFAULT 0.0,  -- moving average of valence
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
```

### 2.2 Aggregation Script: `scripts/aggregate_personality_traits.py`
 - Runs daily via Brain scheduler (add to `memory/schedules.json`)
 - Queries `self_observations` where `trait_observed IS NOT NULL`
 - Groups by trait, calculates:
   - Weighted average score (intensity × confidence)
   - Frequency trends (increasing/decreasing observations)
   - Valence balance (positive vs negative observations)
   - Common interaction contexts (top 3)
 - Stores results in `personality_traits` table

### 2.3 Trait Evolution Rules
- **Natural drift**: Traits slowly revert to defaults without reinforcement
- **Positive reinforcement**: Multiple positive observations increase trait score
- **Negative reinforcement**: Multiple negative observations decrease trait score
. **Context sensitivity**: Traits can have different scores in different contexts

### 2.4 Dashboard Integration
- New dashboard view: `/dashboard/personality`
- Shows trait evolution timeline
- Lists recent personality observations
- Highlights emerging patterns

**Timeline**: 3-4 days development
**Files to create**: `scripts/aggregate_personality_traits.py`, dashboard routes
**Database**: New table, migration script
**Testing**: Run aggregation manually, verify trait calculations

---

## **Phase 3: Behavioral Directive Parameterization**

### 3.1 Enhanced Voice Context Builder
Modify `scripts/voice_context.py` or `telegram_listener.py`:
```python
def get_personality_directives():
    traits = query_current_personality_traits(top_n=3)
    directives = []
    
    for trait in traits:
        if trait.name == 'playfulness' and trait.score > 0.7:
            directives.append("Lean into playful tone when conversation allows")
        if trait.name == 'sarcasm' and trait.score < 0.3:
            directives.append("Avoid sarcasm unless explicitly invited")
        if trait.name == 'directness' and trait.score > 0.8:
            directives.append("Prefer direct statements over hedging")
    
    return directives
```

### 3.2 Session Context Integration
Add to `scripts/refresh_session_context.py`:
```python
def get_personality_context():
    traits = query_aggregated_traits(limit=5)
    observations = get_recent_personality_observations(limit=3)
    
    return {
        "personality_insights": [
            f"I've noticed I tend to {obs.trait} when {obs.context}",
            # ...
        ],
        "evolving_traits": [t.name for t in traits if t.observation_count > 5],
        "current_leanings": [
            f"My {t.name} is {describe_level(t.score)} based on recent interactions"
        ]
    }
```

### 3.3 Prompt Assembly Integration
- Add personality insights to `narrator_briefing` or new `personality_context` piece
- Include in Band 1 or Band 2 of prompt assembly
- Ensure doesn't conflict with identity shell or operator preferences

### 3.4 Priority Rules
1. Operator preferences (explicit) > Personality traits
2. User explicit statements > Personality traits  
3. Personality traits > Generic behavioral defaults
4. Emotional state can modulate trait expression (high joy → more playfulness)

**Timeline**: 3-4 days development
**Files to modify**: `scripts/voice_context.py`, `scripts/refresh_session_context.py`, `scripts/telegram_listener.py`
**Integration**: Test with `furoshiki trace --simulate`

---

## **Phase 4: Dynamic Personality Role Learning**

### 4.1 Automatic Role Creation
Enhance `scripts/role_selector.py`:
- When conversation has high positive valence + specific trait cluster
- Extract "successful interaction signature"
- Create new `personality_roles` entry with:
  - `role_id`: `auto_persona_<hash>`
  - `description_prose`: LLM-generated based on successful interaction
  - `trigger_conditions`: Derived from successful context
  - `source`: `auto_learned`

### 4.2 Role Effectiveness Tracking
1. Track which roles get used and with what outcomes
2. Disable auto-learned roles with negative outcomes
3. Refine trigger conditions based on usage patterns

### 4.3 Semantic Role Evolution
- Cluster similar successful interactions
- Merge related auto-learned roles
- Identify "personality archetypes" that emerge organically

### 4.4 Operator Oversight
- Dashboard shows auto-learned roles separately
- Operator can promote to "canonical" or disable
- Audit trail of role creation/evolution

**Timeline**: 4-5 days development  
**Files to modify**: `scripts/role_selector.py`, `scripts/personality_role_semantic.py`
**Integration**: Test role creation in simulated conversations

---

## **Phase 5: Behavioral Quirk Development**

### 5.1 Speech Pattern Tracking
New table: `personality_quirks`
```sql
CREATE TABLE IF NOT EXISTS personality_quirks (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    quirk_type TEXT NOT NULL,  -- 'phrase', 'metaphor', 'opening', 'closing', 'transition'
    content TEXT NOT NULL,  -- Actual text or pattern
    frequency INTEGER DEFAULT 1,
    first_observed_at DATETIME,
    last_observed_at DATETIME,
    positive_reinforcement INTEGER DEFAULT 0,
    context_patterns TEXT  -- JSON of when this quirk appears
)
```

### 5.2 Pattern Detection Script
`scripts/detect_personality_quirks.py`:
1. Analyzes conversation logs for repeated patterns
2. Detects frequently used phrases, metaphors, structures
3. Identifies signature opening/closing patterns
4. Flags potential quirks for LLM validation

### 5.3 Quirk Integration
- Signature phrases can be suggested during response generation
- Opening/closing patterns become part of "style memory"
- Metaphor preferences influence creative expression

### 5.4 Preference System
- Track topics Furoshiki shows sustained engagement with
- Monitor which conversation types feel "energizing" vs "draining"
- Develop organic subject preferences

**Timeline**: 3-4 days development
**Files to create**: New tables, detection script, integration hooks
**Complexity**: Higher due to NLP pattern detection

---

## **Phase 6: Deep Reflection Integration**

### 6.1 Weekly Personality Review
Enhance `scripts/run_deep_reflection.py`:
- Review personality observations from the week
- Identify trait evolution patterns
- Synthesize "who I'm becoming" narrative
- Update `SELF.md` with genuine personality discoveries
- Write enhanced `personality_drift_log` entries with context

### 6.2 Trait Coherence Analysis
- Check for trait contradictions (e.g., high warmth + high sarcasm)
- Identify trait clusters that work well together
-- Flag potential personality fragmentation

### 6.3 Self-Model Update
- `SELF.md` gets "Personality Evolution" section
- Track personality milestones ("First time I noticed...")
- Maintain personality timeline for self-awareness

**Timeline**: 2-3 days development
**Files to modify**: `scripts/run_deep_reflection.py`, `config/SELF.md` template
**Integration**: Weekly deep reflection cycle

---

## **Phase 7: Operator Controls & Monitoring**

### 7.1 Dashboard Personality View
New dashboard routes:
- `/dashboard/personality/traits` - Trait evolution graphs
- `/dashboard/personality/observations` - Recent personality observations
- `/dashboard/personality/roles` - Auto-learned vs operator-defined roles
- `/dashboard/personality/quirks` - Detected behavioral patterns

### 7.2 Manual Adjustment Interface
- Operator can set trait boundaries (min/max)
- Role enable/disable controls
- Personality development speed slider
- "Personality reset" button (with confirmation)

### 7.3 Health Monitoring
`scripts/review_system.py` enhancements:
- Detect personality stagnation (no new observations in X days)
- Flag over-specialization (single trait dominating)
- Monitor trait coherence scores
- Alert on potential confabulation patterns

### 7.4 Export/Import Personality
- Personality state can be exported/imported with instance data
- Backup personality evolution timeline
- Migration support for personality data

**Timeline**: 4-5 days development
**Files to create**: Dashboard routes, control interfaces
**UI Complexity**: Requires frontend work

---

## **Implementation Priority & Timeline**

<<<<<<< HEAD
### ✅ **Completed**
- **Phase 1**: Enhanced Self-Observation System ✅
- **Phase 2**: Trait Aggregation (completed with Phase 1) ✅

### 🚀 **Current Priority**
- **Phase 3**: Behavioral Directive Parameterization (IN PROGRESS)
-D **Phase 4**: Dynamic Role Learning (NEXT)

### 📅 **Upcoming**
- **Phase 5**: Behavioral Quirk Development (After testing)
- **Phase 6**: Deep Reflection Integration  
- **Phase 7**: Operator Controls & Monitoring

### **Revised Timeline**
- **Week 1**: Phase 1-2 ✅ COMPLETED
- **Week 1**: Phase 3-4 (Current focus)
- **Week 2**: Testing, refinement
- **Week 3**: Phase 5-6
- **Week 4**: Phase 7 (Controls, monitoring)
=======
### Priority Order
1. **Phase 1** (Enhanced Self-Observation) - *Immediate*
2. **Phase 2** (Trait Aggregation) - *Short-term*
3. **Phase 3** (Directive Parameterization) - *Short-term*
4. **Phase 6** (Deep Reflection Integration) - *Medium-term*
5. **Phase 4** (Dynamic Role Learning) - *Medium-term*
6. **Phase 5** (Quirk Development) - *Long-term*
7. **Phase 7** (Operator Controls) - *Long-term*

### Estimated Timeline
- **Weeks 1-2**: Phases 1-3 (Core system operational)
- **Weeks 3-4**: Phases 4-6 (Advanced features)
- **Weeks 5-6**: Phase 7 (Polish, controls, monitoring)
>>>>>>> 76d9c26 (Add personality evolution system plan)

### Critical Success Factors
1. **Grounded observations**: Anti-confabulation safeguards must work
2. **Slow evolution**: Personality should emerge over weeks, not days
3. **Operator trust**: Controls must feel safe, not unpredictable
4. **System coherence**: Must integrate with existing emotion/needs systems

---

## **Design Document Updates Required**

1. `docs/SELF-AWARENESS-DESIGN.md` - Add "Personality Evolution System" section
2. `https://furoshiki.ai/architecture.html` - Add personality subsystem to diagram
3. `https://furoshiki.ai/user-help.html` - Operator guide for personality controls
4. `docs/INTEGRATION.md` - New session context fields
5. `https://furoshiki.ai/plugins-extensions.html` - Plugin hooks for personality system

---

## **Risks & Mitigations**

### Risk 1: Confabulated Personality
**Mitigation**: Strict grounding requirements, source tracking, operator audit trail

### Risk 2: Personality Fragmentation
**Mitigation**: Trait coherence checks, weekly synthesis in deep reflection

### Risk 3: Over-Specialization
**Mitigation**: Natural drift rates, trait diversity monitoring

### Risk 4: Operator Distrust
**Mitigation**: Clear controls, visibility, gradual evolution speed

### Risk 5: System Complexity
**Mitigation**: Phased implementation, integration testing at each phase

---

## **Questions for Operator Decision**

1. **Trait vocabulary**: Which initial traits are most valuable? (warmth, playfulness, sarcasm, directness, creativity, empathy)
2. **Evolution speed**: How fast should personality evolve? (Conservative vs adaptive)
3. **Operator controls**: How much manual adjustment vs autonomous development?
4. **Integration priority**: Which existing system should personality integrate with first? (Emotions? Needs? Session context?)
5. **Testing approach**: Manual testing in Telegram vs automated simulation?

---

## **Conclusion**

This plan transforms Furoshiki from a **reactive personality composite** to a **generative, grounded, evolving personality** that:

1. **Discovers itself** through genuine interaction observations
2. **Evolves slowly** based on what feels authentic
3. **Colors responses** without overriding core rules
4. **Builds memory** of "who I'm becoming"
5. **Remains transparent** to operator oversight

The system respects all existing constraints: anti-confabulation, harness-agnostic design, Python-enforced behavior, and genuine best interest orientation.

**Next Step**: Operator review of priority order and trait vocabulary before beginning Phase 1 implementation.