Wiki merge

From flonat/flonat-research · View interactive version

Wiki merge is an AI agent skill from the GitHub repository flonat/flonat-research. Merge an overlap cluster of Vault concepts into one canonical concept, rewrite wikilinks, and preserve a dry-run/apply boundary. Use when $wiki-curate has identified a winner and fold-in slugs. Not for general wiki auditing or automatic article promotion.

How to use this skill

Skill file

Wiki Merge — Collapse an Overlap Cluster

Folds one or more concept slugs into a single canonical entry.

Preserves provenance, rewrites incoming wikilinks across atlas /

books / concepts / project knowledge folders, deletes the losers,

and denylists them so the Saturday wiki-grow cron doesn't

re-promote.

When to Use

and you've decided which slug should be canonical.

When NOT to Use

— keep both, add a [[wikilink]] reference between them instead.


What it does

uv run python scripts/wiki-merge.py <winner> <loser1> [<loser2> ...]
uv run python scripts/wiki-merge.py --apply <winner> <loser1> [<loser2> ...]

Steps performed (in order, only on --apply):

  1. Read winner + every loser concept file under ~/vault/concepts/.
  2. Build merged body — winner's body verbatim, then each loser's

body under a ## From <loser-slug> section. Each section includes

a small admonition naming the source project + promotion date for

traceability. Sub-headings in loser bodies are demoted by one

level (## → ###) so they don't compete with the new section

delimiter.

  1. Build merged frontmatter — winner's fields preserved; tags

becomes the union of winner ∪ loser tags; a new fold_in_sources:

block records each loser's slug + source_project + promoted_on

date; last_merged: is set to today.

  1. Write merged content back to the winner's file.
  2. Rewrite wikilinks — every [[<loser-slug>]] (with or without

alias suffix) across atlas topics, book chapters, other concepts,

and project knowledge folders gets rewritten to

[[<winner-slug>|<original-display-text>]]. The alias keeps the

original display label visible so the change isn't jarring on

pages that referenced the loser by name.

  1. Delete loser files from ~/vault/concepts/.
  2. Append to denylist — each loser slug is added to

~/vault/concepts/.denylist with a comment noting the

merge date. This stops the Saturday wiki-grow cron from

re-promoting the loser slug if a project knowledge article with

that slug still exists.

Dry-run output

Default invocation (no --apply) prints a plan:

Merge plan (dry-run):
  Winner:  goodharts-law  (concepts/goodharts-law.md)
  Fold in: goodhart-taxonomy, goodhart-resistance
  Merged file size: 11666 chars (winner was 3516)
  Wikilink rewrites: 12 file(s)
    concepts/strategic-classification.md: 1 occurrence(s)
    .../knowledge/goodhart-resistance.md: 1 occurrence(s)
    ...
  Denylist additions: goodhart-taxonomy, goodhart-resistance
  Files to delete: concepts/goodhart-taxonomy.md, concepts/goodhart-resistance.md

(dry-run — pass --apply to perform the merge)

Inspect the file count and the rewrite targets. If anything looks

wrong (e.g. a loser slug is wildly overrepresented across the corpus

suggesting it's actually a distinct concept), abort and reconsider.

Apply

uv run python scripts/wiki-merge.py --apply goodharts-law goodhart-taxonomy goodhart-resistance

Performs all six steps. After the run:

content with fold-in provenance in frontmatter.

the loser slugs now wikilink to the winner with the original

display label preserved as the alias.

Verify with wiki-curate — the goodhart cluster should be gone

on the next run.


Safety properties

the loser file is deleted, the merged file records source_project +

promoted_on for each fold-in, so the provenance is recoverable.

[[winner|Original Display]] form, so a topic page that wrote

[[Goodhart Taxonomy]] will still render "Goodhart Taxonomy" after

the merge, just pointing at goodharts-law now.

<loser-slug>.md in its knowledge folder, the next Saturday cron

won't re-promote it.

Anti-patterns

you must, swap winner/loser. Curated content should be the

canonical surface.

share a token (e.g. model token in language-model and

linear-model). Use judgement.

the only confirmation step.


Cross-References

| Skill | Relationship |

|-------|-------------|

| wiki-curate | Identifies the clusters this skill collapses. |

| wiki-grow | Writer of auto-promoted concepts; denylist entries from wiki-merge prevent it from re-promoting losers. |

| compile-knowledge | Source of project knowledge articles that get promoted to concepts. |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.