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: "[email protected]" },
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