agent-justice-protocol
v0.1.0
Published
Forensic investigation, dispute resolution, and risk assessment for the agent economy — TypeScript reference implementation
Maintainers
Readme
Agent Justice Protocol — TypeScript
Forensic investigation, dispute resolution, and risk assessment for the agent economy — TypeScript reference implementation. The accountability layer (Layer 4) of the Agent Trust Stack.
Port of the Python reference implementation — 9 source modules, 115 tests, strict TypeScript.
Quick Start
npm install agent-justice-protocolimport {
ForensicInvestigation, IncidentReport, AgentReference,
EvidenceRecord, JusticeStore,
} from "agent-justice-protocol";
// Investigate an incident
const report = new IncidentReport({
reporter: new AgentReference({ agentId: "agent-monitor-01" }),
incidentType: "service_failure",
severity: "high",
description: "Agent failed to deliver contracted output",
subjects: [new AgentReference({ agentId: "agent-suspect-42" })],
});
const investigation = new ForensicInvestigation(report);
investigation.addEvidence(new EvidenceRecord({
evidenceType: "interaction_log",
provenanceTier: 2,
sourceAgentId: "agent-monitor-01",
content: { action: "request_sent", status: "timeout" },
}));
const finding = investigation.produceFinding();
// Store results
const store = new JusticeStore();
store.appendFinding(finding);Three Modules
| Module | Purpose | Key Classes |
|--------|---------|-------------|
| Forensics Engine | Investigate incidents: collect evidence, reconstruct timelines, flag causal indicators | ForensicInvestigation, IncidentReport, EvidenceRequest, PrivacyGuard |
| Dispute Resolution | File claims, exchange evidence (commit-reveal), arbitrate with peer panels | Dispute, DisputeClaim, ArbitratorPool, renderDecision |
| Risk Assessment | Score agent risk, compute actuarial outputs for insurance underwriting | RiskEngine, RiskProfile, populationRiskSummary |
Architecture
src/
├── schema.ts — Constants, helpers, all data structures (AgentReference, EvidenceRecord,
│ ForensicFinding, DisputeClaim, ArbitrationDecision, RiskProfile)
├── evidence.ts — Evidence request scoping, filtering, redaction manifests
├── forensics.ts — Five-phase investigation engine, timeline reconstruction, causal indicators
├── privacy.ts — Anti-fishing enforcement (Rules 5/5a), per-initiator/per-respondent tracking
├── dispute.ts — Dispute lifecycle, commit-reveal protocol, settlement offers
├── arbitration.ts — Arbitrator pool, eligibility, weighted panel selection, vote aggregation
├── remediation.ts — Remediation orders, compliance tracking
├── risk.ts — Risk scoring engine, actuarial outputs, population analytics
├── store.ts — Append-only JSONL store for all record types
└── index.ts — Barrel exportsBuild & Test
npm install
npm run build
npm testKey Features
- Evidence-first: Every dispute must be grounded in a forensic investigation
- Provenance-tiered: Evidence weight scales with quality (Tier 1 cryptographic > Tier 4 self-reported)
- Privacy-protected: Anti-fishing rules prevent weaponization of investigations (Rules 5/5a)
- Commit-reveal: Blind evidence exchange prevents strategic adaptation
- Three resolution tiers: Automated (<$1K), peer arbitration ($1K-$50K), human escalation (>$50K)
- Actuarial outputs: Expected loss rate, loss severity distribution, premium basis
- Identity-agnostic: Works with CoC, ERC-8004, A2A, W3C VC/DID, or bare URIs
- Zero runtime dependencies — only
node:cryptoandnode:fs - Strict TypeScript with declaration files and source maps
Security Disclaimer (VAM-SEC v1.0)
This software is provided as a reference implementation of the Agent Justice Protocol specification. It is intended for research, development, and integration testing.
This software does not provide legal advice, legal representation, or legally binding arbitration. Dispute decisions are structured data outputs, not legal judgments.
No warranties. See LICENSE for full terms.
License
Apache 2.0
