Skip to main content
This page covers the day-to-day prompt management loop: create the manifest, write prompt files, check local state, sync versions, and promote release labels. All commands come from the moda CLI.

Prerequisites

  • @moda-ai/cli installed: npm install -g @moda-ai/cli (Node.js >= 18).
  • An API key for sync and promote: set MODA_API_KEY, or run moda init once to provision and store one. init, status, diff, and migrate work offline.
  • If you already have a key and no browser (CI, a coding agent), moda auth login --api-key validates and stores it non-interactively; moda auth whoami confirms it worked.
1

Create the manifest

Run this from your project root: the manifest path is resolved against the current working directory. The command reports the absolute manifestPath it wrote (and lists it under artifacts in agent mode), so you can verify the result without guessing where it landed.This writes .moda/prompts.yml if it does not exist (it never overwrites an existing manifest):
.moda/prompts.yml
A version 2 manifest has two fields:
  • prompt_paths: fast-glob patterns, matched exactly and relative to the repository root. A pattern without glob characters is an exact file path, and the file must exist. Prefix a pattern with ! to exclude matches. node_modules, .git, dist, build, .env*, *.pem, and *.key are never matched, and symlinks are rejected.
  • sources: prompts that live in code or config, mapped in place. See Map prompts defined in code. moda prompts sync adds the mappings its discovery verifies, and you can also write them by hand.
Manifests written by older CLIs say version: 1. They keep working, but those CLIs discovered prompts by .prompt.* suffix anywhere in the repository, while patterns are now exact globs. If prompt files outside prompts/ stopped syncing, see Migrate a version 1 manifest.
Although the default manifest lists .prompt.yaml and .prompt.yml patterns, the CLI parses those files with the same frontmatter parser as .prompt.md. Write prompts as .prompt.md or .prompt.json.
2

Write prompt files

Markdown format — optional frontmatter, then the prompt content as the body:
prompts/support/triage.prompt.md
Recognized frontmatter keys:Frontmatter is parsed line by line as flat key: value pairs — nested YAML structures and lists are not supported, and .prompt.md files cannot declare variables. Use .prompt.json for structured prompts.JSON format — supports the full schema, including messages, variables, and tool references:
prompts/support/answer.prompt.json
Supported JSON fields: key, name, description, category, content (defaults to the pretty-printed messages array when omitted), messages, systemPrompt, variables, variablesSchema, modelConfig, toolRefs, responseSchema. variables and variablesSchema are stored as declared metadata with each version; the CLI and registry do not render or substitute variables.Key derivation. When no explicit key is set, the key comes from the file path: strip a leading prompts/, strip the .prompt.<ext> extension, and replace slashes with dots. prompts/support/triage.prompt.md becomes support.triage.
3

Check local state

status is local-only — no network call. It compares discovered files against .moda/prompts.lock.json:
Per-prompt state is one of new (not in the lockfile), unchanged (hash matches), changed (hash differs), or deleted (in the lockfile but no longer on disk).status also checks the manifest itself:
  • zeroMatchPatterns lists prompt_paths patterns that match no file. A manifest whose patterns all match nothing, and that has no sources:, syncs nothing without reporting an error.
  • legacyOnlyFiles lists .prompt.* files that older CLIs discovered but the current patterns miss. When it is non-empty, status warns and points at moda prompts migrate.
moda doctor runs the same check as prompts_discovered.moda prompts diff runs the same comparison but lists only prompts that are new, changed, or deleted. It compares hashes; it is not a textual diff of prompt content.
4

Sync versions

Sync first scans for source definitions, then uses an installed coding-agent CLI (Claude Code, Codex, or Cursor) to follow unresolved relationships. New code mappings receive a separate semantic review, with deterministic checks of the selected source and cited SDK binding. Uncertain candidates stay in discovery.pending and are not uploaded. Existing configured mappings remain authoritative; no application modules are imported to extract prompt text.
The default auto analyst uses an installed, authenticated CLI. Assistance uses that CLI’s account and has no fixed wall-clock timeout; cancel the command to stop it. If assistance is unavailable, configured sources and dedicated prompt files still sync, while uncertain candidates remain pending. --assist=none also disables assistance. Agent-generated prompt text is never uploaded.Successful sync saves new accepted source mappings in .moda/prompts.yml. Runtime-composed prompts remain typed builder definitions with dependency fingerprints and partial coverage, not rendered runtime text. Finding one fragment does not mean every prompt in the repository has been found.Sync uploads all eligible prompts, not only changed ones. Because versions are content-addressed, unchanged prompts resolve to their existing version IDs and create nothing new. On success the CLI writes .moda/prompts.lock.json:
.moda/prompts.lock.json
The lockfile holds the IDs you need for runtime attribution and for promote. It is rewritten wholesale on each sync; commit it alongside your prompt files.Every sync also moves the dev label to the just-synced version of each prompt, so every synced prompt carries dev: moda prompts list --label=dev lists them all, and --label=unlabeled matches none. In API responses the label pointers are devVersion (the same value as currentVersion), stagingVersion, and prodVersion, and each version’s labels lists every label pointing at it. A version’s releaseLabel holds at most one stored label, so read labels for the full set.Options:
  • --dry-run — the server computes and returns the IDs without writing anything; the lockfile is not updated.
  • --from-harness[=<report>] — first register the prompt mappings from a harness report (default .moda/harness-report.json). Reports from older CLIs are normalized, and prompts without a promptSource are mapped from their sourcePath when that is unambiguous. Prompts that still do not resolve against current source are listed in harnessImport.skipped with a reason. The command fails only when none resolve; regenerate the report with moda harness analyze --experimental --concern=prompts.
  • --watch — re-check local files on an interval and re-sync when hashes change. --interval=<ms> sets the poll interval (default 2500, minimum 1000).
moda sync prompts is an alias for moda prompts sync.
5

Promote a release label

--label accepts dev, staging, or prod; --version (alias --version-id) takes the version ID from the lockfile or from moda prompts status. The label moves atomically from whichever version held it to the target version.Promote to staging before prod if you validate releases in a pre-production environment. You can also promote from the dashboard: each version on the prompt’s Versions tab has staging and prod promote buttons.
A --label=dev promotion is overwritten by the next moda prompts sync, because sync always moves dev to the version it just uploaded.

Verify in the dashboard

After the first sync, open Dashboard → Prompts. You should see each discovered prompt with one version, the dev label on that version, and the source path and commit you synced from. After a promote, the label badge moves to the target version on the prompt’s Versions tab.

Optional: sync automatically from CI

Add this GitHub Actions workflow to run moda prompts sync (and moda skills sync) on every push to main — and only main, so unmerged versions are never published. It needs two repository secrets: MODA_API_KEY and MODA_TENANT_ID.
.github/workflows/moda-autosync.yml
Replace <version> with an exact @moda-ai/cli release — the pin makes CLI upgrades explicit, reviewable diffs.

Map prompts defined in code

A prompt that lives in application code or config does not need its own file. Map it under sources: with a stable key, the file, and a selector:
.moda/prompts.yml
Python selectors need python3. Modules are parsed, never imported. When a file is matched by both a glob and a sources: entry, the sources: entry owns it. Builders and templates are not plain prompt text: run the application’s builder and attribute the resulting model call to its registry version.

Migrate a version 1 manifest

The default manifest has not changed, but discovery has. The first CLIs matched any file ending in .prompt.md or .prompt.json anywhere in the repository. Patterns are now exact globs from the repository root, so with the default prompts/** patterns, files such as src/agents/support.prompt.md silently stopped syncing. moda prompts status reports them as legacyOnlyFiles.
migrate rewrites .moda/prompts.yml to version 2:
  • Every existing pattern and sources: entry is kept, and comments are preserved.
  • Each legacy-only file is added to prompt_paths as an explicit path. Its path-derived key, lockfile entry, and version history stay the same.
  • A sources: list is added if missing. --discover scans for code-defined prompts without agent calls. A code mapping needs independent verification before it is registered, so the scan adds only mappings that need none. It lists the other candidates under pendingSources. To map them, run moda harness analyze --experimental --concern=prompts with an installed analyst, then moda prompts sync --from-harness, or add them under sources: yourself.
The write is atomic. Running migrate on a version 2 manifest with nothing to add changes nothing. Patterns that still match nothing are kept and reported so you can fix or remove them.

How the content hash is computed

The lockfile contentHash decides whether a prompt is changed and which registry version it maps to. To check a lockfile from your own tooling, use the published helper instead of reimplementing it:
PROMPT_HASH_VERSION is 1. The algorithm is:
stableJson is JSON.stringify after sorting every object’s keys, recursively, with String.prototype.localeCompare. Arrays keep their order. For sources: entries, sourceDefinition holds the mapping (kind, source) and the extracted sourceHash. Builders and templates also include dependencies, coverage, and unresolved, so editing a dependency or moving a selector mints a new version even when the text is identical. name, description, category, and sourcePath are not hashed. For sources: entries the registry recomputes the hash and rejects a mismatch.

Deleting a prompt

Delete the file from your repo. moda prompts status reports it as deleted, and the next sync drops it from the lockfile. The prompt and its versions remain in the registry — there is no delete or archive API — but they stop receiving new versions.

Troubleshooting

Next steps