community-detection

community-detection is a command for Claude Code from MattArtzAnthro/gephi-ai. It costs 9 tokens per session (999 once invoked), scanned A, original, Apache-2.0.

A Gephi command for finding communities in a network, where a community is a group of nodes with relatively many connections within the group. It also visualizes the detected groups.

In plain words
What is it for?
Use it to detect and display communities with Louvain, Leiden when available, or stochastic block model inference.
Why use it?
It helps reveal clusters that may be difficult to see in an unprocessed network.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the gephi-network-analysis plugin — 1 skill, 11 commands, 4 agents, 1 hook, 1 MCP server shipped together

Good fit Use it to detect and display communities with Louvain, Leiden when available, or stochastic block model inference.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/mattartzanthro/gephi-ai/community-detection
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/MattArtzAnthro/gephi-ai

Made for: Claude Code.

Or install gephi-network-analysis, the plugin that ships this one along with the rest of its 1 skill, 11 commands, 4 agents, 1 hook, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for community-detection

README.md
[![agentmods](https://agentmods.dev/badge/commands/mattartzanthro/gephi-ai/community-detection.svg)](https://agentmods.dev/commands/mattartzanthro/gephi-ai/community-detection)
Your own site
<a href="https://agentmods.dev/commands/mattartzanthro/gephi-ai/community-detection"><img src="https://agentmods.dev/badge/commands/mattartzanthro/gephi-ai/community-detection.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 999 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00009 $0.00999
Opus 5 $0.00005 $0.00500
Sonnet 5 $0.00002 $0.00200
Haiku 4.5 $0.00001 $0.00100

Measured 8d ago against content hash 14424287852c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

community-detection scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/claude-code/commands/community-detection.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Community Detection Workflow

Run a complete community detection and visualization workflow on the current Gephi graph.

Tell the user what you're doing at each step — narrate briefly before each tool call.

Steps

  1. Health check: Call gephi_health_check. If it fails, tell the user to start Gephi and stop.

  2. Graph info: Call gephi_get_project_info. Tell the user the node/edge counts.

  3. Ask which method (skip if $ARGUMENTS names one or the user already said). One question, with the trade-off stated plainly:

    • Louvain (Gephi's built-in Modularity; Blondel et al. 2008): maximizes modularity by greedy local moves. Fast and familiar; the default.
    • Leiden (Traag, Waltman, and van Eck 2019): the same objective with a refinement step that guarantees every community is internally connected and converges more reliably. Its partitions can be more uneven in size. Requires the CWTS Leiden plugin in Gephi; check gephi_list_statistics for "Leiden algorithm" before offering it as available.
    • Stochastic block model inference (Peixoto 2019): fits a generative model of the edges and selects the partition that best explains them, with model selection that returns a single block when the data support no structure. Modularity maximization has no such check and returns a partition for any graph, including a random one. SBM inference is not implemented in Gephi; if the user wants it, say so and point to graph-tool (minimize_blockmodel_dl) outside this workflow.

    Frame the choice as: modularity maximization gives a partition that describes how the observed edges cluster; SBM inference tests whether a block structure is supported at all. Cite the papers in the caption when the map is publication-bound.

  4. Compute communities:

    • Louvain: call gephi_compute_modularity with resolution $ARGUMENTS resolution (default 1.0). Note Gephi's resolution runs opposite to the gamma convention in most papers: raising it merges communities.
    • Leiden: call gephi_run_statistic with name="Leiden algorithm" and params={"algorithm": "Leiden", "qualityFunction": "Modularity", "resolution": <resolution>}; the result column is what the plugin reports (check gephi_get_columns and use that name in step 6). Tell the user: "Running community detection..." then report the modularity score and number of communities.

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 78 lines · 9 tokens per session scan A 14424287852c

Subscribe to this mod's changes

community-detection is a command published in the GitHub repository MattArtzAnthro/gephi-ai (22 stars, last pushed 6d ago), licensed Apache-2.0. It adds 9 tokens to every session and 999 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.