KotlinLLM is Going Open Source
TL;DR
KotlinLLM is now public. It’s a research prototype for delegating runtime logic to an LLM from Kotlin code. Instead of calling an LLM on every request or running a separate agent, you can write an explicit Kotlin call. Its body is generated Kotlin source code, and that code is updated as your application hits new runtime scenarios.
What is KotlinLLM?
KotlinLLM is an IntelliJ IDEA plugin for Kotlin/JVM projects. It adds a language feature called Smart macros. A Smart macro is a regular Kotlin function call whose body is generated Kotlin code. The public API has two Smart macros:
asLlm<F, T>(from, hint)converts an input of type F into a typed value T (data class, enum, list, or primitive). Use it to parse unstructured or semi-structured data into typed Kotlin values at runtime.mockLlm<T>()generates a stateful implementation of an interface T. Its behavior depends on which methods are called on it, so it works as a test double that you don’t have to write by hand.
Example:
val issuesApiUrl: String = asLlm(repoInput, hint = "GitHub API URL: get all issues, including closed")
val issues: List<Issue> = asLlm(response, hint = "Return all beginner-friendly issues for this repository")
The behavior comes from actual runtime usage rather than being fully specified before the program runs. The call site stays compact and explicit.
The problem it solves
Using an LLM at the runtime of a compiled application is less common than IDE-time use. Existing options have trade-offs:
- Direct runtime delegation (calling the model on every invocation) is slow, non-deterministic, and costly.
- External agent workflows keep generated logic outside the codebase, harder to review, test, and ship.
- Most prior work (e.g. byLLM, nightjar, Healer) targets interpreted languages like Python, not compiled, statically typed Kotlin.
KotlinLLM is built around three properties:
- Explicit – the call site shows that a feature is LLM-backed, visible in code review.
- Persistent – generated behavior is saved as ordinary Kotlin source, commit-able, reviewable, testable.
- Portable – once generated, the code runs as plain Kotlin without the plugin; covered scenarios need no further LLM call.
Evaluation
Tested on two Kotlin/JVM projects:
- Adapted Spring Petclinic Kotlin – 18
asLlmcall sites, 24/24 application scenarios completed after Smart macro evolution, 100% hot-reload success rate, compilation/redefinition adding ~1% of total runtime overhead. - Synthetic “GitHub Beginner Issue Radar” – parsing real GitHub issue data across 20 repositories (30k+ issues), ~0.89 recall on ground-truth beginner labels.
Open source release
KotlinLLM is open source under the Apache License 2.0. The repository contains:
- The IntelliJ plugin prototype and the stable Smart macro API.
- Runnable example projects (GitHub Issue Radar, adapted Petclinic), including committed generated sources.
- The KotlinConf 2026 talk recording and theoretical write-up with full design rationale and evaluation.
GitHub: https://github.com/JetBrains-Research/kotlinllm-plugin