Skip to main content

把 Claude Code / GitHub Copilot 對話 session 變成 Obsidian 裡依語意主題分區、可翻找、可給 Claude compact 後回想的回顧筆記

Project description

session-to-obsidian

CI PyPI Python License: MIT

Turn a Claude Code or GitHub Copilot Chat session into an Obsidian note that is organized by topic, easy to browse, good for writing from, and useful as a memory layer your AI can recall after a context compaction.

繁體中文說明見 README.zh-TW.md.

Not a verbatim log dump. It splits one session into coherent topic threads (not time slices). Under each topic: what you asked + the assistant's full narrative + the tools/files/screenshots involved, with a table of contents on top — plus a cross-session INDEX.md.

Why

One AI coding session often does several unrelated things (fix a bug, tweak some UI, detour into something else). Later you want to find "how did I solve that thing" — and a timeline is useless, because what you remember is the topic, not the timestamp. This tool uses an LLM to cluster steps into topics so the note is organized the way you remember it.

The first audience is the author's own future self (a tool you keep using); open source is a bonus.

Install

pipx install session-to-obsidian

Topic clustering calls your local claude CLI (Claude Code) in headless mode — no API key, uses your existing subscription. No Claude Code? It still works, clustering just degrades to time-slicing (see below).

Usage

# A Claude Code session (jsonl lives in ~/.claude/projects/<proj>/<uuid>.jsonl)
s2o import ~/.claude/projects/myproj/abc123.jsonl --vault ~/Obsidian

# A Copilot Chat session (VS Code's chatSessions/<uuid>.jsonl append-log)
s2o import "~/…/workspaceStorage/<hash>/chatSessions/<uuid>.jsonl" --vault ~/Obsidian

# Output language (labels + generated titles). Default: en
s2o import <file> --vault ~/Obsidian --lang zh-TW

# No LLM — pure time-segmentation (offline / no Claude Code)
s2o import <file> --vault ~/Obsidian --cluster time

# Rebuild the index only
s2o index --vault ~/Obsidian

Source (Claude native / Copilot append-log) is auto-detected. Output goes to <vault>/90-Meta/sessions/<date>-<source>-<title>/ with a .md (recap) and .canvas (topic-grouped node graph). Set S2O_VAULT to skip --vault; S2O_LANG to set a default language. Re-importing the same session replaces the previous note (deduped by an originSessionId stored in frontmatter).

How it works

detect source → adapter restores steps → extract "ask + files + first-line gist"
   → cluster (LLM) → render .md/.canvas → update INDEX.md

Clustering only feeds the LLM the ask list + each step's touched filenames + the assistant's first line (never the full transcript), so token use is bounded. Compound asks go to their dominant topic; topics may be non-contiguous in time; each step keeps its original number.

Limitations

  • Topic clustering needs the local claude CLI (Claude Code). Without it, use --cluster time.
  • Images are not extracted by default (--images to enable). By Obsidian convention images live under _attachments/ (gitignore them; sync via Syncthing to avoid bloating git).
  • Topic names / titles are LLM-generated; quality depends on the model. Re-run a single session to regenerate.

Development

pip install pytest -e .
pytest

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

session_to_obsidian-0.1.1.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

session_to_obsidian-0.1.1-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file session_to_obsidian-0.1.1.tar.gz.

File metadata

  • Download URL: session_to_obsidian-0.1.1.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for session_to_obsidian-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1f1709427903f905e46ca9058ce2a8f0bb3d40e069eac5e2d989715decb6d7aa
MD5 badb43bca07bdb71dcf44eb369b0cc35
BLAKE2b-256 ba4848d95a630c099b702c15966836bd3c6cdf51c582321dea3b7261ed1aa92c

See more details on using hashes here.

Provenance

The following attestation bundles were made for session_to_obsidian-0.1.1.tar.gz:

Publisher: release.yml on timo9378/session-to-obsidian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file session_to_obsidian-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for session_to_obsidian-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3840ffdf3a8d9ae30af1fc9f1d8548cbdc58f77579fd6a71e104ecbbbabd3bd4
MD5 b5f19a1f100ea6547b855eccc614d1db
BLAKE2b-256 d4e027a2f7ca5d6d562f1b623a628bb3e037331a32f56b3db0833a12006ad8c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for session_to_obsidian-0.1.1-py3-none-any.whl:

Publisher: release.yml on timo9378/session-to-obsidian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page