m2-market/specs/001-market-first-wedge/contracts/catalog-index.md
m2 (AI Agent) 8757c6b620 factory-loop(plan): 001-market-first-wedge — plan, research, data model, 5 contracts, quickstart
Rail-independence is the plan's spine: fedlearn rails verified NOT landed
(no m2/m2-core, no capture/curator CLIs), so the wedge builds against frozen
interfaces — m2/market-registry as registry of record, ApplyAdapter seam with
local adapter now / m2core-sync stub, schemas frozen here with a fedlearn
coordination note. Constitution check passed (1 justified deviation).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 02:15:24 +02:00

1.7 KiB

Contract: market:catalog partition (memory-api) (v1)

The semantic index over published listings. Derived data only — rebuildable from m2/market-registry at any time.

Partition

  • Namespace: market:catalog (memory-api partition, same mechanism as fedlearn:core-index design).
  • Document = one published listing: embedded text = name + summary + keywords + intent + evidence_summary (BGE-M3 hybrid dense+sparse); payload = full listing.json + tenant_visibility.
  • Endpoint: the stack behind memory.machinemachine.ai (split-brain caveat: research.md R4 — pinned until fedlearn T13 resolves; recovery = reindex).

Writers

ONLY m2-market-indexer:

  • watch — on registry merge (webhook or poll ≤5 min), upsert changed listings, remove delisted.
  • reindex — drop partition, rebuild from registry main (constitution II gate; must complete < 5 min at wedge scale).

Readers

  • CLI m2-market search → memory-api semantic query, server-side filter tenant_visibility ⊇ {caller tenant | "*"} (FR-007; Scout edge case "impossible by construction").
  • M2 Store front page/search → same query path (via CLI or direct HTTP with desktop creds).
  • Scout matcher → same query path, additionally thresholded by confidence.

Query contract (via memory-api HTTP)

Request: {query_text, partition: "market:catalog", tenant, limit} → Response items: {listing_id, score, listing: <payload>} ordered by hybrid score.

Telemetry write-back (FR-012, FR-014)

Install + proposal events land as memory records in market:evidence partition keyed by listing_id; a periodic indexer pass folds counts into stats in the registry (PR-less stats commit or scheduled batch PR — implementation's choice, registry remains truth).