An autonomous documentation update agent built on Cloudflare Computer (@cloudflare/computer) and Durable Objects. The agent inspects source code files on an edge-native Virtual Filesystem (VFS), parses function signatures and docstrings, and autonomously syncs Markdown documentation on Cloudflare's global edge network.
Important
The Ephemeral State Problem: In traditional serverless AI architectures, worker execution state is wiped between requests. When an AI coding agent writes or refactors code, it loses memory of files and intermediate state once the serverless function completes.
The Cloudflare Computer Solution: By binding a stateful Virtual Filesystem backed by SQLite Durable Objects, this agent maintains a persistent edge workspace. It automatically detects code changes, extracts docstrings, and updates API reference documentation persistently without external database dependencies.
+-------------------------------------------------------------------+
| Cloudflare Worker |
| |
| +-------------------------------------------------------------+ |
| | DocAgentDurableObject | |
| | | |
| | +-------------------------------------------------------+ | |
| | | Cloudflare Computer Workspace VFS | | |
| | | (SQLite Backed DO) | | |
| | | | | |
| | | [workspace.fs.readFile] -> Extract Function Signatures | | |
| | | [workspace.fs.writeFile] -> Update docs/API_REF.md | | |
| | | [workspace.runtime.exec] -> Execute Isolate Checks | | |
| | +-------------------------------------------------------+ | |
| +-------------------------------------------------------------+ |
+-------------------------------------------------------------------+
|
v
[ Narrative Output: outputs.md ]
- Node.js (v18.0 or higher)
- npm (Package Manager)
Open your project directory in the terminal and install @cloudflare/computer:
# Install Cloudflare Computer package
npm install @cloudflare/computerStart the live file watcher to automatically process Python files (.py) in src/:
# Start live watcher mode
npm run watchWhenever a .py file inside src/ is added or edited, the agent logs telemetry in the terminal and updates docs/API_REFERENCE.md and outputs.md.
To run a one-off execution of the doc agent pipeline:
# Execute local test run
npm run test:runEmulate the Cloudflare Worker and Durable Object SQLite storage locally:
# Start local Wrangler dev server on localhost
npm run devTo deploy the worker and Durable Object SQLite storage to Cloudflare's global edge network:
# Authenticate with Cloudflare
npx wrangler login
# Deploy to Cloudflare Network
npm run deploy{
"name": "cloudflare-computer-doc-agent",
"main": "src/index.js",
"compatibility_date": "2026-08-01",
"compatibility_flags": [
"nodejs_compat"
],
"durable_objects": {
"bindings": [
{
"name": "MY_DURABLE_OBJECT",
"class_name": "DocAgentDurableObject"
}
]
},
"migrations": [
{
"tag": "v1",
"new_sqlite_classes": [
"DocAgentDurableObject"
]
}
]
}import { Workspace } from '@cloudflare/computer';
export class DocAgentDurableObject {
async fetch(request) {
// 1. Initialize persistent Cloudflare Computer Workspace
const workspace = await Workspace.get(this.env.MY_DURABLE_OBJECT, "doc-workspace");
// 2. Read source code from edge VFS
const code = await workspace.fs.readFile("/src/calculator.py", "utf-8");
// 3. Autogenerate & write Markdown documentation
await workspace.fs.writeFile("/docs/API_REFERENCE.md", "# Generated Docs...");
// 4. Verify runtime execution via Isolate Shell
const check = await workspace.runtime.exec("python3 --version", { backend: "isolate-shell" });
return new Response("Doc Sync Complete");
}
}.
โโโ .gitignore # Git exclusion rules
โโโ package.json # Project metadata and script definitions
โโโ wrangler.json # Cloudflare Worker & Durable Object configuration
โโโ README.md # Master project documentation
โโโ src/
โโโ index.js # Main Autonomous Documentation Agent & DO handler
Running npm run watch or npm run test:run scans Python source files and produces structured outputs:
docs/API_REFERENCE.md: Autogenerated Python API reference document with function signatures and docstrings.outputs.md: Full telemetry execution report detailing VFS file reads, function extraction counts, and runtime status.
- Continuous Documentation Sync: Automatically sync API documentation whenever a coding agent edits function signatures or exports.
- Edge Code Sandbox Verification: Execute code snippets inside Cloudflare Workers Isolates to verify code examples before publishing docs.
- Multi-File PDF Pipeline: Generate Markdown docs on the Isolate backend and pass them to Container backends running
pandocfor PDF export. - Autonomous PR Reviewer: Inspect incoming PR code changes in a temporary Durable Object workspace and generate architectural change notes.
- AI Chat Memory & Scratchpad: Store multi-turn agent workspace state, prompt history, and artifact builds persistently on the edge.
- Git Integration via
ws:git: Direct commits and push operations of autogenerated docs to GitHub repositories. - AST Parsing for TypeScript & Python: Advanced language parsers running inside Dynamic Worker Isolates.
- Container-Based Pandoc PDF Export: Direct integration with
@cloudflare/computerdcontainer for automated PDF rendering. - Webhook Event Listeners: Automatic execution triggers upon GitHub push webhooks.
- Interactive UI Visualizer: Web interface for viewing live VFS file trees and agent task logs side-by-side.
Cloudflare Computer Cloudflare Workers Durable Objects SQLite VFS AI Agents Agent Sandbox Serverless AI Edge Computing Wrangler CLI Autonomous Coding Agent Node.js JavaScript
MIT License. See LICENSE for full details.