Blog

Faction Detection: Reading the Review Graph Before the Fork

31 March 2026, by Jasper Blues · Also published on Medium

Forks and crises in open source and enterprise projects rarely come out of nowhere. They just look_ that way._

A Zachary Karate Club-inspired logo A Zachary Karate Club-inspired logo

Today we’re building a tool that can predict IMMINENT forks in open source and large enterprise projects, using nothing but pull request comment data. Magic? Nuh-uh, science baby.


We’ll Start in a Karate Dojo

In 1977, a maths post-grad named Wayne Zachary had an unusual research subject: a karate club at a university in the American Midwest. He wasn’t studying martial arts. He was mapping relationships — who trained with whom, who socialized outside class, who deferred to whom. Standard social network stuff. Except that is, that nobody had really done this before. It was one of the first formal studies of community structure in a social network.

A Faction Forms

Over two years, the club’s instructor and its president fell into a slow-building dispute over lesson fees and club direction. Members didn’t pick sides publicly. They just… drifted. Training partners shifted. Maybe Maryellen stopped meeting Albert for coffee after practice and started meeting James for — well, let’s call it strategic alignment. Social ties rearranged in ways that were invisible unless you were drawing the map. By the time the club officially split in two, Zachary had already predicted — from the network structure alone — which members would end up on which side. He got 33 out of 34 right.

That paper launched an entire subfield. “Zachary’s Karate Club” became the standard benchmark dataset for community detection algorithms. It became so famous that researchers still use it as a benchmark nearly fifty years later — the go-to dataset when you need to test whether an algorithm can find hidden groups in a network. Think of it as the “Hello, World!” of mathematics-based social network science.

The insight is simple and a little unsettling: the structure of who-talks-to-whom contains more information about an impending split than anything anyone actually says. The faction is already in the graph before anyone announces it.

Wax on, fork off

Let’s replace the dojo with GitHub repositories.

Instead of training partners, we have reviewers. Instead of socializing after class, we have PR threads. Instead of a dispute over lesson fees, we have a governance argument that nobody’s having in public… yet. But underneath, it’s the same network, and when tensions build, the graph shifts in exactly the ways Zachary would recognize.

Let’s see if we can use 1970s network science to predict future forks, governance crises and other notable schisms on GitHub projects.

Back, to the Future

To know if our model is any good at predicting the future, let’s put it on the job of retrodicting the past. For any given Github repository, we’ll give the tool a time-frame to ingest pull requests and factor the comments. If we set the time-frame just ahead of “the forkening” it should return FRACTURE_IMMINENT. Re-running to include the actual fork in the time-frame returns FRACTURE_ADVERSARIAL_FORK or one of the insightful variants.

Code and Tools

Faction Detector is on GitHub with full setup instructions. You’ll need a GitHub token, an Anthropic API key, and a Neo4j instance. The first run against a repo is slow, damn slow, actually (it pages through every closed PR), but everything is cached — subsequent runs complete in seconds.

It is built with Neo4j the world’s leading graph database and Embabel — an open source framework for building agentic AI applications on the JVM, founded by Rod Johnson, creator of Spring. Embabel is where I work, too.

Neo4j, Three Ways

One of the reasons we love graphs and Neo4j at Embabel, is there are three ways you can use it. People talk about the blue pill or the red pill way. Not everyone realizes that there’s a third option …

Neo4j usage patterns Neo4j usage patterns

Here’s a Cypher query for each row — the first and third are real queries from the codebase:

Relational — persist a review edge and look up neighbours:

MERGE (reviewer:Contributor {login: row.reviewer, runId: row.runId})
MERGE (author:Contributor {login: row.author, runId: row.runId})
MERGE (reviewer)-[r:REVIEWED {repo: row.repo, timestamp: row.timestamp, runId: row.runId}]->(author)
SET r.commentCount = row.commentCount, r.weight = row.weight

Ontological — infer indirect faction alignment through review chains. Two contributors who never reviewed each other directly may still be connected through a shared intermediary — the graph can derive relationships that don’t exist explicitly:

MATCH (a:Contributor {runId: $runId})-[:REVIEWED]->(bridge:Contributor)-[:REVIEWED]->(b:Contributor {runId: $runId})
WHERE a <> b AND NOT (a)-[:REVIEWED]->(b)
RETURN a.login AS aligned_with, b.login AS via_bridge, bridge.login AS bridge_figure

Structural — project a weighted graph into GDS and run Louvain community detection:

CALL gds.graph.project.cypher(
  'faction-graph',
  'MATCH (n:CoreContributor) WHERE n.runId = $runId RETURN id(n) AS id',
  'MATCH (s:CoreContributor)-[r:REVIEWED]->(t:CoreContributor) WHERE r.runId = $runId
   RETURN id(s) AS source, id(t) AS target,
          coalesce(r.factionSignal, r.anomalyScore, 1.0) AS weight'
)

CALL gds.louvain.write('faction-graph', {
  writeProperty: 'communityId',
  relationshipWeightProperty: 'weight'
})

Graph Data Science

That third row — structural analysis (or the whole bottle) — is where Neo4j Graph Data Science (GDS) comes in. GDS is a library that runs algorithms on the graph rather than through it. You don’t write a query that says “find me the path from A to B.” You say “tell me something about the shape of the entire network that I couldn’t see by looking at any individual node.” That’s the difference between asking “who reviewed this PR?” and asking “has this project quietly separated into two groups that no longer talk to each other?”

This is exactly what Zachary did with the karate club — he didn’t study what people said to each other, he studied the shape of who interacted with whom. GDS gives us the same lens on a code review graph. We’ll be primarily exploring two structural motifs: community detection (has the project split into factions?) and centrality (how much power or influence does a person have?).

There are different kinds of community detection and centrality. For example, Google search results (page rank) use Eigenvector Centrality. Early facebook community detection used label propagation. We’ll be using Louvain and simple degree centrality.

How it works

Every PR review on GitHub is public data: who reviewed whose code, when, and what they said. Most tools treat this as activity metrics — review coverage, cycle time, PRs merged per week. Today we’re treating it as a social graph.

The review graph

Every review event becomes a directed edge: reviewer → author. Review Bob’s PR, you get an edge pointing at Bob. Do it ten times, that edge gets weight. The edge also carries metadata — how quickly the review arrived and how many inline comments.

Only core contributors make it into the graph. If you reviewed fewer than twice in the current window, you’re filtered out. Drive-bys and first-timers don’t define community structure — the regulars do.

Asymmetry — the first signal

In a healthy project, reviewing is roughly reciprocal. Alice reviews Bob. Bob reviews Alice. Not perfectly balanced — nobody’s keeping score — but the flow goes both ways.

When that breaks down, it means something. Alice is consistently reviewing Bob’s work but Bob never looks at Alice’s PRs. Multiply that across a dozen pairs and you have a graph where one group is doing all the reviewing and another group is receiving all the scrutiny. The reciprocity has collapsed.

We measure this as a ratio: of all directed reviewer→author pairs in a rolling 30-day window, what fraction have no reverse pair? Zero means perfectly reciprocal. One means completely one-directional — every reviewer has a distinct set of authors they review, and none of them review back.

The implementation is almost disappointingly simple:

val pairs = edges.map { it.reviewer to it.author }.toSet()
val asymmetric = pairs.count { (r, a) -> (a to r) !in pairs }
val asymmetryRatio = if (pairs.isEmpty()) 0.0 
  else asymmetric.toDouble() / pairs.size

Three lines. That’s the core of the early warning system.

Roll that across weekly-stepped windows and you get a time series. A rising asymmetry trend is the early warning. Sustained asymmetry at 1.0 — as we’ll see with Redis — is the alarm.

This single metric, computed from nothing but the direction of review edges, does about 80% of the detection work. No NLP. No sentiment analysis. No AI (yet). Just: who reviewed whom, and did they review back? Zachary would recognise it instantly. It’s the same signal he found in the karate club — the structure of reciprocity tells you more about an impending split than the content of any conversation.

Community detection — finding the factions

Asymmetry tells you the graph is unbalanced. It doesn’t tell you where the line is. For that, you need community detection — an algorithm that looks at the full topology and says: “these nodes cluster together, and those nodes cluster together, and the two clusters barely talk.”

We’ll be using the Louvain algorithm, and there’s a reason it’s the default choice for this problem. Louvain optimises directly for modularity — the mathematical measure of how cleanly a network separates into communities. High modularity means the groups are dense internally and sparse between each other. That’s exactly the question we’re asking: has this project separated into factions that review within their group but not across the divide?

There are newer community detection algorithms — Leiden fixes some of Louvain’s edge cases around poorly-connected communities, and label propagation is faster on massive graphs. But Louvain has two properties that matter here. First, as said, it produces a modularity score as a direct output, which we use as a signal. When modularity hits 0.50 — the theoretical maximum for two equal communities — that’s not a number you need a PhD to interpret. It means the project has split in half and the halves aren’t speaking. Second, it’s battle-tested on exactly this class of problem.

The weighted review graph — edges scored by anomaly — goes into Neo4j GDS. Louvain assigns every contributor to a community. In a cohesive project you get one community, or several that cross-review freely. In a fractured project you get two or more communities with almost no edges between them. The community assignments tell you not just that the project has split, but who is on which side.

Centrality — measuring “load-bearing capacity” of a contributor

Not all departures are equal. Three TSC members leaving is not the same as fifteen drive-by contributors leaving. We need a way to measure how load-bearing each contributor is.

We use degree centrality — the simplest measure in the book. A contributor’s centrality score is the number of review interactions you participated in, whether as reviewer or author. That’s it.

Graphs have different notions of centrality. PageRank, betweenness, eigenvector. We’re keeping it simple here and that suits our purposes, for now. However, arguably, Eigenvector centrality would be a very good fit here.

When we detect an exodus — a step-change in contributor mass across a rolling window — we weight it by centrality. A 30% drop in raw headcount might be noise. A 30% drop in centrality-weighted mass, sustained across three subsequent windows, means the people who left were the ones doing serious work.

We Haven’t Read A Single Message Yet

As mentioned, we’ve already done 80% of the work, simply by looking at who talks to whom. We haven’t read the content of any messages. If we were an intelligence agency protecting the country, we’d already be most of the way to the finish line with nothing but call logs. We haven’t even asked for a wire-tap yet. Everything described so far — asymmetry, community detection, centrality, exodus detection — is pure graph structure.

You can detect that a fracture is forming, identify the factions, measure the severity, and name the departed contributors. Zachary didn’t need to know what Maryellen and Albert talked about over coffee. He just needed to know they stopped meeting.

But there’s a question the structure can’t answer: what kind of fracture is this?

Time for some Wire-tapping

A project where one faction is nitpicking the other into the ground — blocking PRs with trivial objections, requesting changes on style preferences, tone-policing commit messages — is a different animal from a project where the community is pushing back against a corporate steward’s direction. The first is adversarial. The second is an uprising. The structural signal looks similar in both cases: asymmetry rises, communities separate, reciprocity breaks down. But the intervention is completely different, and so is the likely outcome.

That’s where we cross the 80% line and bring in an LLM. Time for some wire-tapping.

A movie-like montage where an intelligence agency is gathering intel by wire-tapping A movie-like montage where an intelligence agency is gathering intel by wire-tapping

Pair anomaly scoring — finding the suspicious relationships

Before we spend API tokens on comment analysis, we narrow the field. For each reviewer→author pair with at least three interactions, we look at how often the reviewer comments on that author’s PRs relative to the project baseline, adjusted for code quality — if the author’s PRs consistently take twice as long to merge as everyone else’s, heavy commenting is more justified. The anomaly score is the gap that remains after that adjustment.

GitHub does offer structured review states (APPROVED, CHANGES_REQUESTED) via its Reviews API, and using them would make this step more precise. We deliberately don’t. First, the Reviews API was introduced in late 2016 — several of our retrodiction cases (io.js, LibreSSL) predate it, and we want the detector to work on the full historical record. Second, part of the thesis is seeing how far we can get with less signal. Comments exist on every PR back to the beginning of GitHub. If comment frequency alone can surface the suspicious pairs, we don’t need to lean on structured metadata that not every forge provides.

LLM Comment Scoring

For the top anomalous pairs, we fetch the actual review comments from GitHub and ask an LLM to classify each one on two dimensions:

Significance: Is this feedback trivial or important? NITPICKY (style preference, personal taste) → FAIR → VERY_FAIR → ESSENTIAL (security bug, data loss, breaking change). Blocking nature: BLOCKING (PR genuinely shouldn’t merge without this fix) vs NON_BLOCKING (could merge now, fix later).

The faction fingerprint is NITPICKY + NON_BLOCKING + high comment volume. A reviewer who consistently weighs in with objections that even an LLM classifies as trivial and non-critical is not doing code review. They’re doing gatekeeping.

Combined with a sentiment score — hostile to appreciative — this gives us a faction signal per pair. Average that across the crisis period and compare it to the baseline period, and you can distinguish an adversarial fork (faction signal rises during crisis) from an uprising (faction signal drops — the community is pushing back with substantive objections, not petty ones).

The LLM step uses Claude Haiku for classification — fast and cheap, but not a genius. Haiku tends to classify ambiguous comments as FAIR rather than NITPICKY, which slightly suppresses faction signals on marginal cases. Everything comes out in the wash across enough pairs, but it does mean the DetectorWeights are tuned to Haiku’s bias profile. Switch to Sonnet and maybe we’d need to recalibrate.

A key premise of Embabel is the ability to decompose AI into steps and use cheaper or specialized models, in place of one “god model”

Classification

With asymmetry time series, community structure, exodus data, and faction signals in hand, the detector applies a rule set:

  • Find the peak cluster: the contiguous run of windows where asymmetry exceeds the tension threshold
  • Measure the rise: did the peak significantly exceed the pre-cluster baseline? This handles projects like Redis where structural asymmetry bakes in a higher resting level — what matters is how far the peak rose from that baseline
  • Check for resolution: did asymmetry drop back? Did an exodus follow?
  • Classify

In code, the core of it is a single when expression:

val pattern = when {
    !isResolved && peakAsymmetry >= 0.70 -> FRACTURE_IMMINENT
    !isResolved                          -> TENSION
    isResolved && isSharpRise && fractureType != null -> fractureType
    isResolved && isSharpRise            -> GOVERNANCE_CRISIS
    isResolved && isAttrition(exodus)    -> ATTRITION
    isResolved                           -> EXODUS
    else                                 -> STABLE
}

The full classification includes additional gates — minimum cluster sizes, faction signal thresholds, and tunable weights — but the decision tree above is the skeleton.

The confidence score reflects certainty, but its composition varies by classification. For FRACTURE_ADVERSARIAL_FORK, peak asymmetry and exodus scale dominate — the LLM already confirmed the adversarial signal during classification. For FRACTURE_IMMINENT, peak asymmetry, faction formation balance, modularity, and faction signal all contribute. For ATTRITION, confidence reflects departure scale only — how much review capacity walked out — capped at 65% because we never have high confidence that natural churn is a faction event. The architecture reflects the thesis: structure first, content second.

The LLM Narrative

The classification is deterministic. But a label like FRACTURE_IMMINENT doesn’t tell a CTO what to do about it. So we feed the full context — fracture classification, exodus data, rolling asymmetry scores, community assignments, top pair faction signals — into Claude and ask for a 2–3 paragraph analysis: who the factions are, what the risk level is, and what to do about it.

The narrative adapts to the classification. ATTRITION gets succession planning recommendations — bus factor reduction, documented handoffs. FRACTURE_IMMINENT gets governance intervention advice. FRACTURE_ADVERSARIAL_FORK gets a frank assessment of whether a cooperative separation might be less damaging than the status quo.

The confidence score gates the tone. Below 40%, the narrative hedges. Above 80%, it states findings directly. This isn’t cosmetic — a 44% confidence ATTRITION reading (as we’ll see with Babel) should sound very different from a 77% confidence FRACTURE_ADVERSARIAL_FORK reading (as we’ll see with Redis).

Retrodiction results

Let’s run it. Here’s redis/redis analysed from 2021–01–01 to 2023–12–01 — a window that ends three months before the Valkey fork was publicly announced in March 2024:

## Faction Analysis: redis/redis
+-----------------+------------------------------------------+
| Pattern         | FRACTURE_IMMINENT                        |
| Severity        | EXTREME                                  |
| Confidence      | 79%                                      |
| Peak tension    | 2021-06-21 (asymmetry 1.00)              |
| Status          | UNRESOLVED — RISING                      |
| Exodus date     | 2021-03-07                               |
| Mass drop       | 26%  (182.0 → 134.7)                     |
| Core impact     | 1.2% of total project centrality         |
| Departed        | YaacovHazan(28)  uriyage(16)  ny0312(13) |
| Predicted split | 2026-09-19                               |
+-----------------+------------------------------------------+

FRACTURE_IMMINENT at 79% confidence, severity EXTREME, status UNRESOLVED — RISING. The detector saw it coming. Asymmetry hit 1.00 repeatedly across the window — sustained runs of seven consecutive weeks at peak in mid-2022 — and never resolved. The graph was screaming.

Now extend the window to include the fork (2021–01–01 to 2024–09–01), and the same repo returns FRACTURE_ADVERSARIAL_FORK at 75% confidence. The prediction became a retrodiction.

The Node.js trilogy

The most compelling case in the corpus is nodejs/node — the same repository, three different time windows, three different patterns. It tells the full lifecycle of a governance crisis:

NodeJS narrative arc NodeJS narrative arc

That’s the arc of a governance crisis that healed. The io.js fork was adversarial — contributors actively warring in the review stream — but it resolved when the Node Foundation brought both sides back together. The aftershock looked like it might fork again: senior TSC members were leaving, the signal was rising and unresolved. But nobody forked. The tension bled out into normal turnover. By 2018 it was just attrition — people moving on, not fighting. The detector distinguishes all three from the same repository.

The full corpus

The full corpus covers 26 confirmed cases across 15 repos and every fracture type:

Adversarial forks — internal faction wars where contributor groups were actively hostile in the review stream:

  • redis/redis (RSALv2 2020–2021): FRACTURE_ADVERSARIAL_FORK. Licence change triggered faction dynamics visible in review patterns. Core contributors departed to Valkey under the Linux Foundation — and what’s left of redis/redis never settled. It still shows the fork signal today, never settling to ATTRITION
  • nodejs/node (io.js 2013–2015): FRACTURE_ADVERSARIAL_FORK. The classic governance schism.

Uprisings — community unified against a steward, not against each other:

  • moby/moby (Docker Enterprise 2019–2021): FRACTURE_UPRISING. Review signal stayed below baseline — contributors pushing back against Docker Inc’s direction with substantive objections, not petty gatekeeping.
  • hashicorp/terraform (BSL 2022–2024): FRACTURE_UPRISING. Community response to the BSL licence change. OpenTofu fork crystallized the split.

Exodus — coordinated departure without adversarial dynamics:

  • rust-lang/rust (Mozilla layoffs 2020–2021): EXODUS. External corporate event, not internal faction war. 41% mass drop but only 2% core impact — the departed were Mozilla employees, not the volunteer core team.

Attrition — natural contributor lifecycle turnover:

  • babel/babel (2018–2020): ATTRITION. Burnout-driven churn after the Babel 7 release push, not factional dynamics.
  • go-gitea/gitea (2019–2021): ATTRITION. Healthy governance, normal turnover.

Early warnings — FRACTURE_IMMINENT on windows ending before the known fork:

  • redis/redis (2021–2023): 79% confidence, 3 months before the Valkey announcement.
  • hashicorp/terraform (2021–2022): Detected before the BSL licence change.
  • prestodb/presto (2018–2020): Detected before the Trino fork. The parent never healed — even a 3-year window (2018–2021) still returns FRACTURE_IMMINENT at 96%.
  • gogs/gogs (2016–2017): Single-maintainer bottleneck. bkcsoft departed Jan 2016 and co-founded gitea 10 months later. The fork overtook the parent (54k vs 48k stars).

One pattern appears to hold across the cases we’ve tested: contributor departures tend to precede public fork announcements — often by months. The graph shows the breakup before the press release.

RedisGraph contributors departed 10 months before the discontinuation announcement. Docker contributors left before the Enterprise sale. If this holds more broadly, the public fork is the crystallization of a split that already happened in the review graph. But this is early work — 26 cases across 15 repos, built in under a week. I’d love to see it stress-tested on projects I haven’t looked at.

True negatives — the signal gate in action

A detector that fires on everything is useless. The signal gate — which downgrades FRACTURE_IMMINENT to TENSION when the LLM finds no adversarial signal — is what separates genuine fractures from structurally asymmetric but healthy projects:

Tension without fork events Tension without fork events

Kubernetes is the key case. Perhaps the largest project in the corpus. Peak asymmetry of 1.00 and a 38% mass drop — structurally, it looks terrifying. But the faction signal is 0.049, just below the 0.05 threshold. There are no factional dynamics significant enough to trigger a notable fork. The gate holds.

Django is the healthiest signal in the entire corpus — ATTRITION, not even TENSION. Natural contributor turnover under DSF stewardship.

The terraform golden era is telling in a different way. The same repo that returns FRACTURE_UPRISING for 2022–2024 returns TENSION for 2016–2017. The adversarial signal rose from 0.020 to 0.075 over five years. The structural asymmetry was always there — what changed was the tone.

One case we deliberately investigated as a potential false positive: Godot/Redot. The Redot fork (September 2024) was triggered by a social media incident — a “Wokot” tweet and mass-blocking of users on Twitter. It generated enormous online controversy. But no core Godot contributors defected to Redot (5.8k stars vs Godot’s 108k, 100% new volunteers). The detector sees elevated tension in Godot’s review graph — but that appears to be structural (small core team reviewing thousands of community PRs) rather than factional. The social media firestorm didn’t register in the code review stream. The graph watched what people did, not what they said.

The tool measures if a fork event is significant enough to be a threat to the original repository, not if one exists at all. (After all, anyone can just click the fork button :) )

Beyond GitHub: process theater and structural decay

Not every fracture is someone acting in bad faith. Sometimes it’s genuinely different visions of the future — reasonable people who’ve reached irreconcilable conclusions about where a project should go. Sometimes it’s power-seeking. Sometimes it’s a corporation exercising rights the community didn’t know it had. The review graph doesn’t tell you who’s right. It tells you the structure has separated, and the separation is accelerating.

Process Theater

There’s a specific phenomenon this data can surface: process theater — when formal processes stop serving their stated purpose and start serving a hidden agenda. A CHANGES_REQUESTED that’s really a territory marker. A review that’s technically about code style but functionally about who gets to ship. The process looks the same from the outside.

The tool doesn’t identify process theater. It shows you the graph structure — the factions, the asymmetry, the patterns of who blocks whom — and a well-informed user decides whether what they’re seeing is legitimate disagreement or something else. The graph doesn’t know the difference. But it gives you the information to make that call.

Generalizing Beyond Open Source

Perhaps we can generalize beyond open source? The same structural signal — who interacts with whom, how reciprocal it is, when the reciprocity breaks — appears anywhere formal processes mediate human collaboration. Possible targets:

Academic peer review. The review graph for a journal or conference has the same structure: reviewer → author, directed, weighted by outcome. When a body undergoes regulatory capture — a clique of reviewers systematically blocking work from outside their school of thought — the asymmetry signature is identical. Astro-turfing, manufactured consensus and fake news. Social media platforms have engagement graphs: who upvotes whom, who amplifies whom. Organic communities have the messy reciprocal structure of real relationships. Astro-turfed campaigns — bot networks making something look grassroots — produce the characteristic one-directional topology: many nodes amplifying a few, with no reverse flow. The Zachary signal, again. Corporate governance. Board votes, committee assignments, budget approvals. When a faction forms inside an organization, the approval graph shifts before anyone writes an angry email.

Why this matters now

We’re entering an age where system integrity matters more than ever.

The systems that let humans coordinate at scale — democratic process, regulatory oversight — work because participants mostly act in good faith, and bad faith is eventually detected. AI changes that equation. It makes bad faith cheaper and harder to spot at the content level. You can generate plausible-sounding review objections.

You can flood a council development consultation with LLM-generated objections that each reference specific planning codes, cite different concerns, and read like they came from independent ratepayers. At the content level, they’re indistinguishable from genuine community feedback. But graph watches how people are aligned, not what they say.

Content-level defences — reading comments harder, training moderators, building better spam filters — are in an arms race they will increasingly lose. Structural analysis is a different kind of defense. You can fake a comment. You can’t easily fake a social network topology that looks organic over months.

Zachary figured this out in 1977 with a clipboard and a karate club. The tools are better now. The insight is the same: the faction is in the graph before anyone announces it. You just have to be looking.

This post exists to show what’s possible when you combine Embabel’s agentic AI framework with Neo4j’s graph analytics. The model was developed over days, not months, and holds up well. But it’s a sample application, not a product. We invite you to try it, along with the other Embabel sample applications. We make no warranty on fitness for purpose. This one’s a fun curiosity.

← All posts