AI Agent Interactive Modding Workflow
This document defines the end-to-end Standard Operating Procedure (SOP) for AI Coding Agents (such as Claude Code, Cursor, Windsurf, Cline, and OpenChamber) and human developers building custom NPC mods for Probably Stolen.
To build a complete, scanner-compliant mod that loads and runs cleanly, an AI Agent needs two complementary references:
- Official Base Modding Guide: from the official repository
dragonpan2/probably-stolen-modding(README.md,ModdingGuide.md, andAPIChanges.md), which defines folder structure, mandatorymanifest.xmltags (<Assemblies>and<Capabilities />),IModlifecycle,ModLog, asset folders (Textures/Items/,Textures/Paper/,Sounds/,Localization/,LootTables/,Books/),ModHookevents,ModScannercapability rules, and Steam Workshop publishing. - Custom NPC Framework Specification: from this documentation site (and the single-file context
/llms-full.txt), which defines the zero-referenceNpcFrameworkSdk.csbridge, 5-phase customer generation, per-save storyline state store (cnpcf_),288×211customer portrait injection, and all 18 Customer Subsystems.
1. Copy-Paste Starter Prompts for AI Coding Agents
Copy and send either of the prompts below to your AI coding assistant so it ingests both the official modding guide and the Custom NPC Framework specification before guiding you step-by-step:
Prompt Template A: Interactive End-to-End Mod Creation (Recommended)
Please read the following two sets of technical documentation for Probably Stolen modding first:
1. Official Probably Stolen Modding Guide (project layout, mandatory manifest.xml <Assemblies> and <Capabilities /> tags, IMod lifecycle, ModLog, custom items/sounds/localization asset loading, ModHook events, and ModScanner rules):
- Quick Start: https://raw.githubusercontent.com/dragonpan2/probably-stolen-modding/main/README.md
- Advanced Modding Guide: https://raw.githubusercontent.com/dragonpan2/probably-stolen-modding/main/ModdingGuide.md
- API Changes: https://raw.githubusercontent.com/dragonpan2/probably-stolen-modding/main/APIChanges.md
2. Custom NPC Framework Complete Specification (6-step AI Agent workflow, full NpcFrameworkSdk.cs source code, all 18 Customer Subsystems, vanilla item/tag/sprite dictionaries, and full code breakdowns of both example mods):
- Workflow Guide: https://customnpc.netlify.app/en/guide/agent-workflow
- Single-File Full Context: https://customnpc.netlify.app/llms-full.txt
After reading, do not write code blindly. Walk me through the [6-Step Interactive Requirement Checklist] to confirm:
1. Mod metadata (Mod ID, display name, author) and whether the mod also needs custom items (GameItem), custom sounds, or loot table edits;
2. The new NPC's identity, faction (clientFaction), and portrait source (built-in SpriteDict pool vs. custom 288x211 PNG in Textures/);
3. Spawn phase (spawnPhase), day window, cooldown days, and spawn probability;
4. Core trade intent (regular BUY, regular SELL, Wholesale lot, BarterOffer, multi-day Procurement contract, or Custom GunOrder);
5. Multi-day storyline state machine (cnpcf_ save keys) and branching outcomes;
6. World integrations (7-digit holophone contact, handwritten note, store terminal request bounty StoreRequest, next-day newspaper headline TriggerNews, interrogation/smart-glasses scan dialogue, wanted arrest cutscene, afterhour events).
Once confirmed, generate the complete Modding/<ModName> project (.csproj, manifest.xml, NpcFrameworkSdk.cs, IMod entry class) and Mods/<ModName> deployment folder following the official manifest and zero-capability scanner rules.Prompt Template B: Rapid Multi-Act Storyline NPC Generation
Read the official modding guide https://raw.githubusercontent.com/dragonpan2/probably-stolen-modding/main/ModdingGuide.md and the Custom NPC Framework full specification https://customnpc.netlify.app/llms-full.txt .
I want to create a multi-act storyline NPC mod for Probably Stolen named [Character Name]. Ask me to confirm each act's trade intent, items (vanilla item IDs vs. custom items), dialogue branches, and rewards first, then output a complete, buildable C# mod project that passes mod-scan with empty <Capabilities />.2. Official Base Modding Rules (dragonpan2/probably-stolen-modding)
Every mod generated by an AI Agent must follow the base rules established in the official repository:
2.1 Standard Folder Layout
Inside the game installation folder (next to Probably Stolen.exe), Modding/ holds source projects and Mods/ holds runtime mod folders:
Probably Stolen/
├── Probably Stolen.exe
├── dev.txt # Optional empty file: enables F8 Debug Console and F9 Dev Menu
├── Mods/
│ └── MyCustomNPCPack/
│ ├── manifest.xml # Mandatory: root element must be <Manifest>
│ ├── MyCustomNPCPack.dll # Mandatory: listed under <Assemblies>
│ ├── preview.png # Optional: Workshop & Mods menu preview (< 1 MB recommended)
│ ├── Textures/
│ │ ├── my_npc.png # General texture (288x211 NPC portraits go here; auto-injected into SpriteDict)
│ │ ├── Items/
│ │ │ └── custom_item.png # Custom item sprite (must sit directly in Textures/Items/)
│ │ └── Paper/
│ │ └── page_bg.png # Paper book art (must sit directly in Textures/Paper/)
│ ├── Sounds/
│ │ └── custom_sfx.wav # Custom audio (registered as "<modId>:custom_sfx")
│ └── Localization/
│ ├── en.csv # English localization (UTF-8, no header: key,text)
│ └── zh.csv # Chinese localization
└── Modding/
└── MyCustomNPCPack/
├── MyCustomNPCPack.csproj
├── manifest.xml
├── NpcFrameworkSdk.cs # Zero-reference bridge SDK file
└── MyCustomNPCPackMod.cs # IMod entry classNote: Asset folder scanning is not recursive. Item sprites must sit directly in
Textures/Items/, paper art inTextures/Paper/, general/NPC textures inTextures/, sounds inSounds/, and localization CSVs inLocalization/.
2.2 Mandatory manifest.xml Schema
The root element of manifest.xml must be <Manifest>, and both <Assemblies> and <Capabilities /> are mandatory:
<?xml version="1.0" encoding="utf-8"?>
<Manifest>
<ID>my_custom_npc_pack</ID>
<Name>我的自定义NPC扩展包 / My Custom NPC Pack</Name>
<Author>YourName</Author>
<ModVersion>1.0.0</ModVersion>
<Description>Custom NPC and storyline add-on built on Custom NPC Framework.</Description>
<GameVersions>
<Version>0.46</Version>
</GameVersions>
<Prerequisites>
<Mod>CustomNPCFramework</Mod>
</Prerequisites>
<Assemblies>
<Assembly>MyCustomNPCPack.dll</Assembly>
</Assemblies>
<Capabilities />
</Manifest><ID>: ASCII letters, digits,_,-, and.only (cannot start with., max 64 chars).<Prerequisites>: list dependencies using<Mod>CustomNPCFramework</Mod>.<Assemblies>: list every DLL in the mod folder; any unlisted DLL or game assembly copy (0Harmony.dll,Assembly-CSharp.dll) refuses activation.<Capabilities />: keep empty (<Capabilities />).
2.3 .csproj Configuration
Target netstandard2.1 and set <Private>false</Private> on all game assembly references so they are never copied into Mods/<ModName>/:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>MyCustomNPCPack</AssemblyName>
<RootNamespace>MyCustomNPCPack</RootNamespace>
<LangVersion>latest</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<ManagedDir Condition="'$(ManagedDir)' == ''">$(MSBuildProjectDirectory)/../../Probably Stolen_Data/Managed</ManagedDir>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>$(ManagedDir)/Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(ManagedDir)/UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(ManagedDir)/UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="0Harmony">
<HintPath>$(ManagedDir)/0Harmony.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>2.4 Combining Custom NPCs with Custom Items (OnModItemDirectoryInit)
If your custom NPC needs to buy, sell, or reward a brand-new item not in vanilla:
- Place the item sprite PNG in
Mods/<ModName>/Textures/Items/<sprite_key>.png(sized to64pxper inventory grid cell); - Subscribe to
ModHook.OnModItemDirectoryInit += RegisterItems;inOnEnable()(and unsubscribe inOnDisable()); - Inside
RegisterItems(), create the item withItemDirectory.CreateEmptyItem("<item_id>")and bind its sprite and grid shape viaitem.SetSpriteAndShapeFromMod("<mod_id>", "<sprite_key>"); - Reference
"<item_id>"insc.clientBuyingIdList.Add("<item_id>")orPlayerStore.Instance.AddDirectSellingItemToTable("<item_id>", ...).
3. 6-Step Interactive Requirement Checklist for AI Agents
- Step 1 — Mod Metadata & Custom Assets: confirm
<ID>, display name, author, and whether custom items (Textures/Items/) or sounds (Sounds/) are needed alongside the NPC. - Step 2 — Identity, Faction & Portrait: confirm
identifier, bilingual display names,clientFaction(from the 8 vanilla factions), andspriteName(70+ built-inSpriteDictmethods vs. custom288×211PNG inTextures/). - Step 3 — Spawn Scheduling: confirm
spawnPhase(1Early for story acts,2Normal for recurring visitors),priority,minDay,cooldownDays, andspawnChancePercent. - Step 4 — Core Trade Intent (
ClientIntent): select from regularBUY, regularSELL,Wholesalebundle,BarterOffer,AttachProcurementOffer,BuildCustomGunOrder, orDIALOGUEinvestigation. - Step 5 — Multi-Day Storyline State Machine: define
cnpcf_save keys (GetSaveInt/SetSaveInt), register an auto-dispatcher entry (minDay = 9999, spawnChancePercent = 0), and advance stages insideacceptDealDialogue,allDoneDialogue, or dialogue choice callbacks. - Step 6 — World Subsystems: confirm optional
interogationDialogue,glasseDialogue, realtime scale callbacks (onItemAddedToWeighted),SetWanted+customOnArrestDialogue,RegisterPhoneContact,GiveHandnoteToPlayer,PostStoreRequest,TriggerNews, orRegisterAfterhourEvent.
4. Pre-Publish Verification Checklist
- Do not touch gameplay singletons inside
InitorOnEnable:InitandOnEnablerun at the Main Menu before any save is loaded. Only accessPlayerStore.InstanceorStoreStation.InstanceinsideclientFactoryor gameplay hooks. - Always call
sc.CompleteClientCreation(false)before returning aStoreClient(followed bysc.CompleteSecClient()for Security dialogue encounters). - Pass
DirectoryMaster.Item("$", true)as the placeholder item inDialogue.AddChoice, and end non-trade dialogue branches withDialogUIManager.Instance?.CurrentClientLeave(1f). - Keep
sc.isAug = falsefor non-monster characters (isAug = trueis reserved for hostile disguised Aug monsters). - Verify zero-capability compliance: run
mod-scan <your_mod_id>in the F8 console (withdev.txtpresent) to confirm the DLL requires no<Capabilities>.