JetBrains Open-Sources KotlinLLM: Smart Macros That Generate Kotlin Source Code at Runtime and Hot-Reload I…
What changed
JetBrains Research has open-sourced KotlinLLM, a new IntelliJ IDEA plugin prototype that introduces Smart macros for Kotlin developers. These macros, named asLlm and mockLlm, replace the typical approach of calling language models live by instead generating Kotlin source code at runtime. The plugin captures runtime state using the Java Debug Interface (JDI), then queries an LLM agent for a narrowly scoped code update. This updated Kotlin code is compiled and hot-reloaded into the running application, bypassing further model inference after initial generation.
Why builders should care
KotlinLLM changes how AI-assisted coding integrates with runtime environments by shifting inference off live execution paths to static code generation and hot-reloading. This avoids the latency, cost, and flakiness of repeated calls to LLMs during test or production runs. It also makes AI-generated code inspectable and debuggable in standard Kotlin tooling since the output is real, compiled source code. This approach can reduce runtime overhead and increase confidence in AI-driven updates by turning model outputs into concrete code artifacts rather than ephemeral suggestions.
The practical takeaway
Builders working in Kotlin, especially those using IntelliJ IDEA, gain a workflow that leverages AI to generate precise code updates during runtime but runs purely as standard Kotlin afterward. On a modified Spring Petclinic project, KotlinLLM completed all 24 test scenarios without further inference calls after code injection. This means developers can prototype and experiment with language models influencing their app logic without paying for or risking inference failures on every run. The approach also simplifies debugging and integration of AI changes into existing codebases.
What to watch next
Watch how KotlinLLM evolves from prototype to production-ready tooling and whether JetBrains integrates it more broadly into their ecosystem. Note if the strategy of runtime-aware, compile-time AI code injection spreads to other languages or IDEs. Also keep an eye on performance impacts in larger, more complex codebases and how developers adopt or customize these Smart macros in real-world projects. The open-source angle offers a chance for community input that could shape practical AI programming workflows.
AI Quick Briefs Editorial Desk