obsidian-merge

obsidian-merge is a command for Claude Code from eugeniughelbur/obsidian-second-brain. It costs 28 tokens per session (1,545 once invoked), scanned A, original, MIT.

A command for combining two nearly identical Obsidian notes, where Obsidian is a note-taking application, into one note.

In plain words
What is it for?
Use it after duplicate notes are identified to combine their front matter, aliases, and written content into a chosen surviving note.
Why use it?
It avoids duplicate information while keeping the retired note as a redirect, so existing links and the original file location are preserved. It previews the changes by default and does not delete notes.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Part of the obsidian-second-brain plugin — 1 skill, 47 commands, 3 hooks shipped together

Good fit Use it after duplicate notes are identified to combine their front matter, aliases, and written content into a chosen surviving note.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/eugeniughelbur/obsidian-second-brain/obsidian-merge
About the project

obsidian-second-brain turns an Obsidian vault into persistent, searchable memory for Claude Code and other command-line coding agents, storing knowledge as linked Markdown notes. It is for developers, founders, writers, and researchers who want agents to retain project context across sessions. Its catalogue entries provide commands, hooks, a plugin, a skill, and instructions for capturing, finding, and maintaining that memory.

eugeniughelbur/obsidian-second-brain · 4,392 stars · on GitHub · eugeniughelbur.github.io

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.

Clone the repo
git clone --depth 1 https://github.com/eugeniughelbur/obsidian-second-brain

Made for: Claude Code.

Or install obsidian-second-brain, the plugin that ships this one along with the rest of its 1 skill, 47 commands, 3 hooks.

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 obsidian-merge

README.md
[![agentmods](https://agentmods.dev/badge/commands/eugeniughelbur/obsidian-second-brain/obsidian-merge/github.svg)](https://agentmods.dev/commands/eugeniughelbur/obsidian-second-brain/obsidian-merge)
Your own site
<a href="https://agentmods.dev/commands/eugeniughelbur/obsidian-second-brain/obsidian-merge"><img src="https://agentmods.dev/badge/commands/eugeniughelbur/obsidian-second-brain/obsidian-merge/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for obsidian-merge

Your own site · 80×15
<a href="https://agentmods.dev/commands/eugeniughelbur/obsidian-second-brain/obsidian-merge"><img src="https://agentmods.dev/badge/commands/eugeniughelbur/obsidian-second-brain/obsidian-merge.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,545 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00028 $0.01545
Opus 5 $0.00014 $0.00772
Sonnet 5 $0.00006 $0.00309
Haiku 4.5 $0.00003 $0.00154

Measured 11d ago against content hash 2f6f417283bb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

obsidian-merge 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 11d 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.

commands/obsidian-merge.md · 52 lines

How it starts

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

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.

Read the full file on GitHub · 52 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. 11d ago First seen · 52 lines · 28 tokens per session scan A 2f6f417283bb

Subscribe to this mod's changes

obsidian-merge is a command published in the GitHub repository eugeniughelbur/obsidian-second-brain (4,392 stars, last pushed 4d ago), licensed MIT. It adds 28 tokens to every session and 1,545 once invoked, about $0.0001 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-30.