# maind: a shared brain for your AI agents

maind is free and open source. Your agents read mail, web pages and forms, and they also know your clients and your plans. One line planted in an email can tell an agent to send all of that out. maind splits the work: no agent it runs holds outside text, your private data and a way out together. Nothing goes out until you approve it.

- Code: https://github.com/dave8172/maind (Apache-2.0)
- Install: `uv tool install "maind @ git+https://github.com/dave8172/maind"`
- Video (2 min, captions): a real run, at real speed, dates removed: a planted email is held back, then a reply waits for the owner's OK: https://pub-21da2bddd9cf4685b4374f3e9115db36.r2.dev/maind/maind-demo-3.mp4

## What it does for you

- **Your agents stop working from scratch.** Each one reads the same goal, the same rules and what was decided last week, so you don't explain it all again in every chat.
- **Nothing goes out behind your back.** Every email, payment or form waits as a card. Approve it, decline it, or leave it for later.
- **A trick email can't empty your files.** The agent that reads strangers' mail never holds your client list and a way to send it, so a planted line has nothing to leak.
- **It stays yours.** Plain files on your own machine, your own model plan, and the code is open. Nothing to sign up for.

Rather set it up together? It fits in a trial week: https://quirkyagents.com/first-agent/#week

## What sets it apart

What maind does, and what similar tools do by default, from their own docs (tools change, so check).

- **The split is checked, not suggested.** No agent maind runs holds outside text, your private data and a way out together; `maind check` refuses a setup that would. Elsewhere: one assistant with your apps reads and acts. OpenClaw's docs recommend a separate read-only reader, which you set up (https://docs.openclaw.ai/gateway/security/prompt-injection); Microsoft's FIDES check is optional and experimental (https://learn.microsoft.com/en-us/agent-framework/agents/security).
- **Approval is on from the start.** Every outward action is a card with the exact email or form. Code sends that text once, and refuses if it changed after you approved. Rules you write can let routine mail through. Elsewhere: you turn it on. OpenClaw's command approval is off by default (https://docs.openclaw.ai/tools/exec-approvals); CrewAI's human review is off by default (https://docs.crewai.com/en/concepts/tasks); Microsoft's agents run tools without approval unless you mark them (https://learn.microsoft.com/en-us/agent-framework/concepts/agents/safety).
- **Background jobs, no server.** Hand work over and close the session. One monitor, plain code, starts when a step waits. It waits for free memory, and on systemd each step runs under a hard memory and time limit. After a crash, plans and agent steps run again; an email never goes twice. A real `maind job queue`, trimmed: `running nightly-backup backup.sh`, `queued stock-report stock.sh`, later `queued nightly-backup backup.sh · waiting for free memory`. Elsewhere: LangGraph's scheduled and resumable runs live in its Agent Server, which keeps its data in Postgres and uses Redis (https://docs.langchain.com/langsmith/agent-server). OpenClaw's schedules need its Gateway running; past eight jobs at once, a new one waits for 1 GiB free (https://docs.openclaw.ai/automation/cron-jobs/how-it-works). Design: https://github.com/dave8172/maind/blob/main/DESIGN.md#background-work-jobs-one-monitor-steps
- **A card holds one step, not the run.** A run plans, acts and waits. The part that needs you waits; the rest goes on. When you answer or clear a flag, the run plans again, and your next session tells you what finished. Elsewhere: an approval pauses the run. LangGraph's interrupt suspends the graph until you resume it (https://docs.langchain.com/oss/python/langgraph/interrupts); Microsoft's workflows pause at an approval-required tool (https://learn.microsoft.com/en-us/agent-framework/workflows/human-in-the-loop).
- **One agent's request is never an approval.** Agents ask each other through your own session, and answers come back as data. A change that one agent asks of another waits for you. Elsewhere: agents hand work to each other directly. In Microsoft's handoff, every agent can hand off to every other by default (https://learn.microsoft.com/en-us/agent-framework/workflows/orchestrations/handoff); LangChain's handoffs pass control through tool calls (https://docs.langchain.com/oss/python/langchain/multi-agent).
- **Shared memory with owners.** The brain is files in git. Each section has one owner, and every write is checked: the right owner, the right shape, no planted text. Your rules and verdicts stay yours. Elsewhere: Letta's memory blocks are read-write by default, and its agents edit their own memory through tools (https://docs.letta.com/guides/agents/memory-blocks).
- **Learning can't widen permissions.** A routine rewrites its playbook after each run, from a checked digest, never from raw pages. Lessons never grant permissions. A new standing rule comes only as a card you approve; decline it, and it is never offered again. Elsewhere: in LangGraph, agents can change their own prompts as they learn (https://docs.langchain.com/oss/python/langgraph/memory); Letta's agents edit their own memory.

## What you can use it for

Real runs at Acme Invoicing, a made-up company (https://quirkyagents.com/world/), with the waits cut (videos: https://pub-21da2bddd9cf4685b4374f3e9115db36.r2.dev/maind/maind-acme-hiring.mp4, maind-acme-pay.mp4, maind-acme-sales.mp4, maind-acme-support.mp4 in the same folder).

- **Hiring an engineer.** Goal: hire a backend engineer, and share only what the job ad says. Install, then tell your assistant "start using maind": it asks Acme's goal, how progress is tracked and what must never happen, shows a design (a mail reader and five teams), and writes nothing until you say yes. A candidate asks for the salary range; People answers from its own files: the range in the job ad, not anyone's own salary. Stopped: a fake recruiter whose email told the AI to send the team's salaries and the lowest offer; no agent read it. Waited for you: the reply, sent only after approval.
- **Paying a supplier.** Mail reader and Accounts. An email says Printwell changed its bank and asks for payment today; the reader flags a lookalike domain and stops, and Accounts says the account on file ends in 3301, not 9930: don't pay. Stopped: an email that told the AI to send the customer list; no payment was made. Waited for you: one task, phoning Printwell on the number on file. The price of caution: a customer's reply waits until you clear the reader.
- **Answering a paying customer.** Mail reader and Sales. Tom at Bright Labs asks to pay monthly from the August renewal; Sales drafts a short reply. Stopped: an email that told the AI to forward the customer list. Waited for you: the reply, and a change to the renewals requested in another agent's name.
- **Answering what's coming.** Mail reader, Support (drafts replies) and Product (keeps the roadmap). A customer asks if bank matching is coming; Product says what may be said. Stopped: an email that told the AI to send the roadmap and upcoming price changes. Waited for you: the reply, which promises no date.

## How it differs from similar tools

From each tool's own documentation; tools change, so check.

- **One assistant with your apps connected (ChatGPT, Claude):** good for starting in minutes. ChatGPT approves low-risk actions itself by default (https://help.openai.com/en/articles/20001495-managing-app-permissions-in-chatgpt); Claude asks for each Google action outside Auto mode (https://support.claude.com/en/articles/10166901-use-google-workspace-connectors). The same assistant reads and acts.
- **An always-on personal agent (OpenClaw):** approval for commands is off by default (https://docs.openclaw.ai/tools/exec-approvals), message-tool agents can send by default (https://docs.openclaw.ai/gateway/security/tool-permissions). Its docs recommend a separate read-only reader (https://docs.openclaw.ai/gateway/security/prompt-injection); you set it up.
- **A framework for developers (CrewAI, LangGraph, Microsoft Agent Framework):** you add approvals (https://docs.crewai.com/en/concepts/tasks, https://docs.langchain.com/oss/python/langchain/human-in-the-loop, https://learn.microsoft.com/en-us/agent-framework/concepts/agents/safety). The closest check is Microsoft's FIDES, optional and experimental (https://learn.microsoft.com/en-us/agent-framework/agents/security).
- **Shared memory for agents (Mem0, Letta):** agents that share what they know (https://docs.letta.com/concepts/shared-memory/index.md).
- **maind:** several agents on your own work, over months. Every outward action waits for you, or a rule you wrote. Checked before anything runs: no agent it runs holds outside text, private data and a way out together. Pick something else if you want a phone app: it is a beta, runs on Linux from a command line, and needs your own mail tool.

## Why split agents up

An AI agent turns risky when three things meet in it: it reads text from outside, it holds private data, and it has a way out. With all three, one planted line can send your data out. Simon Willison named this the lethal trifecta (https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/). No agent that maind runs gets all three, and `maind check` refuses a setup that does.

| Agent | Outside text | Private data | A way out |
|---|---|---|---|
| One agent for everything (a common setup) | yes | yes | yes |
| Mail reader | your inbox | your inbox | none |
| Web reader | web pages | none | web requests |
| Sales department | reports only | customers, renewals | none |

## One job each

- **Reader:** one source: mail, the web, forms, or one MCP server. It uses read tools and writes its own report. It sees only sections marked open (a mail reader also sees your mail).
- **Department:** one function: sales, research, marketing. Its own notes and lists, and the readers' reports. No web, mail or outside tools.
- **Door:** code, not a model: send mail, fill a form, post. Runs the exact text you approved, once.
- **You:** set the rules; approve or decline each card. Your own session (the orchestrator) asks the agents and passes answers on.

## One email, start to finish

1. An email arrives. A trusted tool saves it, and each file is scanned first.
2. The mail reader reads it and writes a short report.
3. Sales reads the report, not the email, and drafts a reply.
4. maind checks the draft and puts it on a card.
5. You see the exact email. Approve or decline.
6. The mail door sends that text, once. If it changed after you approved, it refuses.

The card from the recorded run:

```
~/acme $ maind show a-…-e223
approval card · a-…-e223 · reply email · pending
by:    sales
to:    tom@brightlabs.example (from sales@acme-invoicing.example)
why:   Tom, a paying customer, asked about moving to monthly billing; this acknowledges it while the details are checked.
--- exactly what happens ---
Subject: Re: Moving to monthly billing

Hi Tom,

Thanks for your message. I've noted that you'd like Bright Labs to pay monthly for the Team plan from your next renewal, rather than yearly.

I want to check exactly what changes with monthly billing, and whether there is anything you need to do before the renewal. I'll come back to you once I've confirmed both.

Best regards,
Acme Invoicing sales team
--- end ---
note:  checks passed · sha 1b2212706ecc
choose: maind approve | later | decline | never a-…-e223 [comment]
```

Routine replies can go under a **standing rule** you write: known people, a daily cap. Mail with money, a commitment or a new recipient still gets a card.

## The brain is files with owners

The brain is files in git. Each file has one owner, and each agent sees its own slice (from the example brain: https://github.com/dave8172/maind/blob/main/templates/brain.example.toml):

| File | What | Owner | Read by (agents) |
|---|---|---|---|
| CORE.md | purpose, values | you | every agent |
| CLAUDE.md, maind/ | rules, charters, manifest | you | each agent gets its own charter |
| PLAN.md, decisions/ | plan, verdicts | your session | none of the other agents |
| sales/RULES.md | what sales must not do | you | sales |
| sales/brief.md | what you offer, to whom | your session | sales |
| sales/pipeline.md and notes | sales notes | sales | sales |
| sales/data/crm.sqlite | contacts, as a table | sales | sales |
| reports/questions.md | what to look up | your session | web reader |
| reports/scout/ | web findings | web reader | web reader, sales |
| reports/forms/ | form findings | form reader | form reader, sales |
| mail/inbox/ | raw mail | your session | mail reader |
| mail/reports/ | mail summaries | mail reader | mail reader, sales |

## Shared context, and its own

Every agent loads the same short core. Then each gets its own charter and an index of what it may read (about 1,100 to 1,400 tokens each in Acme's brain), and pulls a section when the task needs it. In a small test, loading other teams' notes by default cost about 60% more per task: https://github.com/dave8172/maind/tree/main/evidence/brain-vs-board

## How agents talk

Agents don't message each other directly: your session passes the question on. maind checks the answer, which comes back as data. A change that another agent asks for is held until you approve it: one agent's request is never an approval. In the recorded run Sales proposed the change to the renewals, and maind held it for the owner.

## The check on every reply

An agent's only output is a typed reply. Before it is saved: its shape, who may write where, a scan for planted text, and, if you set one, a second model that can only warn. Planted text in a new file: the agent never sees the file. In what the agent read or wrote: the agent stops until you clear it.

## Skills that keep it current

- **update-maind**, at the end of a session: each fact goes to the file and the owner it belongs to. New: one dated line. Update: the old line is replaced. Duplicate: skipped. Contradicts a verdict: raised to you.
- **dream-maind**, now and then: each owner prunes its own section (stale and duplicate lines). Verdicts and your rules stay, removals wait for you, and git keeps the old text.

## Start

```
uv tool install "maind @ git+https://github.com/dave8172/maind"
```

Then, in your project folder, tell your coding assistant: **start using maind**. It asks your goal, how you measure progress, the lists you keep and your hard rules. It shows you a design, builds it, and ends with a first run and a first action you approve. Claude Code users link the skills that come with it first; the README has the line.

Agents run one of two ways: on your own Claude Code and Claude plan, or through Pydantic AI with any model it supports, on your own key, with a budget per agent.

## Tested

- **Offline:** the whole suite runs with a stand-in model. Every line of the code that assigns roles, runs doors and applies standing rules is covered by tests.
- **Live:** one real brain in daily use, on Claude Code. On an OpenAI model through Pydantic AI, three runs: one was stopped by a false alarm in the scan (since fixed), one failed on an invalid reply, one came back clean.
- **Jobs:** live on a 2 GB machine. Two jobs ran side by side, and one job's second step waited for its first. A step waited for free memory. With hardening on, a step's write to /etc failed. A step over its memory limit was stopped alone (on the queue code before jobs, which runs steps the same way). The run and routine items under "What sets it apart" are examples, not recordings.
- **Shown on the page:** real runs on demo brains with Claude Code. Their mail doors write to a folder instead of sending. The questions between agents were typed in by the person running the demo. The app demo's first run was stopped by a false alarm from the judge; the run shown came after the judge's wording was fixed.

## What it can't do

- **The scan and the judge are filters.** New wordings get past them. The split and the doors are the boundary; the card is where you catch the rest.
- **Your own session is yours.** maind doesn't run it: it has your tools, under your assistant's permissions.
- **It's a beta.** The manifest format may change. Tested on Linux; macOS should work but is untested; not Windows.
- **Bring your own mail tool.** A mail door is any tool with maind's check-and-send contract. A Gmail and Outlook door is planned.
- **One owner per brain.** No team roles yet.

## Questions

**What is maind?** A shared brain for AI agents: your plan, notes and lists as files in git, with one owner per section and a typed check on everything an agent writes. Agents that read the outside, agents that decide and code that acts are kept apart, and every outward action waits for your OK.

**Does maind stop prompt injection?** It doesn't make an agent immune. It limits what a misled agent can reach and do: the agent that reads your mail has no way to send anything, the agent that reads the web holds none of your private data, the agents that know your business only read reports, and anything outward waits for you. A scan, and a judge model if you turn it on, also look for planted text. Found in a new file, that file is kept from the agent; found in what the agent read or wrote, the agent stops until you clear it.

**Which models does it run?** Two ways. Your own Claude Code, on your Claude plan. Or Pydantic AI, with any model it supports (Anthropic, OpenAI, Google, Mistral, Groq, OpenRouter, a local model through Ollama) on your own key, with a budget per agent.

**What does it cost?** maind is free (Apache-2.0). Runs cost what your model costs: on a Claude plan through Claude Code, nothing beyond the plan and its usage limits; on an API key, per token, within the budgets you set.

**Can routine mail go without a card each time?** Yes, if you write a standing rule in the manifest: replies and follow-ups to people you already approved mail to, under a daily cap. Mail with money, a commitment, a new recipient or another agent's request still gets a card. Without rules, every outward action is a card.

**How is it different from firstwatch?** firstwatch watches what one agent reads and makes it ask before risky actions. maind arranges many agents so that no one of them holds outside text, private data and a way out together. They work well side by side.

Design: https://github.com/dave8172/maind/blob/main/DESIGN.md
