This file provides guidance to AI coding agents working with code in this repository.
Rust monorepo for game modification projects built on the Injection Toolkit (ITK) framework. The architecture follows "minimal injection, maximal external processing" — injected code in the target game process is kept minimal, with heavy processing in external daemon and overlay processes connected via IPC and shared memory.
All code is authored by AI agents under human direction. No external contributions are accepted (see CONTRIBUTING.md).
This is a Cargo workspace. All CI runs containerized via Docker but the commands work locally:
# Format check
cargo fmt --all -- --check
# Lint (warnings are errors in CI)
cargo clippy --all-targets -- -D warnings
# Run all tests
cargo test
# Run a single crate's tests
cargo test -p itk-protocol
# Run a specific test by name
cargo test -p itk-shmem -- seqlock_concurrent
# Build release
cargo build --release
# License and advisory audit
cargo deny checkCI pipeline order: fmt → clippy → test → build → cargo-deny.
To match CI exactly (containerized):
docker compose --profile ci run --rm rust-ci cargo test- Rust Edition 2024. Formatting enforced by
rustfmt.toml: 100-char max line width, 4-space indentation, Unix newlines,Tallfn params layout. - Run
cargo fmt --allbefore committing. CI rejects unformatted code. - Clippy warnings treated as errors in CI:
cargo clippy --all-targets -- -D warnings. - Workspace-level lints in root
Cargo.toml:clippy::dbg_macro,clippy::todo,clippy::unimplemented, andunsafe_op_in_unsafe_fnare all warnings.
13 crates organized into four layers:
Core libraries (core/):
itk-protocol— Wire protocol (20-byte header + bincode payload, CRC32 validated, 1 MB max)itk-shmem— Cross-platform shared memory with seqlock (single-writer, multi-reader)itk-ipc— Named pipes (Windows) / Unix sockets (Linux)itk-sync— Clock synchronization and drift correctionitk-video— Video decoding via ffmpeg-nextitk-net— P2P networking via laminar
Framework templates: daemon/, overlay/, injectors/windows/native-dll/, injectors/linux/ld-preload/
Active project: projects/nms-cockpit-video/ — No Man's Sky cockpit video player (daemon, injector, overlay, launcher)
Tools: tools/mem-scanner/ — Memory pattern scanning for reverse engineering
Launcher (orchestration)
├── Daemon (external) — video decode, audio, IPC server, shared memory writer
├── Injector (DLL/SO) — Vulkan hooks, minimal state extraction, IPC client
└── Overlay (optional) — egui + wgpu transparent window, shared memory reader
Components run in separate processes. A crash in any one component does not bring down the others.
- All data from injectors is untrusted. Validate: NaN/Inf, numeric bounds, string lengths (256-byte cap), data sizes (64 KB cap).
- Seqlock shared memory is single-writer only. Multiple concurrent writers corrupt the sequence counter.
- Unsafe code requires detailed
// SAFETY:comments explaining the invariant. - Named pipes use process-token ACLs (Windows); Unix sockets use
0600permissions (Linux).
- Dependencies are managed at workspace level in the root
Cargo.toml. Add new dependencies there. - Error handling:
thiserrorfor library error types,anyhowfor application-level errors. - Logging:
tracingcrate withtracing-subscriberenv-filter. Notlogorprintln!. - Platform-specific code uses
cfg_if!blocks initk-shmemanditk-ipc. - Protocol changes: add variant to
MessageTypeenum initk-protocol, define payload struct with serde derives, update daemon handlers. - New injector platforms go in
injectors/and implement IPC client + platform-specific init.
Three GitHub Actions workflows on self-hosted runners:
ci.yml— Runs on push to main. Format, lint, test, build, cargo-deny.main-ci.yml— Runs on main push and tags. Same CI stages plus auto-creates GitHub issues on failure.pr-validation.yml— Runs on PRs. CI stages + Gemini AI review (primary) + automated agent fix iterations (max 5, extendable with[CONTINUE]comment). Addno-auto-fixlabel to disable automated fixes.
Agent commit authors: AI Review Agent, AI Pipeline Agent, AI Agent Bot.
Two advisories ignored in deny.toml:
RUSTSEC-2025-0141— bincode unmaintained (migration planned)RUSTSEC-2026-0007— bytes integer overflow (update pending)