AlphaClaw

repository·main·Indexed 23 days ago

https://github.com/chrysb/alphaclaw

A convenience wrapper for OpenClaw that simplifies setup and management. It provides a password-protected Setup UI, a gateway manager with a self-healing Watchdog for crash recovery, automated GitHub workspace synchronization, and an OpenAI-compatible API proxy. Key features include guided onboarding, multi-agent management, Google Workspace integration, cron job orchestration, and webhook endpoints.

Tokens
34.2K
Snippets
50
Records
203
Agent score
81%

What's inside @chrysb/alphaclaw

  1. Overview of AlphaClaw Features

    main

    AlphaClaw is an OpenClaw harness that provides observability, reliability, and management capabilities through a web-based UI. Key features include:

    • Setup UI: A password-protected dashboard for onboarding, configuration, and management.
    • Guided Onboarding: A wizard for model selection, provider credentials, GitHub repo, and channel pairing.
    • Multi-Agent Management: Sidebar-driven navigation to create, rename, and delete agents.
    • Gateway Manager: Manages the OpenClaw gateway as a child process (spawning, monitoring, restarting).
    • Watchdog: Self-healing mechanism for crash detection, recovery, and notifications.
    • Channel Orchestration: Integration with Telegram, Discord, and Slack.
    • Google Workspace Integration: OAuth for Gmail, Calendar, Drive, etc., including Gmail watch setup via Google Pub/Sub.
    • Cron Jobs: Management of scheduled tasks with interactive calendars and analytics.
    • Nodes: Setup for VPS deployments with browser attach checks.
    • Webhooks: Named endpoints with transform modules and request logging.
    • File Explorer: Browser-based workspace management with inline edits and Git-aware sync.
    • Prompt Hardening: Injects anti-drift prompts (AGENTS.md, TOOLS.md) into system prompts.
    • Git Sync: Automatic hourly commits of the OpenClaw workspace to GitHub.
    • Version Management: In-app updates for AlphaClaw and OpenClaw.
  2. Configure persistent storage for plugins and tools

    main

    Because AlphaClaw runs in ephemeral containers, any data stored in /tmp or other temporary locations will be lost during redeploys.

    To ensure data durability:

    • All persistent data must be stored under /data/.openclaw.
    • When staging local plugins or helper files, place them under /data/.openclaw/... instead of /tmp/....
    • Use standard openclaw plugins install <spec> flows for durable installations.
    • Ensure plugins.load.paths entries do not point to temporary directories.
  3. How the Watchdog ensures reliability

    main

    The AlphaClaw Watchdog is a self-healing mechanism that monitors the health of the OpenClaw gateway. It provides the following capabilities:

    • Health checks: Performs periodic openclaw health checks at a configurable interval.
    • Crash detection: Listens for gateway exit events.
    • Crash-loop detection: Detects if the gateway is repeatedly crashing (default threshold: 3 crashes in 300s).
    • Auto-repair: Automatically runs openclaw doctor --fix --yes and relaunches the gateway when a crash is detected.
    • Notifications: Sends alerts for crashes, repairs, and recovery via Telegram, Discord, or Slack.
    • Event log: Maintains a SQLite-backed incident history accessible via the UI and API.
  4. AlphaClaw System Architecture

    main

    AlphaClaw acts as a management layer wrapping the OpenClaw Gateway.

    Components:

    • Setup UI: A Preact + htm + Wouter frontend for user interaction.
    • Express Server: The central API handling JSON requests, Authentication, and Proxying.
    • Watchdog: Monitors gateway health and handles crash recovery.
    • Webhooks: Manages incoming requests, transformations, and logging.
    • OpenClaw Gateway: A child process running on 127.0.0.1:18789 that handles the core AI logic.
    • Data Storage: All data (OpenClaw workspace, .env, logs, SQLite) is stored in the directory specified by ALPHACLAW_ROOT_DIR.

    Data Flow: The Setup UI, Watchdog, and Webhooks all communicate with the OpenClaw Gateway via the Express Server, which proxies requests to the gateway process.

  5. Manage environment variables via the Envars tab

    main

    To ensure changes are validated and the gateway is correctly restarted, always manage environment variables through the Envars tab in the Setup UI ({{SETUP_UI_URL}}#envars).

    Important: Do not edit /data/.env directly. After saving changes in the UI, the system will automatically prompt you to restart the gateway to apply the new variables.

  6. Set up AlphaClaw for development

    main

    To develop locally with a git checkout, you must build the Setup UI bundle and its associated CSS.

    Requirements:

    • Node.js ≥ 22.22.3 (on Node 22)
    • Node.js ≥ 24.15.0 (on Node 24)
    • Node.js ≥ 25.9.0 (on Node 25)

    Commands:

    npm install
    npm run build:ui        # Generate Setup UI bundle, Tailwind CSS, and vendor CSS
    npm install
    npm run build:ui        # Generate Setup UI bundle, Tailwind CSS, and vendor CSS (required for local runs from a git checkout)
    npm test                # Full suite (440 tests)
    npm run test:watchdog   # Watchdog-focused suite (14 tests)
    npm run test:watch      # Watch mode
    npm run test:coverage   # Coverage report
  7. Read Gmail threads and messages

    main

    Retrieve the content of specific threads or messages using their IDs.

    • Threads: Use gog gmail thread get <threadId>. You can optionally download attachments to a specific directory using --download --out-dir <directory>.
    • Messages: Use gog gmail get <messageId> to read a single message.
    # Read a thread and optionally download attachments
    gog gmail thread get <threadId>
    gog gmail thread get <threadId> --download --out-dir ./attachments
    
    # Read a single message
    gog gmail get <messageId>
  8. Quick Start: Deploy on Render (Recommended)

    main

    AlphaClaw provides a one-click deployment template for Render. This is the recommended method as it ships a complete stack without manual gateway setup. Render sponsors AlphaClaw; you can redeem $50 in Render credits using the code RENDER-ALPHACLAW during deployment.

    To deploy, use the official Render template: Deploy to Render

    https://render.com/templates/alphaclaw
  9. Manage Google Sheets with the gog CLI

    main

    The gog sheets command group allows you to interact with Google Spreadsheets via the CLI. You can perform metadata operations, read/write cell ranges, manage rows and columns, and export files.

    Data Formats:

    • Standard Input: Use pipe-delimited (|) for rows and comma-separated (,) for columns (e.g., row1_col1|row1_col2,row2_col1|row2_col2).
    • Complex Data: Use the --values-json flag to pass structured JSON arrays for cell values.
  10. Manage Gmail filters and vacation settings

    main

    Automate your inbox with filters and auto-replies.

    Filters:

    • list: Lists existing filters.
    • create: Creates a filter using --from '<email>' and --add-label '<label>'.
    • delete <filterId>: Removes a filter.

    Vacation (Auto-reply):

    • get: Checks current vacation status.
    • enable: Sets an auto-reply with --subject and --message.
    • disable: Turns off vacation mode.
    # Filters
    gog gmail filters list
    gog gmail filters create --from 'noreply@example.com' --add-label 'Notifications'
    gog gmail filters delete <filterId>
    
    # Vacation / auto-reply
    gog gmail vacation get
    gog gmail vacation enable --subject "Out of office" --message "I'm away"
    gog gmail vacation disable