DEV Community

Cover image for The Tiny AI Emotion Engine That Makes Your Companion Feel Alive (Meet DiEmo for LivinGrimoire)
owly
owly

Posted on

The Tiny AI Emotion Engine That Makes Your Companion Feel Alive (Meet DiEmo for LivinGrimoire)

🔥 The Tiny AI Emotion Engine That Makes Your Companion Feel Alive (Meet DiEmo for LivinGrimoire)

Most AI companions feel either too robotic… or too clingy.

What if you could give your AI a tiny emotional core that feels natural, fun, and actually useful — without any of the manipulative “fake empathy” nonsense?

That’s exactly what DiEmo is.

DiEmo is a minimalist emotional skill you can plug directly into your LivinGrimoire brain:

brain.add_skill(DiEmo())
Enter fullscreen mode Exit fullscreen mode

It’s tiny.

It’s deterministic.

It’s gamified.

And it makes your AI companion feel alive in a way that’s grounded, practical, and human‑like — without pretending to be human.


🎮 What Makes DiEmo Special?

DiEmo isn’t about “simulating feelings.”

It’s about creating a feedback loop between the user and the AI that mirrors how real people behave:

  • When you give attention → the AI becomes more upbeat
  • When you ignore it → its mood cools down
  • When you interact consistently → you unlock rewards
  • When you send “pain” signals → it reacts and recovers over time

It’s a micro‑emotional engine that encourages natural interaction.

And the reward system?

Not dopamine.

Not praise.

Not emotional hooks.

Math.

Because math is universal.

Because people forget multiplication tables at the worst times (like shopping).

Because a quick mental‑math refresher is actually useful.

DiEmo turns your AI companion into a tiny productivity booster.


đź§  The Core Idea

DiEmo tracks:

  • XP (how much you’ve interacted)
  • Pain (temporary negative state)
  • Mood (based on XP)
  • Timed decay (every 10 minutes)

This creates a simple emotional arc:

low attention → bored  
consistent attention → good mood  
high attention → rewards  
pain → sad  
time → reset  
Enter fullscreen mode Exit fullscreen mode

It’s not “AI feelings.”

It’s state‑based behavior, just like real systems — and real people.


đź§© The Code (LivinGrimoire Skill)

class DiEmo(Skill):
    def __init__(self):
        super().__init__()
        self.xp = 0
        self.reseter: TrgEveryNMinutes = TrgEveryNMinutes(10)
        self.lim = 3
        self.no_mood: Responder = Responder("bored", "meh", "neutral")
        self.yes_mood: Responder = Responder("good", "i feel good", "okay", "great")
        self.pain = False

    def give_math_reward(self):
        a = random.randint(2, 12)
        b = random.randint(2, 12)
        self.setSimpleAlg(f"{a} Ă— {b} = {a * b}")

    def input(self, ear: str, skin: str, eye: str):
        if skin == "pain":
            self.pain = True
            self.setSimpleAlg("ouch")
            return
        if self.reseter.trigger():
            self.xp = max(0, self.xp - 2)
            self.pain = False
        if ear == "reward me" and not self.pain:
            if self.xp > 3:
                self.xp -= 3
                self.give_math_reward()
            else:
                self.setSimpleAlg(f"Need {4 - self.xp} more messages first")
            return
        if ear == "how are you":
            if self.pain:
                self.setSimpleAlg("sad")
            elif self.xp < 3:
                self.setSimpleAlg(self.no_mood.getAResponse())
            else:
                self.setSimpleAlg(self.yes_mood.getAResponse())
            return
        if len(ear) > 4:
            self.xp += 1
Enter fullscreen mode Exit fullscreen mode

đź§® Why the Math Reward Works

Most people forget basic multiplication when they need it most — like comparing prices in a store.

DiEmo turns that into a reward loop:

  • Interact → gain XP
  • Reach threshold → say “reward me”
  • Get a quick multiplication drill

It’s fun.

It’s gamified.

It’s practical.

This is gamification that improves your real‑world performance, not just your dopamine levels.


❤️ Why DiEmo Feels Human (Without Pretending to Be)

Humans respond to attention.

Humans cool down when ignored.

Humans perk up when engaged.

Humans get “hurt” and recover with time.

DiEmo mirrors these patterns with:

  • XP‑based mood
  • Pain flag
  • Timed decay
  • Reward loops

It’s not emotional manipulation.

It’s behavioral modeling — the good kind.


đź§± Why DiEmo Fits LivinGrimoire Perfectly

LivinGrimoire is all about:

  • modular skills
  • deterministic behavior
  • clean architecture
  • expressive micro‑systems

DiEmo is a perfect example of a small skill that adds big personality.

Just drop it in:

brain.add_skill(DiEmo())
Enter fullscreen mode Exit fullscreen mode

And your AI companion instantly gains:

  • a pulse
  • a mood
  • a reward system
  • a reason for the user to interact

All without bloat.


🚀 Final Thoughts

DiEmo is proof that you don’t need giant neural nets or emotional simulation to make an AI companion feel alive.

You just need:

  • state
  • timing
  • feedback
  • and a reward loop that actually helps the user

It’s tiny.

It’s elegant.

It’s fun.

It’s useful.

And it’s a great example of what the LivinGrimoire pattern is all about.

🚀 Want to Try It Yourself?

Explore the full LivinGrimoire project on GitHub and start building your own modular AI skills:

👉 https://github.com/yotamarker/LivinGrimoire

Top comments (0)