Wolf 7133 referenced sorcery that powers Grace. I decided to post a bit of her background so it'll be all clearer
Grace's photonics and electronics failed almost completely on the magical world. Only mechanical difference engines and parts which were the closest to golden elements, which nullify magic, weren't completely affected and the program that run within, to always protect the user, sparked the will to survive, the will which turned through willforce, sorcery, into thought.
This can be noticed in my opening post (she was still relatively fine in space) and the second one (when she was already going nuts on the surface).
This is why Grace is kind of crazy (stuttering before being "freed", voting unit 0 from hell), why eating golden coins (i.e. putting them close to her internal wiring) makes her fall into a coma, why she couldn't successfully protect Lumi and why she lets herself get damaged despite being able to protect her squishy contents (Lumi) when she was hit by the planet we're all on at hte beginning.
Obviously it progresses and she's bound to lose her mechanical self eventually. Her purely logical computations are infested with irrationality, deliberate misinterpretation, emotion, she weaves her own hopes, fears and beliefs into primary goals.
This is how free will begins.