A simplified Claude Cowork clone demonstrating Mesa Code Storage as a Git-backed filesystem for AI agent workspaces.
This project showcases how to build an AI coding agent with persistent storage using:
- Mesa SDK - Programmatic Git hosting for automated workflows
- Cloudflare Sandbox SDK - Isolated code execution environment
- Anthropic SDK - Claude AI with tool calling
- Next.js - Full-stack React framework
Users chat with Claude, which executes code in a Cloudflare sandbox and automatically commits all changes to a Mesa Git repository.
User Chat → Next.js API → Claude (Anthropic) → Custom Tools:
├─ read_file (Cloudflare sandbox)
├─ write_file (Cloudflare sandbox)
├─ list_files (Cloudflare sandbox)
├─ execute_bash (Cloudflare sandbox)
└─ Auto-commit to Mesa
- 🤖 AI-Powered Workspace - Chat with Claude to analyze data, organize files, and run scripts
- 📦 Git-Backed Storage - Every change is automatically committed to Git via Mesa
- ☁️ Sandboxed Execution - Safe code execution in Cloudflare sandbox with Python and Unix tools
- 📂 Sample Data - Pre-loaded with messy CSV files, scripts, and notes for demonstration
- 📜 Commit History - View a readable log of all agent actions
- 🎨 Modern UI - Clean Next.js interface with real-time updates
- Node.js 20+
- Mesa API key (sign up for free)
- Anthropic API key (for Claude)
- Cloudflare account (for sandbox)
- Clone the repository:
git clone https://github.com/yourusername/knowledge-worker-example.git
cd knowledge-worker-example- Install dependencies:
npm install- Set up environment variables:
cp .env.example .envEdit .env and add your API keys:
ANTHROPIC_API_KEY=your_anthropic_api_key_here
MESA_API_KEY=your_mesa_api_key_here
CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id_here
CLOUDFLARE_API_TOKEN=your_cloudflare_api_token_here- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
- Click "Create Workspace" on the landing page
- Mesa will create a new Git repository with seed files:
data/sales_2023.csv- Sample sales datadata/customers.csv- Customer datascripts/old_script_v2_final_FINAL.py- Poorly named scriptreports/draft_analysis.txt- Messy notesdownloads/random_notes.txt- Scattered files
Try asking Claude:
- "Can you organize these files into a better structure?"
- "Analyze the sales CSV and create a summary report"
- "Clean up that Python script and add documentation"
- "What insights can you find in the customer data?"
- "Run the Python script and show me the output"
- You send a message via the chat interface
- Next.js API route receives the message
- Claude analyzes the request and calls tools:
read_file- Read files from sandboxwrite_file- Create/modify files in sandboxlist_files- Browse file structureexecute_bash- Run Python scripts, data analysis, etc.
- Claude streams responses back to the UI
- When done, modified files are committed to Mesa
- Commit history shows what Claude did
knowledge-worker-example/
├── app/
│ ├── api/
│ │ ├── workspace/ # Create Mesa repos
│ │ └── chat/ # Chat with Claude
│ ├── page.tsx # Main UI
│ ├── layout.tsx # Root layout
│ └── globals.css # Styles
├── components/
│ ├── chat/ # Chat interface
│ ├── file-tree/ # File browser
│ └── commit-history/ # Git commit log
├── lib/
│ ├── mesa/ # Mesa SDK wrapper
│ ├── sandbox/ # Cloudflare Sandbox wrapper
│ └── agent/ # Tool definitions
├── CLAUDE.md # Project documentation
└── README.md # This file
Mesa provides programmatic Git hosting optimized for AI agents:
- No local Git required - All operations via API
- Fast commits - Create repositories and commit files in milliseconds
- Full Git compatibility - Clone with standard Git clients
- Version history - Every agent action is tracked
Learn more: Mesa Documentation
Cloudflare Sandbox provides secure code execution:
- Isolated containers - Each workspace runs in isolation
- Full Linux environment - Python, Node.js, Unix tools
- Real-time output - Stream command results
- Network access - Fetch external data (can be restricted)
Learn more: Cloudflare Sandbox Docs
Claude AI with tool calling:
- Tool use - Claude can call functions to interact with the environment
- Streaming - Real-time response streaming
- Multi-turn conversations - Context-aware across tool calls
Learn more: Anthropic Documentation
This demo showcases Mesa's key capabilities:
await mesa.repos.create({
org: "demo",
body: { name: "workspace-123" }
});await mesa.commits.create({
org: "demo",
repo: "workspace-123",
body: {
branch: "main",
message: "Agent updated files",
author: { name: "Claude", email: "claude@example.com" },
edits: [
{ path: "report.md", action: "create", content: "# Analysis\n..." }
]
}
});const file = await mesa.files.get({
org: "demo",
repo: "workspace-123",
path: "data/sales.csv"
});const commits = await mesa.commits.list({
org: "demo",
repo: "workspace-123"
});Key Benefits:
- No need to clone repositories locally
- No Git configuration or SSH keys
- Perfect for automated workflows and AI agents
- Every agent action is versioned and auditable
npm testnpm run build
npm startnpx tsc --noEmitThis is a demo project with intentional simplifications:
- ❌ No authentication or multi-user support
- ❌ No real-time collaboration
- ❌ No branch management or merging
- ❌ Sandbox state is ephemeral (Mesa is source of truth)
- ❌ Limited error handling
Potential additions for a production version:
- User authentication and workspace management
- Real-time collaboration with WebSockets
- Git branch management and pull requests
- File upload/download
- Workspace templates
- Custom tool additions
- Rate limiting and quota management
- Integration with GitHub/GitLab
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
Open an issue or reach out on Twitter @yourusername