A universally injectable enemy-intelligence kernel for computer games: host-agnostic and deterministic, with an Idris2-verified C ABI over a Zig zero-overhead FFI seam, so enemy behaviour is authored once and injected into whatever engine the game already uses.
|
Important
|
Status: Phase 1 complete — the ABI seam is frozen; the kernel is a skeleton. This
repository was minted from the RSR template on 2026-09-20. What exists today is the
seam, end to end and mechanically gated: seven ABI structs proved in Idris2, a
generated Phase 2 has landed its first half: perception and memory, end to end. An agent that
loses sight of a contact investigates where it went, for at most 36 ticks, and then
forgets — and forgetting clears the payload rather than only lowering a flag.
Phase 2 has also landed the control layer above the rule: modes plus a score margin
( Phase 2 has also landed the rule itself, rewritten as a utility graph
( The ABI did not move to make room for it. v0’s The whole seam in one command: just seam-check # model → artefacts → no drift → C header compiles → 28 tests → both hosts agree |
Most game AI is welded to one engine. Evil Weevil inverts that: the intelligence is a kernel that the game hosts, not a library the game is built around.
The kernel owns perception memory, decision-making (utility scoring over a behaviour graph), steering and a tick budget. It owns no rendering, no physics, no scene graph, and no networking. The host supplies world data once per tick as a validated snapshot; the kernel returns intents. It never calls back into the host mid-tick — which is the single decision that lets one implementation serve very different hosts.
| Mode | Trade-off |
|---|---|
A. In-process library (C ABI: |
The default and the fastest. Requires linking or loading a native library. |
B. Sidecar process (shared memory + ring buffer) |
For hosts that cannot rebuild: mod sandboxes, managed runtimes, anti-cheat-constrained environments. Costs about a frame of latency and no kernel changes. |
C. Bytecode blob (WASM / small VM) |
For hosts that only accept a data blob, and for browser play. Slowest; same kernel. |
A host declares its capabilities at init — navmesh, line-of-sight queries, physics raycasts, waypoint graph, spawn rights — and the kernel degrades gracefully (navmesh absent implies steering plus a waypoint graph) rather than aborting. The word "universally" is only meaningful against that ladder.
host adapters Godot 4 · Unity · Unreal · native Rust/Bevy · null host · WASM
(thin, per-engine) each must pass the same conformance kit
|
v
=== SEAM (frozen, versioned) =============================================
include/evil_weevil/ee.h generated from the Idris2 types, never hand-edited
src/interface/Abi/ Idris2: struct layout proofs, enum exhaustiveness,
tick purity and determinism contract
src/interface/ffi/ Zig: the C ABI, comptime layout assertions
=== KERNEL (host-agnostic) ===============================================
perception -> memory -> decision -> action fixed tick, integer-only math
behaviour graph + utility scoring, seeded RNG, per-agent budget guard
=== AUTHORING ============================================================
enemy definition (a2ml) -> compiler -> workbench: headless sim + replay inspectorThe seam is frozen in Phase 1 before any behaviour code exists. An adapter written against a moving header is the one mistake that would sink the whole claim.
The kernel uses integer and fixed-point maths only — no libm — so a replay is
bit-exact across platforms, compilers and injection modes. That buys three things at
once: a golden-replay corpus in CI (scenarios in, intent traces out, hashes compared),
a server that can re-simulate exactly what a client’s enemies did, and regression
detection for "the enemy got dumber at 3am". Each agent carries a hard tick budget and
degrades its own behaviour rather than blowing the frame.
If you are an AI agent installing this project, read the AI installation guide first — it gives the orientation order, the full prompt sequence, and the privacy notice.
The one trap worth stating up front: do not set RSR_NON_INTERACTIVE=1. It
stubs the shell builtin read, which also disables the loops that perform token
substitution — the run never terminates and substitutes nothing. Pipe answers to
stdin instead. (Measured on this repo’s own mint; see
MINT-NOTES.)
just # list every recipe
just validate # structure + metadata gates
just claude-md # regenerate the agent arrival pack from the a2ml descriptiles
just repo-map # regenerate the authoritative repository map (CI fails if stale)
just coapt # regenerate the coaptation receipt (CI fails if stale)Agents start at evil-weevil_chora.deed (the repo deed) or CLAUDE.md,
not here. The generated region of CLAUDE.md is compiled from
.machine_readable/descriptiles/ — edit the a2ml, never the output.
The authoritative map is generated, so it cannot drift from the tree: docs/architecture/REPOSITORY-MAP.adoc.
| Path | What lives there |
|---|---|
|
Start here — humans and AI agents respectively. |
|
The seam: the Idris2 ABI model and proofs ( |
|
The host-agnostic kernel: fixed-point arithmetic, the deterministic RNG, perception and the v0 decision rule. No behaviour beyond that yet. |
|
|
|
The null host in C: a game with no game in it, which is how the header and the library are tested as a host sees them. |
|
Tests; proofs and the golden-replay corpus. |
|
Human documentation, including the development plan and ADRs. |
|
Descriptiles, contractiles and policies that tools and agents read. |
|
Every task runs through |
-
Development plan — what we are building, in what order, and what counts as done.
-
Mint notes — what the RSR mint did and did not do, measured on this repo.
-
ADRs — 0002 variant contract, 0004 injection modes, 0005 ABI versioning, 0006 determinism.
-
Repository map — generated; what every directory is for.
-
AFFIRMATION — the dated honesty snapshot of the repo’s true state.
Code, configuration and scripts are Mozilla Public License 2.0
(MPL-2.0); prose documentation is CC-BY-SA-4.0. Both texts live in LICENSES/,
and per-file SPDX-License-Identifier headers are authoritative. Long-term
attribution uses Quantum-Safe Provenance — see
the Quantum-Safe Provenance exhibit.