I want to create a job to clean it up daily. Will this affect the agent negatively?

UPDATE: So as a test (on a test machine) I deleted everything in the the folder after seeing that they appeared to be just data. Afterward the agent went offline and I had to re-install the agent to get things going again. Why?

I am very surprised that you had to reinstall the agent to make it work after deleting this folder.

A breakdown of what is in the folder:

the .Agent folder contains a folder with all the deployment logs in it. I'd recommend not deleting this folder: the contents are all text (ie small) and could prove useful.

The .Agent folder also contains a cache of NuGet packages downloaded from the server. The agent might behave a little strangely and need a restart if you delete these while it's running, but otherwise you can safely delete them.

The other directories in this folder should correspond to package deployments for projects in Deployment Manager or agent upgrades. You should be careful when deleting these, since your currently deployed projects are probably in these folders: for example if you have a running IIS website, it will be located in here by default. As long as you are sure these deployments are past their sell-by-date, they can be deleted however.

In summary, I wouldn't be surprised if you had to restart the agent after deleting the contents of this directory, it could get confused about which files exist. It definitely shouldn't need to be reinstalled, though - it'd be really good to work out what's going on here so that we can fix it.

What exact behaviour were you seeing? Were there any errors in the Windows Event Viewer relating to the agent? Did you try restarting the agent services from the Windows Services control panel?

We are also looking at improving the use of this directory in the near future, and cleaning up unused files from here so that it takes up less space. If you have any strong opinions about how this should work, let us know. If you think this is currently the most important thing for us to be working on, vote for it on uservoice

When I deleted the files in the folder, I could not run deployments. The following error was thrown:

Client is unable to finish the security negotiation within the configured timeout (00:00:00). The current negotiation leg is 1 (00:00:00).

When I placed all the deleted files back in their original folders, the issue persisted. Only re-installing (uninstalling and reinstalling that is) the agent worked to resolve the issue.

So if these folders under "applications" are truly just temporary data I think users would benefit from a global DM setting to clean this files in this folder after a successful deployment. In the meantime I will try setting up a batch job that deletes just older files and leaves the most recent.