Cereal docs
Deploy and monitor

Retention

Choose how long Cereal keeps session events, hook deliveries, traces, and usage.

await client.environments.update({
  update: {
    slug: "dev",
    retention: {
      sessionEventsDays: 30,
      deliveredHooksDays: 7,
      deadHooksDays: 30,
      spansDays: 14,
      usageRollupDays: 400
    }
  }
})

An omitted field in the policy means unlimited retention. {} keeps all categories without a time limit. A value of 0 makes eligible data removable on the next retention pass.

WindowDefaultData
deliveredHooksDays7Successful event-hook deliveries.
deadHooksDays30Failed deliveries that may need redelivery.
spansDays90Session traces.
sessionEventsDaysunlimitedA pruned session cannot be resumed: the prompt is folded from the log and nothing else.
usageRollupDaysunlimitedAggregated model usage.

What it never touches

  • A live session. Pruning underneath a running turn would make the next model request wrong rather than merely losing history.
  • A pending hook delivery, however old. It is still going to be attempted, so it is still pending.
  • An archived environment. Archiving is what you do when you want the history kept and nothing written.

How you can tell

After session events are pruned, sessions.send and sessions.decide return SessionPruned (HTTP 422) with prunedAt. Start a new session to continue working. You can still interrupt the old session or update its metadata.

const session = await client.sessions.get({ id })
session.eventsPrunedAt        // an empty transcript reads as a policy, not a bug

const trace = await client.traces.forSession({ id })
trace.prunedAt

The control plane's Environments page has the five windows with a one-click "keep very little" preset for a development environment.

On this page