Skip to content

ai: blocktank lsp api agent skill#860

Draft
ovitrif wants to merge 2 commits intomasterfrom
ai/lsp-skill
Draft

ai: blocktank lsp api agent skill#860
ovitrif wants to merge 2 commits intomasterfrom
ai/lsp-skill

Conversation

@ovitrif
Copy link
Collaborator

@ovitrif ovitrif commented Mar 23, 2026

This PR:

  1. Adds a Blocktank LSP API Claude Code plugin with full endpoint reference, workflows, and state machines
  2. Adds a ./lsp CLI wrapper for calling the Blocktank API from the repo root
  3. Adds a bitkit://dev/create-invoice deep link handler (debug builds only) for programmatic invoice creation
  4. Adds a pay-invoices.sh automation script for bulk invoice creation, payment, and block mining

Description

Introduces a Claude Code plugin at .claude/plugins/blocktank-api/ that gives Claude knowledge of the Blocktank LSP REST API (18 endpoints) and provides shell scripts for calling it. The plugin includes a skill with endpoint tables, common workflows (channel purchase, CJIT, force close), and state machine documentation.

A dev-only deep link (bitkit://dev/create-invoice?amount=N) allows creating bolt11 invoices on the app's LDK node and writing them to a file readable via ADB. This enables the pay-invoices.sh script to automate creating invoices, paying them via the LSP, and mining blocks — useful for populating the app with payment activity during testing.

The deep link handler checks canReceive() before creating invoices, matching the UI behavior of not generating bolt11s when no LN channel is available.

Preview

N/A — AI tooling, no UI changes.

QA Notes

1. Verify ./lsp wrapper

./lsp GET /info

Should return JSON with LSP node info and channel limits.

2. Verify deep link invoice creation (requires dev debug build with wallet + open channel)

adb shell am start -a android.intent.action.VIEW \
  -d "bitkit://dev/create-invoice?amount=1000" to.bitkit.dev
sleep 2
adb shell "run-as to.bitkit.dev cat files/dev/invoice.txt"

Should output a bolt11 invoice string.

Verify it can be paid afterwards using the ./lsp helper in repo root:

./lsp POST /regtest/channel/pay \
'{"invoice":"__paste_invoice_here__"}'

3. Verify deep link guard without channel

With no open LN channel, the deep link should log an error and not write an invoice file.

4. Verify full automation (requires open channel with inbound capacity)

INVOICE_COUNT=3 MINE_TOTAL=10 MINE_BATCH=10 \
  .claude/plugins/blocktank-api/skills/lsp/scripts/pay-invoices.sh

Should create 3 invoices (1, 2, 3 sats), pay each, mine 10 blocks. Payments should appear in the app's activity list.

@ovitrif ovitrif changed the title ai: blocktank lsp api plugin and dev invoice deep link ai: blocktank lsp api agent skill Mar 23, 2026
@ovitrif ovitrif self-assigned this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant