--- name: reconnect description: Repair "dropped connections" in the Baltun'ia vault — find plain-text mentions of entities that already have notes (NPCs, POIs, cities, regions, factions, deities, species) but were never wikilinked, and wire them back into the graph. The inverse of a broken-link check: here the target file exists, the link is just missing. Use when the DM says "reconnect the vault", "add missing links", "fix dropped connections", "this note isn't linked to anything", or after importing/pasting prose from an outside tool (e.g. an archivist export) that stripped the links. --- # Reconnect Dropped Links First read `.claude/skills/_shared/vault-conventions.md` — especially the **Linking discipline** section. This skill adds `[[wikilinks]]` that *should* exist but don't. It does **not** invent content and it does **not** fix broken links pointing at missing files (that's `/lore-audit`). Every link it proposes points at a note that already exists. ## Scope If the DM named specific notes/folders (e.g. "the recaps", one file), work only those. Otherwise sweep all `.md` files under canonical folders. **Always skip** `z_*`, `.obsidian`, `.smart-env`, `.smtcmp_*`, and `Index File.base`. ## Pass 1 — build the target index 1. List every `.md` basename in the canonical folders. Each basename is a link target (Obsidian matches by basename, case-insensitive, folders optional). 2. Harvest **aliases** from existing links across the vault: every `[[Note|alias]]` tells you `alias` should resolve to `Note` (e.g. `[[Belter Overview|Belters]]`, `[[House of Suits Overview|the Suits]]`). Also add obvious surface variants — plurals and possessives (`Belters`, `Six's`), and overview files' short names (`Belter Overview` → also match "Belters"). Build a **name → note** map. 3. Note which names are risky: very short or common English words that happen to be entity names (e.g. an NPC literally named "Six", "Ray", "The Church"). Flag these for confirmation rather than auto-linking. ## Pass 2 — find unlinked mentions For each in-scope note, scan the prose for occurrences of any indexed name/alias that are **not already linked**. When deciding what to link: - **Match on word boundaries**, case-insensitively; carry trailing possessives outside the link (`Six's` → `[[Six]]'s`). - **Link the first unlinked mention only**, per entity per note — matching the vault's "link first mention" discipline. If the note already links an entity somewhere, don't add a second link. - **Use an alias when the filename differs** from how it reads: `[[Belter Overview|Belters]]`, `[[Voxiu|the city]]` only if natural. - **Never link a note to itself** (its own title / self-references). - **Ignore text already inside** `[[...]]`, markdown links `[..](..)`, code fences/inline code, and image embeds. - Treat **Session Recaps** as prime candidates — new entities first appear there in prose and are frequently left unlinked; imported/pasted prose especially. ## Pass 3 (optional) — recurring unwritten entities While scanning, note proper nouns that recur but have **no** note yet. Per vault convention a red link is correct and intentional, so you *may* propose wikilinking the first mention as a future stub — but list these separately and flag each as "no note yet — stub worth creating," and hand them to `/lore-audit` / `/create-*` rather than silently spawning links everywhere. ## Output & apply 1. Present findings **grouped by note**, each line showing the entity, the sentence it appears in, and the exact edit (`X` → `[[X]]`). Separate the **clearly-safe** links (unambiguous full names) from the **risky** ones (short/common-word names, uncertain aliases). 2. **Don't edit until the DM confirms.** Then apply the safe ones; apply risky ones only on explicit OK. Edit in place — change only the first mention, leave everything else byte-for-byte identical. - **Whitespace gotcha (common).** Many notes are riddled with invisible non-ASCII whitespace — U+00A0 (no-break space), U+202F (narrow no-break space), U+2011 (non-breaking hyphen) — plus curly quotes and en/em-dashes. A multi-word `old_string` will silently fail to match when one of its "spaces" is really a `\xa0`. Anchor each Edit on a SHORT run you're sure is contiguous ASCII, keep the entity word at the edge, and if an Edit reports "String not found," re-inspect the exact bytes (`python3` → `repr(line)`) and shorten the anchor. NPC files named ` – ""` use an en-dash and quotes in the filename — link them with the full name as the target and a clean display alias. 3. For a whole-vault sweep, consider fanning Pass 2 out across subagents (one per folder/region), then merge — but build the target index (Pass 1) **once** and hand the same map to every subagent so they link consistently. 4. Finish with a one-line summary: N links added across M notes, plus any stubs surfaced for follow-up.