What you implement — five methods
const agtsPlugin = {
// 1. Unique domain identifier
get name() { return 'myDomain'; },
// 2. Called once when plugin is registered
// Call onMeasurement() to push events into the clearinghouse
async initialize(onMeasurement) {
this._emit = onMeasurement;
onMeasurement({
type: 'plugin_registered',
measurement_source: 'PLUGIN',
plugin: this.name,
timestamp: new Date().toISOString(),
});
},
// 3. Returns current plugin status — synchronous, non-throwing
getStatus() {
return {
name: this.name,
initialized: true,
lifecycleState: 'ACTIVE',
};
},
// 4. Handle messages from the clearinghouse or other plugins
async onMessage(msg, sender) { return null; },
// 5. Called on clearinghouse shutdown
destroy() { this._emit = null; },
};
// Registration
await clearinghouse.pluginRegistry.register(agtsPlugin);
// Calls initialize(onMeasurement) automatically.
// If initialize() throws, the plugin is not registered.
Emitting governance evidence
When your domain has collected all five gate results, emit agts_governance_evidence:
this._emit({
type: 'agts_governance_evidence',
measurement_source: 'PLUGIN',
plugin: this.name,
timestamp: new Date().toISOString(),
subject_id: 'myDomain:action:v2.1',
capability_certificate_id: '<sha256-hex>',
deployment_artifact_hash: '<sha256-hex>',
replay_seed: '<hex-or-uri>',
gate_results: {
G1: { result: 'PASS', confidence_interval_lower: 0.80, confidence_interval_upper: 0.95 },
G2: { result: 'PASS', causal_attribution: true, ablation_delta: 0.031 },
G3: { result: 'PASS', protected_metrics: { accuracy: 0.93 } },
G4: { result: 'PASS', evidence_class: 'HOOKED' },
G5: { result: 'PASS', operator_id: 'alice@example.com' },
},
evidence: {
dataset_provenance_hash: '<sha256-hex>',
evaluation_trace_hash: '<sha256-hex>',
ablation_execution_log_hash: '<sha256-hex>',
capability_certificate_hash: '<sha256-hex>',
},
state_before_hash: '<sha256-hex>',
state_after_hash: '<sha256-hex>',
});
After this call: the clearinghouse assembles the AGTS_PROOF_BUNDLE_V1, initiates the validator round, and — if the quorum approves — submits the Governance Envelope to the transparency log.
Standard measurement types
| Type | HCE effect | When to use |
|---|---|---|
plugin_registered | H↑ | Plugin initialization complete |
plugin_error | H↓ | Internal plugin error |
gate_pass | H↑ C↑ E↓ | Any single RTR gate (G1–G5) passes |
gate_fail | H↓ C↓ E↑ | Any single RTR gate fails |
agts_governance_evidence | H↑ C↑ E↓ | Full G1–G5 evidence set ready for Proof Bundle assembly |
agts_envelope_admitted | H↑ C↑ E↓ | Governance Envelope successfully admitted to log |
agts_envelope_rejected | H↓ C↓ E↑ | Governance Envelope rejected by log or validator network |
receipt_submitted | H↑ | AGTS_SETTLEMENT_V1 successfully submitted |
receipt_error | H↓ | Settlement receipt submission failed |
Plugin lifecycle states
| State | Meaning | What happens |
|---|---|---|
PROPOSED | Registered, no gate passes yet | No Governance Envelope issuance |
ACTIVE | Operating normally | Full pipeline: evidence → validators → envelope → log |
QUARANTINE | Degraded — 3+ consecutive gate failures | Evidence accumulates; validator rounds suspended; alert emitted |
LOCKBOX | Suspended — 10+ consecutive failures | Read-only forensic state; no new measurements accepted |
REJECTED | Permanent policy violation | Cannot be reactivated without full restart and re-registration |
Iframe / postMessage bridge
If your domain UI is hosted in an iframe, bridge events via postMessage:
// From inside the iframe — emit governance evidence
window.parent.postMessage({
type: 'AGTS_GOVERNANCE_EVIDENCE',
payload: {
plugin: 'myDomain',
timestamp: new Date().toISOString(),
subject_id: 'myDomain:action:id',
gate_results: { G1: {...}, G2: {...}, G3: {...}, G4: {...}, G5: {...} },
evidence: { dataset_provenance_hash: '...', /* ... */ },
state_before_hash: '...',
state_after_hash: '...',
replay_seed: '...',
},
}, '*');
// Single gate result
window.parent.postMessage({
type: 'AGTS_GATE_RESULT',
payload: { gate: 'G4', pass: true, evidence_class: 'HOOKED' },
}, '*');