l402

L402 agent commerce workflows with lnd, lnget, scoped macaroons, aperture, and MCP.

390 stars

Best use case

l402 is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

L402 agent commerce workflows with lnd, lnget, scoped macaroons, aperture, and MCP.

Teams using l402 should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/l402/SKILL.md --create-dirs "https://raw.githubusercontent.com/OpenAgentsInc/openagents/main/skills/l402/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/l402/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How l402 Compares

Feature / Agentl402Standard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

L402 agent commerce workflows with lnd, lnget, scoped macaroons, aperture, and MCP.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# L402

## Overview

Build and operate Lightning-native agent commerce flows using L402. Use this skill when tasks involve setting up Lightning payment infrastructure (`lnd`), enforcing key isolation with a remote signer, baking scoped macaroons, paying for L402-gated APIs with `lnget`, selling paid endpoints behind `aperture`, querying node state with Lightning MCP over LNC, or orchestrating end-to-end buyer and seller workflows.

This skill is based on `~/code/lightning-agent-tools` and should be treated as Bitcoin and Lightning only.

## Environment

- Requires `bash`, `curl`, and `jq`.
- Requires access to `~/code/lightning-agent-tools` (or `LIGHTNING_AGENT_TOOLS_DIR` override).
- Docker is the default runtime for node and signer flows.
- Go 1.24+ is needed for source builds; `npx` can be used for zero-install MCP.

Use this skill for concrete implementation and operations, not generic payment theory.

## Workflow

1. Choose the role path first:
- Buyer agent: `lnd` + pay-only macaroon + `lnget` for paid API access.
- Seller agent: `lnd` + invoice-only macaroon + `aperture` paywall in front of backend.
- Observer agent: Lightning MCP server over LNC with read-only tools.
- Full loop: buyer and seller integration with explicit budgets and token checks.

2. Run preflight:
- `scripts/check-l402-prereqs.sh buyer`
- `scripts/check-l402-prereqs.sh seller`
- `scripts/check-l402-prereqs.sh observer`
- `scripts/check-l402-prereqs.sh full`

3. Bootstrap stack from [lightning-agent-tools-playbook](references/lightning-agent-tools-playbook.md):
- Install and start node components from `lightning-agent-tools/skills/*`.
- Use `lnget` for L402 buyer traffic.
- Use `aperture` for paid endpoint hosting.

4. Enforce security model from [security-and-macaroons](references/security-and-macaroons.md):
- Default to watch-only + remote signer for production.
- Bake and use least-privilege macaroons (`pay-only`, `invoice-only`, `signer-only`, `read-only`).
- Keep admin macaroons off agent runtime paths.

5. For read-only observability or assistant node introspection, use [mcp-observability](references/mcp-observability.md):
- Configure Lightning MCP server and connect by LNC pairing phrase.
- Use MCP tools for status, channels, invoices, payments, peers, and fee estimates.

6. Validate outcome before production traffic:
- Buyer: run `lnget --no-pay` and `lnget --max-cost` checks.
- Seller: verify 402 challenge and successful paid retry.
- Security: verify scoped macaroons in active config.

## Quick Commands

```bash
# Node + lnget setup (buyer path)
~/code/lightning-agent-tools/skills/lnd/scripts/install.sh
~/code/lightning-agent-tools/skills/lnd/scripts/create-wallet.sh --mode standalone
~/code/lightning-agent-tools/skills/lnd/scripts/start-lnd.sh
~/code/lightning-agent-tools/skills/lnget/scripts/install.sh
lnget config init
lnget --max-cost 500 https://api.example.com/paid-data.json

# Scoped buyer credentials (recommended)
~/code/lightning-agent-tools/skills/macaroon-bakery/scripts/bake.sh --role pay-only

# Seller path (aperture)
~/code/lightning-agent-tools/skills/aperture/scripts/install.sh
~/code/lightning-agent-tools/skills/aperture/scripts/setup.sh --insecure --port 8081
~/code/lightning-agent-tools/skills/aperture/scripts/start.sh

# MCP read-only path
~/code/lightning-agent-tools/skills/lightning-mcp-server/scripts/install.sh
~/code/lightning-agent-tools/skills/lightning-mcp-server/scripts/configure.sh --production
```

## Reference Files

- [lightning-agent-tools-playbook](references/lightning-agent-tools-playbook.md): practical buyer/seller workflow and end-to-end L402 loop.
- [security-and-macaroons](references/security-and-macaroons.md): remote signer tiers, role-scoped macaroons, and production hardening.
- [mcp-observability](references/mcp-observability.md): Lightning MCP setup over LNC and read-only operations surface.

Related Skills

neutronpay

390
from OpenAgentsInc/openagents

Neutronpay MCP and SDK workflows for Lightning, stablecoin, and fiat payments.

moneydevkit

390
from OpenAgentsInc/openagents

Money Dev Kit workflows for Lightning checkout and agent wallets.

mezo

390
from OpenAgentsInc/openagents

Mezo integration workflows for apps, autonomous agents, and Mezo Earn operations.

maestro

390
from OpenAgentsInc/openagents

Maestro Symphony blockchain query operations for OpenAgents agents, including tip freshness checks, address/UTXO/runes queries, and production-safe troubleshooting against deployed Symphony API endpoints.

charms

390
from OpenAgentsInc/openagents

Charms workflows for Bitcoin app contracts, spell proving, and UTXO asset operations.

cast

390
from OpenAgentsInc/openagents

Charms CAST DEX workflows for order creation, cancellation/replacement, partial fulfillment, signing, and Bitcoin transaction verification.

blink

390
from OpenAgentsInc/openagents

Bitcoin Lightning wallet for agents — balances, invoices, payments, BTC/USD swaps, QR codes, price conversion, and transaction history via the Blink API. All output is JSON.

autopilot-pane-control

390
from OpenAgentsInc/openagents

OpenAgents desktop pane and CAD control for Codex via openagents.* tool calls.

autopilot-data-seller

390
from OpenAgentsInc/openagents

Conversational seller-authoring policy for DS-first Data Market listings in OpenAgents.

autopilot-data-seller-cli

390
from OpenAgentsInc/openagents

Shell-first OpenAgents DS-first Data Market packaging and publication workflow using the deterministic packaging helper, autopilotctl, and the no-window headless runtime.

autopilot-data-market-control

390
from OpenAgentsInc/openagents

Typed OpenAgents DS-first Data Market tool contract for seller publication and market read-back.

autopilot-cad-builder

390
from OpenAgentsInc/openagents

Deterministic CAD build orchestration for Autopilot Chat using openagents CAD and pane tools, including week-1 gripper flow.