from the Basic Interpreter Design Specification:
>8388 FLAG ... described as "Error flag bits."
from the XB (Product 359) Basic Interpreter Design Specification:
>8345 FLAG ... described as "General flag byte."
You could trigger some action that causes a change to FLAG.
Like checking the current AUTO NUM status and toggling it to trigger the Auto Num bit switching in the FLAG Byte.
If you see the bit changing in >8345, you are in XB or a XB variant.
If you see the bit changing in >8388, you are in TI Basic.
After your identification toggle it again to restore the memory state as before.
At least when using the pure command line (not programmatically), this approach just worked in Classic99.
Now the question is how to toggle Auto Num programmatically
Another approach I could think of is using the condition of SDD99 that you always run XB with memory expansion, so it will store numerical variables in expansion ram in contrast to TI Basic.
1. check for the non-existance of variable RALPHB
2. assign Value 1 to variable RALPHB
3. check where the variable got stored by going the path from the CPU pointers.
4. if you end up in CPU Ram you run XB, if you end up in VDP Ram, you run TIB.
4. remove variable RALPHB