moda CLI. 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).
Setup and diagnostics
moda init
Interactive project setup: browser login, tenant selection, API key provisioning, agent-rules/skill install, prompt manifest creation with a best-effort first sync, and (by default) a server-side harness analysis. Non-interactive with--yes.
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
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
moda auth status
Reports session state without ever opening a browser. Exit code 0 = valid session, 4 = logged out.--online adds a 5-second API reachability probe.
Output
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.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-conversations
List conversations in one cluster node.Output (trimmed)
An unknown node ID returns
cluster: null with an empty list, not an error.
moda conversations
Search and filter conversations by summary text, cluster, user, environment, world state, and outcome.Output (trimmed)
moda search
Message-grain search across conversations: 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 conversation.Output (trimmed)
moda world-state
A conversation’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 conversation (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 conversation has no state; the CLI adds a not-found warning.
moda audit
Raw span read for a conversation or trace: hierarchy, orphans, duplicates. Useful for debugging ingestion. Alias:moda trace.
Output (trimmed)
moda step-scores
Graph-PRM step scores for one conversation: 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 conversation returns the empty shape (
segments: [], rollup: null) with a CLI warning — the API does not 404. Very large conversations 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 conversation’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 (conversation + 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 conversations, 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: conversations re-emit when they advance (
message_count changes — long-running, single-conversation-per-user tenants update in place); emotion detections emit once per detection_id.
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 conversation you are investigating.
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)
Prompt management
Code-first prompt workflow — see Prompt management for concepts and Workflow for the end-to-end guide. Runningmoda prompts with no subcommand is equivalent to moda prompts status.
moda prompts init
Creates.moda/prompts.yml if absent (never overwrites). The default manifest discovers prompts/**/*.prompt.{md,json,yaml,yml}.
Output
moda prompts status / moda prompts diff
Local-only comparison of discovered prompt files against.moda/prompts.lock.json. No network call. diff is an alias for status (it is not a textual diff). Per-prompt state is new, changed, unchanged, or deleted.
Output (trimmed)
moda prompts sync
Uploads all discovered prompts (unchanged ones are server-side no-ops — versions are content-addressed and immutable), moves each prompt’scurrent pointer to the synced version, and writes .moda/prompts.lock.json.
Output (trimmed)
moda prompts promote
Moves a release label (dev, staging, prod) to a specific version. Returns the updated prompt with all versions.
A
dev promotion moves the same pointer that every sync overwrites, so it is replaced by the next moda prompts sync. Use staging/prod for stable release labels.moda prompts ab
Judged A/B replay comparison between a baseline and a candidate prompt. Builds (or reuses) a replay set, runs both arms, and reports a verdict — the candidate wins only with strictly more passed cases. See Experiments.--no-wait returns immediately after enqueueing.
moda prompts propose
Generates a revised, unlabeled candidate version from a failed A/B run’s failure evidence.Skills
Moda can distill recurring agent behavior into skill files and sync them with your repo. Skill commands talk to the Ingestion API host (MODA_INGEST_URL) and the control plane using your API key.
moda skills gen
Kicks off tenant-wide skill generation and returns a run ID.Output
--source=all|sdk, --max-sessions=N, --start-at=ISO, --end-at=ISO, --wait.
moda skills status
Status, outcome, and recent events for a generation run (latest run when no ID is given). Exits 1 when the run failed.moda skills pull
Downloads tenant-generated skills into.claude/skills/**/SKILL.md (and .cursor/rules), tracked in .moda/skills.yml.
moda skills sync
Pushes local.claude/skills/**/SKILL.md files up to Moda. --dry-run shows what would be pushed.
moda skills proposals / moda skills proposal apply
moda skills proposals list [--status=ready_for_pr] lists skill improvement proposals with baseline/candidate pass rates. moda skills proposal apply <proposal-id> writes the proposed SKILL.md locally and acknowledges the proposal; it exits 1 if the local write succeeded but the acknowledgment failed (re-run to retry).
Harness
The harness commands produce and sync the cited map of your agent codebase. The supported path for analysis is the Moda GitHub App (see Harness); the CLI analyze path is experimental.moda harness analyze
Produces a cited harness report. Gated: without--experimental or MODA_HARNESS_ANALYZE_CLI=1 it prints a pointer to the GitHub App and exits 1.
Output (gated)
moda harness pull
Fetches a server-side analyze run (status while running, the report when done).--sync also syncs a passing report. --run-id targets a specific run; otherwise the run recorded in .moda/harness-remote-run.json is used.
moda harness validate-report / approve / sync
validate-report checks .moda/harness-report.json citations. approve --yes validates and writes a hash-bound approval file; sync --from-report uploads the approved report to Moda Cloud (it refuses unapproved reports) and writes .moda/sync-state.json. moda sync and moda sync harness are top-level aliases for harness sync; moda sync prompts aliases moda prompts sync.
moda harness scan / candidates / agents / explain
Local, no-LLM inspection commands:moda harness scan— discover local runtime agents and write.moda/harness.json(--jsonfor structured output).moda harness candidates— static candidate pre-pass with file:line citations (--out=PATH).moda harness agents— list detected runtime agents and families.moda harness explain [--agent=<id>]— explain the discovered harness graph.
moda harness delete
Permanently deletes a synced harness from Moda Cloud.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.
- Prompt management workflow — the full prompts loop these commands drive.
- Harness CI rescan — the generated rescan workflow in detail.