Vercel — AI · · 1 min read

Enforce consistent code for agents and humans with konsistent

Mirrored from Vercel — AI for archival readability. Support the source by reading on the original site.

konsistent is now open source.

konsistent is a CLI linter for TypeScript codebases that enforces structural conventions, giving agents and humans the consistent context they need to implement features correctly. Deterministic, fast, and covers structural patterns that TypeScript and ESLint don't model.

Configure conventions in a project-level konsistent.json file for concerns like:

  • Do all files matching pattern X export functions Y and Z?

  • Does every folder that has file X also have file Y?

  • Does every class exported from files matching pattern X implement type Y?

konsistent is used in AI SDK and Chat SDK to enforce structural code conventions.

▲ pnpm konsistent
packages/harness-demo-code/src/index.ts
- error Missing export type "DemoCodeHarnessSettings" from "./demo-code-harness" [harness-package-must-export-harness-creator-and-settings]
- error Missing export constant "demoCode" [harness-package-must-export-harness-creator-and-settings]
packages/harness-demo-code/src/demo-code-harness.ts
- error Missing required file: demo-code-auth.ts [harness-file-must-export-harness-creator-and-settings-type]
- error Missing export type "DemoCodeHarnessSettings" [harness-file-must-export-harness-creator-and-settings-type]
- error Missing import type "HarnessV1" [harness-file-must-export-harness-creator-and-settings-type]
- error Missing local type declaration "DemoCodeBridgeCoords" [harness-file-with-bridge-must-declare-bridge-contracts]
- error Missing local constant declaration "demoCodeBridgeCoordsSchema" [harness-file-with-bridge-must-declare-bridge-contracts]
12 error Function "createDemoCode" must return value of type "HarnessV1" [harness-file-must-export-harness-creator-and-settings-type]
packages/harness-demo-code/src/demo-code-bridge-protocol.ts
- error Missing export type "BridgeReady" [harness-bridge-protocol-file-must-export-relevant-symbols]
- error Missing export constant "bridgeReadySchema" [harness-bridge-protocol-file-must-export-relevant-symbols]
packages/harness-demo-code/src/bridge/index.ts
- error Missing local function declaration "runTurn" [harness-bridge-must-declare-and-use-relevant-symbols]
- error Missing import "runBridge" [harness-bridge-must-declare-and-use-relevant-symbols]
- error Missing import type "StartMessage" [harness-bridge-must-declare-and-use-relevant-symbols]
- error Missing import type "BridgeEvent" [harness-bridge-must-declare-and-use-relevant-symbols]
- error Missing import type "BridgeTurn" [harness-bridge-must-declare-and-use-relevant-symbols]
Checked 340 files in 212ms. Found 15 errors.

konsistent CLI example output for a "Demo Code" harness adapter in AI SDK

Use the konsistent skill to help your agent create a konsistent.json for your project:

npx skills add vercel-labs/konsistent --skill konsistent-config

Add the skill to have your agent create the konsistent.json file with you

Get started with konsistent

Install the package, then use the skill with your agent to declare the conventions.

Get started

Discussion (0)

Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.

Sign in →

No comments yet. Sign in and be the first to say something.

More from Vercel — AI