Skip to content

feat(edges): semantic edge resolution (Phase 3, slice 3)#24

Open
gurdenbatra wants to merge 11 commits into
mainfrom
phase-3-semantic-edges
Open

feat(edges): semantic edge resolution (Phase 3, slice 3)#24
gurdenbatra wants to merge 11 commits into
mainfrom
phase-3-semantic-edges

Conversation

@gurdenbatra

Copy link
Copy Markdown
Member

Third Phase 3 slice. When the LLM suggests a connection whose target_title doesn't exactly match an existing node, the connection was silently dropped — leaving the graph under-connected. Now those misses are resolved semantically against the vetted graph (reusing slice 1's embeddings + match_nodes).

How it works

  • Exact-first, unchanged & inline: resolveConnections still does the case-insensitive ilike match and creates those edges immediately. It now returns { created, unresolved } instead of dropping the misses.
  • Async tiered semantic fallback: both capture/process call sites schedule resolveSemantically via after() (post-response, non-fatal, service-role client). For each unplaced suggestion it embeds the target_title, finds the nearest vetted node via match_nodes, and tiers the top hit:
    • ≥ 0.80 → auto-create the edge (weight = similarity)
    • 0.65–0.80 → record an open edge_suggestions row for review
    • < 0.65 → drop
  • Review inbox: a new "Suggested connections" section (SuggestedConnectionItem) shows source —[edge_type]→ target, rationale, and % match, with Add connection / Dismiss.
  • Endpoint: PATCH /api/edge-suggestions/[id]accept (idempotent; only acts on an open row, returns 409 otherwise) creates the real edge then marks accepted; dismiss marks dismissed.

Decisions captured (yours)

  • Tiered: auto-create high-confidence, review the middle band.
  • Forward-only (no backfill of historically-dropped suggestions).
  • Thresholds (0.80 / 0.65) are starting values for the asymmetric title→title+description match; a debug log records (target_title, matched id, similarity, tier) so they can be tuned from real data.

Rollout (you, after merge)

Run supabase/v1.3-edge-suggestions.sql in the SQL editor. No new key — rides on the Voyage embeddings from slice 1 (VOYAGE_API_KEY already set; depends on match_nodes + backfilled embeddings).

Test plan

  • semanticEdges (auto/review/drop tiers, self-filter, existing-edge skip, no-op without key, non-fatal on rpc error)
  • resolveConnections returns { created, unresolved }
  • edge-suggestions route (accept inserts + marks accepted; dismiss; invalid action 400; idempotent 409)
  • SuggestedConnectionItem render + actions; ReviewPage still green
  • clean tsc → 0 · eslint . → 0 · vitest run → 608 pass

Spec: docs/superpowers/specs/2026-06-22-semantic-edge-resolution-design.md · Plan: docs/superpowers/plans/2026-06-22-semantic-edge-resolution.md

Note: optimistic accept/dismiss in the inbox swallows fetch errors (consistent with the slice-2 duplicate handlers) — a small follow-up could surface failures since accept is a write.

@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cof-learning-system Ready Ready Preview, Comment Jun 23, 2026 9:59am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant