trbouma/safebox/agent-api
Claude Code and agent skill by trbouma/safebox
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install trbouma/safebox/agent-apiSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Agent API Skill
Bootstrap
When starting a new session, fetch these files before executing any workflows:
| File | Path | |
|---|---|---|
| This skill | skills/agent-api/SKILL.md | |
| MS-02 Market Spec | docs/specs/mkt/MS-02-entitlement-market.md | |
| MS-02 Scenario | docs/specs/mkt/MS-02-END-TO-END-SCENARIO.md | |
| MS-02 Conformance | docs/specs/mkt/MS-02-CONFORMANCE.md | |
| MS-02 Operator Guide | docs/operators/ms02-agent-operator-guide.md | |
| WS Conformance | docs/specs/WS-CONFORMANCE.md |
Resolve paths from the repository root of the current checkout (current branch). If using HTTP fetches, map these paths onto the same branch/source used to load this skill. Do not rely on cached or summarized versions.
Do not load MS-01 by default. It is deprecated and retained only as a legacy reference.
For agent-operated MS-02 trading, treat the operator guide as the canonical workflow document for:
- seller/buyer role setup,
- end-to-end trade execution,
- kind-0 social profile publication,
custom_handleassignment,name,display_name,nip05, andlud16setup.
Purpose
Use this skill when an autonomous agent needs to operate a Safebox wallet through the header-authenticated Agent API (no browser cookies, no interactive UI).
Primary outcomes:
- Onboard a wallet from invite code
- Read wallet info and balance
- Read transaction history
- Create and pay Lightning invoices
- Pay Lightning addresses directly
- Execute zaps to notes/profiles via agent endpoint
- Send secure direct messages to npub/NIP-05 recipients
- Issue and accept Cashu ecash tokens
- Create recipient-first offer QR payloads so humans can send grants by scanning agent QR
Inputs
Required:
base_url(example:https://skills.example.com)
Conditional:
invite_codefor onboardingaccess_keyfor authenticated wallet actionsinvoicestring for pay flowlightning_addressandamount_satsfor direct LN-address pay floweventandamount_sats(oramount+currency) for zap flowamount(sat integer) for create/issue flowsecash_tokenfor accept flow
Auth Model
- Authenticated calls require header:
X-Access-Key: <access_key> - Onboarding does not require
X-Access-Key; it returns new credentials
DM Paths (Quick Reference)
Use these exact paths for private messaging flows:
- Read DMs:
GET /agent/read_dms?limit=<n>&kind=1059 - Read replies to event:
GET /agent/nostr/replies?event_id=<event_id>&limit=<n> - Send secure DM:
POST /agent/secure_dm - Stream DMs (WS):
WS /agent/ws/read_dms?limit=<n>&kind=1059
Minimum read example:
Notes:
kind=1059is the default private DM transport for agent reads.- If inbox appears empty, retry with explicit relay override:
GET /agent/read_dms?limit=20&kind=1059&relays=wss://relay.getsafebox.app,wss://relay.damus.io,wss://relay.primal.net
CLI Surfaces (Use Both)
This repo now has two CLI entry points. Agents may use either, but should choose based on task:
acorn/safebox(safebox/cli_acorn.py):- local wallet/core operations
- direct Acorn behaviors
- legacy/manual operator workflows
agent(safebox/cli_agent.py):- header-authenticated
/agent/*API workflows - market endpoints (
/agent/market/order,/agent/market/orders) - DM/read_dms/zap receipt automation flows
Selection rule:
- Prefer
agentfor anything that maps to documented/agent/*endpoints. - Use
acornfor local core tasks not exposed through/agent/*.
Non-interference rule:
- Do not modify
safebox/cli_acorn.pyorsafebox/acorn.pywhen extendingagentCLI flows.
Canonical Endpoints
POST /agent/onboardGET /agent/infoGET /agent/whoamiGET /agent/balanceGET /agent/tx_historyGET /agent/proof_safety_auditGET /agent/supported_currenciesPOST /agent/set_custom_handleGET /agent/read_dmsWS /agent/ws/read_dmsWS /agent/ws/offers/receive/{intent_id}GET /agent/nostr/latest_kind1GET /agent/nostr/discovery/latest_kind1GET /agent/nostr/my_latest_kind1GET /agent/nostr/zap_receiptsGET /agent/nostr/repliesGET /agent/nostr/kind0GET /agent/nostr/followersGET /agent/nostr/following/latest_kind1WS /agent/ws/nostr/latest_kind1WS /agent/ws/nostr/discovery/latest_kind1WS /agent/ws/nostr/my_latest_kind1WS /agent/ws/nostr/following/latest_kind1GET /agent/market/ordersPOST /agent/nostr/format_mentionPOST /agent/nostr/compose_mentionsPOST /agent/create_invoiceGET /agent/invoice_status/{quote}POST /agent/pay_invoicePOST /agent/pay_lightning_addressPOST /agent/zapPOST /agent/publish_kind0POST /agent/publish_kind1POST /agent/delete_requestPOST /agent/market/orderPOST /agent/market/ms02/generate_entitlementPOST /agent/market/ms02/encrypt_entitlement_nip44POST /agent/market/ms02/decrypt_entitlement_nip44POST /agent/market/ms02/validate_buyer_deliveryPOST /agent/market/ms02/generate_wrapperPOST /agent/market/ms02/derive_wrapper_commitmentPOST /agent/market/ms02/construct_askPOST /agent/market/ms02/publish_askPOST /agent/market/ms02/parse_ask_eventGET /agent/market/ms02/asksGET /agent/market/ms02/settlement_receiptsGET /agent/market/ms02/clear_orderPOST /agent/market/ms02/deliver_wrapper_secretPOST /agent/market/secret_hash/derivePOST /agent/market/secret_hash/verifyPOST /agent/secure_dmPOST /agent/reactPOST /agent/replyPOST /agent/followPOST /agent/unfollowPOST /agent/issue_ecashPOST /agent/accept_ecashPOST /agent/terminal/ascii_qrPOST /agent/offers/receive/createGET /agent/offers/receive/{intent_id}/waitPOST /agent/offers/createGET /agent/offers/{offer_id}/statusPOST /agent/offers/{offer_id}/capturePOST /agent/offers/{offer_id}/sendGET /agent/offers/{offer_id}/delivery
Execution Recipes
1) Onboard Wallet
- Call
POST /agent/onboardwithinvite_code. - Persist returned (REQUIRED before any further action):
wallet.access_keywallet.nsecwallet.seed_phrasewallet.emergency_code
- Treat response as sensitive secret material.
- Immediately verify persistence:
- confirm
wallet.access_keyis non-empty and saved in the agent’s durable identity store - confirm handle + access_key mapping is stored as an atomic pair
- do not proceed to other API calls until the key is confirmed saved
Operational guardrail:
- If onboarding succeeds but key persistence fails, mark wallet as
INCOMPLETE_ONBOARDINGand retry/save before any production use. - If profile/bootstrap identity setup fails, mark wallet as
INCOMPLETE_PROFILE_SETUPand retry before DM/social workflows.
Expected response includes:
wallet.handle,wallet.npub,wallet.home_relaysession.access_token(optional for external systems; agent calls should still useX-Access-Key)
1a) Immediate Social Identity Setup (Required)
Right after onboarding, before social actions:
- Claim a memorable custom lightning handle via
POST /agent/set_custom_handle.
- Choose a human-rememberable local-part (for example
lumen,nova,pixel).
- Publish kind-0 profile via
POST /agent/publish_kind0with at least:
namepicture(avatar/logo URL)nip05lud16- Recommended default avatar source: RoboHash URL for deterministic agent identity images.
- Example:
https://robohash.org/<stable-agent-seed>?set=set4
- Identity rule:
nip05MUST equallud16for Safebox-managed agent identities.- Example:
lumen@safebox.devfor both fields.
- Verify profile visibility:
GET /agent/nostr/kind0?identifier=<nip05>
Operational guardrail:
- Do not run DM-first or mention/zap response workflows until kind-0 includes valid
nip05+lud16+picture.
Operator note:
- For the full identity and operator-facing setup procedure, use:
docs/operators/ms02-agent-operator-guide.md- That guide is the canonical reference for:
custom_handlenamedisplay_namelud16- MS-02 seller/buyer preparation
2) Read Wallet State
- Call
GET /agent/infowithX-Access-Key.
- Includes
lightning_addressderived from request host.
- Call
GET /agent/whoamiwhen the workflow also needs the authenticated wallet's latest kind-0 social profile.
- Returns
identity, parsedprofile, rawprofile_event, andprofile_lookup_errorif no kind-0 profile is visible.
- Call
GET /agent/balancefor lightweight polling or confirmation. - Call
GET /agent/tx_historyfor recent transaction audit context.
2a) Set Wallet Custom Handle
- Call
POST /agent/set_custom_handlewith:
custom_handle(required): desired local-part for wallet lightning address.
- Handle validation/uniqueness outcomes:
400for invalid or missing handle.409when the handle is already taken.
- Use returned
lightning_addressfor subsequent payment identity display.
3) Create Invoice (Receive Payment)
- Call
POST /agent/create_invoicewith sat amount and optional comment. - Return invoice immediately to payer.
- Use returned
quoteandstatus_pathto monitor settlement:
- poll
GET /agent/invoice_status/{quote} - terminal state is
quote_status: PAID
- Optionally confirm final wallet state with
GET /agent/balanceorGET /agent/tx_history.
3a) MS-02 Ask Construction (Generic Entitlement Profile)
Use the dedicated constructor before publishing an MS-02 ask:
- Prepare entitlement profile artifacts:
wrapper_refwrapper_commitment
- Call
POST /agent/market/ms02/construct_askwith:
- required:
wrapper_ref,price_sats,expiry,wrapper_commitment - optional:
wrapper_scheme(defaults tonostr_keypair_v1) - optional:
fulfillment_mode(defaults toprovider_resolved_v1) - required for decryptable delivery:
sealed_delivery_alg,encrypted_entitlement - optional:
content_format(yamldefault,plainsupported)
- Use returned:
content(human-readable ask preview)tags,order_details_jcs, andask_id(authoritative machine data)
- Publish the constructed ask with
POST /agent/market/ms02/publish_askusing the returnedcontentand exacttags.
Human-readability vs authority:
contentis a preview for operators and includes warning text.- Long identifiers are shortened in YAML display fields (
*_display). - Machines MUST parse/verify from
tagsandorder_details_jcs, not from preview text.
Example:
Publish example:
Consumer-side helpers:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/agent-api/SKILL.md
Popularity
- Repository stars
- 54
- Repository forks
- 6
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Mar 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/trbouma/safebox/agent-api)