Skip to content

brentrockwood/second-brain

Repository files navigation

Second Brain

AI-powered thought capture from Slack to Notion. Drop thoughts into a Slack channel and they're automatically classified and filed to the right Notion database.

Features

  • Smart Classification: Uses AI to categorize thoughts into People, Projects, Ideas, or Admin
  • Automatic Filing: Creates structured records in Notion with extracted fields
  • Fix Command: Reply fix: [category] to correct misclassifications
  • AI Digests: Daily and weekly summaries with actionable insights
  • Scheduled Delivery: Automatic digest delivery at configurable times

How It Works

  1. Post a thought to your designated Slack channel
  2. The bot classifies it using AI and extracts relevant fields
  3. A record is created in the appropriate Notion database
  4. You get a confirmation reply with a link to the Notion page

Setup

Prerequisites

  • Node.js 20+
  • A Slack workspace where you can install apps
  • A Notion workspace
  • An Anthropic API key

1. Clone and Install

git clone https://github.com/brentrockwood/2b.git
cd 2b
npm install

2. Create Slack App

  1. Go to api.slack.com/apps and create a new app
  2. Enable Socket Mode and generate an App Token
  3. Add these Bot Token Scopes:
    • channels:history - Read messages
    • chat:write - Send replies
    • app_mentions:read - Respond to @mentions
  4. Install to Workspace and copy the Bot Token
  5. Copy the Signing Secret from Basic Information

3. Create Notion Integration

  1. Go to notion.so/my-integrations
  2. Create a new integration and copy the token
  3. Share your Notion databases with the integration

4. Configure Environment

cp .env.example .env
# Edit .env with your credentials

5. Create Notion Databases

npx tsx scripts/create-databases.ts

This creates the required databases and outputs the IDs to add to your .env.

6. Run

Development:

npm run dev

Production (Docker):

docker compose up -d

Usage

Capturing Thoughts

Just post to your inbox channel:

Had coffee with John, he's moving to Seattle next month

The bot will classify this as People and create a record with:

  • Name: John
  • Context: Had coffee, moving to Seattle
  • Follow-ups: Check in about the move

Fixing Misclassifications

Reply in the thread:

fix: projects

Valid categories: people, projects, ideas, admin

Requesting Digests

Mention the bot:

@Second Brain digest daily
@Second Brain digest weekly

Configuration

Variable Description Default
SCHEDULE_ENABLED Enable automatic digests true
SCHEDULE_DAILY_CRON Daily digest schedule 0 8 * * * (8am)
SCHEDULE_WEEKLY_CRON Weekly digest schedule 0 8 * * 1 (Monday 8am)
SCHEDULE_TIMEZONE Timezone for schedules America/New_York
ANTHROPIC_MODEL AI model to use claude-sonnet-4-20250514

Development

npm run dev        # Run with hot reload
npm run build      # Compile TypeScript
npm run lint       # Run ESLint
npm test           # Run tests

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors