Skip to content

Instantly share code, notes, and snippets.

Moltworker on Cloudflare can be largely automated using Wrangler (Cloudflare's CLI tool)

step by step, based on the official Moltworker repo instructions and Cloudflare's Wrangler documentation

Key Limitations for Full Automation

  • Non-Automatable Parts via Wrangler:
    • Upgrading to Workers Paid plan or adding R2 subscription: These require dashboard UI (or Cloudflare API calls, but Wrangler doesn't support them directly).
    • Creating R2 API tokens: Done via dashboard UI (R2 > Manage R2 API Tokens). Wrangler can't create tokens, but it can use them once set as secrets.
    • Enabling Cloudflare Access/Zero Trust on the Worker: Requires dashboard UI to create an Access application, add policies (e.g., email allowlist), and copy the AUD tag/team domain. Wrangler can't enable or configure Zero Trust features.
  • Obtaining external keys (e.g., Anthropic API key): These come from third-party dashboards (manual copy-paste into Wrangler secrets).

Step-by-Step Guide to Setting Up Moltworker on Cloudflare

This guide is based on the official Cloudflare Moltworker repository (https://github.com/cloudflare/moltworker), which allows you to run OpenClaw (formerly Moltbot/Clawdbot) as a self-hosted personal AI agent on Cloudflare Workers. The setup uses Cloudflare's Sandbox containers for execution, with optional persistence via R2 storage. I've adapted the instructions to use the Cloudflare dashboard UI exclusively for setting secrets and configurations (no Wrangler CLI). Note that as of February 2026, some Cloudflare dashboard navigation paths have been updated for better integration with Zero Trust (formerly Cloudflare Access), and I've incorporated the latest from the repo's README and related documentation. The process involves prerequisites, deployment, security setup, storage configuration, and testing. Expect the full setup to take 30-60 minutes, with some waiting time for deployments and container startups.

Step 1: Prepare Prerequisites

Befo

Observability

Claude Code and Cursor

Here's a practical implementation of an observability plugin/hook for your Claude Code and Cursor workflows. I'll provide:

  • Python version for Claude Code: A hook script that integrates with OpenTelemetry (OTel) to trace and log lifecycle events (e.g., tool uses, prompts). This can be configured in .claude/settings.json for multiple hooks. It exports traces to a console exporter for simplicity (you can swap to Jaeger, Zipkin, or any OTel-compatible backend like Langfuse or Arize by updating the exporter).

  • TypeScript version for Cursor: A VS Code extension (since Cursor is VS Code-based) that logs AI-powered suggestions and code changes. It listens to text document changes and completion acceptance events, then logs them (to console or a file). This enhances observability for Cursor's AI features like autocomplete and Composer. Install via VS Code marketplace or sideload.

Both focus on basic observability: logging events, timings, and details for debug

JavaScript/TypeScript - Web Frontend

  1. Vite React TypeScript Application with Tailwind and Shadcn, React Router as Single Frontend: You are an AI Prompt Engineering Assistant specialized in guiding developers through the creation of a Product Requirements Document (PRD) for a Vite-based React TypeScript greenfield project using Tailwind CSS 4 plugin, Shadcn UI components, and React Router for routing. Start by asking if the user has a project idea or needs suggestions. If proceeding, gather problem statement, ideal avatar, and initial user stories. Confirm the stack: Vite for build tool, React with TypeScript, Tailwind 4, Shadcn for UI, React Router. Ask about IDE/AI assistant for cursor rules. Enforce git branching strategy (feature branches, sequential commits, merge to main), no Husky/pre-commit hooks. Use latest docs via Context7 MCP for stable releases. Build PRD sections iteratively in a short conversation: Problem Statement, Ideal Avatar, Elevator Pitch, Executive Summary, Technical Summary (

You are an AI Prompt Engineering Assistant specialized in guiding developers through the creation of a Product Requirements Document (PRD) for greenfield projects. Your goal is to facilitate a concise, back-and-forth conversation to collaboratively build a comprehensive PRD with the following required sections:

Problem Statement: A clear description of the problem the project solves. Ideal Avatar (Customer): Detailed profile of the target user. Elevator Pitch: A short, compelling summary. Executive Summary: High-level overview of the project. Technical Summary: Overview of technical aspects. Technical Stack: Chosen technologies, frameworks, and tools. Always recommend and verify the latest stable releases by referencing official docs (use Context7 MCP for up-to-date information where applicable). For Vite-based React apps, include Tailwind 4 plugin. For mobile apps using JS/TS, strongly recommend CapacitorJS unless contraindicated. List of Epics: High-level groupings of work. List of User Stories: As-is stat

you are my AI Prompt Engineering Assistant. You are tasked with helping me make a back and forth conversational way to create a PRD for getting started on a new greenfield project. the prompts should help produce a PRD that has a set of specific parts.

Problem Statement Ideal Avatar (Customer) Elevator Pitch Executive Summary Technical Summary Technical Stack List of Epics List of User Stories

Step 1: Feature Breakdown and Decomposition

Start by decomposing your high-level features into smaller, manageable tasks or sub-features. This creates a granular view, making it easier to spot dependencies later. Use a structured approach like Work Breakdown Structure (WBS) from project management.

  • List all features: Write down each major feature you want to implement (e.g., Feature A: User Authentication; Feature B: Payment Processing; Feature C: UI Dashboard).
  • Break into sub-tasks: For each feature, divide it into atomic tasks. Focus on:
    • Functional components (e.g., backend API endpoints, database schemas, frontend components).
    • Non-functional aspects (e.g., error handling, testing, documentation).
    • Example: For "User Authentication":
      • Task 1: Define user model in database.
  • Task 2: Implement login endpoint.

RAG Agent Implementation Plan

Architecture Overview

The RAG Agent will follow the existing modular patterns in the codebase, providing both a dedicated agent routable via the supervisor and standalone tools that any agent can use.

graph TB
    subgraph rag_components [RAG Components]
 RAGAgent[RAGAgent]

Office Hours: Building a PPM Image Drawing Agent

Objective: Add a custom AI agent that can create PPM images using natural language instructions.

This guide walks through adding a new Image Artist agent to the modular agent supervisor system. The agent will understand human-readable prompts like:

"Draw a PPM image of size 200 by 200, add a square at coordinate 10,10 with a size of 20 pixels in red color, then add 10 circles of varying sizes and colors randomly around the image, and write the file as image.ppm"


#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <ORG_NAME> <GITHUB_TOKEN> <MEMBERS_FILE>"
exit 1
fi
ORG_NAME="$1"
GITHUB_TOKEN="$2"
MEMBERS_FILE="$3"