/mm-publish

The /mm-publish skill drives the full creator publish flow inside your AI agent. You only confirm decisions — the agent runs every CLI command. The user creates the draft on the web first; the skill resumes from a pack-id and handles auth, signing, source discovery, pack assembly, and publish.

This page mirrors the canonical packages/cli/skills/mm-publish/SKILL.md file shipped in the memorymarket npm package. The SKILL.md is what your agent actually reads at invocation time — if this page drifts from it, the SKILL.md wins.

Usage

$ /mm-publish --pack-id <uuid> [--sources path1,path2,...] [--out output-dir]

Arguments

FlagRequiredPurpose
--pack-idyesExisting draft pack-id (UUID) from https://memorymarket.co/sell/<id>. If absent, the skill stops and asks you to create the draft on the web first.
--sourcesnoComma-separated source paths to package. If omitted, the skill auto-scans common memory locations and asks you to confirm.
--outnoOutput directory for the assembled pack. Defaults to ./.memorymarket-drafts/<slug>/; the skill confirms before writing.

Phase 1 — Auth gate

Before doing anything else, the agent confirms you are signed in and have a registered signing key.

  1. Run mm whoami. If output is “Not authenticated” or the command exits non-zero, the agent runs mm login, which opens a browser window for OAuth. Wait for the CLI to print “Logged in as @<username>”.
  2. Probe for ~/.memorymarket/keys/signing.pub. If absent, run mm keygen (writes a fresh Ed25519 keypair to ~/.memorymarket/keys/).
  3. Run mm register-key to upload the public key to the server. Key already registered is fine — proceed.

If any of these steps error (network, rate-limit, refused), the skill stops and surfaces the error to you. It does not proceed to Phase 2.

Phase 2 — Memory source discovery

Your memory layout is unknown. The agent scans, proposes a list, and asks for confirmation.

Auto-scan locations from CWD and home, in order:

SourceReason
./CLAUDE.md, ./AGENTS.md, ./.cursorrules, ./.windsurfrulesProject-scope agent rules
./.claude/**/*.mdProject-scope Claude Code memory
./.cursor/rules/*.md, ./.cursor/rules/*.mdcProject-scope Cursor rules
~/.claude/CLAUDE.md, ~/.claude/skills/**/SKILL.mdUser-scope Claude memory + skills
~/.codex/AGENTS.mdCodex memory
./knowledge-base/**/*.mdKarpathy-style wiki, if present
./*.md (root only)Any project-root markdown that smells like memory: philosophy.md, principles.md, voice.md, playbook.md, runbook.md, style-guide.md, system-prompt.md

The agent prints a numbered table (index, path, line count, one-line shape guess), then asks: “Which of these should I include? Reply with numbers (e.g. 1,3,5-8), all, or paste your own paths.”

Banned: the skill never invents memory content. Every line in the resulting pack traces back to a file you confirmed.

Phase 3 — Pack assembly

The agent does the extraction in-context — there is no mm pack or amp packCLI. The full AMP extraction pipeline runs inline as Phase 3 sub-phases (3a shape detection → 3b unit extraction → 3c primitive classification + capability routing → 3d draft pack assembly → 3e validation → 3f confirm + sign). Output: a directory containing manifest.json, agents.md, and memory/<capability>.md files. There is no separate skill for the extraction step.

  1. Asks where to write the assembled pack. Default suggestion: ./.memorymarket-drafts/<slug>/. Confirms the directory does not already contain a manifest.json (asks before overwriting).
  2. Runs the AMP extraction pipeline (in-agent, not a CLI call) against the confirmed sources. Produces a manifest.json on the AMP v0.4 schema (primitive_format: "inline-tag-v0.4"), agents.md routing index, and one memory/<capability>.md per detected capability. The manifest the skill writes follows this exact shape — every field below is required by mm publish validation:
    manifest.json
    {
    "name": "[pack-slug]",
    "title": "[Pack Title]",
    "version": { "number": 1 },
    "layout": "semantic-cluster",
    "primitive_format": "inline-tag-v0.4",
    "agents_file": "agents.md",
    "agents": ["claude-code"],
    "capability_files": ["operating-principles.md", "copy-voice.md"],
    "signed": false,
    "signature": ""
    }
    signed and signature start empty; mm sign writes them in-place during Phase 3f.
  3. Shows you the resulting file tree (paths + line counts). Asks for confirmation.
  4. Signs the pack: mm sign <pack-dir>. Then runs mm verify <pack-dir> to confirm the signature is valid. mm verify is a signature check (it expects a signed pack); pre-sign structural validation happens implicitly during assembly.

Phase 4 — Draft binding

Every published pack needs a server-side draft row, and the web is the only place that creates drafts. The skill never creates a draft.

  1. If --pack-id <uuid> was passed: validate it is a valid UUID (8-4-4-4-12 hex shape). On valid input, confirm to you — “Publishing into draft <uuid>.” — and proceed to Phase 5.
  2. If --pack-id was NOT passed: stop and redirect. Print this exact message:
I can't create the draft for you — that has to happen on the web
so your account, Stripe Connect status, and marketing metadata stay in sync.
Open https://memorymarket.co/sell/new, click + New pack,
then copy the pack-id from the URL bar (/sell/<this-uuid-here>).
Paste it back here and I'll continue.

Wait for you to paste a UUID. Validate the shape. On valid input, continue to Phase 5. On invalid input, ask again — never retry silently.

Never run mm create. Never call POST /api/packs/create. Drafts are created on the web only.

Phase 5 — Publish

  1. From the pack directory, run mm publish --pack-id <uuid>.
  2. The CLI signs the pack with your local key, uploads files, and flips the row to published.
  3. On success, the skill prints the live URL https://memorymarket.co/pack/<slug> and the marketing reminder:
Pack is live. Edit title, description, tags, cover, supported agents,
or price anytime at https://memorymarket.co/sell/<uuid>
(step 2 — Marketing). Slug is the only locked field.

Error handling

  • MANIFEST_NOT_FOUND / FILE_NOT_FOUND — wrong directory; the skill asks you to cd into the assembled pack dir and retries.
  • NO_SIGNING_KEY — re-runs Phase 1 step 2 (key registration). Never loops silently — it tells you what happened.
  • INVALID_SIGNATURE / PACK_VALIDATION_FAILED— surfaces the API's error details verbatim and asks how to proceed.

Banned behaviors

  • Never run mm create. Drafts are created on the web only. If --pack-id is missing, redirect — never silently create a draft.
  • Never run mm publish before you have confirmed the assembled pack files in Phase 3.
  • Never skip the auth gate in Phase 1, even if you “look logged in.”
  • Never invent memory content, capability files, or manifest fields not derived from confirmed source paths.
  • Never paste long shell pipelines. The skill runs one CLI subcommand at a time so you can see and trust each step.
  • Never skip the price-confirm phase — the skill must ask you for a price before invoking mm publish.
  • Never skip the post-publish edit reminder — tell the creator where they can change marketing copy and price.

Out of scope

  • Setting screenshots or post-publish marketing copy edits. Those happen at https://memorymarket.co/sell/<uuid>(Marketing step). Price IS in scope here — it's set via --price when you run mm publish.
  • Stripe Connect onboarding for paid packs. The web UI handles that.
  • Editing or refactoring source memory files. Sources are read-only inputs.

Related