Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ This repository contains the design specifications and implementation plans for
<!-- BEGIN MECHANISMS INDEX -->

<!-- AUTOGENERATED: run node scripts/build-mechanism-index.mjs -->
- [m008 — Data Attestation Bonding (v0 advisory)](mechanisms/m008-attestation-bonding/)
- [m010 — Reputation Signal (v0 advisory)](mechanisms/m010-reputation-signal/)

<!-- END MECHANISMS INDEX -->
Expand Down
18 changes: 18 additions & 0 deletions docs/MECHANISM_CONSUMERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ This document maps **mechanism IDs** to known **consumers** (agents, digests, sc
- Heartbeat replay runner: `scripts/replay-m010.mjs` (regen-heartbeat)
- Heartbeat stub runner: `scripts/stub-run-signal-agent.mjs` (regen-heartbeat)
- Heartbeat validator: `scripts/validate-signal-agent.mjs` (regen-heartbeat)

## m008 — Data Attestation Bonding
**Canonical spec**
- `mechanisms/m008-attestation-bonding/SPEC.md`

**Outputs**
- KPI JSON block schema: `mechanisms/m008-attestation-bonding/schemas/m008_kpi.schema.json`
- Quality score schema: `mechanisms/m008-attestation-bonding/schemas/m008_quality_score.schema.json`
- Attestation lifecycle schema: `mechanisms/m008-attestation-bonding/schemas/m008_attestation.schema.json`

**Datasets (deterministic)**
- Replay fixtures: `mechanisms/m008-attestation-bonding/datasets/fixtures/v0_sample.json`
- Challenge scenarios: `mechanisms/m008-attestation-bonding/datasets/fixtures/v0_challenge_sample.json`

**Known consumers**
- Heartbeat character: `attestation-agent` (regen-heartbeat, planned)
- KOI MCP: attestation quality lookups via `resolve_entity` / `get_entity_documents`
- Ledger MCP: bond balance queries via `get_balance` / `get_all_balances`
32 changes: 32 additions & 0 deletions mechanisms/m008-attestation-bonding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# m008 — Data Attestation Bonding (v0 advisory)

m008 creates economic incentives for high-quality ecological data attestations by requiring attesters to **bond REGEN tokens** that can be slashed for false or misleading claims. Attestation types include project boundaries, baseline measurements, credit issuance claims, and methodology validations, each with risk-proportional bond requirements.

## What it outputs
- An **attestation quality score** (0–1000) per attestation, based on bond adequacy, attester reputation, evidence completeness, and attestation type risk.
- An **attestation lifecycle** tracking state transitions from BONDED through ACTIVE, CHALLENGED, to RELEASED/RESOLVED_VALID/SLASHED.
- **KPI metrics**: attestations submitted, challenge rate, resolution outcomes, average bond amount, slashing rate.

## What it does not do (v0)
- No on-chain bond escrow. Bond requirements are published as guidelines only.
- No on-chain challenge deposits or arbiter resolution. Challenge workflow is admin-driven.
- No automated slashing. Quality scores are advisory/informational only.
- No Arbiter DAO integration (v1 uses DAO DAO subDAO).

## How to reference
- Canonical spec: `mechanisms/m008-attestation-bonding/SPEC.md`
- State machine: SPEC.md section 6
- Bond schedule: SPEC.md section 7 (ProjectBoundary 500, Baseline 1000, CreditIssuance 2000, Methodology 5000 REGEN)
- Scoring function: SPEC.md section 5 (4-factor weighted composite)
- Other mechanisms may treat m008 attestation status as an input (e.g., M009 service escrow, M001-ENH class approval).

## Replay datasets
See `datasets/` for deterministic fixtures used to generate non-zero KPI outputs without MCP.
- `v0_sample.json` — attestations covering full lifecycle (active, released, challenged, resolved)
- `v0_challenge_sample.json` — challenge scenarios with varied resolution outcomes

## Schemas
Canonical JSON schemas for m008 outputs live in `schemas/`.
- `m008_attestation.schema.json` — attestation lifecycle objects with bond and status
- `m008_quality_score.schema.json` — attestation quality score output
- `m008_kpi.schema.json` — KPI metrics (attestations, challenges, bond economics)
308 changes: 308 additions & 0 deletions mechanisms/m008-attestation-bonding/SPEC.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions mechanisms/m008-attestation-bonding/datasets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# m008 replay datasets

Fixture files for replay testing of m008 (Data Attestation Bonding) computations.

## Files
- `schema.json` — JSON Schema for the replay dataset format.
- `fixtures/v0_sample.json` — Five attestations across all types, with quality scores matching reference-impl output. Includes ACTIVE, RELEASED, and SUBMITTED statuses.
- `fixtures/v0_challenge_sample.json` — Six attestations covering challenge and resolution scenarios: CHALLENGED (pending), SLASHED, RESOLVED_VALID, RESOLVED_INVALID, ACTIVE, and RELEASED.

## Usage
Feed fixture files into `m008_kpi.js` to verify KPI computation. Quality scores in fixtures correspond to `m008_score.js` output for the matching factor inputs.
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"mechanism_id": "m008",
"scope": "v0_advisory",
"as_of": "2026-02-18T12:00:00Z",
"attestations": [
{
"attestation_id": "att-c01",
"attestation_type": "CreditIssuanceClaim",
"attestation_iri": "koi://attestation/carbon-issuance-batch-C02-disputed",
"attester": "regen1chal01attester",
"bond": { "amount": "2000", "denom": "uregen" },
"status": "CHALLENGED",
"quality_score": 450,
"submitted_at": "2025-12-01T10:00:00Z",
"activated_at": "2025-12-03T10:00:00Z",
"challenge": {
"challenger": "regen1challenger01",
"reason": "Baseline data inconsistent with satellite imagery for claimed issuance period",
"challenged_at": "2026-01-15T08:00:00Z",
"resolved_at": null,
"outcome": null
}
},
{
"attestation_id": "att-c02",
"attestation_type": "BaselineMeasurement",
"attestation_iri": "koi://attestation/soil-baseline-fabricated",
"attester": "regen1chal02attester",
"bond": { "amount": "1000", "denom": "uregen" },
"status": "SLASHED",
"quality_score": 280,
"submitted_at": "2025-10-01T09:00:00Z",
"activated_at": "2025-10-03T09:00:00Z",
"challenge": {
"challenger": "regen1challenger02",
"reason": "Measurement data does not match on-site verification; suspected fabrication",
"challenged_at": "2025-11-01T12:00:00Z",
"resolved_at": "2025-12-15T16:00:00Z",
"outcome": "INVALID"
}
},
{
"attestation_id": "att-c03",
"attestation_type": "MethodologyValidation",
"attestation_iri": "koi://attestation/methodology-review-biochar-v2",
"attester": "regen1chal03attester",
"bond": { "amount": "5000", "denom": "uregen" },
"status": "RESOLVED_VALID",
"quality_score": 820,
"submitted_at": "2025-09-15T11:00:00Z",
"activated_at": "2025-09-17T11:00:00Z",
"challenge": {
"challenger": "regen1challenger03",
"reason": "Questioned permanence assumptions in biochar sequestration model",
"challenged_at": "2025-10-20T14:00:00Z",
"resolved_at": "2025-12-01T10:00:00Z",
"outcome": "VALID"
}
},
{
"attestation_id": "att-c04",
"attestation_type": "ProjectBoundary",
"attestation_iri": "koi://attestation/project-boundary-overlap-detected",
"attester": "regen1chal04attester",
"bond": { "amount": "500", "denom": "uregen" },
"status": "RESOLVED_INVALID",
"quality_score": 310,
"submitted_at": "2025-08-01T08:00:00Z",
"activated_at": "2025-08-03T08:00:00Z",
"challenge": {
"challenger": "regen1challenger04",
"reason": "Project boundary overlaps with existing registered project P-regen-018",
"challenged_at": "2025-09-10T09:00:00Z",
"resolved_at": "2025-11-05T15:00:00Z",
"outcome": "INVALID"
}
},
{
"attestation_id": "att-c05",
"attestation_type": "CreditIssuanceClaim",
"attestation_iri": "koi://attestation/carbon-issuance-batch-C07-valid",
"attester": "regen1chal05attester",
"bond": { "amount": "3000", "denom": "uregen" },
"status": "ACTIVE",
"quality_score": 880,
"submitted_at": "2026-01-20T13:00:00Z",
"activated_at": "2026-01-22T13:00:00Z",
"challenge": null
},
{
"attestation_id": "att-c06",
"attestation_type": "BaselineMeasurement",
"attestation_iri": "koi://attestation/soil-baseline-plot-99",
"attester": "regen1chal06attester",
"bond": { "amount": "1500", "denom": "uregen" },
"status": "RELEASED",
"quality_score": 650,
"submitted_at": "2025-06-01T07:00:00Z",
"activated_at": "2025-06-03T07:00:00Z",
"challenge": null
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"mechanism_id": "m008",
"scope": "v0_advisory",
"as_of": "2026-02-18T12:00:00Z",
"attestations": [
{
"attestation_id": "att-001",
"attestation_type": "BaselineMeasurement",
"attestation_iri": "koi://attestation/soil-baseline-plot-42",
"attester": "regen1abc123attester1",
"bond": { "amount": "1500", "denom": "uregen" },
"status": "ACTIVE",
"quality_score": 769,
"submitted_at": "2026-01-10T08:00:00Z",
"activated_at": "2026-01-12T08:00:00Z",
"challenge": null
},
{
"attestation_id": "att-002",
"attestation_type": "CreditIssuanceClaim",
"attestation_iri": "koi://attestation/carbon-issuance-batch-C04-2026",
"attester": "regen1def456attester2",
"bond": { "amount": "2000", "denom": "uregen" },
"status": "ACTIVE",
"quality_score": 704,
"submitted_at": "2026-01-15T10:00:00Z",
"activated_at": "2026-01-17T10:00:00Z",
"challenge": null
},
{
"attestation_id": "att-003",
"attestation_type": "ProjectBoundary",
"attestation_iri": "koi://attestation/project-boundary-P-regen-042",
"attester": "regen1ghi789attester3",
"bond": { "amount": "500", "denom": "uregen" },
"status": "RELEASED",
"quality_score": 425,
"submitted_at": "2025-11-01T09:00:00Z",
"activated_at": "2025-11-03T09:00:00Z",
"challenge": null
},
{
"attestation_id": "att-004",
"attestation_type": "MethodologyValidation",
"attestation_iri": "koi://attestation/methodology-review-soil-carbon-v4",
"attester": "regen1jkl012attester4",
"bond": { "amount": "10000", "denom": "uregen" },
"status": "ACTIVE",
"quality_score": 970,
"submitted_at": "2026-02-01T14:00:00Z",
"activated_at": "2026-02-03T14:00:00Z",
"challenge": null
},
{
"attestation_id": "att-005",
"attestation_type": "BaselineMeasurement",
"attestation_iri": "koi://attestation/weak-baseline-unresolvable",
"attester": "regen1mno345attester5",
"bond": { "amount": "1000", "denom": "uregen" },
"status": "SUBMITTED",
"quality_score": 393,
"submitted_at": "2026-02-15T16:00:00Z",
"activated_at": null,
"challenge": null
}
]
}
54 changes: 54 additions & 0 deletions mechanisms/m008-attestation-bonding/datasets/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "m008_dataset_v0",
"title": "m008 replay dataset",
"description": "Replay dataset for m008 Data Attestation Bonding — attestation lifecycle records with bond, status, and quality scores.",
"type": "object",
"required": ["mechanism_id", "scope", "as_of", "attestations"],
"properties": {
"mechanism_id": { "const": "m008" },
"scope": { "type": "string" },
"as_of": { "type": "string", "format": "date-time" },
"attestations": {
"type": "array",
"items": {
"type": "object",
"required": ["attestation_id", "attestation_type", "attestation_iri", "attester", "bond", "status"],
"properties": {
"attestation_id": { "type": "string" },
"attestation_type": {
"type": "string",
"enum": ["ProjectBoundary", "BaselineMeasurement", "CreditIssuanceClaim", "MethodologyValidation"]
},
"attestation_iri": { "type": "string" },
"attester": { "type": "string" },
"bond": {
"type": "object",
"required": ["amount", "denom"],
"properties": {
"amount": { "type": "string" },
"denom": { "type": "string" }
}
},
"status": {
"type": "string",
"enum": ["SUBMITTED", "ACTIVE", "CHALLENGED", "RESOLVED_VALID", "RESOLVED_INVALID", "RELEASED", "SLASHED"]
},
"quality_score": { "type": ["number", "null"] },
"submitted_at": { "type": "string", "format": "date-time" },
"activated_at": { "type": ["string", "null"], "format": "date-time" },
"challenge": {
"type": ["object", "null"],
"properties": {
"challenger": { "type": "string" },
"reason": { "type": "string" },
"challenged_at": { "type": "string", "format": "date-time" },
"resolved_at": { "type": ["string", "null"], "format": "date-time" },
"outcome": { "type": ["string", "null"], "enum": ["VALID", "INVALID", null] }
}
}
}
}
}
}
}
42 changes: 42 additions & 0 deletions mechanisms/m008-attestation-bonding/reference-impl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# m008 reference implementation (v0 advisory)

This folder provides a **canonical computation** for m008 outputs so that different agents/runners
produce consistent numbers.

## Inputs

### Scoring (`m008_score.js`)
An input object per attestation:

- `attestation` — attestation metadata:
- `attestation_type` (string, one of ProjectBoundary/BaselineMeasurement/CreditIssuanceClaim/MethodologyValidation)
- `attestation_iri` (string)
- `bond` (object with `amount` and `denom`)
- `factors` — pre-computed factor scores (each 0–1000):
- `bond_adequacy` — bond amount relative to minimum
- `attester_reputation` — M010 reputation score (default 300 if unavailable)
- `evidence_completeness` — document completeness checklist
- `type_risk` — attestation type risk factor
- `reputation_available` (boolean), `iri_resolvable` (boolean), `has_prior_attestations` (boolean), `type_recognized` (boolean)

### KPI (`m008_kpi.js`)
- `as_of` (ISO-8601 string, Z-suffixed)
- `attestations[]` — each with `status`, `attestation_type`, `bond`, `quality_score` (optional)

## Outputs

### Score
- `score` (0–1000) — weighted composite
- `confidence` (0–1000) — data availability
- `factors` — individual factor scores

Formula:
```
score = 0.30 × bond_adequacy + 0.30 × attester_reputation + 0.25 × evidence_completeness + 0.15 × type_risk
```

### KPI block
- Attestation counts by status (submitted, active, released, challenged, slashed)
- `challenge_rate`, `slash_rate`
- Bond economics (total bonded/released/slashed, average)
- Average quality score, type breakdown
Loading