claude-to-obsidian
Mirrors Claude Code session transcripts (~/.claude/projects/**/*.jsonl) into the
Obsidian vault at ~/Documents/wiki/chats/code/ as clean markdown — one note per
session, with YAML frontmatter, auto-extracted #tags, and [[wikilinks]] back
into the vault.
Pipeline
claude-extract(claude-conversation-extractor, uv tool) — JSONL → markdown.claude_to_obsidian.py(bundled inscripts/) — adds frontmatter, tags fromKEYWORD_TAG_MAP, wikilinks; files notes into<vault>/chats/code/.
Both are orchestrated by scripts/sync.sh, which self-heals (installs the
extractor via uv if missing) and is idempotent (safe to re-run / schedule).
Quick start
# Full catch-up — export ALL sessions, file into the vault
bash ~/.claude/skills/claude-to-obsidian/scripts/sync.sh
# Fast incremental — only the N most recent sessions (good for hooks/cron)
bash ~/.claude/skills/claude-to-obsidian/scripts/sync.sh recent 10
# Preview without writing anything
DRY_RUN=1 bash ~/.claude/skills/claude-to-obsidian/scripts/sync.sh
The script prints how many notes the vault holds when done. To verify the gap before
running: compare find ~/.claude/projects -name '*.jsonl' | wc -l (total sessions)
against ls ~/Documents/wiki/chats/code/*.md | wc -l (already archived).
Automatic tracking ("track all conversations")
The pipeline only runs when invoked. For continuous tracking, install ONE of:
- Daily cron (simple, portable):
(crontab -l 2>/dev/null; echo "0 22 * * * bash $HOME/.claude/skills/claude-to-obsidian/scripts/sync.sh >/dev/null 2>&1") | crontab - - macOS launchd (survives reboots, runs even if 22:00 was missed) — preferred on
this machine. Template:
scripts/com.rohit.claude-obsidian.plist(see below). - Claude Code
SessionEndhook — archive the just-ended session immediately viasync.sh recent 3. Configure with theupdate-configskill; keep itrecent(notall) so it stays fast.
Use the AskUserQuestion tool to confirm cadence/mechanism before installing any of
these — it's a persistent background change to the user's machine.
Configuration
- Vault:
VAULT_DIR(default~/Documents/wiki). Notes land inchats/code/. - Tags: edit
KEYWORD_TAG_MAPinscripts/claude_to_obsidian.pyto match the user's stack/projects (already tuned: myfinancial, swing-india, resolvr, hunt, etc.). - Log:
~/scripts/claude_obsidian_sync.log.
Notes & gotchas
--allre-exports every session each run; processing overwrites existing notes in place (refreshes tags/wikilinks). Manual edits tochats/code/*.mdwill be lost on re-sync — curate elsewhere in the vault.- Web chats (claude.ai) aren't auto-pulled; drop their markdown into
~/claude-exports/web/and they're processed intochats/web/on the next run. - The legacy
~/scripts/sync_claude_obsidian.shis superseded by this skill'ssync.sh(self-healing + incremental mode). Safe to leave or delete.