Watch Madu explain it in two minutes

Knowledge about your code, from the terminal.

Kimün measures the health of a project with one command: it gives you a grade, tells you which files need attention, and how far each change reaches before you merge it.

cargo install kimun

why this name?

Madu, the mascot of Kimün: a pudú wearing a pink headband
km score
$ km score

 Project Score:  A (91.7)
 Files Analyzed: 141
 Total LOC:      19,075

 Dimension                 Weight   Score   Grade
 Cognitive Complexity         30%    84.2   B+
 Duplication                  20%   100.0   A++
 Indentation Complexity       15%    93.1   A+
 Halstead Effort              20%    87.5   A-
 File Size                    15%   100.0   A++

 Files Needing Attention
  60.7  D    src/deps/analyzer.rs      Cognitive: 36
  63.8  D+   src/cogcom/analyzer.rs    Cognitive: 35
  72.4  C    src/smells/rules.rs       Cognitive: 20

real output: kimün measuring itself

What it measures

Six ways to know your code

Each one answers a different question, and they all come from the same program.

01

A grade for the project

From A++ to F--, out of five dimensions: cognitive complexity, duplication, indentation, Halstead effort and file size. Plus the list of files worth looking at first.

$ km score
 Project Score:  A (91.7)
 Files Analyzed: 141
 Total LOC:      19,075
02

A command for each measure

Lines of code in more than sixty languages, duplicated code, cyclomatic and cognitive complexity, maintainability index, code smells, dependencies between files and a map of the code as nested circles.

$ km loc
 Language     Files   Blank  Comment    Code
 Rust           140    2637     3885   20170
 Markdown         4     953        0    2627
 YAML             3      35        1     174
03

The history, read from git

Hotspots: complex files that change often. Knowledge map: who owns each file. Temporal coupling: files that always change together, even when the code does not say so.

$ km hotspots --top 3
 File            Commits  Total Indent  Score
 src/main.rs          67          1259  84353
 src/cli.rs           36           588  21168
 src/git/mod.rs       22           808  17776
04

The impact of a change

Before you merge, ask what your change reaches: which files call the functions you touched, which of them have tests, and where one is probably missing.

It works today for C, C++, C#, Elixir, Go, Java, JavaScript/TypeScript, Kaikai, Python, Ruby and Rust. In Elixir and Python it also narrows the change to the functions you touched.

$ km impact --since-ref main
 3 files call what changed, 1 of them with no test
 Changed: lib/shop/orders.ex
 Functions: total

 Tests  Dependent
  none  lib/shop/workers/report_worker.ex
     1  lib/shop/cart.ex
     1  lib/shop/receipt.ex

No test reaches 1 of the files that call what changed;
an integration test is probably missing
05

A gate in CI

It compares your branch with the main one. If a file gets worse or duplicated code grows, the change does not pass.

$ km score --trend main --fail-if-worse \
           --gate-scope changed
error: quality gate failed:
  src/cart.rs dropped 88.73 → 86.62 (-2.11),
  below the project score and more than
  the 0.5 tolerance
06

Built for coding agents

Every command that measures can answer in JSON, and one command installs a skill so your agent measures before it changes anything.

$ km ai skill claude
$ km score --format json
{
  "score": 91.72,
  "grade": "A",
  "files_analyzed": 141,
  "dimensions": [ … ]
}

Video

Kimün, explained by Madu

Two minutes on what it measures, how you use it and why it matters. Madu is a machi: the one who holds the knowledge of her people.

Míralo en español

Commands

Everything km brings

The commands that measure take a path and, with --format json, answer for a machine.

Static metrics

km score
The overall grade of the project, from A++ to F--
km loc
Lines of code, comments and blanks by language
km dups
Duplicated code across files
km cycom
Cyclomatic complexity per file and per function
km cogcom
Cognitive complexity per file and per function
km indent
Indentation complexity
km hal
Halstead metrics
km mi
Maintainability index, in two variants (mi and miv)
km smells
Code smells: long functions, magic numbers, pending debt
km deps
Dependencies between files and their cycles
km docs
Dead references, the graph of notes, agent context, and documents behind the code
km infra
Security smells of infrastructure code: secrets, root, open addresses, unpinned images
km map
The code as nested circles, coloured by a metric
km report
One report with every metric together

History in git

km hotspots
Complex files that change often
km churn
How much each file changes
km knowledge
Who owns each file, and where the risk is
km authors
Summary by author
km tc
Files that change together
km impact
What a change or a pull request reaches
km age
Active, stale or frozen files

Tools

km init
Creates a .kimun.toml calibrated for your project
km ai
Skill and analysis for coding agents
km completions
Completions for your shell

Shall we try it?

It installs with one command and needs no configuration. Start with km score in the folder of your project.

cargo install kimun
⌂ 换网址