I Built a Desktop Tamagotchi Cat with AI Brain in Swift - and It Lives on My macOS Doc

Published: (March 7, 2026 at 10:05 PM EST)
3 min read
Source: Dev.to

Source: Dev.to

Cover image for I Built a Desktop Tamagotchi Cat with AI Brain in Swift - and It Lives on My macOS Doc

You know that feeling when you’re coding at 2 AM and wish someone was there with you?

Meet Murchi — a kawaii desktop cat that lives on your macOS dock, walks around your screen, reacts to your music, and now can actually talk to you powered by Gemini AI.

What is this?

Murchi is a desktop Tamagotchi for macOS. A tiny animated cat that:

  • 🐾 Walks on your Dock like it’s a shelf
  • 🎵 Detects Apple Music / Spotify and dances (or hates your music 25 % of the time)
  • 😿 Goes to the corner and cries if you punish it
  • 🖱️ Dangles from the scruff when you drag it
  • 💬 Chats with you via Gemini AI — in character, as a cat
  • 🐟 Needs feeding, bathing, playing — classic Tamagotchi loop

It sits in your menu bar as =^.^= and just… lives there.

The Tech Stack (it’s cursed and I love it)

The entire app is one Swift file (~7 000 lines). No Xcode project, no storyboards, no SwiftUI.

  • Pure AppKitNSPanel, NSImageView, raw CGContext drawing
  • SVG strings rendered to NSImage – every animation frame is an SVG built in code
  • No sprites, no assets – the cat is literally constructed from Bézier paths and hex colors
  • Gravity physics, dock detection via CGWindowListCopyWindowInfo
  • Music detection via AppleScript (tell application "Spotify" to player state)
  • AI chat via Gemini 2.0 Flash REST API with URLSession
  • Built and packaged with a 100‑line build-app.sh – no Xcode needed

The AI Part

The cat has personality. When you chat with it, Gemini knows:

  • The cat’s name, level, and evolution stage
  • Current mood, hunger, happiness stats

It responds in 1‑3 sentences with cat sounds (“mrrrow~!”, “purrr”).

let systemPrompt = """
You are Murchi, an adorable kawaii desktop cat.
Your personality: playful, cute, a bit mischievous.
Keep responses SHORT. Use cat sounds like "mrrrow", "mew".
Current mood: \(stats.mood). Hunger: \(Int(stats.hunger))%.
"""

Users can plug in their own Gemini API key in settings, or it works out of the box.

The Entire Thing Was Built with Claude Code

This project was built almost entirely in conversation with Claude Code (Anthropic’s CLI agent). I described what I wanted, it wrote the code, I tested, gave feedback, and it fixed.

Workflow example

  1. Me: “I want a cat that walks on the dock.”
  2. Claude: writes 2 000 lines of SVG renderer.
  3. Me: “The cat is orange, it should be peach.”
  4. Claude: rewrites the renderer.
  5. Me: “Now make it talk with AI.”
  6. Claude: adds Gemini integration in 15 minutes.

Every commit in the repo is co‑authored with Claude. This shows how AI‑assisted development can augment a developer rather than replace them.

Try It

It’s free, open source, and works on any Mac (macOS 12+):

No Xcode needed to build – just run bash build-app.sh.

If you’ve ever wanted a pet on your desktop that judges your music taste and occasionally poops on your screen — this is it.

mrrrow~! 🐱

0 views
Back to Blog

Related posts

Read more »