Weft is an architecture and project harness for Kotlin Multiplatform (KMP) and Compose Multiplatform (CMP).
Weft helps a team answer four questions before generating project code:
- What should this product share across Android and iOS?
- How should shared and native code communicate?
- Will the team operate a separate server (Spring Boot), or use Supabase?
- Which modules should own each responsibility?
Weft combines architecture guidance, focused Codex skills, project profiles, and a scaffold CLI. Every app profile requires the same Ktor Client/Ktorfit/Kotlin Serialization network stack, Koin Annotations composition root, Montage design system, multi-module layout, and included Gradle convention build.
Weft is an early open-source project. Its CLI creates a decision-recorded app layout, while the repository also hosts a KMP bridge-library workspace. :weft-core provides the plugin installation contract, health-check contract, provider-neutral map models, and Compose APIs (LocalWeft, WeftApp, and WeftMap). The :weft-map namespace contains Kakao (weft-kakaomap) and Naver (weft-navermap) provider leaves. Kakao uses Android Maps SDK 2.15.2 and iOS SwiftPM package 2.12.19; Naver uses Android Maps SDK and iOS SPM-NMapsMap 3.24.1. The six established default artifacts and BOM were published as version 0.1.1; weft-bluetooth is newly added to the next coordinated release set and still needs platform and device validation. :weft-sensor:gps provides native Android and Apple location streams, but permission and device validation remain open. :weft-bluetooth provides BLE central scanning, GATT connections, and characteristic operations on Android and iOS. :weft-live remains a candidate outside the default BOM until its remote SwiftPM consumer path is ready. Login includes Supabase Auth PKCE and Android Restore Credentials; push includes Firebase registration and Android/iOS notification presentation. See the module milestones before relying on a capability in production.
- Direction and delivery plan
- Project shapes
- Module layout
- Apple interop and distribution
- Bridge library contract
- Bridge library modules
- Sensor capabilities
- Bluetooth capability
- Maven Central publishing
- Backend choices
- Application dependency policy
- Toolchain policy
- Harness design and profiles
- Open questions
python3 scripts/weft.py profiles
python3 scripts/weft.py plan --profile cmp-supabase
python3 scripts/weft.py scaffold --profile cmp-supabase --name sample-app --output /tmp/sample-app
python3 scripts/weft.py verify --project /tmp/sample-app
python3 scripts/weft.py verifyThe scaffold records the required app stack and profile decisions, then creates the planned module tree including build-logic. Every profile selects Spring Boot or Supabase and records OAuth 2.0 Authorization Code with PKCE for native sign-in. This is a Weft policy, not a protocol requirement for PKCE. Ktorfit/KSP, Koin Compiler Plugin, Montage, and Kotlin/Gradle/AGP/Compose/Xcode versions must be selected as a compatible tuple. The current scaffold records these requirements but does not generate build files or pin versions, so its output is not build-ready.
This repository packages the skills-only weft-app-builder plugin under plugins/ and lists it in the repo-local marketplace at .agents/plugins/marketplace.json. It has no MCP server or account connection. From the Weft checkout, add the marketplace and install the plugin:
codex plugin marketplace add .
codex plugin list --marketplace weft-local
codex plugin add weft-app-builder@weft-localThen invoke $weft-app-builder to plan, scaffold, implement, or review an app. Start a new Codex conversation after installation so the packaged skill is available there. The plugin package is at plugins/weft-app-builder.
The Gradle workspace includes Kotlin Multiplatform libraries for the plugin core, map, login, push notifications, Bluetooth, and a gated live-activity candidate, plus a Java Platform BOM that aligns their versions. Their initial artifact coordinates are:
run.thespot.weft:weft-core:0.1.0-SNAPSHOT
run.thespot.weft:weft-kakaomap:0.1.0-SNAPSHOT
run.thespot.weft:weft-login:0.1.0-SNAPSHOT
run.thespot.weft:weft-push:0.1.0-SNAPSHOT
run.thespot.weft:weft-bluetooth:0.1.0-SNAPSHOT
run.thespot.weft:weft-live:0.1.0-SNAPSHOT # candidate; excluded from the default BOM
run.thespot.weft:weft-bom:0.1.0-SNAPSHOT
The live-activity candidate is verified with the workspace but is omitted from the default BOM and
coordinated release until the versioned remote WeftLiveKit package and an external app/widget
consumer have passed. It can be included only through the explicit weftLiveReleaseEnabled=true
release gate.
Each capability module owns a WeftContribution. In a multi-module app, Koin collects those contributions and one app module creates the runtime:
@Module
@Configuration
class AppWeftModule {
@Single
fun weft(contributions: List<WeftContribution>): Weft = Weft(contributions)
}
@KoinApplication
class AppKoinApplication
startKoin<AppKoinApplication> {
properties(
mapOf(
"weft.kakaoMap.nativeAppKey" to kakaoNativeAppKey,
"weft.login.supabaseUrl" to supabaseUrl,
"weft.login.publishableKey" to supabasePublishableKey,
"weft.login.redirectUri" to loginRedirectUri,
),
)
}
val weft = KoinPlatform.getKoin().get<Weft>()The Koin Compiler Plugin discovers configured modules on the application classpath. Kakao Maps and Supabase login contribute their own installs and read public configuration from Koin properties. Firebase push contributes its default message policy; an app can provide a PushMessageProcessor definition to customize it. weft-live also contributes its plugin when included, and requires the app to provide a platform-specific LiveActivityPlatform. A consumer that does not use Koin can continue using the direct Weft DSL:
val weft = Weft {
install(KakaoMap) {
nativeAppKey = kakaoNativeAppKey
}
}
val mapPlugin = weft.get<MapPlugin>()Every map provider declares type = MapPlugin::class, so weft.get<MapPlugin>() returns whichever implementation was installed. Installing a second plugin for the same plugin type fails with DuplicateWeftPluginException instead of silently replacing the first.
Composables read the runtime from the composition instead of receiving it as a parameter. WeftApp provides it once at the root, so screens depend only on the capability they use:
setContent {
WeftApp(weft) {
val map = LocalWeft.current.get<MapPlugin>()
MapScreen(map)
}
}Reading LocalWeft outside WeftApp fails during composition with a message that names the wrapper, and a preview or UI test provides a fake runtime the same way.
WeftMap delegates to the installed provider through MapPlugin.renderer, a composable function value. Its child content is provider-neutral and keyed by element ID; markers and the basic polyline, polygon, and circle overlays share the same Compose node tree. The function value keeps the provider dispatch compatible with Kotlin/Native. See the provider-neutral overlay contract.
WeftApp(weft) {
val mapState = rememberWeftMapState(CameraPosition(LatLng(37.5665, 126.9780)))
WeftMap(state = mapState) {
Marker(MapMarker(id = "seoul-city-hall", position = LatLng(37.5665, 126.9780)))
Polyline(id = "route", points = listOf(LatLng(37.5665, 126.9780), LatLng(37.5700, 126.9820)))
Polygon(
id = "service-area",
points = listOf(LatLng(37.5660, 126.9770), LatLng(37.5670, 126.9770), LatLng(37.5665, 126.9790)),
)
Circle(id = "pickup-radius", center = LatLng(37.5665, 126.9780), radiusMeters = 250.0)
}
}WeftMapState stores the latest camera snapshot and provides moveCamera, animateCamera,
fitBounds, zoomTo, zoomBy, zoomIn, and zoomOut. Markers accept an optional PNG/JPEG
MapMarkerIcon, normalized anchor, rotation, orientation, z-index, visibility, selection, label, and
badge text. WeftMap reports readiness, camera movement, map taps, long presses, and marker taps
through callbacks; camera snapshots include visible bounds when the provider can calculate them.
An app can follow a location stream without putting location policy in the map provider:
val mapState = rememberWeftMapState(initialCamera)
LaunchedEffect(locationFlow) {
locationFlow.collect { location ->
mapState.animateCamera(
mapState.cameraPosition.copy(target = location, zoom = 16f),
)
}
}
WeftMap(
state = mapState,
onCameraChanged = { snapshot ->
// Use snapshot.isMoving and snapshot.source to update app-owned follow controls.
},
)Kakao Maps implements these camera commands and pointer events on Android and iOS. The provider
remains a regular MapPlugin, so an app can install another provider that implements the same
renderer contract. The new camera commands, callbacks, and marker styling fields currently have
Kakao support; Naver retains its existing camera and marker behavior.
:weft-gradle-plugin keeps an app honest about what it installed. Add it to the app module:
plugins {
id("weft.verify")
}verifyWeftPlugins is offline and part of check: it fails when a required .get<T>() has no installed plugin (naming the type and every file:line), when an install(...) block configures a credential as an empty or placeholder string, or when client code contains a credential that must not ship — a Supabase service_role JWT, a provider secret token (sk-, ghp_, AKIA..., xox[baprs]-, a private key block), or a privileged property such as serviceRoleKey in an install block or Koin property. A finding reports only the category and file:line; the token never appears in the build output. Since the verifier does not inspect compiled contributions from dependencies, list their capability types in the verifier's installedTypes metadata:
weft {
installedTypes.add("MapPlugin")
}This declaration is only for static analysis; runtime installation still comes from Koin. verifyWeftHealth runs the health checks instead, and fails when a credential is blank, rejected (401/403), or the endpoint is unreachable.
verifyWeftDependencies enforces the direct-dependency allowlist. Weft app convention plugins enable it by default; generic consumers can also enable it directly:
weft {
enforceDependencyWhitelist = true
allowedDependencyGroups.add("com.example") // or the whole family with "com.example.*"
}Capability libraries own their probes, because each provider knows its own endpoint. A plugin reports them through WeftPlugin.healthCheck, and a build can add one more:
weft {
healthCheck("supabase-auth") {
url = "https://project.supabase.co/auth/v1/health"
header("apikey", providers.environmentVariable("SUPABASE_ANON_KEY").get())
}
}./gradlew verifyWeftPlugins # offline, also runs with `check`; blocks secrets too
./gradlew verifyWeftDependencies # offline; joins `check` when the whitelist is enforced
./gradlew verifyWeftHealth # network; run before a release or when credentials changeConsumers can import the BOM to use the coordinated version without repeating it:
dependencies {
implementation(platform("run.thespot.weft:weft-bom:1.0.0"))
implementation("run.thespot.weft:weft-kakaomap")
implementation("run.thespot.weft:weft-gps")
}Configure the repository for the selected provider alongside Google and Maven Central. Kakao uses its release repository (shown below); Naver uses the official Naver Maven repository and weft-navermap leaf:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://repository.map.naver.com/archive/maven")
}
}
dependencies {
implementation(platform("run.thespot.weft:weft-bom:1.0.0"))
implementation("run.thespot.weft:weft-navermap")
}dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://devrepo.kakao.com/nexus/repository/kakaomap-releases/")
}
}The default artifact set has a 0.1.1 release. Further capability work should clear the CI and separate consumer gates listed in the module docs. The live-activity candidate remains outside the default BOM until its remote SwiftPM and external app/widget consumer path pass. See the module instructions and toolchain policy.
The demo is a local Gradle composite consumer for the Weft modules. It runs as an Android app and a project-free Kotlin/Native iOS simulator app, with no Swift app source. Both exercise the local Weft dependencies and Kakao SwiftPM import. The login and push pages report their current M0 status because those modules do not expose runtime APIs yet.
./gradlew projects
./gradlew verify
./gradlew :weft-core:publishToMavenLocal
./gradlew :weft-map:kakaomap:publishToMavenLocal
./gradlew :weft-bom:publishToMavenLocalSee Maven Central publishing for the local consumer fixture, credentials, signing, and the release workflow. The iOS provider currently imports the Kakao SDK through Kotlin's SwiftPM integration; publishing a native SwiftPM XCFramework for direct Swift consumers is a separate distribution path.
The repository contains four installable Codex skills under skills/:
weft-architectchooses a project shape and records architecture decisions.weft-scaffoldgenerates a project layout from a Weft profile.weft-apple-bridgedesigns Kotlin-to-Apple SDK boundaries and distribution.weft-reviewchecks a project against its recorded profile and Weft guidance.
To try a skill in Codex, link it into ~/.codex/skills/ and keep the Weft checkout available in the workspace. For example:
mkdir -p ~/.codex/skills
ln -s /absolute/path/to/Weft/skills/weft-architect ~/.codex/skills/weft-architectA symlink keeps the skill and its repository guidance discoverable.
Run ./scripts/verify.sh before proposing changes. Read AGENTS.md for the repository workflow. Weft is licensed under the Apache License 2.0.