Helix Core is now P4 and Helix Swarm is now P4 Code Review. Learn more >>

Documentation | 2025.2

# Set up a cron job to delete AI summaries

AI summaries are stored as P4 keys in the Perforce database. By default, the AI summaries are kept for 30 days before being permanently deleted from P4 Code Review.

To ensure that the AI summaries are removed on a schedule, a cron job is required. The cron job that deletes these AI summaries runs at 6:00 PM on the 28th of every month and runs in the P4 Code Review server's time zone.

P4 Code Review admin credentials must be added to the cron job in order to successfully delete the AI summaries.

#### Do I need to manually add the cron job to P4 Code Review?

Use the table below to determine if you need to manually add the cron job to the AI summaries.

P4 Code Review version | Installation method | Do I need to manually add cron job?
--- | --- | ---
Upgrading to 2025.2 | Package | Yes
Upgrading to 2025.2 | Docker | No
Upgrading to 2025.2 | Tarball | Yes
Installing 2025.2 and onwards | Package | No
Installing 2025.2 and onwards | Docker | No
Installing 2025.2 and onwards | Tarball | Yes

## Prerequisites

Before adding the cron job to delete the AI summaries, ensure you have completed the following.

- Installed either curl or wget on the P4 Code Review server machine that runs the cron job.

  - To install curl, see Install curl.
  - To install wget, see Install wget.

- Create a file named helix-swarm in /etc/cron.d if it does not already exist.

- Ensure you have the following information:

  - `<ADMIN_USER>` - This is the user name of the P4 Code Review admin.

  - `<TICKET>` - This is the ticket associated with the P4 Code Review admin user. This is 30 characters hexadecimal string. For example, `12524CCEA6C43BC6EC081C9EA73WE3`.

    To find the `<TICKET>`, enter the following into a command prompt.

    p4 -u <username> login -p

    Replace `<username>` with your P4 Code Review user name.

  - `<DOMAIN>` - This is either `http` or `https`.

    - If you have SSL enabled in your P4 Code Review instance, enter `https`.

    - If you have not enabled SSL, enter `http`.

## Create a cron for removal of AI summaries

1. Find and open the helix-swarm file. This file is located in the /etc/cron.d.

2. Edit the helix-swarm file so that it has the following content:

    #
    # Cron job to delete AI summaries
    #
    0 18 28 * * nobody curl -X DELETE -u <ADMIN_USER>:<TICKET> <DOMAIN>://<HOSTNAME>[:<PORT>]/api/v11/AiAnalysis/removeAiSummaries

The `<PORT>` credential may not be applicable in your API URL.
3. Save the helix-swarm file.

The cron to remove the AI summaries is now set up and will run at 6:00 PM on the 28th of every month. This will run in the server's timezone.

Your search for returned results