obsidian/wiki/obsidian-rag/claude-code-obsidian-setup.md
2026-04-15 10:27:17 +01:00

92 lines
3 KiB
Markdown

---
title: "Claude Code + Obsidian Setup"
aliases: [obsidian-setup, karpathy-setup, wiki-setup]
tags: [claude-code, obsidian, setup, workflow]
sources: [raw/Karpathy's Obsidian RAG + Claude Code = CHEAT CODE.md, raw/Как сделать Claude Code в 10 раз умнее.md]
created: 2026-04-15
updated: 2026-04-15
---
# Claude Code + Obsidian Setup
Practical setup guide for the Karpathy-style LLM knowledge base.
## Key Takeaways
- CLAUDE.md is the most important file — it defines Claude as "the librarian"
- Web Clipper + Local Images Plus = one-click article ingestion
- `_master-index.md` is the LLM's table of contents — always kept current
- Sessions auto-captured via hooks → compiled to wiki after 21:00
## Tools Required
| Tool | Purpose | Required |
|------|---------|---------|
| Obsidian | Frontend (graph view, search, browse) | Yes |
| Claude Code | LLM backend (compile, query, audit) | Yes |
| Obsidian Web Clipper | Browser extension → raw/ | Recommended |
| Local Images Plus | Downloads images from clipped pages | Recommended |
| claude-memory-compiler | Auto-captures sessions → daily logs | Installed |
## Vault Structure (This Vault)
```
VadymSamoilenko/
├── raw/ ← dump articles here (Web Clipper target)
│ └── _processed/ ← compiled files move here
├── wiki/ ← LLM's domain, do not edit manually
│ ├── _master-index.md
│ ├── obsidian-rag/ ← example topic folder
│ ├── concepts/ ← auto-generated from sessions
│ ├── connections/ ← auto-generated cross-links
│ └── qa/ ← filed query answers
└── output/ ← query results, reports
```
## Hook System (Already Configured)
| Hook | When | What it does |
|------|------|-------------|
| SessionStart | Every session start | Injects `_master-index.md` + recent daily log |
| SessionEnd | Session ends | Captures transcript → flush.py → daily log |
| PreCompact | Before context compaction | Safety net — saves context |
| PostCompact | After compaction | Haiku writes structured entry to project note |
Auto-compilation fires after **21:00** when a session ends.
## The Compile Workflow
1. Clip article with Web Clipper → lands in `raw/`
2. Open Claude Code, say: **"compile"**
3. Claude reads raw/, creates wiki article, updates `_index.md` and `_master-index.md`
4. Processed file moves to `raw/_processed/`
5. Article appears in Obsidian with wikilinks
## Query Pattern (3 hops)
```
Question → _master-index.md → topic/_index.md → article → answer
```
Manual query:
```bash
cd ~/.claude/memory-compiler && uv run python scripts/query.py "your question"
```
With auto-filing:
```bash
uv run python scripts/query.py "your question" --file-back
```
## Audit Command
```
audit the wiki
```
Claude reviews for: broken links, orphan articles, contradictions, gaps. Reports without making changes.
## Related
- [[wiki/obsidian-rag/karpathy-llm-wiki-approach|Karpathy's LLM Wiki Approach]]
- [[wiki/obsidian-rag/obsidian-rag-vs-true-rag|Obsidian RAG vs True RAG]]