Documentation · Getting started
Configuration
The .kimun.toml file: thresholds, quality gates and how to generate it with km init.
Run km init to analyze your project and generate a calibrated .kimun.toml in one step:
$ km init
Analyzing project... done.
Current state:
avg function length: 38 lines → suggested max_lines = 45
avg param count: 3.2 → suggested max_params = 4
dup ratio: 4.1% → suggested max_dup_ratio = 5.0
health score: B+ → suggested fail_below = B
Write .kimun.toml with these values? [Y/n]
Use --yes to skip the prompt. Add -y in CI to write the file non-interactively.
Alternatively, place a .kimun.toml file manually in the root of your repository to set project-level defaults for thresholds and quality gates. km searches for the file at the git repository root, falling back to the current directory.
CLI flags always take precedence over .kimun.toml, which in turn takes precedence over built-in defaults.
[smells]
max_lines = 30 # flag functions longer than N body lines (default: 50)
max_params = 3 # flag functions with more than N parameters (default: 4)
[dups]
min_lines = 8 # minimum block size for duplication detection (default: 6)
# also applies to `km report` and `km score`
max_duplicates = 10 # CI gate: fail if duplicate groups exceed N
max_dup_ratio = 5.0 # CI gate: fail if duplicated-lines ratio exceeds this %
[score]
model = "cogcom" # scoring model: cogcom (default), cogcom-0.35 or legacy
fail_below = "B-" # CI gate: fail if health score is below this grade
[age]
active_days = 60 # files modified within N days are Active (default: 90)
frozen_days = 180 # files not modified for more than N days are Frozen (default: 365)
[tc]
min_degree = 5 # minimum commits per file to include in coupling analysis (default: 3)
min_strength = 0.5 # only show pairs with coupling strength >= this value
[hotspots]
complexity = "cogcom" # complexity metric: indent (default), cycom, or cogcom
[map]
llm_friendly = 95 # km map --color-by llm: from this score a file is LLM-friendly (default: 95)
llm_risk = 70 # below this score it is an LLM risk (default: 70)
[impact]
inert = ["scripts/**"] # changed files that reach nothing, besides documentation
entry_points = ["**/endpoint.ex"] # files run rather than used, besides tasks and scripts
[docs]
covers = { "apps/payments/**" = "kb/payments/**", "lib/billing/**" = ["kb/billing.md"] } # code and the documents that describe it
ignore = ["docs/adr/**"] # documents that never need to follow the code
[exclude]
dirs = ["vendor", "third_party"] # directory names, at any depth (as --exclude-dir)
extensions = ["sql", "proto"] # file extensions (as --exclude-ext)
patterns = ["legacy/**", "*.min.js"] # globs from the analyzed directory (as --exclude)
[exclude] leaves files and directories out of every command, besides what .gitignore already does. Unlike other values it does not give way to flags: it adds to --exclude-dir, --exclude-ext and --exclude, and --list-excluded shows what it leaves out. Patterns are matched against the path relative to the analyzed directory, as --exclude is.
[kinds] declares the kind of files by glob, against the path relative to the analyzed directory, before what their language and path say. With separate = true, infrastructure is no longer measured as code unless --kind asks for it.
[kinds]
separate = false # true: Terraform and Dockerfiles are not measured as code (default: false)
docs = ["notes/**"] # these files are docs, whatever their extension
infra = ["deploy/**/*.yml"]
All sections and fields are optional — omit any you don’t need. A fully documented template is available at .kimun.toml.example.