← Market Pulse · Nov 21
cccc: a Rust tool that measures cognitive complexity and cyclomatic complexity of codeGitHub · created May 2026 · original page ↗
Stars / day new0 → 84

Veteran complexity metric makes a comeback thanks to one AGENTS.md rule

What it isCommand-line tool that measures cognitive and cyclomatic complexity of every function in 20+ languages with one command.

Why it grewAndré Staltz posted about using it to stop AI from writing junk tests: 33K views.

What to takeWraps an old metric into one command plus one threshold, so it can go straight into AGENTS.md.

Who built itmoznion, a Tokyo engineer and longtime open-source authorHow it makes moneyFree, MIT open source, no path to revenueStaying powerHard to say: the star jump came from one post, but people really are running it in CI
We ran it on the zod source: 36 ms to list the 8 most complex functions; with a threshold added, anything over the limit gives a non-zero exit

Positioning and edge

Who it's forEngineers who write code with AI agents and need to keep quality in checkThe job it doesScores every function for complexity and stops CI or the agent when a function goes over the limitWhat people did beforeInstall one plugin per language, or bring in the whole SonarQube suiteThe wedgeOne binary for many languages, JSON output, non-zero exit when over the limit

How it differs from the rest

  1. Gives AI agents a numeric threshold they can followStaltz's rule: cognitive complexity ≤5 means no test needed, >40 means refactor; over the limit means non-zero exit
  2. One binary measures cognitive complexity in 20+ languagesgocognit only does Go, complexipy only does Python
  3. Fast enough to run on every commitTested on the zod source: 333 files, 8,640 functions in 36 ms; faster still with caching
  4. Easy to wire into CI for ongoing trackingOfficial Action hooks in with one line; yuuk1: "Installed on about 15 repos, convenient"

Who else is in the space

Similar productHow it differs from this one
SonarQube / SonarJSThe inventor of cognitive complexity, an enterprise platformNeed the whole suite or an ESLint plugin; cccc's own benchmark is 117x faster
lizardVeteran multi-language complexity tool, about 2,600 starsOnly computes cyclomatic complexity, no cognitive complexity
complexipyCognitive complexity tool, about 920 starsPython only; cccc runs a mixed-language directory in one pass
sccLines-of-code counter, about 8,900 starsCounts keywords per file, doesn't parse syntax, no function-level scores

Can it hold?Can't be defended: the algorithm is public and parsers are off the shelf. All that's left is first-mover word of mouth and the name in the rule.

Last two weeks · Stars / day
11-0811-1111-1411-188411-21

How it happened

  1. moznion commits the first line of code, creates the public repo the next day ↗

  2. The author talks about "cccccc" at an in-person event in Tokyo; an attendee forks it on the spot and adds Python ↗

  3. v1.0.0: per-language binaries merged into a single cccc, with a config file ↗

  4. 5 releases in two weeks; community contributions take languages from 4 to nearly 20 ↗

  5. v1.8.0 adds C# and VB.NET; 484 stars on Oct 28 ↗

  6. Staltz first mentions it: setting rules for AI, cccc cap of 42 ↗

  7. Japanese engineer yuuk1 posts: installed on 15 repos, 33 likes, +11 stars the next day ↗

    An earlier small bump: Japanese engineer yuuk1 said he installed it on about 15 repos and tracks them continuously with octocov
  8. Staltz posts about using cccc to stop AI writing junk tests: 384 likes, 33K views ↗

    The trigger: André Staltz's post, which turned cccc into a rule in AGENTS.md (the screenshot is in US Pacific time, early morning Nov 20 Beijing time)
  9. +84 stars in one day to 606; at agent users' request, the author takes a PR adding Bash ↗

    An issue the day after the post: someone already has their AI agent run cccc before writing tests, and asks for Bash support

In detail

What it's like to use

Download a roughly 5 MB archive, unpack a single binary, and run cccc --table --top-cognitive 8 src/ against a directory. It assigns each file to the right parser by extension and outputs two numbers per function: cognitive complexity (the SonarSource rules, where deeper nesting and more tangled logic score higher) and cyclomatic complexity (McCabe). We tried it on the zod source: 333 files, 8,640 functions, results in 36 ms, and the most complex function has a cognitive complexity of 193. Add --max-cognitive 15 and it exits non-zero whenever any function goes over, so CI can go red and an AI agent knows "this needs refactoring." Thresholds go in cccc.toml, and the official GitHub Action hooks in with one line.

What people actually choose it for is "a number an agent can follow"

Speed and multi-language support are the author's own selling points: the README says it's 117x faster than ESLint + SonarJS on zod (author's own test, Apple M4 Pro). But speed isn't what took it mainstream. André Staltz (author of Cycle.js, 6,000+ followers on GitHub) was making a different point in his post: AI loves piling tests onto functions that are obvious at a glance, so he added a line to AGENTS.md, "don't write tests for functions with cccc cognitive complexity ≤ 5, except those containing regex," and added in a reply, "refactor if cccc > 40." Someone in the replies put it more bluntly: "The clever part is turning a judgment call into a number. The agent doesn't have to decide what counts as trivial, it just measures." The next day someone filed an issue asking for Bash support, with the reason, in their words: "We have our AI agent measure complexity with cccc before writing tests." In Japan it started earlier: on Nov 9 engineer yuuk1 said he'd installed it on about 15 repos, "convenient."

There was pushback under the same post: the most-liked reply was "complexity doesn't decide whether something needs a test," and several people pointed out that permission checks and boundary validation need tests no matter how simple they are. The rule is contested, but the argument itself is helping it spread.

Discount this surge

The 84 stars came from one post with 33K views, about one star per 400 views, a very small absolute number; after the jump it's still only 606 stars. Over the previous 174 days it grew slowly, mostly among Japanese engineers, and had 484 stars on Oct 28. A better sign that people really use it is another number: the binaries on GitHub Releases have been downloaded about 147,000 times, 96% of them the Linux build. That's basically one pull per CI run, so it counts runs, not users; a rough search on GitHub finds about 47 workflows using its Action. The command-line package on crates.io has only about 2,300 downloads.

Money, and whether to follow

There's no money. MIT license, no paid tier, not even a sponsor link in the repo (in October a user called on X for him to open GitHub Sponsors). The author is an engineer with a day job, and this is a side tool. The algorithm comes from a public paper and the parsers are all off the shelf, so anyone who wants to copy it could do it in a few weeks. Don't treat "build another complexity tool" as a business.

What's worth taking is the playbook: now that AI writes code, many old code metrics (complexity, duplication, dependency depth) suddenly have a new use as guardrails for agents. Make an old metric into a single binary, JSON output by default, non-zero exit when over the limit, add a rule that can be pasted straight into AGENTS.md, and distribution is handed to everyone who copies that rule. To make money you'd have to build on top: cross-repo trend dashboards, team threshold management, automatic PR comments. Those are the places people would pay.

The author's own comparison: computing the same two complexities, 117x faster than ESLint + SonarJS; lizard only does cyclomatic complexity, scc doesn't parse syntax