HOI4-Live-Tools
Health Uyari
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Gecti
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
MCP server that lets coding agents test mods and play Hearts of Iron IV: stable Windows release, plus a fast native Rust runtime in Linux preview
HOI4 Live Tools
An MCP server that lets your coding agent play and test Hearts of Iron IV.
Install, check, play · Which version · What works where · Manual install · Launch order · Native preview · Tool reference · Changelog
Your agent can test mods without you sitting at the keyboard: it launches the game,
loads a save, fires events, answers popups, runs time forward and reads the error
log. It can also play campaigns through the real game interface, from focuses,
research and production to construction, politics, diplomacy and armies.
In a mod it has never seen, even a total conversion, it can learn: it reads what the
mod adds, inspects the mod's own panels, tries a button and sees what changed, and
keeps what worked as a skill for later games (Playing a mod the tools have never
seen).
Part of the HOI4 modding toolkit: HOI4 Mod Setup
installs it for you, Agentic HOI4 Modding
gives your agent modding skills, and HOI4 Agent Tools
builds and previews mod content.
Install, check, play
Three commands, the same on every system. You need Hearts of Iron IV from Steam and Python 3.9 or newer.
1. Install. macOS and Linux, in a terminal:
curl -fsSL https://github.com/klimPaskov/HOI4-Live-Tools/releases/latest/download/install.sh | sh
Windows, in PowerShell:
irm https://github.com/klimPaskov/HOI4-Live-Tools/releases/latest/download/install.ps1 | iex
The installer downloads the release for your system and processor, checks every file against the release's
checksums, puts the program in a private folder, registers the server with the coding clients it finds (Claude
Code, Codex, Cursor, OpenCode) and ends with the doctor. On a Mac it also verifies the native runtime's signature
and signs it when needed. Run it again to update. Nothing asks you to edit a file.
The one-line installer ships with the first release after 1.4.2. Until that release is out, use the
manual install.
2. Check.
hoi4-live doctor
The doctor checks the install, the game and its version, memory access, input and screen permissions, the game's
display mode and resolution, Steam and your mods. For each item that is not in place it prints the one step that
fixes it. It only reads: it never changes a system setting and never asks for a password. If your shell does not
find hoi4-live, use the full path the installer printed.
3. Play.
hoi4-live play ITA "conquer Ethiopia before 1937"
It runs the checks, picks the reviewed plan that ships for the country and prints the one instruction to give your
coding client. Plans ship for Italy, Ethiopia, Germany and China (FAIR) and Poland (META); for anything else the
strategist writes a plan first (a separate, long step: --plan FOLDER then plays it).
On a Mac with the native runtime:
- Start Hearts of Iron IV from Steam the way you always do (or add
--launchand the command asks Steam). In
Options > Graphics choose Windowed, 1920x1080, UI scaling 1.0. - Start the country's campaign (Normal difficulty, historical AI) and leave it paused on the first day.
hoi4-live playattaches to that game, switches the plan's executor on, starts a supervisor in the background
and prints:Read <run folder>/BRIEF.txt and follow it word for word.Give that to your coding client; it plays
through thehoi4-live-playtools the installer registered (restart the client once after installing).- The run ends when the plan's goal is reached, at a date you give (
--until 1938.01.01), when the agent stops
or you runhoi4-live stop, when the agent has made no call for 45 minutes (a usage limit, a closed client),
or when the game's memory runs high. At its own ends the program pauses the game and saves it with the game's
own save;report.mdin the run folder says why it ended and which save to continue from. - A long campaign goes on in segments: load that save and run
hoi4-live play --continue. The plan in force and
everything the program remembered carry over. hoi4-live reportreads the run at any time: the campaign's segments, a bar audit from the run's own records
and where the country stands (factories, divisions and their equipment, force, air).
The command never edits your game settings, saves or mods; the only file it writes outside its run folder is that
save, named by the game. It records your files at the start and the report says if anything changed during the
run. The game keeps running while the agent plays; it is paused only when you or the agent ask, or after a
silence: with no call from the agent for 15 minutes (--idle-pause MINUTES changes it, 0 switches it off) the
supervisor pauses the game, after a wake at half that time, and the agent's next call lifts the pause. The whole
walk-through for players, with what to do when something stops: docs/CAMPAIGN_GUIDE.md.
How it works: docs/PLAY_FLOW.md.
hoi4-live update installs the newest release. hoi4-live uninstall removes the program, the native runtime, the
command and the client registrations.
What each system gets today
| Windows | macOS | Linux | |
|---|---|---|---|
| Installed | Python server | Python server; native runtime on Apple silicon | Native runtime (x86_64) |
| Registered with your coding client | Yes | Yes (the Python server, and hoi4-live-play for native campaigns) |
Not yet |
hoi4-live doctor |
Yes | Yes | Yes |
hoi4-live play |
Hands the campaign to your coding client (Python server) | Attaches to the game you started, executor on, supervisor running; one instruction for your coding client | Tells you what is missing: the runtime cannot attach to a game you start yet |
| Game versions | No version check; run on HOI4 1.19.4 | Native runtime: HOI4 1.19.4.1 only. Python server: no version check | HOI4 1.19.4.1 only |
Not supported yet:
- The native runtime on Windows. Windows uses the Python server.
- Starting a campaign on Linux, and registering a server there: the Linux runtime plays only games its own launcher
started under its own X display. - A plan for a country that has no shipped plan without the repository: the strategist runs from a checkout.
- A full campaign through
hoi4-live playhas not been accepted yet. On macOS the attach flow passed its live
checks (scripts/live_checks/play_attach.py), and campaigns have been played live on the same runtime through the
developer rig; segments,--continueandhoi4-live reporthave passed their offline tests and wait for their
live check (scripts/live_checks/product_campaign.py). The Linux and Windows adapters exist but have not played
a campaign on the current game version.
When the game updates to a version the native runtime cannot read, the doctor and the runtime say so, name the
version that works and what to use meanwhile.
Which version should I use?
| You want to… | Use | Platform | Maturity |
|---|---|---|---|
| Test mods and try agent play today | hoi4-live-tools-1.4.2.zip from the 1.4.2 release (Python) |
Windows 10/11 | Stable release |
| Agent play with the full management toolset | hoi4-live-native-1.4.2-macos-arm64.tar.gz (native downloads) |
macOS on Apple silicon, Steam HOI4 1.19.4.1 | Experimental |
| Agent play on Linux | hoi4-live-native-1.4.2-linux-x86_64.tar.gz (native downloads) |
Linux x86_64, HOI4 1.19.4.1 | Experimental |
The Windows native game adapter is unfinished. An internal read-only foundation
is available for development; see the Windows port.
No full campaign has been accepted on any runtime yet. Earlier Mac campaign
defeats remain preserved alongside the later qualification tests. Status details
are below.
What works where
Mod testing (launch the game, fire events, run effects, read error.log) is a
feature of the Python package on Windows. The native Linux and macOS builds
read the game's memory to play a campaign. They have no console, no events and noerror.log tools, and they start the game without your mods. Use this table to
pick:
| What you want to do | Windows, Python package | Linux | macOS |
|---|---|---|---|
| Install | One command: Python server, registers your coding client | One command: native runtime; no server is registered yet | One command: Python server (registered) and native runtime (Apple silicon) |
Launch with your mods, -debug, new game, load, save, quit |
Works (tested live on 1.19.4.1) | No. The Python package refuses; the native launcher starts the game with an empty playset | Not accepted. The Python code exists but has no live run; the native build has no launcher |
Console, hoi4_eval_effect, hoi4_fire_event, answer popups |
Works in test mode | No | Not tested |
| Smoke tests, trigger and focus checks, localisation sweep (they use the console) | In test mode. Offline-tested on recorded fixtures; the first live run is pending | No | Not tested |
Read error.log and game.log, query plain-text saves |
Works | Plain file reads that should work; not tested live | Plain file reads that should work; not tested live |
| Screenshots, OCR, click and type in the game window | Works (needs the English Windows OCR component) | No in Python | Not tested |
| Play a campaign through the interface | Python tools, recorded attempts only | Native, about 104 tools tested live, experimental | Native, about 120 tools tested live, experimental |
| Game builds accepted | No build gate; tested on 1.19.4.1 | HOI4 1.19.4.1 x86_64 only | HOI4 1.19.4.1 x86_64 under Rosetta only |
When Steam updates the game, the native runtime refuses the new build until a table for it ships;
Game versions says what to do meanwhile and how a new build is brought up.
Things every modder should know:
- Test mode. The server starts in campaign mode, which refuses the console,
events and effects. SetHOI4_LIVE_MODE=test(or"mode": "test"inconfig.json) before you start it. A campaign session cannot go back to test mode. - DLC and Steam. A scratch user folder needs
hoi4_preparefor the DLC to load: follow the
launch order. Career Profile and Awards need the Steam client. - Windows setup. Windowed or borderless game, UI scale 1, English Windows OCR,
console key on the`key of a US layout. A 1920×1080 borderless window is
what the live runs used. A larger window, for example a 2560×1440 borderless game, works too: the tools
read the screen as a picture (the frame) and scale click points from the frame to the window, so a capture
that is smaller than the window still clicks the right spot.hoi4_statusshowswindow.client,window.frame
and the scale when they differ. Coordinates in tool results are frame pixels.
A window larger than the screen is moved when a click point would fall outside the desktop. - Mods and
-debug. The Python package launches the game with whatever your
playset enables. The native Linux launcher starts it with no mods. - Not working yet. The Windows native adapter, ARM64 Linux, and a clean
two-year campaign on any system. The status section below keeps the details.
Mod checks (Windows, test mode)
With the game running in test mode, an agent can run these. They are new: tested
on fakes and recorded log lines first, then run live on HOI4 1.19.4.2 on 14 November 2026 (see the changelog).
| Tool | What it answers |
|---|---|
hoi4_smoke_namespace |
Fires every event of a namespace through the console, answers each option (one firing per option), takes the decisions of a category or prefix, and reads error.log after each step. One report. |
hoi4_check_trigger |
Is this trigger true for this country? True or false, and the condition that is not met. |
hoi4_check_focus |
Can this country take this focus? Names the unmet prerequisite, exclusive focus, available or allow_branch condition. |
hoi4_sweep_loc |
Visits the map and each panel, reads the screen with OCR and lists [missing_key], raw keys, unresolved $VARIABLES$ and colour codes shown as text, plus localisation warnings in the logs. |
Manual install: Windows
The one-line installer does these steps for you. You need Windows 10 or 11, HOI4 from
Steam (windowed or borderless, UI scale 1), Python 3.9 or newer, and the Windows English OCR component. FFmpeg
is optional.
Download
hoi4-live-tools-1.4.2.zipfrom the
latest release
and unpack it anywhere.In that folder, run:
python install.pyIt installs a private Python environment under
%LOCALAPPDATA%\hoi4-live-tools
and registers the server with the coding clients it finds (Claude Code, Codex,
Cursor, OpenCode).Restart your coding client and check the game side:
hoi4-live doctor
To uninstall, run hoi4-live uninstall. See
Windows setup and usage for manual registration,
configuration and the command line, and the tool reference for
every tool and argument.
Launch order for a mod test
A game started without the Steam client finds no DLC in a user folder that
lacks two files the Paradox launcher keeps there, launcher-v2.sqlite anddlc_signature. Your normal user folder has them. A scratch folder (set withHOI4_LIVE_USER_DIR, or a gameDataPath redirect) does not, and the game then
loads 0 DLC. Mod testing needs the server in test mode (HOI4_LIVE_MODE=test, or"mode": "test" in config.json): the default is campaign mode, which refuses the
console, events and hoi4_prepare. The order is:
hoi4_preparecopies the two DLC files from your normal user folder into the
run's folder. Every file it replaces is backed up byte for byte first. When the
run's folder is your normal one it reports that there is nothing to copy.hoi4_prepare {"action": "status"}shows what each folder holds.hoi4_launchstarts the game (debug: truefor the console tools).hoi4_launch {"prepare_dlc": true}does steps 1 and 2 in one call.- Test. Fire events, run effects, read
error.log. hoi4_shutdownquits through the game's own menu and puts the run's folder
back as it was. If the server was restarted in between, runhoi4_prepare {"action": "restore"}once the game has exited. A file that
changed after the copy is never overwritten; it is reported instead, andforce: truerestores the original and keeps the changed file next to the backup.
Career Profile and Awards need the Steam client, so achievement checks cannot run
this way. Everything in the journal stays under artifacts/dlc_backups/.
Native Rust preview
The native runtime builds on Clausewitz-MCP.
It reads structured state directly from the owned game process. Reads do not
pause, take screenshots or move the cursor. Inputs use ordinary player controls
and fresh state checks; unknown builds and unsupported operations refuse explicitly.
The primary live path does not depend on save parsing or screenshot polling.
Build with Rust 1.86 or newer:
cargo build --manifest-path native/Cargo.toml --release --locked
cargo test --manifest-path native/Cargo.toml --locked
Follow native setup and the platform notes below. The native
runtime is experimental, not a replacement for the Windows package.
Native downloads
Each release carries prebuilt hoi4-live-native archives, SHA256SUMS.txt and
GitHub build attestations, so nothing needs to be built from source:
sha256sum -c SHA256SUMS.txt --ignore-missing # macOS: shasum -a 256 -c
gh attestation verify hoi4-live-native-1.4.2-linux-x86_64.tar.gz --repo klimPaskov/HOI4-Live-Tools
tar -xzf hoi4-live-native-1.4.2-linux-x86_64.tar.gz
The macOS binary is already signed with debugger.entitlements (included).
First run: memory access
hoi4-live doctor includes this check. For a binary you unpacked or built yourself, ask it directly whether it
will be allowed to read the game:
./hoi4-live-native --doctor
It prints what is in place and, for anything missing, the one command to run. It
only reads system state: it changes no security setting and never asks for a
password. What each system needs, once:
- macOS: Developer mode on (
sudo DevToolsSecurity -enable) and your user in
the_developergroup (sudo dseditgroup -o edit -a "$USER" -t user _developer,
then log out and back in). The release binary is already signed; a binary you
built yourself is signed with./hoi4-live-native --doctor --sign. If you
downloaded the archive with a browser, also runxattr -d com.apple.quarantine ./hoi4-live-native. After that there is nothing
to renew. - Linux: nothing on a default system. The tool reads only a game it started
itself with its launcher, as your own user, which the usualkernel.yama.ptrace_scopevalue of 1 (or 0) allows. If an administrator set it
to 2,sudo sysctl kernel.yama.ptrace_scope=1is needed; at 3 the setting must
be changed in the system configuration and the computer restarted. - Windows: use the Windows package (the Python
server); the native runtime's Windows adapter is unfinished and refuses to
attach. Run the game and your coding client as the same Windows user, both
without "Run as administrator". Nothing else is needed.
No Steam variable or overlay reaches the game, and the native Linux launcher gives
it an empty private HOME.
The macOS and Linux builds have the same management toolset (about 120 tools: armies,
fronts and encirclement planning, air, navy and naval invasions, designers, doctrine,
intelligence, peace conferences, decisions, events and the plan runner; see
the tool index) on HOI4 1.19.4.1.
Linux
The tested native Linux game is HOI4 1.19.4.1 x86_64 (GNU build ID 2265e6e7...); the
build gate refuses any other build, including 1.19.3. The
owned launcher verifies process ownership and never
takes over an unrelated game. --bind-management binds the full management toolset to
the owned X11 window. The tools read the game through a per-build address table
(native/layouts/), generated from the macOS build and checked live
(Linux port).
Live verification on Linux records 104 tools run
against the game (economy, research, focus, politics, trade, armies and fronts in a war,
air, navy, special projects, the intelligence agency, events, diplomacy and the plan
runner), the refusals reached for the rest, and the fixes the Linux build needed. Peace
conferences and the operative tools were not reached on Linux. The older Linux-only GUI
diagnostics written for 1.19.3 refuse on 1.19.4.1.
Manual install: macOS (Python server)
You need a Mac with HOI4 from Steam and Python 3.9 or newer (Apple's command-line tools
Python or python.org). FFmpeg is optional.
- Download
hoi4-live-tools-<version>.zipfrom the
latest release and unpack it. - In that folder, run
python3 install.py. It installs a private Python environment, with numpy, Pillow,
OpenCV and PyObjC, under~/Library/Application Support/hoi4-live-tools, and registers the server with
the coding clients it finds. - Restart your coding client and check the game side with
hoi4-live doctor.
The app that starts the server (your terminal or coding client) needs Screen Recording and Accessibility
permission in System Settings; the doctor checks both, and a tool that lacks one returns an error that names it.
To uninstall, run hoi4-live uninstall.
ARM64 Linux through FEX has verified own-state reads and lower-level stationary
Research keys at 1080p. Its pinned Rust input adapter remains disabled by default:
the latest retained-goal Research action still timed out at five seconds. The
explicitly pinned unified GL profile reached the actual 1920×1080 game and
own-country reads passed, but Research readiness did not verify. The latest
private diagnostic captured changing animation values under the original bound;
they do not establish readiness or update cadence. The uncertain Intent remains
preserved without retry or later settlement, and ordinary closure passed.
No campaign or annual throughput result is accepted. See
FEX setup and
the bounded animation check.
macOS
The native preview supports one Steam HOI4 1.19.4.1 (checksum f584) x86_64 build under Rosetta
(see the 1.19.4 update notes; the 1.19.3 build is no longer accepted on macOS)
with a verified 1920×1080, UI scale 1 input profile. It checks the owned game
and window before input. Window recording captures
1920×1108, including the titlebar around the game client.
Recorded Luna-medium component tests passed Research refill, Focus handoffs,
one-factory production changes, durable plan revisions/reconnects, construction
opening and ordinary building-template selection. The selection call took
240 ms. A recorded one-F Find-focus test also passed, with visible Find reads
below 1 ms. The native Find action then typed an owned state ID and Return in
549 ms, with a zero-input historical replay. Stationary Find/camera reads measured
0.48 ms per RPC with zero input. These are measurements of specific tested paths. See the validation record for scope and
preserved failures.
The read-only construction target tool now offers a Mac center-terrain candidate
with include_map_point: true. Stationary native 1080p testing measured 2.36 ms
median RPC, compared with 2.00 ms without the option. It leaves the game and
cursor unchanged and supplies no placement permission; see the
resident observer evidence.
The default-off hoi4_construction_place qualification
uses one ordinary click with the exact template already selected and an owned
state centered. It verifies an exact +1 queue change, retains durable once-only
receipts and returns compact route diagnostics. A recorded private Rust component
passed at native 1080p: its 17-call driver took 4.661 seconds, including guards;
placement took 2.326 seconds with zero cursor displacement or observation pauses.
The source port remains a qualification preview; construction worker integration
and advancing-time acceptance remain unfinished. The Find action requires an
already-open focused empty box and explicit qualification permission. Peace
conferences and naval invasions have since been added and live-tested on 1.19.4.1
(live verification); the clean two-year acceptance
run and full campaigns remain open. Broader legacy adapters remain separate from the durable worker. The controller contract describes current
permissions, receipts and recovery.
The default-off hoi4_construction_clear_selection qualification
now verifies ordinary Escape cancellation with the complete own queue unchanged.
A native 1080p action took 686 ms; a separate historical-only replay took 76 ms,
sent no input and left the original journal unchanged. The failed raw-timestamp
comparison between those phases is retained. This does not enable construction
standing plans or establish campaign acceptance.
The default-off hoi4_construction_find_open qualification now opens the exact
named Find button with one ordinary click. A recorded native 1080p test verified
it in 603 ms, preserving the full queue; historical replay sent no input.
Pointer actions also reject windows covering the intended point, including
floating panels. Decimal character admission has separate checks; mixed
construction plans remain under development. See current evidence.
Mac memory access needs three things, each set up once: Developer mode on
(sudo DevToolsSecurity -enable), your user in the _developer group, and the
tool signed with native/macos/debugger.entitlements (hoi4-live-native --doctor
checks all three, see first run). With those in place
macOS grants access with no password and nothing to renew. A tool without that
signature falls back to the password-protected right, which lapses after about
10 hours (security authorize -u system.privilege.taskport renews it). The tool
checks the right that applies to it without showing a dialog and never changes
system settings; the game is never re-signed. Missing access returns a
capability error that names the right and the missing step, for telemetry/UI
fallback. Screenshots and saves are
not the primary native observation path. The public Research-folder diagnostic
remains Linux-only.
Remaining acceptance work
- Qualify broader routine action batches and expand economy, shortage repair
and warfare. - Implement and live-test the native Windows adapter.
- Complete a clean two-year Luna run, then the recorded FAIR Germany and China
campaigns. Final showcase videos must come from macOS at 1080p or higher. - Validate long campaign recording and publish only after release acceptance.
All nine CI jobs passed on the preceding placement checkpoint (0b963fb) across
Linux, Windows and macOS. Offline tests do not prove native game behavior.
For measurements, retained failures and the next gate, use
the comparison,
validation record and
current handoff.
Campaign rules
Campaigns run on Normal difficulty with vanilla rules and historical AI. There are
no cheats, console commands, save editing, hidden enemy information or
reload-to-undo.
- FAIR (default) follows the reviewed multiplayer-style house policy and
permits normal tactical play, including encirclements and concentrated attacks. - META allows single-player metas and UI tricks a human could use.
The campaign playbook defines both modes.
Mod testing features (console, scripted effects, scenario setup) are kept separate
and cannot be reached by campaign automation.
Project status
| Runtime | Verified so far | Still required |
|---|---|---|
| Python / Windows (1.2.0) | Mod-testing tools and recorded play attempts | Clean campaign acceptance |
| Python / macOS | Platform work and limited diagnostic play | Reliable live acceptance |
| Rust / Linux | Owned 1080p runs on 1.19.4.1: 104 live-tested tools of the management toolset, including a declared war with fronts, offensives and plans | Peace conferences, operatives, the two-year acceptance run and campaigns (live verification) |
| Rust / macOS | Owned 1080p runs on 1.19.4.1: about 120 live-tested tools (economy, armies and fronts, air, navy, invasions, designers, doctrine, intelligence, peace conferences, plan runner) and short training wars | Open defects in live verification, the two-year acceptance run and campaigns |
| Rust / Windows | Portable protocol and dormant owned-reader fixtures | Native game adapter, input and live tests |
Passing tests or listing a tool does not mean live play works. Only recorded live
runs count, and failures are kept in the record. See the changelog
for every run.
Contributing
Bug reports and ideas are welcome in Issues.
- Python 3.9+:
python -m pip install -e ., thenpython -m unittest discover -s tests -v. - Rust: the checks above, plus the platform notes in native/README.md.
- Follow AGENTS.md and the release process.
Releases and downstream pins move only after live acceptance.
Game assets, saves, recordings, credentials and private journals never go in this
repository.
License
Project code is licensed under Apache-2.0. Imported and derived
Clausewitz-MCP components keep their MIT notices, license and provenance in
NOTICE and the upstream manifest.
HOI4 is a trademark of Paradox Interactive AB. This independent project is not
affiliated with or endorsed by Paradox.
Acknowledgements
This project builds on smerss/Clausewitz-MCP,
Copyright (c) 2026 smerss, licensed under MIT. Its structured game model, process
interface, player-command research and event-driven automation form the foundation
of the native runtime. We keep the original MIT license
and file-level provenance.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi