Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/cloudflare/moltworker/agents-mdgit clone --depth 1 https://github.com/cloudflare/moltworkerWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.02483 | $0.02483 |
| Opus 5 | $0.01241 | $0.01241 |
| Sonnet 5 | $0.00497 | $0.00497 |
| Haiku 4.5 | $0.00248 | $0.00248 |
Grade C, and why
moltworker AGENTS.md scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
- **Never delete R2 data**: The mount directory `/data/moltbot` IS the R2 bucket. Running `rm -rf /data/moltbot/*` will DELETE your backup data. Always check mount status before any destructive operations. How it starts
The opening of the file, as written. The whole thing — 262 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Instructions
Guidelines for AI agents working on this codebase.
Project Overview
This is a Cloudflare Worker that runs OpenClaw (formerly Moltbot/Clawdbot) in a Cloudflare Sandbox container. It provides:
- Proxying to the OpenClaw gateway (web UI + WebSocket)
- Admin UI at
/_admin/for device management - API endpoints at
/api/*for device pairing - Debug endpoints at
/debug/*for troubleshooting
Note: The CLI tool and npm package are now named openclaw. Config files use .openclaw/openclaw.json. Legacy .clawdbot paths are supported for backward compatibility during transition.
Project Structure
src/
├── index.ts # Main Hono app, route mounting
├── types.ts # TypeScript type definitions
├── config.ts # Constants (ports, timeouts, paths)
├── auth/ # Cloudflare Access authentication
│ ├── jwt.ts # JWT verification
│ ├── jwks.ts # JWKS fetching and caching
│ └── middleware.ts # Hono middleware for auth
├── gateway/ # OpenClaw gateway management
│ ├── process.ts # Process lifecycle (find, start)
│ ├── env.ts # Environment variable building
│ ├── r2.ts # R2 bucket mounting
│ ├── sync.ts # R2 backup sync logic
│ └── utils.ts # Shared utilities (waitForProcess)
├── routes/ # API route handlers
│ ├── api.ts # /api/* endpoints (devices, gateway)
│ ├── admin.ts # /_admin/* static file serving
│ └── debug.ts # /debug/* endpoints
└── client/ # React admin UI (Vite)
├── App.tsx
├── api.ts # API client
└── pages/
Key Patterns
Environment Variables
DEV_MODE- Skips CF Access auth AND bypasses device pairing (maps toOPENCLAW_DEV_MODEfor container)DEBUG_ROUTES- Enables/debug/*routes (disabled by default)- See
src/types.tsfor fullMoltbotEnvinterface
CLI Commands
When calling the OpenClaw CLI from the worker, always include --url ws://localhost:18789:
sandbox.startProcess('openclaw devices list --json --url ws://localhost:18789')
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 262 lines · 2,483 tokens per session scan C dfcf55474871
moltworker AGENTS.md is an instructions file published in the GitHub repository cloudflare/moltworker (9,958 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 2,483 tokens to every session, about $0.0124 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
cloudflare-workers-nextjs-saas-template AGENTS.md
Instructions for LubomirGeorgiev/cloudflare-workers-nextjs-saas-template, covering project context, vinext, general coding rules, control flow and comments.
sonicjs CLAUDE.md
Instructions for SonicJs-Org/sonicjs, covering sonicjs ai development guidelines, core technology stack, workspace boundary (conductor), architecture direction: document model (authoritative) and the 5 document tables (migration 0002documents.sql).
flarestarter CLAUDE.md
Instructions for FlareStarter/flarestarter: This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
baerly-storage CLAUDE.md
Toolchain, verification matrix, module map, conventions, anti-patterns. The main agent entry point.
munkel CLAUDE.md
Instructions for limehq/munkel, covering claude.md, monorepo layout, commands, macos development specifics and deploy.
ai-coding-primer CLAUDE.md
Instructions for ammonhaggerty/ai-coding-primer, covering claude.md, repository structure, guidebook chapters, constraints and writing tone.