databasedmcp gives your AI assistant databases it keeps between conversations, so everything in this article works from the day you connect it. Free to start, no card.
Get started freeWhat goes wrong with two agents
You open a second terminal so two agents can work at once. Both read the same issue list and start on the same bug. One rewrites a file the other is halfway through. Neither knows the other decided last hour that the API stays on v1. You spend the saved time merging.
The agents aren't the problem. They have nowhere to say "I've got this one" that the other will see before it starts. A shared task board fixes that, as long as taking a task is a single write that only one agent can win.
One board for every agent
databasedmcp's project template gives a repo a task board and a memory in one SQLite database. Every agent on your account, in any MCP client, reads and writes the same rows. In Claude Code, connect databasedmcp and run the slash command it adds:
/mcp__databased__project
It creates the database, reads its guide, and offers to add a line to CLAUDE.md so every later session starts from the board. The guide teaches each agent the rules below, so you don't have to.
Claiming is one statement
An agent ready for work takes the highest-priority ready task in one UPDATE:
UPDATE tasks SET status = 'doing', owner = ?, lease_until = datetime('now', '+15 minutes'), attempts = attempts + 1, updated_at = datetime('now')
WHERE id = (SELECT id FROM ready_tasks ORDER BY priority, id LIMIT 1)
RETURNING id, title, body, land, (SELECT group_concat(p.id || ': ' || p.result, char(10)) FROM json_each(tasks.needs) n JOIN tasks p ON p.id = n.value) AS inputs
It runs with expect_changes: 1. If another agent claimed the same task a moment earlier, the WHERE no longer matches, nothing changes, and the call fails with [conflict]. The losing agent claims the next one instead. Reading the board and writing to it happen in one step, so there's nothing to race.
"Ready" is a view, ready_tasks: a task that's to do (or whose claim has lapsed), whose dependencies are done, that hasn't failed three times, and whose files nobody else is writing.
Leases, so a crashed agent lets go
A claim lasts 15 minutes. An agent that's still working past 10 renews it:
UPDATE tasks SET lease_until = datetime('now', '+15 minutes') WHERE id = ? AND owner = ? AND status = 'doing'
If the agent crashes or you close its terminal, the lease runs out and the task goes back on the board for the next agent. Times come from the server's clock, so no agent's laptop clock can extend a claim by accident.
Land: the files a task writes
Each task lists the paths it will change, its land. Directories end in a slash:
INSERT INTO tasks (title, body, needs, land) VALUES (?, ?, '[3]', '["src/web/", "src/sql.ts"]')
While one task is being worked on, no other task whose land overlaps it counts as ready, and an agent that tries to start one anyway gets [land_conflict]. src/web/ and src/web/styles.ts overlap; src/web/ and src/sql.ts don't. Two agents can work side by side while they're in different parts of the tree.
Finish with something the next agent can use
Done means writing a result: what changed, which files, the commit, the tests, and anything surprising.
UPDATE tasks SET status = 'done', result = ?, lease_until = NULL, updated_at = datetime('now') WHERE id = ? AND owner = ? AND status = 'doing'
A task that depended on this one gets that result handed to it when it's claimed, in the inputs column of the claim above. The agent building on your migration reads what the migration agent wrote, not your summary of it.
Copy this prompt to set it up
Paste this into the first agent. Start the others with "Join the project board in databasedmcp and claim a task."
Set up a shared task board for this repo in databasedmcp, from the project template, named <owner>-<repo> from git remote get-url origin (lowercase, hyphens). 1. Read its guide with get_database and follow it from now on. 2. Add a line to CLAUDE.md (and AGENTS.md if there is one): "Shared memory: databasedmcp database `<name>` (project template). Run get_database on it at the start of every session and follow its guide: claim tasks before working on them." 3. Break the work I describe next into tasks of an hour or less, each with the paths it will write as its land and the tasks it needs first. 4. Show me the board, then claim the first ready task and start.
Give each agent its own git worktree or checkout, so their uncommitted changes don't mix. Land keeps them out of each other's files.
What it doesn't do
databasedmcp doesn't start agents, merge branches or watch your files. The database enforces the claim and the land check. The rest is a protocol the agents follow from the guide, and an agent that never claims a task can still edit anything. databasedmcp itself is built this way, by Claude Code sessions sharing one project board. The CLAUDE.md line and the guide keep them on it. Open the board on the website to see who holds what.