> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roboticks.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Archive Lifecycle

> 90 days hot in S3 standard, then S3 Glacier Deep Archive. 10-year minimum retention, configurable to 25. The cost model and retrieval timing.

# Archive Lifecycle

Evidence packs are written to S3 standard, served immediately to anyone with a download link for the first 90 days, then transitioned to S3 Glacier Deep Archive for long-term retention. The 90 + Deep-Archive pattern is what lets Roboticks meet the EU Product Liability Directive's 10-year minimum retention at a cost that does not dominate the bill.

## The lifecycle

```mermaid theme={null}
%%{init: {"theme": "neutral", "themeVariables": {"primaryColor": "#4040ff"}} }%%
flowchart LR
    Gen["Pack generated"] --> Hot["S3 Standard<br/>(hot, 90 days)"]
    Hot -->|Day 90| DA["S3 Glacier Deep Archive<br/>(cold, 10+ years)"]
    DA -->|Retention end<br/>(configurable: 10–25 years)| Del["Hard-deleted"]
```

| State                          | Storage class           | Latency      | Cost                                    |
| ------------------------------ | ----------------------- | ------------ | --------------------------------------- |
| Hot (first 90 days)            | S3 Standard             | Milliseconds | \$0.05 / GB-month (Team and Enterprise) |
| Cold (90 days → retention end) | S3 Glacier Deep Archive | Hours        | \$0.005 / GB-month                      |
| End of retention               | Hard-deleted            | N/A          | \$0                                     |

The transition is automated via an S3 lifecycle rule on the evidence-pack bucket. No manual action is required.

## Retention floor

The default retention is **10 years**, set to satisfy the EU Product Liability Directive's 10-year tail. The floor is configurable per project:

| Industry                            | Recommended floor                         |
| ----------------------------------- | ----------------------------------------- |
| General machinery (EU MR 2023/1230) | 10 years                                  |
| Medical device adjacent             | 15 years                                  |
| Rail (CENELEC EN 50128/9)           | 20 years                                  |
| Nuclear-adjacent                    | 25 years (the maximum Roboticks supports) |

The floor is set in **Project Settings → Evidence Retention** and is one-way ratcheting — you can extend a project's floor, never shorten it. This protects against operator error that could delete legally-required evidence.

<Warning>
  **Retention is your legal responsibility.** Roboticks holds the bits; the obligation to retain them is yours. Confirm the regulatory retention period applicable to your machinery class with your legal team before shipping. Roboticks' defaults reflect common best practice, not legal advice.
</Warning>

## Retrieval from Glacier Deep Archive

Retrieving a pack from Deep Archive is a two-step asynchronous process:

<Steps>
  <Step title="Issue a restore request">
    Either from the dashboard (**Releases → archived release → Restore from Archive**) or via CLI:

    ```bash theme={null}
    rbtk evidence restore epak_01HF5ZN3T0AAQ8X6BB1A8M2P3W \
      --tier bulk     # or 'standard' or 'expedited'
    ```
  </Step>

  <Step title="Wait for the restore">
    | Tier      | Typical wait                                 | Per-GB retrieval cost |
    | --------- | -------------------------------------------- | --------------------- |
    | Expedited | 1–5 minutes (not available for Deep Archive) | —                     |
    | Standard  | 9–12 hours                                   | \$0.02 / GB           |
    | Bulk      | 48 hours                                     | \$0.0025 / GB         |

    Deep Archive supports **Standard** and **Bulk** only. Expedited is for the warmer Glacier Instant Retrieval and Glacier Flexible Retrieval classes, which Roboticks does not use.
  </Step>

  <Step title="Download the restored copy">
    Once restored, the pack is available in S3 standard for 7 days. Generate a download link from the dashboard or:

    ```bash theme={null}
    rbtk evidence download epak_01HF5ZN3T0AAQ8X6BB1A8M2P3W ./
    ```

    After 7 days the restored copy is purged; the original Deep Archive copy is unaffected. Re-restore as needed.
  </Step>
</Steps>

## MCAP archival

MCAP bag files follow the same lifecycle as the packs that reference them. When a pack transitions to Deep Archive, every MCAP referenced exclusively by archived packs transitions with it. MCAPs referenced by any pack still in the 90-day hot window remain in hot storage.

This is why the manifest's `mcaps[*].storage_class` field exists: a recently restored pack may have some MCAPs in `STANDARD` (re-restored) and others in `DEEP_ARCHIVE` (not yet restored, requiring a separate request).

To restore the pack and all its MCAPs in one call:

```bash theme={null}
rbtk evidence restore epak_01HF5ZN3T0AAQ8X6BB1A8M2P3W \
  --tier standard --include-mcaps
```

## Cost worked example

Worked for a typical Team-tier customer producing one pack per release, every 3 weeks, with \~5 GB of MCAPs per pack:

* **Year 1 (17 packs, all hot first 90 days, then Deep Archive):**
  * Average hot storage: \~22 GB-months × $0.05 = $1.10
  * Average cold storage: \~700 GB-months × $0.005 = $3.50
  * **Total: \~\$4.60**

* **Years 2–10 (steady state, all packs in Deep Archive):**
  * \~85 GB cold storage × 12 months × $0.005 = $5.10 / year

* **10-year total: \~\$50**.

The cost is dominated by MCAP volume. Customers that capture multi-gigabyte MCAPs per test can prune to representative samples for archival (a pack can reference MCAPs by SHA-256 even after the bytes themselves are deleted, though the auditor then sees a `STORAGE_PRUNED` flag on the manifest entry).

## Configuring lifecycle

Project owners control:

* **Hot retention window** — default 90 days. Reducible to 30 days for cost-sensitive projects; expandable to 365 for active projects that re-pull evidence frequently.
* **Total retention** — default 10 years. Ratcheting up only.
* **MCAP-only retention** — independently set MCAP retention shorter than pack retention (the manifest preserves SHA-256s; only the bytes go). For projects where MCAPs are very large but the rest of the pack (logs, JUnit, coverage) is the meaningful evidence.

All settings live under **Project Settings → Evidence Retention**.

## Disaster recovery

The evidence-pack bucket is replicated cross-region (eu-west-1 primary, us-east-2 mirror). A single region outage does not affect retrieval. The Deep Archive class itself carries 99.999999999% (eleven nines) annual durability per AWS's published SLA.

## Next steps

<CardGroup cols={2}>
  <Card title="Release scoping" icon="tag" href="/evidence/release-scoping">
    How a Release pins what an archived pack will contain.
  </Card>

  <Card title="Customer handoff" icon="user-shield" href="/evidence/customer-handoff">
    What to tell an auditor about restoring a 7-year-old pack.
  </Card>
</CardGroup>
