# Spec-Discovery Brief — m2-market (M2 Marketplace) ## Mission Produce implementation-ready SPECs for the M2 Marketplace: operators package repeatable outcomes as installable **Solutions**, sell them for **M2 credits**; a **Solution Scout** proposes packages in-session at the moment of need; Hermes composes build-vs-install proposals. "The unit is not software. The unit is completed work." READ FIRST (in order): 1. /home/m2/m2-market/CONCEPT.md — the unified concept v0.2 (your requirements source) 2. /home/m2/m2-market/context/SYSTEM-MAP.md — verified map of m2-gpt, agent.memory.system, m2o 3. /home/m2/m2o/.planning/federated-learning/PLAN.md — the fedlearn MVP rails you build upon ## Locked decisions (operator-accepted; do NOT relitigate — design WITH them) 1. **Ledger:** standalone `m2-ledger` service, BUT architected to evolve into a crypto-capable ledger managed under extended **m2-gpt billing** (tenant keys/metering federate; design the migration path now, ship internal credits first). 2. **Pricing v1:** fixed price per install AND job-based pricing where applicable — sometimes another m2o operator takes a JOB to deliver a solution (service-style engagement settling through the same ledger). 3. **Storefront:** MVP = **cargstore Electron revival** (github.com/machine-machine/cargstore) that connects to Coolify and other parts using credentials from **m2-gpt** (gateway-issued identity/keys). Web variant later from cargstore's web/ seed. 4. **Scout:** EXPLORE the solution space — standalone supervised watcher vs Hermes plugin vs herdr plugin. Compare honestly, recommend one, spec it. 5. **Seed Solutions:** mm-pdf (branded PDF generator), agent-scaffold (workspace generator), competitor-scan (research report). 6. **Economy defaults:** platform cut 10%, starter grant 100 credits. ## Hard constraints (inherited — every spec must respect) - Tenant isolation: client data (sdjs=GST, nasr, parlobyg, peter) never crosses into shared catalog; commercialization of tenant-derived work is owner-initiated + doubly-scrubbed. - No secrets in repos/images; keys injected at runtime (M2_GPT_API_KEY pattern). - Mixed fleet images: runtime-sync (fedlearn m2-core-sync) is the universal install path. - Host fragility: canary-first, idempotent, reversible; new services deploy as Coolify apps on the `coolify` network. Local registry route is broken (302) — no registry push/pull. - Harness-agnostic where cheap: Hermes is primary, openclaw stays supported; anything speaking OpenAI-wire through m2-gpt should work. - Forgejo (git.machinemachine.ai, org m2) = system of record; memory-api = semantic index. ## Your output — a SPEC, not a plan Write to /tmp/mktspec/specs/.md. Structure: 1. **Scope & non-goals** (MVP vs later) 2. **User stories + acceptance criteria** (Given/When/Then where useful) 3. **Interfaces & data contracts** — concrete: schemas (JSON), API endpoints (method+path+ payload), CLI verbs, file paths, DB tables, events. This is the heart. 4. **Integration contract** with the other subsystems (name exact touchpoints) 5. **Options compared** where your lane has a genuine fork; recommend one 6. **Risks/edge cases** (tenant, secrets, fragility, abuse) 7. **[NEEDS CLARIFICATION]** markers for anything genuinely undecidable (max 3) Inspect the LIVE system (docker, curl, repos in /home/m2/) — ground every contract in reality. Read-only on all existing repos; your ONLY write is your spec file. Last terminal line: SPEC_DONE_