Skill: caioiscoding/omi-me (version 1.0.0)

--- name: omi-me description: Complete Omi.me integration for memories, action items (tasks), and conversations. Full CRUD + sync capabilities for OpenClaw. homepage: https://omi.me metadata: openclaw: emoji: "🧠" requires: bins: ["omi", "omi-token"] env: ["OMI_API_TOKEN"] --- # Omi.me Integration for OpenClaw Complete integration with Omi.me to sync and manage memories, action items (tasks), and conversations. Provides CLI tools. ## Table of Contents - [Setup](#setup) - [Token Management](#token-management) - [CLI Commands](#cli-commands) - [Memories](#memories) - [Action Items / Tasks](#action-items--tasks) - [Conversations](#conversations) - [Sync](#sync) - [Usage Examples](#usage-examples) ## Setup ### Automated Setup ```bash # Run the setup script bash /home/ubuntu/.openclaw/workspace/skills/omi-me/scripts/setup.sh ``` The setup script will: 1. Create config directory `~/.config/omi-me/` 2. Guide you to configure your API token 3. Create symlinks for `omi` and `omi-token` commands ### Manual Setup ```bash # Create config directory mkdir -p ~/.config/omi-me # Save your API token echo "omi_dev_your_token_here" > ~/.config/omi-me/token chmod 600 ~/.config/omi-me/token ``` ### Get API Token 1. Visit https://docs.omi.me/doc/developer/api/overview 2. Generate a developer API key 3. Configure using: ```bash # Interactive (recommended) omi-token.sh set # Or manually echo "your-token" > ~/.config/omi-me/token ``` ## Token Management ```bash omi-token.sh set # Configure API token interactively omi-token.sh get # Print current token omi-token.sh test # Test connection to Omi.me ``` ### Token File Default location: `~/.config/omi-me/token` You can also set via environment variable: ```bash export OMI_API_TOKEN="your-token" ``` ### Files - `~/.config/omi-me/token` - API token storage ## CLI Commands ### Token Management | Command | Description | |---------|-------------| | `omi-token.sh set` | Configure API token interactively | | `omi-token.sh get` | Print current API token | | `omi-token.sh test` | Test connection to Omi.me | ### Memories | Command | Description | |---------|-------------| | `omi memories list` | List all memories | | `omi memories get <id>` | Get specific memory | | `omi memories create "content"` | Create new memory | | `omi memories create "content" --type preference` | Create with type | | `omi memories update <id> "new content"` | Update memory content | | `omi memories delete <id>` | Delete a memory | | `omi memories search "query"` | Search memories | ### Action Items / Tasks | Command | Description | |---------|-------------| | `omi tasks list` | List all action items | | `omi tasks get <id>` | Get specific task | | `omi tasks create "title"` | Create new task | | `omi tasks create "title" --desc "description" --due "2024-01-15"` | Create with details | | `omi tasks update <id> --title "new title"` | Update task | | `omi tasks complete <id>` | Mark as completed | | `omi tasks pending <id>` | Mark as pending | | `omi tasks delete <id>` | Delete a task | ### Conversations | Command | Description | |---------|-------------| | `omi conversations list` | List all conversations | | `omi conversations get <id>` | Get specific conversation | | `omi conversations create --title "My Chat" --participants "user1,user2"` | Create conversation | | `omi conversations create --participants "user1,user2" --message "Hello!"` | Create with initial message | | `omi conversations add-message <id> user "Hello world"` | Add message to conversation | | `omi conversations delete <id>` | Delete a conversation | | `omi conversations search "query"` | Search conversations | ### Sync | Command | Description | |---------|-------------| | `omi sync memories` | Sync memories from Omi.me | | `omi sync tasks` | Sync action items from Omi.me | | `omi sync conversations` | Sync conversations from Omi.me | | `omi sync all` | Sync all data | ## Usage Examples ### Token Configuration **Interactive setup:** ```bash omi-token.sh set ``` **Test connection:** ```bash omi-token.sh test ``` **Get current token:** ```bash omi-token.sh get ``` ### CLI Examples **List memories:** ```bash omi memories list ``` **Create a memory:** ```bash omi memories create "Caio prefers working in English" --type preference ``` **Create a task:** ```bash omi tasks create "Review Omi integration" --desc "Check if sync is working" --due "2024-02-01" ``` **Mark task complete:** ```bash omi tasks complete <task-id> ``` **Create conversation:** ```bash omi conversations create --title "Team Sync" --participants "alice,bob" --message "Let's discuss the project" ``` **Add message:** ```bash omi conversations add-message <conv-id> user "I agree!" ``` **Sync all data:** ```bash omi sync all ``` ## Rate Limits Omi.me API rate limits: - 100 requests per minute per API key - 10,000 requests per day per user The client automatically tracks rate limit headers and handles 429 responses. ## Troubleshooting ### "Token not configured" ```bash # Configure interactively omi-token.sh set # Or check manually cat ~/.config/omi-me/token # If empty, add your token echo "omi_dev_your_token" > ~/.config/omi-me/token ``` ### "Connection failed" or 401 error ```bash # Test connection omi-token.sh test # Reconfigure if needed omi-token.sh set ``` ### Permission denied for symlink ```bash # Use full path instead bash /home/ubuntu/.openclaw/workspace/skills/omi-me/scripts/omi-cli.sh memories list ``` ---

path: scripts/omi-cli.sh
content: #!/bin/bash
# Omi.me CLI Wrapper for OpenClaw Skill
# Full CRUD + Search capabilities

# Load environment variables from default locations
export OMI_API_TOKEN="${OMI_API_TOKEN:-$(cat ~/.config/omi-me/token 2>/dev/null)}"
export OMI_API_URL="${OMI_API_URL:-https://api.omi.me/v1/dev}"

if [ -z "$OMI_API_TOKEN" ]; then
    echo "Error: OMI_API_TOKEN not set."
    echo "Options:"
    echo "  1. echo 'your-token' > ~/.config/omi-me/token"
    echo "  2. export OMI_API_TOKEN='your-token'"
    exit 1
fi

# Helper function for API calls
omi_api() {
    local method="$1"
    local endpoint="$2"
    local data="$3"
    
    curl -s -X "$method" \
        -H "Authorization: Bearer $OMI_API_TOKEN" \
        -H "Content-Type: application/json" \
        "${API_URL}/$endpoint" \
        ${data:+-d "$data"}
}

# Pretty print JSON with syntax highlighting
omi_json() {
    if command -v jq &> /dev/null; then
        jq '.'
    else
        cat
    fi
}

# Parse command
case "$1" in
    # === MEMORIES ===
    memories|memory)
        case "$2" in
            list|ls)
                echo "📚 Memories:"
                omi_api GET "user/memories" | omi_json
                ;;
            get)
                if [ -z "$3" ]; then echo "Usage: omi memories get <id>"; exit 1; fi
                echo "📖 Memory $3:"
                omi_api GET "user/memories/$3" | omi_json
                ;;
            create|add)
                shift 2
                if [ -z "$*" ]; then echo "Usage: omi memories create \"content\" [--type <type>]"; exit 1; fi
                # Parse optional type
                local type="fact"
                if [ "$1" = "--type" ]; then
                    type="$2"
                    shift 2
                fi
                echo "➕ Creating memory..."
                omi_api POST "user/memories" "{\"content\": \"$*\", \"type\": \"$type\"}" | omi_json
                ;;
            update|edit)
                shift 2
                if [ -z "$2" ]; then echo "Usage: omi memories update <id> \"new content\""; exit 1; fi
                local id="$1"
                shift
                echo "✏️  Updating memory $id..."
                omi_api PATCH "user/memories/$id" "{\"content\": \"$*\"}" | omi_json
                ;;
            delete|rm|remove)
                if [ -z "$3" ]; then echo "Usage: omi memories delete <id>"; exit 1; fi
                echo "🗑️  Deleting memory $3..."
                omi_api DELETE "user/memories/$3"
                echo "Memory $3 deleted"
                ;;
            search|find)
                if [ -z "$3" ]; then echo "Usage: omi memories search \"query\""; exit 1; fi
                echo "🔍 Searching memories for: $3"
                omi_api GET "user/memories" | jq -r ".[] | select(.content | contains(\"$3\")) | \"  - \(.id): \(.content[0:70])\""
                ;;
            help|--help|-h)
                echo "🧠 Memory Commands:"
                echo "  omi memories list                    - List all memories"
                echo "  omi memories get <id>                - Get specific memory"
                echo "  omi memories create \"content\" [--type <type>]"
                echo "  omi memories update <id> \"new content\""
                echo "  omi memories delete <id>            - Delete a memory"
                echo "  omi memories search \"query\"         - Search memories"
                ;;
            *)
                echo "Unknown command: omi memories $2"
                echo "Run 'omi memories help' for usage"
                ;;
        esac
        ;;
    # === ACTION ITEMS / TASKS ===
    tasks|task|actions|action)
        case "$2" in
            list|ls|today)
                echo "📋 Action Items:"
                omi_api GET "user/action-items" | omi_json
                ;;
            get)
                if [ -z "$3" ]; then echo "Usage: omi tasks get <id>"; exit 1; fi
                echo "📖 Task $3:"
                omi_api GET "user/action-items/$3" | omi_json
                ;;
            create|add)
                shift 2
                if [ -z "$*" ]; then echo "Usage: omi tasks create \"title\" [--desc \"description\"] [--due <date>]"; exit 1; fi
                # Parse options
                local title="$*"
                local desc=""
                local due=""
                if [ "$1" = "--desc" ]; then
                    desc="$2"
                    shift 2
                    title="$*"
                fi
                if [ "$1" = "--due" ]; then
                    due="$2"
                    shift 2
                fi
                echo "➕ Creating action item..."
                local data="{\"title\": \"$title\"}"
                [ -n "$desc" ] && data="{\"title\": \"$title\", \"description\": \"$desc\"}"
                [ -n "$due" ] && data=$(echo "$data" | jq -c ". + {\"due_date\": \"$due\"}")
                omi_api POST "user/action-items" "$data" | omi_json
                ;;
            update|edit)
                shift 2
                if [ -z "$2" ]; then echo "Usage: omi tasks update <id> [--title \"title\"] [--desc \"desc\"] [--due <date>] [--status <pending|completed|cancelled>]"; exit 1; fi
                local id="$1"
                shift
                local data="{}"
                while [ $# -gt 0 ]; do
                    case "$1" in
                        --title) data=$(echo "$data" | jq -c ". + {\"title\": \"$2\"}"); shift 2 ;;
                        --desc|--description) data=$(echo "$data" | jq -c ". + {\"description\": \"$2\"}"); shift 2 ;;
                        --due) data=$(echo "$data" | jq -c ". + {\"due_date\": \"$2\"}"); shift 2 ;;
                        --status) data=$(echo "$data" | jq -c ". + {\"status\": \"$2\"}"); shift 2 ;;
                        *) shift ;;
                    esac
                done
                echo "✏️  Updating task $id..."
                omi_api PATCH "user/action-items/$id" "$data" | omi_json
                ;;
            complete|done)
                if [ -z "$3" ]; then echo "Usage: omi tasks complete <id>"; exit 1; fi
                echo "✅ Marking task $3 as complete..."
                omi_api PATCH "user/action-items/$3" '{"status": "completed"}' | omi_json
                ;;
            pending|todo)
                if [ -z "$3" ]; then echo "Usage: omi tasks pending <id>"; exit 1; fi
                echo "⏳ Marking task $3 as pending..."
                omi_api PATCH "user/action-items/$3" '{"status": "pending"}' | omi_json
                ;;
            delete|rm|remove)
                if [ -z "$3" ]; then echo "Usage: omi tasks delete <id>"; exit 1; fi
                echo "🗑️  Deleting task $3..."
                omi_api DELETE "user/action-items/$3"
                echo "Task $3 deleted"
                ;;
            help|--help|-h)
                echo "📋 Action Item Commands:"
                echo "  omi tasks list                       - List all tasks"
                echo "  omi tasks get <id>                   - Get specific task"
                echo "  omi tasks create \"title\" [--desc \"desc\"] [--due <date>]"
                echo "  omi tasks update <id> [--title \"t\"] [--desc \"d\"] [--due <date>] [--status <pending|completed>]"
                echo "  omi tasks complete <id>              - Mark task as completed"
                echo "  omi tasks pending <id>               - Mark task as pending"
                echo "  omi tasks delete <id>               - Delete a task"
                ;;
            *)
                echo "Unknown command: omi tasks $2"
                echo "Run 'omi tasks help' for usage"
                ;;
        esac
        ;;
    # === CONVERSATIONS ===
    conversations|conversation|chats|chat)
        case "$2" in
            list|ls)
                echo "💬 Conversations:"
                omi_api GET "user/conversations" | omi_json
                ;;
            get)
                if [ -z "$3" ]; then echo "Usage: omi conversations get <id>"; exit 1; fi
                echo "💬 Conversation $3:"
                omi_api GET "user/conversations/$3" | omi_json
                ;;
            create|add)
                shift 2
                if [ -z "$*" ]; then echo "Usage: omi conversations create [--title \"t\"] [--participants \"p1,p2\"] [--message \"m\"]"; exit 1; fi
                # Parse options
                local title=""
                local participants=""
                local message=""
                while [ $# -gt 0 ]; do
                    case "$1" in
                        --title) title="$2"; shift 2 ;;
                        --participants|-p) participants="$2"; shift 2 ;;
                        --message|-m) message="$2"; shift 2 ;;
                        *) shift ;;
                    esac
                done
                if [ -z "$participants" ]; then echo "Error: --participants is required"; exit 1; fi
                # Convert comma-separated to JSON array
                local participants_json=$(echo "$participants" | jq -R 'split(",") | map(trim)')
                local data="{\"participants\": $participants_json}"
                [ -n "$title" ] && data=$(echo "$data" | jq -c ". + {\"title\": \"$title\"}")
                [ -n "$message" ] && data=$(echo "$data" | jq -c ". + {\"initial_message\": \"$message\"}")
                echo "➕ Creating conversation..."
                omi_api POST "user/conversations" "$data" | omi_json
                ;;
            update|edit)
                shift 2
                if [ -z "$2" ]; then echo "Usage: omi conversations update <id> [--title \"t\"] [--participants \"p1,p2\"]"; exit 1; fi
                local id="$1"
                shift
                local data="{}"
                while [ $# -gt 0 ]; do
                    case "$1" in
                        --title) data=$(echo "$data" | jq -c ". + {\"title\": \"$2\"}"); shift 2 ;;
                        --participants|-p)
                            local p_json=$(echo "$2" | jq -R 'split(",") | map(trim)')
                            data=$(echo "$data" | jq -c ". + {\"participants\": $p_json}")
                            shift 2
                            ;;
                        *) shift ;;
                    esac
                done
                echo "✏️  Updating conversation $id..."
                # Note: Omi API may not support PATCH for conversations
                echo "⚠️  Note: Conversation updates may not be fully supported by API"
                omi_api PATCH "user/conversations/$id" "$data" 2>/dev/null || echo "Update attempted"
                ;;
            delete|rm|remove)
                if [ -z "$3" ]; then echo "Usage: omi conversations delete <id>"; exit 1; fi
                echo "🗑️  Deleting conversation $3..."
                omi_api DELETE "user/conversations/$3"
                echo "Conversation $3 deleted"
                ;;
            add-message|msg)
                shift 2
                if [ -z "$3" ]; then echo "Usage: omi conversations add-message <conv_id> <role> \"content\""; exit 1; fi
                local conv_id="$1"
                local role="$2"
                shift 2
                local content="$*"
                if [ -z "$content" ]; then echo "Error: message content required"; exit 1; fi
                echo "💬 Adding message to conversation $conv_id..."
                omi_api POST "messages" "{\"conversation_id\": \"$conv_id\", \"role\": \"$role\", \"content\": \"$content\"}" | omi_json
                ;;
            search|find)
                if [ -z "$3" ]; then echo "Usage: omi conversations search \"query\""; exit 1; fi
                echo "🔍 Searching conversations for: $3"
                omi_api GET "user/conversations" | jq -r ".[] | select(.title // \"\" | contains(\"$3\")) | \"  - \(.id): \(.title // \"Untitled\")\""
                ;;
            help|--help|-h)
                echo "💬 Conversation Commands:"
                echo "  omi conversations list              - List all conversations"
                echo "  omi conversations get <id>         - Get specific conversation"
                echo "  omi conversations create [--title \"t\"] [--participants \"p1,p2\"] [--message \"m\"]"
                echo "  omi conversations update <id> [--title \"t\"] [--participants \"p1,p2\"]"
                echo "  omi conversations delete <id>       - Delete a conversation"
                echo "  omi conversations add-message <id> <role> \"content\""
                echo "  omi conversations search \"query\"   - Search conversations"
                ;;
            *)
                echo "Unknown command: omi conversations $2"
                echo "Run 'omi conversations help' for usage"
                ;;
        esac
        ;;
    # === SYNC ===
    sync)
        case "$2" in
            memories)
                echo "🧠 Syncing memories from Omi.me..."
                echo ""
                omi_api GET "user/memories" | jq -r '.[] | "  - \(.id): \(.content[0:70])..."'
                echo ""
                echo "💡 Tip: These memories are available via MCP server in OpenClaw!"
                ;;
            tasks|action-items)
                echo "📋 Syncing action items from Omi.me..."
                echo ""
                omi_api GET "user/action-items" | jq -r '.[] | "  - \(.id): [\(.status)] \(.title)"'
                echo ""
                echo "💡 Tip: These tasks are available via MCP server in OpenClaw!"
                ;;
            conversations)
                echo "💬 Syncing conversations from Omi.me..."
                echo ""
                omi_api GET "user/conversations" | jq -r '.[] | "  - \(.id): \(.title // \"Untitled\") (\(.participants | length) participants)"'
                echo ""
                echo "💡 Tip: These conversations are available via MCP server in OpenClaw!"
                ;;
            all)
                echo "🔄 Syncing ALL data from Omi.me..."
                echo ""
                echo "🧠 Memories:"
                omi_api GET "user/memories" | jq -r '.[] | "  - \(.id): \(.content[0:50])..."'
                echo ""
                echo "📋 Action Items:"
                omi_api GET "user/action-items" | jq -r '.[] | "  - \(.id): \(.title)"'
                echo ""
                echo "💬 Conversations:"
                omi_api GET "user/conversations" | jq -r '.[] | "  - \(.id): \(.title // \"Untitled\")"'
                ;;
            help|--help|-h)
                echo "🔄 Sync Commands:"
                echo "  omi sync memories        - Sync memories"
                echo "  omi sync tasks          - Sync action items"
                echo "  omi sync conversations  - Sync conversations"
                echo "  omi sync all            - Sync all data"
                ;;
            *)
                echo "Unknown sync command: $2"
                echo "Run 'omi sync help' for usage"
                ;;
        esac
        ;;
    # === HELP ===
    help|--help|-h)
        echo "🧠 Omi.me CLI for OpenClaw"
        echo ""
        echo "COMMANDS:"
        echo ""
        echo "  🧠 Memories:"
        echo "    omi memories list"
        echo "    omi memories get <id>"
        echo "    omi memories create \"content\" [--type <type>]"
        echo "    omi memories update <id> \"new content\""
        echo "    omi memories delete <id>"
        echo "    omi memories search \"query\""
        echo ""
        echo "  📋 Action Items (Tasks):"
        echo "    omi tasks list"
        echo "    omi tasks get <id>"
        echo "    omi tasks create \"title\" [--desc \"desc\"] [--due <date>]"
        echo "    omi tasks update <id> [--title \"t\"] [--desc \"d\"]"
        echo "    omi tasks complete <id>"
        echo "    omi tasks pending <id>"
        echo "    omi tasks delete <id>"
        echo ""
        echo "  💬 Conversations:"
        echo "    omi conversations list"
        echo "    omi conversations get <id>"
        echo "    omi conversations create [--title \"t\"] [--participants \"p1,p2\"]"
        echo "    omi conversations update <id> [--title \"t\"]"
        echo "    omi conversations delete <id>"
        echo "    omi conversations add-message <id> <role> \"content\""
        echo "    omi conversations search \"query\""
        echo ""
        echo "  🔄 Sync with OpenClaw:"
        echo "    omi sync memories"
        echo "    omi sync tasks"
        echo "    omi sync conversations"
        echo "    omi sync all"
        echo ""
        echo "ENVIRONMENT VARIABLES:"
        echo "  OMI_API_TOKEN  - Your Omi.me developer API token"
        echo "  OMI_API_URL    - API URL (default: https://api.omi.me/v1/dev)"
        echo ""
        echo "FILES:"
        echo "  ~/.config/omi-me/token  - Default location for API token"
        echo ""
        echo "MCP SERVER:"
        echo "  Already configured in openclaw.json"
        echo "  Use 'openclaw gateway restart' to activate"
        ;;
    *)
        echo "Unknown command: $1"
        echo "Run 'omi help' for usage"
        ;;
esac


path: scripts/omi-token.sh
content: #!/bin/bash
# Omi.me Token Manager
# Usage: omi-token.sh [get|test|set]

CONFIG_DIR="$HOME/.config/omi-me"
TOKEN_FILE="$CONFIG_DIR/token"

# Ensure config directory exists
mkdir -p "$CONFIG_DIR"

get_token() {
    if [ -f "$TOKEN_FILE" ]; then
        cat "$TOKEN_FILE"
    else
        echo ""
    fi
}

case "$1" in
    get)
        [REDACTED_SECRET])
        if [ -z "$TOKEN" ]; then
            echo "Error: OMI_API_TOKEN not configured."
            echo "Run 'omi-token.sh set' to configure."
            exit 1
        fi
        echo "$TOKEN"
        ;;
    
    test)
        [REDACTED_SECRET])
        if [ -z "$TOKEN" ]; then
            echo "✗ OMI_API_TOKEN not configured."
            echo "Run 'omi-token.sh set' to configure."
            exit 1
        fi
        
        echo "Testing Omi.me connection..."
        RESULT=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $TOKEN" "https://api.omi.me/v1/dev/user/memories")
        
        if [ "$RESULT" = "200" ]; then
            echo "✓ Connected successfully!"
            echo ""
            echo "Memories count: $(curl -s -H "Authorization: Bearer $TOKEN" "https://api.omi.me/v1/dev/user/memories" | jq -r '. | length')"
        elif [ "$RESULT" = "401" ]; then
            echo "✗ Invalid API token. Run 'omi-token.sh set' to update."
            exit 1
        else
            echo "? Connection returned HTTP $RESULT"
            exit 1
        fi
        ;;
    
    set)
        echo "🧠 Omi.me Token Configuration"
        echo ""
        echo "Get your API token from: https://docs.omi.me/doc/developer/api/overview"
        echo ""
        read -p "Paste your OMI_API_TOKEN: " -s TOKEN
        echo ""
        
        if [ -z "$TOKEN" ]; then
            echo "Error: No token provided."
            exit 1
        fi
        
        echo "$TOKEN" > "$TOKEN_FILE"
        chmod 600 "$TOKEN_FILE"
        echo "✓ Token saved to $TOKEN_FILE"
        echo ""
        echo "Test your connection with: omi-token.sh test"
        ;;
    
    help|--help|-h)
        echo "🧠 Omi.me Token Manager"
        echo ""
        echo "Usage: omi-token.sh [get|test|set]"
        echo ""
        echo "Commands:"
        echo "  get   - Print current API token"
        echo "  test  - Test connection to Omi.me API"
        echo "  set   - Interactively configure API token"
        echo ""
        echo "Files:"
        echo "  $TOKEN_FILE"
        ;;
    
    "")
        [REDACTED_SECRET])
        if [ -z "$TOKEN" ]; then
            echo "✗ OMI_API_TOKEN not configured."
            echo "Run 'omi-token.sh set' to configure."
            echo ""
            echo "Or manually: echo 'your-token' > $TOKEN_FILE"
        else
            echo "✓ Token configured"
        fi
        ;;
    
    *)
        echo "Unknown command: $1"
        echo "Run 'omi-token.sh help' for usage"
        ;;
esac


path: scripts/setup.sh
content: #!/bin/bash
# Setup script for Omi.me skill
# Run: bash /home/ubuntu/.openclaw/workspace/skills/omi-me/scripts/setup.sh

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
CONFIG_DIR="$HOME/.config/omi-me"
TOKEN_FILE="$CONFIG_DIR/token"

echo "🧠 Setting up Omi.me skill..."

# Create config directory
mkdir -p "$CONFIG_DIR"

# Check for existing token
if [ -f "$TOKEN_FILE" ] && [ -s "$TOKEN_FILE" ]; then
    echo "✓ Token already configured"
else
    echo ""
    echo "⚠️  OMI_API_TOKEN not found!"
    echo ""
    echo "To configure, run:"
    echo "  bash $SCRIPT_DIR/omi-token.sh set"
    echo ""
    echo "Or manually:"
    echo "  echo 'your-token' > $TOKEN_FILE"
    echo ""
    echo "Get your token from: https://docs.omi.me/doc/developer/api/overview"
    echo ""
fi

# Also check environment variable
if [ -n "$OMI_API_TOKEN" ] && [ ! -f "$TOKEN_FILE" ]; then
    echo "✓ Using OMI_API_TOKEN from environment"
    echo "$OMI_API_TOKEN" > "$TOKEN_FILE"
fi

# Make scripts executable
chmod +x "$SCRIPT_DIR/omi-cli.sh"
chmod +x "$SCRIPT_DIR/omi-token.sh"

# Optional: Create symlinks
if [ -d /usr/local/bin ]; then
    ln -sf "$SCRIPT_DIR/omi-cli.sh" /usr/local/bin/omi 2>/dev/null || true
    ln -sf "$SCRIPT_DIR/omi-token.sh" /usr/local/bin/omi-token 2>/dev/null || true
    echo "✓ Symlinks created: /usr/local/bin/omi, /usr/local/bin/omi-token"
fi

# Check dependencies
if ! command -v jq &> /dev/null; then
    echo "⚠️  jq is not installed. Install with: sudo apt install jq"
fi

# Create _meta.json for OpenClaw skill registration
META_FILE="$SKILL_DIR/_meta.json"
if [ ! -f "$META_FILE" ]; then
    cat > "$META_FILE" << 'EOF'
{
  "slug": "omi-me",
  "version": "1.0.0"
}
EOF
    echo "✓ _meta.json created"
fi

echo ""
echo "✅ Setup complete!"
echo ""
echo "Usage:"
echo "  omi-token.sh set              # Configure API token"
echo "  omi-token.sh test             # Test connection"
echo "  omi memories list"
echo "  omi tasks create \"My task\""
echo "  omi sync memories"
echo ""
echo "Or use the CLI commands directly"


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)