ข้ามไปที่เนื้อหา

สร้าง Second Brain ด้วย Claude Code และ Obsidian

แอปจดโน้ตส่วนใหญ่สุดท้ายก็กลายเป็นสุสาน clip บทความมาเก็บไว้ในโฟลเดอร์ แล้วก็ไม่เคยเปิดอ่านอีกเลย ความรู้ไม่ได้ต่อยอดกับอะไร ไม่งอกเงย ผ่านไปสามปีมีโน้ต 4,000 อัน แต่จะหาอะไรสักอย่างก็หาไม่เจอ

Guide นี้พาสร้างอะไรที่ต่างออกไป คือ knowledge base ที่ดูแลตัวเองได้ โดยให้ Claude Code เป็นบรรณารักษ์ คุณแค่โยนของดิบเข้าไป ที่เหลือ Claude จัดการเอง ทั้งอ่าน เขียนเป็นบทความ wiki ที่มีโครงสร้าง cross-link concept ที่เกี่ยวกัน แล้วจัดเข้าที่ พอคุณถามอะไร คำตอบก็กลายเป็นโน้ตใหม่ ยิ่งใช้ ห้องสมุดก็ยิ่งฉลาดขึ้น

Architecture นี้มาจาก LLM Wiki pattern ของ Andrej Karpathy แนวคิดคือ knowledge base ที่อยู่ยาวและงอกเงยไปเรื่อยๆ โดยให้ LLM รับงานจัดเก็บที่เราไม่มีวันทำเองอยู่แล้ว


ภาพรวมของสิ่งที่จะสร้าง

Browser Clipper
      ↓
  raw/          ← your inbox (you dump things here)
      ↓ compile
  wiki/         ← Claude's domain (structured articles, cross-linked)
      ↓ query
  output/       ← answers, reports, synthesis

สามโฟลเดอร์ คู่มือหนึ่งไฟล์ (CLAUDE.md) กับคำสั่งสี่คำ ทั้งระบบมีแค่นี้

Claude Code อ่านของดิบ ตีความว่าเนื้อหาคืออะไร เขียนเป็นบทความ wiki และอัปเดต master index ไว้ตลอด session หน้าจะได้หาทางในห้องสมุดทั้งหมดได้ คุณไม่ต้องจัดอะไรเองเลยสักอย่าง


Part 1: ติดตั้งเครื่องมือ

Claude Code

npm install -g @anthropic-ai/claude-code

เช็กว่าลงแล้ว:

claude --version

Obsidian

ดาวน์โหลดจาก obsidian.md แล้วติดตั้ง เปิดขึ้นมาแล้วสร้าง vault ใหม่ vault ก็คือโฟลเดอร์ธรรมดาในเครื่องนี่แหละ ตั้งชื่อเช่น brain แล้ววางไว้ในที่ที่จะไม่ย้ายไปไหน (เช่น ~/brain)


Part 2: วางโครงสร้าง Vault

เปิด Claude Code ในโฟลเดอร์ vault:

cd ~/brain
claude

แล้วส่ง prompt นี้:

Create this folder structure for my knowledge base:

- raw/ — this is my inbox where I'll dump source material
- wiki/ — this is your domain, you'll write and maintain everything here
- Create a _master-index.md inside wiki/ with the heading "Knowledge Base Index"
  and a note that says "Topics will be listed here as they are created."
- output/ — this is where query results and reports go

Just create the folders and that one file. Nothing else yet.

เสร็จแล้วจะได้แบบนี้:

~/brain/
├── raw/
├── wiki/
│   └── _master-index.md
└── output/

Part 3: กฎของบรรณารักษ์ใน CLAUDE.md

ไฟล์นี้คือคู่มือที่บอกบรรณารักษ์ว่าต้องทำงานยังไง สร้าง CLAUDE.md ไว้ที่ root ของ vault:

touch ~/brain/CLAUDE.md

แล้ววางเนื้อหานี้ลงไป:

# Knowledge Base Rules

This is an LLM-maintained knowledge base. You are the librarian.

## Folder roles
- **wiki/** is YOUR domain. You write and maintain everything in it.
  I rarely edit wiki files directly.
- **raw/** is the inbox. When I dump files here, you process them
  into the wiki during a "compile" step.
- **output/** is for query results and generated reports.

## Structure rules
- wiki/_master-index.md is the entry point. It lists every topic folder
  with a one-line description. Always keep it up to date.
- Each topic gets its own subfolder in wiki/ (e.g., wiki/ai-agents/) with
  its own _index.md listing all articles with brief descriptions.
- Always use [[wiki links]] to connect related concepts across topics.
- Keep articles concise — bullet points over paragraphs.
- Include a ## Key Takeaways section in every wiki article.

## Compile workflow
When I say "compile", process everything in raw/ not yet compiled:
1. Read the raw file
2. Decide which topic it belongs to (or create a new one)
3. Write a wiki article with key takeaways and [[wiki links]] to related concepts
4. Update that topic's _index.md
5. Update wiki/_master-index.md
6. If a raw file spans multiple topics, create articles in both and cross-link

## Query workflow
When answering questions:
1. Read wiki/_master-index.md first to navigate
2. Drill into the relevant topic _index.md
3. Read specific articles
4. If I ask to save the answer, write it to output/ and link it to source articles

## Audit workflow
When I say "audit", walk the whole wiki and report:
- Broken [[wiki links]]
- Missing cross-references between related topics
- Gaps in coverage
- Inconsistencies between articles
Do not make changes yet — just give me the report.

ตัวระบบจริงๆ ก็คือไฟล์นี้ Claude อ่านทุกครั้งที่เริ่ม session เลยรู้ว่าต้องทำอะไร ทำแบบไหน


Part 4: ต่อ Obsidian MCP

พอต่อ MCP แล้ว Claude อ่านและเขียนโน้ตใน Obsidian ได้แบบ native ทั้ง backlink, metadata และ graph ของทั้ง vault ถ้าไม่ต่อ Claude ก็ใช้ได้แค่ file tool ธรรมดา เห็นแค่ไฟล์ แต่ถ้าต่อ Claude จะเห็นทั้ง vault แบบที่ Obsidian เห็น

เตรียมให้พร้อมก่อน

  • Node.js 18+ (เช็กด้วย node --version)
  • Claude Code 1.x ขึ้นไป (เช็กด้วย claude --version)
  • Path ของ vault (เช่น ~/brain หรือ /Users/you/brain)

Claude Code มีคำสั่งลงทะเบียน MCP server มาให้ในตัว รันแค่ครั้งเดียว:

claude mcp add --scope user obsidian -- npx -y mcp-obsidian /Users/YOUR_USERNAME/brain

เปลี่ยน /Users/YOUR_USERNAME/brain เป็น path vault จริงของคุณ ส่วน flag --scope user จะเก็บ server ไว้ใน global user settings ใช้ได้ทุกโปรเจกต์ ไม่ใช่แค่โปรเจกต์นี้

เช็กว่าลงทะเบียนแล้ว:

claude mcp list

ในรายการควรมี obsidian ขึ้นสถานะ connected หรือ ready

ทางที่ 2: แก้ settings.json เอง

ถ้าอยากแก้ไฟล์เอง เปิด ~/.claude/settings.json แล้วเพิ่ม block mcpServers:

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-obsidian",
        "/Users/YOUR_USERNAME/brain"
      ]
    }
  }
}

ถ้าใน settings มี mcpServers อยู่แล้ว ให้ใส่ key "obsidian" เพิ่มเข้าไปข้างใน อย่าเขียนทับทั้ง block

Restart แล้วเช็กอีกรอบ

เพิ่ม server เสร็จแล้ว restart Claude Code:

claude

ตอนเปิดขึ้นมา Claude Code จะ initialise MCP server ทุกตัวที่ลงทะเบียนไว้ และขึ้นข้อความสั้นๆ ว่าต่อแต่ละตัวได้หรือยัง ถ้า obsidian ต่อไม่ติดจะมี error โผล่มา ส่วนใหญ่เป็นเพราะใส่ path ของ vault ผิด

ลองทดสอบด้วย prompt นี้:

List all the files currently in my Obsidian vault and show me the contents 
of wiki/_master-index.md

ถ้า Claude แสดง file tree ของ vault และอ่านไฟล์ index ออกมาได้ แปลว่า MCP ใช้งานได้แล้ว แต่ถ้า Claude หันไปใช้ file tool ธรรมดาแทน แปลว่า server ยังต่อไม่ติด ลองเช็ก path อีกรอบแล้ว restart ใหม่

MCP ได้อะไรเพิ่มจากการอ่านไฟล์ตรงๆ

ความสามารถ File tool ธรรมดา Obsidian MCP
อ่าน/เขียนโน้ต ได้ ได้
Resolve [[wikilinks]] ไม่ได้ ได้
ค้นจาก tag หรือ frontmatter ไม่ได้ ได้
ไล่ตาม backlink ไม่ได้ ได้
ดู graph ของ vault ไม่ได้ ได้

ถ้าเป็น wiki ง่ายๆ แบบในโพสต์นี้ file tool ธรรมดาก็ทำได้ 90% ของงานแล้ว MCP จะเริ่มคุ้มตอนที่คุณ query ด้วย tag ไล่ backlink ข้าม topic หรือให้ Claude หาว่าโน้ตไหนบ้างที่พูดถึง concept หนึ่งๆ


Part 5: ให้ Claude ออกไปหาข้อมูลบนเว็บเองได้

ถ้า knowledge base อ่านได้แค่ไฟล์ที่คุณเอามาใส่เอง ไม่นานข้อมูลก็เก่า เครื่องมือสองตัวนี้ทำให้ Claude ไปดึงข้อมูลใหม่มาได้เองโดยไม่ต้องรอคุณ

Playwright — Browser Automation

Playwright ให้ Claude เปิด browser จริง เข้าหน้าเว็บ แล้วเก็บสิ่งที่เห็นบนหน้านั้นกลับมา

ติดตั้ง Playwright CLI:

npx playwright install

ลองดู:

Open a browser, go to news.ycombinator.com, and tell me the top 5 stories right now.

Claude จะเปิด browser ขึ้นมา scrape หน้าเว็บ แล้วส่งเนื้อหากลับมาให้เลย

Firecrawl — Web Scraper

Firecrawl ดึงเนื้อหาจาก URL ไหนก็ได้ออกมาแบบสะอาด ไม่มีโฆษณา ไม่มีเมนู nav เหลือแต่ตัวเนื้อหา ถ้าเป็นบทความหรือ documentation ใช้ตัวนี้ดีกว่า Playwright

npm install -g firecrawl-cli

Login ด้วย API key ที่ได้จาก firecrawl.dev:

firecrawl login --api-key fc-YOUR-API-KEY

เช็กว่าใช้ได้:

firecrawl --status

ลองดู:

firecrawl https://example.com --only-main-content

พอมีครบทั้งสองตัว จะให้ Claude research เรื่องไหนก็สั่งได้ทันที ไม่ต้องจำกัดอยู่แค่สิ่งที่มีใน wiki แล้ว


Part 6: Web Clipper

ไว้เก็บบทความตอนท่องเว็บ ติดตั้ง browser extension Obsidian Web Clipper (มีทั้ง Chrome, Firefox และ Safari)

เข้าไปตั้งค่าใน Web Clipper:

  • Vault: เลือก vault ของคุณ (brain)
  • Note location: raw
  • Note name: {{date|date:"YYYY-MM-DD"}}-{{title|safe_name}}

แค่นี้ เจอบทความไหนก็คลิกเดียว ไฟล์ลงไปอยู่ใน raw/ พร้อมวันที่ข้างหน้า รอ compile ได้เลย


Part 7: คำสั่งสี่คำ

งานประจำวันทั้งหมดมีแค่สี่คำ

1. Clip

เจออะไรน่าเก็บก็คลิกทีเดียว ของจะไปอยู่ใน raw/ ไม่ต้องจัดหมวด ไม่ต้องสรุป ไม่ต้องคิดว่าจะเอาไปไว้ไหน clip ไว้ก่อนก็พอ

2. Compile

สัปดาห์ละครั้ง (หรือเมื่อ raw/ เริ่มรก) เปิด Claude Code แล้วพิมพ์:

Compile everything in raw/ into the wiki. For each file:
1. Read it and identify the core topic
2. Create or find the right topic folder in wiki/
3. Write a wiki article with a summary, key takeaways, and [[wiki links]]
   to any related concepts
4. Update the topic's _index.md
5. Update wiki/_master-index.md

Cross-link between topics wherever relevant.

Claude จะไล่อ่านทุกไฟล์ที่ยังไม่ได้ compile เขียนเป็นบทความที่มีโครงสร้าง แล้วอัปเดต index กลับมาอีกทีก็ได้ห้องสมุดที่จัดไว้เรียบร้อย

3. Query

อยากรู้อะไรก็ถามห้องสมุดได้เลย

ถามหาข้อมูลตรงๆ:

What were the key findings from the article I clipped about PostgreSQL partitioning?

ถามโยงข้ามเรื่อง:

How does the shift to AI coding assistants relate to what I've been 
reading about developer productivity?

ให้สังเคราะห์ (ท่าที่ทำให้ระบบงอกเงย):

Based on everything in the wiki, what are the strongest arguments 
for and against multi-agent AI systems in production?
Save your answer as a new wiki article and link it to the sources 
you referenced.

Query สุดท้ายนี่แหละที่ทำให้ระบบงอกเงย ถามอะไรไป คำตอบก็กลายเป็นโน้ตใหม่ที่ลิงก์กลับไปหาแหล่งที่มา ยิ่งใช้ ห้องสมุดก็ยิ่งฉลาด

4. Audit

เดือนละครั้ง:

Audit the wiki. Look for inconsistencies, broken links, missing 
cross-references, and gaps in coverage. Don't make changes yet, 
just give me a report.

Claude จะไล่ดูทั้งห้องสมุด แล้วบอกว่าตรงไหนเริ่มไม่ชัดหรือไม่ลงรอยกัน ส่วนจะแก้อะไร คุณเป็นคนตัดสินใจ


Part 8: สั่ง Research ได้ทันที

พอต่อ Playwright กับ Firecrawl แล้ว ระบบไม่ได้แค่ compile ของที่คุณ clip มา แต่ออกไปหาข้อมูลใหม่ได้ด้วย

ดึงทั้ง topic เข้า wiki ให้อัตโนมัติ:

Research the current state of vector databases for AI applications.
Use Firecrawl to read the top articles. Then compile the findings 
into a new wiki topic at wiki/vector-databases/ and update 
_master-index.md.

ตามเรื่องที่สนใจให้ทันอยู่เสมอ:

Check Hacker News for any posts about PostgreSQL in the last week.
Clip anything relevant to wiki/databases/ and cross-link to 
existing articles.

Research เจาะลึกแล้วสังเคราะห์ออกมา:

I need to understand how Patroni handles leader election. 
Read the official Patroni docs and the GitHub issues about 
etcd connectivity. Compile a wiki article at 
wiki/databases/patroni-leader-election.md with key takeaways 
and links to sources.

สรุป

สรุปทั้งระบบในประโยคเดียว: Obsidian เป็นห้องสมุด Claude Code เป็นบรรณารักษ์ ส่วนคำสั่งสี่คำทำให้ห้องสมุดไม่ตาย

Setup checklist

ขั้นตอน ต้องทำอะไร
ติดตั้ง Claude Code npm install -g @anthropic-ai/claude-code
ติดตั้ง Obsidian ดาวน์โหลดจาก obsidian.md แล้วสร้าง vault ที่ ~/brain
วางโครงสร้าง vault รัน prompt สร้างโฟลเดอร์ใน Claude
สร้าง CLAUDE.md วางกฎของบรรณารักษ์ลงไป
เพิ่ม Obsidian MCP แก้ ~/.claude/settings.json ใส่ path ของ vault
ติดตั้ง Playwright npx playwright install
ติดตั้ง Firecrawl npm install -g firecrawl-cli + firecrawl login
ติดตั้ง Web Clipper ลง browser extension → ตั้งให้เซฟลง raw/ ใน vault

คำสั่งสี่คำ

คำสั่ง ใช้ตอนไหน พิมพ์อะไร
Clip ได้ตลอด คลิกเดียวใน browser
Compile สัปดาห์ละครั้ง "Compile everything in raw/"
Query อยากรู้เมื่อไหร่ก็ถาม ถามเป็นภาษาคนธรรมดา
Audit เดือนละครั้ง "Audit the wiki"

ทำไมระบบนี้ถึงรอด

ระบบจัดการความรู้ส่วนใหญ่ล้มเพราะแรงที่ต้องใช้ดูแลมากกว่าประโยชน์ที่ได้ตอนกลับมาค้น ทั้งจัดเข้าแฟ้ม ติด tag ทำ cross-reference ทำได้ไม่เกินสองอาทิตย์ก็เลิก

ระบบนี้ตัดงานดูแลออกไปทั้งหมด หน้าที่คุณมีอย่างเดียวคือ clip ของที่น่าสนใจ ที่เหลือ Claude ทำให้หมด ห้องสมุดโตขึ้นเรื่อยๆ แทบไม่ต้องออกแรง และทุกคำถามที่ถามไปก็ทำให้คำถามต่อไปได้คำตอบที่ดีขึ้น


แนวคิดมาจาก LLM Wiki pattern ของ Andrej Karpathy สร้างด้วย Claude Code, Obsidian, Playwright และ Firecrawl

มีคำถามหรืออยากคุยต่อ ทักมาได้ทาง LinkedIn, X หรือ email

Discussion

Have thoughts on this post? Share them below — questions, corrections, or your own experience are all welcome.