moda CLI workflows. Install and authentication are covered in the CLI overview; this page lists each command by area.
Conventions used below:
- Flags accept
--flag=valueor--flag value. Boolean flags are--flag. - Data commands call the Data API (
https://moda.dev/api/v1/data,x-api-keyauth) and require an API key (MODA_API_KEY, profile, or~/.moda/config.json). Numeric ranges are validated before the request is sent. - Example outputs are shown as
--jsonprints them (the raw payload, trimmed to representative fields). Piped and CI invocations get amoda.agent.v1envelope instead, with the same payload underdata— see Using the CLI from agents and CI. - Requests time out after 30 seconds per attempt and retry up to 3 times on 429/5xx and network errors (exceptions:
askuses a 250-second timeout and retries at most once, on network errors only;feedbacknever retries;fixmutations never retry). - A trace is one full agent run, identified by its
conversation_id(the trace ID). Data API paths and JSON fields keep theconversation/conversation_idnames for backwards compatibility, and the legacy command and flag names noted below remain as aliases.
Setup and diagnostics
moda init
Interactive project setup with browser login, tenant selection, API key provisioning, and coding-agent integration. Use--yes for non-interactive setup.
moda provision
Headless API key provisioning for CI and agents. Prints exactly one JSON credentials document to stdout; exits 4 without a stored session and 5 when a multi-tenant account omits--tenant-id. Flags: --tenant-id, --label (default: hostname), --save, --profile. Full behavior and output are documented in the CLI overview.
moda status
Concise local setup state (config, credentials, synced artifacts).moda doctor
Diagnoses local setup and data flow: config, auth, prompt manifest, harness artifacts, and (unless--offline) an online connectivity check. Flags: --json, --offline, --online.
moda manifest
Machine-readable description of the CLI protocol: commands, global flags, env vars, exit codes, and stream events.moda --json-schemas prints the JSON Schemas for the agent output contract.
Output (trimmed)
moda profiles / moda config
moda profiles list|use <name>|create <name>|doctor [name] manage local profiles (prod, staging, local by default). moda config show [--profile=NAME] prints the resolved configuration.
moda keys
moda keys list and moda keys create --name=<label> manage local key descriptors (metadata about which key belongs to which profile). moda keys rotate and moda keys revoke are not supported yet and exit with an error; revoke keys in the dashboard at Settings → Ingestion keys.
Sessions
The CLI has two independent credentials, and theauth commands report both:
An API key on its own is enough for all data commands. You only need a browser session to mint new keys or run the onboarding wizard.
moda auth login
Opens the browser PKCE login flow and stores a 30-day sliding CLI session.--screen=signup opens the signup screen instead.
Output
--api-key authenticates with an API key and never opens a browser. The key is validated against the Data API before anything is written, then saved to ~/.moda/config.json.
Three ways to supply it, safest first:
Output
--non-interactive takes the same path but additionally guarantees no browser opens even when no key is found — it exits with the commands that would mint one.
If MODA_API_KEY holds a different key than the one being saved, the environment still wins for every later command. Login reports this rather than a clean success: it warns on stderr, sets "shadowed_by_env": true and "effective_credential": "env", and exits 3 (degraded). Unset MODA_API_KEY to use the saved credential.
moda auth status
Reports the state of both credentials without ever opening a browser. Exit code 0 = at least one usable credential, 4 = neither.--online adds a 5-second API reachability probe of the browser session.
Output
loggedIn covers the browser session only; authenticated is true when either credential is usable, and the exit code follows authenticated. apiKeyCredential.source is env, profile, or config — env tells you a MODA_API_KEY is shadowing anything stored on disk. The raw key is never emitted.
Without --online this command does no network I/O, so authenticated reflects that a credential is present, not that it still works, and apiKeyCredential.verified is null (not checked). With --online the API key is probed too: a key the API rejects gets verified: false, stops counting toward authenticated, and exits 4. A key that cannot be reached stays verified: false but still counts, so a network blip never declares a good credential dead. Use moda auth whoami to verify a key on demand.
moda auth token
Prints the bare session token plus a newline to stdout in every output mode (built for$(moda auth token) composition). Exits 4 when logged out; with --json it prints {"error":"not_authenticated"} instead of prose.
moda auth whoami
Shows the authenticated user, session expiry, and available tenants.Output
verified: true means the API accepted the key just now. If the API is unreachable the command exits 3 (degraded) with verified: false rather than claiming an identity it could not confirm. A rejected key is an error, not a logged-out state.
moda auth logout
Revokes the session server-side (best effort) and clears local credentials — including the stored API key. IfMODA_API_KEY is set in the environment it still takes precedence afterwards; unset it to fully sign out.
Output
Production data
moda overview
Health briefing built from production data: data-flow status, local sync state (harness, prompts, skills), and the top finding. On a TTY it renders prose;--raw returns the raw Data API /overview payload instead.
Output (trimmed)
moda clusters
Browse the use-case cluster hierarchy from the latest completed cluster run.Output (trimmed)
Instead of walking the hierarchy, find a cluster by meaning with
--search, or resolve a node deep link deterministically with --node-id:
Output (trimmed)
moda cluster-traces
List traces in one cluster node. Legacy alias:moda cluster-conversations.
Output (trimmed)
An unknown node ID returns
cluster: null with an empty list, not an error.
moda traces
Search and filter traces by summary text, cluster, user, environment, world state, and outcome. Legacy alias:moda conversations.
Output (trimmed)
moda search
Message-grain search across traces: keyword, semantic, or hybrid.Output
search_mode in the response is the mode that actually ran: semantic and hybrid degrade to keyword when embeddings are unavailable (degrade_reason: "semantic_unavailable", retry may fix) or no hit clears the relevance floor ("below_relevance_floor", retry will not fix). Scores are not comparable across modes. Each result carries conversation_id + message_index — feed them to moda context.
moda context
Windowed context around one message in a trace.Output (trimmed)
moda world-state
A trace’s world state: durable user profile, per-segment slots, open threads, and the event stream.Output (trimmed)
Point-in-time snapshot — the folded slot state at an exact
(msg_index, block_index) tick: what the agent believed at that turn.
Output (trimmed)
msgIndex/blockIndex in the response are the tick of the last applied state change at or before the requested tick. An unknown trace (or no state at that tick) returns found: false with empty slots and the CLI adds a not-found warning.
Replay — state evolution over time, frame by frame or as raw fold inputs.
--message-count frames (msgIndex, slots, openThreads, hasSnapshot), carrying state forward between frames; --message-count is required in frames mode — the API returns no frames without it, so the CLI rejects the invocation up front. fold-inputs mode returns the raw keyframes and events (snake_case fields, no count needed). hasData: false means the trace has no state; the CLI adds a not-found warning.
moda audit
Raw OpenTelemetry span read for one trace, looked up by its trace ID (conversation_id) or by an OTLP trace_id: hierarchy, orphans, duplicates. Useful for debugging ingestion. Alias: moda trace.
Output (trimmed)
moda step-scores
Graph-PRM step scores for one trace: per-segment progress curves, the first bad step, and the blended rollup. This is the reward evidence thatmoda problems and moda ask cite.
Output (trimmed)
An unknown or not-yet-scored trace returns the empty shape (
segments: [], rollup: null) with a CLI warning — the API does not 404. Very large traces can exceed the output budget; the payload is then replaced with a truncation stub (truncated, original_bytes).
moda frustrations
User frustration detections with evidence quotes. The CLI adds ananchor block per row (derived from key_turns/user_quotes) so agents can jump straight to moda context.
Frustration is the legacy single-family view. The current multi-family emotion model — frustration, sadness, confusion, anxiety, trust, positive — is served by moda emotions, which analyzes a much larger sample. Prefer emotions for new work.
Output (trimmed)
moda emotions
Multi-family emotion detections:frustration, sadness, confusion, anxiety, trust, and positive. The summary always covers all families; --family filters the paginated detections list only.
Output (trimmed)
moda hallucinations
Grounding detections: assistant claims that contradict or are verified against the trace’s world state, with the rule that fired and the offending substring.Output (trimmed)
The detections list contains only contradicted and verified rows; plain ungrounded rows appear in the summary counts but are not listed.
pagination here has no has_more field — compute offset + limit < total client-side.
moda tool-failures
Per-tool failure overview for the window.Output (trimmed)
moda tool-failure-detail
Failure subtypes and concrete examples for one tool. Each example carries a CLI-addedanchor (trace ID + message index).
Output (trimmed)
moda problems
The ranked cross-signal problem list (what to fix first). The CLI appendsdashboard_url for the corresponding dashboard page.
Output (trimmed)
moda problem
Open one Problem: the full dossier, or a paged sub-resource view. The dossier includes the rubric, rank trend, sub-problems, verification results, evidence, affected traces, investigation reports, confidence, hierarchy, and representative stories.Output (dossier, trimmed)
At most one view flag per invocation. The dossier endpoint never returns 404 — an unknown or retired ID comes back
found: false and the CLI adds a not-found warning. Sub-resource views require a canonical UUID (the CLI rejects other ids before the network). Cursors are not portable across different --family/--door filters.
moda problem-feedback
Close the loop on a Problem from the terminal: mark it fixed, dismiss it, rename it, or flag a bad attribution. Writes to the same reconcile queue as the dashboard.Output
The write is idempotent while the previous identical submission is still pending (
duplicate: true, no new row). The CLI enforces the conditional requirements locally, so a bad invocation fails before the network.
moda feedback
Flag wrong or missing data (or CLI quirks) to the Moda team. The note is required; IDs attach context.Output
moda tail
Live-tail production activity: poll the Data API and emit one JSON line per newly seen item (NDJSON on stdout in every output mode — a tail is a stream, so the single-envelope agent contract does not apply).Ctrl-C stops it.
Output (one line per item)
Dedupe is in-memory per process: traces re-emit when they advance (
message_count changes — long-running, single-trace-per-user tenants update in place); emotion detections emit once per detection_id. Trace records keep "type":"conversation" on the wire.
Emotions coverage. The emotions endpoint is ranked by score with no time ordering or cursor, so a tail cannot ask for “detections since X” — by default it follows the highest-scoring detections and emits a tail_coverage record per poll stating exactly what it scanned (scanned, total, coverage_pct, complete). On high-volume tenants the default poll covers a fraction of the day; use --full-scan when completeness matters more than request count. --max-events bounds every record on stdout, metadata included. When it is set, one slot is reserved for the coverage record so a capped tail still reports what it saw; at --max-events=1 the data row keeps the slot and the coverage record is written to stderr instead, where it cannot affect a consumer’s record count.
Production intelligence
moda investigate
Aggregates overview, tool failures, and frustrations into ranked findings with evidence references and next commands.--tool=NAME scopes to one tool; --conversation=ID records the trace you are investigating (by trace ID).
Output (trimmed)
moda failures
Same investigation, restricted to failure findings (frustration findings excluded). Flags:--days-back, --tool.
moda ask
Ask Moda a production question in natural language. On a TTY the answer streams live; add--no-stream for a buffered request. The cloud request times out after MODA_ASK_TIMEOUT_MS (default 250 s); if Moda Cloud is unavailable the CLI synthesizes an answer from local Data API evidence and exits 3 with source: "local_fallback" and degraded: true.
Output (trimmed)
Agent-native commands
moda agent context, moda agent investigate, moda agent next-action, and moda agent evidence <ref> emit local Moda context, readiness diagnostics, prioritized next commands, and expanded evidence for coding agents. They default to agent JSON output in every environment. See Using the CLI from agents and CI.
Next steps
- Using the CLI from agents and CI — envelope schema, exit-code recipes, CI examples.
- Data API overview — the same data over HTTP.