What You’ll Build
Your Granola calls, your Linear issues and your Gmail inbox go into one cognee memory. After your latest call, an agent lists the next steps everyone agreed to and fills in what the call left out from everything else it remembers. It posts the list to a Slack channel, or prints it when Slack is not set up. Building the memory takes threecognee.remember calls, one per source, and working out the next steps takes three cognee.recall calls.
The complete cookbook is
examples/cookbooks/company_brain/follow_up_agent/.
Try It on Sample Data
Two days ago, on a launch-readiness call, Omar agreed to move card payments to 3DS2, Sam to load-test the checkout API, and Lena to write the announcement. The call names no team and no deadline. An earlier call says which team each person is on, Linear already tracks Omar’s step as PAY-104, and an email from the bank sets the 3DS2 deadline. You need only an LLM key, no Granola, Linear, Gmail or Slack account. A sample run never posts to Slack.LLM_API_KEY alone is enough for OpenAI, cognee’s default for both the LLM and the embeddings. Other providers, such as Anthropic, Gemini, Azure OpenAI, AWS Bedrock or a local model through Ollama, need a few more lines in the same .env: LLM Providers and Embedding Providers list them for each provider. Set both, because embeddings you leave at the default still need an OpenAI key.
- Terminal
- Coding agent
[clear] Forgot the dataset follow_up_agent instead. The sample is dated relative to today, so your dates and wording will differ.
Run It on Your Data
Granola is required. Linear and Gmail are optional sources: without one, its step is skipped. Slack is optional too: without it, the steps are printed instead of posted. Set up each one you use:- Granola
- Linear
- Gmail
- Slack
The cookbook reads your calls through Granola’s API with a personal API key. Creating one needs a Granola Business plan; on Enterprise, a workspace admin enables it first.
- In the Granola desktop app, open Settings → Connectors → API keys and click Create new key.
- Choose the Personal notes scope and click Generate API Key. Copy the key now; Granola shows it only once.
- Add it to
.envat the repo root:GRANOLA_API_KEY="grn_...".
credentials.jsonandtoken.jsonare git-ignored. Never commit them.
--check reports what is missing and which optional sources are skipped, without doing any work. The first Gmail run opens a browser so you can let it read your mail. Running it again skips content cognee already holds; add --clear to forget the dataset first and start over from your sources as they are now. Each script also runs alone, for example uv run python examples/cookbooks/company_brain/follow_up_agent/scripts/follow_up.py.
How It Works
Step 1: Start From an Empty Memory
Source:scripts/clear.py
This step forgets what an earlier run remembered, so old copies never mix with new ones. It runs only with --clear, which a sample run turns on by default; --no-clear keeps the dataset.
cognee.forget(dataset="follow_up_agent"), which deletes the dataset and everything extracted from it. On your own data, use --clear only to start over.
Step 2: Remember Your Calls
Source:scripts/ingest_granola.py
This step saves your recent calls so the agent knows who works on what. It reads the calls from the last 30 days; pass --days N to change that.
args.sample, it reads the sample calls instead; every ingest step works this way. cognee’s part is one call: cognee.remember, into the dataset follow_up_agent with node_set=["calls"]. remember turns text into a knowledge graph of people, teams and decisions. A dataset is the named memory everything goes into. A node set is a tag on what you remember, so you can later recall from that part alone.
Step 3: Remember Your Linear Issues
Source:scripts/ingest_linear.py
This step saves the work your team already tracks, so the agent can say a step has an issue. It runs only when Linear is set up and you don’t pass --no-linear. It reads the issues changed in the last 30 days, not your whole workspace; --days N changes that too.
cognee.remember with node_set=["linear"]. Writing the identifier into the text is what lets the agent copy PAY-104 exactly.
Step 4: Remember Your Inbox
Source:scripts/ingest_email.py
This step saves your newest emails, because deadlines often arrive by email, not on a call. It runs only when Gmail is set up and you don’t pass --no-email. It takes the newest 50 inbox emails, not your whole mailbox; pass --emails N to change how many.
cognee.remember with cognee’s Gmail connector, gmail_source, as the input and node_set=["email"]. write_disposition="merge" with primary_key="id" merges emails by message id, so a rerun does not store the same email twice.
Step 5: Work Out the Next Steps
Source:scripts/follow_up.py
This step reads your newest call from the last 30 days and lists its next steps, then posts them to Slack or prints them.
cognee.recall calls. The first two use query_type=SearchType.CHUNKS with the call as the query: one with node_name=["linear"], one with node_name=["email"]. Each returns the three closest issues or emails as raw text, because they rarely rank in a search over the whole graph, and raw text keeps identifiers and dates exact. The third uses HYBRID_COMPLETION, which answers from the matching passages and the graph across all sources. It gets the call, those issues and emails, and NEXT_STEPS_PROMPT: take teams from earlier calls and issues, deadlines from emails, and never invent a date, a team or an issue.
Step 6: Browse the Graph
Source:scripts/ui.py
This step opens the cognee UI so you can see the memory behind the answer. It runs only when you pass --ui.
cognee.start_ui. Open http://localhost:3000 to browse the people, teams, issues and deadlines in the graph. Ctrl+C stops both. See Run the UI Locally for what the UI can do.
Make It Yours
- Ask for more in each step. Edit
NEXT_STEPS_PROMPTinscripts/follow_up.pyto add a priority or the customer a step is for. Keep its last rule, so the agent still never invents a fact. - Post where your team works. The Slack post is one HTTP request at the end of
follow_upinscripts/follow_up.py. Swap it for your chat tool’s API, or for a comment on the Linear issue. - Add another source. Write one more ingest script that calls
cognee.rememberwith its own node set, such as a folder of specs or postmortems, and add it torun(). See Remember for the inputs it accepts. - Build a weekly team digest. Keep steps 2 to 4 and replace the agent with one
HYBRID_COMPLETIONrecall withnode_name=["calls", "linear"]: “What did the Payments team commit to this month, and what is still open?” Same memory, a different application. NodeSet Grouping shows how scoping works.
Clean Up
sample/ and token.json in the cookbook folder.
Company Brain Q&A
Build another one: answer questions across your database, tickets and docs.
Personalized Email
Build another one: email replies that know what you promised.
Self-Hosted AI Companion
Build another one: a chat companion that remembers your notes.
NodeSet Grouping
Tag memories by source and recall from one part at a time.