Tested with: KSA Version 2026.10.19.5638
Unofficial project
There is currently no official way to add custom code to Kitten Space Agency. The tools used in this guide are developed by the community. They are not affiliated with or endorsed by the KSA developers.
This guide explains how to add custom code execution to Kitten Space Agency.
To develop mods using visual studio you need the following prerequisites
Currently the most popular way to create mods is by using StarMap.
Before starting this guide it is recommended to set up the example mod and running it to verify StarMap is working. You can find a guide here and an example mod here
This guide is written against StarMap 0.4.6. Check the releases page for the current version.
Create a new visual studio project by pressing Create a new project. This name is going to be your mod name and needs to match your mods class, dll and mod folder.

Filter for the C# language
Select Class Library
Click next

Enter FirstMod as the name of the project
Select a location
Press next

Select .NET version 10 (Long Term Support)
Press create

Now that we have a working Visual Studio project it is time to setup StarMap.
We will have to add the StarMap.API nuget package
Right click the project
Select Manage NuGet Packages

Search for StarMap.API in the browser tab

Select StarMap.API
Install the latest stable version

StarMap should be set up
Follow the same steps when setting up StarMap.API but instead of searching for StarMap.API you search for Lib.Harmony

When using StarMap to mod the game you will eventually need external resources from the game itself called assemblies or .dll files. For a basic mod you only need one dependency: KSA.dll. So this first-steps guide will do just that.
Right click on dependencies
Press Add Project Reference

Press Browse
Now go to your KSA install directory and find KSA.dll, select it and click add. The install path depends on where the game was installed, see Directories and Files.
Press OK

Another thing you have to do is configure Visual Studio's project file to work corrctly.
<Reference> tag, change or add <Private>false</Private>. This will avoid exporting every dependency DLL when building the mod.<PlatformTarget>x64</PlatformTarget>. This will avoid the warning MSB3270 when Visual Studio doesn't export the mod for the right CPU.StarMap automatically loads the class with the same name as the .dll file and that has the [StarMapMod] attribute
Our first step will be creating this class. Our example will be using the name FirstMod for the mod.
Create a class under the namespace FirstMod with the name FirstMod. And let it inherit from IStarMapMod by putting the [StarMapMod] attribute one line before the class.
using StarMap.API;
namespace FirstMod
{
[StarMapMod]
public class FirstMod
{
}
}
The api exposes a couple of attributes but for this simple hello world example we only need one:
[StarMapImmediateLoad]. The function marked with this attribute will be run when the mod is loaded. The function this attribute is assigned to does need to take in Mod definingMod as a parameter.
The Mod class needs the KSA namespace (found in KSA.dll) so we will add using KSA on the top of the file.
using StarMap.API;
using KSA;
namespace FirstMod
{
[StarMapMod]
public class FirstMod
{
[StarMapImmediateLoad]
public void Init(Mod definingMod)
{
}
}
}
Lets make a simple hello world program now.
Just add a Console.WriteLine("Hello World!")
Inside FirstMod:
[StarMapImmediateLoad]
public void Init(Mod definingMod)
{
Console.WriteLine("Hello World!");
}
A mod should always have a mod.toml file so it can be identified by StarMap. Lets Create that file.
mod.toml.name = "FirstMod"
That is the only key a code-only mod needs. See The mod.toml file for the rest.
Properties.Copy To Output Directory set it to Copy always.If you did all steps correctly simply right clicking the project and selecting Build should build the files.
The compiled files will now be in the following directory: projectdir\FirstMod\bin\Debug\net10.0.
Now follow the installation guide to test your brand new mod. If you did all the steps correctly you should see Hello World! in the console output of StarMap.exe.