---
title: "List Shared Data Compaction Events"
method: GET
path: "/api/admin/shared-data/users/{user_id}/compaction-events"
tags: ["admin"]
---

# List Shared Data Compaction Events

`GET /api/admin/shared-data/users/{user_id}/compaction-events`

Return per-event compaction metadata for one consenting user.

Backed by the OSS ``compaction_events`` table (migrations 023 and
030). The metadata columns (counts, timings, outcome flags) carry
no user content, so no redaction is applied. Migration 030 added
eight envelope-encrypted before/after snapshots (memory, history,
user, soul); these decrypt to plaintext on read and ride through
the response so an admin can see exactly what a compaction event
rewrote across the four memory files. ``status`` is one of
``'pending'`` (sync watermark advanced, async LLM call still
running or crashed) or ``'completed'``; legacy rows default to
``'completed'`` via the migration's server-side default.

Snapshots that exceed
``settings.compaction_event_snapshot_max_bytes_per_file`` are
stored as a JSON truncation record. We surface those as a flagged
payload (``truncated=True`` plus head, tail, size, sha256) instead
of dumping the JSON verbatim so the UI can render
"truncated, N KB" with the head and tail visible inline.

Ordered ``triggered_at desc`` so the most recent compaction shows
first; that is the question admins almost always ask ("did this
user just compact, and what did it cost?"). ``limit`` caps the
response so a long-running user does not OOM the wire.

## Path parameters

- `user_id` string, required

## Query parameters

- `limit` integer
- `start_date` string, nullable — ISO-8601 timestamp; lower bound on triggered_at.
- `end_date` string, nullable — ISO-8601 timestamp; upper bound on triggered_at.

## Response `200`

Successful Response

- SharedDataCompactionEventListResponse
  - `user_id` string, required
  - `consent_at` string, nullable, required
  - `items` SharedDataCompactionEventItem[], required
    - `id` integer, required
    - `triggered_at` string, nullable, required
    - `duration_ms` integer, required
    - `trimmed_count` integer, required
    - `trimmed_chars` integer, required
    - `input_tokens` integer, required
    - `output_tokens` integer, required
    - `min_message_seq` integer, nullable, required
    - `max_message_seq` integer, nullable, required
    - `status` string, required
    - `memory_updated` boolean, required
    - `user_profile_updated` boolean, required
    - `soul_updated` boolean, required
    - `summary_len` integer, required
    - `memory_text_before` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `memory_text_after` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `history_text_before` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `history_text_after` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `user_text_before` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `user_text_after` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `soul_text_before` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `soul_text_after` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `prompt` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `raw_response` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
    - `parsed_response` SharedDataCompactionSnapshot, required — One before/after memory-file snapshot from a compaction event. OSS stores eight envelope-encrypted text columns on ``compaction_events`` (memory/history/user/soul x before/after). The ORM decrypts to plaintext on read. When the underlying file exceeded ``settings.compaction_event_snapshot_max_bytes_per_file`` the column instead carries a JSON truncation record (``head``, ``tail``, ``size_bytes``, ``sha256``); we surface that here as ``truncated=True`` so the admin UI can render "truncated, N KB" with the head and tail visible inline rather than dumping the JSON verbatim into a body cell. ``None`` plaintext (``text`` is None and ``truncated`` is False) means the field was unchanged by this event (skip-if-unchanged optimization), the row is still ``'pending'``, or the row predates the feature.
      - `text` string, nullable
      - `truncated` boolean
      - `size_bytes` integer, nullable
      - `head` string, nullable
      - `tail` string, nullable
      - `sha256` string, nullable
  - `total` integer, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/mozilla-ai/apis/clawbolt.md) · [All operations](https://skmtc.net/mozilla-ai/apis/clawbolt/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mozilla-ai/clawbolt/revisions/0e52fe5f8d33/schema)
