Add m011 Marketplace Curation & Quality Signals mechanism spec#22
Add m011 Marketplace Curation & Quality Signals mechanism spec#22CShear wants to merge 2 commits intoregen-network:mainfrom
Conversation
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>
Summary of ChangesHello @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
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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_bondafter slash → CLOSED". This implies a direct transition to theCLOSEDstate. - However, the state machine diagram and transition table describe a
SUSPENDEDstate that allows the curator atop_up_windowto replenish their bond before the collection is moved toCLOSED.
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
- 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.
- This rule requires explicitly defining transition logic and state-based conditions to prevent implementation ambiguity, especially when different mechanisms interact.
| 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); |
There was a problem hiding this comment.
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.
| 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>
Summary
Test plan
node mechanisms/m011-marketplace-curation/reference-impl/m011_score.js— self-test PASS (5 test vectors)npm run verify— PASSnpm run check:index— mechanism index up to date🤖 Generated with Claude Code