Build a local Python agent that does the math.
Recent revisions are kept. Restoring one creates a new revision.