Created by Hanna Lovvold (2025)
A completely standalone modern GTK4/libadwaita AI companion application with SMS integration, memory management, and multi-companion support.
Kardia is now 100% standalone - all backend code is included. No need for the parent ai-companion directory!
- Modern GTK4/libadwaita Interface - Beautiful GNOME-style UI
- Multiple AI Companions - Create custom companions with personalities
- SMS Integration - Send/receive SMS via Twilio
- Multi-Companion SMS - Different companions for different phone numbers
- SMS Commands - Control companions via text commands
- Memory System - AI remembers details about you
- Conversation History - All conversations saved
- Customizable - Create your own companions with traits, goals, and backstories
- Python 3.8 or higher
- Linux (GTK4/libadwaita)
- GNOME 42+ or GTK4 environment
# Required packages
pip install gi-gtk gi-adwaita
# Backend dependencies
pip install openai anthropic groq
pip install python-dotenv requests twilio flask
# Optional: for Ollama (local AI)
# Install Ollama separately from https://ollama.aisudo apt install python3-gi python3-gi-cairo gir1.2-gtk-4.0 gir1.2-adwaita-1sudo dnf install python3-gobject gtk4 libadwaita# Install Python packages
pip install -r requirements.txt
# Or install individually
pip install gi-gtk gi-adwaita openai anthropic groq python-dotenv requests twilio flaskCreate a .env file in the Kardia directory:
# For Groq (FREE, recommended)
AI_BACKEND=groq
API_KEY=gsk_your_api_key_here
API_URL=https://api.groq.com/openai/v1
API_MODEL=llama-3.3-70b-versatile
# For OpenAI
# AI_BACKEND=openai
# API_KEY=sk-your_api_key_here
# API_URL=https://api.openai.com/v1
# API_MODEL=gpt-3.5-turbo
# For Ollama (local, free)
# AI_BACKEND=ollama
# OLLAMA_URL=http://localhost:11434
# OLLAMA_MODEL=mistral
# Additional Parameters (JSON format, optional)
API_PARAMS={"thinking": {"type": "enabled", "clear_thinking": "true"}, "do_sample": "true"}cd /home/hanna/PythonProjects/Kardia
python3 main.py-
Install Flask:
pip install flask
-
Configure Twilio in
.env:TWILIO_ACCOUNT_SID=your_account_sid TWILIO_AUTH_TOKEN=your_auth_token TWILIO_PHONE_NUMBER=+1234567890 USER_PHONE_NUMBER=+0987654321 WEBHOOK_PORT=5000
-
Setup ngrok (for local development):
ngrok http 5000
-
Configure Twilio Webhook:
- Go to Twilio Console โ Your Phone Number โ Messaging
- Set webhook URL to:
https://your-ngrok-url.ngrok.io/sms/incoming
See SMS_FEATURES_GUIDE.md in parent directory for details.
- Click "+ Create Companion" button
- Fill in basic info:
- Name
- Gender/Pronouns
- Select personality traits (use quick-select presets or custom)
- Set relationship goal and communication tone
- Add background story (optional)
- Click "Save"
- Click "Change Companion" button
- Select from available companions
- Or use SMS commands:
/switch [name]
- Click the trash icon in the chat header
- Confirm to delete all messages and start fresh
- Go to Settings โ Memory tab
- View recent memories
- Add memories manually
- Search memories
- Export/Import memories
- Clear all memories
- Go to Settings โ Your Profile (or click profile button in header)
- Fill in your personal information
- Add interests, likes, dislikes
- Set goals
- Save to create shared memories
All data is stored in the Kardia directory:
Kardia/
โโโ companion_data/
โ โโโ companions.json # Preset companions
โ โโโ presets/ # Custom companions (created by you)
โโโ conversations/ # Conversation history
โโโ memories/ # Memory storage
โโโ config # App configuration
โโโ .env # Environment variables (create this)
- Ctrl+Q - Quit application
- Escape - Go back to companion selection
Edit style.css to customize the appearance:
- Message bubble colors
- Chat input styling
- Personality trait chips
- And more...
Companion data structure:
{
"id": "unique_id",
"name": "Companion Name",
"gender": "Female/Male/Non-Binary/etc",
"pronouns": "she/her",
"personality": "Detailed personality description",
"interests": ["interest1", "interest2"],
"greeting": "Initial greeting message",
"relationship_goal": "Being a supportive friend",
"tone": "Warm and affectionate",
"background": "Backstory",
"image_path": "/path/to/image.png"
}Error: ModuleNotFoundError: No module named 'gi'
Solution:
sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-4.0 gir1.2-adwaita-1Error: Theme parser errors in style.css
Solution: GTK4 CSS has limited properties. The included CSS has been validated for GTK4.
Solution:
- Check Flask is installed:
pip install flask - Verify Twilio credentials in
.env - Ensure ngrok is running
- Check webhook URL in Twilio Console
Solution:
- Check backend configuration in
.env - Verify API key is valid
- Test connection in Settings โ AI Backend
See parent directory for detailed guides:
SMS_WEBHOOK_SETUP.md- SMS webhook setup guideSMS_FEATURES_GUIDE.md- Advanced SMS features guide
Copyright (c) 2025 Hanna Lovvold. All rights reserved.
This software is provided as-is without warranty of any kind.
Hanna Lovvold (2025)
Design and development of the Kardia AI Companion application.
- GTK4/libadwaita - Modern GNOME UI framework
- GNOME HIG - Human Interface Guidelines
- Twilio - SMS services infrastructure
- AI Providers - OpenAI, Groq, Anthropic, Together AI, DeepSeek, etc.
- Python - Programming language
- Flask - Webhook server for incoming SMS
Version: 1.0.0 (GTK4) Platform: Linux with GTK4/libadwaita Language: Python 3.8+ Created by: Hanna Lovvold