DEV Community

Cover image for Cortex: The AI-Powered Notion CLI That Builds Your Entire Startup Workspace in 30 Seconds
Raman Sharma
Raman Sharma

Posted on

Cortex: The AI-Powered Notion CLI That Builds Your Entire Startup Workspace in 30 Seconds

Notion MCP Challenge Submission 🧠

"The best way to predict the future is to build it. The fastest way to build it is with Cortex." -> Modern Founder Proverb


Demo Video πŸš€


(See Cortex in action: From an empty terminal to a 7-page populated Notion ecosystem with dual databases!)


The Problem: The "Organization Tax" πŸ“‰

Every founder knows the feeling: You have a killer idea at 2 AM, but the thought of manually creating a Notion page, a roadmap, a competitor analysis, and a task list kills the motivation.

You spend 4 hours organizing and 0 hours building. 🀯


How Cortex Works

Cortex isn't just a "wrapper." It’s a sophisticated orchestration of two cutting-edge technologies:

1. Resilient Multi-Model Architecture

Cortex uses a sophisticated hybrid AI stack to ensure maximum uptime even under heavy rate limits:

  • Google Gemini Array (Primary): We cycle through 5 different Gemini versions (3.1 Pro, 3 Flash, 2.5 Flash, etc.) in a single session. This auto-scaling ensures that if one free-tier quota is hit, the CLI intelligently pivots to the next model instantly.
  • OpenAI GPT-4.1 (Fail-Safe): A high-reasoning fallback for complex competitive logic if all Gemini models reach their daily limits.

2. The Notion MCP (Model Context Protocol)

This is the secret sauce. πŸͺ„

Cortex uses @modelcontextprotocol/sdk/client to manage a live stdio transport connection with the Notion MCP server. This means the AI isn't just "writing text"β€”it's executing high-level tools via the same protocol used by tools like Claude Desktop and Cursor.

Cortex CLI - Available Commands:
notion login - Authorize your Notion workspace
ai login - Set your OpenAI or Gemini API key
build: [topic] - Build a full 6-page startup workspace
idea: [topic] - Save a quick startup concept page
research: [topic]- Generate a deep market analysis report
brainstorm: [msg]- Generate 20 fresh project ideas
tasks: [project] - Inject 10 MVP tasks into an existing page
stories: [topic] - Generate persona-driven user stories
investor: [topic]- Draft pitch deck points and "Why Now?" insights
status - See recent Notion pages and connection info
help - Show this menu
exit - Shutdown the CLI

How it works under the hood:

// 1. Spawn the Notion MCP server as a subprocess
const transport = new StdioClientTransport({
    command: 'npx',
    args: ['@notionhq/notion-mcp-server'],
    env: {
      OPENAPI_MCP_HEADERS: JSON.stringify({
        Authorization: `Bearer ${token}`,
        'Notion-Version': '2022-06-28',
      }),
    },
  });

  const client = new Client(
    { name: 'notion-cortex', version: '1.0.0' },
    { capabilities: {} },
  );

  try {
    await client.connect(transport);
  } catch (error: any) {
    throw new Error(`Notion Connector Failed: ${error.message}. Please check your internet or if "npx" is available.`);
  }

// 2. Write to Notion via MCP tool calls, NOT a direct REST API
await client.callTool({ 
  name: "API-post-page", 
  arguments: { 
    parent: { workspace: true },
    properties: { title: { title: [{ text: { content: "New Startup" } }] } }
  } 
});
Enter fullscreen mode Exit fullscreen mode

Cortex changes that. It's a state-of-the-art CLI agent that turns your raw startup concept into a structured, modular empire in Notion.

πŸš€ Key Features: Not Just Text, but Structure!

Cortex doesn't just "dump text"β€”it crafts a professional workspace using Native Notion Blocks:

1. πŸ’‘ Premium Strategy Briefs (idea:)

The idea: command generates a high-end strategy document using:

  • Callouts: For the "Summary" and key takeaways.
  • Quotes: Indented blocks for "Moats" and competitive edges.
  • Structured Headings: Professional sections (Problem, Solution, Moat).

2. πŸ“‹ Jira-Style Roadmap (tasks:)

Generates a Native Notion Database with:

  • Status: (To Do, In Progress, Done).
  • Priority: AI-calculated (High, Medium, Low).
  • Timeline: AI-assigned Deadlines using native Notion Date properties.

3. 🎭 User Persona Stories (stories:)

Creates a User Story Database mapping Personas to Actions and Business Value. Perfect for aligning your product and engineering teams.

4. πŸ—οΈ Full-Stack Startup Build (build:)

The flagship command. Launches an entire Enterprise Workspace including BOTH databases (Roadmap + Stories) and all 5 strategy pages in one unified hierarchy.


πŸš€ Full Demo Walkthrough

Step 1: Initialize your Brain

cortex > notion login (Automatically handles the redirect sync)
cortex > ai login (Choose Google Gemini for ultra-fast, free-tier generation)

Step 2: Launch "CEO Mode"

cortex > build: Hyperlocal Green Hydrogen Micro-Grids
Enter fullscreen mode Exit fullscreen mode

Watch the magic happen:

  • βœ… Root workspace established.
  • πŸ’‘ Core Concept: Drafts your unique value proposition.
  • πŸ” Market Analysis: Estimates market size and trends.
  • βš”οΈ Competitor Landscape: Maps the gaps where you can win.
  • ✨ Product Roadmap: Lays out your MVP timeline.
  • πŸ“‹ Roadmap Database: Populates 10 Jira-style tickets with status and deadlines.
  • 🎭 Story Database: Maps 10 user stories for your core personas.

πŸ—οΈ Technical Deep Dive

  • Built with: Node.js, TypeScript, ESM.
  • Bundler: tsup (Compiles everything into a tiny 20KB binary).
  • Markdown-to-Notion Parser: We built a custom "Rich Text Transformer" to convert ### headers, > quotes, [!] callouts, and **bold** into native Notion objects on-the-fly.

🚦 Installation

# Manual Setup (Developer Mode)
git clone https://github.com/RamanSharma100/cortex-notion.git
cd cortex-notion
npm install
npm run build
npm link
Enter fullscreen mode Exit fullscreen mode

πŸ§˜β€β™‚οΈ Final Thoughts

β€œWhy did the startup founder cross the road?”
β€œTo find a more sustainable way to disrupt the other side.” πŸ˜‚ πŸš€

Seriously, the goal of Cortex is to eliminate the "organization tax" of starting something new. Stop clicking, start building.

πŸ”— Links

Top comments (0)