REDNODE / DESIGN DOC / DRAFT 0.1 TARGET: CYBERPUNK 2077 PC
// Research & architecture

REDnode

REDnode is a Node-based API for scripting Cyberpunk 2077, built on the same injection points that RED4ext, Cyber Engine Tweaks and redscript already use. Asynchronous mods run in a normal Node process. A small sandboxed tier runs inside the game for the few cases that must change a value mid-call.

Recommended: hybrid B + small A Tier 2: Node (out of process) Tier 1: sandboxed in-process Single-player modding

01Goal and scope

In scope
  • Let modders write game logic in TypeScript and JavaScript with npm packages.
  • Expose game state, events and commands through a typed API generated from the game's own reflection data.
  • Coexist with CET, RED4ext plugins, redscript and REDmod.
  • Survive game patches without per-patch rewrites of mods.
Out of scope for v1
  • Multiplayer or anything that touches online services.
  • Full in-process Node with fs, require and a live event loop.
  • Replacing redscript for engine-level changes.
  • Mods that need to run arbitrary game calls from inside a hook.

02Existing landscape

Checked against the install on this machine. Two independent injection points are already in use, so a new framework can attach to either.

ComponentHow it attachesSeen on this install
Ultimate ASI LoaderProxy version.dll that loads every .asi in bin/x64/plugins/.v6.0.0. Loads cyber_engine_tweaks.asi.
RED4extProxy winmm.dll loads red4ext/RED4ext.dll, which loads red4ext/plugins/*/*.dll.v1.30.0. Plugins: ArchiveXL, Codeware, RedData, mod_settings, input_loader.
Cyber Engine TweaksIn-process Lua runtime with reflection access to game types and an ImGui overlay.Closest precedent for an embedded scripting runtime.
redscriptCompiles .reds files into the game's script bytecode at launch. Not a runtime embed.Many mods under r6/scripts/.
REDmodOfficial CDPR deploy tool for archives, tweaks, scripts and audio. No injection.redMod.exe present, mods/ empty.

What this teaches

03Options considered

PlanApproachStrengthsWeaknesses
AEmbed Node in a RED4ext plugin or .asi.Closest to CET. JS runs inside hooks as plain function calls.30 to 80 MB runtime. Event loop and threads inside a DX12 game process. Hard to keep stable.
BThin native RED4ext plugin plus a separate Node process over IPC.Crash isolation. Normal npm tooling. Easy hot reload. Small native surface to maintain.No synchronous access from hooks. Round-trip latency on every call.
CEmbed QuickJS only.About 1 MB. Fast start. Easy to sandbox.Not Node. No npm ecosystem.

The tradeoff in Plan B

A hook runs inside the game's own function call, on the game thread, and the game waits for it to return. If the logic lives in another process, the hook must block on a round trip. That costs roughly 50 to 200 µs when healthy and much more when Node is busy. A 60 fps frame has about 16 ms, and hooks such as damage or per-frame ticks can fire thousands of times a frame. If the Node process crashes or hangs, the game thread blocks until a timeout.

PatternPlan B
Notify: "the player took damage"Works. The hook enqueues an event and returns.
Query: "what is the player's health?"Works. Node awaits the answer.
Command: "set health to 100"Works. Queued and applied on the game thread next tick.
Intercept: change a value before the call continuesDoes not work well. Needs a synchronous answer while the game waits.

04Recommended design: two tiers

Keep Plan B as the main path. Add a small in-process tier for interceptors only. A mod can ship either tier or both.

Tier 1 · sync interceptors
  • Runs inside the hook on the game thread.
  • Can change arguments or return values, or cancel a call.
  • No await, no I/O, no require.
  • Hard time budget, for example 100 µs.
Tier 2 · async Node mods
  • Observe events, query state, send commands.
  • Full Node and npm.
  • Never blocks the game.
  • Can push parameters to Tier 1 interceptors.

What runs Tier 1

EngineSizeNotes
Full Node / V830 to 80 MBBrings back every problem of Plan A. Not recommended for interceptors.
Bare V8 isolate10 to 30 MBSame JS dialect as Node. Fast. No Node APIs. Heavier to ship.
QuickJSabout 1 MBRecommended. Small, easy to sandbox and to time-limit. TypeScript is compiled ahead of time. Slower than V8, which is fine for tiny functions.

Tier 1 shares TypeScript types with Tier 2 but is not Node. The documentation must say so plainly.

Cheaper than either: declarative rules

For the simplest cases, such as "multiply incoming damage by X", offer a no-code rule that the native plugin applies directly in the hook. It needs no JS engine and no IPC, and it covers a large share of real mods.

05API sketch

Tier 1 · interceptor (sync, sandboxed)
export default defineInterceptor({
  target: "PlayerPuppet.OnDamageReceived",
  run(ctx) {
    ctx.args.damage *= ctx.params.multiplier;   // pushed from Tier 2
  }
});
Tier 2 · async mod (full Node)
import { game } from "rednode";

game.on("PlayerPuppet.OnDamageReceived", async (e) => {
  await db.log(e);                          // fine, the game is not waiting
  game.player.setHealth(100);              // queued, runs next tick
});

const hp = await game.player.getHealth();    // async query
interceptor("damage-scale").set("multiplier", 0.5);

Native plugin responsibilities

06Native game UI (ink)

Proposed on 2026-10-18, not scheduled. The game draws its own UI with ink: a tree of widgets (inkCanvasWidget, inkTextWidget, inkImageWidget and so on) with logic controllers for behavior (inkButtonController, inkSliderController and so on). redscript mods build their menus and HUD parts into that tree. REDnode should let JavaScript and TypeScript mods do the same, with a set of tags and an ink API in the rednode package.

What REDnode has today

Neither of REDnode's two UI paths is ink. Overlay apps write HTML, and the ui builder lets Node mods describe a window as a tree of nodes. Both are drawn by Chromium in the overlay host, and the plugin composites the picture over the game's frame. The game's UI never sees them. The "Native button" sample is an HTML window styled like the game, not ink.

Overlay (HTML apps, ui)Ink (proposed ink)
Drawn byChromium offscreen; the plugin composites it over the frameThe game's renderer, inside its own UI
LookThe REDnode UI kit, or any web contentThe game's fonts, styles and library widgets
HUD hiding, photo mode, UI scale, HDRREDnode follows them by hand (the HUD widget rules)Follows them as the game's own UI does, by layer (unverified)
InputF10 Using mode with REDnode's cursorThe game's cursor in menus; none on the HUD in gameplay (open question)
CostA Chromium process and its texturesWidgets in the game's tree, no extra process
ReachAnything a web page can doInk widgets and the game's library items only

The generic game API (rtti.call, api in the package) can already call ink functions one at a time. inkCompoundWidget.AddChild returns a reference, and SetText works on it. With Codeware, a Node mod could reach the HUD layer and add raw widgets. That is unverified: nobody has tried it. Five things are missing: a root to attach to without Codeware, events, ownership and cleanup, a rebuild after a save load, and speed. Each call is one round trip, and a styled panel of 40 widgets takes hundreds of calls.

What the engine offers

Checked in REDnode's base-game RTTI dump for game 2.31 (gameapi/2.31/rtti.json) and in the installed Codeware's scripts.

PartClasses and functions
ContainersinkCanvasWidget, inkVerticalPanelWidget, inkHorizontalPanelWidget, inkFlexWidget, inkGridWidget, inkUniformGridWidget, inkScrollAreaWidget
LeavesinkTextWidget, inkRichTextBoxWidget, inkTextInputWidget, inkImageWidget, inkRectangleWidget, inkCircleWidget, inkShapeWidget, inkBorderWidget, inkMaskWidget, inkVectorGraphicWidget, inkVideoWidget
ControlsNo button widget exists. A game button is a compound widget, from a library resource, with a controller attached: inkButtonController, inkSliderController, inkListController, inkScrollController, inkSelectorController, inkStepperController, inkRadioGroupController, inkComboBoxController
BuildinginkCompoundWidget.AddChild(type), RemoveChild, ReorderChild. From a logic controller, SpawnFromExternal(parent, resource, libraryID) spawns the game's own library items, with their controllers and styles
EventsinkWidget.RegisterToCallback(event, object, function) calls a function on a script object: OnPress, OnRelease, OnHoverOver, OnHoverOut, and the controllers' own callbacks, such as a slider's value change
RootsBase-game scripts reach a root only from inside a controller (GetRootCompoundWidget); gameuiRootHudGameController owns the HUD. Codeware adds GameInstance.GetInkSystem().GetLayer(n"inkHUDLayer").GetVirtualWindow() and AttachController
NamesThe dump uses native names, and redscript renames some of them: gameuiWidgetGameController is inkGameController in redscript, and inkWidgetLogicController is inkLogicController. Mods using the tags see neither

Which tier

The first phases need neither Tier 1 nor a new engine in the game; frame drawing adds Tier 1 later (below). The work splits between the native plugin and Tier 2:

Plugin · the ink driver (native, in process)
  • Keeps each package's tree, so it can rebuild it after a save load or a HUD rebuild with no help from Node.
  • Applies changes in batches on the game thread, between frames, with a budget per frame.
  • Owns the widgets, and removes a package's widgets when the package stops.
  • Registers callbacks through a small listener class in REDnode's scripts and sends the events out.
  • Reads bindings each frame, so a value that changes every frame needs no round trip.
Tier 2 · the ink API (Node, TypeScript)
  • Tags and functions that describe a tree, typed.
  • Diffs each new tree against the last one and sends only the changes.
  • Runs the mod's handlers for clicks, hovers and value changes.
  • Hot reload, like the rest of Tier 2.

UI needs very few synchronous answers. Wherever the game would wait, the answer can be declared in the tree ahead of time, the same way Tier 2 pushes parameters to an interceptor:

NeedHow it works without a synchronous call
Build or change the UICommands, batched and applied on the next frame
Click, hover, value changeAn event goes out and the handler runs in Node. Its changes apply one or two frames later
Hover and pressed looksInk states and styles declared on the node; the engine switches them with no round trip
AnimationAn ink animation (inkanimDefinition) declared on the node and played by the engine
A value every frame, such as a health barA binding the plugin reads each frame, like a declarative rule; or the mod sets the value at its own rate
Keep the game from also acting on a clickA consume flag on the node, applied by the plugin when the event fires

Phases I1 to I5 need no Tier 1. Frame drawing does, and comes in a later phase (I6, agreed with the user on 2026-10-18): richer animations and cosmetic effects on screens and widgets, computed every frame. A Tier 1 draw function runs on the game thread each frame, inside the same sandbox and time budget as an interceptor. It changes its package's own widgets directly, with no round trip: opacity, translation, rotation, scale, tint, shape points and effect parameters. Tier 2 pushes it parameters, as it does for interceptors.

Tier 1 · frame drawing (later, I6; sketch)
export default defineFrame({
  target: "bounties",                           // a screen or mounted tree of this package
  draw(f) {
    f.widget("glow").opacity = 0.5 + 0.5 * Math.sin(f.time * f.params.speed);
    f.widget("scan").translation.y = (f.time * 120) % f.height;
  }
});

Tags

TagInk
canvas, vbox, hbox, flex, grid, scrollThe containers above; scroll adds inkScrollController
text, richtext, inputinkTextWidget, inkRichTextBoxWidget, inkTextInputWidget
image, rect, circle, border, mask, vector, videoThe leaves above. image takes an atlas and a part, or a TweakDB icon
button, slider, list, selector, stepper, radio, comboThe game's library items with their controllers, so they look and sound like the game's own
libraryAny item of a game .inkwidget library, by resource path and item name
widgetThe escape hatch: any ink class by name, with raw properties

One tree format, written three ways. In .tsx files the tags are JSX, which TypeScript compiles with REDnode's factory and checks against generated types. Plain JavaScript can write the same tags in a tagged template, or call the functions, which mirror the ui builder. A tree mounts on a layer: hud (display only; hides with the HUD), menu (inside the game's menus, with the game's cursor), and later world (in-world screens through IWorldWidgetComponent). The layers are unverified.

Tier 2 · ink from TypeScript (sketch)
import { ink } from "rednode";

const board = ink.mount("hud", { anchor: "top-right", x: -40, y: 120 },
  <vbox gap={6}>
    <text style="title">Bounty board</text>
    <text bind="player.health" />          // read by the plugin every frame
    <list items={contracts} item={(c) => <text>{c.name}</text>} />
  </vbox>);

ink.mount("menu", { menu: "pause" },
  <button label="Track contract" consume onClick={() => track()} />);  // event, async

board.update(...);                            // diffed, only changes are sent
Tier 2 · the same from plain JavaScript
ink.mount("hud", { anchor: "top-right" },
  ink.vbox({ gap: 6 }, ink.text("Bounty board", { style: "title" })));

What the API adds over ink

Modders are not engine developers. A modder should write what they want, not how ink builds it. If the engine takes ten lines to place a button, the modder writes one tag with a few properties. Ink is a low-level kit. REDnode adds the layer a UI toolkit has and ink lacks.

A game-style button in redscript
  • Spawn the button item from its library resource path into a parent.
  • Name it, then set its anchor, margin and size.
  • Find its label child and set the text.
  • Write a listener class with a handler function.
  • Register press, release and hover on it.
  • Play the click sound.
  • Unregister and remove it all when done.
The same with REDnode
<button label="Track" onClick={track} />

The look, sounds, hover state, controller navigation and cleanup come with it.

AreaWhat ink hasWhat REDnode gives the modder
LayoutAnchors, margins, paddings, size rules and alignments, set one by one on each widget and panelrow, column, stack and grid with gap, pad, align and sizes such as fill, auto or 40%. Placement relative to the screen's safe area
LookStyle resource paths, font family paths, colors as numbersTheme words: style="title", tone="danger", and the game's palette by name (red, cyan, yellow). Defaults that already look like the game
Composite widgetsPrimitives and a few controllersReady pieces: panel (the game's frame with a title), tabs, dialog and confirm (modal; Back closes), tooltip on any node, table and list from an array (long lists only draw what shows), toggle, progress, icon, keyhint (the right key or pad glyph for the player's input), menu, slots (an inventory-style grid), notify
HandlersA script object and a function name per event, registered and unregistered by hand; raw ink eventsPlain functions with plain values: onClick (mouse, pad button or Enter), onHover, onChange(value), onHold. Removed with the node
Data and stateWidgets changed one by one through referencesTrees made from data. Change the data, and the API sends only what changed. Nodes are named with id, not held as references. bind to game values
Controller and keyboardNavigation set up per screenFocus order worked out from the layout, so pad and arrow keys work by default
SoundsPlayed by name, per eventThe game's hover and click sounds by default; a property to change or mute them
LifecycleWidgets live until removed; they vanish on a save loadMount and unmount; removed when the package stops; rebuilt after a load; screens handle pause and Back
Your own piecesLibrary resources made in an editorComponents as plain functions: a modder's <BountyCard> is a function that returns tags. REDnode's own composites are written the same way, so modders can read them and copy the pattern
Escape hatchEverythingThe widget tag and ink.raw(id), which give the real ink widget to the api for what the tags do not cover

Most of this layer lives in Tier 2. Composites expand into primitives inside the package before anything is sent, so they hot reload and modders can read their source. Only what needs the engine sits in the plugin's driver: focus navigation, sounds, input glyphs, measuring text, and pause and Back. The names and properties match the ui builder where the two overlap, so button, toggle and slider mean the same thing in an overlay window and in ink. A modder learns one vocabulary.

Localization

Localization covers all of REDnode, not only ink: its plan is on the Localization page. For ink, any text property, such as a button's label, a text or a tooltip, takes either a plain string or a key:

WriteWhat it showsResolved by
label="Track"The string as it isNobody
label="LocKey#12345"The game's own text for that key, in the player's language. This is the form TweakDB records use, so a record's name works as it isThe engine: SetLocalizedText, so it follows a language change by itself
label={t("bounty.track")}The package's own text, from locales/<language>.json in its folder. A key the package lacks falls back to the game's secondary keys (t("UI-…")), then to English, then to the key itselfREDnode: sends it again when the language changes
// locales/en-us.json                     locales/fr-fr.json
{ "bounty.reward": "Reward: {amount} €$",      { "bounty.reward": "Récompense : {amount} €$",
  "bounty.thanks": { "m": "…", "f": "…" } }       …

<text text={t("bounty.reward", { amount: 500 })} />

Screens

Besides single widgets, mods need whole screens: open and switch the game's own full-screen menus (inventory, character, cyberware and the rest), and build new ones that behave the same way. A new screen should pause the game, take the game's cursor and Back key, and sit in the hub's row of tabs where that fits. The game does this with two pieces, both in the dump:

PieceWhat it is
Menu resourceinkMenuResource: a list of inkMenuEntry (a menu name, its widget library resource, depth, spawn mode and input context) and the scenario names. Codeware declares both for scripts
ScenariosScripted state machines that open, switch and close menus: MenuScenario_HubMenu (OpenMenu, SwitchMenu, OpenSubMenu, OnBack), plus PauseMenu, Vendor, Storage, Wardrobe, FastTravel and others. inkMenuScenario.SwitchToScenario(name, userData) moves between them
Opening oneA StartHubMenuEvent carrying HubMenuInitData (menuName, submenuName, userData), queued with GetUISystem().QueueEvent. Inside the hub, an OpenMenuRequest. The hub's tabs are the HubMenuItems enum: Crafting, Character, Inventory, Map, Journal, Phone, Database, Stats, Backpack, Codex, Shards, Gallery, Tarot, Gear, Cyberware, VisualSets

Opening and switching the game's screens needs no new engine work. The API wraps these events, so a mod writes ink.screens.open("inventory"). The names map to the game's menu names, kept in one table. Screens that need context, such as a vendor or a stash, take it as an argument or are left out. The plugin also reports the open screen as an event, so mods can follow the player through the menus.

New screens need an entry in the menu resource, because a scenario can only open the menus listed there. The proposal is one generic entry: REDnode adds a single menu, rednode_screen, whose widget is an empty canvas with a REDnode controller. Every package screen opens that one entry, with userData naming the package and screen, and the ink driver builds the package's tree into the canvas. One entry serves every mod, so adding a screen never touches game files. How the entry gets in is unverified and is part of the spike:

Way inNotes
The plugin adds the entry to the loaded menu resourceNo game files changed. Needs the resource in memory before the menu layer reads it
A small REDnode .archive with the canvas widget and a patched menu listThe usual modding route. The widget file can be built with REDbridge (WolvenKit's engine). Patching the menu list may need ArchiveXL
Draw on the menu layer while REDnode holds the game in a menu stateA fallback with no menu entry. Pause, input and Back must then be handled by hand

REDnode's scripts add their own scenario class, extending MenuScenario_BaseMenu, for screens outside the hub. Screens that belong in the hub open as hub menus, and a hub tab can be added by wrapping the hub's controller (MenuHubGameController), as redscript mods do.

Tier 2 · screens (sketch)
ink.screens.open("inventory");                     // a game screen
ink.screens.on("change", (s) => log(s.name));          // which screen is open

const bounties = ink.screen({
  id: "bounties", title: "Bounties",
  hub: { tab: true, after: "Journal" },             // a tab in the hub's row
}, <BountyBoard />);

bounties.open();                                // pauses, takes the cursor and Back
bounties.on("back", () => bounties.close());

Phases (proposal)

PhaseWhat
I1 SpikeReach a root on the HUD and in a menu, with and without Codeware. Add a text and a rectangle through rtti.call. Have a listener class in REDnode's scripts receive OnRelease. Measure how many calls fit in a frame. Read a live screen's tree (for Dump source). Open the inventory with a StartHubMenuEvent, and try adding a menu entry to the loaded menu resource. Check the script changes with redscript-cli first
I2 DisplayThe driver: kept trees, batched changes, cleanup per package, rebuild on load. ink.mount on hud with the containers, text, images, shapes and bindings. The layout words (row, column, gap, pad, align), theme words, data-driven trees and id. Localization: LocKey# strings, t() with package locale files, parameters, V's gender forms, the language and its change event. Sample: an ink version of Coords HUD
I3 InputButtons, sliders, lists, toggles and text input on the menu layer. Plain handlers, consume, focus order for pad and keys, default sounds, and an answer to the cursor question
I4 Game lookThe game's library items, styles, states and animations. The composites: panel, tabs, dialog, tooltip, table, keyhint, slots. JSX typings and the docs page, with a gallery of every tag. Dump source (proposed 2026-10-22): write an open game screen as REDnode tags, as a starting point for a modder's own; a primitives-only version can come with I2 (plan)
I5 ScreensOpen and switch the game's screens, and report the open one. The rednode_screen entry and REDnode's scenario. ink.screen for new screens, with pause, cursor and Back. Hub tabs
I6 Frame drawingTier 1 defineFrame: a draw function each frame for animations and cosmetic effects on a package's own widgets, with Tier 1's time budget and fault handling. Comes with or after P4, which builds the Tier 1 runner

Open questions

07Safety rails for Tier 1

Hard requirement

A buggy interceptor must never crash or freeze the game.

Time budget

Each call is time-limited. On overrun, return to default game behavior.

Fault handling

Catch exceptions, fall back to defaults, and auto-disable an interceptor after repeated failures.

Ordering

Define priority and chaining when several mods hook the same function.

Typed writes

Validate every write to ctx.args against the real parameter types before it reaches the game.

Limited host API

Read-only accessors and shared-memory reads only. No arbitrary game calls from a hook, to avoid reentrancy bugs.

Safe reload

Swap Tier 1 code between frames. Tier 2 reloads freely.

08Risks

RiskImpactMitigation
Game patch breaks hooksMods stop working until the plugin updates.Use the Address Library and RED4ext hooking. Never hard-code offsets.
Conflicts with other pluginsDouble hooks, crashes.Use RED4ext's hook API. Do not add a third loader.
Thread-safety bugsRandom crashes.All game access goes through the game-thread queue.
IPC latency or stallsStutter.Async by default. Fast-path rules and shared memory for hot paths.
Tier 1 scope creepMaintenance load.Build it last, only for hooks modders actually need.
Modding termsDistribution limits.Check CD Projekt and Nexus Mods terms before publishing. Single-player only.

09Roadmap

P0RESEARCH

Map the ABI

Read the RED4ext plugin entry points and the imports and exports of an installed plugin. Inspect how cyber_engine_tweaks.asi hooks and resolves addresses.

P1PROOF

Hello-world plugin

A RED4ext plugin that logs the RTTI class count. Confirms build, load and logging on the current game version.

P2TIER 2

Pipe bridge and Node SDK

Expose one function over a named pipe and call it from Node. Then events, queries, commands and generated types.

P3RULES

Declarative rules

Native fast-path rules applied inside hooks with no IPC. Gives synchronous behavior with no engine.

P4TIER 1

QuickJS interceptors

Add the sandboxed runner, time limits, ordering and fault handling. Only after P2 and P3 show which hooks need it. Ink frame drawing (I6, section 06) is a second use of the same runner.

10Open questions