---
title: "oz0 retention keep-for"
description: "Usage and flags for oz0 retention keep-for."
canonical_url: "https://docs.oz0.ai/reference/cli/oz0/retention/keep-for"
---
# oz0 retention keep-for

> Usage and flags for oz0 retention keep-for.

For: Operators and developers looking up a command.

An agent's keep_for (in its definition, or a tenant's rule that overrides it) keeps its jobs at least that long: an erasure of a data subject erases everything else at once and defers that agent's jobs until their period ends, then erases them by itself; retention keeps them that long, and the tenant's Temporal namespace keeps its histories at least the longest period (where the backend keeps less, such as Temporal Cloud's 90 days, the jobs' histories are kept as held copies).

A period is 30d, 12w or 7y (a year counts 366 days), at most 30 years; 0 keeps nothing beyond the tenant's retention. A rule applies to jobs started afterwards. --basis records the legal basis the tenant keeps the jobs under, an ID from its own list of legal bases (oz0 inventory purposes); an erasure's deferral entry names it beside the reason keep_for.

It is a governance setting: --reason always, and shortening, --clear, or changing or removing a basis waits for another admin where the tenant has four eyes on. Which period a law asks for, and under which basis, is not the platform's to say.

## Usage

```bash
oz0 retention keep-for [AGENT [PERIOD]] [flags]
```

## Flags

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --basis
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      the legal basis the tenant records for the period: an ID from its own list of legal bases (none if empty)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --clear
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      remove the tenant's rule, so the agent definition's keep_for applies again
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --decision-ref
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      the decision or case the change follows, such as a case number (at most 200 characters)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --json
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      print JSON instead of a table
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --reason
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      why, required for every governance change (at most 500 characters; default $OZ0_REASON); the audit log keeps it
    </td>
  </tr>
</tbody>
</table>

## Inherited flags

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --context
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        $OZ0_CONTEXT or &lt;config dir>/orchestrator-zero/context.json
      </code>
    </td>
    
    <td>
      CLI context file written by server init
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --log-level
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        info
      </code>
    </td>
    
    <td>
      log level: debug, info, warn or error
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --tenant
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        default
      </code>
    </td>
    
    <td>
      the tenant
    </td>
  </tr>
</tbody>
</table>

See [all `oz0` commands](https://docs.oz0.ai/reference/cli/oz0) and the [global flags](https://docs.oz0.ai/reference/cli/oz0#global-flags).


## Sitemap

See the full [sitemap](https://docs.oz0.ai/sitemap.md) for all pages.
