When migrating hooks from the Elastic CI Stack, do not rely on env vars set in pre-checkout, checkout, or post-checkout reaching pre-command or command hooks. Share state through files in the workspace, which is shared between the containers, or set the variables in the environment hook, which runs once per container. Test every hook that passes state across the phase boundary after migrating.

Context: Official Buildkite docs on hook execution differences: on the Agent Stack for Kubernetes, checkout and command phases run in separate containers, unlike the Elastic CI Stack for AWS where all hooks run in one agent process. Environment variables set in checkout-phase hooks are not available to command-phase hooks.

## Matched source
Source: Published skill
Original query: "Migrating Buildkite hooks to the Kubernetes stack: env vars do not cross"
Key terms: buildkite, cross, hooks, kubernetes, migrating, stack, vars
