Instructions for AI agents building mods
For AI agents helping someone build a mod with Ravenswatch Mod Manager (RSMM). Your job is the mod: a folder of data and, where needed, a Lua script that uses RSMM as it stands.
Read Agent quick start first, unless it sent you here.
Follow Writing style for the mod’s description, README, in-game text, release notes, and issue reports. Review the finished text against its checklist before sharing it.
The one rule: RSMM changes go through an issue
Section titled “The one rule: RSMM changes go through an issue”Never push to RSMM and never open a pull request against it. RSMM is Ravenswatch-Modding/RavenswatchModManager. The rule covers direct pushes, branches, pull requests from a fork, and draft pull requests, however small the fix and even if the account you are using has write access.
If the mod needs something RSMM doesn’t have, or RSMM has a bug, the way forward is an issue: see When RSMM is missing something.
Why: the SDK is shared by every mod. A change made for one mod lands in everyone’s game, so the maintainers decide where each capability belongs and build it themselves. A clear issue gets you there faster than a patch they have to take apart.
What this means on disk
Section titled “What this means on disk”The modding tools are a clone of the RSMM repository, and mods are usually written in its mods/ folder, so you may be working inside the RSMM checkout. Git ignores mods/.
| Path | You may |
|---|---|
mods/<your mod id>/ |
Create and edit freely. It can be its own git repository. |
Rest of the RSMM clone (src/, data/, apps/, tests/, docs/, …) |
Read. Update with git pull --ff-only. Make no edits, commits or branches. |
<game>/rsmm/lib/ (the installed Lua SDK) |
Read. A local patch here works only on this machine and is overwritten by the next loader update. |
Everything else in <game>/ |
Change only through rsmm commands. Leave _Save/ and DarkTalesResources/_Cooking/ alone. |
| Other people’s mods | Read. Copy only what their licence allows. |
Before any git command that writes, run git rev-parse --show-toplevel and git remote -v. The top level must be the mod’s own folder (or the author’s own mods repository), and no remote may be RSMM or a fork of it. Otherwise stop. The one exception is git pull --ff-only to update the clone.
Which instructions win
Section titled “Which instructions win”The clone has its own CLAUDE.md, AGENTS.md, CONTRIBUTING.md and .claude/skills/. Your tool may load them automatically. Apart from the pointer to the quick start, they are for people developing RSMM itself. Their facts about the engine and the linter are useful to you; their workflow (editing src/loader/, adding symbols, regenerating files, opening pull requests, publishing releases) is not yours. Where they disagree with this file, follow this file.
The same goes for wording like “move its logic into rsmm.sdk” or “add a symbol to data/symbols.json” in the docs and in rsmm lint output. For a mod author that means: open an issue.
Read the docs first
Section titled “Read the docs first”Ravenswatch runs on its own C++ engine. It is not Unity: there is no Ravenswatch_Data/, Assembly-CSharp.dll or mono runtime, and BepInEx, Harmony, MelonLoader and DLL plugins do not load. RSMM’s loader is a winhttp.dll proxy with an embedded Lua 5.4. Knowledge from modding other games will mislead you, so read before you write. Don’t invent a manifest key, content kind, event or R.* call; look it up.
All pages are on https://docs.rsmm.me. In a clone, the same pages are Markdown files under apps/docs/src/content/docs/ (pull first, so they’re current). Two ways to get them as text:
/llms.txt: an index of every page, small. Open the pages you need from it./llms-mods.txt: every authoring page in one file. It is over 500 KB, so download it and search it unless your context can hold it all.
/llms-full.txt adds the reverse-engineering notes. You don’t need it to build a mod.
Reading order
Section titled “Reading order”Always, before the first line of a mod:
- Mods ship data, not code: the rule everything else follows from.
- The mod lifecycle: how a mod gets into the game and back out.
- Authoring mods: the design workflow. Then use the Mod authoring reference for the fields and recipes your feature needs.
- Content kinds & confidence: what can be added or changed, and how proven each kind is.
Then by what the mod does:
| The mod | Read |
|---|---|
| Is the author’s first | Make your first mod, First mod, by kind, Example mods |
| Adds or edits items | Custom items |
| Adds or edits enemies, bosses | Custom enemies |
| Changes talents | Talent modding, step by step, Advanced talent modding, Talent name lookup |
| Changes numbers | Numeric balance |
| Runs Lua in game | Lua-scripted mod and the Lua gameplay API |
| Reacts to events | Events, Event payloads, and Event systems |
| Will be published | Packaging rules, Online play, rsmm pack and rsmm publish in the CLI reference |
Not set up yet: Set up the modding tools. Something broken: Troubleshooting, then rsmm doctor.
Ask the tools
Section titled “Ask the tools”| Question | Command |
|---|---|
| Which vanilla ids can I clone? | rsmm schema <kind> --grep <text> |
| Which items, enemies, talents exist? | rsmm items, rsmm enemies, rsmm talents |
| Where is this asset? | rsmm assets search <text> |
| Which events can I listen to? | rsmm symbols events [filter] |
| Is my mod valid? | rsmm lint <id> (the id, not a path) |
| What will it change, and what does it overlap? | rsmm diff <id> |
| What happened in game? | rsmm log, rsmm log --grep <text> |
| Is the install healthy? | rsmm doctor |
When sources disagree
Section titled “When sources disagree”Trust rsmm lint, then the Lua SDK source (the module’s header comment), then the Mod authoring reference and the Lua API page, then everything else. Known out-of-date spot:
- The reverse-engineering pages show raw engine calls, hooks and memory access (
rsmm.call,rsmm.hook,rsmm.write_*) from a mod’sinit.lua. Follow Off limits instead.
How a mod is built
Section titled “How a mod is built”A mod is data: a manifest.toml and the assets it uses, plus Lua where needed. A Python script is never the deliverable. rsmm lint fails any *.py in a mod except the on_disable.py lifecycle hook, and an SDK generator stays outside the mod folder.
Describe what the player should experience, including when it starts, stops, and can happen again. For each part, use the first option that can express it.
- A
[[patch]]inmanifest.tomlfor a number, a texture swap or a plaintext field. Patches from different mods merge. - A content definition, in its own folder (
items/ember_charm/item.toml) or as[[content]], for something new or changed. Each content kind is ratedconfirmed,experimentalorguess, and one rated belowconfirmedneedsexperimental = trueunder[mod](sdk.Mod(..., experimental=True)in an SDK generator). - An asset override under
assets/. One mod owns the whole file, so two mods overriding the same file conflict. init.luaat the mod root (notmain.luaorscripts/main.lua), for decisions the supported cooked definitions cannot express. All game interaction from Lua must go through the public, high-level SDK.- An issue, when none of the above can do it.
Cooked definitions can describe runtime triggers, conditions, and timers. Check the relevant kind and fields before moving a rule into Lua. For a Lua dependency, verify the public SDK call and its prerequisites. If it relies on an engine event, look up only the events relevant to the feature and confirm the timing, payload, and repeat behavior in a focused playtest.
Aim for mods that feel built into the game: its own menus, key bindings and events before anything drawn on top or forced every frame. For settings, a config_schema.toml gives the mod rows in Settings > Mods. For keys, R.input.keybinds adds rows to the game’s Controls menu. R.overlay is for data the game has nowhere to show.
Ship only files the author made or changed. rsmm pack refuses unmodified game files, and mods that unlock paid content (DLC heroes, outfits) are not accepted.
Producers and consumers
Section titled “Producers and consumers”This is the idea behind RSMM’s design. Use it to decide where each part of a feature goes.
- A producer makes something available: it emits an event, exposes state, offers one action, or adds native data. It doesn’t know or care who uses it.
- A consumer decides what to do with it. It uses only the producer’s public surface and never reaches behind it.
The same split runs at every level:
| Producer | Consumer | Example |
|---|---|---|
The SDK (R.*, content kinds) |
Your mod | The SDK offers R.camera.zoom. The mod decides when to zoom and how far. |
One R.* submodule |
Another submodule or a mod | R.input reports a wheel notch and knows nothing about cameras. |
| A content kind (build time) | Lua (run time) | The kind adds a marker to a nameplate. Lua decides whose marker shows. |
| One mod | Another mod | A loot mod exposes roll() through R.api. Another mod calls it. |
Your mod is always a consumer of the SDK. It holds the rules, the numbers, the conditions and the taste. The SDK holds the general ability and knows no mod by name.
Splitting a feature
Section titled “Splitting a feature”Say what the feature does in one sentence, then cut it where the concern changes. “Scroll the mouse wheel to zoom the camera, but not in menus”:
| Part | Concern | Who owns it |
|---|---|---|
| The player turned the wheel | Input | R.input (producer) |
| A menu is open | What the UI is showing | R.ui (producer) |
| The view gets closer | Camera | R.camera (producer) |
| One notch is 10%, skip it in menus | This mod’s rules | Your init.lua (consumer) |
Three general producers and one small consumer:
local R = require "rsmm"
if not (R.input and R.input.on_wheel and R.ui and R.ui.is_open and R.camera and R.camera.zoom) then R.log("[wheel-zoom] needs a newer loader (no R.input.on_wheel, R.ui or R.camera.zoom)") returnend
R.input.on_wheel(function(steps) -- R.input: what the player did -- R.ui: what the UI shows. true, false, or nil for "can't tell"; zoom only on a sure false. if R.ui.is_open("menu") ~= false then return end R.camera.zoom(0.9 ^ steps) -- R.camera: what the view doesend)with, in its manifest.toml:
[mod]loader_flags = ["RSMM_ENABLE_HERO_CAPTURE"] # R.camera has to find the heroIf a part has no owner yet, that part is the issue. Build the rest against what exists.
Is the missing part a producer or a consumer?
Section titled “Is the missing part a producer or a consumer?”- Would another, unrelated mod want it, in the same form? Producer. It belongs in RSMM, so open an issue.
- Does it contain this mod’s numbers, text, hero, art or rule? Consumer. It stays in the mod.
- Is it both? Cut it again. “Zoom out when a boss wakes” is a boss event (producer), a zoom (producer) and one line joining them (consumer).
How the R.* submodules work
Section titled “How the R.* submodules work”local R = require "rsmm" is the only entry point (there is no R.call() or rsmm.call()), and every Lua file in the mod that uses R needs it in scope. R is the Lua SDK. Each R.<name> namespace owns one concern. Many live in their own file and the rest in the core file; the SDK attaches them all to R, so use R.camera, not require "rsmm.camera".
A namespace can be missing. If a submodule fails to load, or the player’s loader is older than it, that namespace is nil while the rest of R keeps working. Check for what you use and log a plain reason when it isn’t there. Many calls return nil, reason or false; log the reason when there is one, and look in rsmm log when there isn’t.
Which namespace owns what
Section titled “Which namespace owns what”| Concern | Namespaces |
|---|---|
| Events between the game, the SDK and mods | R.on, R.once, R.on_match, R.off, R.emit, R.events |
| Timing and threads | R.schedule |
| Logging, saved values, settings, translations | R.log, R.kv, R.config, R.i18n |
| Calls between mods, and the installed list | R.api, R.mods |
| What the player pressed | R.input, R.input.keybinds |
| What the view does | R.camera |
| What the UI is showing, and menu pages | R.ui, R.ui.menus |
| Data shown in the desktop overlay | R.overlay |
| Sound | R.audio |
| The run: state, chapters, day and night, map | R.game, R.run, R.daynight, R.map |
| The hero: identity, health, stats, level, status effects | R.hero, R.entity, R.hp, R.stat, R.xp, R.status |
| Abilities, talents, melodies, hero input lock | R.ability, R.talent, R.melody, R.control |
| Items and currencies | R.give, R.item, R.shards, R.ingredient, R.reroll, R.revive |
| Game modifiers and game options | R.modifier, R.options |
| Damage totals and ranking | R.damage |
| Spawning, interactions, projectiles | R.spawn, R.interact, R.projectile |
| Players and network state | R.player, R.lobby, R.net |
| Recording what a playtest showed | R.exp |
A name in this table is not proof that it works. Some calls are experimental, some are kept only for older mods, and a few are placeholders that log “NOT IMPLEMENTED”. Before using one, read its section in the Mod authoring reference or the Lua gameplay API, then the source comment for anything the docs leave open.
In a clone, submodules are src/loader/lua/rsmm/<name>.lua (the file name can differ: R.game is gamevalues.lua) and the core is src/loader/lib/rsmm.lua. The comment above a namespace says what it owns, what was seen working in game, and its limits. data/contracts/r_surface.txt lists the names that exist.
Off limits
Section titled “Off limits”Lint rejects these:
require "rsmm.<anything>", and writing into the SDK (R.x = ...,function R.x()). Keep your own table.R.hook,R.unhook,R.ptr,_internal,R.engine.call_raw,R.engine.resolve,peek,poke,read_*,write_*, and literal game addresses.
Lint doesn’t catch all of these, but leave them alone too:
- Any name starting with an underscore, such as
R.stat._set. R.debugandR.watch, unless the mod is a debugging tool.R.debugneeds the mod taggeddebugortest.- The loader’s native
rsmmtable and direct engine calls, includingR.engine.call,R.engine.call_safe, andR.engine.fn, are RSMM internals. If the mod needs a capability the public SDK lacks, follow When RSMM is missing something.
Runtime rules
Section titled “Runtime rules”- Change the game only from the main thread. Wrap such calls in
R.schedule.next_main(function() ... end), or useafter_main/every_main, including inside event handlers. Plainafter,every,next_frame, thetickevent andR.config.on_changewatchers run on a background thread, where changing the game can crash it. - Declare hero capture.
R.entity,R.stat,R.xp,R.combat,R.cameraand someR.talentcalls needloader_flags = ["RSMM_ENABLE_HERO_CAPTURE"]under[mod]. Without it they never find the hero, and the mod does nothing. Lint warns about this. - Wait for the hero. Calls that act on the hero refuse until the hero’s first attack or ability.
R.give.ready()says when. - Each mod has its own Lua state. Globals aren’t shared. Signal with
R.emitandR.on, and call withR.api.exposeandR.api.require. Only data crosses: no functions as arguments or results. - There is no
ioand nodebug. Save withR.kv; read settings withR.config. - Keep handlers short. Many run inside the game’s own code. Prefer an event for the state change you care about. If polling is necessary, limit its frequency and the state it reads.
- Undo what you hold. Pair
R.control.lock()withR.control.release(). List pinned game options underrestore_optionsin the manifest. - Online, mods are sorted by what they do.
rsmm modpacksays whether a mod counts as client-only or gameplay, and why. Setmultiplayer_scopeto match.
Check the work
Section titled “Check the work”rsmm lint <id> # fix every error; explain every warning you leaversmm diff <id> # what it changes, and what it overlapsrsmm apply # install every enabled modrsmm install-loader # Lua mods only; needed again after a restorersmm run # start the gamersmm log -n 80 # look for "init failed" and "[lua] <id>"rsmm restore --all # undo everythingenabled = truemust be in the manifest, orrsmm applyskips the mod. Examples ship with it off.- No line about the mod in the log usually means the loader isn’t installed or the mod is off.
rsmm doctorchecks the loader. - First prove one complete path in game. Check the qualifying action, an action that should have no effect, and how the behavior resets or expires. If runtime cost matters, measure how often the handler runs and how much work it does.
- Lint passing means the mod is well formed. It doesn’t mean it works. Only the game shows that, and the author is usually the one playing, so tell them exactly what to do in game and what they should see.
- Report honestly: say what was linted, what was seen in game and by whom, and what is untested.
- Before explaining a bug, settle what the author actually saw. Ask one question if the report could mean two things.
rsmm watchre-applies on save while the game runs, which suits Lua changes.- Publishing (
rsmm publish <id>) is public. Do it only when the author asks for that release. The author enters their own API token.
Before packaging for release
Section titled “Before packaging for release”Ask the author this question unless they have already answered it:
When the mod is enabled, when should its effect start, stop, and apply again? What should happen when the mod is disabled?
For a simple on/off mod, propose the usual behavior: the effect works whenever it applies while enabled, including after returning to the menu and starting another run, and is absent while disabled. An effect that only works once per game launch needs to be an explicit design choice.
Review the mod against that answer before handing over a release package. Check the transitions that matter for the feature, such as using it again, changing heroes, starting a new run, or disabling and re-enabling it. If nobody has observed the expected behavior in game yet, package a playtest build and say which checks are still needed before calling it ready for release.
The loader normally runs init.lua once per game launch. Lua locals can
therefore outlive a run. If a flag or cached value belongs to one run, clear it
at the run boundary using R.on("run:end", ...). For example, if a movement
bonus should apply once per run, clear the flag that records whether it was
applied and discard any cached starting speed when the run ends.
When RSMM is missing something
Section titled “When RSMM is missing something”Stop at the gap. Don’t patch RSMM to get past it, and don’t work around lint. Then:
-
Make sure it’s missing. Search
data/contracts/r_surface.txt, the docs andrsmm symbols events. Update first (git pull --ff-only,rsmm update-loader), since it may already have landed. -
Look for an existing issue:
Terminal window gh issue list -R Ravenswatch-Modding/RavenswatchModManager --state all --search "<words>"If there is one, show it to the author. A short comment with their use case beats a duplicate.
-
Split it. One issue per producer. A feature that needs an input piece and a camera piece is two issues that link to each other, with the one the other depends on first.
-
Write the issue and show it to the author. Open it, or comment on an existing one, only once they say yes, because it is public and under their name:
Terminal window gh issue create -R Ravenswatch-Modding/RavenswatchModManager --title "<title>" --body-file <file>Leave labels to the maintainers. Without
gh, give the author the text and https://github.com/Ravenswatch-Modding/RavenswatchModManager/issues/new/choose. -
Carry on with the rest of the mod. Leave the missing part out, or fall back behind a check like the one in the example above. When the feature ships, set the oldest version that has it (these numbers are only examples):
[requires]loader = 66 # Lua SDK and loader featurescli = 31 # manifest and content features
Request for something new
Section titled “Request for something new”Title: <R.namespace or content kind>: <the capability, in a few words>
**What's missing**One capability, in one or two sentences. What a mod can't do today.
**Where it belongs**The R.* namespace or content kind that owns this concern, and why.
**Suggested shape**Producer only: the event and its payload, the state to read, or the one call.Nothing specific to this mod.
**Who uses it**The mod's name (and a link, if public), and what it will do with it.
**What I tried**Existing calls you checked and why each falls short, with file or page names.Any fallback the mod uses meanwhile.Describe the need. Addresses, patches and SDK code aren’t required. If you found something out about the engine, include it and say whether it was seen in game or only worked out from reading.
Bug in RSMM
Section titled “Bug in RSMM”Check that the mod isn’t the cause: rsmm lint <id>, then try again with only this mod enabled. Then include what happened, what was expected, steps to reproduce, operating system, RSMM version, the whole rsmm doctor output, and the relevant rsmm log lines. Attach the smallest mod that shows it. Remove user names and tokens from pasted output.
Security problems never go in a public issue. Follow SECURITY.md. Problems with someone else’s mod go to that mod’s page.
Before you say it’s done
Section titled “Before you say it’s done”- Every file you changed is the mod’s own, and
git statusin the RSMM clone shows nothing from you. - Nothing was pushed to RSMM and no pull request was opened.
-
rsmm lint <id>has no errors. - Every
R.*call, event, manifest key and content kind was looked up, not guessed. - Rules and numbers are in the mod; nothing general was rebuilt inside it.
- Anything RSMM is missing is in an issue, or a draft waiting for the author.
- For a release package, you confirmed the intended behavior with the author and checked the relevant transitions in game.
- You told the author what was tested in game and what wasn’t.
