Skip to content

Add m011 Marketplace Curation & Quality Signals mechanism spec#22

Open
CShear wants to merge 2 commits intoregen-network:mainfrom
CShear:feat/m011-marketplace-curation
Open

Add m011 Marketplace Curation & Quality Signals mechanism spec#22
CShear wants to merge 2 commits intoregen-network:mainfrom
CShear:feat/m011-marketplace-curation

Conversation

@CShear
Copy link
Contributor

@CShear CShear commented Feb 18, 2026

Summary

  • Adds full mechanism spec for m011 (Marketplace Curation & Quality Signals) following the established m010 pattern
  • Includes SPEC.md (13 sections), JSON schemas (quality score, collection lifecycle, KPI), reference implementation with deterministic self-test, replay datasets with challenge scenarios
  • 7-factor quality scoring for credit batches: project reputation (0.25), class reputation (0.20), vintage freshness (0.15), verification recency (0.15), seller reputation (0.10), price fairness (0.10), additionality confidence (0.05)
  • Covers curator bonding, curated collections, collection challenge mechanism (CURATOR_WINS/CHALLENGER_WINS), featured batch criteria, and 5 standard credit types
  • Helper functions for vintage freshness decay, verification recency decay, and price fairness calculation
  • Updates MECHANISM_CONSUMERS.md with m011 consumer mappings

Test plan

  • node mechanisms/m011-marketplace-curation/reference-impl/m011_score.js — self-test PASS (5 test vectors)
  • npm run verify — PASS
  • npm run check:index — mechanism index up to date
  • m010 regression — self-test still passes
  • Review SPEC.md sections for accuracy against phase-2/2.1 and phase-3/3.1 source material
  • Validate JSON schema coverage against SPEC.md state machine

🤖 Generated with Claude Code

Adds full mechanism spec for m011 following the m010 pattern:
- SPEC.md with 13 sections covering curated collections, curator bonding,
  challenge mechanism, and 7-factor quality scoring for credit batches
- JSON schemas for quality score, collection lifecycle, and KPI metrics
- Reference implementation (m011_score.js, m011_kpi.js) with deterministic
  self-test and helper functions for vintage freshness, verification recency,
  and price fairness calculations
- Test vectors and replay dataset fixtures including collection challenge scenarios
- 7-factor scoring: project reputation (0.25), class reputation (0.20),
  vintage freshness (0.15), verification recency (0.15), seller reputation (0.10),
  price fairness (0.10), additionality confidence (0.05)
- Updates MECHANISM_CONSUMERS.md with m011 consumer mappings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CShear, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the foundational specification and initial implementation for the m011 Marketplace Curation & Quality Signals mechanism. It aims to enhance the credit marketplace by introducing robust quality differentiation, enabling buyers to identify high-integrity credits and incentivizing curators through economic mechanisms. The changes lay out a detailed framework for credit batch quality assessment, curated collection management, and a challenge system, supported by reference code and data for consistent evaluation.

Highlights

  • New Mechanism Specification (m011): Introduced the full specification for m011, focusing on Marketplace Curation & Quality Signals, providing a detailed framework for enhancing credit marketplace quality.
  • 7-Factor Quality Scoring: Implemented a comprehensive 7-factor weighted quality scoring mechanism for credit batches, considering project/class/seller reputation, vintage freshness, verification recency, price fairness, and additionality confidence.
  • Curated Collections & Challenge Mechanism: Defined the lifecycle and challenge mechanisms for curated collections, including token flows, governance parameters, and states like PROPOSED, ACTIVE, UNDER_REVIEW, SUSPENDED, and CLOSED.
  • Comprehensive Schemas and Reference Implementation: Provided extensive JSON schemas for quality scores, collection lifecycle, and Key Performance Indicator (KPI) metrics, alongside a JavaScript reference implementation for scoring and KPI computation, complete with deterministic replay datasets and self-tests.
  • Documentation Integration: Updated existing documentation to seamlessly integrate the new m011 mechanism into the overall mechanism index and consumer mapping.
Changelog
  • README.md
    • Added a new entry for "m011 — Marketplace Curation & Quality Signals" to the autogenerated mechanisms index.
  • docs/MECHANISM_CONSUMERS.md
    • Appended a dedicated section for "m011 — Marketplace Curation & Quality Signals," outlining its canonical spec, output schemas, deterministic datasets, and known consumers.
  • mechanisms/m011-marketplace-curation/README.md
    • Created a new README file detailing the purpose, outputs (quality score, confidence, KPI block), scoring formula, and components of the m011 mechanism.
  • mechanisms/m011-marketplace-curation/SPEC.md
    • Added the comprehensive specification document for m011, covering problem definition, actors, signal definition, evidence inputs, scoring functions, state machine for collection lifecycle, token flows, governance parameters, featured batches, security invariants, attack model, integration points, acceptance tests, and rollout plan.
  • mechanisms/m011-marketplace-curation/datasets/README.md
    • Created a new README file explaining the m011 replay datasets and their usage.
  • mechanisms/m011-marketplace-curation/datasets/fixtures/v0_collection_sample.json
    • Added a JSON fixture file containing sample data for m011 collection lifecycle scenarios.
  • mechanisms/m011-marketplace-curation/datasets/fixtures/v0_sample.json
    • Added a JSON fixture file containing sample data for m011 scored credit batches and collections.
  • mechanisms/m011-marketplace-curation/datasets/schema.json
    • Added a JSON schema defining the structure for m011 replay datasets.
  • mechanisms/m011-marketplace-curation/reference-impl/README.md
    • Created a new README file describing the m011 reference implementation, its inputs, and outputs.
  • mechanisms/m011-marketplace-curation/reference-impl/m011_kpi.js
    • Added a JavaScript module for computing m011 Key Performance Indicator (KPI) metrics.
  • mechanisms/m011-marketplace-curation/reference-impl/m011_score.js
    • Added a JavaScript module for computing the m011 7-factor quality score and confidence, including helper functions.
  • mechanisms/m011-marketplace-curation/reference-impl/test_vectors/vector_v0_sample.expected.json
    • Added a JSON file containing expected output for the m011 score self-test.
  • mechanisms/m011-marketplace-curation/reference-impl/test_vectors/vector_v0_sample.input.json
    • Added a JSON file containing input data for the m011 score self-test.
  • mechanisms/m011-marketplace-curation/schemas/README.md
    • Created a new README file explaining the m011 output schemas.
  • mechanisms/m011-marketplace-curation/schemas/m011_collection.schema.json
    • Added a JSON schema for the m011 curated collection lifecycle object.
  • mechanisms/m011-marketplace-curation/schemas/m011_kpi.schema.json
    • Added a JSON schema for m011 KPI metrics.
  • mechanisms/m011-marketplace-curation/schemas/m011_quality_score.schema.json
    • Added a JSON schema for the m011 credit batch quality score output.
  • package.json
    • Updated the package configuration to specify "type": "module".
Activity
  • The pull request was created by CShear, introducing the m011 mechanism spec.
  • Initial automated tests for the reference implementation (m011_score.js), npm run verify, and npm run check:index have passed.
  • Regression tests confirmed that the m010 mechanism still passes its self-tests.
  • Review of SPEC.md for accuracy and validation of JSON schema coverage against SPEC.md state machine are pending.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the comprehensive mechanism specification for m011, covering marketplace curation and quality signals. It includes the detailed SPEC.md, JSON schemas for data structures, a reference implementation in JavaScript with self-tests, and sample datasets. The changes are well-structured and thorough. I've identified a couple of areas for improvement: a minor ambiguity in the specification document regarding state transitions and an opportunity to improve code clarity in the reference implementation by avoiding a magic number. Overall, this is a solid contribution that clearly defines the new mechanism.

1. **Bond Conservation**: `bond_pool.balance = sum(active_collection_bonds) + sum(pending_refunds)` at all times.
2. **Criteria Enforcement**: Every batch in a collection must satisfy the collection's `CurationCriteria` at addition time; AGENT-003 re-verifies daily for drift.
3. **Curator Authority**: Only the collection curator can add/remove batches; agents cannot modify collection membership directly.
4. **Slash Cap**: Cumulative slashing cannot exceed the curator's total bond; if `bond_remaining < min_curation_bond` after slash → CLOSED.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a contradiction between Security Invariant #4 and the state machine defined in Section 6.

  • The invariant states: "if bond_remaining < min_curation_bond after slash → CLOSED". This implies a direct transition to the CLOSED state.
  • However, the state machine diagram and transition table describe a SUSPENDED state that allows the curator a top_up_window to replenish their bond before the collection is moved to CLOSED.

To ensure clarity and prevent implementation ambiguity, please align the security invariant with the more detailed behavior described in the state machine. For example: "If a slash causes bond_remaining < min_curation_bond, the collection transitions to SUSPENDED. If the bond is not topped up within the bond_top_up_window, the collection then transitions to CLOSED."

References
  1. This rule emphasizes the importance of co-locating all state definitions and transitions, including edge-case flows, within the primary state machine documentation to improve clarity.
  2. This rule requires explicitly defining transition logic and state-based conditions to prevent implementation ambiguity, especially when different mechanisms interact.

Comment on lines +44 to +50
const slashed_colls = colls.filter(c =>
c.challenge?.outcome === "CHALLENGER_WINS"
);
const total_slashed = slashed_colls.reduce((s, c) => {
const bond = parseInt(c.bond?.amount ?? "0", 10);
return s + Math.round(bond * 0.20); // default slash_percentage
}, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The default slash percentage (0.20) is hardcoded here. While the comment mentions it's the default, it's better practice to define this as a named constant. This improves readability and makes it easier to find and update if the default value changes in the future, especially since it's a governance parameter according to the spec.

Suggested change
const slashed_colls = colls.filter(c =>
c.challenge?.outcome === "CHALLENGER_WINS"
);
const total_slashed = slashed_colls.reduce((s, c) => {
const bond = parseInt(c.bond?.amount ?? "0", 10);
return s + Math.round(bond * 0.20); // default slash_percentage
}, 0);
const slashed_colls = colls.filter(c =>
c.challenge?.outcome === "CHALLENGER_WINS"
);
const DEFAULT_SLASH_PERCENTAGE = 0.20;
const total_slashed = slashed_colls.reduce((s, c) => {
const bond = parseInt(c.bond?.amount ?? "0", 10);
return s + Math.round(bond * DEFAULT_SLASH_PERCENTAGE);
}, 0);

…stant

- SPEC.md: align security invariant regen-network#4 with state machine — slash below
  min_curation_bond triggers SUSPENDED (with top-up window), not direct CLOSED
- m011_kpi.js: extract slash percentage 0.20 to DEFAULT_SLASH_PERCENTAGE constant

Fixes Gemini review on PR regen-network#22.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant