The sync jar (clients/sync) brings a player's game folder up to date with the server's published client files before Minecraft starts, and can also run an opt-in Sculkworm tunnel agent. The installer jar adds the server to the player's launcher and picks the right launch mode for that launcher.
Build#
node clients/sync/build.mjsThe build runs in eclipse-temurin:17-jdk, targets Java 8, compiles every class into package network.sculk.sync (keeping the jars out of the unnamed default package so signed vanilla Minecraft jars load cleanly when attached via -javaagent), and writes four files:
| File | What it is |
|---|---|
clients/sync/out/sculk-sync.jar |
The sync jar (unchanged: sync and opt-in tunnel agent only). Its manifest has both Main-Class and Premain-Class (network.sculk.sync.SculkSync). |
clients/sync/out/sculkworm-connect.jar |
Standalone Java 8 player-side sculkworm-connect client. Main-Class runs the play / login / logout CLI; Premain-Class runs connect only (network.sculk.sync.SculkwormConnect). |
clients/sync/out/sculk-sync-sculkworm.jar |
Combined sync + connect jar. Main-Class stays network.sculk.sync.SculkSync; Premain-Class (network.sculk.sync.SculkSyncSculkwormAgent) runs sync first (blocking until sync finishes, plus any configured tunnel agent) and then starts connect in daemon threads. |
clients/sync/out/sculk-installer.jar |
The installer (Main-Class: network.sculk.sync.Installer). It holds sculk-sync.jar and sculk-installer.json at its root. The server adds server-icon.png next to them when it serves the download. |
clients/sync/build.sh does the work, and the Dockerfile runs the same script. The image ships sculk-sync.jar, sculkworm-connect.jar, sculk-sync-sculkworm.jar, and sculk-installer.jar in /app/clients/sync/.
Two ways to run the sync jar#
Both read sculk.json in the instance folder and share the same rules: a 30 second budget (timeoutSeconds), the same log lines, channel tokens and swa_ agent tokens masked in the output, three-way merging of merge-flagged configs (keeping a base copy in sculk-base/), a confirmation prompt for mods uploaded by hand (sculk-accepted-mods.txt), and a failure never stops the launch (only cancelling the hand-added mods prompt exits with code 1).
| Mode | Command | Game folder | Who uses it |
|---|---|---|---|
| Pre-launch | java -jar sculk-sync.jar [instance dir] [game dir] (or INST_DIR, INST_MC_DIR) |
INST_MC_DIR, else 2nd arg, else gameDir in sculk.json, else <instance>/minecraft |
Prism, PolyMC, MultiMC (PreLaunchCommand) |
| Agent | java -javaagent:sculk-sync.jar=<instance dir> ... |
INST_MC_DIR, else gameDir in sculk.json (absolute, or relative to the instance dir), else <instance>/minecraft |
Every other launcher, through the Java arguments |
| Tunnel agent | java -jar sculk-sync.jar --tunnel-agent [instance dir] (or INST_DIR) |
Not used (reads tunnel in sculk.json) |
Opt-in closed-route tunnel agent (see Tunnel agent mode) |
In agent mode the JVM runs premain before the game's main, in the same process, so the mods folder is up to date before Fabric or Forge scans it. The agent returns when the sync ends or the budget runs out (and, if sculk.json has an enabled tunnel block, starts the tunnel agent on a daemon thread). It only halts the JVM (exit code 1) if the player cancels the hand-added mods prompt; otherwise the game starts with its own exit code. After a timeout the worker stops before it writes again.
ATLauncher and the Modrinth App start Java in the game folder, so their agent argument is relative and a space in the user's folder name cannot split it:
-javaagent:sculk/sculk-sync.jar=sculkThe Minecraft Launcher gets an absolute agent argument, because nobody has checked which folder it starts Java in. It splits the Java arguments on spaces and a missing agent jar stops the JVM before the game starts, so the installer never writes a profile whose sync folder has a space in its path. It refuses and writes nothing. The player then runs it again with --sync-dir and a folder whose path has no spaces (C:\sculk, /Users/Shared/sculk, /opt/sculk). The jar and sculk.json go to <sync dir>/<slug>, and gameDir in that sculk.json is the profile's absolute game folder:
$ java -jar sculk-installer.jar --cli --launcher mojang
Installing Aileen SMP for Minecraft Launcher in C:\Users\Jane Doe\AppData\Roaming\.minecraft
The Minecraft Launcher splits Java arguments on spaces, and the sync folder C:\Users\Jane Doe\AppData\Roaming\.minecraft\sculk\aileen-smp\sculk has one. Run this installer again with a folder whose path has no spaces:
java -jar sculk-installer.jar --cli --launcher mojang --sync-dir C:\sculk
Or choose "Another launcher (manual)" and set up the profile by hand.
$ java -jar sculk-installer.jar --cli --launcher mojang --sync-dir C:\sculk
Installing Aileen SMP for Minecraft Launcher in C:\Users\Jane Doe\AppData\Roaming\.minecraft
Downloading Fabric 0.16.9 for Minecraft 1.21.1 from https://meta.fabricmc.net/v2/versions/loader/1.21.1/0.16.9/profile/json
Wrote C:\Users\Jane Doe\AppData\Roaming\.minecraft\versions\fabric-loader-0.16.9-1.21.1\fabric-loader-0.16.9-1.21.1.json
Wrote C:\sculk\aileen-smp\sculk.json
Wrote C:\sculk\aileen-smp\sculk-sync.jar
Wrote C:\Users\Jane Doe\AppData\Roaming\.minecraft\launcher_profiles.json.sculk-backup
Wrote C:\Users\Jane Doe\AppData\Roaming\.minecraft\launcher_profiles.json
Close the Minecraft Launcher if it is open, open it, choose the installation "Aileen SMP" and play.The installer window has no field for this folder. A player whose path has a space sees the same message there and runs the command line.
sculk-installer.json#
The installer reads this entry from its own jar. The server overwrites it per server when it serves the download, so its name and shape are a contract:
{
"serverName": "Aileen SMP",
"manifestUrl": "https://sculk.network/c/<token>/manifest.json",
"minecraft": "1.21.1",
"loader": { "kind": "fabric", "version": "0.16.9" },
"iconKey": "aileen"
}loader.kind is one of fabric, quilt, forge, neoforge or vanilla. version is required except for vanilla. minecraft and version are plain version names (letters, digits, ., _, +, -), because they become folder names and URL paths. iconKey is optional. The installer rejects any other kind, any missing field and any other version before it writes a file. The build puts a placeholder in the jar (clients/sync/installer.placeholder.json).
When the live modpack has a server-icon.png, the server writes the same 64x64 PNG as the Prism export into the jar as the root entry server-icon.png and sets iconKey to sculk-<server id>. Without an icon there is neither. The jar's other entries keep their bytes and order, so every download of the same commit has the same bytes.
Installer#
java -jar sculk-installer.jar # a window, or the CLI when there is no display
java -jar sculk-installer.jar --cli --list # the launchers it found
java -jar sculk-installer.jar --cli --launcher prism
java -jar sculk-installer.jar --cli --launcher manual --dir "/path/to/game folder"
java -jar sculk-installer.jar --cli --launcher mojang --sync-dir /opt/sculkThe window shows the server's icon and name, the launchers it found and a log. Download progress lines are grey, the result is green and a failure is red. When an install ends it opens a dialog with the result: a green Done with what to do next, or a red Not installed with the reason. The command line prints the same lines and exits 0 when the install is done, 1 when it failed and 2 for a usage error. It colours the result green or red only on a terminal and never when NO_COLOR is set, so a pipe or a log file gets plain text. On Windows it colours only in Windows Terminal or a terminal that sets TERM, because the classic console prints the codes as text.
--list prints one launcher per line, with the folder it found or --dir <folder> when the player picks one:
Aileen SMP: Minecraft 1.21.1, Fabric 0.16.9
prism Prism Launcher /home/ana/.local/share/PrismLauncher
mojang Minecraft Launcher /home/ana/.minecraft
modrinth Modrinth App --dir <folder>
manual Another launcher (manual) --dir <folder>Launchers.ALL in clients/sync/src/Launchers.java is the only place that knows launchers. Each entry has an id, a name, the data folders to look in on each system (%APPDATA%, ~/Library/Application Support, $XDG_DATA_HOME or ~/.local/share, and Flatpak folders), the file that proves the folder is that launcher's, and its install step. Detection only reads. Every install can run again: it rewrites the jar and the config in place, writes only the files that changed and never adds a second profile.
| Id | What the install does |
|---|---|
prism, polymc, multimc |
Writes instances/<slug>/ with the same instance.cfg, mmc-pack.json and sculk.json as the server's Prism export, and keeps the pre-launch hook. With an icon it writes <iconKey>.png into the launcher's icons folder (IconsDir in its config, icons by default) and iconKey into instance.cfg: the launcher reads a .png beside an instance only when it imports a zip. A rerun keeps the keys the launcher added to instance.cfg. The launcher downloads the loader itself. |
atlauncher |
Needs an instance with the server's name, Minecraft version and loader, which the player creates in ATLauncher. Writes sculk/ in it and adds the agent to launcher.javaArguments in instance.json, after a copy in instance.json.sculk-backup. |
mojang |
Installs the loader into versions/ when it is not there yet (see Loaders in the Minecraft Launcher). Adds the profile sculk-<slug> to launcher_profiles.json, named after the server, with its own game folder under .minecraft/sculk/<slug>, the server's icon as a data:image/png;base64, URL (Grass without one) and the launcher's default Java arguments plus the absolute agent, after a copy in launcher_profiles.json.sculk-backup. The sync folder is sculk/ inside that game folder, or <sync dir>/<slug> with --sync-dir. When its path has a space it refuses and writes nothing. |
modrinth |
Manual. Never writes the app's database. Writes sculk/ in the profile folder the player picks and prints the argument to paste in the profile's Java arguments. |
manual |
Writes sculk/ in the folder the player picks and prints the absolute agent argument, quoted when the path has a space. |
GDLauncher is not supported yet.
Loaders in the Minecraft Launcher#
The Minecraft Launcher starts a profile from versions/<id>/<id>.json. A loader's JSON names the vanilla version it builds on in inheritsFrom, and the launcher downloads that version and every library on the first Play. InstallerConfig.LoaderKind holds what differs per loader: the version id, where to download it and how.
| Loader | Version id | What the installer does |
|---|---|---|
| Fabric | fabric-loader-<loader>-<mc> |
Downloads https://meta.fabricmc.net/v2/versions/loader/<mc>/<loader>/profile/json, checks that its id is the version id and writes it. That is all Fabric's own installer writes. |
| Quilt | quilt-loader-<loader>-<mc> |
The same with https://meta.quiltmc.org/v3/versions/loader/<mc>/<loader>/profile/json. |
| NeoForge | neoforge-<loader> |
Downloads https://maven.neoforged.net/releases/net/neoforged/neoforge/<loader>/neoforge-<loader>-installer.jar, checks it against the .sha1 the Maven publishes (.sha256 or .md5 when there is no .sha1) and runs <java.home>/bin/java -jar <installer> --installClient <.minecraft> in a temporary folder. |
| Forge | <mc>-forge-<loader> |
The same with https://maven.minecraftforge.net/net/minecraftforge/forge/<mc>-<loader>/forge-<mc>-<loader>-installer.jar. |
| Vanilla | <mc> |
Nothing: the launcher has every vanilla version. |
When the version JSON is already there it prints <loader> for Minecraft <mc> is already installed. and downloads nothing. Downloads follow redirects, never from https to http, time out after 10 seconds to connect and 30 to read, and go to a temporary file first, so a failure leaves no partial file. The Forge and NeoForge installers download the vanilla version (versions/<mc>/<mc>.json and its jar) and the libraries they patch themselves; their output goes to the log without the thousands of lines that list patched classes. They also add a profile named after themselves (NeoForge, forge), so the installer removes every profile that was not in launcher_profiles.json before the run, except sculk-<slug>, also when they fail. Their installers need launcher_profiles.json, which the launcher writes on its first start.
A failure says why and what to do next:
$ java -jar sculk-installer.jar --cli --launcher mojang
Installing Sculk Testing for Minecraft Launcher in C:\Users\Ana\AppData\Roaming\.minecraft
Could not download https://maven.neoforged.net/releases/net/neoforged/neoforge/21.1.266/neoforge-21.1.266-installer.jar (java.net.UnknownHostException: maven.neoforged.net). Check your internet connection and run the installer again.Tests point every loader download at a stand-in server with the SCULK_LOADER_BASE environment variable or the sculk.loaderBase system property: the loader's path is appended to it instead of its own server.
Tunnel agent mode (opt-in)#
sculk-sync.jar can also act as a Sculkworm tunnel agent for a closed route (see crates/sculkworm/docs/tunnel.md): it dials out to the relay's TLS tunnel listener (ALPN sculkworm), authenticates with a per-route swa_ agent token, serves incoming player streams to a local TCP target (host:port), sends PING/PONG keepalives, reconnects with full-jitter exponential backoff, and honors GOAWAY (including GOAWAY replaced, where it drains open streams and exits with code 3 without reconnecting).
The agent is opt-in: if sculk.json has no tunnel block (or "enabled": false), sculk-sync.jar makes zero tunnel network connections and behaves identically to standard sync mode.
Configuration in sculk.json#
Add an optional tunnel object to sculk.json:
{
"manifestUrl": "https://sculk.network/c/<token>/manifest.json",
"tunnel": {
"relay": "https://relay.example:8443",
"route": "friends.play.example",
"token": "swa_<token-id>_<token-secret>",
"target": "127.0.0.1:25565",
"caFile": "relay-ca.pem",
"pin": "sha256/<base64-spki-sha256>"
}
}| Field | Required | Default | Meaning |
|---|---|---|---|
enabled |
No | true |
Set to false to disable the tunnel agent without removing the block. |
relay |
Yes | — | Relay tunnel URL (https://host[:port]) or host[:port] (default port 443). |
route |
Yes | — | Closed route hostname registered on the relay. |
token |
Yes* | — | Per-route agent token (swa_<id>_<secret>). Masked in log output. |
tokenFile |
Yes* | — | Path to a file containing the agent token (relative to the instance folder, or absolute). Used when token is omitted. |
target |
No | 127.0.0.1:25565 |
Local Minecraft server host:port to bridge incoming OPEN streams to (5 s connect timeout). |
caFile |
No | OS/JDK roots | PEM certificate/CA file replacing the default trust store (useful for self-signed or private relay CAs). Relative to the instance folder, or absolute. |
pin / pins |
No | — | Optional SPKI SHA-256 certificate pin (sha256/<base64>) or array of pins checked in addition to normal certificate chain and hostname verification. |
software |
No | sculk-sync/1 |
Software string sent in HELLO (at most 64 UTF-8 bytes). |
*Either token or tokenFile must be set.
Running the tunnel agent#
- Standalone foreground mode: run
java -jar sculk-sync.jar --tunnel-agent [instance-dir](or setINST_DIR). The process runs the reconnect loop in the foreground, shuts down cleanly withGOAWAY normalonSIGTERM/SIGINT, and returns the spec exit codes (0on clean shutdown,2on config error /unsupported_version/unknown_route,3onGOAWAY replaced). - In-JVM
-javaagentmode: when launched with-javaagent:sculk-sync.jar=<instance dir>andsculk.jsoncontains an enabledtunnelblock,premainstarts the tunnel agent on a daemon thread right after sync completes so it runs alongside the JVM process and sendsGOAWAY normalvia a shutdown hook when the JVM exits.
Java 8u251+ or Java 9+ is required for TLS ALPN (sculkworm).
Sculkworm connect client (player side)#
sculkworm-connect.jar and sculk-sync-sculkworm.jar carry a pure Java 8 port of the player-side sculkworm-connect client (see crates/sculkworm/docs/tunnel.md sections 4 and 5). It authenticates players via the relay's loopback redirect + PKCE S256 flow (falling back to the RFC 8628 device flow with --device or whenever a browser cannot be opened), stores opaque swl_ sealed logins in logins.json (0600 on POSIX, atomic temp + fsync + rename), mints short-lived swt_ tickets via POST /tickets, opens a lazy TLS ALPN sculkworm connect session on the first local Minecraft connection (reused across connections and closed after 60 s idle), and answers the local Minecraft client with the exact section 4.6 packets when the route is offline, login is still in progress, or an error occurs.
Configuration in sculk.json (connect block)#
Add an optional connect object to sculk.json when using -javaagent:sculkworm-connect.jar=<instance dir> or -javaagent:sculk-sync-sculkworm.jar=<instance dir>:
{
"manifestUrl": "https://sculk.network/c/<token>/manifest.json",
"connect": {
"enabled": true,
"relay": "https://relay.example",
"route": "friends.play.example",
"listen": "127.0.0.1:25565",
"caFile": "relay-ca.pem",
"pin": "sha256/<base64-spki-sha256>"
}
}| Field | Required | Default | Meaning |
|---|---|---|---|
enabled |
No | true |
Set to false to disable connect (zero network activity and zero threads). |
relay |
Yes | — | Relay public https:// URL (SCULKWORM_PUBLIC_URL, https:// only). |
route |
Yes | — | Closed route hostname registered on the relay. |
listen |
No | 127.0.0.1:25565 |
Local Minecraft listener ip:port. Non-loopback addresses require "listenAny": true. |
listenAny |
No | false |
Allow binding listen to a non-loopback address. |
caFile |
No | OS/JDK roots | PEM CA/certificate file replacing the default trust store (relative to the instance folder, or absolute). |
pin / pins |
No | — | Optional SPKI SHA-256 certificate pin (sha256/<base64>) or array of pins checked on both HTTPS API and tunnel connections. |
loginsFile |
No | <instance dir>/sculkworm/logins.json |
Path to logins.json (kept inside the instance folder by default in -javaagent mode). |
device |
No | false |
Force the RFC 8628 device login flow instead of opening a local browser. |
software |
No | sculkworm-connect/0.1 |
Software string sent in HELLO (at most 64 UTF-8 bytes). |
In -javaagent mode, premain never blocks the game JVM: if connect is absent or "enabled": false it starts no threads and opens no sockets; otherwise it binds the local listener and, if no stored login exists for (route, relay), starts the login flow on a daemon thread while answering local joins with a Login Disconnect telling the player to finish logging in in the browser and retry. All threads are daemon threads and exit cleanly with the game.
Prism instance export with a closed tunnel#
When a server has an active closed Sculkworm route and the caller has server.play (with the sculkworm feature flag enabled), GET /api/servers/:id/export/prism keeps the sync pre-launch hook unchanged (PreLaunchCommand=$INST_JAVA -jar $INST_DIR/sculk-sync.jar) and adds the tunnel client alongside it:
<root>/sculkworm-connect.jarin the instance root (kept separate fromsculk-sync.jar).sculk.jsongets"connect": { "enabled": true, "relay": "<relayUrl>", "route": "<route>" }.instance.cfgaddsOverrideJavaArgs=trueandJvmArgs=-javaagent:../sculkworm-connect.jar=... Prism Launcher does not expand$INST_DIRinsideJvmArgs(passing-javaagent:$INST_DIR/sculkworm-connect.jar=$INST_DIRfails JVM startup withError opening zip file or JAR manifest missing : $INST_DIR/sculkworm-connect.jar), whereas it always starts the game JVM with<instance>/minecraftas its working directory. The relative../sculkworm-connect.jar=..form resolves to<instance>/sculkworm-connect.jarand passes<instance>as the premain argument, working even when the instance or user directory path contains spaces.<root>/minecraft/servers.dat(uncompressed NBT) pre-populated with one server entry{ name: <server name>, ip: "127.0.0.1:25565" }matching the default local connect listener. Whilesculk.jsonhas an enabledconnectblock, the sync skips aservers.datthe channel manifest lists (the log showsSKIPPED servers.dat), so the repository's server list never replaces the one that points at the local listener; withoutconnectit syncs like any other file.
When the sculkworm flag is off, the server has no active closed route, or the caller lacks server.play, none of those files or keys are added and the exported zip is unchanged.
Standalone CLI (sculkworm-connect.jar)#
Every Sculkworm release (sculkworm-v<version> on the Releases page) attaches sculkworm-connect.jar alongside SHA256SUMS so players can download and verify it without building from source:
TAG=sculkworm-v0.1.0-nightly.20261127.5
curl -sSfLO "https://github.com/YellowUmbrellaDev/sculk.network/releases/download/${TAG}/sculkworm-connect.jar"
curl -sSfLO "https://github.com/YellowUmbrellaDev/sculk.network/releases/download/${TAG}/SHA256SUMS"
sha256sum -c SHA256SUMS --ignore-missing
java -jar sculkworm-connect.jar --helpOr run the locally built jar at clients/sync/out/sculkworm-connect.jar:
java -jar clients/sync/out/sculkworm-connect.jar --helpUsage: sculkworm-connect <command> [OPTIONS]
Commands:
play <host[:port]> Log in if needed and open a local Minecraft listener for <host>
login <host[:port]> Log in to a closed route via browser redirect or device flow
logout <route|--all> Revoke and remove a stored login (or all logins)
Options:
--relay <https://...> Relay URL (skips Minecraft status-ping discovery)
--device Use device flow instead of opening a local browser
--listen <ip:port> Local listener address for play (default: 127.0.0.1:25565)
--listen-any Allow binding --listen to a non-loopback address
--ca-file <pem> PEM CA/cert file replacing OS roots (env: SCULKWORM_CONNECT_CA_FILE)
--pin <sha256/base64> Expected leaf SPKI SHA-256 pin; repeatable (env: SCULKWORM_CONNECT_PIN)
--logins <path> Override logins.json path (alias: --logins-file; env: SCULKWORM_CONNECT_LOGINS_FILE)
--yes Skip confirmation prompt for relay URL discovered via status ping
--software <string> Software string sent in HELLO (default: sculkworm-connect/0.1)
-h, --help Show this help textIn standalone CLI mode, logins.json defaults to the OS config path from crates/sculkworm/docs/tunnel.md section 5.8 ($XDG_CONFIG_HOME/sculkworm/logins.json or ~/.config/sculkworm/logins.json on Linux/Unix, ~/Library/Application Support/sculkworm/logins.json on macOS, %APPDATA%\sculkworm\logins.json on Windows), so logins interoperate directly with the Rust sculkworm-connect binary. Relay discovery follows section 4.2 (--relay, then stored login's relay, then Minecraft status ping reading sculkworm.relay with a [y/N] prompt unless --yes is passed). Usage, configuration, and port-in-use errors exit with code 2.
Tests#
pnpm --filter @sculk/sync test runs every case on Java 8 and Java 21 in Docker. test/sync.test.ts covers both modes of the sync jar. test/tunnel.test.ts runs test/java/TunnelProtocolTest.java and test/java/TunnelAgentTest.java on Java 8 and Java 21 to verify every hex vector in crates/sculkworm/docs/tunnel.md, the session multiplexer over in-memory pipes, the reconnect backoff policy, TLS/ALPN/SPKI pinning, stream bridging, and GOAWAY handling; when SCULKWORM_BIN points to a built sculkworm binary, it also runs an end-to-end interoperability test against the real relay (registering a closed route and agent token via the admin API, connecting sculk-sync.jar --tunnel-agent, pushing a real Minecraft status ping over TCP, and verifying GOAWAY replaced exit code 3). test/connect.test.ts runs test/java/SculkwormConnectTest.java on Java 8 and Java 21 to verify the RFC 7636 PKCE vector, token masking, section 4.6 Minecraft failure packet hex vectors, logins.json round-trip and POSIX 0600/0700 permissions, sculk.json connect config and CLI parsing, loopback PKCE and device fallback login flows, ticket rotation and 401 re-login, lazy session reuse and idle timeout, premain pending-login replies, jar manifests, and (when SCULKWORM_BIN is set) a full end-to-end test against the real Sculkworm relay with a mock OAuth2 IdP, Java agent, and Java sculkworm-connect.jar bridging a Minecraft status ping to a stand-in server. test/installer.test.ts writes a sculk-installer.json and an icon into the built installer, runs it against a temporary home for each launcher, reruns it and compares the files, then starts a stand-in game with the Java arguments the installer wrote and checks that the mods folder was synced first. A local HTTP server stands in for the loaders' meta servers and Mavens, and test/fixtures/FakeInstaller.java for the Forge and NeoForge installers: it adds its own profile like they do.