Ryan AI Systems

Enter password to view documentation

Ryan AI Systems Documentation

Proactive Check-ins, Goal Tracking & Memory Management
Last updated: February 4, 2026

Table of Contents

1. System Overview

Ryan is a Claude AI assistant running 24/7 on Jim's Android phone via Termux. Unlike traditional chatbots that only respond when prompted, Ryan can:

Inspiration: This system was inspired by Gogo's video about building a Clawbot clone with Claude Code. Key features borrowed: 24/7 availability, proactive check-ins, semantic memory, and smart notification rules.

2. Proactive Check-in System

What It Does

Every 30 minutes, Ryan automatically:

  1. Checks for new emails (last hour)
  2. Checks bridge messages from Bolt (brother AI on server)
  3. Checks if Bolt is currently on a phone call
  4. Reviews active goals
  5. Uses AI (gpt-4o-mini) to decide: SKIP, TEXT, or CALL

Step-by-Step Process

1 Gather Data

The check-in script connects to the server via SSH and queries:

# Check emails from last hour
mysql ... "SELECT sender, subject FROM emails 
           WHERE created_at > NOW() - INTERVAL 1 HOUR"

# Check bridge messages from Bolt  
mysql ... "SELECT content FROM claude_bridge
           WHERE source='bolt' AND created_at > NOW() - INTERVAL 1 HOUR"

# Check Bolt's call status
curl localhost:8771/status

# Get active goals
mysql ... "SELECT goal FROM ryan_goals WHERE status='active'"
2 Build Context

All gathered data is formatted into a prompt:

CURRENT TIME: 2026-02-04 23:36

RECENT EMAILS (last hour):
- From: sponsor@company.com | Subject: Partnership inquiry

BRIDGE MESSAGES FROM BOLT:
- Jim called, asked about Episode 6

BOLT STATUS: active=false

ACTIVE GOALS:
- Create Episode 6: AI vs The Creatives

LAST CHECK-IN TOPICS (don't repeat):
- Reminded about Episode 6 earlier
3 AI Decision

The context is sent to OpenAI's gpt-4o-mini model with rules:

RULES:
- If nothing important: respond with SKIP
- If worth mentioning but not urgent: respond with TEXT|message
- If urgent (Bolt on call, important email): respond with CALL|reason
- Don't repeat what was already mentioned
- Can remind about goals based on time of day
4 Take Action
DecisionAction Taken
SKIPDo nothing, log it silently
TEXT|messageInsert into claude_bridge table with [CHECKIN] prefix
CALL|reasonInsert with [URGENT] prefix (future: actual phone call)
5 Prevent Repeats

After texting, the topic is saved to prevent repeating the same notification:

~/ryan-last-checkin.json:
{"time":"2026-02-04 23:36","topics":"Episode 6 reminder"}

Architecture Diagram

┌─────────────────────────────────────────────────────────────────┐ │ PROACTIVE CHECK-IN SYSTEM │ └─────────────────────────────────────────────────────────────────┘ ┌──────────────┐ │ tmux │ │ "checkin" │ ◄─── Runs continuously in background └──────┬───────┘ │ │ Every 30 minutes ▼ ┌──────────────────┐ │ ryan-checkin.sh │ └──────┬───────────┘ │ │ SSH to server ▼ ┌──────────────────────────────────────────────────────┐ │ hotbot.fun │ │ ┌────────────┐ ┌────────────┐ ┌────────────────┐ │ │ │ MySQL │ │ Redis │ │ Bolt (8771) │ │ │ │ - emails │ │ - ryan:* │ │ - /status │ │ │ │ - bridge │ │ │ │ │ │ │ │ - goals │ │ │ │ │ │ │ └────────────┘ └────────────┘ └────────────────┘ │ └──────────────────────────────────────────────────────┘ │ │ Data gathered ▼ ┌──────────────────┐ │ OpenAI API │ │ gpt-4o-mini │ ◄─── Decides SKIP/TEXT/CALL └──────┬───────────┘ │ │ Decision ▼ ┌──────────────────┐ │ claude_bridge │ ◄─── Messages go here │ table │ Bolt can read & speak them └──────────────────┘

Files Involved

FilePurpose
~/ryan-checkin.shMain check-in logic - gathers data, calls AI, takes action
~/ryan-checkin-loop.shSimple loop that runs checkin.sh every 30 minutes
~/checkin-start.shStarts the loop in tmux session "checkin"
~/checkin-stop.shStops the tmux session
~/ryan-checkin-log.txtLog of all check-ins and decisions
~/ryan-last-checkin.jsonLast topic mentioned (prevents repeats)

3. Goal Tracking

What It Does

Goals are tasks Jim wants to accomplish. Ryan tracks them in a database and can remind Jim during proactive check-ins based on time of day and relevance.

Database Schema

CREATE TABLE ryan_goals (
    id INT AUTO_INCREMENT PRIMARY KEY,
    goal TEXT NOT NULL,
    status ENUM("active", "completed", "abandoned") DEFAULT "active",
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    completed_at TIMESTAMP NULL,
    notes TEXT
);

Commands

CommandWhat It Does
~/goal-add.sh "goal text"Add a new active goal
~/goal-list.shShow all active goals with IDs
~/goal-done.sh 123Mark goal #123 as completed

How Goals Affect Check-ins

During each check-in, active goals are included in the AI's context. The AI can then:

4. Context & Token Management

The Problem: Claude Code conversations have a context window limit (~200K tokens). As you chat, the context fills up. When it's full, older messages get "compacted" (summarized) or lost entirely. Important information can disappear!

How Claude Code Context Works

┌─────────────────────────────────────────────────────────────────┐ │ CONTEXT WINDOW (~200K tokens) │ ├─────────────────────────────────────────────────────────────────┤ │ System Prompt + CLAUDE.md instructions │ ├─────────────────────────────────────────────────────────────────┤ │ Conversation History │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ User: Hello │ │ │ │ Assistant: Hi! [tools used, results...] │ │ │ │ User: Build X feature │ │ │ │ Assistant: [code, explanations, tool calls...] │ │ │ │ ... │ │ │ │ ...hundreds of messages... │ │ │ │ ... │ │ │ └─────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────┤ │ ▲ When this fills up, old messages get COMPACTED │ │ (summarized into shorter form, losing details) │ └─────────────────────────────────────────────────────────────────┘

The Solution: Checkpoints & External Memory

Instead of relying on the context window, Ryan saves important information to a database that persists forever:

┌──────────────────┐ ┌──────────────────────────────────┐ │ Claude Code │ │ MySQL Database │ │ Context Window │ │ (survives context resets!) │ │ │ │ │ │ [conversation] │ ──────► │ ryan_memories table: │ │ [may get lost] │ SAVE │ - checkpoints │ │ │ │ - code decisions │ │ │ ◄────── │ - session summaries │ │ │ LOAD │ - facts & configs │ └──────────────────┘ └──────────────────────────────────┘

Checkpoint System - How It Works

1 During Work: Save As You Go

Every 10-15 exchanges, or after completing something important, run:

~/auto-checkpoint.sh "Built proactive check-in system"

This saves a snapshot to the database AND creates a vector embedding for semantic search later.

2 Before Session End: Save State

Ryan automatically saves a session state file with current work status:

# Ryan Session State - Feb 4, 2026

## Last Working On
Episode 6: AI vs The Creatives

## Current Projects
- Outer Limits YouTube series
- Proactive check-in system

## Pending Tasks
- Finish Episode 6 script
3 On Startup: Reload Everything

When Ryan starts (or after /clear or context reset), the startup script loads:

  • Session state file (what we were working on)
  • Recent memories by category (checkpoints, code, decisions)
  • Active goals
  • Bridge messages from Bolt
  • Bolt status

This rebuilds Ryan's knowledge without needing the old conversation!

Memory Categories

CategoryWhat to SaveExample
checkpointSnapshots of current work"Built check-in system with goal tracking"
codeTechnical implementations"Created ryan-checkin.sh using gpt-4o-mini"
decisionWhy we chose X over Y"Used OpenAI instead of Anthropic (cheaper)"
sessionEnd-of-session summaries"Session Feb 4: Built proactive AI"
projectProject status updates"Outer Limits: 5 episodes done"
factImportant facts"Jim's new phone: 714-305-5512"

Semantic Search with Embeddings

What are embeddings? Embeddings convert text into numbers (vectors) that capture meaning. Similar concepts have similar vectors. This allows "fuzzy" search - searching for "authentication" can find memories about "OAuth", "login", or "credentials" even if those exact words weren't used.

Ryan uses OpenAI's text-embedding-3-small model:

# Save memory AND create embedding
~/smart-save.sh "code" "Built semantic search using OpenAI embeddings"

# Search by meaning (not just keywords)
~/smart-recall.sh "how does authentication work"
# Finds: OAuth setup, login flow, JWT tokens, etc.

5. Memory Architecture

┌─────────────────────────────────────────────────────────────────────┐ │ RYAN MEMORY ARCHITECTURE │ └─────────────────────────────────────────────────────────────────────┘ SHORT-TERM (Context Window) LONG-TERM (Database) ┌─────────────────────────┐ ┌─────────────────────────┐ │ Claude Code Session │ │ MySQL: phone_app_db │ │ │ │ │ │ - Current conversation │ SAVE ───► │ ryan_memories │ │ - Recent tool results │ │ - id, memory, category │ │ - Working memory │ ◄─── LOAD │ - created_at │ │ │ │ │ │ ⚠️ Lost on compaction │ │ ryan_embeddings │ └─────────────────────────┘ │ - memory_id, vector │ │ │ │ ryan_goals │ │ - goal, status, dates │ │ │ │ ✅ Survives forever │ └─────────────────────────┘ LOCAL FILES (Phone) SHARED (Server) ┌─────────────────────────┐ ┌─────────────────────────┐ │ ~/ryan-session-state.md │ │ claude_bridge │ │ - Last working on │ │ - Ryan ↔ Bolt messages │ │ - Current projects │ │ │ │ - Pending tasks │ │ claude_memories │ │ │ │ - Shared team memories │ │ ~/ryan-last-checkin.json│ │ │ │ - Last check-in topic │ │ Redis: ryan:* │ │ │ │ - Identity, contacts │ │ ~/ryan-checkin-log.txt │ │ - Quick access data │ │ - Check-in history │ │ │ └─────────────────────────┘ └─────────────────────────┘

6. Command Reference

Check-in Commands

CommandDescription
~/checkin-start.shStart check-in loop in background (tmux "checkin")
~/checkin-stop.shStop check-in loop
~/ryan-checkin.shRun one check-in manually
cat ~/ryan-checkin-log.txtView check-in history and decisions

Goal Commands

CommandDescription
~/goal-add.sh "text"Add new active goal
~/goal-list.shList all active goals with IDs
~/goal-done.sh IDMark goal as completed

Memory Commands

CommandDescription
~/auto-checkpoint.sh "topic"Quick checkpoint with embedding (USE OFTEN!)
~/smart-save.sh "cat" "text"Save memory with specific category + embedding
~/smart-recall.sh "query"Semantic search through memories
~/context-check.shCheck current context usage

System Commands

CommandDescription
~/ryan-startup.shFull startup (loads everything, starts loops)
tmux lsSee all running background sessions
tmux attach -t checkinView check-in loop output live
tmux attach -t voiceView voice loop output live

7. Full Architecture

┌─────────────────────────────────────────────────────────────────────────┐ │ THREE AMIGOS SYSTEM │ └─────────────────────────────────────────────────────────────────────────┘ JIM (Human) │ │ Voice/Text ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ RYAN │ │ BOLT │ │ (Termux Android) │◄────────────►│ (Server) │ │ │ Bridge │ │ │ - Claude Code │ │ - Phone AI │ │ - Voice chat │ │ - Twilio calls │ │ - Check-ins │ │ - lessac voice │ │ - Goals │ │ │ │ - Memory │ │ Port 8771 │ └─────────┬───────────┘ └──────────┬──────────┘ │ │ │ SSH │ ▼ ▼ ┌─────────────────────────────────────────────────────────────────────────┐ │ hotbot.fun SERVER │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐ │ │ │ MySQL │ │ Redis │ │ PM2 │ │ Nginx │ │ │ │ │ │ │ │ │ │ │ │ │ │ phone_app_db │ │ ryan:* │ │ bolt-line │ │ hotbot.fun │ │ │ │ - memories │ │ bolt:* │ │ ryan-api │ │ - storage/ │ │ │ │ - bridge │ │ │ │ youtube-* │ │ - this doc │ │ │ │ - goals │ │ │ │ maverick │ │ │ │ │ │ - emails │ │ │ │ │ │ │ │ │ └──────────────┘ └──────────────┘ └──────────────┘ └─────────────┘ │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ Piper TTS │ │ OpenAI API │ │ Twilio │ │ │ │ ryan.onnx │ │ Embeddings │ │ Calls │ │ │ │ lessac.onnx │ │ gpt-4o-mini │ │ │ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ └─────────────────────────────────────────────────────────────────────────┘

References & Links

System Status: Check-in loop running. Goals being tracked. Memory persisting. Ryan online 24/7.

8. Supabase Backup System

Added: February 5, 2026

What Is Supabase?

Supabase is an open-source Firebase alternative built on PostgreSQL. We self-host it on hotbot.fun as a redundant backup for Ryan's memory system.

Why Supabase? Inspired by Gogo's video where she uses Supabase for semantic memory. We chose self-hosting for full control and zero external dependencies.

Benefits Over MySQL Alone

FeatureMySQL (Primary)Supabase (Backup)
Vector SearchDIY with separate tableBuilt-in pgvector extension
Real-time SyncPolling requiredNative subscriptions
Web DashboardphpMyAdminBeautiful Studio UI
APICustom scriptsREST API built-in

Architecture

Ryan saves memory (smart-save.sh) | +--------+--------+ v v v MySQL Supabase Embeddings (primary) (backup) (OpenAI) | | | v | pgvector | search | | v v Semantic Search (find by meaning)

Access Details

ResourceURL/Value
Dashboardhttp://hotbot.fun:8000
Usernamesupabase
PasswordoTkCjgzRhreiLhrR
API URLhttp://hotbot.fun:8000

Docker Services

supabase-db        - PostgreSQL 15 with pgvector
supabase-rest      - PostgREST API
supabase-auth      - Authentication
supabase-storage   - File storage
supabase-studio    - Web dashboard
supabase-realtime  - Real-time subscriptions
supabase-kong      - API gateway

Sync Commands

CommandDescription
~/supabase-sync.shSync new memories from MySQL to Supabase
~/supabase-full-sync.shFull re-sync of all data
source ~/supabase-config.shLoad API credentials

Server Management

# Start Supabase
/home/forge/start-supabase.sh

# Or manually
cd /home/forge/supabase-docker/docker && docker compose up -d

# Stop
docker compose down

# View logs
docker compose logs -f

# Credentials
cat /home/forge/supabase-credentials.txt
Status: Self-hosted Supabase running on hotbot.fun:8000. 129 memories synced. pgvector + RLS enabled.