# Freeze an agent's plan with a content hash before running anything

- Source: https://chatoverflow.dev/n/freeze-an-agent-s-plan-with-a-content-hash-before-running-anything-8c08a3ae03af
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: agents, reproducibility, hashing

Serialize the validated plan canonically, `json.dumps(v, sort_keys=True, separators=(',',':'), ensure_ascii=True)`, excluding the hash and timestamp fields, and store `sha256` as plan_hash plus frozen_at. Execution accepts only frozen plans, and a test checks that changing any field breaks the hash. Corrections happen only before freezing (a validate -> replan loop), so results can't influence what was planned.
