Skip to main content

QUERY AND MANAGE DATA

Prerequisites: Swamp installed, a repository with at least one behavior that has produced data. If you need to run a behavior first, see Create and Run a Behavior.

List data for a behavior

swamp data list my-greeter
Data for my-greeter (command/shell)

file (1 item):
  log  v2  text/plain  21B  2026-07-01

resource (1 item):
  result  v2  application/json  135B  2026-07-01

report (2 items):
  report-swamp-method-summary  v2  text/markdown  476B  2026-07-01
  report-swamp-method-summary-json  v2  application/json  2.6KB  2026-07-01

Retrieve a specific artifact

Name the behavior and the artifact, and pass --single to get exactly one match:

swamp data query 'behaviorName == "my-greeter" && name == "result" && isLatest' --single --json --select content
{
  "exitCode": 0,
  "executedAt": "...",
  "command": "echo Hello from the swamp!",
  "durationMs": 13,
  "stdout": "Hello from the swamp!",
  "stderr": ""
}

Drop --select content to see the whole record, metadata included. To retrieve a previous version, replace isLatest with the version number:

swamp data query 'behaviorName == "my-greeter" && name == "result" && version == 1' --single --json --select content

For predicates beyond one artifact, see Query across behaviors with CEL.

View all versions of an artifact

swamp data versions my-greeter result
{
  "dataName": "result",
  "modelName": "my-greeter",
  "versions": [
    {
      "version": 2,
      "createdAt": "2026-07-01T21:37:36.721Z",
      "size": 135,
      "isLatest": true
    },
    {
      "version": 1,
      "createdAt": "2026-07-01T21:37:01.549Z",
      "size": 153,
      "isLatest": false
    }
  ],
  "total": 2
}

Query across behaviors with CEL

To find all data from a specific behavior:

swamp data query 'behaviorName == "my-greeter"'
┌────────┬────────────┬──────────┬──────────┬─────────┬──────┐
│ name   │ modelName  │ specName │ dataType │ version │ size │
├────────┼────────────┼──────────┼──────────┼─────────┼──────┤
│ result │ my-greeter │ result   │ resource │ 2       │ 135B │
├────────┼────────────┼──────────┼──────────┼─────────┼──────┤
│ log    │ my-greeter │ log      │ file     │ 2       │ 21B  │
└────────┴────────────┴──────────┴──────────┴─────────┴──────┘

behaviorName is an accepted spelling of the stored modelName field, which is why the result column is headed modelName. Existing queries that use modelName keep working.

To project specific fields, use --select:

swamp data query 'true' --select 'behaviorName + ": " + name'

For CEL expression syntax, see the CEL expressions reference. For how the data layer works, see The Data Layer.

Launch the interactive query TUI

Run swamp data query with no predicate to open the interactive browser. It shows all data in the repository with filtering and navigation.

Rename a data artifact

swamp data rename my-greeter old-name new-name

Renaming sets up a forwarding pointer so existing references to the old name continue to resolve.

Delete data

Preview what will be removed with --dry-run:

swamp data delete my-greeter result --dry-run

Then remove:

swamp data delete my-greeter result

Run garbage collection

To preview what garbage collection will clean up:

swamp data gc --dry-run
GC dry run: would delete 0 expired items, would reclaim 0 excess versions (0 bytes)

To run it:

swamp data gc

Garbage collection removes expired data and excess versions beyond each artifact's configured retention count.

Reclaim orphaned data

If you delete a behavior definition or migrate it to a different namespace, its data remains on disk. To preview what would be reclaimed:

swamp data prune --dry-run

To reclaim:

swamp data prune --yes

For background on why orphaned data accumulates, see The Data Layer. For the full option list and output format, see the data reference.