The dataset is currently empty. Upload or create new data files. Then, you will be able to explore them in the Dataset Viewer.
ClonAgent — Architecture of an Email-Driven AI Agent Builder
Live demo: clonagent.utopiaia.com
GitHub: github.com/KikoCisBot/clonagent
What is ClonAgent?
ClonAgent is an open platform that lets anyone create AI agents that operate entirely through email.
No dashboards. No code. You describe what the agent should do, and it handles everything — reading emails, reasoning about the request, taking action, and replying.
The mental model is simple:
→ Authorized sender emails a request
← Agent reads it, acts on it, deploys the result, replies to the thread
System Architecture
┌─────────────────────────────────────────────────────────────┐
│ ClonAgent Platform │
│ │
│ Browser ──► client (Vite / React) │
│ │ │
│ ▼ │
│ server (Express, port 3300) │
│ ├── /api/chat ──► Claude (via relay) │
│ ├── /api/agents ──► ~/.claude/skills/ │
│ ├── /api/auth ──► magic-link / OIDC │
│ ├── /api/billing ──► Stripe │
│ └── gmail-poller ──► IMAP every 1min │
│ │ │
│ ▼ launchAgent() │
│ host-relay ──► Claude CLI session │
│ │ │
│ ▼ │
│ Agent workspace │
│ ~/.claude/skills/<agent-id>/ │
└─────────────────────────────────────────────────────────────┘
Core Components
1. Agent Builder (Chat UI + Claude)
The entry point for creating agents. Users describe their agent in plain language. The builder:
- Calls Claude via a LiteLLM-compatible relay
- Uses a tool-calling loop (
list_agents,save_agent,gitea_create_repo,provision_database, etc.) - Creates everything from scratch: repo, database, mailbox, SSH config
- Never asks technical questions — it just builds and lets the user correct
Key design decision: The builder calls Claude CLI via a relay with --max-turns 20, which allows multi-step tool execution within a single conversation turn.
2. Host Relay
A Node.js process (host-relay.js) that exposes an OpenAI-compatible /v1/chat/completions endpoint, backed by Claude CLI instead of the API.
This means:
- No per-token billing — uses Claude subscription (Claude Code)
- Full tool use — Claude can run shell commands, read files, make HTTP calls
- Streaming support — progressive responses to the frontend
client → POST /v1/chat/completions → relay → claude CLI → stream back
3. Email Poller (gmail-poller.js)
Runs every 60 seconds per agent. For each enabled agent:
- Connects to the agent's IMAP inbox
- Fetches unseen threads from authorized senders
- Checks for
!commands(handled locally — no Claude needed):!help,!status,!add,!remove,!pause,!resume,!senders
- For real requests — launches a Claude CLI session pointed at the agent's workspace
- Claude reasons, writes code, calls tools, deploys
- Replies to the email thread with the result
4. Agent Skill (per-agent workspace)
Each agent lives in ~/.claude/skills/<agent-id>/ and contains:
├── config.json # authorized senders, deploy targets, IMAP config
├── CLAUDE.md # agent's system prompt / instructions
├── gmail_client.py # IMAP/SMTP helpers for Gmail OAuth
├── imap-credentials.json # IMAP password (mode 600)
└── <project files> # the project the agent manages
The CLAUDE.md is auto-generated by the builder from the user's description and defines the agent's entire behavior — what it does, who it listens to, how it deploys.
5. Auth Layer
Three modes, configurable at runtime:
| Mode | Description |
|---|---|
none |
Open (dev/local) |
basic |
Username + bcrypt password, stored in data/users.json |
oidc |
OpenID Connect — Keycloak, Google, Auth0 |
Magic-link login is built in: enter your email → get a link → auto-login. No password needed for first-time users.
6. Infrastructure (built-in)
ClonAgent ships with optional built-in infrastructure for agents that need it:
| Service | Purpose |
|---|---|
| Gitea | Per-agent Git repositories |
| PostgreSQL | Per-agent databases |
| docker-mailserver | Per-agent IMAP/SMTP mailboxes at @bot.utopiaia.com |
Email Command Protocol
Before launching Claude, the poller checks the first line of the email body for !commands:
!help → reply with command list
!status → reply with agent config + last run
!add email@domain.com → add authorized sender
!remove email@domain.com → revoke access
!pause → stop polling
!resume → restart polling
!senders → list all authorized senders
Anything else is forwarded to Claude as a natural-language task.
You can also just write plainly: "The checkout button is broken on mobile" — the agent understands.
Data Flow: Processing an Email
1. Poller tick (every 60s)
│
▼
2. Fetch UNSEEN messages from IMAP inbox
└── Filter by authorizedSenders list
│
▼
3. Is first line a !command?
├── YES → handle locally, SMTP reply, mark read
└── NO →
│
▼
4. POST to host-relay → spawn Claude CLI session
- Working dir: agent workspace
- System prompt: agent's CLAUDE.md
- Input: email body + thread context
│
▼
5. Claude reasons + acts
- Reads/writes files
- Runs shell commands
- Calls MCP servers (postgres, github, etc.)
- Deploys via SSH / git push
│
▼
6. Claude outputs result text
│
▼
7. Poller sends SMTP reply to original thread
8. Marks email as read
Self-Learning Mechanism
Each correction a user makes — every pricing adjustment, every rule they add to the agent's CLAUDE.md, every deploy script they refine — is persisted in the agent's workspace.
The next invocation starts from that evolved state. There is no separate training loop. The agent improves through use, exactly like a junior developer who reads the notes from yesterday.
Real-World Usage
ClonAgent has been running in production since July 2025 supporting professional users in the construction and engineering sector.
In 10 months of real usage:
- 42 registered users
- 1,212 AI-assisted projects processed
- 186,000+ automated task decompositions
- 8,500+ AI conversations
- 5,500+ model calls in the last 3 months
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | React 18 + Vite + Tailwind CSS |
| Backend | Node.js + Express |
| AI | Claude (Anthropic) via Claude Code CLI |
| Auth | express-session + bcrypt + openid-client |
| Nodemailer + ImapFlow + docker-mailserver | |
| Payments | Stripe |
| Storage | JSON files (agents, users, sessions) |
| Git | Gitea (built-in) |
| Database | PostgreSQL (built-in, per-agent) |
Getting Started
git clone https://github.com/KikoCisBot/clonagent.git
cd clonagent
cp .env.example .env # add your ANTHROPIC_API_KEY
cd server && npm install && cd ..
cd client && npm install && cd ..
( cd server && npm run dev ) # → http://localhost:3300
( cd client && npm run dev ) # → http://localhost:3301
Open the Chat, describe your agent, and it will build itself.
Built by Kiko Cisneros · Utopia IA
- Downloads last month
- 31