Catch pipeline bugs before they leave your laptop.

Some pipeline bugs are syntactically fine and pass their tests. They break only when the code runs somewhere other than the author's laptop. kv-cli catches them before the code leaves the workstation.

View on GitHub

MIT · single binary · no account · no network call

kv-cli 0.16.1 · acme-pipelines

A recorded terminal session with captions. kv-cli init writes .kovallent.yaml. kv-cli audit on jobs/load_orders.py fails with 2 errors and 2 warnings: a hardcoded DB_PASSWORD, shown redacted; a pinned S3 path; and run_load missing the target_environment and dry_run parameters. kv-cli fix adds both parameters, moves the password to os.environ and says to rotate it, git diff shows the change, and a second audit passes with the S3 path left as a warning.

A real kv-cli 0.16.1 session, recorded with asciinema and captioned: init, audit, fix, git diff, then audit again.
Read a session as text
$ kv-cli init
created ./.kovallent.yaml
  · required parameters: target_environment, dry_run
  · secret detectors: 9 name patterns, 15 value patterns (detector set 2)
  · contract 4bc0fc3192e4e992
  · framework profiles: dbt, polars, flink, databricks, snowpark, airflow (auto-detected per file)

Next: kv-cli audit

In your editor: the kv-cli extension for VS Code and Cursor shows findings as you save.
  https://marketplace.visualstudio.com/items?itemName=kovallent.kv-cli-vscode

$ kv-cli audit --strict samples/deploy.py
kv-cli audit  .kovallent.yaml  1 file
  · contract 4bc0fc3192e4e992
  · functions: 7 in scope, 0 framework-exempt, 2 user-exempt, 1 out of scope

samples/deploy.py
    11  error  KV002  `DB_PASSWORD` is assigned a hardcoded literal
        value "s3…" (<redacted>, 20 chars) - load it from the environment or a secret store
    20  error  KV001  `deploy_service` is missing contract parameter `target_environment`
        expected signature to declare `target_environment: str = "dev"`
        in scope: name matches applies_to.name_patterns "deploy*"
    …

  · files: 1 failing, 0 warning-only, 0 clean, 0 skipped
FAIL 13 errors, 6 warnings (19 gating under --strict)

$ kv-cli fix samples/deploy.py
kv-cli fix

samples/deploy.py
  + added `target_environment` to deploy_service()
  ~ `DB_PASSWORD` now reads os.environ["DB_PASSWORD"]
    …

  manual: samples/deploy.py:90 `password` has a hardcoded default; move the lookup into the body so it is read per call, not at import time
FIXED applied 18 changes across 1 file
    …

Real session from the kv-cli README, shortened where marked …

Install kv-cli

A 500-file repository takes about 0.3s on 8 cores.

pip install kv-cli
uv tool install kv-cli

Wheels for Linux x86-64 and ARM64 (glibc and musl), macOS Apple silicon and Intel, and Windows x86-64, with no Rust toolchain needed. On any other platform, pip builds from source, which needs Rust and a C compiler.

Built for AI coding agents Available

kv-cli mcp serves kv-cli's checks to Claude Code, Cursor, VS Code and any other Model Context Protocol client, as tools they call directly instead of running kv-cli in a shell and parsing its output. It is a subcommand of the kv-cli you already install, from 0.16.0, so the agent, your editor, pre-commit and CI run the same rules at the same version.

Set up your clientkv-cli 0.16.0 or later

1. Install kv-cli as usual and check that your client will find it:

kv-cli --version

If your editor doesn't inherit your shell's PATH, use the full path to kv-cli (from which kv-cli) as the command below.

2. Add the server to your client. Each configuration starts kv-cli mcp in your repository.

Add it for yourself, in the current project:

claude mcp add --transport stdio kv-cli -- kv-cli mcp

To share it with your team, add --scope project, or commit this as .mcp.json at the repository root:

{
  "mcpServers": {
    "kv-cli": {
      "type": "stdio",
      "command": "kv-cli",
      "args": ["mcp"]
    }
  }
}

Claude Code asks each person to approve a project-scoped server before using it. Check the connection with claude mcp get kv-cli.

3. Check that it works. Ask the agent to run kv-cli's contract_show tool. The result starts with # effective contract: and the contract's path. If it says built-in defaults, set the working directory (cwd) in the client's configuration to your repository.

Seven toolseach runs its CLI command's code
The tools kv-cli mcp provides
ToolWhat it does
auditThe JSON output of kv-cli audit --format json, plus exit_code and verdict
explainA rule's reference, KV001 to KV004
contract_showThe effective contract and its fingerprint
contract_checkValidates the contract, each problem with its line
frameworksThe built-in framework profiles
fix_previewThe fix as a unified diff, values redacted, with a preview_id
fix_applyApplies one preview, once, within 10 minutes, if nothing changed since

Only fix_apply writes. It never touches .kovallent.yaml, and it refuses unless every file and the contract are as they were at preview time.

What an agent can't dothe gate stays kv-cli's
  • Change the contract. No tool writes .kovallent.yaml, runs init or takes a contract override.
  • Touch the pin or declare a pass. No tool reads or sets the fingerprint pinned in CI, or waives a finding. A pull request passes only when kv-cli exits 0 in CI.
  • See a credential. Every result, every line of a fix preview included, redacts values as the terminal does.
  • Leave the workspace or the machine. Paths must resolve inside the workspace, and the server makes no network call: no listening socket, no account.

The server isn't a sandbox: an agent with its own shell can still edit any file. What catches a weakened contract is the pinned fingerprint in CI, which fails the run with exit 3.

Read the MCP guide

Findings in VS Code and Cursor, as you save

The Kovallent kv-cli extension shows each finding on its line and in the Problems panel. It runs the kv-cli you installed, so the editor, your pre-commit hook and CI all run the same version.

orders_job.pyVS Code
Illustration of the extension on samples/orders_job.py from the extension's repository. The file, the two findings and the status bar text kv-cli: 2 warnings come from the kv-cli output recorded in the extension's test fixtures; the window around them is a mock of VS Code.
kv-cli-vscode v0.1.5MIT
  • Findings appear when you open or save a file, never on a keystroke. Each is underlined on its line and listed in the Problems panel, with the rule code linked to its documentation. kv-cli reports lines, not columns, so the whole line is underlined.
  • The status bar describes the active file: clean (2 enforced), nothing enforced, credentials only, or its error and warning counts. It never calls a single file "compliant".
  • Apply a fix with a preview. On a KV001 or KV002 finding, the extension shows the output of kv-cli fix --dry-run and writes only after you confirm.
  • It uses the kv-cli you installed and never downloads one. It makes no network call and collects nothing.
  • Safe in untrusted workspaces. In Restricted Mode it ignores a workspace-level kovallent.path, because a cloned repository could point it at any program.

Needs kv-cli 0.9.0 or later, and 0.14.0 or later to check dbt SQL models. Extension README

Where it runs

One binary and one contract, shared by every stage. The earlier stages are where a finding is cheapest to fix; the CI gate is what guarantees it.

  1. Stage 1Advisory

    VS Code / Cursor

    The kv-cli extension shows findings as you save, in VS Code and Cursor. Or run kv-cli audit and kv-cli fix in a terminal.

  2. Stage 2Advisory

    Pre-commit

    kv-cli-pre-commit audits staged files. --no-verify skips it: a finding is cheapest to fix here, and the CI gate is what guarantees it.

  3. Stage 3Required check

    CI gate

    The GitHub Action, GitLab CI/CD component or CircleCI orb, gating on kv-cli's exit code. As a required status check it is the one stage a contributor can't skip. Whoever can edit the workflow can drop it, so protect the workflow with CODEOWNERS.

  4. Stage 4Ships

    Merge

    With the gate required, a pull request merges only when the audit exits 0.

What kv-cli catches

Three kinds of bug that only show up outside the author's laptop, and a fourth rule that checks function names against your own conventions if your contract sets any.

1Error

KV001

Missing parameter

A governed function missing a required parameter such as target_environment.

Severity is set per parameter. In the default contract, target_environment is an error and dry_run is a warning.

    20  error  KV001  `deploy_service` is missing contract parameter `target_environment`
KV001 reference →
2Error

KV002

Hardcoded credential

A hardcoded credential, in code, notebooks or config.

    11  error  KV002  `DB_PASSWORD` is assigned a hardcoded literal
        value "s3…" (<redacted>, 20 chars) - load it from the environment or a secret store
KV002 reference →
3Warning

KV003

Pinned infrastructure

Infrastructure pinned to one environment: a warehouse, bucket, cluster ID or endpoint.

    20  warning  KV003  `warehouse` is pinned to `PROD_WH`
KV003 reference →
4Warning

KV004

Naming rule

Off by default

A function name that breaks a naming rule in the contract. There are none by default, so KV004 reports nothing until your contract sets a naming rule.

    14  warning  KV004  `LoadOrders` does not match naming rule `pipeline_functions`
KV004 reference →

Every result shows what was checked

The scope line is the denominator behind the result. Without it, a repository where every function is framework-owned would look identical to one that complies, so a pass without its scope can't be trusted.

Scope linekv-cli audit --strict samples/deploy.py
  · functions: 7 in scope, 0 framework-exempt, 2 user-exempt, 1 out of scope
7
in scope
0
framework-exempt
2
user-exempt
1
out of scope

A low in scope count next to a high framework-exempt count means a framework owns those signatures: the exemption is working, not missing things. kv-cli audit --show-clean names each clean file with its own scope.

Exit codes your CI can act on

Exit codes are a stable interface, and each one is a problem for a different owner.

kv-cli auditexit code
kv-cli exit codes and who each one goes to
ExitResultGoes to
0PassNo one: the code complies
1FindingsThe pull-request author
2Tool errorWhoever operates the gate
3Contract driftWhoever owns the contract

"No files to audit" is a tool error, not a pass. Contract drift outranks findings, because the findings were computed against the wrong rules. An empty or malformed --expect-contract is 2, never a pass.

Stop a pull request from weakening the rules

The contract is the policy, so a pull request that edits .kovallent.yaml could switch off the checks meant to stop it. Pin the contract's fingerprint and any change to a rule fails the gate with exit 3, while reformatting or editing a comment does not.

.kovallent.yaml · pull requestdiff
 # .kovallent.yaml, changed in the pull request
 secrets:
-  enabled: true
+  enabled: false
kv-cli audit --expect-contractExit 3
$ kv-cli audit --expect-contract 4bc0fc3192e4e992
…
CONTRACT DRIFT the local contract is not the one this repository pins
  expected  4bc0fc3192e4e992
  local     0d4d3e172ba45264
  findings above were computed against the local contract
  this is not a code failure - it escalates to whoever owns the contract

Recorded with kv-cli 0.16.1 on samples/deploy.py, after kv-cli init and the edit on the left, with the findings shortened at …. The check is described in the kv-cli README.

The pin lives outside the repository, in an organization variable that pull-request authors can't edit: committed to the repository, whoever weakens the contract could update the lock in the same commit. Contract pinning

Redacted in the output, moved out of the code

A tool that prints credentials into CI logs has moved the leak, not closed it. kv-cli shows only the first characters and the length.

Audit · KV002audit
    11  error  KV002  `DB_PASSWORD` is assigned a hardcoded literal
        value "s3…" (<redacted>, 20 chars) - load it from the environment or a secret store

Since 0.15.0, kv-cli init turns on detector set 2, which adds Azure Storage account keys, Databricks personal access tokens and SendGrid API keys to the built-in shapes.

kv-cli is not a secret store. It never fetches or holds a credential; it reports one written into the code and moves it to the environment.

Fixkv-cli fix
$ kv-cli fix samples/deploy.py
kv-cli fix

samples/deploy.py
  + added `target_environment` to deploy_service()
  ~ `DB_PASSWORD` now reads os.environ["DB_PASSWORD"]
    …

  manual: samples/deploy.py:90 `password` has a hardcoded default; move the lookup into the body so it is read per call, not at import time
FIXED applied 18 changes across 1 file
    …

fix rewrites code on purpose; run kv-cli fix --dry-run first to see the changes. It leaves a hardcoded default as a manual: item, because os.environ[...] in a default is read once, at import time.

Afterwards, rotate the credential: a value that was ever committed is still in git history.

Supported frameworks

Each profile applies only to files that use the framework, detected from imports. That scoping is what makes aggressive rules safe: warehouse would be noisy everywhere, but in a file that imports snowflake it is precise.

Six profileskv-cli frameworks
kv-cli framework profiles
ProfileDetected byContributes
dbtdef model(dbt, session)Owns the model signature; profiles.yml credentials
polarsimport polarsstorage_options credentials; object-store paths
flinkimport pyflinkOwns @udf/@udtf/@udaf; broker and JDBC endpoints
databricksimport dlt / databricks / pysparkOwns @dlt.table/@dlt.view; PATs; workspace URLs, cluster IDs, DBFS paths
snowparkimport snowflakeOwns @sproc/@udf; account, warehouse, role
airflowimport airflowOwns @dag/@task_group/@setup/@teardown; governs @task (report-only); Fernet keys; conn_id, pool, queue

dbt SQL models are checked for pinned infrastructure (KV003): hardcoded three-part names, USE WAREHOUSE and USE DATABASE, and object-store paths in COPY INTO and LOCATION. Names built in Jinja, hooks, config() arguments, credentials in SQL and .sql files outside a dbt project are not checked.

Databricks asset bundles (databricks.yml and the files it includes) are checked for pinned infrastructure outside targets: and variables:.

Python gets every rule. Notebooks and config files (YAML, .env, TOML, INI/.cfg, JSON) get credential checks. SQL gets KV003, in dbt models only.

How kv-cli compares

Every cell is checked against each tool's own documentation. "Partial" and "No" are footnoted; "—" means the documentation doesn't say (note 1).

Already using Ruff and pre-commit? Keep them.

Ruff checks that Python is well-formed and consistently styled, with lint rules and a formatter. kv-cli checks that pipeline code is portable across environments, against your contract: required parameters (KV001), credentials (KV002), pinned infrastructure (KV003) and the naming rules your contract sets (KV004).

Both run as pre-commit hooks, side by side: pre-commit decides when checks run, and kv-cli is one of the hooks it runs, as Ruff is.

How kv-cli fits alongside Ruff and pre-commit

Feature comparisonsources in the footnotes
kv-cli compared with linters, secret scanners, CodeQL and dbt-checkpoint
kv-cliLinters (Ruff, SQLFluff)Secret scanners (gitleaks, detect-secrets)CodeQL / SASTdbt-checkpoint
What it checks
Required pipeline parameters (KV001)Yes———No2
Hardcoded credentials (KV002)YesPartial3YesYes4—
Infrastructure pinned to one environment (KV003)Yes———Partial5
Naming rules from a contract (KV004)YesPartial6——Partial7
dbt SQL modelsPartial8Partial9—No10Yes
Databricks asset bundlesYesNo11——No2
Credentials in notebooks and saved notebook outputYesPartial12—No10No2
How results can be trusted
Every result shows what was checked (scope counts)Yes————
Framework-aware: dbt, Airflow and Databricks entrypoints aren't false positivesYesPartial13—No14Partial15
Secret values redacted in outputYes—Partial16——
Findings keep their identity when line numbers shift (fingerprints)Yes—Partial17——
A changed contract fails the gate (exit 3)Yes————
How it fits in
Fixes code, not just reports it (fix)YesYes18——Yes19
Runs in editor, pre-commit and CI from one binaryYesYes20Partial21Partial22Partial23
SARIF for GitHub code scanningYesYes24Partial25Yes—
Runs offline, no account, no network callYes—Partial26Partial27No28
Open source, no account neededYesYes29Yes30Partial31Yes32

kv-cli complements linters and secret scanners. They check that code is well-formed; kv-cli checks that it will run correctly in every environment.

Kovallent is named for the covalent bond: a shared pair that holds two atoms together. kv-cli is the shared contract that holds every pipeline to the same rules.

  1. Not documented: the tool's documentation doesn't settle it either way.
  2. dbt-checkpoint's stated scope is the quality of dbt projects; its hook list has no check on Python function signatures.
  3. Ruff's S105–S107 flag string literals assigned to password-like names; SQLFluff documents no credential rule.
  4. CodeQL's py/hardcoded-credentials query.
  5. check-script-has-no-table-name requires ref() or source() for table names in SQL; warehouses, buckets and endpoints aren't covered.
  6. Ruff's N802 enforces lowercase function names, with an ignore list; it takes no custom pattern.
  7. check-model-name-contract applies a regex to dbt model names, not to Python function names.
  8. Pinned infrastructure (KV003) only: three-part names, USE WAREHOUSE / USE DATABASE, and object-store paths in COPY INTO and LOCATION.
  9. SQLFluff lints compiled dbt SQL for style and syntax through its dbt templater.
  10. SQL is not among CodeQL's documented supported languages; Python analysis covers .py files.
  11. Ruff is documented as a Python linter and SQLFluff as a SQL linter; bundle YAML is outside both.
  12. Ruff lints notebook code cells, so S105–S107 apply there; saved outputs aren't documented.
  13. Ruff's AIR rules check Airflow code and SQLFluff's dbt templater compiles dbt models; neither documents entrypoint exemptions.
  14. Airflow, dbt and Databricks are not in CodeQL's documented list of supported Python frameworks.
  15. dbt-aware (reads manifest.json and runs dbt commands); not Airflow or Databricks.
  16. gitleaks redacts only with --redact; detect-secrets hashes values in its baseline, but audit --report prints them.
  17. detect-secrets leaves the line number out of a secret's identity; gitleaks' documented fingerprint includes it.
  18. ruff check --fix and sqlfluff fix.
  19. Its "modifier" hooks, such as remove-script-semicolon and replace-script-table-names, rewrite dbt files.
  20. Ruff documents a VS Code extension, a pre-commit hook and a GitHub Action.
  21. Both document a pre-commit hook and CI use; neither documents an editor integration.
  22. A VS Code extension is documented; a pre-commit hook is not.
  23. A pre-commit hook collection with a GitHub Action; no editor integration documented.
  24. Ruff's --output-format sarif; SQLFluff's SARIF output format.
  25. gitleaks reports SARIF; detect-secrets documents no SARIF output.
  26. detect-secrets verifies secrets over the network by default (--no-verify turns it off); gitleaks doesn't document network use.
  27. The CodeQL CLI runs locally, but its terms allow use outside open-source code only with a GitHub Advanced Security licence.
  28. Anonymous usage tracking is on by default (disable-tracking turns it off).
  29. Ruff and SQLFluff are both MIT, and both install as local tools with no account.
  30. gitleaks is MIT and detect-secrets is Apache-2.0; both run as local command-line tools with no account.
  31. The CodeQL queries are MIT, but the CLI is licensed separately and needs a commercial licence to analyse closed-source code.
  32. dbt-checkpoint is MIT and runs as pre-commit hooks with no account.
Control Plane · in development

Control Plane waitlist

Team-wide policy, history and scorecards across many repositories. In development; kv-cli works fully without it.

When the Control Plane is ready, we'll invite waitlist members in small batches, in the order they joined.