Wikilinks, backlinks, and the graph

~3 min read

Wikilinks, backlinks, and the graph

Lettuce’s most useful affordance is its first-class link graph. Every [[wikilink]] you write becomes an edge that powers backlinks, the graph view, smart rename, and several agent tools.

Form Resolves to
[[note]] Any note named note.md in the vault
[[Folder/note]] Specifically Folder/note.md
[[note|alias]] Renders as “alias”, links to note.md
[[note#section]] Jumps to the ## section heading
[[note#^block-id]] Jumps to a block-id
[[#section]] Section within the current note

Resolution rules:

  1. Exact filename match, case-insensitive (full vault-relative path or basename).

  2. If a basename is ambiguous (same name in several folders), the copy in the same folder as the linking note wins, else the shortest path.

  3. A fuzzy match is offered only in the editor’s autocomplete — never auto-resolved at link-follow time.

aliases: in frontmatter are recorded (and surfaced in search) but are not currently used to resolve [[wikilinks]] — link by filename.

The inspector’s Backlinks tab shows every note that links to the current one, with a preview of each link’s surrounding paragraph. Click any backlink to jump.

Backlinks include:

Backlinks are always live — change a wikilink anywhere and the count updates within milliseconds.

The graph

View → Graph (or ⌘G) opens a force-directed visualisation. Nodes are notes; edges are wikilinks. The view has three controls:

Useful for:

Smart rename

Rename a note in Lettuce (sidebar context menu → Rename, or just double-click) and every wikilink to it is rewritten:

The rewrite is atomic: either all references update or none do. There’s a confirmation dialog showing every file that will change.

Warning

If you rename a file outside Lettuce (Finder, git mv, agents using raw write_note instead of apply_edits), the wikilinks don’t auto-update — you’ll get broken links until you fix them.

Programmatic access

Agents can read the link graph two ways:

read_outline(note: "Lettuce.md")
→ returns headings + outgoing links in document order

link_graph(seed: "Lettuce.md", depth: 2)
→ returns the subgraph reachable within 2 hops

See Agent reference/04 Read tools for full signatures.

Performance

The link index is built in parallel at launch and updated incrementally on each save. On a 6000-note vault, full rebuild takes <100ms; incremental updates are sub-millisecond. See For developers/04 Architecture map for the details.