Week 7 & Week 8: Similarity edges, wiring up the graph and a hairball problem

These two weeks were about making the AI side of the note graph actually real instead of just built-and-unused, plus running into the first real visual problem now that semantic edges are live.

Built out the piece that turns note embeddings into actual connections. Every note's vector gets compared against every other note's using cosine similarity, and for larger vaults it leans on Joplin's own search instead of doing a full pairwise comparison so it stays fast. Scores get normalized to a 0–1 scale and each note keeps only its top 5 matches. On top of that there are small bonus bumps: sharing a tag, already being linked, or being created close together in time all nudge the score up slightly. There's a safety floor though, so tags alone can never fake a connection only genuine similarity or an existing real link can produce an edge. All of this gets turned into graph edges alongside the existing link and tag edges and each note's vector gets cached in a local SQLite database so unchanged notes don't need to be re-fetched next time.

The previous piece was all built but not reachable from the plugin itself, so this part connected it to the real "Show Note Graph" command. Added a new "Note Graph" section under Tools → Options with a toggle for AI-based semantic analysis, a similarity threshold slider and a max-edges-per-note setting. The graph now opens instantly showing the normal links/tags view, then quietly fills in the AI-based connections a moment later once embedding finishes, instead of making the user sit and wait. If AI analysis is on but Joplin's AI isn't ready or available, it just falls back to the normal structural view with a small notice instead of failing outright. Changing the threshold or max-edges setting while the graph is open updates it immediately without needing to re-embed everything again, and there's a small progress bar so you can see embedding progress happening in the background.

Once semantic edges started rendering on a real vault, the graph turned into a hairball on any note with a lot of connections. Discussing it with my mentor and will come up with best solution super soon.

1 Like