code: func (a *Agent) persistCheck(check *structs.HealthCheck, chkType *structs.CheckType) error {
  	checkPath := filepath.Join(a.config.DataDir, checksDir, checkIDHash(check.CheckID))
  
  	// Create the persisted check
  	wrapped := persistedCheck{
  		Check:   check,
  		ChkType: chkType,
  		Token:   a.State.CheckToken(check.CheckID),
  	}
  
  	encoded, err := json.Marshal(wrapped)
  	if err != nil {
  		return err
  	}
  
  	return file.WriteAtomic(checkPath, encoded)
  }
docs: // persistCheck saves a check definition to the local agent's state directory