Skip to content

CryptoThaler/mudbug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🦞 mudbug β€” OpenClaw watchOS Client

Liquid Glass Watch β€’ iOS β€’ OpenClaw Interface

A thin Gateway client for OpenClaw on watchOS 12, targeting the Apple Watch Series 11. One tap on your wrist to command your autonomous AI agent.


πŸ—οΈ Architecture β€” Hybrid Client

mudbug uses a hybrid architecture: standalone HTTP/SSE to the Gateway for active chat, plus WatchConnectivity (WCSession) as a background relay from the paired iPhone for push-style notifications.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       HTTPS/SSE        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       TDLib        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Apple Watch β”‚  ──────────────────▢  β”‚  OpenClaw Gateway β”‚  ──────────────▢  β”‚ Telegram β”‚
β”‚  (mudbug)    β”‚  ◀──────────────────  β”‚  :18789           β”‚  ◀──────────────  β”‚ Servers  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    text/event-stream   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                      β”‚
       β”‚  WCSession (background relay)        β”‚ Operator Protocol
       β”‚  ◀────────────────────────────       β”‚
       β”‚                               β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
       └───────────────────────────────│  iPhone App  β”‚
                                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Why Gateway, not standalone TDLib?

Criteria Gateway (mudbug) Standalone TDLib
Binary size ~5 MB ~300 MB
Battery impact Minimal High
RAM pressure Low > 500 MB
Auth complexity Bearer token QR code sync
Supports all Skills βœ… ❌
Requires server βœ… ❌

πŸ“‚ Project Structure

OpenClawWatch/
β”œβ”€β”€ App/
β”‚   β”œβ”€β”€ OpenClawApp.swift               # Entry point + WCSession init
β”‚   └── ComplicationBundle.swift        # Widget extension entry
β”œβ”€β”€ Features/
β”‚   β”œβ”€β”€ Chat/
β”‚   β”‚   β”œβ”€β”€ ChatView.swift              # Liquid Glass chat UI
β”‚   β”‚   β”œβ”€β”€ ChatViewModel.swift         # Business logic & streaming
β”‚   β”‚   β”œβ”€β”€ MessageBubble.swift         # Glass bubble component
β”‚   β”‚   └── SettingsView.swift          # Gateway config & diagnostics
β”‚   └── Complication/
β”‚       └── QuickActionComplication.swift # Watch face widget
β”œβ”€β”€ Core/
β”‚   β”œβ”€β”€ Network/
β”‚   β”‚   β”œβ”€β”€ OpenClawAPI.swift           # SSE streaming engine
β”‚   β”‚   β”œβ”€β”€ APIConstants.swift.sample   # Config template (committed)
β”‚   β”‚   └── APIConstants.swift          # Your secrets (gitignored)
β”‚   β”œβ”€β”€ Connectivity/
β”‚   β”‚   └── WatchConnectivityReceiver.swift # iPhone β†’ Watch relay
β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   └── OpenClawModels.swift        # Protocol models
β”‚   β”œβ”€β”€ Persistence/
β”‚   β”‚   └── ConversationStore.swift     # UserDefaults chat history
β”‚   └── Haptics/
β”‚       └── HapticManager.swift         # Tactile feedback
└── Preview Content/
    └── PreviewData.swift               # Mock data for previews

πŸš€ Getting Started

Prerequisites

  • Xcode 26 (or later) with watchOS 12 SDK
  • An OpenClaw Gateway running and reachable (local network, Tailscale, or public URL)
  • Gateway HTTP API enabled in openclaw.json:
    {
      "gateway": {
        "http": {
          "endpoints": {
            "chatCompletions": { "enabled": true }
          }
        }
      }
    }

Setup

  1. Clone the repo:

    git clone https://github.com/CryptoThaler/mudbug.git
    cd mudbug
  2. Configure your Gateway credentials:

    cp OpenClawWatch/Core/Network/APIConstants.swift.sample \
       OpenClawWatch/Core/Network/APIConstants.swift

    Edit APIConstants.swift with your Gateway URL and bearer token.

  3. Open in Xcode:

    open OpenClawWatch.xcodeproj

    Or create a new watchOS project in Xcode and drag in the OpenClawWatch/ source folder.

  4. Build & Run:

    • Select the Watch App scheme
    • Target: Apple Watch Series 11 (45mm) Simulator or your physical Watch
    • Press ⌘R

⌚ Features

πŸͺŸ Liquid Glass Interface

All message bubbles and the input bar use ultraThinMaterial with gradient overlays, inner stroke borders for glass-edge light refraction, and soft shadows for depth. Dark gradient background for maximum contrast.

πŸ’¬ Streaming Chat

Real-time token-by-token display using URLSession.bytes(for:) and AsyncThrowingStream. See the AI "type" on your wrist.

🧠 Animated Thinking Dots

Bouncing dot animation in OpenClaw's signature orange while the agent processes your request β€” replaces the standard ProgressView.

πŸ“² WatchConnectivity (iPhone Relay)

Receives background push-style notifications from the paired iPhone via WCSession. Ported from the official OpenClaw WatchExtension with dedup and chat integration.

πŸ“³ Haptic Feedback

  • Click when you send a message
  • Success when the AI finishes responding
  • Failure on network errors

⌚ Watch Face Complication

One-tap complication in circular, rectangular, corner, and inline styles. Shows the last assistant message preview and opens directly to chat.

πŸ’Ύ Conversation Persistence

Last 50 messages stored in UserDefaults so your chat survives app suspension and relaunch from the Watch Dock.

πŸ”„ Error Recovery

Automatic retry support, connection status banner, and Gateway health check from Settings.


πŸ”‘ Security

  • APIConstants.swift is gitignored β€” your token never leaves your machine
  • The .sample template is committed so collaborators know the expected structure
  • All connections use HTTPS with bearer token auth
  • Consider using a proper cert (Let's Encrypt / Cloudflare) rather than self-signed

πŸ›‘ The "Push" Problem (Mitigated)

OpenClaw Gateway doesn't natively send Apple Push Notifications. mudbug mitigates this via:

  1. WatchConnectivity β€” The iPhone OpenClaw app relays notifications to the Watch via WCSession even when mudbug is backgrounded
  2. Telegram fallback β€” Let your agent send results to your Telegram DM; the Telegram system notification hits your Watch

πŸ“‹ Roadmap

  • v1.0 β€” Core chat with streaming SSE
  • v1.1 β€” Liquid Glass interface
  • v1.2 β€” WatchConnectivity hybrid relay
  • v1.3 β€” HealthKit integration (workout context for the agent)
  • v1.4 β€” Siri Shortcuts / App Intents integration
  • v2.0 β€” Push notification relay via CloudKit
  • v2.1 β€” Multi-conversation support with SwiftData
  • v2.2 β€” ClawHub skill browser on the wrist

🀝 Contributing

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/health-kit-integration)
  3. Commit your changes (git commit -m 'Add HealthKit context to chat')
  4. Push to the branch (git push origin feature/health-kit-integration)
  5. Open a Pull Request

πŸ“„ License

This project is open source. See LICENSE for details.


🦞 Built for the wrist. Powered by OpenClaw.
mudbug β€” because crawdads are just lobsters with ambition.

About

Liquid Glass Watch IOS Open Claw 🦞 Interface

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages