anchor.diff:  # Buildkite Agent Hooks
   
  -Every agent installer comes with a hooks directory which can be used to override and extend the built-in agent behavior. For example you could create an agent `checkout` hook which speeds up a fresh `git clone` on a new build machine, an agent `environment` hook which exports secret API keys as environment variables, or a pipeline `pre-command` hook which sets up some repository-specific environment variables.
  +Every agent installer comes with a hooks directory which can be used to override and extend the built-in agent behavior. For example you could create an agent `checkout` hook which speeds up a fresh `git clone` on a new build machine, an agent `environment` hook which exports secret API keys as environment variables, or a repository `pre-command` hook which sets up some repository-specific environment variables.
   
   <%= toc %>
   
  
positive.code: 
  To get started with agent hooks copy the relevant example script and remove the `.sample` file extension.
  
  ## Pipeline hooks
  
  Pipeline hooks allow you to execute pipeline-specific scripts. Pipeline hooks live alongside your pipeline’s source code under the directory `.buildkite/hooks`.
  
  To get started create a `.buildkite/hooks` directory, add your hook script, and make it executable.
  
  
negative.code:     <tr><th>Hook</th><th>Order</th></th><th>Description</th></tr>
    </thead>
    <tbody>
      <tr><td style="white-space: nowrap"><code>environment</code></td><td style="white-space: nowrap">Agent, Plugin</td><td>Runs before all other commands. Useful for <a href="/docs/agent/v3/securing#using-environment-hooks-for-secrets">exporting secret keys</a>, <a href="/docs/agent/v3/securing#whitelisting">security whitelisting</a>, etc.</td></tr>
      <tr><td style="white-space: nowrap"><code>pre-checkout</code></td><td style="white-space: nowrap">Agent, Plugin</td><td>Runs before checkout.</td></tr>
      <tr><td style="white-space: nowrap"><code>checkout</code></td><td style="white-space: nowrap">Agent, Plugin</td><td>Overrides the default <code>git checkout</code> behavior. <em>Note:</em> If multiple checkout hooks are found, only the first will be run.</td></tr>
      <tr><td style="white-space: nowrap"><code>post-checkout</code></td><td style="white-space: nowrap">Agent, Repository, Plugin</td><td>Runs after checkout.</td></tr>
      <tr><td style="white-space: nowrap"><code>pre-command</code></td><td style="white-space: nowrap">Agent, Repository, Plugin</td><td>Runs before the build command.</td></tr>
      <tr><td style="white-space: nowrap"><code>command</code></td><td style="white-space: nowrap">Plugin, Repository, Agent</td><td>Overrides the default command running behavior. <em>Note:</em> If multiple command hooks are found, only the first will be run.</td></tr>
      <tr><td style="white-space: nowrap"><code>post-command</code></td><td style="white-space: nowrap">Agent, Repository, Plugin</td><td>Runs after the command.</td></tr>
      <tr><td style="white-space: nowrap"><code>pre-artifact</code></td><td style="white-space: nowrap">Agent, Repository, Plugin</td><td>Runs before artifacts are uploaded, if an artifact upload pattern was defined for the job.</td></tr>
      <tr><td style="white-space: nowrap"><code>post-artifact</code></td><td style="white-space: nowrap">Agent, Repository, Plugin</td><td>Runs after artifacts have been uploaded, if an artifact upload pattern was defined for the job.</td></tr>
      <tr><td style="white-space: nowrap"><code>pre-exit</code></td><td style="white-space: nowrap">Agent, Repository, Plugin</td><td>Runs before the job finishes, useful for performing cleanup tasks.</td></tr>
    </tbody>
  </table>
  
  