# yashr-cmd/runtime-agent architecture

> Architecture diagram of the GitHub repository yashr-cmd/runtime-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashr-cmd/runtime-agent
- Repository: https://github.com/yashr-cmd/runtime-agent

## Overview

Transfinity is a JVM runtime agent for protecting a Minecraft runtime, with gameplay protections and hostile-mod/transformer defenses. The main workflow is launch-time native setup, agent startup, and bytecode patching that delegates runtime checks to protection modules. Additional branches cover armor-invulnerability Lua rules, launcher and event-bus guards, and hostile-thread detection. The README is empty; relationships below rely on sampled source and the SOURCE INDEX, so unsampled behavior is represented only where those references support it.

Main entry points: [`src/main/java/runtime/RuntimeAgent.java`](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/RuntimeAgent.java) (Runtime agent), [`src/main/java/runtime/bootstrap/NativeBootstrap.java`](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/NativeBootstrap.java) (Native bootstrap), [`src/main/java/runtime/RuntimePatch.java`](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/RuntimePatch.java) (Bytecode patcher), [`src/main/java/runtime/HostileRegistry.java`](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/HostileRegistry.java) (Hostile registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["Launch bootstrap"]
  node_native["Native bootstrap"]
  node_launch_context["JVM launch context"]
  node_launch_contract["Launch context contract<br/>[LaunchContext.java]"]
  node_platform["Platform detection"]
  node_extractor["Native library extraction"]
  node_server_detect["Server launch detection"]
  node_server_attach["Server native attach"]
  node_attacher["Attach entry point<br/>[AttacherMain.java]"]
  node_native_agent["JVMTI agent binaries"]
end

subgraph group_agent["Agent runtime"]
  node_runtime_agent["Runtime agent<br/>[RuntimeAgent.java]"]
  node_patcher["Bytecode patcher<br/>[RuntimePatch.java]"]
  node_watchdog["Transformer watchdog"]
end

subgraph group_defense["Runtime defenses"]
  node_thread_sanitizer["Thread sanitizer"]
  node_hostile_registry["Hostile registry"]
  node_trust["Trust checker<br/>[TrustChecker.java]"]
  node_launcher_guard["Launcher state guard"]
  node_forge_guard["Forge launcher guard"]
  node_event_fixer["Event bus fixer<br/>[EventBusFixer.java]"]
end

subgraph group_gameplay["Gameplay protections"]
  node_armor_guard["Armor lock guard"]
  node_armor_bridge["Armor invulnerability bridge"]
  node_lua_engine["Lua armor engine"]
  node_lua_script["Armor invulnerability rules<br/>[armor_invuln.lua]"]
  node_health_guard["Health guard<br/>[HealthGuard.java]"]
  node_god_helper["God-mode helper<br/>[GodHelper.java]"]
  node_spoof["Preator spoof<br/>[PreatorSpoof.java]"]
end

subgraph group_support["Runtime support"]
  node_hardened_thread["Hardened thread"]
  node_log["Agent logging<br/>[AgentLog.java]"]
end

node_launcher(("Game launcher"))

node_launcher -.->|"starts or attaches"| node_native
node_native -->|"reads launch state"| node_launch_context
node_launch_context -->|"implements"| node_launch_contract
node_native -->|"selects platform"| node_platform
node_native -->|"extracts library"| node_extractor
node_native -->|"checks server launch"| node_server_detect
node_native -->|"attaches server agent"| node_server_attach
node_native -.->|"loads native library"| node_native_agent
node_attacher -->|"supports attachment"| node_server_attach
node_native -.->|"relaunches with agent"| node_runtime_agent
node_runtime_agent -->|"registers transformer"| node_patcher
node_runtime_agent -->|"starts watchdog"| node_watchdog
node_runtime_agent -->|"starts on thread"| node_hardened_thread
node_runtime_agent -->|"initializes guard"| node_launcher_guard
node_runtime_agent -->|"initializes guard"| node_forge_guard
node_runtime_agent -->|"initializes sanitizer"| node_thread_sanitizer
node_runtime_agent -->|"initializes fixer"| node_event_fixer
node_runtime_agent -->|"initializes guard"| node_health_guard
node_runtime_agent -->|"initializes guard"| node_armor_guard
node_runtime_agent -->|"initializes engine"| node_lua_engine
node_runtime_agent -->|"initializes registry"| node_hostile_registry
node_runtime_agent -->|"initializes helper"| node_god_helper
node_runtime_agent -->|"initializes spoofing"| node_spoof
node_patcher -->|"injects armor checks"| node_armor_guard
node_patcher -->|"injects health checks"| node_health_guard
node_patcher -->|"injects god checks"| node_god_helper
node_patcher -->|"references spoofing"| node_spoof
node_patcher -->|"references registry"| node_hostile_registry
node_patcher -->|"references sanitizer"| node_thread_sanitizer
node_thread_sanitizer -->|"checks hostile threads"| node_hostile_registry
node_event_fixer -->|"consults registry"| node_hostile_registry
node_forge_guard -->|"consults registry"| node_hostile_registry
node_armor_guard -->|"checks trust"| node_trust
node_health_guard -->|"checks trust"| node_trust
node_armor_bridge -->|"calls engine"| node_lua_engine
node_lua_engine -->|"loads rules"| node_lua_script
node_runtime_agent -->|"writes diagnostics"| node_log
node_patcher -->|"writes diagnostics"| node_log
node_native -->|"writes diagnostics"| node_log

click node_native "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/NativeBootstrap.java"
click node_launch_context "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/JvmLaunchContext.java"
click node_launch_contract "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/LaunchContext.java"
click node_platform "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/NativePlatform.java"
click node_extractor "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/NativeLibraryExtractor.java"
click node_server_detect "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/ServerLaunchDetector.java"
click node_server_attach "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/ServerNativeAttach.java"
click node_attacher "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/AttacherMain.java"
click node_native_agent "https://github.com/yashr-cmd/runtime-agent/tree/main/src/main/resources/JVMTI_AGENT"
click node_runtime_agent "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/RuntimeAgent.java"
click node_patcher "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/RuntimePatch.java"
click node_watchdog "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/TransformerWatchdog.java"
click node_thread_sanitizer "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ThreadSanitizer.java"
click node_hostile_registry "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/HostileRegistry.java"
click node_trust "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/TrustChecker.java"
click node_launcher_guard "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/LauncherStateGuard.java"
click node_forge_guard "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ForgeLauncherGuard.java"
click node_event_fixer "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/EventBusFixer.java"
click node_armor_guard "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ArmorLockGuard.java"
click node_armor_bridge "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ArmorInvulnBridge.java"
click node_lua_engine "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/LuaArmorEngine.java"
click node_lua_script "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/resources/scripts/lua/armor_invuln.lua"
click node_health_guard "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/HealthGuard.java"
click node_god_helper "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/GodHelper.java"
click node_spoof "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/PreatorSpoof.java"
click node_hardened_thread "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/HardenedThread.java"
click node_log "https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/AgentLog.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_native,node_launch_context,node_launch_contract,node_platform,node_extractor,node_server_detect,node_server_attach,node_attacher,node_native_agent toneBlue
class node_runtime_agent,node_patcher,node_watchdog toneAmber
class node_thread_sanitizer,node_hostile_registry,node_trust,node_launcher_guard,node_forge_guard,node_event_fixer toneMint
class node_armor_guard,node_armor_bridge,node_lua_engine,node_lua_script,node_health_guard,node_god_helper,node_spoof toneRose
class node_hardened_thread,node_log,node_launcher toneIndigo
```

## Components

### Launch bootstrap

- [Native bootstrap](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/NativeBootstrap.java): `src/main/java/runtime/bootstrap/NativeBootstrap.java`
- [JVM launch context](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/JvmLaunchContext.java): `src/main/java/runtime/bootstrap/JvmLaunchContext.java`
- [Launch context contract](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/LaunchContext.java): `src/main/java/runtime/bootstrap/LaunchContext.java`
- [Platform detection](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/NativePlatform.java): `src/main/java/runtime/bootstrap/NativePlatform.java`
- [Native library extraction](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/NativeLibraryExtractor.java): `src/main/java/runtime/bootstrap/NativeLibraryExtractor.java`
- [Server launch detection](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/ServerLaunchDetector.java): `src/main/java/runtime/bootstrap/ServerLaunchDetector.java`
- [Server native attach](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/bootstrap/ServerNativeAttach.java): `src/main/java/runtime/bootstrap/ServerNativeAttach.java`
- [Attach entry point](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/AttacherMain.java): `src/main/java/runtime/AttacherMain.java`
- [JVMTI agent binaries](https://github.com/yashr-cmd/runtime-agent/tree/main/src/main/resources/JVMTI_AGENT): `src/main/resources/JVMTI_AGENT`

### Agent runtime

- [Runtime agent](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/RuntimeAgent.java): `src/main/java/runtime/RuntimeAgent.java`
- [Bytecode patcher](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/RuntimePatch.java): `src/main/java/runtime/RuntimePatch.java`
- [Transformer watchdog](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/TransformerWatchdog.java): `src/main/java/runtime/TransformerWatchdog.java`

### Runtime defenses

- [Thread sanitizer](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ThreadSanitizer.java): `src/main/java/runtime/ThreadSanitizer.java`
- [Hostile registry](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/HostileRegistry.java): `src/main/java/runtime/HostileRegistry.java`
- [Trust checker](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/TrustChecker.java): `src/main/java/runtime/TrustChecker.java`
- [Launcher state guard](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/LauncherStateGuard.java): `src/main/java/runtime/LauncherStateGuard.java`
- [Forge launcher guard](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ForgeLauncherGuard.java): `src/main/java/runtime/ForgeLauncherGuard.java`
- [Event bus fixer](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/EventBusFixer.java): `src/main/java/runtime/EventBusFixer.java`

### Gameplay protections

- [Armor lock guard](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ArmorLockGuard.java): `src/main/java/runtime/ArmorLockGuard.java`
- [Armor invulnerability bridge](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/ArmorInvulnBridge.java): `src/main/java/runtime/ArmorInvulnBridge.java`
- [Lua armor engine](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/LuaArmorEngine.java): `src/main/java/runtime/LuaArmorEngine.java`
- [Armor invulnerability rules](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/resources/scripts/lua/armor_invuln.lua): `src/main/resources/scripts/lua/armor_invuln.lua`
- [Health guard](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/HealthGuard.java): `src/main/java/runtime/HealthGuard.java`
- [God-mode helper](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/GodHelper.java): `src/main/java/runtime/GodHelper.java`
- [Preator spoof](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/PreatorSpoof.java): `src/main/java/runtime/PreatorSpoof.java`

### Runtime support

- [Hardened thread](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/HardenedThread.java): `src/main/java/runtime/HardenedThread.java`
- [Agent logging](https://github.com/yashr-cmd/runtime-agent/blob/main/src/main/java/runtime/AgentLog.java): `src/main/java/runtime/AgentLog.java`

### Other components

- **Game launcher**

## Connections

- Game launcher → Native bootstrap: starts or attaches
- Native bootstrap → JVM launch context: reads launch state (evidence: `src/main/java/runtime/bootstrap/NativeBootstrap.java`)
- JVM launch context → Launch context contract: implements (evidence: `src/main/java/runtime/bootstrap/JvmLaunchContext.java`)
- Native bootstrap → Platform detection: selects platform (evidence: `src/main/java/runtime/bootstrap/NativeBootstrap.java`)
- Native bootstrap → Native library extraction: extracts library (evidence: `src/main/java/runtime/bootstrap/NativeBootstrap.java`)
- Native bootstrap → Server launch detection: checks server launch (evidence: `src/main/java/runtime/bootstrap/NativeBootstrap.java`)
- Native bootstrap → Server native attach: attaches server agent (evidence: `src/main/java/runtime/bootstrap/NativeBootstrap.java`)
- Native bootstrap → JVMTI agent binaries: loads native library
- Attach entry point → Server native attach: supports attachment (evidence: `src/main/java/runtime/bootstrap/ServerNativeAttach.java`)
- Native bootstrap → Runtime agent: relaunches with agent (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Bytecode patcher: registers transformer (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Transformer watchdog: starts watchdog (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Hardened thread: starts on thread (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Launcher state guard: initializes guard (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Forge launcher guard: initializes guard (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Thread sanitizer: initializes sanitizer (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Event bus fixer: initializes fixer (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Health guard: initializes guard (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Armor lock guard: initializes guard (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Lua armor engine: initializes engine (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Hostile registry: initializes registry (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → God-mode helper: initializes helper (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Runtime agent → Preator spoof: initializes spoofing (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Bytecode patcher → Armor lock guard: injects armor checks (evidence: `src/main/java/runtime/RuntimePatch.java`)
- Bytecode patcher → Health guard: injects health checks (evidence: `src/main/java/runtime/RuntimePatch.java`)
- Bytecode patcher → God-mode helper: injects god checks (evidence: `src/main/java/runtime/RuntimePatch.java`)
- Bytecode patcher → Preator spoof: references spoofing (evidence: `src/main/java/runtime/RuntimePatch.java`)
- Bytecode patcher → Hostile registry: references registry (evidence: `src/main/java/runtime/RuntimePatch.java`)
- Bytecode patcher → Thread sanitizer: references sanitizer (evidence: `src/main/java/runtime/RuntimePatch.java`)
- Thread sanitizer → Hostile registry: checks hostile threads (evidence: `src/main/java/runtime/ThreadSanitizer.java`)
- Event bus fixer → Hostile registry: consults registry (evidence: `src/main/java/runtime/EventBusFixer.java`)
- Forge launcher guard → Hostile registry: consults registry (evidence: `src/main/java/runtime/ForgeLauncherGuard.java`)
- Armor lock guard → Trust checker: checks trust (evidence: `src/main/java/runtime/ArmorLockGuard.java`)
- Health guard → Trust checker: checks trust (evidence: `src/main/java/runtime/HealthGuard.java`)
- Armor invulnerability bridge → Lua armor engine: calls engine (evidence: `src/main/java/runtime/ArmorInvulnBridge.java`)
- Lua armor engine → Armor invulnerability rules: loads rules (evidence: `src/main/java/runtime/LuaArmorEngine.java`)
- Runtime agent → Agent logging: writes diagnostics (evidence: `src/main/java/runtime/RuntimeAgent.java`)
- Bytecode patcher → Agent logging: writes diagnostics (evidence: `src/main/java/runtime/RuntimePatch.java`)
- Native bootstrap → Agent logging: writes diagnostics (evidence: `src/main/java/runtime/bootstrap/NativeBootstrap.java`)
