refactor: Transform daemon_boyfriend into Loyal Companion

Rebrand and personalize the bot as 'Bartender' - a companion for those
who love deeply and feel intensely.

Major changes:
- Rename package: daemon_boyfriend -> loyal_companion
- New default personality: Bartender - wise, steady, non-judgmental
- Grief-aware system prompt (no toxic positivity, attachment-informed)
- New relationship levels: New Face -> Close Friend progression
- Bartender-style mood modifiers (steady presence)
- New fact types: attachment_pattern, grief_context, coping_mechanism
- Lower mood decay (0.05) for emotional stability
- Higher fact extraction rate (0.4) - Bartender pays attention

Updated all imports, configs, Docker files, and documentation.
This commit is contained in:
2026-01-14 18:08:35 +01:00
parent 3d939201f0
commit dbd534d860
60 changed files with 310 additions and 381 deletions

View File

@@ -12,16 +12,13 @@ pip install -r requirements.txt
pip install -e .
# Run the bot (requires .env with DISCORD_TOKEN and AI provider key)
python -m daemon_boyfriend
python -m loyal_companion
# Run with Docker (includes PostgreSQL)
docker-compose up -d
# Run database migrations
alembic upgrade head
# Syntax check all Python files
python -m py_compile src/daemon_boyfriend/**/*.py
python -m py_compile src/loyal_companion/**/*.py
```
## Testing
@@ -34,7 +31,7 @@ pip install -e ".[dev]"
python -m pytest tests/ -v
# Run tests with coverage
python -m pytest tests/ --cov=daemon_boyfriend --cov-report=term-missing
python -m pytest tests/ --cov=loyal_companion --cov-report=term-missing
# Run specific test file
python -m pytest tests/test_models.py -v
@@ -50,7 +47,7 @@ The test suite uses:
## Architecture
This is a Discord bot that responds to @mentions with AI-generated responses (multi-provider support). It features a "Living AI" system that gives the bot personality, mood, and relationship tracking.
Loyal Companion is a Discord bot companion for those who love deeply and feel intensely. It features a "Living AI" system called Bartender - a wise, steady presence who listens without judgment, understands attachment theory, and knows when to offer perspective versus when to just hold space.
### Provider Pattern
The AI system uses a provider abstraction pattern:
@@ -75,11 +72,10 @@ The bot uses PostgreSQL for persistent memory (optional, falls back to in-memory
- `services/database.py` - Connection pool and async session management
- `services/user_service.py` - User CRUD, custom names, facts management
- `services/persistent_conversation.py` - Database-backed conversation history
- `alembic/` - Database migrations
Key features:
- Custom names: Set preferred names for users so the bot knows "who is who"
- User facts: Bot remembers things about users (hobbies, preferences, etc.)
- User facts: Bot remembers things about users (hobbies, preferences, attachment patterns, grief context)
- Persistent conversations: Chat history survives restarts
- Conversation timeout: New conversation starts after 60 minutes of inactivity
@@ -88,8 +84,8 @@ The bot implements a "Living AI" system with emotional depth and relationship tr
#### Services (`services/`)
- `mood_service.py` - Valence-arousal mood model with time decay
- `relationship_service.py` - Relationship scoring (stranger to close friend)
- `fact_extraction_service.py` - Autonomous fact learning from conversations
- `relationship_service.py` - Relationship scoring (new face to close friend)
- `fact_extraction_service.py` - Autonomous fact learning from conversations (including attachment patterns, grief context, coping mechanisms)
- `opinion_service.py` - Bot develops opinions on topics over time
- `self_awareness_service.py` - Bot statistics and self-reflection
- `communication_style_service.py` - Learns user communication preferences
@@ -110,14 +106,14 @@ Uses a valence-arousal model:
- Valence: -1 (sad) to +1 (happy)
- Arousal: -1 (calm) to +1 (excited)
- Labels: excited, happy, calm, neutral, bored, annoyed, curious
- Time decay: Mood gradually returns to neutral
- Time decay: Mood gradually returns to neutral (slower decay = steadier presence)
#### Relationship Levels
- Stranger (0-20): Polite, formal
- Acquaintance (21-40): Friendly but reserved
- Friend (41-60): Casual, warm
- Good Friend (61-80): Personal, references past talks
- Close Friend (81-100): Very casual, inside jokes
- New Face (0-20): Warm but observant - "Pull up a seat" energy
- Getting to Know You (21-40): Building trust, remembering details
- Regular (41-60): Comfortable familiarity - "Your usual?"
- Good Friend (61-80): Real trust, can be honest even when hard
- Close Friend (81-100): Deep bond, full honesty, reflects patterns with love
### Configuration
All config flows through `config.py` using pydantic-settings. The `settings` singleton is created at module load, so env vars must be set before importing.
@@ -153,12 +149,12 @@ Optional:
- `MOOD_ENABLED` - Enable mood system (default: true)
- `RELATIONSHIP_ENABLED` - Enable relationship tracking (default: true)
- `FACT_EXTRACTION_ENABLED` - Enable autonomous fact extraction (default: true)
- `FACT_EXTRACTION_RATE` - Probability of extracting facts (default: 0.3)
- `FACT_EXTRACTION_RATE` - Probability of extracting facts (default: 0.4)
- `PROACTIVE_ENABLED` - Enable proactive messages (default: true)
- `CROSS_USER_ENABLED` - Enable cross-user memory associations (default: false)
- `OPINION_FORMATION_ENABLED` - Enable bot opinion formation (default: true)
- `STYLE_LEARNING_ENABLED` - Enable communication style learning (default: true)
- `MOOD_DECAY_RATE` - How fast mood returns to neutral per hour (default: 0.1)
- `MOOD_DECAY_RATE` - How fast mood returns to neutral per hour (default: 0.05)
### Command Toggles
- `COMMANDS_ENABLED` - Master switch for all commands (default: true)