Graph Min-Cut Skill
Purpose
A minimum cut is the cheapest set of edges that splits a graph in two. In a code graph it is where a module boundary costs least. Around one node of the knowledge graph it marks that node's cluster.
When to Trigger
- "where should this module be split?"
- "what belongs with X?"
- assigning disjoint file sets to parallel agents
When to Skip
- reachability or k-hop questions (use
agentdb_graph-query)
Commands
Code boundaries
npx @claude-flow/cli analyze boundaries src/
Seed-local cut in the knowledge graph
npx @claude-flow/cli mcp exec -t agentdb_graph-pathfinder -p '{"seedNodeId":"entity:auth-module","query":"auth boundary","algorithm":"dynamic-mincut","depth":3,"threshold":0,"complexityBudget":{"maxMillis":2000}}'
paths lists the seed's side of the cut, nearest first. mincut reports cutValue, cutEdges, side sizes and backend.
Reading Results
backend: mincut-wasmis the exact wasm solver, about 30x faster than the JS fallback at 1,000 nodes.backend: js-fallbackmeans ruvector is missing. The fallback only handles neighbourhoods of 300 nodes or fewer (npm i ruvector).- If the cut only isolates the seed, the seed is weakly attached. Raise
depth.
Best Practices
- Cut at the weakest boundary first, then recurse on the larger side
- Treat
spectral-sparsify/connected-component-churnresults as k-hop approximations (the response says so)
