No runtime. No sidecar. No framework.
Just PostgreSQL — thinking.
Website · Quick Start · How It Works · Ecosystem · Docs
🤖 100% Vibe-Coded. This entire project — every SQL function, every trigger chain, every line of Python, this README, and even the website — was built through conversational AI. The human (Marcus Meyer) designed the architecture and made decisions. The code was written by Claude Opus 4.6 via OpenClaw. No line was typed by hand.
Every AI agent framework runs outside the database. MeClaw runs inside it.
MeClaw turns PostgreSQL into an operating system for AI agents. Messages flow through trigger chains. Agents are nodes in a graph. LLM calls go out via async HTTP. Tools execute as SQL functions. Nothing leaves the database process.
SELECT meclaw.send('How many users signed up today?');That's a real query. It fires a trigger chain that routes through a graph, loads conversation context, calls an LLM, executes a tool if needed, and delivers the response — all inside PostgreSQL.
git clone https://github.com/mmeyerlein/meclaw.git
cd meclaw
cp config.example.sql config.sql # Add your API keys
docker compose up -d # Done.Open http://localhost:8080 — your agent is running.
Manual install (existing PostgreSQL 17)
# Required extensions: age, pg_cron, pg_net, pgvector, pg_background, plpython3u
psql -d your_db -f install.sql
psql -d your_db -f config.sqlMeClaw uses a Hive & Bee architecture:
┌─────────────────────────────────────────────────┐
│ HIVE (= one PostgreSQL container) │
│ │
│ 📥 Receiver ──▶ 🗺️ Router ──▶ 📚 Context │
│ Bee Bee Bee │
│ │ │ │
│ ▼ ▼ │
│ 🧠 LLM ◀──▶ 🔧 Tool │
│ Bee Bee │
│ │ │
│ ▼ │
│ 📤 Sender │
│ Bee │
│ │
│ Routing: Apache AGE graph (Cypher) │
│ Events: Trigger chains (zero polling) │
│ LLM: pg_net async HTTP (any provider) │
│ Tools: plpython3u (full OS access in sandbox) │
│ State: Append-only event log (ACID) │
└─────────────────────────────────────────────────┘
Bees are pure functions — one input, one output, no loops. The Router Bee reads a Cypher graph to decide what happens next. Everything fires through PostgreSQL triggers. No orchestration layer. No event bus. No message queue. The database is the message queue.
INSERT INTO meclaw.llm_models (id, provider_id, model_name, tier) VALUES
('sonnet-4', 'openrouter', 'anthropic/claude-sonnet-4', 'large'),
('haiku', 'openrouter', 'anthropic/claude-3.5-haiku', 'medium'),
('local', 'vllm', 'Qwen/Qwen3.5-9B', 'small');Each Bee can use a different model. Context history adapts automatically — 5 messages for small models, 30 for large ones.
| Tool | What it does |
|---|---|
sql_read |
Run SELECT queries against the database |
sql_write |
INSERT, UPDATE, DELETE with audit trail |
python_exec |
Execute Python code (requests, urllib, math, os) |
The LLM decides when to use tools via OpenAI function calling. Tool results flow back through the same event chain.
A web UI served directly from PostgreSQL — no web server needed:
SELECT meclaw.admin_bee(8080);
-- Status · Graph Visualization · Event Log · Chat · Models| Channel | Status | How |
|---|---|---|
| Telegram | ✅ | Self-sustaining pg_net long-poll |
| Web Chat | ✅ | Built-in HTTP server |
| Slack | 🔜 | Webhook via HTTP server |
MeClaw is part of a thriving ecosystem of AI agent projects. Here's where it fits:
| OpenClaw | NanoBot | ZeroClaw | PicoClaw | NanoClaw | GoClaw | MeClaw | |
|---|---|---|---|---|---|---|---|
| Language | TypeScript | Python | Rust | Go | TypeScript | Go | SQL |
| Runtime | Node.js | Python | Native binary | Native binary | Node.js | Native binary | None (PostgreSQL) |
| RAM | >1 GB | >100 MB | <5 MB | <10 MB | ~200 MB | ~35 MB | Shares PG |
| Agent logic | App code | App code | App code | App code | App code | App code | Triggers + Graph |
| State | Files + DB | SQLite/PG | Files | Files | Files | PostgreSQL | PostgreSQL IS the state |
| Routing | Config | Config | Config | Config | Config | Config + PG | Cypher graph queries |
| Observability | Logs | Logs | Logs | Logs | Logs | OTel | SELECT * FROM events |
| Recovery | Manual | Manual | Manual | Manual | Manual | Manual | ACID + WAL + PITR |
The difference: Every other project runs agents as an application that uses a database. MeClaw runs agents as the database.
- Pure PostgreSQL — If it can't be done with extensions, it doesn't get done. Zero external processes.
- Event-Driven — Trigger chains fire on every INSERT. No polling in the hot path. No cron loops.
- Append-Only — Every message, every LLM call, every routing decision — immutable event log.
- Container = Sandbox — One Hive = one container.
plpython3ugets full OS access because the container is the boundary. - Bees Don't Loop — An agent does one thing and hands off. The graph decides what's next.
MeClaw stands on the shoulders of these PostgreSQL extensions:
| Extension | Role |
|---|---|
| Apache AGE | Graph DB — agent routing via Cypher |
| pg_net | Async HTTP — LLM calls, webhooks |
| pg_cron | Watchdog only (not in the hot path) |
| pg_background | Background workers for LLM execution |
| pgvector | Vector search — semantic memory |
| plpython3u | Python inside SQL — tools + admin UI |
v0.1.0 — Memory Hive. 30 SQL files, 6 Bees, Knowledge Graph, LLM extraction, 69 smoke tests. 100% vibe-coded.
- Event-driven trigger chain
- Apache AGE graph routing
- Multi-provider LLM (OpenRouter, vLLM, any OpenAI-compatible)
- Tool system (SQL, Python)
- Tier-aware conversation history
- Telegram + Web Chat channels
- Admin dashboard
- Rate limiting
- Docker
- Semantic memory (pgvector embeddings)
- Skill & tool-set management
- Slack channel
- Multi-user
Apache 2.0 — Marcus Meyer, 2026
- 🌐 Website: meclaw.ai
- 📖 Docs: docs/
- 🐛 Issues: GitHub Issues
MeClaw — Your database already knows how to think.
You just haven't asked it yet.