CLI reference
Every aimem command and flag. Mount a Memory Bucket, and manage buckets, secrets, search, version history, and the agent biography (bio).
The aimem binary mounts a Memory Bucket and manages what is in it. Every
command works on a Memory Bucket in your MinIO AIStor deployment.
| Command | What it does |
|---|---|
aimem <bucket> <mountpoint> | Mounts a Memory Bucket as the agent's workspace. This is the default form, with no subcommand. |
aimem create, convert, list, get, delete, credentials | Creates and manages Memory Buckets. |
aimem secret | Stores secrets in the Vault and gives them to an agent at launch. |
aimem search | Searches a Memory Bucket's objects with a regular expression. |
aimem history | Shows who wrote each version of an object. |
aimem bio | Records the agent's OpenTelemetry data into tables in the Memory Bucket, and reads it back. |
The mount takes its settings from a --config file. The other commands take
their settings as flags or environment variables (see
Connection flags), never from a config file. They use the
AIStor Memory API; aimem bio also uses the Iceberg REST catalog.
Mounting a Memory Bucket
aimem s3://<bucket>/ <mountpoint> mounts a Memory Bucket as a workspace. Put the
settings in a YAML file, pass it with --config, and set credentials in the
environment:
export AIMEM_ACCESS_KEY=... AIMEM_SECRET_KEY=...
aimem s3://my-memory-bucket/ /workspace --config /etc/aimem/mount.yaml- Give the bucket as an S3 URI:
s3://bucket/, ors3://bucket/prefix/to mount a sub-prefix. A sub-prefix must end in/. The URI is never mistaken for anaimemcommand, so use it in scripts, fstab entries and systemd units.bucketandbucket/prefix/are accepted as shorthand. - The config file must set
version: "1.0". It holds every mount setting, including the required staging directory (local:). See Configuration for every key. - Credentials come only from the environment:
AIMEM_ACCESS_KEY,AIMEM_SECRET_KEY, and the optionalAIMEM_SESSION_TOKEN, orAIMEM_CREDENTIALS_FILE. They are never flags or config keys, so they stay out of config files and the process list. - The target must be a Memory Bucket on a paid-tier AIStor server. See Prerequisites.
Mount flags
Each flag matches the config key of the same name, with dashes changed to underscores. A flag overrides the file. Use the flags for quick, one-off mounts.
| Flag | Config key | Description |
|---|---|---|
--config <FILE> | — | YAML configuration file. Its values apply unless a flag overrides them. |
--local <DIR> | local | Required local staging and read-cache directory. Also AIMEM_LOCAL; set it with the flag, the variable, or the key. |
--local-size <SIZE> | local_size | Cap on staging plus the read cache under --local, such as 10Gi. Also AIMEM_LOCAL_SIZE. See Local store size. |
--endpoint-url <URL> | endpoint_url | AIStor endpoint. Repeat it, or use a {1...N} brace range, for failover. |
--region <REGION> | region | SigV4 signing region (default us-east-1). Also AIMEM_REGION. |
--request-timeout <SECONDS> | request_timeout | Deadline for each request; retries on the next endpoint. Needs two or more endpoints. |
--health-path <PATH> | health_path | HTTP path polled on each endpoint; unhealthy endpoints leave the rotation. |
--tls-ca-file <FILE> | tls_ca_file | Extra PEM CA bundle for endpoint TLS. Also AIMEM_TLS_CA_FILE. |
--tls-server-name <NAME> | tls_server_name | Name to verify the endpoint's certificate against, when --endpoint-url is an IP. Also AIMEM_TLS_SERVER_NAME. |
--read-only | read_only | Mount read-only. |
--agent <TYPE> | agent | Warm the agent's memory files on mount (claude, codex, cursor, auto). |
--session-file <FILE> | session_file | File that holds the current agent session ID. It is read as each upload starts and stamped on the object, so AIStor can tell which session wrote each version. |
--bio-agent <ID> | bio_agent | Capture this agent's telemetry: start the aimem bio collector for the mounted bucket and keep it running for the life of the mount. Mount with the agent's own credential. Requires --bio-endpoint-file and --bio-session-key. |
--bio-endpoint-file <FILE> | bio_endpoint_file | Where the collector publishes its loopback OTLP endpoint. Point the agent's OpenTelemetry exporter at its contents. |
--bio-session-key <ATTRIBUTE> | bio_session_key | Attribute that carries the agent's session ID, as the agent record's capture_descriptors declare it. Requires --bio-agent. |
--metadata-ttl <TTL> | metadata_ttl | Kernel metadata cache TTL: indefinite, minimal, or seconds. |
-f, --foreground | foreground | Run in the foreground instead of the background. |
-l, --log-directory <DIR> | log_directory | Write logs to files in this directory instead of to syslog. |
-d, --debug | debug | Turn on debug logging. |
--no-log | no_log | Turn logging off. |
Only --local, --local-size, --region, --tls-ca-file, and
--tls-server-name also read an environment variable. Every other mount setting
is set only in the config file; see Configuration.
Connection flags
Every command other than the mount reaches the Memory API with the same endpoint and credentials. Set them as environment variables (preferred) or as flags.
| Flag | Environment variable | Description |
|---|---|---|
--endpoint-url <URL> | AIMEM_ENDPOINT_URL | AIStor endpoint (for example https://aistor.example.com:9000) |
--access-key <KEY> | AIMEM_ACCESS_KEY | Access key |
--secret-key <KEY> | AIMEM_SECRET_KEY | Secret key |
--region <REGION> | AIMEM_REGION | SigV4 region (default us-east-1) |
--session-token <TOK> | AIMEM_SESSION_TOKEN | Optional STS session token |
--credentials-file <FILE> | AIMEM_CREDENTIALS_FILE | JSON credentials file, used when no access key and secret key are set. Read again on each connection, so a rotated file is picked up. |
--tls-ca-file <FILE> | AIMEM_TLS_CA_FILE | PEM file of extra CA certificates to trust for the endpoint |
--tls-server-name <NAME> | AIMEM_TLS_SERVER_NAME | Name the endpoint's certificate carries, when it differs from the host in --endpoint-url |
export AIMEM_ENDPOINT_URL=https://aistor.example.com:9000
export AIMEM_ACCESS_KEY=your-access-key
export AIMEM_SECRET_KEY=your-secret-keyThe credentials file is JSON:
{"access_key_id": "...", "secret_access_key": "...", "session_token": "...", "expiration": "<RFC 3339>"}.
session_token and expiration are optional.
The Memory API is a paid-tier AIStor feature. You need a licensed AIStor deployment to create and mount a Memory Bucket.
Manage Memory Buckets
A Memory Bucket is an AIStor bucket built for agents: compressed, versioned, tagged with memory metadata, and encrypted when AIStor has a KMS. AIStor Memory mounts only a Memory Bucket, so every workspace starts here.
Each of these commands follows aimem directly, for example aimem create my-project.
Older releases put these commands under aimem bucket (and before that aimem cortex), as in aimem bucket create my-project. Both spellings still work
and print a notice on stderr. Change your scripts to the shorter form.
A bucket named after an aimem command (create, convert, list, get,
delete, credentials, secret, search, history, bio, bucket or
cortex) cannot be mounted as aimem <name> <mountpoint>, because the
command runs instead. Mount it as aimem s3://<name>/ <mountpoint>. The
first six are new in this release, so change such mounts before you upgrade.
create <name>
Create a Memory Bucket.
| Flag | Description |
|---|---|
--kms-key-id <ID> | Pin a specific KMS key for encryption (defaults to the server key). |
--upgrade-existing | Convert an existing regular bucket instead of failing if it exists. |
aimem create my-projectThe name cannot be one of the aimem commands, such as list or secret.
aimem <name> <mountpoint> would run the command instead of mounting the
bucket.
You cannot change encryption, compression, or the KMS key after you create or convert a bucket.
convert <name>
Convert an existing regular bucket into a Memory Bucket, in place.
- Objects written before the conversion are not compressed, encrypted, or tagged. Only later writes are.
- Converting a bucket that is already a Memory Bucket does nothing.
- Warehouse buckets cannot be converted.
- A bucket named after an
aimemcommand, such aslist, can be converted. Mount it asaimem s3://list/ <mountpoint>, becauseaimem listruns the command. - The converted bucket is also an Iceberg warehouse, so
aimem biotables work on it at once.
| Flag | Description |
|---|---|
--note <NOTE> | Record a free-form migration note (stored as upgrade-note). |
--kms-key-id <ID> | Pin a KMS key, applied only when the bucket has no encryption of its own. |
aimem convert legacy-bucket --note "migrated 2026-07"list
List Memory Buckets.
| Flag | Description |
|---|---|
--search <SUBSTR> | Filter Memory Buckets whose name contains this substring. |
--json | Print JSON instead of a table. |
get <name>
Show one Memory Bucket: name, UUID, creation time, encryption, compression, KMS
key (when pinned), memory format, and whether it was converted (upgraded).
--json prints the full detail, including any operator metadata.
aimem get my-project --jsondelete <name>
Delete a Memory Bucket and all its data.
| Flag | Description |
|---|---|
--force | Delete even when the Memory Bucket is not empty. |
--yes, -y | Do not ask for confirmation. |
On a terminal, aimem delete asks you to type the bucket name before it
deletes anything. Scripts, which have no terminal, are not asked.
credentials <name>
Create temporary STS credentials that reach one Memory Bucket only (AssumeRole with an inline session policy). They can mount the bucket and use the Memory API on it, and nothing else. Use them to give a sandbox access to exactly one workspace.
| Flag | Description |
|---|---|
--duration <SECS> | Requested credential lifetime in seconds. |
--json | Print JSON instead of shell export lines. |
# Set scoped, time-limited credentials in a sandbox.
eval "$(aimem credentials my-project --duration 3600)"aimem secret — deployment-side secret provisioning
The process that launches the agent runs aimem secret, outside the
sandbox: for example a sandbox controller, a CI job, or an orchestrator. The
agent does not run it. Secrets never pass through the mount.
secret provision --grant VAR=name [-- cmd …]
Fetch the granted secrets and set them as environment variables.
- With a command after
--,provisionstarts the command as a child process, waits for it, and exits with its status. The command inherits the current environment, plus the granted secrets, minus the store and connection credentials. Removed: theAIMEM_SECRET_STORE_*variables,AIMEM_ACCESS_KEY,AIMEM_SECRET_KEY,AIMEM_SESSION_TOKEN,AIMEM_CREDENTIALS_FILE,AIMEM_ENDPOINT_URL, andAIMEM_REGION. The agent gets its API keys as ordinary environment variables but cannot read the store credential or fetch secrets again. - With no command, it prints
KEY=VALUElines for the caller to use.
| Flag | Description |
|---|---|
--grant VAR=name | Bind an environment variable to a secret name. Repeatable. At least one is required. |
--bucket <BUCKET> | Read secrets from a Memory Bucket over the Memory API. |
--store-endpoint <URL> | Read secrets from a generic HTTP store (HashiCorp Vault/OpenBao, a cloud secret manager). Cannot be combined with --bucket. Also AIMEM_SECRET_STORE_ENDPOINT. |
--store-token <TOK> | Bearer token for the HTTP store; stays with the launcher, never passed to the command. Also AIMEM_SECRET_STORE_TOKEN, which is safer than the flag. |
With --bucket, provision also needs the connection flags:
an endpoint and either an access key and secret key or a credentials file. It
stops with an error if they are missing. Use HTTPS for a production endpoint.
# Launch the agent with OPENAI_API_KEY set; store credentials are removed.
aimem secret provision --bucket my-project \
--grant OPENAI_API_KEY=openai -- claudesecret put / get / list / delete
Manage secrets stored in a Memory Bucket. Run these from the launcher or an operator's machine, not from inside the sandbox. Each takes the connection flags.
| Command | Description |
|---|---|
secret put <bucket> <name> | Store a secret. Pipe the value on stdin; a value passed with --value shows in the process list and shell history. |
secret get <bucket> <name> | Print a secret's value. |
secret list <bucket> | List the secret names in a Memory Bucket. |
secret delete <bucket> <name> | Delete a secret. |
printf '%s' "$OPENAI_KEY" | aimem secret put my-project openai
aimem secret list my-projectaimem search — regex over data at rest
aimem search runs a regular-expression search on the server over a Memory
Bucket's objects, which stay compressed and encrypted. It prints the names of
matching objects, or with --content, the matching lines (name:line:text).
aimem search my-project --pattern 'TODO|FIXME' --ext md --ext rs --ignore-case| Flag | Description |
|---|---|
-e, --pattern <REGEX> | RE2 pattern. Required and repeatable, 1–16 patterns; every pattern must match (AND). |
--prefix <PREFIX> | Search only keys under this prefix. |
--no-recursive | Search only the keys directly under --prefix, not nested ones. |
--ext <EXT> | Search only these extensions, with or without the dot (md or .md). Repeatable. |
-i, --ignore-case | Match without regard to case. |
-U, --multiline | Let a pattern match across lines. Off by default. |
--content | Print matching lines (name:line:text), not only object names. |
--column | Add the column to content output (name:line:col:text). |
-B, --before <NUM> | Print NUM lines before each match. |
-A, --after <NUM> | Print NUM lines after each match. |
-C, --context <NUM> | Print NUM lines before and after each match. |
--max-file-size <BYTES> | Skip objects larger than this. |
--max-total-bytes <BYTES> | Stop after this many bytes of matched text (0 uses the server default). |
aimem history — who wrote each version
aimem history shows an object's versions: who wrote each one, and in which
agent session. It takes the connection flags.
aimem history my-project/notes/plan.mdThe object is bucket/key or s3://bucket/key, the same form the mount takes.
| Flag | Description |
|---|---|
--limit <N> | Maximum versions to show. The total is reported either way. |
--after <VERSION> | Continue after this version ID, using the cursor a shortened listing prints. |
--annotations | Also list the annotations on the current version (names and sizes only). Annotations are a tech preview. |
--json | Print the raw response as JSON. |
aimem bio — the agent's biography
aimem bio records what an agent did. It runs an OpenTelemetry collector next
to the agent, writes the agent's traces, logs, and metrics into tables in the
same Memory Bucket as its files, and reads them back.
The collector accepts standard OTLP/HTTP. Any harness or SDK that exports OpenTelemetry can send to it.
aimem bio runs a separate aimem-bio binary, found next to aimem or on
PATH. The deb and rpm packages and the archive include it. aimem bio --help lists its options. Every bio command takes the connection
flags.
bio serve <bucket> --agent <ID> --endpoint-file <FILE> --session-key <ATTRIBUTE>
Run the collector. It listens on a loopback port, writes its base URL to
--endpoint-file, and accepts OTLP/HTTP on /v1/traces, /v1/logs, and
/v1/metrics, as JSON or protobuf, compressed with gzip or not.
aimem bio serve my-project --agent checkout-bot \
--session-key session.id \
--endpoint-file /run/agent/otlp-endpoint| Flag | Environment variable | Description |
|---|---|---|
--agent <ID> | — | The agent. Every payload is stored under it. |
--endpoint-file <FILE> | AIMEM_OTLP_ENDPOINT_FILE | Where the collector writes its endpoint. |
--session-key <ATTRIBUTE> | AIMEM_BIO_SESSION_KEY | Attribute that carries the session ID, as the agent record's capture_descriptors declare it. Required. |
--spool-dir <DIR> | AIMEM_OTLP_SPOOL_DIR | Where accepted payloads wait until they are committed. Default: <endpoint-file>.spool. |
- Run one collector per agent. An
aimem.agent.idattribute in a payload is stored but does not choose the agent. - Run it with the agent's own credential. A Memory Bucket's tables accept only
that credential, and it cannot read the agent record, which is why
--session-keyis required. See Scoping a collector to one agent. - You do not need to create tables first. Before it publishes its endpoint, the collector creates the agent's namespace and any missing tables.
Point the agent's exporter at the published endpoint:
export OTEL_EXPORTER_OTLP_ENDPOINT="$(cat /run/agent/otlp-endpoint)"If the collector cannot write what it receives, for example because the Memory Bucket name is wrong or the credential lacks table permissions, it reports each failure and then exits with a non-zero status. Run it under a supervisor that restarts it and reports the exit.
For crash safety and back-pressure, see Agent telemetry.
Tables and columns
Each agent's telemetry goes into six tables: otel_spans, otel_span_events,
otel_span_links, otel_logs, otel_metric_points, and
otel_metric_exemplars. Payloads that cannot be stored go to
otel_quarantine. bio serve creates missing tables before it publishes its
endpoint; bio ingest creates them on its first write.
- Histograms. In
otel_metric_points, a histogram point also fillscount,sum,min,max,bucket_counts, andexplicit_bounds, so SQL can add up token use and durations without parsing JSON. Other point types leave these columns empty.value_jsonholds every point in full. - GenAI attributes. Spans, span events, and logs also store
gen_ai_input_messages,gen_ai_output_messages,gen_ai_system_instructions, andgen_ai_tool_definitionsas JSON. A key-value list becomes a JSON object with sorted keys, and an array stays an array. A string that holds a JSON object or array is stored as that JSON. Any other value is stored as a JSON scalar, so a plain string keeps its quotes ("gpt-5"). A non-finite number is stored asnull; on its own, it leaves the column empty. The attribute map is unchanged. - New columns. A table created before a column existed gets it the next time the collector starts; older rows read it as null. If the credential cannot change the table's schema, the collector says so and keeps writing the table as it is.
bio query <bucket> --agent <ID> [--table <TABLE>] [--where <EXPR>] [--limit N]
Read an agent's telemetry as JSON lines. --table defaults to otel_spans, and
--limit to 100. --where takes one filter, session_id = <value>, to read one
session. The session ID is whatever the harness sends. If the harness names it
something AIStor Memory does not recognize, the column is empty and the filter
matches nothing.
aimem bio query my-project --agent checkout-bot --limit 20
aimem bio query my-project --agent checkout-bot --table otel_logs \
--where "session_id = 2f9c1b04"bio ls <bucket>[.<agent>]
List a Memory Bucket's namespaces (one per agent with telemetry), or the tables in one namespace.
aimem bio ls my-project # namespaces
aimem bio ls my-project.checkout-bot # that agent's tablesbio export <bucket> --agent <ID> --output <FILE> [--table <TABLE>] [--where <EXPR>]
Write every row of an agent's table to a Parquet file, for engines that cannot
read the tables directly, such as DuckDB and Spark. There is no row limit. Each
timestamp is written in microseconds, which those engines read, and the exact
value is kept in an integer column named <column>_unix_nano. --table
defaults to otel_spans, and --where takes the same session_id = <value>
filter as bio query.
aimem bio export my-project --agent checkout-bot --output spans.parquetbio ingest <bucket> <path> [--session-key <ATTRIBUTE>]
Load OTLP/JSON from a file or directory, for example telemetry captured before the collector was running. Rows go to the same tables as live telemetry. Loading the same file again adds no duplicate rows while AIStor Memory still has its record of the payload. That record is limited in size, so after many later writes to a table, a replay can add rows again.
--session-key defaults to session.id. Run it with the agent's own
credential: a Memory Bucket accepts only that agent's credential for its rows.
aimem bio ingest my-project ./otel-traces.jsonbio quarantine replay <bucket> --agent <ID> --session-key <ATTRIBUTE>
Write the rows in an agent's otel_quarantine table again, for example after
you fix the cause. This writes rows again even when they were written before.
| Flag | Description |
|---|---|
--agent <ID> | The agent whose quarantine table to replay. |
--session-key <ATTRIBUTE> | Attribute that carries the session ID. Also AIMEM_BIO_SESSION_KEY. |
--payload-id <ID> | Replay one payload instead of every matching row. |
--reason <REASON> | Replay only rows with this reason: decode_failed, attempts_exhausted, or row_build_failed. |
bio create <bucket>.<namespace>.<table> --schema <FILE>
Create your own table in an agent's namespace, next to its telemetry tables, with that agent's credential. AIStor Memory manages the rest of a Memory Bucket's catalog: every credential, root included, is refused a namespace that is not an agent's own.
--schematakes an Iceberg struct schema or a simple ordered field list ([{"name":"id","type":"string"}, …]).--schema -reads it from stdin.- If the table exists with the same schema, nothing changes. If it exists with a different schema (a missing field, or a different type or required setting), the command fails.
aimem bio create my-project.checkout-bot.events --schema schema.jsonWhat's next
- Configuration: every mount key.
- How memory works: workspace mode, memory warmup, and SKILLS.
- Operations: mounting in each sandbox runtime, logging, and metrics.
Configuration
Reference for the AIStor Memory mount configuration file. Covers the local staging store, endpoints and failover, health checks, request timeout, metadata caching, and FUSE and transfer settings.
Advanced
The AIStor Memory API that a Memory Bucket serves, how each aimem command maps to it, and the Memory Bucket storage contract. You do not need this section to use aimem.