This patch moves the local state to a separate package to further decouple it from the agent code. The code compiles but the tests do not yet.