Public API boundary rules for AI
🤖 AI-critical ✅ Political World source-backed
When a mod exposes a documented public addon facade, an AI assistant should treat that facade as a hard architectural boundary unless the user explicitly asks to modify the parent mod itself.
For Political World the supported facade is:
Lous12.PoliticalWorld.PoliticalWorldAPIIf creating a third-party addon
Section titled “If creating a third-party addon”Do:
RegisterAddonIsCompatibleHasCapabilitypublic Event Buspublic registriespublic data helperspublic diagnosticsDo not reach for:
MainMain.ScenarioBridgeprivate partial methodsreflection into Political World internalsHarmony patches against Political World implementationjust because those internals are visible on GitHub.
Visible source is not the same as supported API.
Why AI is especially likely to violate this
Section titled “Why AI is especially likely to violate this”Coding models are good at finding a method that appears to solve the immediate task.
If both exist:
PoliticalWorldAPI.SetKingdomGovernment(...)Main.ScenarioBridge.SetKingdomGovernment(...)the internal method may look shorter or expose more parameters.
That does not make it the correct dependency for an addon.
Decision procedure
Section titled “Decision procedure”Before generating addon code:
1. Identify the parent mod's supported public namespace/facade.2. Check API compatibility.3. Check capability for optional/newer functionality.4. Search public API/reference/examples.5. If the required operation is missing, state the missing capability.6. Propose an API extension request.7. Do not silently bypass the boundary.Exception — modifying the parent mod itself
Section titled “Exception — modifying the parent mod itself”If the task is explicitly:
“Change Political World core.”
then internal modules are the correct target.
The same method can therefore be:
wrong dependency for an addoncorrect implementation detail for the parent modContext matters.
Keep evidence scopes separate
Section titled “Keep evidence scopes separate”The current Political World ecosystem also demonstrates version drift.
Before using a method, identify whether it exists in:
- the user’s installed runtime;
- the exact source snapshot;
- an older API reference;
- a newer development build.
Do not generate code against the union of all observed versions.
Best failure mode
Section titled “Best failure mode”If the public API cannot perform the requested feature, the best answer is:
The current verified public API does not expose this operation.Here is the capability that would need to be added.That is better than producing brittle reflection code that works today and breaks the next time the parent mod is reorganized.