К основному содержанию
команда CX Codex

obsidian-merge — команда для Claude Code: что делает и как установить

Команда obsidian-merge объединяет дублирующиеся заметки в Obsidian без удаления файлов. Сохраняет канонический текст, переносит связи и превращает старую заметку в ссылку-перенаправление.

MIT ★ 5 412 обновлён 2026-10-24

Установить в Claude Code · Через маркетплейс плагинов Все способы и платформы ↓
/plugin marketplace add eugeniughelbur/obsidian-second-brain
/plugin install obsidian-second-brain@obsidian-second-brain
Открыть на GitHub

Что делает obsidian-merge

Команда берёт две похожие заметки в хранилище Obsidian и объединяет их содержимое. Скрипт scripts/merge_notes.py запускается через uv и берёт на себя техническую часть: сводит метаданные frontmatter, переносит заголовки в псевдонимы aliases: и оставляет в файле архивной заметки заглушку с type: redirect. Сам текст новой заметки Claude Code собирает с сохранением ссылок [[wikilink]] и явной фиксацией противоречий.

Никакие файлы из хранилища не удаляются. По умолчанию команда работает в режиме предварительного просмотра и показывает все изменения перед записью. Без явного подтверждения и флага --apply скрипт не станет перезаписывать файлы в хранилище.

Какие задачи решает

  • объединить две дублирующиеся заметки в Obsidian
  • обработать пары дубликатов из отчёта команды /obsidian-health
  • сохранить обратные ссылки [[wikilink]] при слиянии заметок
  • заменить старую заметку на указатель type: redirect без удаления файла

Примеры запросов агенту

  • /obsidian-merge "Notes/Project-Idea.md" "Notes/Project-Idea-Old.md"
  • /obsidian-merge --from-health
  • Объедини найденные дубликаты заметок через /obsidian-merge

Как установить obsidian-merge

1Через маркетплейс плагинов

/plugin marketplace add eugeniughelbur/obsidian-second-brain
/plugin install obsidian-second-brain@obsidian-second-brain

2Вручную: положить файлы

.claude/commands/obsidian-merge.md

Вызов — /obsidian-merge. Для всех проектов — ~/.claude/commands/

Вопросы об obsidian-merge

Как установить obsidian-merge в Claude Code?

Выполните по очереди команды /plugin marketplace add eugeniughelbur/obsidian-second-brain и /plugin install obsidian-second-brain@obsidian-second-brain.

Что делает команда obsidian-merge?

Она сводит две похожие заметки в одну каноническую. Вторичный файл не удаляется, а перезаписывается короткой ссылкой-заглушкой со свойством type: redirect.

Что нужно для работы скрипта слияния?

Команда запускает scripts/merge_notes.py с помощью утилиты uv, а путь к хранилищу Obsidian считывает из файла конфигурации _CLAUDE.md.

Исходный текст

obsidian-merge.md · MIT
---
description: Merge two near-duplicate notes found by /obsidian-health into one - dry run by default, redirects the retired note rather than deleting it
category: meta
triggers_en: ["merge these notes", "merge duplicate notes", "merge near-duplicates", "combine these two notes"]
triggers_de: ["diese Notizen zusammenführen", "doppelte Notizen zusammenführen", "ähnliche Notizen zusammenführen", "diese beiden Notizen kombinieren"]
triggers_es: ["fusiona estas notas", "combina estas notas duplicadas", "une estas dos notas"]
triggers_pt: ["mescle estas notas", "combine estas notas duplicadas", "una estas duas notas"]
triggers_zh: ["合并这两篇笔记", "合并重复笔记", "把这些近似重复的笔记合并"]
---

Use the obsidian-second-brain skill. Execute `/obsidian-merge $ARGUMENTS`:

`/obsidian-health` finds duplicate pairs and stops - it is read-only by contract. This command does the merge: `scripts/merge_notes.py` (SKILL_ROOT's absolute path was given at session start as **Skill root**; substitute it for `SKILL_ROOT` below) handles the mechanical half - frontmatter union, alias folding, and replacing the retired note with a `type: redirect` stub - and you compose the merged body, since deciding what actually contradicts between two notes is judgment, not mechanics.

**Nothing is ever deleted.** The surviving note keeps its path; the retired note's file stays in the vault, its content replaced by a short pointer (`references/write-rules.md`: never delete vault notes).

1. Read `_CLAUDE.md` first to find the vault path.

2. **Resolve which two notes to merge:**
   - If `$ARGUMENTS` gives two note paths, the first is the **canonical** note (its path survives) and the second is **retired** (becomes a redirect). If the ordering isn't obviously what the user wants (e.g. the second path is clearly the richer/more recent note), say which one you'd keep canonical and why, and confirm before continuing.
   - If `$ARGUMENTS` is `--from-health` (or the user just says "merge the duplicates from health"), run:
     `uv run --directory "SKILL_ROOT" scripts/merge_notes.py --path <vault> --from-health`
     with no `--canonical`. This lists every duplicate group from the current scan, split into auto-pairable (exactly 2 files) and groups that need an explicit pick (3+ files, where nothing says which file should survive). Present the list and ask the user which pair to merge, or merge them one at a time with their approval - never guess a canonical note out of a 3+ group.

3. **Read both notes in full.** Note each one's `date`/`updated`, and everything in its body - this is the material the merged body and the frontmatter conflict list are built from.

4. **Compose the merged body**, following `references/ai-first-rules.md`:
   - One `## For future agent` preamble at the top, stating this note is the result of a merge (name both original notes) and what it now covers.
   - Keep both notes' provenance trails - what each note said and when - rather than silently picking a winner's prose and discarding the other's.
   - Where the two notes' bodies actually disagree (not just phrase things differently), list the contradiction explicitly - which note said what, and its date - rather than resolving it silently. An unresolved factual conflict is not this command's job to adjudicate; documenting it is.
   - Carry forward every `[[wikilink]]` from both notes that is still relevant; do not drop cross-links because they came from the retired side.
   - Write the composed body to a scratch file (e.g. via the Write tool, alongside the vault or in a temp path) - this is what `--merged-body-file` reads. Writing it once and reusing the same file for the dry run and the `--apply` run is what guarantees the preview and the actual write are identical.

5. **Preview (dry run, no `--apply`):**
   `uv run --directory "SKILL_ROOT" scripts/merge_notes.py --path <vault> --canonical "<canonical rel path>" --retire "<retired rel path>" --merged-body-file <scratch file>`
   (swap `--retire` for `--from-health` if resolving the pair from the health scan, per step 2). This prints the frontmatter conflicts (canonical's value wins each one; the retired note's value is recorded under `merged_from:`), whether a title was folded into `aliases:`, and the full text of both the proposed canonical note and the proposed redirect stub. Show this to the user - do not summarize it away.

6. **Ask for explicit confirmation before applying.** This rewrites one note and replaces another's entire content - never auto-apply on the strength of the dry run alone, the same rule this skill applies to any destructive vault write.

7. **Apply**, once confirmed, by re-running the exact same command from step 5 with `--apply` appended. Do not hand-edit either file afterward - the write already happened byte-for-byte as previewed.

8. **Report back:** which note survived, which became a redirect, the frontmatter fields that conflicted (and which value won), any alias added, and the contradictions the merged body documented rather than resolved.

9. Append to the operation log: if `Logs/` exists write `**HH:MM** - merge | <retired> -> <canonical>` to `Logs/YYYY-MM-DD.md`; otherwise append `## [YYYY-MM-DD] merge | <retired> -> <canonical>` to `log.md`.

If `merge_notes.py` refuses to run (malformed frontmatter on either note, an ambiguous `--from-health` group, a path that isn't in the vault), it says exactly why on stderr with a nonzero exit - relay that message rather than retrying blindly or picking a canonical note for the user.

---

**AI-first rule:** Every note created or updated by this command MUST follow `references/ai-first-rules.md` - `## For future agent` preamble, rich frontmatter (`type`, `date`, `tags`, `ai-first: true`, plus type-specific fields), recency markers per external claim, mandatory `[[wikilinks]]` for every person/project/concept referenced, sources preserved verbatim with URLs inline, and confidence levels where applicable. The retired note is the one documented exception: it becomes `type: redirect` (schema in `references/ai-first-rules.md` § Documented exceptions), which deliberately carries no preamble - its only job is to point at the canonical note. If the reference path does not resolve from your working directory, search upward for it; if you still cannot read it, say so before writing rather than producing a note that silently skips the rule.

**Anti-fabrication:** Search exhaustively before claiming any note, person, or file is absent - false absence is the most common failure mode - and never invent facts, entities, or dates (mark unknowns as `TBD`). Do not resolve a genuine contradiction between the two notes by picking one side and dropping the other - list it instead. See the anti-fabrication and search-completeness hard rules in `references/ai-first-rules.md`.

© Eugeniu Ghelbur · MIT · eugeniughelbur/obsidian-second-brain

Похожие слэш-команды

Все слэш-команды по теме «Заметки, задачи и проекты» →
obsidian-markdown AgriciDaniel Скилл obsidian-markdown объясняет, черновики и проверяет синтаксис Obsidian Flavored Markdown: свойства, wikilinks, вставки, callouts, теги, блоки, математику и Mermaid. CX Codex +1 593установок obsidian Teknium (teknium1), Hermes Agent Читает, ищет, создаёт и редактирует заметки в хранилище Obsidian. CX Codex +1 503установок obsidian-cli kepano Скилл obsidian-cli для Claude Code управляет заметками и поиском в хранилище Obsidian через CLI. Также помогает разрабатывать и отлаживать плагины и темы. CX Codex +1 83 700установок Obsidian Automation Claude Office Skills Скилл Obsidian Automation для Claude Code и других агентов: создаёт заметки Obsidian по шаблонам, расставляет ссылки и разбирает граф связей в Markdown-хранилище. CX Codex +1 5 000установок obsidian-mcp-server cyanheads MCP-сервер подключает агента к базе Obsidian через локальный REST API для точечной правки текста, разделов, заголовков и frontmatter. CX Codex +1 ★ 715звёзд репо obsidian-companion thoreinstein Скилл obsidian-companion подключает агент к хранилищу Obsidian: позволяет искать заметки, вести ежедневные записи и отвечать на вопросы по базе через локальный RAG. CX Codex +1 ★ 102звёзд репо

Из того же набора51

Весь набор →
obsidian-architect Команда obsidian-architect сканирует проект и генерирует набор архитектурных заметок в хранилище: обзор, заметки по модулям, ключевые решения. Переустановка обновит документацию без потери ваших правок. CX Codex +1 ★ 5 412звёзд репо obsidian-reconcile Команда obsidian-reconcile для Claude Code выявляет противоречия в Obsidian-vault и разрешает их автоматически или выносит на решение. Сканирует всё хранилище или отдельную тему, сверяя утверждения и свежесть источников. CX Codex +1 ★ 5 412звёзд репо obsidian-visualize Команда obsidian-visualize строит интерактивную карту вашего хранилища Obsidian: показывает, как связаны заметки, находит центральные узлы и выявляет изолированные записи. Полезна, чтобы увидеть структуру своей второй мозг целиком. CX Codex +1 ★ 5 412звёзд репо obsidian-distill Команда obsidian-distill сжимает длинную заметку или статью до списка тезисов, каждый с отметкой, откуда он взят — параграф, секция или timestamp. CX Codex +1 ★ 5 412звёзд репо obsidian-checkin Команда obsidian-checkin сверяет старые заметки с ответами владельца хранилища и сохраняет обновления. Она пригодится, когда сведения о людях или проектах могли измениться. CX Codex +1 ★ 5 412звёзд репо research-deep Команда research-deep сканирует ваше хранилище Obsidian, выявляет пробелы в информации и заполняет их через Perplexity или Grok, потом синтезирует результат и автоматически обновляет заметки о людях, проектах и идеях. CX Codex +1 ★ 5 412звёзд репо create-command Команда create-command для Claude Code пошагово опрашивает пользователя и создаёт готовый файл слэш-команды для Obsidian без ручной правки Markdown и фронтметтера. CX Codex +1 ★ 5 412звёзд репо obsidian-init Команда obsidian-init сканирует хранилище Obsidian и создаёт _CLAUDE.md, index.md и файлы журнала. Помогает подготовить навигацию и рабочие правила для ИИ. CX Codex +1 ★ 5 412звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой