Skip to content

wil-pe/CATAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CATAI

Virtual desktop pet cats for macOS β€” pixel art cats that live on your dock, chat with you via Ollama LLM, and debate ideas together to help you brainstorm and refine your thoughts.

Swift macOS Ollama

CATAI Demo

πŸŽ₯ Prefer a smoother experience? Watch the full demo video on YouTube

Features

  • Dock companion β€” Cats walk along your dock with pixel-perfect animations
  • Window perching β€” When dock auto-hides, cats teleport to sit on top of your active window
  • Multi-cat β€” Up to 7 cats with distinct colors and personalities
  • AI chat β€” Click a cat to open a pixel-art chat bubble, powered by Ollama
  • Cat Debate mode β€” Your cats debate any topic together! Each cat argues from its personality, then they synthesize a final answer. A creative brainstorming & idea-refining tool
  • Mouse tracking β€” Cats notice your cursor and turn to look at it. Get too close and they'll chase it!
  • Random meows β€” Cats spontaneously say "Miaou~", "Prrr...", "Mrrp!" in cute speech bubbles
  • Pixel art UI β€” Settings panel, chat bubbles, and controls all in retro pixel style
  • Menu bar icon β€” 🐱 icon with quick access to settings and quit
  • Retina ready β€” Nearest-neighbor scaling keeps pixel art crisp on HiDPI displays
  • Multilingual β€” French, English, Spanish (switch with flag buttons)

Cat Personalities

Color Default Name Personality Skill
🟠 Orange Citrouille Playful & mischievous Jokes & puns
⚫ Black Ombre Mysterious & philosophical Deep questions
βšͺ White Neige Elegant & poetic Poetry & grace
πŸ”˜ Grey Einstein Wise & scholarly Science facts
🟀 Brown Indiana Adventurous storyteller Epic tales
🟑 Cream Caramel Cuddly & comforting Emotional support
🐾 Percy Percy Retro geek & hilarious 80s-90s internet references

Animations

Each cat has 368 hand-drawn sprites across 8 directions:

  • Walking / Chasing β€” 8 frames per direction (all 8 directions!)
  • Eating β€” 11 frames per direction
  • Drinking β€” 8 frames per direction
  • Angry β€” 9 frames per direction
  • Waking up β€” 9 frames per direction
  • Idle / Looking / Sleeping β€” Static rotation sprites (8 directions)

Requirements

  • macOS 14+ (Apple Silicon or Intel)
  • Ollama running locally (for chat feature, optional)

Build & Run

Download pre-built app

Grab CATAI.zip from Releases, unzip, then:

xattr -cr CATAI.app   # remove macOS quarantine (app is unsigned)
open CATAI.app

Build from source

./build.sh
open CATAI.app

As standalone binary

swiftc -O -o cat cat.swift -framework AppKit -framework Foundation
./cat

No Xcode project, no dependencies, no package manager β€” just one Swift file.

Settings

Click the 🐱 menu bar icon β†’ Settings:

  • Language β€” πŸ‡«πŸ‡· πŸ‡¬πŸ‡§ πŸ‡ͺπŸ‡Έ click a flag to switch
  • Cats β€” Click a color bubble to add a cat, click Γ— to remove
  • Name β€” Rename each cat
  • Size β€” Pixel art slider to scale cats
  • Ollama model β€” Select from your installed models
  • Debate mode β€” Toggle on/off to enable multi-cat brainstorming

How It Works

  • Single native Swift file (~2000 lines), no external dependencies

  • NSWindow with transparent background for overlay rendering

  • CGWindowListCopyWindowInfo for detecting frontmost windows

  • Dock auto-hide detection via mouse position polling at 30 FPS

  • Color tinting via direct pixel manipulation in sRGB CGContext

  • Ollama streaming chat via URLSessionDataDelegate

  • Conversation memory persisted in UserDefaults

    CATAI Screenshot

Project Structure

.
β”œβ”€β”€ cat.swift              # Entire application (single file)
β”œβ”€β”€ build.sh               # Build .app bundle script
└── cute_orange_cat/       # Sprite assets
    β”œβ”€β”€ metadata.json      # Animation & rotation definitions
    β”œβ”€β”€ rotations/         # 8 static direction sprites (68x68 PNG)
    └── animations/        # 5 animations Γ— 8 directions Γ— 8-11 frames
        β”œβ”€β”€ angry/
        β”œβ”€β”€ drinking/
        β”œβ”€β”€ eating/
        β”œβ”€β”€ running-8-frames/
        └── waking-getting-up/

Changelog

v2.0.2 β€” Debate UX overhaul: focused & non-intrusive (2026-04-16)

  • Focused debate β€” cats now stay strictly on the user-supplied topic
    • System prompt rewritten as 6 strict rules: stay on topic, never derail, attempt creative tasks, personality is just tone, react to others, 2 short sentences
    • Each turn re-asserts the topic in the user message β†’ no more drifting from "write a poem" to "what's a dinosaur"
    • Final synthesis now actually delivers the requested artefact (poem, plan, idea) instead of meta-summarising
  • Non-intrusive bubbles β€” debate bubbles no longer steal focus from your work
    • New passiveMode: ignoresMouseEvents = true, canBecomeKey = false, no input field, no buttons
    • Uses orderFrontRegardless (display only) instead of makeKeyAndOrderFront + NSApp.activate
    • You can keep typing in your editor, switching apps, etc. β€” the debate just unfolds visually above your cats
  • Clicks on cats are ignored during a debate (no accidental flow break)
  • Bubbles auto-revert to interactive mode 8s after the synthesis appears

CATAI Screenshot

v2.0.1 β€” Code quality pass: critical fixes & stability hardening (2026-04-16)

  • Debate engine rewritten as a stateful class β€” eliminates Swift 6 Sendable warnings
    • Validates each cat still exists before its turn (survives mid-debate cat removal)
    • Generation counter invalidates stale callbacks if the debate is stopped
    • DispatchQueue.main.asyncAfter instead of Timer.scheduledTimer from URLSession queue
    • Public stop() called from removeCat and applicationWillTerminate
  • Debate button now appears reliably (didSet observer triggers bubble rebuild)
  • OllamaChat session race fixed β€” no more stale callbacks clearing newer requests
  • Memory β€” tintCache bounded (NSCache, 600 items), getPreview cached, orphan mem_<UUID> purged at startup, URLSession properly invalidated
  • Robustness β€” fatalError at startup β†’ NSAlert with clear message, addCat rolls back on failure, frontmostWindowFrame cached (200 ms) to avoid hammering CGWindowListCopyWindowInfo
  • Code organisation β€” BehaviorTuning enum centralizes AI tuning knobs, Dictionary.localized() helper dedupes the L10n fallback pattern
  • Build is now clean: zero warnings, zero errors

v2.0 β€” Cat Debate: brainstorm with your cats (2026-04-13)

  • Debate mode β€” Your cats now debate any topic together in a dedicated window
    • Each cat argues from its unique personality (philosopher, geek, poet, scientist...)
    • 3 rounds of discussion where cats react to each other's arguments
    • Final synthesis/consensus by the moderator cat
    • Enable/disable via toggle in Settings
  • Debate button in chat bubble β€” When debate mode is on, a "🎀 DΓ©battre !" button appears in each cat's speech bubble
  • Non-streaming Ollama API for reliable multi-turn debate exchanges
  • Fix: Chat bubble input no longer loses focus when cat is walking
  • CATAI is no longer just a desktop companion β€” it's now an idea refinement system powered by multiple AI personalities

v1.3 β€” Percy the retro cat (2026-04-10)

  • New 7th cat: Percy β€” white-grey cat with a unique personality
  • Percy's dad is the "king of the internet" β€” he drops 80s-90s internet references (Astalavista, GeoCities, Netscape, IRC, BBS, AOL, 56k modems, ICQ...)
  • Custom pixel-level desaturation tinting for Percy's white-grey look
  • Custom bicolor bubble in the cat color picker
  • Cat name displayed in chat bubble
  • Performance: Sprite tint cache, conditional image updates, shared mouse polling, reduced dock polling

v1.2 β€” Mouse tracking & code polish (2026-04-08)

  • Cats now look toward your cursor when it's nearby (8 directions!)
  • Cats chase the cursor when it gets close enough
  • Sleeping cats wake up if you wave the cursor near them
  • Centralized UI color palette for consistency
  • Simplified Ollama model fetching
  • Fixed angle mapping gap at 360 degrees
  • Code optimizations (hypot, removed dead code)

v1.1 β€” Bug fixes (2026-04-07)

  • Fix cats floating after resize or dock refresh
  • Fix chat bubble losing position near screen edge
  • Remove force unwraps with safe fallbacks
  • Fix potential crash in clamshell mode
  • Fix memory leak on quit (monitors & timers)
  • Fix fragile scale slider timer

v1.0 β€” Initial release (2026-04-06)

  • Multi-cat support with 6 color variants
  • Distinct AI personalities per color
  • Pixel art UI with custom controls
  • Walk on dock and window title bars
  • Random meow speech bubbles
  • Chat memory persistence
  • macOS .app bundle with build script

Multiplatform port in progress (Tauri v2) β€” Windows & Linux coming soon! 🐱✨

Thanks

A huge thank you to Korben.info for the mention!

License

MIT