closedhumanPR #54Trust

action-state-group: capsule-emit trust layer — verifiable, anchored records for NANDA agents

capsule-emit-nanda — a drop-in NANDA trust plugin backed by the [Agent Action Capsule](https://github.com/action-state-group/agent-action-capsule) spec (IETF draft).

Author

Status
Closed without merging
Opened on
Jul 1
Branch
hackathon/capsule-trust

Description

The pitch.

## What this adds

`capsule-emit-nanda` — a drop-in NANDA trust plugin backed by the [Agent Action Capsule](https://github.com/action-state-group/agent-action-capsule) spec (IETF draft). Every corroborated receipt triggers a `capsule_emit.emit()` call, sealing the reputation event to a tamper-evident ledger that any third party can independently verify — with zero changes to existing NANDA agent code.

A companion demo (`StripeCapsuledPayments`) shows the same capsule pattern applied to payment events.

## How it works

```
NANDA scenario  →  ctx.plugins.get("trust").report(agent, evidence)
                →  CapsuleEmitTrust.report()
                →  capsule_emit.emit(action, operator, agent_input, agent_output, anchor=True)
                →  anchored to https://anchor.agentactioncapsule.org/v1/digest (live public log)
                →  capsule sealed to local JSONL ledger
                →  agent-action-capsule verify --store capsule_ledger.jsonl  ✔
```

**Three gates before a receipt contributes to reputation:**
1. Valid — Ed25519 issuer signature verifies
2. Corroborated — distinct counterparty co-signed the same interaction
3. Anchored — a capsule was emitted and is present in the ledger

Gate 3 is the novel contribution: an agent whose interactions are never anchored gets **zero reputation score** even if their receipts are individually valid and corroborated. The capsule ledger is the authoritative, externally-auditable record.

## Installable package

```
pip install -e examples/capsule-emit
```

```yaml
# scenario.yaml
layers:
  trust: capsule_emit
```

## Smoke tests

```
$ pytest examples/capsule-emit/tests/ -v
tests/test_smoke.py::test_trust_report_and_score  PASSED
tests/test_smoke.py::test_sandbox_pay             PASSED
```

Both plugins instantiate cleanly, exercise a happy path each, and sandbox mode runs without any Stripe credentials.

## Files changed

| Path | Role |
|------|------|
| `examples/capsule-emit/capsule_emit_nanda/trust.py` | `CapsuleEmitTrust` — NANDA Trust protocol implementation |
| `examples/capsule-emit/capsule_emit_nanda/payments.py` | `StripeCapsuledPayments` — standalone payment demo |
| `examples/capsule-emit/pyproject.toml` | Installable package config, entry-points |
| `examples/capsule-emit/README.md` | Plugin docs |
| `examples/capsule-emit/tests/test_smoke.py` | Smoke tests |
| `examples/stripe-capsule-payment/README.md` | Stripe demo docs with protocol-conformance caveats |

## Demo clarifications

- `StripeCapsuledPayments` is a **standalone demo**, not a conforming NANDA Payments protocol implementation. The NANDA Payments protocol requires `pay(to, amount, ref) -> Receipt`; this class uses a different signature. `@runtime_checkable` only checks method names, so an `isinstance` check will falsely pass — documented in the module docstring.
- On the real-Stripe path, `payee` is **not enforced at the Stripe level** (no `destination`/`transfer_data`) — the capsule commits to the payer/payee pair by digest, but the charge does not route to the payee.

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/54/head:pr-54
git checkout pr-54