split-jvm-nonjvm
Skill4.6k starsChanged 7 months agoApache-2.0View on GitHub
Splits a class or several classes in the common source set commonMain into JVM and non-JVM parts into jvmCommonMain and nonJvmCommonMain. This is used to provide some JVM-specific functionality for a class on JVM targets (e.g. Kotlin/JVM or Java backend or Android).
Trending
Quiet since October.about the whole repository
Who's talking about JetBrains/koog
- A Hacker News story“Koog, a Kotlin-based framework to build and run Al agents in idiomatic Kotlin”Hacker News · May 22, 2025 · 79 points
- @johnoreilly.dev“Yay, just created my first (very basic) AI Agent using the new Koog framework (github.com/JetBrains/koog) …”Bluesky · Jun 10, 2025 · 21 likes
- @vadim-briliantov.bsky.social“If for some reason you haven’t seen it yet, we released Koog — one of the most advanced frameworks for …”Bluesky · Sep 7, 2025 · 19 likes
- @johnoreilly.dev“Koog: a Kotlin-based framework designed to build and run AI agents entirely in idiomatic Kotlin (just …”Bluesky · May 22, 2025 · 17 likes
- @johnoreilly.dev“Inspired by proandroiddev.com/building-age... I updated the Koog agent (github.com/JetBrains/koog) in …”Bluesky · Aug 17, 2025 · 6 likes
The biggest 5 of 59 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 59
Talked about on GitHub, Bluesky and Hacker News (59 times).
On GitHub · 46
- Jul 31, 2025Adding missing watchos targets — oshai/kotlin-logging2 reactions · 5 comments
- Sep 7, 2026build(deps): bump the koog group with 2 updates — edjchapman/HelloDave1 reaction · 1 comment
- Jul 27, 2026build(deps): bump the koog group with 2 updates — edjchapman/HelloDave1 reaction · 1 comment
- Jul 20, 2026build(deps): bump ai.koog:koog-agents from 1.0.0 to 1.1.1 — Yuonsa/CommitGenius1 reaction · 1 comment
- Dec 23, 2025Bump ai.koog:koog-agents from 0.5.4 to 0.6.0 — Marko-Veljovic/Memoriori1 reaction · 1 comment
41 more on GitHub
- Oct 29, 2025Refactoring to Multiplatform Protocol with KMP — phodal/auto-dev1 reaction
- Sep 15, 2025Duplicate LibVersionKt causing Android build failure — modelcontextprotocol/kotlin-sdk1 reaction · 2 comments
- Oct 5, 2026build(deps): Bump ai.koog:koog-agents from 0.8.0 to 1.3.0 — geoknoesis/kastor0 reactions
- Oct 3, 2026agent-skills.github.jetbrains.koog: 1.2.0 → 1.3.0 — sudosubin/agents.nix0 reactions
- Oct 3, 2026build(deps): bump the all-dependencies group with 14 updates — storytellerF/A0 reactions
- Oct 3, 2026Bump ai.koog:agents-tools from 1.2.0 to 1.3.0 in the koog group — T45K/koog-google-search-tool0 reactions · 1 comment
- Oct 1, 2026Bump the gradle group with 2 updates — siarhei-luskanau/koog-models0 reactions
- Sep 28, 2026agent-skills.github.jetbrains.koog: init at 1.2.0 — sudosubin/agents.nix0 reactions
- Sep 28, 2026Bump ai.koog:koog-agents from 1.2.0 to 1.3.0 — myda-chi/frictionless0 reactions
- Sep 28, 2026chore(deps): bump ai.koog:koog-agents from 1.2.0 to 1.3.0 in /android — kaeawc/auto-mobile0 reactions · 1 comment
- Sep 26, 2026Bump ai.koog:http-client-ktor from 1.2.0 to 1.3.0 — UgaiSoftwares/ACPSample0 reactions
- Sep 26, 2026Bump ai.koog:agents-features-trace from 1.2.0 to 1.3.0 — UgaiSoftwares/ACPSample0 reactions · 1 comment
- Sep 24, 2026release: update Package.swift for 1.3.0 — JetBrains/koog-spm0 reactions
- Sep 5, 2026Bump ai.koog:agents-features-trace from 1.1.1 to 1.2.0 — UgaiSoftwares/ACPSample0 reactions · 1 comment
- Sep 5, 2026Bump ai.koog:http-client-ktor from 1.1.1 to 1.2.0 — UgaiSoftwares/ACPSample0 reactions
- Sep 5, 2026Bump ai.koog:agents-tools from 1.1.1 to 1.2.0 in the koog group — T45K/koog-google-search-tool0 reactions · 1 comment
- Sep 1, 2026build(deps): bump ai.koog:koog-agents from 0.8.0 to 1.2.0 in /examples/demo-compose-app — secure-workflows/koog0 reactions · 1 comment
- Aug 31, 2026chore(deps): bump koogVersion from 1.1.1 to 1.2.0 — elenavanengelenmaslova/mocknest-serverless0 reactions · 2 comments
- Aug 27, 2026build(deps): bump ai.koog:koog-agents from 0.6.0 to 1.1.1 in /app — rishabhpandey139/Summora-AI0 reactions
- Jul 24, 2026Koog MkDocs Material icons and nested content tabs are rendered as raw Markdown — BinaryTape/Open-AIDoc0 reactions
- Jul 20, 2026release: update Package.swift for 1.1.1 — JetBrains/koog-spm0 reactions
- May 25, 2026chore: update skills for koog 1.0.0 — javiergbravo/koog-skills-mcp0 reactions
- May 22, 2026Bump ai.koog:koog-agents from 0.7.1 to 1.0.0 — Valentine-456/AICodePlugin0 reactions
- Apr 23, 2026chore: update skills for koog 0.8.0 — javiergbravo/koog-skills-mcp0 reactions
- Apr 7, 2026build(deps): bump ai.koog:koog-agents from 0.6.0 to 0.7.3 in /examples/demo-compose-app — xfqwdsj/koog-fixed-llm-provider0 reactions · 1 comment
- Mar 31, 2026Bump ai.koog:koog-agents-jvm from 0.7.2 to 0.7.3 — Iarylkin/auto-issue0 reactions · 1 comment
- Mar 23, 2026Bump ai.koog:koog-agents-jvm from 0.7.1-rc3 to 0.7.2 — Iarylkin/auto-issue0 reactions · 1 comment
- Mar 23, 2026fix(koog-ktor): parsing timeouts configuration — BLannoo/koog0 reactions
- Mar 13, 2026Add Java API to Koog documentation — BLannoo/koog0 reactions · 2 comments
- Mar 9, 2026build(deps): bump ai.koog:koog-agents from 0.6.0 to 0.6.4 in /app — talosross/SummaryYou0 reactions
- Feb 26, 2026chore(deps): bump koog from 0.6.2 to 0.6.3 — phodal/routa.kt0 reactions
- Feb 13, 2026add multi executor and history compression strategy — hernandazevedo/kotlin-ai-agent-koog0 reactions
- Oct 30, 2025Bump ai.koog:koog-agents from 0.4.1 to 0.5.2 — iammohdzaki/Starter-Project-Ktor0 reactions
- Sep 4, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 4, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 3, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 3, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 2, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Sep 1, 2025Check trending repo: JetBrains/koog — uibm/trending-watcher0 reactions · 1 comment
- Aug 6, 2025[FEAT] Introduce Koog for full agentic capabilities — Open-Distributed-Edge-Agents/EdgeGenAI0 reactions
- Jun 20, 2025Interesting Projects — PenumbraOS/mabl0 reactions
On Bluesky · 12
- Jun 10, 2025Yay, just created my first (very basic) AI Agent using the new Koog framework (github.com/JetBrains/koog) from @jetbrains.com . Agent… — @johnoreilly.dev21 likes and reposts · 1 reply
- Sep 7, 2025If for some reason you haven’t seen it yet, we released Koog — one of the most advanced frameworks for building AI agents! Targeting… — @vadim-briliantov.bsky.social19 likes and reposts
- May 22, 2025Koog: a Kotlin-based framework designed to build and run AI agents entirely in idiomatic Kotlin (just announced at #KotlinConf keynote)… — @johnoreilly.dev17 likes and reposts · 1 reply
- Aug 17, 2025Inspired by proandroiddev.com/building-age... I updated the Koog agent (github.com/JetBrains/koog) in ClimateTraceKMP sample… — @johnoreilly.dev6 likes and reposts
- Jul 3, 2025Did you know that a lot of Kotlin AI libraries are built on top of Ktor? The new Koog library for building agents is doing all its… — @vergauwensimon.bsky.social4 likes and reposts
7 more on Bluesky
- Sep 23, 2026https://github.com/JetBrains/koog more like this: https://agentwire.thecompound.tech/aw/1f6ane — @agentwire.thecompound.tech2 likes and reposts
- Aug 11, 2026Does anyone have experience with this #Kotlin library for building agents? Thoughts? I need Kotlin as it'd like to build an Android app.… — @alexn.org2 likes and reposts · 3 replies
- Oct 4, 2025Trying out new Functional Agents support in Koog 0.5.0 (github.com/JetBrains/koog) ....also have set things up now to invoke population and… — @johnoreilly.dev2 likes and reposts · 1 reply
- Sep 30, 2025More information about Koog here github.com/JetBrains/koog. @vadim-briliantov.bsky.social (Koog Technical Lead) has also been writing a… — @johnoreilly.dev2 likes and reposts · 1 reply
- Sep 10, 2025JetBrains Koog : « We didn’t just port Python concepts to Kotlin. We reimagined what an AI agent framework could be »… — @nfonrose.bsky.social1 likes and repost · 1 reply
- May 26, 2025https://github.com/JetBrains/koog KoogはKotlinでAIエージェントを構築・実行するためのフレームワークです。 自然なKotlinでAIエージェントを構築できます。 外部システムやAPIにアクセスするツールでエージェントを拡張可能です。 — @topickapp.bsky.social1 likes and repost
- May 25, 2025Koog, a Kotlin-based framework to build and run Al agents in idiomatic Kotlin | Discussion — @hackernewsbot.bsky.social1 likes and repost
On Hacker News · 1
- May 22, 2025Koog, a Kotlin-based framework to build and run Al agents in idiomatic Kotlin79 points · 2 comments
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- a2a/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- examples/simple-examples/CLAUDE.mdCLAUDE.md
- add-java-code-snippets-in-docsSkill
- arithmetic-evaluatorSkill
- weather-retrievalSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
When using this skill, avoid unnecessarily looking at existing implementations of the split in the project, just follow this instruction.
- Very specific: line 95
If MyClass had any internal symbols, these should also be listed in the expect class along with their KDocs.
- Very specific: line 96
If MyClass had a KDoc, add it on top of the expect class without parameters/properties description.
- Very specific: line 97
If MyClass original KDoc described certain parameters/properties that it accepted in its constructor, add these to KDoc of the expect class …
- Distinctive: line 136
After these steps, the structure should look as follows, omitting irrelevant packages and files:
- Distinctive: line 179
If the users asked for certain JVM-specific/non-JVM-specific functionality, these actual classes might contain additional public symbols …
- Very specific: line 207
Do not rename the test, it should still be called e.g.
- Very specific: line 208
If you need to test some platform-specific functionality, create tests in jvmCommonTest and/or nonJvmCommonTest source sets.
- Distinctive: line 218
If both pass, the split is working correctly.
- Distinctive: line 227
When creating the new files (API interface, Impl, expect class, actual classes), carry over all relevant imports from the original class.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
The following example shows how to split a class into JVM and non-JVM parts. When using this skill, avoid unnecessarily looking at existing implementations of the split in the project, just follow this instruction. You can, however, check existing implementations for reference if you have a complex case or otherwise stuck.
Here's a sample class in a commonMain source set
package com.example
/**
* A sample class with an external dependency, some logic and public methods
* @param name Some public property
* @param myRepo Some external dependency, private property
*/
public class MyClass(
public val name: String,
private val myRepo: MyRepo,
) {
/**
* Public API method
*/
public fun doSomething(): String {
return fetchData()
}
/**
* Private implementation logic
*/
private fun fetchData(): String {
return myRepo.getData()
}
/*
* Internal method
*/
internal fun doInternal(): String {
return "Internal"
}
}In the same package as MyClass in commonMain, create the following files. The original MyClass.kt file will be overwritten with the expect class (see step three).
First, the API interface describing the contract. It should contain only public symbols from the MyClass.
Take KDocs from the respective symbols in MyClass and add them to the interface.
package com.example
/**
* API for [MyClass]
*/
public interface MyClassAPI {
/**
* Some public property
*/
public val name: String
/**
* Public API method
*/
public fun doSomething(): String
}Second, MyClassImpl.kt — implementation of the API interface providing the implementation logic. The filename matches the class name.
internal class MyClassImpl(
override val name: String,
private val myRepo: MyRepo,
) : MyClassAPI {
override fun doSomething(): String {
return fetchData()
}
private fun fetchData(): String {
return myRepo.getData()
}
internal fun doInternal(): String {
return "Internal"
}
}Third, the original class becomes expect class
MyClass should extend MyClassAPI and override all public symbols from MyClassAPI, without method bodies and property values, since expect classes can't have any.
If MyClass had any internal symbols, these should also be listed in the expect class along with their KDocs.
If MyClass had a KDoc, add it on top of the expect class without parameters/properties description.
If MyClass original KDoc described certain parameters/properties that it accepted in its constructor, add these to KDoc of the expect class secondary constructor.
This constructor KDoc can't have @property tag for parameters, use only @param for all parameters, even if the original was @property.
package com.example
/**
* A sample class with an external dependency, some logic and public methods
*/
public expect class MyClass internal constructor(
delegate: MyClassImpl,
) : MyClassAPI {
/**
* Constructs a new instance of [MyClass]
*
* @param name Some public property
* @param myRepo Some external dependency,
*/
public constructor(
name: String,
myRepo: MyRepo,
)
internal val delegate: MyClassImpl
override val name: String
override fun doSomething(): String
/**
* Internal method
*/
internal fun doInternal(): String
}Fourth, ensure that jvmCommonMain and nonJvmCommonMain source sets have a package directory for MyClass, i.e., com.example. If not, create missing package directories.
The source sets themselves are already declared in the Gradle convention plugin — you do NOT need to add them to the module's build.gradle.kts unless you need to add dependencies specifically for these source sets.
Then, create MyClass.kt files in jvmCommonMain and nonJvmCommonMain source sets.
After these steps, the structure should look as follows, omitting irrelevant packages and files:
commonMain/
kotlin/
com/example/
MyClass.kt
MyClassAPI.kt
MyClassImpl.kt
jvmCommonMain/
kotlin/
com/example/
MyClass.kt
nonJvmCommonMain/
kotlin/
com/example/
MyClass.ktFifth, in MyClass.kt files in jvmCommonMain and nonJvmCommonMain create actual declarations for MyClass.
Initially, they should be identical for both source sets.
It should use by delegate to delegate all public symbols from MyClassAPI to the implementation, and direct delegation to delegate internal symbols.
// Suppress IntelliJ warnings
@file:Suppress("MissingKDocForPublicAPI")
package com.example
public actual class MyClass internal actual constructor(
internal actual val delegate: MyClassImpl,
) : MyClassAPI by delegate {
public actual constructor(
name: String,
myRepo: MyRepo,
) : this(
delegate = MyClassImpl(name, myRepo)
)
internal actual fun doInternal(): String = delegate.doInternal()
}Sixth, optional, step. If the users asked for certain JVM-specific/non-JVM-specific functionality, these actual classes might contain additional public symbols not present in the API interface. Such additional public symbols should be documented properly and concisely with KDoc
For example, jvmCommonMain implementation that uses JVM-specific API
// Suppress IntelliJ warnings
@file:Suppress("MissingKDocForPublicAPI")
package com.example
public actual class MyClass internal actual constructor(
internal actual val delegate: MyClassImpl,
) : MyClassAPI by delegate {
public actual constructor(
name: String,
myRepo: MyRepo,
) : this(
delegate = MyClassImpl(name, myRepo)
)
/**
* Gets environment variable value by [key]
*/
public fun getEnv(key: String): String = System.getenv(key)
}Seventh, if MyClass had any tests in the original commonTest source set, use MyClassImpl in the test to verify common implementation.
Do not rename the test, it should still be called e.g. MyClassTest.
If you need to test some platform-specific functionality, create tests in jvmCommonTest and/or nonJvmCommonTest source sets.
Kotlin tests for JVM-specific functionality should go to jvmCommonTest.
IMPORTANT: if the test suite is written in Java, it MUST go to jvmTest, not jvmCommonTest. KMP only compiles Java code in jvmMain/jvmTest source sets.
Finally, ensure that the implementation compiles by running:
./gradlew :mymodule:compileKotlinJvm
./gradlew :mymodule:compileKotlinJsReplace :mymodule with the actual Gradle module path derived from the file location (e.g., agents/agents-core → :agents:agents-core).
If both pass, the split is working correctly.
IntelliJ false positives
Due to the experimental state of expect/actual classifiers, IntelliJ may report false positive errors such as "no actual for expect" or "no expect for actual". These diagnostics should NOT be trusted. The only reliable verification is running the Gradle compile tasks listed above.
Important notes
Imports
When creating the new files (API interface, Impl, expect class, actual classes), carry over all relevant imports from the original class.
Annotations
Classes being split should not have annotations. If the original class has annotations (e.g., @Serializable, @Deprecated), ask the user explicitly how to handle them before proceeding.
Companion objects
Classes being split should not have companion objects. If the original class has a companion object, ask the user explicitly how to handle it before proceeding.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

