--- title: "Build your company brain with one prompt" description: "An AI agent agency builds a company brain for each client on past.dev. Their setup, what to watch out for, and one prompt that builds yours." canonical: https://past.dev/blog/company-brain-one-prompt date: 2026-11-25 last-updated: 2026-11-25 category: Engineering authors: Louis Tissot --- # Build your company brain with one prompt One of our customers is a small agency that runs AI agents for other companies. One agent answers a client's inbound email. Another one keeps projects on track. A person checks every draft before it goes out. Agents like these have one big problem: the company's knowledge is everywhere, and nothing keeps it in order. Ask one "What did we promise this customer last week?", and it searches the email, the Slack, the documents and the call notes. It reads hundreds of messages, burns through tokens, and then answers from an old email that's no longer true. The right answer was there, of course. The agent just had no way to tell which version was the current one. So they built each client a company brain: one memory, made from the client's email, calls and Slack, that stays up to date. Then they did it again for the next client, with the same setup. In their first month, they sent more than 10,000 records into past.dev for two clients and their own company. We think every company will want one of these. So in this post, we show you their setup, what to watch out for, and a prompt that builds the same thing for your company. **Short on time?** Jump to the prompt in the last section. Paste it into Claude Code, Codex or Cursor. It asks about your tools and your privacy rules, then builds the brain with you. You don't even need a past.dev account to start. ## The setup in one picture ![Diagram: email, calls and Slack go into one past.dev project for each client, with an audience for each thread and chat. The agent recalls as the person who asks.](/blog/agent-agency/setup.png) There are four parts. Each client gets its own project. Email, calls and Slack go in, the history first and then every day. Each record keeps the same permissions it had in the tool. And when someone asks an agent a question, the agent searches the brain as that person. ## One project for each client A project in past.dev is a separate brain, with its own key. Nothing crosses between projects. So two clients can never see each other's mail, even when the agents run the same code for both. The agency started with a project for its own company, as a test. Then it added one project for each client. A new client is now a short script: create a project, create its key, and run the same import as before. ## Email, calls and Slack The agency sends three kinds of records: - **Email:** one record for each message, with the sender, the people on it and the date at the top. - **Calls:** one record for each recording, with one line for each person who speaks. - **Slack:** one record for each channel and day. They imported each client's history first. Old records keep their real dates, so a decision from August is still a decision from August. After that, a daily job sends what's new. When a message changes, the job sends it again with the same id, and the old version is replaced. Want to connect a tool without writing code? You can. past.dev also takes records from [webhooks](/docs/memory-api/webhooks), [Zapier](/integrations/zapier), [n8n](/integrations/n8n) and [22 agent frameworks](/integrations). This agency uses the API for everything, which gives the most control. ## The same permissions as in the tools This is the part we like most. The agency didn't design any roles. They copy the permissions that the client already has: - Each email thread gets its own group, with the people who were on the thread. - Public Slack channels go to one group with the whole staff. - Each private Slack chat gets a group with its members. In past.dev, these groups are called audiences. After their first month, the agency had more than 150 of them. Every record goes in with its audience, and nothing goes in without one. So when someone at the client asks an agent a question, the agent searches the brain as that person, and only gets back what that person could already read. In their biggest client, one person can read less than 5% of the records. Others can read about a quarter to a third. So the filtering happens in past.dev instead of in the agents. That's a part of the code that the agency doesn't have to build for each client. ## A brain that stays up to date Here's where a brain is different from a search index. Say a supplier writes "delivery on the 12th" in one email. A week later, another email says "delivery moved to the 19th". A plain search finds both emails, and the model has to guess. past.dev keeps the 19th as the current date, and keeps the 12th as the old value. It also marks the difference between a promise and an idea: "Maybe we can ship on Friday" is saved as an idea instead of a promise. And a fact from a private thread stays private, even when it's combined with facts from public channels. ## The numbers We didn't measure accuracy on their mail: nobody has an answer key for a client's real inbox. But their clients have a lot of history, several million tokens of text each, up to about 11 million by our count. That's exactly the size of BEAM, the biggest public benchmark for agent memory: - **Right answers at 10 million tokens:** past.dev gets 85%. A standard RAG gets about 1 in 4. The next best published memory gets 73%. - **Questions about what changed:** past.dev gets 92.5%. The best RAG in the BEAM paper gets 37.5%. - **Tokens:** each answer reads at most 8,000 tokens of evidence, about a tenth of a percent of the history. It doesn't grow when the history grows. And the bill is small. The two imports cost about 200,000 credits together, one time. After that, the daily sync for all three companies uses a bit more than a quarter of the credits included in our $99 Flex plan. ## Things to watch out for - **Company-wide Gmail needs your Google admin.** To read every mailbox in the company, a Google Workspace admin has to give one read-only account access. Plan for that conversation. - **A Slack app only sees the channels it's in.** Reading every private chat needs special approval from Slack. - **Projects depend on your plan.** Flex includes 5 projects. With more clients, use Enterprise, or one project with one audience for each client. - **Always set the audience.** A record without one is visible to everyone in the project. ## Build your company brain with one prompt We turned all of this into one prompt. Paste it into Claude Code, Codex or Cursor. It works in five steps, and it stops for your OK after each one: 1. **It asks you questions:** which tools you use, how to connect them, who can read what, and how your team will use the brain. 2. **It writes a plan** for you to approve. 3. **It builds the brain.** With no account, it creates a test project for you, and you claim it later by signing in. 4. **It gives your team access,** through your own agents or from Claude and other assistants. 5. **It tests everything** and writes a short runbook. ```text You are my engineer for this project. Together we will build a company brain on past.dev: one memory that stays up to date, built from our tools, where each person only gets answers from what they could already read. It can be for my own company, or one brain for each of my clients. Work in five phases. Don't skip a phase, and don't start the next phase before I approve the current one. GROUND RULES * Read the docs before you design anything: https://past.dev/llms.txt, https://past.dev/docs/memory-api/setup/llms.txt, https://past.dev/docs/memory-api/access-control/llms.txt and https://past.dev/docs/memory-api/sending-data/llms.txt. If you can add MCP servers, add the past.dev docs server at https://past.dev/mcp. Check every endpoint and field in the docs or in https://past.dev/openapi.json before you use it. Never guess a field. * Every data point gets an audience. A data point without one is visible to the whole project, and a re-send without one becomes visible to the whole project. * The identity on a recall comes from the signed-in user in code. A model never chooses it. * Keys live in environment variables or a secret manager, never in code, logs, prompts or this chat: one PAST_API_KEY per project, and PAST_MANAGEMENT_KEY for projects and keys. Never print a key and never ask me to paste one here. Only check whether a variable is set. * Start small. Test each source on a small slice before the full import. Ask me before a large import, a deletion, or anything that is hard to undo. * Send only what the brain needs. If nobody should read it, don't send it. HOW TO ASK ME * If you have a tool that asks me questions with choices to click (AskUserQuestion in Claude Code, or the same kind of tool in another agent), use it for every question and every approval in this project. Write what I must read first as text, then call the tool. * Give each question 2 to 4 choices. Each choice is a short label plus one line that says what it means for the project. Put the choice you recommend first and mark it "(Recommended)". Don't add an "Other" choice: I can always type my own answer. * Build the choices from what you already know about me: this folder, my tools, my earlier answers. Offer my real options instead of a generic list. Skip a question that is already answered. * Ask up to 4 questions in one round, then wait for my answers. Where more than one choice can be true (sources, tools, who uses the brain), let me pick several. * An approval is a question too: "Approve" first, then "Change something". * A question that needs my own words (the example questions, names, volumes) is plain text. Give an example of a good answer. * With no such tool, write each question as a numbered item with lettered choices, your recommendation first, so that I can answer "1a 2c". MY PAST.DEV ACCOUNT I don't need a past.dev account to start. Before phase 1, check what exists, and don't print any value: * A key: PAST_API_KEY in my environment or in an env file of this folder (.env, .env.local). If it is set, I have a project: use it, and go to phase 1. * A project that waits for its claim: .past/claim.json in this folder. If it is there, run `npx -y past-dev@latest status`, tell me its deletion date, and continue with that project on the "No account" path below. * The past.dev tools (get_viewer), if my past.dev account is connected to you. If you have them, I have an account: follow the "An account" path below. If you find none of them, ask me one question: do I have a past.dev account? The choices are "No, create a project for me (Recommended)" and "Yes, I have an account". Say in the first choice that it is for a person who never signed up to past.dev. * No account: don't send me to a sign-up page. In phase 3 you create the project yourself with the past-dev CLI, and I claim it later by signing in. Read https://past.dev/SKILL.md now, in full, for the CLI, the key and the claim. Its "Rules" section and its steps 1 and 4 apply. This prompt replaces its checklist and its steps 2 and 3. Where it sends you to another setup page, come back to the "An account" path here. * An account: in phase 3, I create a project key in the console at https://app.past.dev, on the API keys screen, and I put it in the .env file as PAST_API_KEY myself. Tell me so now, and start phase 1 without waiting for the key. PHASE 1: DISCOVERY Interview me the way HOW TO ASK ME says: a few questions per round, suggested answers on each one, your recommendation first. Wait for my answers before the next round. Cover all of these: 1. Scope. One company or several clients? How many? Do clients ever share memory? Recommend one project per client when clients must never share anything (Flex includes 5 projects, Enterprise is unlimited), or one project with one audience per client when the plan or the volume makes projects impractical. Explain the trade-off: with projects, a leaked key reaches one client only. A project that you create for me starts like a new Pay as you go account, which holds one project, so more projects wait until I claim it and move to Flex or Enterprise. 2. Use. Which agents or people will ask the brain, and which questions must it answer? Ask for 5 real example questions, which I type myself. We use them as tests in phase 5. 3. Sources. List every tool: email (Gmail, Outlook), chat (Slack, Teams), meetings (recorder or transcripts), documents (Drive, Notion, Confluence), CRM, tickets, others. For each one, ask: the volume, how much history to import, who owns the admin access, and the rate limits of its API. 4. What goes into memory, and what stays live. Conversations, decisions, notes and documents that change over time go into past.dev. Data that a system of record already holds exactly (database rows, current CRM fields, stock levels) is often better read live by the agent with its own tools. Decide this for each source. 5. Connection, for each source. Choose one: our own code with the REST API (best for history imports and full control), past.dev webhooks for a tool that posts JSON when something happens (Flex and Enterprise; you map content, id, time and audience with JSON paths), the past.dev app on Zapier, the past.dev node for n8n, or a framework integration from https://past.dev/integrations. Recommend one for each source and give the reason. 6. Privacy. For each source, where do its permissions come from: email thread participants, channel members, folder sharing, CRM owner or team? Which content must stay out completely (HR, legal, health, personal messages, passwords)? Which few facts may be visible to everyone in the project? How do we handle a person who leaves, and a request to delete data? 7. Identities. Which key identifies a person in every source (I recommend the work email)? Which traits do we need for rule audiences (team, company, role)? Where do the people come from: an HR list, the identity provider, the tools themselves? 8. Access for employees. How will people use the brain: through our own agents, from their own assistant (Claude, Cursor and other MCP clients) through the past.dev end-user MCP server, or both? Which identity provider do we use (Microsoft Entra ID, Okta, Google Workspace, JumpCloud, OneLogin, or another OpenID Connect provider on request)? Can people save their own notes to the brain (the write toggle)? 9. Freshness. How fast must each source update: in real time (webhook), hourly, or daily? How do edits and deletions in the source reach past.dev? 10. Budget. Estimate the import and the monthly volume per source. Ingestion costs one credit for each 350 bytes of content. Recalls are included on Flex and Enterprise within fair use. Propose monthly caps for each project. PHASE 2: PLAN Write brain-plan.md and ask me to approve it. It contains: * the projects, and the reason for each one * the account: mine, or an unclaimed project that you create, and what waits for my claim (the full import, more projects, the management key, webhooks, the MCP server). For an unclaimed project, say whether it becomes the first real project after the claim or stays the test project. * where each project's key lives: its own variable or secret, by name * a table of sources: source, connection method, data point unit, id scheme, timestamp field, audience rule, sync frequency, history window, estimated size and credits * the identities, traits and audiences, with how each audience is created and kept up to date * what stays out of memory, and what agents read live * how employees get access, and the identity provider setup * the test plan, with the example questions from phase 1 * the operations plan: schedules, monitoring, offboarding, deletion, caps Cut each source the way the docs say: email = one data point for each message, timed at the Date header; calls = one data point for each recording, one line for each speaker turn, timed at the start of the call; chat = one data point for each channel and day; documents and records = one data point each. Each data point has a stable id from the source (no "/"), an ISO 8601 timestamp in UTC, a label and its audience. A correction uses the same id. A new event uses a new id. PHASE 3: BUILD Build in this order and show me the result of each step. Go on to the next step without waiting, except where a step says to wait for me: 1. The first project and its key. Start with a test project. * No account: the project that you create is the test project. Tell me in one line that it falls under https://past.dev/terms and https://past.dev/privacy, then run `npx -y past-dev@latest init` from this project's folder, never from my home folder. It creates an unclaimed past.dev project and writes its key into the env file as PAST_API_KEY, so neither of us handles the key. Tell me where the key went and the deletion date that it prints. The project works at once, like a new Pay as you go account with the credits a sign-up gets. It is deleted with everything in it 7 days after it was made, unless I claim it. Create it now and not earlier, so that the 7 days are not spent on the plan. The package is past-dev: never run `npx past`, which belongs to someone else. * An account: open the API keys screen of the console for me and wait until I say that PAST_API_KEY is in the .env file. For more projects, use the management API (POST /api/v1/projects, then POST /api/v1/projects/{slug}/keys) with PAST_MANAGEMENT_KEY. Write each key that the API returns straight to the place the plan names, and never print it. 2. Identities and traits with POST /api/v1/identities/bulk (up to 1,000 per call). 3. Audiences with PUT /api/v1/audiences/{slug}: fixed lists copied from the source permissions, and rule audiences on traits for teams and companies. Create each audience before any data point that names it. 4. One connector per source, in the order of the plan. First send one small slice (for example one week) and check it with a recall. While the project is unclaimed, stay on small slices: no full import and no sync that runs by itself. 5. The claim, when the project is unclaimed and the slice of the first source passes its recall check. Tell me in two lines what works, with the deletion date. Then run `npx -y past-dev@latest claim`. It opens the claim page in my browser: I sign in or sign up and approve, and the command finishes by itself. If it says that it still waits, run it again, three times at most, then stop and wait for me. If the page shows me a code, I give it to you and you run `npx -y past-dev@latest claim --code `. Never open the claim page in a browser that you control, never sign in for me, and never use a code that I did not give you here. After the claim, show me the partly hidden address that now owns the project and ask me to confirm that it is mine. Then set up what waited for the claim, as the plan needs it: I move to Flex or Enterprise in the console for more than one project or for webhooks, I create the management key in the console and put it in the env file as PAST_MANAGEMENT_KEY myself, and you create the other projects and their keys with the management API, each key written straight to the place the plan names. If the claim says that my account already has a past.dev organization, run `npx -y past-dev@latest abandon`, continue on the "An account" path with a key from my console, and send the slice again. Before the claim, a 402 answer with the code claim-required means that the call waits for it. If I don't claim now, end each of your messages with: "This project and everything in it are deleted on unless you claim it: run npx -y past-dev@latest claim." 6. The full import for each source, after my yes: oldest first with POST /api/v1/ingest/batch (up to 1,000 data points and 16 MiB per call, one idempotencyKey per batch). Keep every ingestionId and poll GET /api/v1/ingest/{ingestionId} until the status is completed. Retry a failed send with POST /api/v1/ingest/{ingestionId}/retry. 7. The sync for each source: a scheduled job, webhooks, or the Zapier or n8n flow. Handle edits (same id, new content, same audience), deletions (DELETE /api/v1/data-points/{sourceId}) and permission changes (update the audience or the identity's traits). 8. The recall layer for our agents: POST /api/v1/recall with the identity of the signed-in user. Add occurredFrom for questions about recent events. Retry a 429 after a pause and a 5xx with the same idempotencyKey. PHASE 4: ACCESS FOR EMPLOYEES Set up the access we chose in phase 1. The MCP server needs a claimed project, so do the claim of phase 3 first if it is still open. * Our own agents: they call our recall layer, never past.dev directly with a key that the model can see. * Their own assistant: on each project, open Build > MCP server in the past.dev console, connect our identity provider, enable the server, decide who may use it (everyone the provider signs in, or a rule over traits), and set the write toggle. Give employees the address https://api.past.dev/mcp/ and short install steps for their client. Each person signs in with their usual account and recalls only what their identity can read. Use directory sync if audiences must be ready before people sign in. * Bots and services without a browser: use an access link for one identity, and treat the link as a secret. Write a one-page guide for employees: how to connect, what the brain knows, and what it doesn't know. PHASE 5: TESTS AND OPERATIONS Run these tests and show me the results: * Permissions: recall the same question as two people with different access, and show that the sourceIds differ. Recall as a person outside an audience, and show that its data points don't come back. Check reach with GET /api/v1/identities/{identity}. * Freshness: send a fact, then a newer fact about the same thing with a new id. The recall must give the newer value, with both dates. * Correction and deletion: correct a data point with the same id, then delete it, and show that recall changes at once. * Quality: run the 5 example questions from phase 1 and show the answers with their sources. * Cost: compare the credits used with the estimate in the plan. Then write RUNBOOK.md: how to add a client, a source or a person; how to offboard a person; how to handle a deletion request; how to read errors on the Requests screen of the console; how to change caps. List anything still open, and the claim first if the project is still unclaimed. ``` ## The API calls For the developers who want to see it, here's the agency's whole loop in four calls: a project, an audience, a record, and a question asked as one person. **Call 1: one project per client (management key).** ```bash curl -X POST https://api.past.dev/api/v1/projects \ -H "Authorization: Bearer $PAST_MANAGEMENT_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Client name" }' ``` **Call 2: one audience per email thread, with the people on it.** ```bash curl -X PUT https://api.past.dev/api/v1/audiences/thread-8f3a21 \ -H "Authorization: Bearer $PAST_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "fixed", "identities": ["staff-1", "staff-2", "staff-7"] }' ``` **Call 3: each email goes in with its audience.** ```bash curl -X POST https://api.past.dev/api/v1/ingest/batch \ -H "Authorization: Bearer $PAST_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "idempotencyKey": "mail-2026-11-09-01", "items": [{ "id": "email:thread-8f3a21:msg-4", "content": "From: ... To: ... Subject: Re: order delay ...", "timestamp": "2026-11-09T14:12:00Z", "label": "Re: order delay", "audience": "thread-8f3a21" }] }' ``` **Call 4: the agent asks as the person who asked it.** ```bash curl -X POST https://api.past.dev/api/v1/recall \ -H "Authorization: Bearer $PAST_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "What did we promise the customer about the late order?", "identity": "staff-1", "occurredFrom": "2026-11-01T00:00:00Z" }' ``` The [setup guide](/docs/memory-api/setup) has every step, and [Sending data](/docs/memory-api/sending-data) shows how to cut each tool into records. Thanks to the agency for building with past.dev. If you build a company brain with the prompt, [get started here](https://sso.past.dev/sign-up) and tell us how it goes.