http://support.screeps.com/hc/en-us/articles/204825672-New-main-loop-architecture   This basically means the only code that runs every tick is the code inside (or called by) your main.loop function. The reason this works (or resets) every time you save code, is because committing code is one of the things that causes a new global to be created (because things could have changed).