chatgpt-sync

chatgpt-sync is a skill for Claude Code from tonydzi/second-brain-starter-kit. It costs 91 tokens per session (1,603 once invoked), scanned A, original, MIT.

An on-demand importer that copies new ChatGPT conversations into an Obsidian vault, a folder of linked Markdown notes. It also updates related notes and a conversation index.

In plain words
What is it for?
Use it to pull recent ChatGPT conversations into Obsidian, update the vault's conversation map, and keep a searchable SQLite record in sync.
Why use it?
It avoids manually exporting and organising chats, while preventing duplicate imports and protecting notes that already contain added concepts.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Claude Code.

Part of the second-brain-skills plugin — 57 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tonydzi/second-brain-starter-kit/chatgpt-sync
Any agent
npx skills add tonydzi/second-brain-starter-kit --skill chatgpt-sync
Clone the repo
git clone --depth 1 https://github.com/tonydzi/second-brain-starter-kit

Made for: Claude Code.

Or install second-brain-skills, the plugin that ships this one along with the rest of its 57 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for chatgpt-sync

README.md
[![agentmods](https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/chatgpt-sync.svg)](https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/chatgpt-sync)
Your own site
<a href="https://agentmods.dev/skills/tonydzi/second-brain-starter-kit/chatgpt-sync"><img src="https://agentmods.dev/badge/skills/tonydzi/second-brain-starter-kit/chatgpt-sync.svg" alt="Measured on agentmods" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,603 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00091 $0.01603
Opus 5 $0.00046 $0.00801
Sonnet 5 $0.00018 $0.00321
Haiku 4.5 $0.00009 $0.00160

Measured 5d ago against content hash 7d70a306ef8a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

chatgpt-sync scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/chatgpt-sync/SKILL.md · 56 lines

How it starts

The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OBJECTIVE: Pull ChatGPT conversations updated since the vault's newest note and fold them into the Obsidian vault (notes + MOC + SQLite), on demand. Idempotent. IDENTICAL pipeline to the scheduled ChatGPT Nightly Sync; the only difference is this fires when the operator asks.

CONTEXT (canon: memory [[chatgpt-export-pipeline]]):

  • ChatGPT chats are NOT on disk - pulled via /backend-api with a bearer token in $IMPORTS_ROOT/chatgpt/secrets/bearer.txt. The cookie/bearer lives ~1-2 weeks; there is NO refresh-token, so it must be hand-refreshed periodically (this is why the flow is semi-auto, not a blind cron).
  • ⚠️ GRABLI: the detail endpoint /conversation/{id} 403s with the bearer alone - incremental_pull.py already sends the required headers (OAI-Device-Id, oai-language, Referer/Origin). The LIST endpoint works without them.
  • Single source of truth = $IMPORTS_ROOT/chatgpt/nightly_sync.py - it chains: vault_backup (pre) -> incremental_pull.py CUTOFF -> chatgpt_export_to_vault.py --zip -> copy staging->vault (NEVER overwrites a concept-enriched note, only related_concepts: []) -> build_chatgpt_moc.py -> vault_backup (post). CUTOFF = newest vault note date - 1 day (so a missed day leaves no gap).
  • Vault home: $OBSIDIAN_VAULT/01-Conversations/ChatGPT/conversations/ + _ChatGPT-MOC.md. SQLite: _imports\chatgpt\chatgpt_conversations.db. Freshness heartbeat: _imports\chatgpt\_freshness.json.

STEPS:

  1. Run the orchestrator (it does backup + pull + fold + MOC + backup itself): cmd.exe /c "$IMPORTS_ROOT/chatgpt/nightly_sync.cmd" (or python $IMPORTS_ROOT/chatgpt/nightly_sync.py). Run it foreground; it logs to _imports\chatgpt\_nightly_sync.log.
  2. Read the tail of $IMPORTS_ROOT/chatgpt/_nightly_sync.log for the result line(s): copy: +N new, ~M refreshed, K enriched-preserved and nightly_sync DONE: +N new chats.
  3. Interpret the exit code:
    • 0 = success (even +0 new is fine - nothing new to pull).
    • 7 = PULL FAILED, token dead/expired. nightly_sync.py now self-heals this automatically (calls token_heal.py on exit 7 → re-mints the bearer from the long-lived session cookie → retries the pull), so a bare exit 7 in the log usually means the automatic heal ALSO failed. DEFAULT ACTION: run skill /chatgpt-token-heal (root-cause fix: session cookie → fresh bearer, 0 browser, 0 LLM; falls back to Chrome cookie re-harvest only if the cookie itself died). Do NOT hand-do the old Chrome Blob-download dance — that is the fallback the skill handles. ESCALATE to the operator (D-type) ONLY if /chatgpt-token-heal reaches L3 (Chrome logged out of chatgpt.com on the hub).
    • 8 = staging build failed (rare) → report the log tail, do not guess.
  4. (optional) Reindex for RAG so new notes are searchable now: python $IMPORTS_ROOT/brain_embed_update.py --wait-gpu 10 - OR just rely on the nightly Brain Reindex @04:00 (skip if the GPU is busy with a parallel session).
  5. Report: how many new chats folded, the newest note date, freshness FRESH/STALE (read _freshness.json), and BROKEN-link status if a validate ran. End with a 🧒 In plain words recap (messages TO the operator only).

CONSTRAINTS:

  • ANTI-RECENTS: when hunting for ONE specific chat by hand on chatgpt.com, never conclude "the chat does not exist" from the recents list. Use the built-in SEARCH by keyword + check Projects/archive + confirm the active account by email. The scripted path (/backend-api LIST via incremental_pull.py) pulls ALL chats and is more reliable than eyeballing the page. Canon: memory [[web-ui-search-not-recents]] (incident 2026-07-23).
  • DON'T duplicate logic - ALWAYS go through nightly_sync.py; never re-implement the pull/convert here. If incremental_pull.py or the converter needs a change, edit THOSE files (single source), not this skill.
  • AK-47: this skill is just this SKILL.md (a procedure). No new server/DB/service.
  • WINDOWS cp1252: the log may show mojibake for Cyrillic titles - cosmetic only; the vault notes are correct UTF-8. Don't "fix" by re-encoding the notes.
  • Token is a secret: never print it, never paste it into a message/vault/always-loaded layer (credential-store anti-leak boundary).
  • Backup-before-write is already inside nightly_sync.py (vault_backup pre+post) - don't double-run it.

Read the full file on GitHub · 56 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 56 lines · 91 tokens per session scan A 7d70a306ef8a

Subscribe to this mod's changes

chatgpt-sync is a skill published in the GitHub repository tonydzi/second-brain-starter-kit (5 stars, last pushed 6d ago), licensed MIT. It adds 91 tokens to every session and 1,603 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

superbrain-distill

Internal SuperBrain skill — run by the detached capture child to distill a session-event delta into routed Obsidian notes. Not for direct user invocation.

m3talux/superbrain · 36 tokens

save

Save a user-selected answer, decision, insight, or session summary into an Obsidian vault as one reviewed transaction. Use only when the user explicitly asks to preserve specific conversation content, not when they supply a file or URL to ingest. Triggers: /save, save this, save that answer, file this conversation…

AgriciDaniel/claude-obsidian · 80 tokens

wiki-retrieve

Build and query a vault-local contextual BM25 retrieval index with optional multilingual Nomic cosine reranking; use for retrieve, hybrid retrieval, BM25, rerank, contextual retrieval, chunk search, vault search, semantic search, find relevant passages, or retrieval diagnostics. Derived caches stay under .vault-meta…

AgriciDaniel/claude-obsidian · 81 tokens

obsidian-bases

Explain, draft, and validate Obsidian Bases .base files with filters, formulas, properties, summaries, and table, card, or list views. Use for Obsidian Bases, database-like vault views, dynamic tables, reading lists, task trackers, filters, formulas, summaries, and .base file edits.

AgriciDaniel/claude-obsidian · 69 tokens

wiki-fold

Create a bounded, extractive, structurally idempotent rollup of recent Obsidian wiki log entries, with dry-run preview by default and one optional transaction apply. Use for manual log compression without modifying child pages. Triggers: fold the log, run a fold, run wiki-fold, log rollup, roll up log entries, commit…

AgriciDaniel/claude-obsidian · 76 tokens

wiki-mode

Read or configure the vault filing methodology and suggest destinations for planned knowledge creation under Generic, LYT, PARA, or Zettelkasten. Use for wiki mode, methodology mode, what is my vault mode, set vault mode, switch to PARA, use LYT, Zettelkasten setup, change mode, configure mode, or methodology routing.…

AgriciDaniel/claude-obsidian · 83 tokens