Skip to content

zhiwehu/second-brain

Repository files navigation

Second Brain

Your personal knowledge base, maintained by AI. Just say what you want to save — AI handles the rest.

🇨🇳 中文说明 · Twitter: @zhiwehu


One-Command Install

In OpenClaw or Claude Code, just say:

Please install Second Brain from https://github.com/zhiwehu/second-brain

AI will automatically: clone → setup → inject → done.


Features at a Glance

What to Say What Happens
Save this to my second brain: [content] Stores and classifies the content
Save this link: [URL] Fetches, summarizes, saves
Search my second brain for [topic] Semantic search across all your knowledge
Save this screenshot Extracts text, saves image + metadata
Save this voice memo Transcribes, summarizes, stores
Save this meeting notes Extracts decisions, action items,存档
Run health check Checks wiki health, fixes issues
Compile schema Builds knowledge graph from your wiki

7 content types: Tweets · Articles · Images · Voice · Files · Chats · Tasks


How It Works

You say "save this" → AI processes → Stored in your knowledge base
         ↓
    Raw file saved (images, audio, documents)
         ↓
    AI extracts key information
         ↓
    Classified into PARA (Projects/Areas/Resources/Archives)
         ↓
    Written to wiki + cross-linked + logged

PARA Classification: AI automatically decides where content belongs:

  • Projects — Active goals with deadlines
  • Areas — Ongoing responsibilities
  • Resources — Topics you're interested in
  • Archives — Completed or abandoned items

Three-Layer Architecture

Layer 1: raw/          → Original files (images, audio, tweets)
Layer 2: wiki/         → Processed knowledge (summaries, links)
Layer 3: wiki/schema/  → Concepts & relationships (weekly compile)

How to Use

After installation, just talk to AI:

Save this to my second brain: [content]
Save this link to second brain: [URL]
Search my second brain for AI related content
Save that screenshot to second brain
Save today's meeting notes to second brain

Supported Content Types

Type Examples
Tweets Twitter posts, Weibo, short thoughts
Articles Blog posts, news, web pages
Images Screenshots, photos (EXIF extracted)
Voice Audio recordings (transcribed)
Files PDF, Word, Excel, text documents
Chat Meeting notes, chat logs
Tasks Schedules, TODOs with deadlines

Upgrade

Please upgrade my second brain

Health Check

Run the second brain health check

Or manually:

./tools/doctor.sh
./tools/doctor.sh --fix  # auto-fix issues

Scheduled Reminders

Set up automatic reminders using OpenClaw cron:

# Daily todo reminder (9 AM)
openclaw cron add \
  --name "Second Brain - Daily Review" \
  --cron "0 9 * * *" \
  --tz "Asia/Shanghai" \
  --session isolated \
  --message "Read wiki/log.md and list all pending tasks for today" \
  --announce --channel <your-channel> --to "<target>"

# Weekly health check (Sunday 8 PM)
openclaw cron add \
  --name "Second Brain - Weekly Check" \
  --cron "0 20 * * 0" \
  --tz "Asia/Shanghai" \
  --session isolated \
  --message "Run ./tools/doctor.sh and report the results" \
  --announce --channel <your-channel> --to "<target>"

Schema Compilation

Layer 3 of the architecture — extract concepts and relationships from your wiki:

Compile my second brain schema

This extracts:

  • Concepts (people, products, methods, technologies)
  • Relations (influences, supports, uses, part_of)
  • Properties (domain, type, first_seen)

Run manually when your wiki accumulates content:

./tools/compile_schema.sh --status  # check status
./tools/compile_schema.sh --incremental  # compile new content only
./tools/compile_schema.sh --full  # full recompile

Directory Structure

Second Brain uses a dual-directory architecture:

second-brain-source/    # Source code directory (cloned from GitHub)
├── tools/             # Utility scripts
├── process/           # AI processing templates
├── setup.sh          # Installation script
├── upgrade.sh        # Upgrade script
└── CLAUDE.md         # AI config

~/second-brain/        # Data directory (your second brain)
├── .git/              # Independent git repo (manage with git)
├── wiki/              # Your knowledge base
│   ├── projects/      #   Active projects
│   ├── areas/         #   Ongoing responsibilities
│   ├── resources/     #   Interesting topics
│   ├── archives/      #   Completed/archived
│   └── schema/        #   Concepts & relationships
├── raw/               # Raw materials (images/audio/files)
└── ...                # Copied code files

Key Points:

  • second-brain-source/ is clean source code, manage with git for your fork
  • ~/second-brain/ is your data, with independent git for your knowledge base
  • Run setup.sh and it automatically creates your data directory

Git Management:

# Manage your data
cd ~/second-brain
git status
git add .
git commit -m 'Added new content'
git push            # Push to your private GitHub/Gitee

# Upgrade source code
cd second-brain-source
git fetch upstream
./upgrade.sh

Obsidian Integration

Use Obsidian to visually browse your wiki:

  1. Open Obsidian
  2. Click "Open Vault" → select ~/second-brain/ (your data directory)
  3. Obsidian will display all .md files in wiki/
  4. Non-markdown files (.sh, images in raw/, etc.) are automatically hidden

Recommended Obsidian plugins:

  • Dataview — Query wiki data with dynamic tables
  • Templater — Automated templates
  • Obsidian Git — Auto-backup to Git (push to your private repo)

Tip: Both OpenClaw/Claude Code and Obsidian work in your data directory (~/second-brain/). OpenClaw manages AI processing, Obsidian provides the visual graph view.


Optional Tools

Install these for full functionality:

Tool Function Install
Whisper Speech-to-text pip3 install whisper
exiftool Image metadata brew install exiftool
yt-dlp YouTube/Bilibili subtitles brew install yt-dlp
agent-reach Twitter/Xiaohongshu/WeChat see below
qmd Semantic search (recommended) npm install -g @tobilu/qmd

agent-reach install:

Please install agent-reach: https://raw.githubusercontent.com/Panniantong/agent-reach/main/docs/install.md

qmd setup:

npm install -g @tobilu/qmd
qmd collection add $(pwd)/wiki --name second-brain
qmd embed

Recommended Browser Extensions

Obsidian Web Clipper

Convert web articles to markdown with one click:

  1. Install Obsidian Web Clipper extension
  2. Configure to save to second-brain/raw/articles/
  3. Clip articles while browsing → they go directly to raw/

This makes ingestion much faster — clip first, process later.

Image Download Hotkey

After clipping an article with images:

  1. In Obsidian Settings → Files and links → set "Attachment folder path" to raw/assets/
  2. Bind hotkey: Search "Download" → "Download attachments for current file"
  3. After clipping, press the hotkey → all images download locally

This ensures LLMs can view images directly from local files.


Generate Slides from Wiki

Use Marp to create presentations from wiki content:

  1. Install Marp plugin in Obsidian
  2. Write markdown with Marp syntax
  3. Export to PPT/PDF

Example:

---
marp: true
theme: default
---

# My Presentation

- Point 1
- Point 2

This lets you generate slide decks directly from your accumulated knowledge.


FAQ

Q: Where is my data stored? A: In ~/second-brain/wiki/ and ~/second-brain/raw/. Your data is managed with an independent git repository, pushable to your private GitHub/Gitee.

Q: Why separate source code and data? A: This way you can upgrade code without affecting your data. Source code in second-brain-source/, your data in ~/second-brain/.

Q: Do I need to maintain it manually? A: No. AI automatically updates index and log. Just regularly git push to backup your data.

Q: How is this different from regular notes? A: Second Brain automatically classifies using PARA, remembers relationships between content, and runs regular health checks.

Q: How do I upgrade? A: Download the latest source to second-brain-source/, then run ./upgrade.sh. Your wiki/ and raw/ data will not be lost.

Q: What is Schema and when should I compile it? A: Schema is Layer 3 — it extracts concepts and relationships from your wiki content. Compile when your wiki has accumulated significant content (weekly recommended). Use @compile command or run ./tools/compile_schema.sh --incremental.


Fork & Contribute

Want to stay updated with the latest changes?

If you fork this repo, you can receive updates from the original:

Step 1: Fork on GitHub

Click the "Fork" button on github.com/zhiwehu/second-brain

Step 2: Clone your fork to source directory

git clone https://github.com/YOUR_USERNAME/second-brain.git second-brain-source
cd second-brain-source

Step 3: Run setup script

./setup.sh

This will:

  1. Create your data directory (~/second-brain/)
  2. Initialize git repo to manage your data
  3. Optional: push to your private GitHub

Step 4: Add upstream remote

git remote add upstream https://github.com/zhiwehu/second-brain.git

Step 5: Upgrade

When updates are available, run:

cd second-brain-source
./upgrade.sh

This fetches latest code from original repo and overlays to your data directory. Your wiki/ and raw/ data stays safe.

Step 6: Contribute (optional)

If you fix a bug or add a feature, submit a Pull Request on GitHub!


Theoretical References


For Developers

For manual installation or contributing, see README_DEV.md.

For Chinese version, see README_ZH.md / README_DEV_ZH.md.

About

用 OpenClaw 或 Claude Code 打造第二大脑,让 AI 自动维护你的知识库。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages