Sitelet https://maple.dev/docs/reference/cli/
Skip to content
Maple Docs
Open app
Browse the docs
On this page

CLI reference

Every maple command, argument and flag, plus the local server's endpoints, environment variables and a troubleshooting guide.

The maple binary is one CLI with two backends: the local server it starts itself (maple start) and a hosted Maple workspace (maple auth login). Every query command runs against whichever backend is resolved for that invocation. Output is JSON by default, clean enough to pipe into jq or an agent.

New here? Start with the Maple Local walkthrough, or use the CLI with hosted Maple. This page is the complete surface.

Command index

CommandWhat it does
maple start · stop · resetRun the local server, stop it, or clear its live data
maple checkpoint · restoreTake a restore point of the local store, or roll back to one
maple archive …Export sealed days to Parquet and manage those archives
maple schema …Inspect and migrate the local store’s schema
maple updateUpgrade a script-installed binary in place
maple services · diagnose · service-map · top-opsServices, their health, dependencies and hottest operations
maple traces · trace · slow-tracesSearch spans, inspect one trace, find the slowest
maple errors · errorError groups by fingerprint, and one group in detail
maple logs · log-patternsSearch logs, or cluster them into templates
maple attributes keys · valuesDiscover attribute keys and their values
maple metrics · queryList metrics; run raw SQL (local only)
maple timeseries · breakdown · compareBucketed metrics, top-N breakdowns, two windows side by side
maple auth … · whoami · useSign in to a workspace, see the resolved backend, pin one

Global flags

Accepted by every command, in any position (maple --local traces and maple traces --local both work):

FlagDescription
--localForce local mode (requires a running maple start)
--remoteForce remote mode (requires maple auth login)
--debugPrint the compiled SQL and per-query timing to stderr; stdout stays clean JSON
--format <json|table>Output format, default json. table renders a flat row set as an aligned table

Most query commands also share a set of filter flags. Which ones apply is listed per command below; the shapes are always the same:

FlagAliasDefaultDescription
--since <range>6hRelative time range: 30m, 1h, 6h, 24h, 7d
--start <time>Absolute start, YYYY-MM-DD HH:mm:ss UTC (use with --end)
--end <time>Absolute end, YYYY-MM-DD HH:mm:ss UTC
--service <name>-sFilter by service name
--env <name>-eFilter by deployment environment, e.g. production
--limit <n>-n20Maximum number of results
--offset <n>0Pagination offset

Server commands

Local mode only. maple start is the long-lived process that owns the embedded ClickHouse connection; every other command talks to it over HTTP.

maple start

Start the local ingest and query server.

FlagDefaultDescription
--host <address>127.0.0.1Bind address. Anything but loopback exposes the UI, OTLP ingest and raw SQL to the network without authentication (see Server endpoints)
--advertise-host <host>the bind addressHostname printed for clients and used by the bundled UI
--port <int>4318Port for OTLP ingest, the query API and the bundled UI
--data-dir <path>~/.maple/dataEmbedded ClickHouse data directory
--offlinefalseServe the UI bundled in the binary instead of linking to local.maple.dev
--background, -dfalseRun detached, logging to ~/.maple/maple.log; stop with maple stop
--resetfalseWipe live data before starting, keeping checkpoints. For an incompatible upgrade
--checkpoint-interval <dur>30mHow often to refresh the restore point while running (45s, 2h, or off)
--on-dirty-store <policy>failWhat to do when the store was not cleanly closed: fail, wipe or restore-checkpoint
--chdb-config-file <path>generatedYour own ClickHouse config for the embedded engine. Must keep backups enabled for checkpoints to work
--minimum-raw-telemetry-retention-days <n>Persist a retention floor for the raw tables (at least 90 days). Survives reset and restore
maple start                    # foreground, UI from local.maple.dev
maple start --offline          # foreground, bundled UI, no internet needed
maple start -d --port 4400     # detached on a custom port
maple start --host 0.0.0.0 --advertise-host maple.home.arpa --offline

The default recovery policy is fail, so an unclean shutdown never silently deletes telemetry. What each policy does, and how reset and restore protect the store, is on Checkpoints and archives.

maple stop

Stop a running server. Reads the PID file beside the data directory.

FlagDefaultDescription
--data-dir <path>~/.maple/dataData directory of the server to stop

maple reset

Delete live data so the next maple start bootstraps fresh. Checkpoints under <data-dir>/backups are kept. Refuses to run while a server owns the store.

FlagDefaultDescription
--data-dir <path>~/.maple/dataStore whose live data to clear
--yes, -yfalseSkip the confirmation prompt

maple checkpoint

Create and validate a restorable checkpoint of the local store. Works out of the box against a running maple start.

FlagDefaultDescription
--host <address>127.0.0.1Host of the running server
--port <int>4318Port of the running server
--data-dir <path>~/.maple/dataThe server’s data directory

If the server was started with a custom host, port or data directory, pass the same values here.

maple restore

Restore the local store from the current checkpoint. Refuses to run while a server owns the store. The existing store is moved beside the data directory as <data-dir>.quarantine-<ids>, never deleted; maple schema gc lists it and --apply removes it.

FlagDefaultDescription
--data-dir <path>~/.maple/dataStore to restore
--checkpoint-id <uuid>the current checkpointRestore one specific checkpoint instead
--yes, -yfalseSkip the confirmation prompt
maple restore --yes
maple restore --checkpoint-id 01234567-89ab-4cde-8fab-0123456789ab --yes

maple archive

Local mode only. Export whole UTC days of the six raw telemetry tables from a checkpoint into Parquet files, and manage those exports. How archives work is explained on Checkpoints and archives.

SubcommandWhat it does
archive create <YYYY-MM-DD> <signal>Export one day of one signal. --checkpoint-id picks the checkpoint. Refuses days past retention, and refuses to replace an archived day with fewer rows unless you pass --allow-shrink
archive list [--output summary|paths|json] [--signal <name>]List archived days. paths prints Parquet file paths for DuckDB and needs --signal
archive verify [--signal <name>]Re-check the SHA-256 of every archived file
archive expire <YYYY-MM-DD> --applyDelete one archived day across all six signals
archive retire-live <YYYY-MM-DD> --applyDelete a day from the live store once all six signals are archived and verified. The day must be at least --sealing-lag-hours (default 24) past UTC midnight
archive gc [--keep <n>] [--apply]Delete replaced copies of re-exported days, keeping the newest n per signal and day (default 1). Without --apply it only prints the plan
archive reconcileFinish an interrupted create or gc without exporting again
archive rebuild <signal>Rebuild a signal’s catalog.jsonl from its manifests

Signals: logs, traces, metrics_sum, metrics_gauge, metrics_histogram, metrics_exponential_histogram.

Common flags: --data-dir (default ~/.maple/data), --archive-dir (default ~/.maple/archive) and --scratch-root (default ~/.maple/scratch). gc, expire and retire-live change nothing unless you pass --apply. reconcile acts by default; pass --dry-run to print the plan without changing anything.

Export settings are fixed: one writer thread, 10,000-row row groups, and files of at most 500,000 rows or 256 MiB. Older releases had archive calibrate; archive create still accepts its --config flag but ignores it.

maple schema

Inspect and migrate the local store’s schema. Needed only when a release note says a store needs migrating; a normal upgrade opens the store as is.

SubcommandWhat it does
schema statusShow the store’s schema identity and migration journal state
schema planShow the deterministic migration plan for this store
schema migrate [--dry-run] [--yes]Migrate a populated store into a staged current-schema store. Needs a stopped server; keeps the original as a rollback point
schema abandon [--yes]Quarantine an unfinished staged target, preserving the active source (also when the source was left dirty)
schema gc [--apply] [--release-preserved]List what restores, resets and migrations set aside (quarantined stores, migration sources, stale locks). --apply deletes it; --release-preserved also unpins the checkpoints a reset kept

All four take --data-dir <path> (default ~/.maple/data).

maple update

Update a script-installed binary to the latest release: download, verify the checksum, install in place.

FlagDescription
--checkOnly report whether a newer version is available
--tag <vX.Y.Z>Install a specific release instead of the latest

Homebrew installs refuse maple update so the package manager stays in charge; run brew upgrade maple instead.

Services

maple services

List active services with throughput, error rate and P95 latency. Flags: --since / --start / --end, --env.

maple diagnose <service-name>

Deep-dive one service: health, top errors, recent traces and logs.

  • <service-name>: the service to diagnose
  • Flags: --since / --start / --end, --env

maple service-map

Service dependency edges with call counts, errors and latency. Flags: --since / --start / --end, --service, --env.

maple top-ops <service-name>

Top operations (span names) for a service, ranked by a metric.

  • <service-name>: the service to inspect
  • --metric <count|avg_duration|p50_duration|p95_duration|p99_duration|error_rate|apdex>: ranking metric, default count
  • Flags: --since / --start / --end, --limit

Traces

maple traces

Search traces and spans.

FlagDescription
--span-name <substr>Filter by span name (substring, case-insensitive)
--errorsOnly traces with errors
--min-duration-ms <int>Minimum duration in milliseconds
--max-duration-ms <int>Maximum duration in milliseconds
--http-method <method>Filter by HTTP method (GET, POST, …)

Plus --since / --start / --end, --service, --limit, --offset.

maple traces --service api --min-duration-ms 500 --errors --since 1h

maple trace <trace-id>

Inspect one trace: the full span tree plus correlated logs.

  • <trace-id>: the trace to inspect

maple slow-traces

The slowest traces with duration stats. Flags: --since / --start / --end, --service, --env, --limit.

Errors

maple errors

Error groups by fingerprint, with count, affected services and last seen. Flags: --since / --start / --end, --service, --env, --limit.

maple error <fingerprint-hash>

One error group in detail: sample traces and a timeseries.

  • <fingerprint-hash>: the fingerprint from maple errors
  • Flags: --since / --start / --end, --service, --limit

Logs

maple logs

Search logs.

FlagAliasDescription
--severity <level>TRACE, DEBUG, INFO, WARN, ERROR or FATAL
--search <text>-qSubstring match on the body
--trace-id <id>Only logs from one trace

Plus --since / --start / --end, --service, --limit, --offset.

maple log-patterns

Cluster logs into templates to surface the noisiest patterns. Flags: --since / --start / --end, --service, --severity, --search/-q, --limit.

Attributes

maple attributes keys

Discover the attribute keys present in your data.

FlagDefaultDescription
--source <traces|metrics|services>tracesWhere to look
--scope <span|resource>spanSpan or resource attributes (traces only)

Plus --service, --since / --start / --end, --limit.

maple attributes values <key>

List the values seen for one attribute key.

  • <key>: the attribute key
  • Flags: same as attributes keys

Metrics and raw SQL

maple metrics

List available metrics. Flags: --since / --start / --end, --service, --search/-q, --limit.

maple query "<sql>"

Run raw ClickHouse SQL against the local store, for anything the typed commands don’t cover.

  • <sql>: the query to run
maple query "SELECT ServiceName, count() FROM traces GROUP BY ServiceName ORDER BY 2 DESC"

Local only. Raw SQL against the hosted warehouse would let one client read other organizations’ data, so maple query returns a clear error in remote mode. Every other command works in both modes.

Analytics

maple timeseries

Time-bucketed trace metrics: count, latency quantiles, error rate and apdex per bucket.

FlagDefaultDescription
--group-by <none|service|span_name|status_code|http_method>noneSplit the series by a dimension
--span-name <substr>Filter by span name
--errorsfalseOnly errored spans
--bucket <seconds>60Bucket size

Plus --since / --start / --end, --service, --env.

maple breakdown

Top-N breakdown of traces by a dimension.

FlagDefaultDescription
--group-by <service|span_name|status_code|http_method>span_nameDimension to group by
--span-name <substr>Filter by span name
--errorsfalseOnly errored spans

Plus --since / --start / --end, --service, --env, --limit.

maple compare

Compare service health between two windows, for regression detection. Give either --around or all four explicit bounds.

FlagDescription
--around <ts>Compare the 30 minutes before and after this UTC time (YYYY-MM-DD HH:mm:ss)
--current-start <ts> / --current-end <ts>The “current” window
--previous-start <ts> / --previous-end <ts>The baseline window
--env <name>Filter by deployment environment

Using the CLI with hosted Maple

The query commands also work against a hosted Maple organization. Sign in once:

maple auth login                                   # US organizations
maple auth login --api-url https://api.eu.maple.dev # EU organizations
maple use remote                                   # optional: stop auto-detecting
maple services --since 1h

maple auth login opens your browser, and you approve the CLI for one organization. The CLI then holds an API key with full access that expires after 90 days. It appears under Settings → API Keys with the description “Created by maple auth login”. Run maple auth login again when it expires, and maple auth logout to revoke it.

Every command except maple query works in remote mode. The server commands (start, stop, reset, checkpoint, restore, archive, schema) always act on the local store. Which region your organization is in is on Regions.

Auth and configuration

maple auth login

Sign in to a hosted Maple workspace. Opens your browser to approve the CLI; the credential is stored in the macOS keychain where available, otherwise in ~/.maple/config.json (mode 0600). maple login is a shorthand for the same command.

FlagDescription
--api-url <url>Maple API base URL, default https://api.maple.dev
--with-tokenRead an existing API token from stdin instead of opening a browser, so it stays out of shell history
maple auth login
echo "$MAPLE_TOKEN" | maple auth login --with-token

maple auth status

Show and validate the active login: API URL, user, workspace and where the credential is stored.

maple auth logout

Revoke the credential with the API and remove it locally. maple logout is the shorthand. A token supplied through MAPLE_API_TOKEN cannot be removed this way; unset the variable instead.

maple whoami

Show the resolved mode (local or remote) and the target it would talk to, plus any pinned default.

maple use <local|remote|auto>

Pin the default backend so commands stop auto-detecting, or auto to clear the pin.

Mode resolution, per command, in priority order:

  1. An explicit --local or --remote flag.
  2. The default pinned with maple use.
  3. Auto-detect: a stored credential implies remote; otherwise a quick GET /health probe of the local server implies local. If neither is available the CLI prints what to do next.

Server endpoints

maple start binds 127.0.0.1 by default. --host or MAPLE_LOCAL_BIND_HOST can select another address. Every route below is then reachable from the network.

MethodPathAuthPurpose
GET/healthNoneLiveness probe, returns OK. Used by mode auto-detect
POST/v1/tracesNoneOTLP traces ingest, responds { "accepted": <rowCount> }
POST/v1/logsNoneOTLP logs ingest
POST/v1/metricsNoneOTLP metrics ingest
POST/local/queryNoneRun SQL: { "sql": "..." } in, a bare JSON array of rows out
GETany other pathNoneThe bundled UI, with --offline only
OPTIONS*NoneCORS and private-network preflight, for the configured hosted UI origin only
POST/local/checkpoint/backupMaintenance tokenTake a checkpoint. maple checkpoint calls this
POST/local/retention/retireMaintenance tokenDelete one UTC day from the live tables. maple archive retire-live --apply calls this
GET/local/eventing/health, /projections, /consumers, /outboxMaintenance tokenRead local event projection and consumer state
POST/local/eventing/projections, /consumers, /consumers/disable, /consumers/accept-gap, /outbox/abandonMaintenance tokenAdminister local event projections and consumers
POST/local/eventing/claims, /local/eventing/acksEvent consumer tokenClaim and acknowledge local events

None means no credential is checked. On a non-loopback bind, anyone who can reach the port can read all local telemetry through /local/query and write to it through OTLP.

The maintenance token is sent in x-maple-maintenance-token and the event consumer token in x-maple-event-consumer-token. maple start creates them on first run as <data-dir>.maintenance-token and <data-dir>.event-consumer-token (mode 0600). Anyone who can read those files can call the token routes, including /local/retention/retire, which deletes data. The event routes are described in the local event consumers design doc.

OTLP bodies may be protobuf (the default) or JSON, optionally gzip-encoded. The /local/query handler owns the output format: it strips any trailing FORMAT <ident>, appends FORMAT JSONEachRow, and wraps the rows into a JSON array, so clients POST their compiled SQL verbatim.

Environment variables

Runtime (CLI and server):

VariableDefaultPurpose
MAPLE_LOCAL_BIND_HOST127.0.0.1Server bind host and the CLI’s default local target; wildcards map to loopback
MAPLE_LOCAL_ADVERTISE_HOSTthe bind hostHost printed for clients and used by the bundled UI
MAPLE_LOCAL_URLbind host + 4318Explicit base URL for CLI queries and mode detection
MAPLE_LOCAL_UI_URLhttps://local.maple.devThe hosted UI origin maple start links to and allows through CORS
MAPLE_LIBCHDB(auto)Explicit path to libchdb. Otherwise resolved beside the binary, then ~/.maple/bin/libchdb.{so,dylib}
MAPLE_API_URLhttps://api.maple.devRemote API base URL
MAPLE_API_TOKENRemote bearer token; overrides the stored credential
MAPLE_ORG_IDRemote organization override
MAPLE_DEBUG1 enables --debug
MAPLE_FORMATjsonjson or table, same as --format
MAPLE_NO_UPDATE_CHECKAny non-empty value disables the startup update check (the Homebrew wrapper sets it). The check runs at most once per 24 hours, only when stderr is a terminal

CLI telemetry. The CLI sends its own traces, logs and metrics (service maple-cli) to Maple by default. See What connects to the internet for what is recorded.

VariableDefaultPurpose
MAPLE_TELEMETRYonoff disables the CLI’s own telemetry entirely. Any other value leaves it on
MAPLE_INGEST_KEYa key built into the binaryIngest key used for the CLI’s own telemetry
MAPLE_ENDPOINThttps://ingest.maple.devWhere the CLI’s own telemetry is sent. Takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT, which is also read. If you export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318 for your app in the same shell, the CLI’s telemetry goes to your local server too
MAPLE_ENVIRONMENTci when CI is set, otherwise clideployment.environment reported on the CLI’s own telemetry

Install script (scripts/install.sh):

VariableDefaultPurpose
MAPLE_VERSIONlatestRelease tag to install
MAPLE_INSTALL_DIR~/.maple/binWhere the two-file bundle lands
MAPLE_BIN_DIR(auto)Where maple is symlinked onto PATH
MAPLE_SKIP_CHECKSUM01 skips SHA-256 verification (air-gapped mirrors only)

~/.maple/config.json stores apiUrl, orgId, defaultMode and, when the keychain is unavailable, the token. Environment variables take precedence over stored values.

Troubleshooting

libchdb not found. The binary loads libchdb from beside its own path, then falls back to ~/.maple/bin. Homebrew keeps maple and libchdb together; the install script keeps them in ~/.maple/bin. If you moved files by hand, keep libchdb.so or .dylib beside maple, or set MAPLE_LIBCHDB to its full path. Running from source has no sibling library, so set MAPLE_LIBCHDB or drop one into ~/.maple/bin.

Homebrew installed, but maple still runs the old binary. A script-installer symlink is earlier on PATH. Confirm with command -v maple, then remove the old symlink or run curl -fsSL https://maple.dev/cli/uninstall | sh before reinstalling with Homebrew.

maple is already running (PID …). Another server owns this data directory. Stop it with maple stop, or start a second instance on its own port and store: maple start --port 4400 --data-dir ~/.maple/data-2.

Incompatible store after an upgrade. A new binary that refuses an older store (the local store … is incompatible) needs the live data cleared: maple reset --yes, or maple start --reset in one step. Both keep checkpoints. If the release notes call for a migration instead, use maple schema.

Store was not cleanly closed. The default --on-dirty-store fail stops rather than guess. Restart with --on-dirty-store restore-checkpoint to roll back to the last good checkpoint, or wipe to discard live data. Neither touches checkpoints.

Browser asks to “access devices on your local network”, or CORS errors. The default dashboard at local.maple.dev is a public origin reaching your loopback server, which trips Chrome’s private network gate. Run maple start --offline to serve the dashboard same-origin. For a wildcard LAN bind, also set --advertise-host to the hostname the browser will use; other hosts and origins are rejected.

Authentication proxy blocks the bundled UI. The UI works behind TLS with browser-managed authentication such as a session cookie or HTTP auth. It does not inject a bearer token or copy an entry-page query parameter into its /local/query and OTLP requests.

No data appearing. Confirm the exporter points at the advertised host and port and the server is up (maple whoami, or curl <host>:4318/health). Widen the time range; the default is --since 6h. A successful ingest responds { "accepted": <n> }.

No Maple backend found. Neither backend could be resolved. Start local mode (maple start), sign in to a workspace (maple auth login), or force one with --local / --remote.