# Build your own CRM with an agent and Supabase

Let an AI agent build a small CRM in your own Supabase project. The five tables, the loop, seven rules, the exact prompt and one step not available yet.

## Summary

A CRM is a set of tables and a way to look at them. That is a job an agent handles well. It writes the schema, fills it with data and builds a dashboard on top. The part it cannot do alone is get the data, which is where looot comes in.

The setup is simple. Your own Supabase project is the memory. looot is the data. The agent connects them. Rows live in your project, and looot keeps none of them.

## Why this works for marketing work

Marketers use agents like Claude Code for research, lists and reports. What goes wrong is that the work disappears into a chat. A table fixes that. Every lead, signal and note has a row, and you can filter, edit and come back next week.

## The five tables

| Table | Holds |
|---|---|
| accounts | Companies: name, domain, industry, size |
| contacts | People: name, title, email, linked to an account |
| signals | Things that happened: a kind, a value, when first seen |
| runs | One row per job: rows added, rows changed |
| notes | Your own notes on an account |

Every table also carries four provenance columns: source, endpoint, cost_usd and fetched_at. When you see a row, you know where it came from, what it cost and how old it is.

## The loop

The agent runs one loop: find, enrich, verify, upsert. It finds accounts, adds contact and company data, checks that emails are deliverable, and writes the result. Upsert means it matches on a natural key such as a domain, so a second run updates rows and does not create copies.

## The seven rules

1. Memory is your Supabase. Rows live in your project.
2. Every row has a source, an endpoint, a cost and a fetch time.
3. Upsert on a natural key. Running the pipeline twice makes no duplicates.
4. Your edits stay. The agent never overwrites a column you edited.
5. Price before any call over one cent. It shows the price and waits for your yes.
6. A daily budget. It stops at the amount you set.
7. A report on every run: rows added, rows changed and total cost.

Rules four to six are the safety rails. They stop the quiet failures: a hand edit lost, a loop that spends all afternoon, a result nobody can trace.

## The prompt

This is the exact prompt from the [build-your-own page](https://looot.ai/build-your-own). Replace the budget placeholder with your own number before you paste it. The first line sets the kind of thing you are building. Swap CRM for signal engine, ad tracker or lead list as needed.

Warning: Step 5 needs scheduled runs, which are not available yet. Until then, ask your agent to run the loop when you want a fresh pass. Alerts are not delivered either, so the agent can only tell you the diff in the chat.

## What to check after the first run

- Open the tables in Supabase and read ten rows. Are the provenance columns filled?
- Run the pipeline again. The row count should not double.
- Edit a column by hand, run again, and confirm your edit survived.
- Read the run report and compare the cost with your budget.

These four checks take ten minutes and catch most problems. If one fails, tell the agent which rule it broke and ask it to fix the pipeline, not just the rows.

## Where to go next

Start with a small job. The [local leads from Google Maps recipe](https://looot.ai/recipes/local-leads-from-google-maps) fits the accounts and contacts tables well. For a signal table, look at [hiring signal watch](https://looot.ai/recipes/hiring-signal-watch). To see how an agent reaches data providers through one connection, read [what is an MCP server](https://looot.ai/blog/what-is-an-mcp-server).

[Open the build kit](https://looot.ai/build-your-own)

## Questions

### Can I build your own CRM with an AI agent?

Yes. Give the agent a Supabase project and looot for data. It creates the tables, fills them through endpoints billed per call and builds a small dashboard.

### What is an AI marketing agent?

An AI marketing agent is an agent such as Claude Code that does marketing tasks: research, lead lists, monitoring and reports. It needs tools and a place to store results to be useful.

### Can I use Claude Code for marketing?

Yes. Claude Code can connect to data through MCP and write to a database. Set a budget and a price check so it does not spend more than you intend.

### Where is the CRM data stored?

In your own Supabase project. looot returns data to your agent and keeps none of your rows.

### Can the CRM update on a schedule?

Not yet. Step 5 of the prompt needs scheduled runs, which are not available. Ask the agent to run the loop when you want a fresh pass.

### Do I need to code to build my own CRM this way?

No. The agent writes the tables and the interface. You review the rows and the dashboard it builds.

## For agents

### Seven-step build prompt

```text
You are building my CRM. Use looot for all data and my Supabase for memory.
1. Setup: set up https://looot.ai/skill.md, then connect my Supabase.
2. Create tables: accounts, contacts, signals, runs, notes. Every row stores source, looot endpoint, cost_usd, fetched_at.
3. Pipeline: find, enrich, verify, upsert. Upsert on a natural key. Never overwrite columns I edited.
4. Before any call that costs more than $0.01, show me the price and wait. Stop at my daily budget of $[X].
5. Watch loop: re-run each signal on a schedule, write only what changed, and tell me the diff.
6. UI: build a small dashboard over these tables (list, filters, row detail, run history).
7. Report each run: rows added, rows changed, total cost.
```
