<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Tyler H</title>
    <description>The latest articles on Forem by Tyler H (@tyy130).</description>
    <link>https://forem.com/tyy130</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3774657%2F4abfa93c-2ccc-4352-92a7-e5b2dbf7adf6.jpeg</url>
      <title>Forem: Tyler H</title>
      <link>https://forem.com/tyy130</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tyy130"/>
    <language>en</language>
    <item>
      <title>Notion Cortex: A Multi-Agent AI Research System Where Notion Is the Operating System</title>
      <dc:creator>Tyler H</dc:creator>
      <pubDate>Tue, 31 Mar 2026 21:51:17 +0000</pubDate>
      <link>https://forem.com/tyy130/notion-cortex-a-multi-agent-ai-research-system-where-notion-is-the-operating-system-3i58</link>
      <guid>https://forem.com/tyy130/notion-cortex-a-multi-agent-ai-research-system-where-notion-is-the-operating-system-3i58</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/notion-2026-03-04"&gt;Notion MCP Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Notion Cortex&lt;/strong&gt; is a multi-agent AI research system that uses Notion as its operating system — not just an output destination, but the shared coordination layer where agents think, communicate, and await human approval.&lt;/p&gt;

&lt;p&gt;Give it any topic, and five specialized AI agents fan out in parallel:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Scout agents&lt;/strong&gt; (x5) research different angles simultaneously, extracting structured entities into a Knowledge Graph&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analyst&lt;/strong&gt; cross-references all findings, identifies patterns and gaps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Synthesizer&lt;/strong&gt; streams a structured synthesis directly into Notion as it thinks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Approval Gate&lt;/strong&gt; pauses execution and waits for you to review in Notion — set Status to "Approved" to continue&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Writer&lt;/strong&gt; produces a publication-ready intelligence brief with headings, entity tables, and conclusions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every agent's reasoning streams into its own &lt;strong&gt;Working Memory&lt;/strong&gt; page in real time. You can literally watch them think in Notion.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;notion-cortex &lt;span class="s2"&gt;"The rise of autonomous AI agents in software engineering"&lt;/span&gt;
&lt;span class="go"&gt;
🧠 Notion Cortex — starting run for: "The rise of autonomous AI agents..."

📋 Bootstrapping Notion workspace...
✅ Workspace ready (1.6s)

🧩 Decomposing topic into research angles...
   5 angles identified

🚀 Running 5 Scout agents (concurrency: 3)...
  ✅ Scout 1 done
  ✅ Scout 2 done
&lt;/span&gt;&lt;span class="c"&gt;  ...
&lt;/span&gt;&lt;span class="go"&gt;
📊 All Scouts complete (103s). Running Analyst...
✅ Analyst done (31s)

🕸️  Computing knowledge graph relations...
✅ Relations linked (8s)

🔗 Running Synthesizer...
✅ Synthesis written (23s)

✍️  Running Writer...
✅ Writer done (43s)

🎉 Done in 229s! Intelligence brief: https://notion.so/...
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Video Demo
&lt;/h2&gt;


&lt;div class="ltag_asciinema"&gt;
  
&lt;/div&gt;



&lt;p&gt;The demo shows a complete run from &lt;code&gt;notion-cortex "topic"&lt;/code&gt; through all 5 agent phases to the final intelligence brief in Notion.&lt;/p&gt;




&lt;h2&gt;
  
  
  Show us the code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/tyy130/notion-cortex" rel="noopener noreferrer"&gt;github.com/tyy130/notion-cortex&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/
  index.ts              CLI entry point + setup wizard
  cleanup.ts            Archives all cortex-* databases for a fresh start
  orchestrator.ts       Pipeline coordinator
  llm.ts                Dual-provider streaming (OpenAI + Anthropic)
  streaming.ts          Token buffer → timed Notion block flush
  concurrency.ts        Write queue (p-limit) + exponential backoff retry
  types.ts              Zod schemas for all database entry types
  agents/
    scout.ts            Research + entity extraction via MCP
    analyst.ts          Cross-scout analysis + KG enrichment
    synthesizer.ts      Structured synthesis streamed to Working Memory
    writer.ts           Final brief written to Outputs database
  notion/
    bootstrap.ts        Idempotent 5-database workspace creation
    client.ts           Notion SDK singleton
    mcp-client.ts       Notion MCP server (stdio transport)
    task-bus.ts         Agent task queue CRUD
    working-memory.ts   Streaming page writer + content reader
    knowledge-graph.ts  Entity store with serialized upsert
    approval-gates.ts   Human-in-the-loop polling
    outputs.ts          Final page publisher
    markdown-blocks.ts  Markdown → Notion block converter
    utils.ts            Shared helpers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Technical Decisions
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Serialized KG upsert&lt;/strong&gt;: Parallel scouts can discover the same entity simultaneously. A &lt;code&gt;pLimit(1)&lt;/code&gt; queue wraps the check-then-create operation, making the upsert atomic without a database lock.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two-queue concurrency design&lt;/strong&gt;: &lt;code&gt;writeQueue&lt;/code&gt; (pLimit(3)) handles Notion API rate limiting. &lt;code&gt;kgUpsertQueue&lt;/code&gt; (pLimit(1)) handles logical atomicity. Different concerns, different queues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Idempotent bootstrap with archived filtering&lt;/strong&gt;: &lt;code&gt;bootstrapWorkspace&lt;/code&gt; searches for existing &lt;code&gt;cortex-*&lt;/code&gt; databases and reuses them. It filters out archived databases (Notion's search API returns them by default) and uses &lt;code&gt;databases.update&lt;/code&gt; to ensure schema migrations apply to pre-existing databases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dual-provider LLM abstraction&lt;/strong&gt;: Supports OpenAI (default) and Anthropic with streaming and multi-turn tool-use loops. Switch with one env var.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;55 tests across 13 files&lt;/strong&gt;: Full coverage of the orchestrator pipeline, all agents, concurrency utilities, markdown converter, and Notion data layer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quick Start
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/tyy130/notion-cortex.git
&lt;span class="nb"&gt;cd &lt;/span&gt;notion-cortex
npm &lt;span class="nb"&gt;install
&lt;/span&gt;notion-cortex setup    &lt;span class="c"&gt;# interactive wizard&lt;/span&gt;
notion-cortex &lt;span class="s2"&gt;"your research topic"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How I Used Notion MCP
&lt;/h2&gt;

&lt;p&gt;Notion isn't just where output ends up — it's the runtime substrate. The &lt;strong&gt;Notion MCP server&lt;/strong&gt; (&lt;code&gt;@notionhq/notion-mcp-server&lt;/code&gt;) runs as a stdio subprocess, giving Scout agents access to &lt;code&gt;notion_search&lt;/code&gt; — they check what knowledge already exists in the workspace before extracting new entities, avoiding redundant work across runs.&lt;/p&gt;

&lt;p&gt;Beyond MCP search, each database works as infrastructure through the Notion SDK:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Task Bus (agent coordination)
&lt;/h3&gt;

&lt;p&gt;The orchestrator creates tasks, scouts claim them via &lt;code&gt;assigned_agent&lt;/code&gt;, and status transitions (&lt;code&gt;pending → active → done → blocked&lt;/code&gt;) drive the pipeline forward. This is a distributed task queue implemented entirely in Notion.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Working Memory (streaming scratchpad)
&lt;/h3&gt;

&lt;p&gt;Each agent gets a dedicated Notion page. As tokens stream from the LLM, a timed buffer flushes them as paragraph blocks to the page every second. You can open a scout's Working Memory page and watch it think in real time.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Knowledge Graph (structured entity store)
&lt;/h3&gt;

&lt;p&gt;Scouts extract entities (companies, products, trends, concepts) with claims, confidence levels, and source URLs. A serialized upsert queue (&lt;code&gt;pLimit(1)&lt;/code&gt;) prevents duplicate entities when parallel scouts find the same thing. After the Analyst pass, &lt;code&gt;computeAndStoreRelations&lt;/code&gt; scans all entities and auto-links them using Notion's relation property — if "GitHub Copilot" appears in another entity's claim, they get linked.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Approval Gates (human-in-the-loop)
&lt;/h3&gt;

&lt;p&gt;Before the Writer runs, an approval gate creates a Notion database entry with status "Pending" and a link to the synthesis. The system polls with exponential backoff until you change the status to "Approved" or "Rejected" in Notion. This is genuine human-in-the-loop control — not a dialog box, but a Notion workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Outputs (final deliverables)
&lt;/h3&gt;

&lt;p&gt;The Writer converts its markdown output into native Notion blocks — headings, bullet lists, numbered lists, tables, code blocks, bold/italic, and links — using a custom &lt;code&gt;markdownToNotionBlocks&lt;/code&gt; converter. The result is a proper Notion page, not a pasted text blob.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The most surprising thing about this project was how naturally Notion works as an agent coordination layer. Databases become task queues. Pages become working memory. Relations become a knowledge graph. Status properties become approval gates. It's not a hack — it's genuinely the right tool for this.&lt;/p&gt;

&lt;p&gt;The human-in-the-loop approval gate is my favorite feature. Most agent systems are either fully autonomous or require you to babysit a terminal. With Cortex, you get a Notion notification, review the synthesis at your own pace, and approve when ready. The agents wait patiently.&lt;/p&gt;

&lt;p&gt;MIT licensed. PRs welcome.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>notionchallenge</category>
      <category>devchallenge</category>
    </item>
  </channel>
</rss>
