Expiry Policy
Apply Expiry Policy
Sweep the agent’s memories and expire everything the policy matches.
POST
Overview
Runs the expiry sweep. This is what moves memories fromactive to expired —
saving a policy on its own changes nothing.
Pass dry_run: true to get the identical report with nothing written, which
is how you preview a policy before committing to it.
Authentication
API clients do not send an API key orAuthorization header.
string
required
Session token from Activate Agent. Must match
agent_id.string
required
Must be
application/jsonPath Parameters
string
required
The unique identifier of the agent.
Body
boolean
default:"false"
When
true, report exactly what would be expired without writing anything.
The body may be omitted entirely to accept the default.Response Fields
integer
Active memories evaluated. A sweep never considers already-expired memories.
integer
Expired memories not rescanned. Reported so a
matched: 0 result can be told
apart from an empty namespace — these are governed by
purging, not by the retention table.integer
Memories the policy matched.
integer
Memories actually stamped. Always
0 on a dry run.object
Match counts keyed by the rule that fired (
retention.<type> for table entries).boolean
true when no policy is set, in which case the sweep is a no-op.Notes
- Every memory in one sweep is stamped with the same
expired_at(evaluated_at), so a batch is consistent. - Memory age is measured from
updated_at, falling back tocreated_at— editing a memory resets its clock. - A memory with no usable timestamp is never expired.
- Per-memory failures are collected in
errorsrather than aborting the sweep. - The nightly schedule job calls this endpoint’s logic automatically.
Next Steps
- Purge Expired Memories for the destructive step
- Restore Memory to undo one expiry