Knowledge graph: typed edges, junk-link suppression, and graph health stats - #335
Merged
Conversation
…uppression, and graph health stats Capture-time inference now draws typed edges (follows, caused_by, decided) in addition to generic relates_to. Update and merge paths re-infer edges so the graph stays current when content changes; typed edges replace only inferred relates_to pairs, never explicit links. The nightly backfill can emit follows when an entry's kind is already classified and refuses long-mirrored sources. Insight calls now parse a relationship and direction before the insight gate, retiring only inferred relates_to edges. GET /stats/graph (admin only, gated behind ?deep=1, unscheduled) reports graph health with gap distribution and EXPLAIN-planned query assertions. The dangling-edge sweep runs weekly instead of nightly (~7x cheaper amortized). MCP link tool description now explains each edge type and direction. Kind gating is wired into the POST /link and MCP link paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Turns the knowledge graph into a real typed graph instead of 94% generic
relates_toedges, per the amended v3 plan.follows,caused_by,decideddrawn in addition to genericrelates_to(junk-link suppression prevents near-duplicate confusion from creating misleading connections).relates_topairs, never explicit links.followswhen an entry's kind is already classified; refuses long-mirrored sources.relates_toedges.GET /stats/graph(admin only, gated behind?deep=1, unscheduled) reports graph health with gap distribution and EXPLAIN-planned query assertions.linktool description now explains each edge type and direction; kind gating wired into POST/linkand MCPlink.Constraints honored
Verification
tsc --noEmitclean;check:scope99 queries / 53 exceptions?deep=1stays manual/unscheduled (noedges(workspace_id)index, user decision; ~5M row-visit cost documented)