I didn't know this /nogui command, that's nice. Ok for BWAPi 4, when I will integrate it to AIUR, I would take this opportunity to deeply improve the code. At the moment, there are some really ugly parts. :-/
There are still more new features being added in BWAPI4 such as filter function composition. Instead of getting the set of units and applying a filter to iterate each element and create a new set, a filter function can be composed and only applied to the initial creation of the set (so that several copies of the set are not made). Additionally, BWAPI4 sets will support the move constructor(A C++11 feature that works in VS2010), which also allows you to create a local variable for the set without making a copy of it.
So I would suggest to hold off porting for now.
I do not set any specific command optimization level, should I? I though it has an impact to make replays, not for the game itself.
Using command optimization is currently not compatible with latency compensation, so if you decide to use it make sure your bot can play with latency compensation disabled.
The command optimization level is used to reduce a bot's actions by grouping them. So a high command optimization could significantly reduce your bot's APM depending on the actions.
For example, if you told 4 SCVs to repair a command center, the bot would use 8 actions (select SCV1, repair target command center, select SCV2,...). With command optimization level 1, it will only use 2 actions (select all SCVs, right click command center). It will also attempt to use alternative actions (like right click) that can perform the same behaviour while using less data (so if 10000 repair actions were made, it would save about 9.8 KB in uncompressed command data).
Command optimization up to level 2 should have no behaviour difference.
Level 1 will group units together that use the same command (burrow and attack target etc).
Level 2 will group buildings and perform action shortcuts otherwise impossible, this causes it to be detected as a hack by bwchart and other programs. (such as selecting three barracks at once and training a marine)
Level 3 might cause some behaviour changes by grouping units that are targeting the same position on terrain. (like attack move to a location).
Level 4 will make positions fuzzier by making them multiples of 32 so that it can attempt to group them. It will also select all templars that are using the summon archon command which means the templar may not merge with the one you specified. (so if you order 8 templar to merge, the same 8 templar will merge into archons, but they will merge with the templar that are closest instead of the ones specified).