
wiki-dedup
Detect and merge wiki pages representing the same concept under different names. Use for page-identity deduplication and consolidation. Destructive merges require confirmation; not for link repair or general linting.
- Installs
- 1.7K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/ar9av/obsidian-wiki --skill wiki-dedup- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads wiki-dedup automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Wiki Dedup — Identity Resolution and Page-Level Deduplication
You are finding and merging wiki pages that cover the same concept under different names. This is a write-heavy, potentially destructive skill — page merges cannot be automatically undone. Work carefully and confirm before acting in merge mode.
Follow the Retrieval Primitives table in llm-wiki/SKILL.md. The candidate-detection pass uses only frontmatter and titles (cheap). Only open full page bodies for confirmed candidate pairs.
Before You Start
Writing profile: Before drafting or rewriting natural-language Markdown, read and apply the Writing Profile Resolution section in llm-wiki/SKILL.md. Framework schema, provenance, safety, and operation-specific requirements take precedence.
WRITING.md preferences apply only to newly drafted or rewritten natural-language Markdown; preserve source content and structured records.
- Resolve config — follow the Config Resolution Protocol in
llm-wiki/SKILL.md(inline@nameoverride → walk up CWD for.env→ global config → prompt setup). This givesOBSIDIAN_VAULT_PATHandOBSIDIAN_LINK_FORMAT. - Read
index.mdto get the full page inventory with one-line descriptions and tags. - Read
log.mdbriefly — if a dedup run just happened, note what was already merged.
Modes
| Mode | Flag | Behavior |
|---|---|---|
| Audit | (default) | Report candidates only — no writes |
| Merge | --merge | Show each confirmed pair, ask for confirmation before merging |
| Auto-merge | --auto | Merge all high-confidence pairs (score ≥ 0.90) non-interactively |
If the user doesn't specify, run in Audit mode and present findings before asking whether to proceed.
Step 1: Build the Page Registry
Glob all .md files in the vault (excluding _archives/, _raw/, .obsidian/, index.md, log.md, hot.md, _insights.md, and any file that contains redirects_to: in its frontmatter — those are already merged redirect stubs).
For each remaining page, extract from frontmatter:
node_id— relative path from vault root, without.mdtitle— frontmattertitlefieldaliases— frontmatteraliaseslist (may be absent)tags— frontmattertagslistcategory— directory prefix
Build a lookup table: node_id → {title, aliases, tags, category, summary}.
Step 2: Detect Candidate Pairs
For every pair of pages in the registry, compute a similarity score using these signals:
2a. Title similarity signals
| Signal | How to assess | Max contribution |
|---|---|---|
| Token overlap | Jaccard similarity of lowercased title word-tokens (split on spaces, hyphens, underscores, punctuation) | 0.65 |
| Edit distance | Normalized edit distance on lowercased titles: 1 - (edits / max(len_a, len_b)) | 0.40 |
| Substring containment | One title is a substring of the other (e.g. "RSC" ⊂ "React Server Components") | 0.50 |
| Alias cross-match | Page A's title appears in page B's aliases, or vice versa | 0.65 |
Composite title score = min(max(token_overlap, edit_distance, substring), 0.65) + alias_cross_bonus.
You don't need exact arithmetic — make a confident judgement about degree of similarity.
Title extraction note: Some pages use YAML block scalars (title: >- or title: |). When the title: value is >-, >, |, or |-, the actual title is on the next indented line — read it from there. Never compare the literal string >- as a title.
2b. Semantic signals (cheap pass)
| Signal | Points |
|---|---|
Same category directory | +0.10 |
| Tag overlap ≥ 3 shared tags | +0.15 |
| Tag overlap ≥ 2 shared tags | +0.05 |
| Same first tag (dominant tag) | +0.05 |
2c. Threshold
Flag pairs with composite score ≥ 0.75 as candidates. Pairs scoring 0.90+ are high-confidence.
Score ranges → confidence labels:
| Score | Label |
|---|---|
| ≥ 0.90 | HIGH — almost certainly the same concept |
| 0.75–0.89 | MEDIUM — likely the same, verify |
| 0.60–0.74 | LOW — possible abbreviation or specialisation; skip unless user asks |
Only carry HIGH and MEDIUM candidates into Step 3.
2d. Quick exit rule
If the vault has fewer than 10 pages, skip the pair loop and report "vault too small to have meaningful duplicates". If the vault has more than 500 pages, process candidates in batches of 50 pairs — pause and report progress between batches.
Step 3: Semantic Verdict
For each candidate pair (sorted by score descending):
- Read both pages in full (full page read — justified because candidate pool is small).
- Ask: are these pages covering the same concept, or are they distinct?
Assign one of three verdicts:
| Verdict | Meaning |
|---|---|
merge | Same concept — different name, abbreviation, alias, or accidental duplicate. Safe to merge. |
keep-separate | Related but distinct — e.g. "Server Actions" vs "Server Components" are related React features, not duplicates. |
needs-review | Ambiguous — substantial overlap but also meaningful differences. Flag for the user to decide. |
Attach a short reason to each verdict (one sentence). This appears in the report and the log.
Step 4: Audit Report
Always produce this report, even in merge/auto-merge mode (so the user sees what will happen):
## Wiki Dedup Report
### High-Confidence Candidates (score ≥ 0.90): N pairs
| Score | Page A | Page B | Verdict | Reason |
|---|---|---|---|---|
| 0.95 | `concepts/rsc.md` | `concepts/react-server-components.md` | merge | "RSC" is the abbreviation; both pages cover identical material |
| 0.91 | `entities/vaswani-2017.md` | `references/attention-is-all-you-need.md` | keep-separate | One is a person stub, one is a paper reference |
### Medium-Confidence Candidates (score 0.75–0.89): N pairs
| Score | Page A | Page B | Verdict | Reason |
|---|---|---|---|---|
| 0.82 | `concepts/fine-tuning.md` | `concepts/finetuning.md` | merge | Same concept, hyphenation variant |
### Needs Human Review: N pairs
| Score | Page A | Page B | Reason |
|---|---|---|---|
| 0.78 | `concepts/agents.md` | `concepts/autonomous-agents.md` | Substantial overlap but "agents" may intentionally be broader |
### Summary
- Pages scanned: N
- Candidate pairs found: M
- Recommended merges: X
- Keep separate: Y
- Needs review: Z
In Audit mode, stop here and ask: "Run --merge to interactively merge the recommended pairs, or --auto to merge all high-confidence ones automatically?"
Step 5: Merge
Pre-write snapshot — before the first file write, check whether the vault itself is the root of a Git repository. Merely being a subdirectory of a larger repository does not qualify: running git add -A there could capture unrelated files. If the vault is not a standalone Git repository, skip this step silently — no nagging, no suggesting git init.
VAULT_REAL_PATH=$(cd "$OBSIDIAN_VAULT_PATH" && pwd -P)
VAULT_GIT_ROOT=$(git -C "$OBSIDIAN_VAULT_PATH" rev-parse --show-toplevel 2>/dev/null || true)
SNAPSHOT_SHA=""
if [ -n "$VAULT_GIT_ROOT" ] && [ "$VAULT_GIT_ROOT" = "$VAULT_REAL_PATH" ]; then
if git -C "$OBSIDIAN_VAULT_PATH" diff --quiet \
&& git -C "$OBSIDIAN_VAULT_PATH" diff --cached --quiet \
&& [ -z "$(git -C "$OBSIDIAN_VAULT_PATH" ls-files --others --exclude-standard)" ]; then
SNAPSHOT_SHA=$(git -C "$OBSIDIAN_VAULT_PATH" rev-parse HEAD)
else
if ! git -C "$OBSIDIAN_VAULT_PATH" add -A; then
echo "Pre-write snapshot failed; abort the skill without writing any vault files." >&2
exit 1
fi
if ! git -C "$OBSIDIAN_VAULT_PATH" commit -m "pre-wiki-dedup snapshot" --quiet; then
echo "Pre-write snapshot failed; abort the skill without writing any vault files." >&2
exit 1
fi
SNAPSHOT_SHA=$(git -C "$OBSIDIAN_VAULT_PATH" rev-parse HEAD)
fi
fi
The clean-repository branch deliberately avoids calling git commit, so "nothing to commit" is not treated as an error. If git add or git commit fails, stop before editing the vault; never continue without the promised snapshot.
If SNAPSHOT_SHA is non-empty and the skill writes files, include the SHA in the final report. To discard the entire run, after confirming there are no later changes worth keeping, the user can run:
git -C "$OBSIDIAN_VAULT_PATH" reset --hard "$SNAPSHOT_SHA"
git -C "$OBSIDIAN_VAULT_PATH" clean -fd
For each merge verdict pair (in merge or auto-merge mode):
In merge mode: show the pair and verdict, then ask: "Merge [Page A] into [Page B]? (yes/skip/review)". Skip on anything other than yes.
In auto-merge mode: only process HIGH-confidence (score ≥ 0.90) merges without prompting.
5a: Pick the canonical page
Apply these tiebreakers in order until one wins:
- More incoming wikilinks — grep the vault for
[[node_id]]references; higher count wins - Richer content — longer page body (more lines) wins
- More sources — larger
sources:list wins - Title length — longer, more descriptive title wins (e.g. "React Server Components" beats "RSC")
- Alphabetical — earlier title wins
The canonical page is the survivor. The other page becomes the secondary (to be merged in, then replaced with a redirect stub).
5b: Merge content into the canonical page
Read both pages. Update the canonical page:
aliases:— add secondary page's title and all its aliases (no duplicates)tags:— merge both tag lists (deduplicate, cap at 5 domain tags + system tags)sources:— merge both source lists (deduplicate)relationships:— merge both relationship lists (deduplicate by target, prefer typed entries over untyped)base_confidence— recompute using the union of sources and the formula fromllm-wiki/SKILL.mdupdated— set to nowsummary:— rewrite to cover the merged scope if the secondary page added new ground- Body content — merge unique sections and bullets from the secondary page. Do not blindly append — integrate the content. Avoid duplicating claims already present in the canonical page. Use
^[inferred]markers where synthesis is needed. provenance:— recompute after merging
5c: Write a redirect stub at the secondary page path
---
title: <secondary page title>
redirects_to: "[[<canonical node_id>]]"
aliases: [<secondary aliases>]
category: <secondary category>
tags: []
created: <secondary original created>
updated: <obsidian-wiki memory now>
---
This page has been merged into [[<canonical page title>]].
The redirects_to: field tells any skill reading this page to follow the redirect rather than treat it as content.
5d: Rewrite wikilinks vault-wide
Grep the entire vault for any link pointing at the secondary slug:
[[secondary-slug]]→[[canonical-slug]][[secondary-slug|display text]]→[[canonical-slug|display text]]- If
OBSIDIAN_LINK_FORMAT=markdown:[text](../path/to/secondary.md)→[text](../path/to/canonical.md)
Safety rules:
- Never rewrite inside code blocks (``` fences or
inline code) - Never rewrite inside the redirect stub itself (that's the one place the old slug should remain legible)
- Never use
rmor destructive shell ops — only Edit/Write tools - Rewrite one file at a time, verifying each before moving on
- If a file has zero occurrences, skip it
5e: Update tracking files
index.md and hot.md are regenerated by the memory sync call in Step 6 — the redirect stub is skipped by the page walker, so the secondary's entry disappears and the canonical entry picks up the merged summary on its own.
.manifest.json — For the secondary page's source entries: add "merged_into": "<canonical node_id>" to each. For the canonical page: merge in the secondary's pages_created and pages_updated lists.
5f: Final check
After all merges, grep the vault for any remaining [[secondary-slug]] references (in non-stub files). If any survive, report them — the rewrite step may have missed a non-standard link format.
Step 6: Log
One locked call writes the log line and reconciles the index and hot cache:
obsidian-wiki memory sync DEDUP \
mode=<audit|merge|auto-merge> pages_scanned=<N> pairs_found=<M> \
merged=<X> kept_separate=<Y> needs_review=<Z> \
wikilinks_rewritten=<W> \
--takeaways "Merged N duplicate pairs; canonical pages updated."
In audit mode (nothing merged) use obsidian-wiki memory log DEDUP ... instead — a read-only run must not rewrite the index or hot cache.
Never hand-edit index.md, log.md, or hot.md — the command takes the lock that keeps a parallel writer from dropping your update.
See .skills/llm-wiki/references/MEMORY.md for the full procedure.
Redirect Stub Handling
Other skills should handle redirect stubs as follows:
wiki-export— skip pages withredirects_to:in frontmatter; they are not content nodeswiki-query— if a search hits a redirect stub, followredirects_to:and read the canonical page insteadwiki-lint— validate that everyredirects_to:wikilink resolves to an existing, non-stub page (a redirect chain — stub pointing to stub — is an error)cross-linker— treat redirect stubs as non-targets; never add a new[[wikilink]]pointing at a stub page
Tips
- Audit first, always. Even in auto-merge mode, the audit report is shown. Read it before trusting the results.
- Check
needs-reviewlast. These are the hard cases — don't batch them with obvious merges. - Abbreviations are the most common case. "GPT" / "GPT-4" / "GPT4", "RSC" / "React Server Components", "LLM" / "Large Language Models" — these score high on substring containment and are almost always safe to merge.
- Different versions are not duplicates. "GPT-3" and "GPT-4" are related but distinct. "fine-tuning" and "fine-tuning-llms" may be distinct (technique vs. specific application).
- Run
cross-linkerafter dedup. The redirect stubs leave the graph in a slightly inconsistent state. Cross-linker will tighten it up.
QMD Refresh After Vault Writes
QMD is a search index, not the source of truth. If $QMD_WIKI_COLLECTION is empty or unset, skip this step. Run it only after this skill has written or rewritten vault markdown. If QMD refresh fails, do not roll back the vault changes; report the QMD status separately.
Use $QMD_CLI if set; otherwise use qmd.
${QMD_CLI:-qmd} update
If the output says vectors are needed or embeddings may be stale, run:
${QMD_CLI:-qmd} embed
Verify the collection with either:
${QMD_CLI:-qmd} ls "$QMD_WIKI_COLLECTION"
or, when a specific page path is known:
${QMD_CLI:-qmd} get "qmd://$QMD_WIKI_COLLECTION/<page>.md" -l 5
Record one of:
QMD refreshed: update + embed + verifiedQMD refreshed: update only + verifiedQMD skipped: QMD_WIKI_COLLECTION unsetQMD skipped: qmd CLI unavailableQMD failed: <short error summary>
FAQ
What does the wiki-dedup skill do?
Detect and merge wiki pages representing the same concept under different names. Use for page-identity deduplication and consolidation. Destructive merges require confirmation; not for link repair or general linting.
How do I install wiki-dedup?
Run npx skills add https://github.com/ar9av/obsidian-wiki --skill wiki-dedup in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/wiki-dedup/ (personal) or .claude/skills/wiki-dedup/ (project).
Which AI agents can use wiki-dedup?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is wiki-dedup safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains wiki-dedup?
It is published by ar9av in ar9av/obsidian-wiki. It has 1,728 recorded installs.
More from ar9av/obsidian-wiki
llm-wiki
ar9av/obsidian-wiki
Explain and apply the foundational LLM Wiki architecture and knowledge-management strategy. Use for setup, architecture, schema, or organization decisions; operational ingest/query/lint work uses dedicated skills.
wiki-ingest
ar9av/obsidian-wiki
Ingest new documents, raw text, folders, or URLs into the Obsidian wiki as distilled, linked knowledge. Use for general wiki ingestion when no more specific ingest skill applies, including processing raw/ staged content.
wiki-setup
ar9av/obsidian-wiki
Initialize or repair an Obsidian wiki vault's required structure and configuration. Use for new-vault setup, .env/config creation, reconfiguration, or broken setup recovery.
wiki-query
ar9av/obsidian-wiki
Search and synthesize answers from the compiled Obsidian wiki, including cited and multi-hop answers. Use for questions about existing wiki knowledge or fast index-only lookups, and for challenge requests ("challenge this", "argue against X", "poke holes in my plan") that look for the vault's own evidence against a plan. Supports named-vault routing such as wiki-query @work; not for ingesting new sources.
wiki-lint
ar9av/obsidian-wiki
Audit wiki health: broken links, orphans, contradictions, stale content, lifecycle and tag issues. Use for maintenance or health checks. Default is report-only; use wiki-dedup for page-identity merges.
wiki-status
ar9av/obsidian-wiki
Report wiki ingestion/completeness state, pending source delta, structural insights, or maintenance equilibrium. Use for remaining-work/status questions, hubs and bridges, or whether maintenance skills still have pending changes. wiki-digest summarizes learned knowledge instead.
Popular productivity & automation skills
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.
lark-doc
open.feishu.cn
飞书云文档(Docx / Wiki)内容操作:读取、创建、编辑文档,插入或下载图片附件,以及操作思维笔记。用户提供文档 URL/token(包括 doubao.com 的 /docx/、/wiki/)时使用;按 URL 路径/token 而非域名路由;/page/ 是妙搭应用,非飞书云文档。文档内嵌资源按读取参考中的统一规则分流。独立评论操作走 lark-drive;随正文读取评论使用 docs +fetch。表格或 Base 内部数据操作不在本 skill。
lark-base
open.feishu.cn
飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。
lark-drive
open.feishu.cn
飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。
lark-shared
open.feishu.cn
Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling notice JSON.
lark-im
open.feishu.cn
飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。