// Organized AI · Open Source Fork

ClaudeFlare

A DuraClaw fork with four obsessions: ephemeral one-time-use Cloudflare Workers that spin up, execute, and vanish — auto-generated CF Pages docs for every infrastructure layer — a ClawBox desktop control plane for local-first orchestration — and the Agent Client Protocol as the cross-editor wire format. One mental model spans desktop, editor, and edge.

0Workers at idle
CF PagesDocs per layer
ClawBoxDesktop control
ACPEditor protocol
Cloudflare Workers CF Pages ClawBox ACP DuraClaw Fork Ephemeral Workers Auto-Doc Generation OpenClaw TypeScript · pnpm

Why ClaudeFlare?

DuraClaw is a robust agent runtime. ClaudeFlare takes that foundation and bets hard on four things DuraClaw doesn't prioritize: Workers as disposable primitives, documentation as a first-class artifact, a desktop control plane for local-first orchestration, and a standardized agent protocol so any compliant editor or client can drive the runtime through one wire format.

Every task in ClaudeFlare is a Worker that exists only long enough to complete its job. No persistent processes. No cleanup. No lingering state. When it's done, it's gone. Every time a project layer ships, a corresponding CF Pages doc site auto-generates — architecture guides, deploy runbooks, API references — at predictable URLs under *.organizedai.vip.

Day-to-day, you orchestrate from ClawBox — a Tauri v2 desktop client that bridges to the OpenClaw Gateway. Launch a worker, watch its tail, schedule its next run, edit its skill — all without touching the Cloudflare dashboard. When you need to drive it from your editor, the Agent Client Protocol (JSON-RPC, the LSP-for-coding-agents) makes any ACP-compliant client — Zed, VSCode, acpx — talk to a ClaudeFlare worker through session/new · session/prompt · session/cancel. One mental model spans desktop, editor, and edge.

               CLAUDEFLARE — THE FOUR BETS

  ┌───────────────────────────────────────────────────────────┐
  │  BET 1: EPHEMERAL WORKERS                                 │
  │                                                           │
  │  task arrives → Worker spins up → executes → self-deletes │
  │                                                           │
  │  No warm processes. No idle billing. No cleanup debt.     │
  │  Each Worker is a single-use function, not a service.     │
  │                                                           │
  ├───────────────────────────────────────────────────────────┤
  │  BET 2: AUTO-DOCS ON CF PAGES                             │
  │                                                           │
  │  code ships → doc-engine reads layer config → generates   │
  │               HTML guide → deploys to CF Pages            │
  │                                                           │
  │  Every layer has a live URL. Docs never go stale.         │
  │  Architecture is always readable.                         │
  │                                                           │
  ├───────────────────────────────────────────────────────────┤
  │  BET 3: CLAWBOX DESKTOP CONTROL PLANE                     │
  │                                                           │
  │  Tauri v2 native client → OpenClaw Gateway (WebSocket RPC)│
  │     │                                                     │
  │     └── launch · tail · schedule · skill-edit · sessions  │
  │                                                           │
  │  Local-first sandbox. No CF dashboard round-trips.        │
  │  Author here, promote to edge with one wrangler deploy.   │
  │                                                           │
  ├───────────────────────────────────────────────────────────┤
  │  BET 4: AGENT CLIENT PROTOCOL (ACP)                       │
  │                                                           │
  │  Zed · VSCode · acpx · ClawBox                            │
  │      │                                                    │
  │      └─ JSON-RPC ──→ ClaudeFlare Worker                   │
  │           session/new · prompt · cancel                   │
  │           fs/read · fs/write · terminal/*                 │
  │                                                           │
  │  Workers become addressable through standard tooling.     │
  │  Bespoke HTTP shapes go away.                             │
  └───────────────────────────────────────────────────────────┘

  THE COMPOSITION

  author skill in  ───→  drive via ACP  ───→  promote to ephemeral
   ClawBox (local)        from editor          CF Worker (edge)
        │                      │                       │
        └──────────── one mental model ─────────────────┘

One-Time-Use Workers

In ClaudeFlare, a Worker is not a service — it's a task envelope. It receives one job, runs it to completion, emits its outputs to a CF Queue or KV, and exits. CF's native scale-to-zero handles the rest. The Worker never waits for another job.

  EPHEMERAL WORKER LIFECYCLE

  ┌─────────────────────────────────────────────────────────────────┐
  │                                                                 │
  │  trigger (Queue / Cron / HTTP)                                  │
  │        │                                                        │
  │        ▼                                                        │
  │  ┌──────────────────────────────────────────────────┐          │
  │  │  flair-worker-[name]-[ulid]                      │          │
  │  │                                                  │          │
  │  │  1. hydrate context from KV / D1                 │          │
  │  │  2. execute single task                          │          │
  │  │  3. emit outputs → Queue | KV | R2               │          │
  │  │  4. log outcome → flair:outcomes:[session]       │          │
  │  │  5. return · CF scales to zero                   │          │
  │  │                                                  │          │
  │  └──────────────────────────────────────────────────┘          │
  │        │                                                        │
  │        ▼                                                        │
  │  next Worker in chain picks up from Queue                       │
  │                                                                 │
  └─────────────────────────────────────────────────────────────────┘

  NEVER:  a Worker that polls, loops, or waits
  ALWAYS: input → transform → output → exit

Dynamic Worker Dispatch

The flair-dispatcher Worker reads a task manifest from KV, spins up the right Worker via CF Queues, and wires up the output chain. No central process manages execution — each Worker is self-contained and independently deployable.

// packages/dispatcher/src/index.ts

export default {
  async fetch(req: Request, env: Env): Promise<Response> {
    const { task, payload } = await req.json();

    // Route task → queue → correct ephemeral Worker
    const queue = TASK_QUEUE_MAP[task];
    if (!queue) return new Response('unknown task', { status: 400 });

    await env[queue].send({
      task_id: ulid(),
      task,
      payload,
      dispatched_at: Date.now(),
    });

    return Response.json({ queued: true });
  }
};

// Every task maps to a dedicated CF Queue
const TASK_QUEUE_MAP = {
  'doc:generate':    'FLAIR_DOC_QUEUE',
  'layer:audit':     'FLAIR_AUDIT_QUEUE',
  'deploy:preview':  'FLAIR_DEPLOY_QUEUE',
  'worker:spawn':    'FLAIR_SPAWN_QUEUE',
};

Worker Conventions

RuleDetail
One task per WorkerA Worker does exactly one thing. Split multi-step work into chained Workers via Queue.
Stateless by defaultAll state lives in KV / D1 / R2. Workers are pure functions over that state.
ULID task IDsEvery dispatch gets a ULID. Outcomes keyed flair:outcomes:{ulid}.
Idempotent writesRe-running a Worker with the same ULID produces the same output — safe to retry.
No warm stateNever cache in Worker memory between requests. KV only.
Scale to zeroWorkers cost nothing at idle. Design for burst, not persistence.

Auto-Docs on CF Pages

Every ClaudeFlare project layer ships with a flair.layer.json manifest. The worker-doc-gen ephemeral Worker reads this manifest, calls Claude Sonnet to render an HTML architecture guide, and deploys it to Cloudflare Pages — automatically, on every layer change.

  AUTO-DOC PIPELINE

  flair.layer.json  ──▶  worker-doc-gen  ──▶  Claude Sonnet
  (layer manifest)        (ephemeral)          (HTML render)
                                                    │
                                                    ▼
                                           CF Pages deploy
                                           {project}-arch.pages.dev
                                           {project}-guide.pages.dev
                                           {project}-api.pages.dev

  TRIGGERS
  ─────────────────────────────────────────────────────
  • wrangler deploy of any layer   → doc-gen queue fires
  • manual: flair docs build       → all layers regenerate
  • git push to main               → CI triggers doc deploy

Layer Manifest

// flair.layer.json — every layer ships one of these
{
  "layer": "worker-analyzer",
  "project": "claudeflare",
  "version": "0.3.1",
  "description": "Pain point extraction via Claude + Gemma",
  "inputs": ["analyze-queue"],
  "outputs": ["score-queue"],
  "kv_keys": ["flair:weights:current", "flair:prompts:analyze"],
  "docs": {
    "arch_url": "https://flair-worker-analyzer-arch.pages.dev",
    "last_generated": "2026-04-14T03:00:00Z",
    "sections": ["overview", "queue-contract", "kv-schema", "deploy"]
  }
}

Doc Generation Worker

// apps/worker-doc-gen/src/index.ts

export default {
  async queue(batch: MessageBatch<DocGenTask>, env: Env) {
    for (const msg of batch.messages) {
      const { layer_manifest, project } = msg.body;

      // 1. Call Claude Sonnet to render HTML guide
      const html = await generateLayerDoc(env, layer_manifest);

      // 2. Write to R2 (source for CF Pages deploy)
      const key = `docs/${project}/${layer_manifest.layer}/index.html`;
      await env.FLAIR_DOCS_BUCKET.put(key, html, {
        httpMetadata: { contentType: 'text/html' }
      });

      // 3. Trigger CF Pages deploy via Workers API
      await deployToPages(env, project, layer_manifest.layer);

      msg.ack();
    }
  }
};

async function generateLayerDoc(env: Env, manifest: LayerManifest): Promise<string> {
  const res = await fetch(`${env.OPENCLAW_URL}/v1/messages`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'X-Codex-Token': env.OPENCLAW_CODEX_TOKEN },
    body: JSON.stringify({
      model: 'claude-sonnet-4-6',
      max_tokens: 4096,
      system: FLAIR_DOC_SYSTEM_PROMPT,  // loaded from KV
      messages: [{
        role: 'user',
        content: `Generate a complete architecture doc HTML page for this layer:\n${JSON.stringify(manifest, null, 2)}`
      }]
    })
  });
  const data = await res.json();
  return data.content[0].text;  // returns full HTML string
}

Doc URL Convention

Doc TypeURL PatternTrigger
Layer Architecture{project}-{layer}-arch.pages.devwrangler deploy
Project Overview{project}-arch.pages.devAny layer deploy
Deploy Runbook{project}-deploy.pages.devscripts/ change
API Reference{project}-api.pages.devwrangler.toml change
Custom Domain{project}.organizedai.vipManual CNAME
Design rule: The doc at {project}-arch.pages.dev is always the canonical human-readable view of the system. Every PR that ships code must also update flair.layer.json so the doc regenerates automatically.

Full System Diagram

                    CLAUDEFLARE — SYSTEM DIAGRAM

┌──────────────────────────────────────────────────────────────────────┐
│  OPERATOR / CI                                                       │
│  wrangler deploy · flair docs build · git push                      │
└──────────────────────────────┬───────────────────────────────────────┘
                               │
                    ┌──────────▼──────────┐
                    │  flair-dispatcher   │  CF Worker (gateway)
                    │  reads task from    │  routes to Queue
                    │  HTTP / Cron / KV   │
                    └──────┬──────────────┘
                           │  CF Queues
         ┌─────────────────┼──────────────────────┐
         ▼                 ▼                      ▼
  ┌─────────────┐  ┌──────────────┐   ┌──────────────────┐
  │ worker-     │  │ worker-      │   │ worker-doc-gen   │
  │ task-[ulid] │  │ audit-[ulid] │   │ reads layer.json │
  │             │  │              │   │ calls Claude     │
  │  one task   │  │  one audit   │   │ deploys to Pages │
  │  then exit  │  │  then exit   │   │ then exit        │
  └──────┬──────┘  └──────┬───────┘   └────────┬─────────┘
         │                │                    │
         ▼                ▼                    ▼
  ┌──────────────────────────────────────────────────────┐
  │  CLOUDFLARE PLATFORM                                 │
  │                                                      │
  │  KV: flair:{project}:{key}    (config, weights)      │
  │  D1: flair-state              (task history, logs)   │
  │  R2: flair-artifacts          (JSONL, doc HTML)      │
  │  Queues: per-task-type        (ephemeral dispatch)   │
  │  Pages:  per-layer docs       (auto-generated)       │
  └──────────────────────────────────────────────────────┘
         │
         ▼
  claws-mac-mini (Tailscale 100.82.244.127)
  OpenClaw :18789  ←  ExoClaw CF Worker (bridge)
  NoClaw   :11434  ←  Gemma 3 27B (free inference)
  Hermes   :7700   ←  memory + context

ExoClaw Bridge

CF Workers can't reach Tailscale directly. ExoClaw is a single CF Worker that acts as a public-to-Tailscale bridge — it authenticates the request, proxies it over Tailscale to OpenClaw on claws-mac-mini, and returns the response. All ClaudeFlare Workers call Claude via this path. No ANTHROPIC_API_KEY anywhere.

  CF Worker  →  ExoClaw (CF Worker)  →  Tailscale  →  OpenClaw :18789
                  validates token           mesh        claude CLI OAuth
                  OPENCLAW_CODEX_TOKEN               no API key needed

ClaudeFlare VS DuraClaw

ClaudeFlare is a fork, not a replacement. DuraClaw is a mature agent runtime with broader scope; ClaudeFlare inherits all of it via git remote — including the eight-PR cost-routing + telemetry + batch-lane stack currently in review at baseplane-ai/duraclaw. On top of that inheritance, ClaudeFlare bets on four specific differentiators: ephemeral one-time-use Workers, auto-doc generation per layer, a desktop control plane via ClawBox, and cross-editor interop via the Agent Client Protocol.

Feature DuraClaw ClaudeFlare
Worker lifecycle Persistent services ✓ Ephemeral, one-time-use
Doc generation Manual / none ✓ Auto-generated CF Pages per layer
Core agent runtime ✓ Full, mature Fork — inherits DuraClaw core
Deploy target Flexible ✓ CF Workers + Pages native
Idle cost Varies ✓ $0 (scale to zero always)
LLM cost routing ✓ UncommonRoute (vendored, PR #90) + router-client (PR #89) Inherited via fork
Decision telemetry ✓ NDJSON sinks per RouteRecord (PR #91) Inherited via fork
Offline policy replay uncommon-route replay --from PATH (PR #99) Inherited via fork
Session-aware routing headers ✓ Client + server (PRs #95, #96) Inherited via fork
Batch-analysis lane ✓ CF Queue + Anthropic Batches, opt-in (PR #97) ✓ CF-native — composes naturally
Doc URL per layer ✗ Not built-in ✓ Auto at {layer}-arch.pages.dev
OpenClaw integration Optional ✓ Default — no API key pattern
Desktop control plane ✗ Not provided ClawBox — Tauri v2 native client
Cross-editor agent protocol ✗ Bespoke API ACP — JSON-RPC, any compliant client
Local-first sandbox → edge promotion Edge-only ✓ Local in ClawBox → promote via wrangler
Open source See upstream license ✓ Organized-AI org, MIT
Marketing / branding DuraClaw ✓ ClaudeFlare — standalone identity

Two pieces DuraClaw doesn't ship: a desktop control plane for managing ephemeral workers without leaving the local machine, and a standardized agent protocol so any compatible client can drive a ClaudeFlare worker through one well-known interface. The combination turns the fork into something DuraClaw structurally can't be — a local-first sandbox that promotes the same agent to the edge with one deploy.

Tauri v2 native client (Rust shell + React 18 + Bun/Hono). Bridges to OpenClaw Gateway over WebSocket RPC for sessions, models, chat history, cron, and skill editing — all local-first. In ClaudeFlare's flow it's the single pane of glass for: launching an ephemeral worker, watching its tail logs, scheduling its next run, editing the skill it executes. No Cloudflare dashboard round-trips.
Tauri v2RustOpenClawdesktop
JSON-RPC 2.0 standard (LSP-for-coding-agents). Any ACP-compliant client — Zed, VSCode, acpx, potentially ClawBox — can drive a ClaudeFlare worker through session/new, session/prompt, session/cancel. Workers become addressable through tooling that already exists, not bespoke HTTP shapes. fs/* + terminal/* handlers run inside the ephemeral worker; permissions flow back to the client.
JSON-RPCprotocolacpxinterop

Strategic value: the two compose. Author a skill in ClawBox locally → drive it via ACP from your editor → promote the same skill to an ephemeral CF Worker with wrangler deploy → invoke the deployed worker from any ACP client by URL. One mental model, three execution surfaces (desktop, editor, edge). DuraClaw's edge-only model can't span the local→edge boundary without a separate stack.

Eight open PRs land cost-routing, telemetry, replay, session-aware routing, and a batch lane into DuraClaw core. ClaudeFlare picks them up automatically via git remote sync — no flair-specific patches needed.

Vendors anjieyang/IYKYK at v0.3.1 (commit 563bb76) into services/uncommon-route/ — a local LLM router that cuts premium-model spend by routing prompts by difficulty. Foundation for the rest of the stack.
vendorrouterlocal-llm
Zero-dep TS workspace package. Wires any LLM caller in the monorepo through UncommonRoute with one routerConfig() call. No runtime changes — additive.
packagetypescriptopt-in
Streams every RouteRecord to optional sinks. NDJSONDecisionSink writes the historical stream that powers offline replay (#99). Stacked on #90.
telemetryndjsonstacked
Wires @duraclaw/router-client into the session-runner behind UNCOMMON_ROUTE_URL. Missing env = unchanged behaviour. Stacked on #89.
runtimeopt-instacked
UncommonRoute resolves richer per-session context — routing decisions can see who the caller is. Stacked on #90 + #91. Sibling to #96.
routersessionstacked
router-client emits the matching headers for #95. Either ordering can land first; missing headers fall back to sentinels. Sibling to #95.
clientheadersstacked
Second LLM-call lane via Cloudflare Queue + Anthropic Batches for non-interactive work. Ships dark — opt-in via wrangler queue + secret + flag. Independent of the routing stack.
CF Queuebatchesorchestrator
The affordability lever. uncommon-route replay --from PATH [--policy PATH] [--json] scores a candidate routing policy against the historical decision stream offline — promote to live only when the diff confirms cost / shape gains. Stacked on #90 + #91.
clireplayautoresearch
Upstream sync: ClaudeFlare pulls DuraClaw core improvements via git remote. The PR #89/#90/#91 trio plus #94 land core routing + telemetry; #95/#96 layer in session context; #97 adds the batch lane (CF-native — composes naturally with ClaudeFlare's ephemeral worker pattern); #99 enables policy replay before promotion. Flair-specific patches (ephemeral worker pattern, doc-gen engine) live in packages/flair-workers/ and packages/doc-engine/ — isolated from upstream to keep rebases clean even as the eight PRs land.

Built-In Layer Catalog

flair-dispatcher
Gateway. Routes tasks to Queues. Never executes tasks itself.
CF Workergateway
worker-doc-gen
Reads layer manifests. Calls Claude. Deploys HTML to CF Pages.
ephemeralClaudeCF Pages
worker-task-[ulid]
Generic task envelope. Extend with your task logic. Exits on completion.
ephemeraltemplate
worker-audit
Reads KV + D1 state. Produces audit report to R2. One run, done.
ephemeralKVD1
exoclaw-bridge
CF Worker bridging public internet → Tailscale → OpenClaw. Auth via Codex token.
CF WorkerTailscaleOpenClaw
flair-dashboard
CF Pages app. Shows task history, doc URLs, Worker outcome log.
CF Pagesdashboard

Stack & Conventions

TypeScript-first, pnpm monorepo. Each Worker is an independent package under apps/. Shared primitives in packages/. Same structure as Organized AI codebase standard.

Monorepo Layout

apps/
  flair-dispatcher/        # CF Worker — task routing gateway
  worker-doc-gen/          # CF Worker — Claude doc generation
  worker-task-template/    # CF Worker — extend for custom tasks
  worker-audit/            # CF Worker — state audit
  exoclaw-bridge/          # CF Worker — Tailscale bridge
  flair-dashboard/         # CF Pages — task + doc index
packages/
  flair-workers/           # ephemeral worker base class + lifecycle
  doc-engine/              # layer manifest reader + Claude doc prompt
  types/                   # shared TypeScript types
  kv/                      # KV namespace helpers
  queue/                   # Queue send/receive helpers
scripts/
  deploy-all.sh            # deploy all Workers + dashboard
  docs-build.sh            # trigger doc-gen for all layers
  bootstrap.sh             # first-time CF infra provisioning
.claude/
  CLAUDE.md                # agent conventions for Claude Code
  skills/                  # Organized Codebase skills
  commands/                # custom slash commands
CLAUDE.md                  # root agent entry
flair.project.json         # project-level manifest

Key Dependencies

PackagePurpose
@cloudflare/workers-typesFull CF Workers + Queues + KV + D1 + R2 types
wranglerDeploy Workers, Pages, manage secrets, KV writes
ulidULID task IDs — sortable, unique per dispatch
zodLayer manifest + task payload schema validation
honoLightweight HTTP router for dispatcher Worker
turborepoMonorepo build orchestration

Deploy & Run

Three scripts do everything. bootstrap.sh provisions CF infra. deploy-all.sh deploys Workers. docs-build.sh triggers doc generation for all layers.

1. Bootstrap (once)

# scripts/bootstrap.sh — run once per new project
CLOUDFLARE_ACCOUNT_ID=691fe25d377abac03627d6a88d3eeac9 \
  bash scripts/bootstrap.sh

# Creates:
#   • KV namespace: FLAIR_KV
#   • D1 database:  flair-state
#   • R2 bucket:    flair-artifacts
#   • Queues:       flair-doc-queue, flair-task-queue, flair-audit-queue
#   • CF Pages projects per layer (from flair.project.json)

2. Configure Secrets

cp .env.example .env
# Fill in:
OPENCLAW_URL=https://exoclaw.your-account.workers.dev
OPENCLAW_CODEX_TOKEN=codex_...
CLOUDFLARE_ACCOUNT_ID=691fe25d377abac03627d6a88d3eeac9

# Push to Workers:
echo $OPENCLAW_URL         | wrangler secret put OPENCLAW_URL         --name flair-dispatcher
echo $OPENCLAW_CODEX_TOKEN | wrangler secret put OPENCLAW_CODEX_TOKEN --name worker-doc-gen
echo $OPENCLAW_CODEX_TOKEN | wrangler secret put OPENCLAW_CODEX_TOKEN --name worker-task-template

3. Deploy All Workers

CLOUDFLARE_ACCOUNT_ID=691fe25d377abac03627d6a88d3eeac9 \
  bash scripts/deploy-all.sh --commit-dirty=true

# Individual Worker:
CLOUDFLARE_ACCOUNT_ID=691fe25d377abac03627d6a88d3eeac9 \
  wrangler deploy --name flair-dispatcher \
  --config apps/flair-dispatcher/wrangler.toml \
  --commit-dirty=true

4. Generate All Docs

# Trigger doc-gen for every layer in flair.project.json
bash scripts/docs-build.sh

# Or trigger a single layer:
curl -X POST https://flair-dispatcher.your-account.workers.dev/dispatch \
  -H "Content-Type: application/json" \
  -d '{"task": "doc:generate", "payload": {"layer": "worker-analyzer"}}'

# Deploy this doc site pattern (how this page was deployed):
wrangler pages project create claudeflare-arch --production-branch=main
wrangler pages deploy ./docs \
  --project-name=claudeflare-arch \
  --branch=main \
  --commit-dirty=true

Operational Checklist

RuleWhy
Always include --commit-dirty=trueCF wrangler requires this for local deploys
Update flair.layer.json with every code changeTriggers auto-doc regeneration
Never put ANTHROPIC_API_KEY in wrangler secretsClaude routes via OpenClaw OAuth only
ULID every task dispatchEnables idempotent retries + outcome tracing
Workers must exit cleanlyNo long-running loops — scale to zero depends on it
Check D1 task log after deploysConfirm Workers ran + exited as expected