Skip to content

Capability Modules

github-actions[bot] edited this page Sep 27, 2026 · 7 revisions

Capability Modules

Permissions in the OS sense. A mod receives imports only for the modules it declared and the user granted; anything else is absent from its import object, so calling it is a link failure at load, not a runtime check that can be bypassed.

Users can revoke individual modules per mod in the mod menu's Advanced panel — so a mod must tolerate being granted less than it asked for.

Module Grants Functions Revocable Status
Core Logging, environment introspection, abort, fuel budget log, env, abort, fuel_budget no implemented
GameState.Read Read the turn, countries, treasuries, provinces turn_number, country_count, country_at, country_name, country_treasury, country_province_count, province_population, province_owner, province_monument, province_monument_level, province_monument_active, country_exists, province_exists yes implemented
UI Register panels and draw inside them panel_register, draw_rect, draw_text, button, draw_line, draw_circle, draw_image, draw_text_sized, measure_text, panel_width, panel_height, panel_set_visible, mouse_x, mouse_y, mouse_inside, theme_accent, set_theme_accent yes implemented
Assets Read your own data/ directory size, read yes implemented
GameProcess Turn lifecycle hooks. Grants exports, not imports. — yes implemented
GameState.Write Mutate the world. Implies GameState.Read. set_country_treasury, add_country_treasury, set_province_owner, set_province_population yes implemented
Neural Observe AI features, rewards, modules, stances and version (observe-only: no import writes to the model) feature_count, features, reward_count, reward_mean, module_count, module_name, action_count, action_name, country_is_ai, update_count, model_loaded, ai_version, ai_arch, country_stance, stance_name, stance_count yes implemented
Neural.Decide Choose the AI's action for a country, in place of the built-in AI action_valid yes implemented
Map Province geometry and adjacency width, height, province_count, province_at, province_name, province_center_x, province_center_y, province_is_land, province_neighbor_count, province_neighbor_at, province_is_coastal, sea_route_exists, point_is_land yes implemented
Diplomacy Read and propose diplomatic actions at_war, allied, non_aggression, guaranteed, propose_war yes implemented
Storage Persistent key-value store namespaced to your mod id get, set, remove yes implemented
Audio Play and stop sounds from your own mod's assets play, stop, set_volume, is_playing yes implemented
Net Send and receive messages between copies of YOUR OWN mod send, recv, peer_count, self_peer, is_host, peer_at, peer_name, max_message_bytes yes implemented
WasiStub Minimal WASI shim so an interpreter-in-a-mod can boot. NOT a WASI implementation: no filesystem, deterministic randomness, no wall clock. fd_write, proc_exit, random_get, clock_time_get, environ_sizes_get, environ_get, args_sizes_get, args_get, fd_close, fd_fdstat_get, fd_prestat_get, fd_prestat_dir_name, fd_read, fd_seek, path_open, clock_res_get, sched_yield, fd_advise, fd_allocate, fd_datasync, fd_sync, fd_fdstat_set_flags, fd_filestat_get, fd_tell, fd_renumber, fd_filestat_set_size, fd_filestat_set_times, fd_pread, fd_pwrite, fd_readdir, path_create_directory, path_remove_directory, path_unlink_file, path_filestat_get, path_symlink, path_readlink, path_rename, path_link, path_filestat_set_times, poll_oneoff, sock_accept, sock_recv, sock_send, sock_shutdown yes implemented
Military.Read Read ships, armies by kind, fortifications and ports ship_count, ship_at, ship_exists, ship_owner, ship_type, ship_lon, ship_lat, ship_health, ship_crew, ship_range, army_stack_count, army_stack_owner, army_stack_size, country_army, province_fortification, province_port_level, troop_type_count, troop_type_id, country_army_of_type, province_troops_of_type yes implemented
Military.Write Queue army and ship orders through the turn resolver order_army_move, order_ship_move, order_ship_engage, order_ship_bombard yes implemented
Research.Read Read the technology tree, what each country has researched, and how many programmes it may run node_count, node_id, node_name, node_category, node_cost, country_has_researched, country_funding, country_research_groups yes implemented
Research.Write Set research funding, and force how many research programmes a country may run set_country_funding, set_country_research_groups yes implemented
Politics.Read Read the political compass, policies, unrest, minorities, districts and what a country publishes country_compass_econ, country_compass_social, province_unrest, policy_count, policy_id, policy_name, country_has_policy, province_minority_count, province_minority_name, province_minority_share, country_district_count, country_district_name, country_district_share, country_district_province_count, country_district_province, country_district_law_count, country_district_law, district_law_count, district_law_id, district_law_name, country_discloses, country_party_count, country_party_name, country_party_short_name, country_party_support, country_party_compass_econ, country_party_compass_social, country_party_is_historical, country_ruling_party yes implemented
Politics.Write Enact and cancel policies, set district budgets and regional law, publish or withhold figures set_country_policy, set_country_district_share, set_country_district_law, set_country_disclosure yes implemented
Economy.Read Read income, expenses, what a country is worth, its population, industry and resources country_income_gross, country_income_net, country_army_upkeep, country_navy_upkeep, country_is_bankrupt, province_industry_level, province_industry_specialization, province_resource, country_expenses, country_national_value, country_population yes implemented
Economy.Write Set province industry level set_province_industry_level yes implemented
MapEditor Read and write the open map editor project; inert outside the editor editor_active, editor_province_count, editor_province_at, editor_province_population, editor_province_industry_level, editor_province_fortification, editor_province_port_level, editor_province_resource, editor_province_compass_econ, editor_province_compass_social, editor_set_province_population, editor_set_province_industry_level, editor_set_province_fortification, editor_set_province_port_level, editor_set_province_resource, editor_set_province_compass, editor_map_name, editor_set_map_name, editor_set_author, editor_set_license yes implemented
Core.Protected Resident memory, executable size, and the installed mod list process_bytes, image_bytes, mod_count, mod_id, mod_name yes implemented
Country Declaring custom fields on countries, and reading and writing them field_add, field_remove, field_has, field_count, field_name, set_number, get_number, set_text, get_text yes implemented
Scripts Adding commands to the map script language command_add, command_remove, command_count, command_name, command_text, command_args yes implemented
Render Tinting provinces and labelling them on the map province_tint, province_label, clear, tint_count, label_count yes implemented
Content Adding doctrines, research nodes, troop and artillery types and district laws add, count, id_at, owner_of, remove yes implemented

GameProcess grants no imports — it gates whether the host calls your mod_pre_turn / mod_post_turn exports.

Deliberately absent: any filesystem, network, process, or clock-with-identity capability. There is no module that grants them, so they cannot be requested. WASI's fd_* and path_* imports are never linked into the runtime.

Asking for less is worth something

Requesting GameState.Write when you only read is not neutral — users see the list before granting, and are right to be suspicious. Declare the least you need.

Mods and AI Learning never coexist

The experimental AI Learning option mutates the trained model as you play. A mod can change what the AI observes, so the two are mutually exclusive: you will never observe a turn where both are active.

Clone this wiki locally