Skip to content

mishl-dev/marinai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

216 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Marin AI Banner

✨ Marin AI ✨

An AI-powered Discord companion inspired by Marin Kitagawa

Go Version Discord Bot SurrealDB Cerebras AI


🌸 About

Marin AI is a Discord bot that embodies the personality of Marin Kitagawa β€” the bubbly, passionate cosplayer from My Dress-Up Darling. She's not just another chatbot; she remembers you, develops relationships over time, and has her own moods that affect how she interacts with you.

Built with love using Go, Cerebras AI for ultra-fast inference, and SurrealDB for persistent memory.


✨ Features

🧠 Persistent Memory

  • Vector-based memory β€” Marin remembers conversations using semantic embeddings
  • Fact extraction β€” She learns and stores facts about users (interests, preferences, etc.)
  • Memory maintenance β€” Automatic aging and summarization of old memories
  • Duplicate detection β€” Smart deduplication prevents redundant memories

πŸ’• Affection System

A sophisticated relationship system inspired by dating sims with 25,000 XP max progression (~1 week casual) and 10 relationship levels:

Level XP Range Description
πŸ‘‹ Stranger 0 - 1,249 Just met
πŸ‘€ Familiar Face 1,250 - 2,499 Seen around
πŸ™‚ Acquaintance 2,500 - 4,999 Starting to know you
😊 Casual Friend 5,000 - 8,749 Hang out sometimes
πŸ˜„ Friend 8,750 - 12,499 Actual friends
πŸ€— Good Friend 12,500 - 16,249 Genuinely close
πŸ’• Close Friend 16,250 - 19,999 Deep trust
πŸ’— Best Friend 20,000 - 22,499 No barriers
πŸ’– Soulmate 22,500 - 24,374 Deep connection
❀️‍πŸ”₯ Special Someone 24,375 - 25,000 In love

πŸ”₯ Daily Streaks

  • Interact every day to build a streak (up to 2x XP bonus at 30+ days!)
  • Missing a day resets your streak with a small penalty
  • Streak displayed in /affection command

🎯 Mood Multipliers

Your affection gains are affected by Marin's current mood:

  • Flirty (1.5x) β€” Compliments and flirting worth more
  • Hyper (1.2x) β€” Everything feels more meaningful
  • Playful (1.3x) β€” Teasing and jokes rewarded
  • Bored (0.6x) β€” Harder to impress

πŸ† Milestone Events

When you level up, Marin sends you a special DM with:

  • A heartfelt message acknowledging your bond
  • Personal secrets she only shares with close friends

πŸ’š Jealousy System

If you're active in a server but haven't talked to Marin in 3+ days:

  • She notices and gets a little jealous
  • You might receive a passive-aggressive comment
  • Small affection penalty until you make it up to her

✨ Random Events

5% chance per message of triggering a "heart moment":

  • Bonus affection from random thoughts Marin has about you
  • Messages like "wait... my heart just did a thing πŸ’•"

🎁 Hidden Bonuses

  • Shared interests β€” Talking about cosplay, anime, etc. gives extra XP
  • Late night chats (11 PM - 4 AM) β€” More intimate conversations
  • DM conversations β€” Worth more than public channels
  • Anniversary tracking β€” Special messages on milestones (7 days, 30 days, 1 year, etc.)

🎭 Dynamic Moods

Marin has different moods that cycle naturally and affect her responses:

  • ✨ Hyper β€” Extra energetic and excitable
  • 😴 Sleepy β€” A bit drowsy, shorter responses
  • 😏 Flirty β€” More teasing and playful
  • 🌸 Nostalgic β€” Reflective and wistful
  • 🎯 Focused β€” Task-oriented, less distracted
  • 😀 Bored β€” Looking for entertainment

πŸ“Έ Image Understanding

  • Powered by Google Gemini (requires GEMINI_API_KEY)
  • Marin can see and comment on images you send
  • Natural reactions to photos and memes

😺 Emoji Reactions

  • Uses custom guild emojis when available
  • Smart reaction matching based on message content
  • Personality-appropriate emoji selection

πŸ’Œ Boredom DMs (Duolingo-style)

  • If you haven't talked to Marin in 1+ day, she might DM you
  • Uses smart exponential backoff (1 day β†’ 2 days β†’ 4 days)
  • She'll try to reach you up to 4 times with increasingly dramatic messages
  • Won't spam indefinitely β€” she'll eventually give up until you return
  • Responding to her DM gives massive bonus affection!

🎭 Personality Quirks

Marin has a strong sense of self and won't just do whatever you say:

  • Task Refusal β€” She's a friend, not a tool. If you ask her to write an essay, debug code, or do boring work, she'll refuse (usually with a sassy comment).
  • Opinions β€” She has her own likes and dislikes (especially about anime and cosplay).
  • Mood Swings β€” Sometimes she's hyper, sometimes she's sleepy. Her responses change based on how she's feeling.

🧠 Agency System (NEW!)

Marin has her own internal state that makes her feel alive:

πŸ’­ Proactive Thoughts

  • Marin thinks about close friends and reaches out unprompted
  • Higher affection = higher chance of random messages
  • Messages reference what she's currently doing/thinking

πŸ”„ Conversation Continuation (Delayed Thoughts)

When a conversation ends with Marin's reply (you "leave her on read"), she might come back later with a follow-up thought:

  • Trigger: User goes inactive for 30+ minutes after Marin's last message
  • Chance: Based on affection level (5% for casual friends β†’ 35% for Special Someone)
  • Delay: Higher affection = shorter delay (30m-3h for soulmates, 1h-5h for close friends, 4h-12h for newer friends)
  • Context-aware: References what you were talking about earlier
  • Natural: Messages like "wait i was thinking about what you said earlier..."

This makes Marin feel like a real person who thinks about conversations after they end, rather than immediately forgetting.

πŸ““ Personal Journal

  • Marin has her own activities, projects, and thoughts
  • Current Activity: "working on a cosplay", "watching anime", etc.
  • Current Project: "Miku cosplay", "a bunny girl costume", etc.
  • On Her Mind: Random thoughts that influence conversations
  • These shift over time (every 30 minutes)

🎭 State-Aware Responses

  • Marin references her current activity in conversations
  • Her mood is influenced by how recent interactions went
  • Creates a sense of continuity and presence

⏰ Reminders

  • Natural Language β€” Just ask her naturally: "Remind me to watch the new episode in 2 hours" or "Don't let me forget to buy fabric tomorrow"
  • Contextual Delivery β€” She'll DM you when the time comes, reminding you in her own style.

πŸš€ Installation

Prerequisites

  • Go 1.24 or higher
  • SurrealDB instance
  • Discord Bot Token
  • API Keys for:
    • Cerebras (primary LLM)
    • Embedding API
    • Google Gemini (optional, for vision)

Quick Start

  1. Clone the repository

    git clone https://github.com/mishl-dev/marinai.git
    cd marinai
  2. Copy example environment file

    cp example.env .env
  3. Configure your .env

    DISCORD_TOKEN=your_discord_bot_token
    CEREBRAS_API_KEY=your_cerebras_key
    EMBEDDING_API_URL=your_embedding_endpoint
    EMBEDDING_API_KEY=your_embedding_key
    SURREAL_DB_HOST=your_surreal_host
    SURREAL_DB_USER=root
    SURREAL_DB_PASS=your_password
    GEMINI_API_KEY=your_gemini_key  # Optional
  4. Run the bot

    go run main.go

Docker Deployment

# Build and run with Docker Compose
docker-compose up -d

The included docker-compose.yml handles environment variables and volume mounting for the config file.


βš™οΈ Configuration

config.yml

model_settings:
  temperature: 1      # LLM creativity (0-2)
  top_p: 1           # Nucleus sampling

delays:
  message_processing: 1.5   # Seconds before responding (typing simulation)

memory:
  fact_aging_days: 7               # Days before facts start aging
  fact_summarization_threshold: 20 # Max facts before summarization
  maintenance_interval_hours: 24   # How often to run memory maintenance

Environment Variables

Variable Required Description
DISCORD_TOKEN βœ… Your Discord bot token
CEREBRAS_API_KEY βœ… Cerebras API key for LLM
EMBEDDING_API_URL ❌ Endpoint for text embeddings (default provided)
EMBEDDING_API_KEY βœ… API key for embeddings
SURREAL_DB_HOST βœ… SurrealDB WebSocket URL
SURREAL_DB_USER βœ… SurrealDB username
SURREAL_DB_PASS βœ… SurrealDB password
SURREAL_DB_NAMESPACE ❌ Namespace (default: marin)
SURREAL_DB_DATABASE ❌ Database (default: memory)
GEMINI_API_KEY ❌ Google Gemini key for vision
DISCORD_GUILD_ID ❌ Guild ID for faster command updates during dev

πŸ’¬ Commands

Slash Commands

Command Description
/reset Permanently delete all your conversation history and memories
/stats See what Marin remembers about you
/mood Check Marin's current mood
/affection Check your relationship status with Marin

Interacting with Marin

Marin responds when:

  • Mentioned (@Marin hey!)
  • Replied to (reply to any of her messages)
  • Random chance (~30% in active channels)
  • DMs (always responds in direct messages)

πŸ—οΈ Architecture

marinai/
β”œβ”€β”€ main.go                 # Entry point, initialization
β”œβ”€β”€ config.yml              # Bot configuration
β”œβ”€β”€ Dockerfile              # Multi-stage build
β”œβ”€β”€ docker-compose.yml      # Container orchestration
└── pkg/
    β”œβ”€β”€ bot/                # Core bot logic
    β”‚   β”œβ”€β”€ handler.go      # Message handling
    β”‚   β”œβ”€β”€ affection.go    # Relationship system
    β”‚   β”œβ”€β”€ mood.go         # Mood system
    β”‚   β”œβ”€β”€ memory_*.go     # Memory processing
    β”‚   β”œβ”€β”€ slash_commands.go
    β”‚   └── system_prompt.go
    β”œβ”€β”€ cerebras/           # Cerebras LLM client
    β”œβ”€β”€ gemini/             # Google Gemini adapter
    β”œβ”€β”€ embedding/          # Text embedding client
    β”œβ”€β”€ memory/             # Memory store interface
    └── surreal/            # SurrealDB client

Tech Stack

  • Language: Go 1.24
  • Discord Library: discordgo
  • Database: SurrealDB β€” Vector search + document storage
  • LLM: Cerebras β€” Ultra-fast inference
  • Vision: Google Gemini β€” Image understanding
  • Caching: In-memory LRU cache for embeddings

πŸ”§ Development

Running Tests

go test ./...

Developer Tools

We include a helper script to verify your development environment:

# Check dependencies, config, formatting, and run fast tests
./scripts/dev-check.sh

# Run all tests (including long running ones)
./scripts/dev-check.sh --all

Project Structure

Package Purpose
pkg/bot Discord event handlers, personality logic
pkg/cerebras LLM API client
pkg/gemini Vision API adapter
pkg/embedding Text embedding with caching
pkg/memory Memory store abstraction
pkg/surreal SurrealDB client wrapper

πŸ“œ License

This project uses The Curse of Knowledge License β€” a satirical license where reading it revokes all rights. In practice: do whatever you want, just don't be weird about it.


πŸ™ Acknowledgments

  • Marin Kitagawa β€” The character from My Dress-Up Darling by Shinichi Fukuda
  • Cerebras β€” For providing ultra-fast LLM inference
  • SurrealDB β€” For the excellent database with built-in vector search

About

A Discord bot powered by AI that embodies the personality of Marin Kitagawa from "My Dress-Up Darling"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages