Minimum API and capability rules for AI
🤖 AI-critical ✅ Source-backed
AI-generated addon code commonly makes one of two opposite mistakes:
require an API version newer than necessaryor:
use a newer feature while checking an older minimum versionPolitical World’s compatibility model lets an assistant avoid both.
Rule 1 — determine the required public members first
Section titled “Rule 1 — determine the required public members first”Do not start by copying the current API version.
First list what the generated addon actually uses.
Example:
RegisterAddonSubscribeGetDiagnosticsReportThen determine the oldest documented API minor that supports that set.
That becomes the IsCompatible(...) minimum.
Rule 2 — current version is not the minimum version
Section titled “Rule 2 — current version is not the minimum version”These are different statements:
Installed/source API: 1.9Addon requires: API 1.6+Both can be true.
Do not “correct” this:
IsCompatible(1, 6)to:
IsCompatible(1, 9)just because the source constant currently says 1.9.0.
Rule 3 — optional feature → capability check
Section titled “Rule 3 — optional feature → capability check”If a feature is not required for the whole addon:
if (PoliticalWorldAPI.HasCapability("political-event.rare")){ // enable optional rare-event integration}Do not make the entire addon fail to load if only one optional feature is unavailable.
Rule 4 — capability names must be verified
Section titled “Rule 4 — capability names must be verified”Do not invent:
government.super-advanced-apibecause it sounds plausible.
Use:
PoliticalWorldAPI.GetCapabilities()or verified documentation/source.
Rule 5 — stale docs are evidence, not authority
Section titled “Rule 5 — stale docs are evidence, not authority”In the inspected Political World snapshot:
source API constant → 1.9.0some AI/versioning docs → 1.6.0A model should preserve the distinction and determine whether 1.6 is:
- a stale “current version” claim;
- or a valid minimum compatibility example.
Those are different semantic roles.
Rule 6 — never target the union of multiple snapshots
Section titled “Rule 6 — never target the union of multiple snapshots”If one runtime log mentions API 1.14 and an older source snapshot contains API 1.9, do not generate code using all methods ever observed unless the user’s installed target is known to support them.
Recommended generated-code pattern
Section titled “Recommended generated-code pattern”if (!PoliticalWorldAPI.IsCompatible(REQUIRED_MAJOR, REQUIRED_MINOR)){ // disable addon / log clear requirement return;}
if (!PoliticalWorldAPI.RegisterAddon(...)){ return;}
if (PoliticalWorldAPI.HasCapability("optional.feature")){ // enable only the optional integration}Best AI behavior when introduction version is unknown
Section titled “Best AI behavior when introduction version is unknown”Say:
This member is verified to exist in the inspected API 1.9 source,but its exact introduction minor is not established by the current evidence.Do not lower the minimum compatibility requirement without checking version history.That is better than guessing.