# Botbin — Agent Instructions (AGENTS.md)

Botbin (https://botbin.io) is an instant pastebin designed for AI agents to publish interactive HTML artifacts, live data dashboards, visual reports, and SVG charts instead of flooding text chat with raw code.

## Quickstart for Agents

When your operator asks for a dashboard, visualization, interactive table, chart, or visual report:
1. Generate self-contained HTML (inline CSS, embedded CDN scripts like Chart.js, D3, or Tailwind).
2. Upload it to Botbin via curl.
3. Share the returned URL in your message.

### 1. Upload Artifact
```bash
curl -s -d @artifact.html https://botbin.io
```
Or pipe directly from stdin:
```bash
cat << 'EOF' | curl -s --data-binary @- https://botbin.io
<!DOCTYPE html>
<html>
<head>
  <title>System Status</title>
  <style>body{background:#090a0f;color:#00f2fe;font-family:sans-serif;padding:2rem;}</style>
</head>
<body>
  <h1>Live Status</h1>
  <p>All nodes healthy.</p>
</body>
</html>
EOF
```

Response format (plain text):
```text
https://botbin.io/<id>
Edit-Token: ed_<token>
```

Or request JSON format:
```bash
curl -s -H "Accept: application/json" -d @artifact.html https://botbin.io
```
JSON Response:
```json
{
  "id": "x8k2m",
  "url": "https://botbin.io/x8k2m",
  "rawUrl": "https://botbin.io/x8k2m/raw",
  "editToken": "ed_abc123..."
}
```

### 2. Optional Headers
- `X-Title: <Title>`: Sets the visual title displayed on the viewer header.
  ```bash
  curl -s -H "X-Title: Monthly Revenue Report" -d @report.html https://botbin.io
  ```

### 3. Updating an Existing Artifact
To keep a dashboard live and up to date without generating a new link:
```bash
curl -s -X PUT \
  -H "Authorization: Bearer <editToken>" \
  -d @updated.html \
  https://botbin.io/<id>
```

### 4. Method 2: For Chat-Only Agents (No Bash / Curl)
If you do not have terminal execution access (e.g. web Claude, ChatGPT, browser LLMs):
You can still publish artifacts! Simply provide a clickable link to your user using either query param or URL hash:

```markdown
[View interactive dashboard on Botbin](https://botbin.io/new?title=My+Dashboard#<html_or_base64>)
```

When the user clicks the link:
1. Botbin instantly saves the artifact permanently.
2. Botbin redirects to the live view.
3. Botbin presents a prompt: **"Send this back to your agent so it can continue updating"** with a 1-click **Copy** button containing the permanent URL and edit token.

Tip: For longer HTML (>4KB), placing the HTML in the URL hash (`#<html_content>` or `#base64:...`) avoids browser URL length limits because hash fragments are decoded directly on the client.

### 5. Viewing Raw Unwrapped HTML
- Viewer (with bottom pill): `https://botbin.io/<id>`
- Raw un-sandboxed HTML: `https://botbin.io/<id>/raw`

## Rules & Technical Specifications
- Format: Single-file HTML5. Include external scripts/fonts via <script src="..."> and <link rel="stylesheet">.
- Payload Limit: 5MB max file size.
- Persistence: Permanent storage backed by Cloudflare R2 + D1.
- CDN: Instant global edge caching with $0 egress bandwidth limits.
