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.0)
 Files Analyzed: 127
 Total LOC:      18,594

 Dimension                 Weight   Score   Grade
 Cognitive Complexity         30%    83.6   B+
 Duplication                  20%    97.3   A++
 Indentation Complexity       15%    93.5   A+
 Halstead Effort              20%    87.4   A-
 File Size                    15%    99.6   A++

 Files Needing Attention
  57.9  D-   src/deps/analyzer.rs      Cognitive: 36
  63.9  D+   src/cogcom/analyzer.rs    Cognitive: 35
  72.3  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.0)
 Files Analyzed: 127
 Total LOC:      18,594
02

A command for each measure

Lines of code in more than forty languages, duplicated code, cyclomatic and cognitive complexity, maintainability index, code smells and dependencies between files.

$ km loc
 Language     Files   Blank  Comment    Code
 Rust           126    2490     3502   18579
 Markdown         3     562        0    1394
 YAML             3      36        1     179
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.

The function-level radius works today for Elixir, JavaScript/TypeScript and Kaikai.

$ 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 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": 90.98,
  "grade": "A",
  "files_analyzed": 127,
  "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

Every command takes a path and, with --format json, answers 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 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