5.1 KiB
5.1 KiB
Agent instructions for Incari
Rules and commands for AI agents (and people) working here. Each module also has an AGENTS.md
with its own rules and a README.md saying what it does and how to test it.
The project
Incari ports Minecraft: Java Edition's latest release to the browser and builds a PvP/QoL client on it. Top priority: performance on typical crappy school Chromebooks.
- Patch-only: the game is downloaded and decompiled into
work/(git-ignored); the repo holds Incari's code andpatches/(ADR 0001). - Target: Minecraft 26.3 (unobfuscated, Java 25).
- Compiler: TeaVM 0.16.0, WebAssembly GC, two builds: Fast (JSPI) and Compatible (coroutines) (ADR 0036). Vineflower 1.12.0 decompiles. Both pinned exactly.
- Graphics: WebGL2 under Mojang's
GpuDeviceAPI, shaders translated at build time. - Networking: WebSocket, Eagler's handshake, and ViaVersion in the client (any server 1.8+).
| To learn | Read |
|---|---|
| Layers and modules | ARCHITECTURE.md, gradle/module-boundaries.txt |
| Why it's built this way | docs/adr/README.md |
| Threads in the browser | docs/threading.md |
| Measuring performance | docs/benchmark.md |
| Moving to a new Minecraft release | docs/updating.md |
Hard rules
- Never commit Mojang files or anything from
work/: jars, decompiled source, textures, sounds, models, language files, shaders (translated too), data dumps. - Never commit or publish a build, or link to a hosted one.
- Never copy decompiled code into an Incari module.
./incari copycheckchecks. - Never hand-edit
patches/. Commit inwork/client, then./incari rebuild. - Never reformat vendor code or edit it to silence a warning.
- Never commit secrets. Use environment variables.
- Run the module's tests before finishing, and say what you ran.
Commands
Needs JDK 25+, git and Node 24+.
./incari setup # fresh clone -> patched tree in work/client
./gradlew check # all Java gates and tests, plus the client build
./gradlew :<module>:check # one module
./gradlew spotlessApply # format Java
npm ci && npm run check # TypeScript
./incari rebuild [--check] # work/client commits -> patches/ (--check: fail if stale)
./incari classes [--stamp] # replaced classes whose Mojang original changed (--stamp: reviewed)
./incari copycheck # nothing copied from the game
tools/ci/check-patch-budget.sh # patch size against patches/budget.properties
./incari assets # once: the game's sounds and languages
./gradlew :app-desktop:run # play on the desktop
./gradlew :app-desktop:smokeTest # unattended session (also smokeHost + smokeJoin)
./gradlew :app-web:teavm # browser build, ~10 minutes, ~20 GB memory
./gradlew :app-web:serve # serve it on localhost
./gradlew :app-web:browserCheck # run it headless until the game loop ticks
./incari build --only rust # the experimental Rust build on Horizon (ADR 0068, rust/README.md)
cargo test --manifest-path rust/Cargo.toml # the Rust build's mods
- Smoke tasks can say
BUILD SUCCESSFULwith failures inside. Read the report they write. ./incari surveymust run on exactly JDK 25.
Where you can run what
- Rendering, audio and performance need a real GPU and display. Without one, build and run
unit tests, but don't claim rendering or performance results.
browserCheckuses SwiftShader by default;-Pbrowser.gpu=gluses the GPU. - Network: allow Mojang (
piston-meta.mojang.com,piston-data.mojang.com,resources.download.minecraft.net), Maven Central andrepo.viaversion.com.
Changing game code
- Edit
work/client/src/main/java: a one- or two-line hook into an Incari module, marked// Incari start: <reason>and// Incari end. - Create an equivalent module/change in the experimental Rust port.
- Commit in
work/client, one concern each, subject<subsystem>: <summary>. ./incari rebuild, then commitpatches/here.
Whole-class deletes or replacements go in patches/classes.txt.
Where code goes
- Logic goes in a strict module (
platform-*,render-*,net,mesher,framework,online,features/*).client's own code is only the adapter the patches call. - Platform modules never see game types.
features/*depend only onframework. - Use Mojang's official names. Comments explain why, especially browser limits ("must not block", "worker-side, no game objects", "hot path, don't allocate").
- Player-facing text is plain words, fitted to its box (
Ui.fit,Ui.wrap). Screens fit 320x240 GUI units;./gradlew :app-desktop:smokeLayoutchecks.
Docs
Write short: the point first, plain words, tables and lists over paragraphs, each fact once.
- New decision → an ADR in
docs/adr/plus a line in its index. - Module changed → its
README.md, andARCHITECTURE.mdif the module table changes.
Commits
Sign off every commit (git commit -s). Subjects are <area>: <summary>. Renderer, networking,
patch and licensing changes need a human reviewer (.github/CODEOWNERS).