[Hackathon] stellarminds-ai: capsule-emit trust layer — verifiable, anchored records for NANDA agents#54
Open
StevenMih wants to merge 3 commits into
Open
Conversation
Two new examples showing how capsule-emit integrates with NANDA Town: 1. examples/capsule-trust/ — Tutorial for using CapsuleEmitTrust (from pip install capsule-emit[nanda]) as a drop-in replacement for agent_receipts. Adds independently-verifiable capsule ledger to any scenario; ring-severance validators still pass. Includes the tax audit demo reference (biz_control vs biz_capsule — same cheat policy, only the record layer differs; capsule business learns to go honest). 2. examples/stripe-capsule-payment/ — Tutorial for wrapping the NANDA Payments layer with Stripe + capsule-emit. Every completed payment is sealed in an Agent Action Capsule whose agent_input_digest commits to amount, payer, and payee at call time — tamper-evident payment audit trail verifiable by any third party. 3. scenarios/receipt_reputation_capsule.yaml — receipt_reputation scenario with layers.trust: capsule_emit instead of agent_receipts. Run with: nest run scenarios/receipt_reputation_capsule.yaml then agent-action-capsule verify --store capsule_ledger.jsonl Reference: https://github.com/action-state-group/capsule-emit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reworks PR projnanda#32 from docs-only to a working capability that users can install and run. The gap: `pip install capsule-emit[nanda]` didn't exist and `nest run scenarios/receipt_reputation_capsule.yaml` failed for anyone who checked out the repo. **What's new:** `examples/capsule-emit/` — installable `capsule-emit-nanda` package containing two real NANDA layer plugins with entry points: - `trust: capsule_emit` → `CapsuleEmitTrust` — drop-in for `agent_receipts`; seals every corroborated receipt to an Agent Action Capsule ledger. Ring-severance logic identical; adds third-party auditability via `agent-action-capsule verify --store`. - `payments: stripe_capsule` → `StripeCapsuledPayments` — Stripe (or deterministic sandbox by default) payments layer; every payment sealed with `agent_input_digest` committing to amount + payer/payee at call time. No real charges without `STRIPE_SECRET_KEY`. **Updated:** - `examples/capsule-trust/README.md` — capability-first; install now points at `pip install -e examples/capsule-emit` (the real package). - `examples/stripe-capsule-payment/README.md` — capability-first with code pattern; sandbox vs real-Stripe instructions; IETF slug fixed. - `scenarios/receipt_reputation_capsule.yaml` — install comment fixed to match the real package path. - IETF slug corrected throughout: `draft-steele-agent-action-capsule` → `draft-mih-scitt-agent-action-capsule`. After `pip install -e examples/capsule-emit`: - `nest plugins list | grep -E "trust|payments"` shows both entries - `nest run scenarios/receipt_reputation_capsule.yaml` succeeds - `agent-action-capsule verify --store capsule_ledger.jsonl` exit 0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nding, smoke tests - Relabel StripeCapsuledPayments as a standalone demo, not a drop-in NANDA Payments layer: update module docstring, class docstring, and both READMEs (stripe-capsule-payment + capsule-emit). - Add payee caveat in module docstring and stripe-capsule-payment README: on the real-Stripe path payee is not enforced in the PaymentIntent (no destination/transfer), so the capsule commits to payer/payee by digest but the charge does not route to the payee. - Fix money rounding: int(amount*100) -> round(amount*100) so $19.99 charges 1999 cents instead of silently truncating to 1998. - Add examples/capsule-emit/tests/test_smoke.py: instantiate both plugins, exercise one trust report/score + one sandbox pay (2 passed). - Remove phantom sentinel comment in trust.py referencing the non-existent test_private_import_still_works test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
capsule-emit-nanda— a drop-in NANDA trust plugin backed by the Agent Action Capsule spec (IETF draft). Every corroborated receipt triggers acapsule_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
Three gates before a receipt contributes to reputation:
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
Smoke tests
Both plugins instantiate cleanly, exercise a happy path each, and sandbox mode runs without any Stripe credentials.
Files changed
examples/capsule-emit/capsule_emit_nanda/trust.pyCapsuleEmitTrust— NANDA Trust protocol implementationexamples/capsule-emit/capsule_emit_nanda/payments.pyStripeCapsuledPayments— standalone payment demoexamples/capsule-emit/pyproject.tomlexamples/capsule-emit/README.mdexamples/capsule-emit/tests/test_smoke.pyexamples/stripe-capsule-payment/README.mdDemo clarifications
StripeCapsuledPaymentsis a standalone demo, not a conforming NANDA Payments protocol implementation. The NANDA Payments protocol requirespay(to, amount, ref) -> Receipt; this class uses a different signature.@runtime_checkableonly checks method names, so anisinstancecheck will falsely pass — documented in the module docstring.payeeis not enforced at the Stripe level (nodestination/transfer_data) — the capsule commits to the payer/payee pair by digest, but the charge does not route to the payee.