Package Exports
- @shakespeare.diy/opencode-plugin
- @shakespeare.diy/opencode-plugin/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shakespeare.diy/opencode-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@shakespeare.diy/opencode-plugin
OpenCode plugin for Shakespeare AI provider with NIP-46 remote signing and Nostr development tools.
Features
- Shakespeare AI Provider: Use Claude and other models via Shakespeare AI with NIP-98 authentication
- NIP-46 Remote Signing: Authenticate via QR code scan - your private key never leaves your signer app
- Shakespeare Deploy: Deploy static sites to shakespeare.wtf
- Nostr Git (ngit): Publish repositories to decentralized git hosting using NIP-34
- mkstack Integration: Initialize new Nostr projects using the mkstack framework
- Shakespeare Agent: Specialized AI agent for building Nostr applications
Installation
Option A: Global Installation (Recommended)
Install once and use in all projects:
mkdir -p ~/.config/opencode
cat > ~/.config/opencode/opencode.json << 'EOF'
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@shakespeare.diy/opencode-plugin"]
}
EOFThen restart OpenCode - it will auto-install the plugin.
Option B: Per-Project Installation
Add to your project's opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@shakespeare.diy/opencode-plugin"]
}The plugin will automatically configure the Shakespeare AI provider and models on first run.
(Optional) Install the Shakespeare agent
The Shakespeare agent provides natural language commands for Nostr development:
mkdir -p ~/.config/opencode/agent
cp node_modules/@shakespeare.diy/opencode-plugin/agent/shakespeare.md ~/.config/opencode/agent/(Optional) Add the Nostr MCP server
For enhanced Nostr functionality:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@shakespeare.diy/opencode-plugin"],
"mcp": {
"nostr": {
"type": "local",
"command": ["npx", "-y", "@nostrbook/mcp@latest"]
}
}
}Authentication
Shakespeare AI uses NIP-46 remote signing for authentication. This means:
- Your private key (nsec) never leaves your signer app
- You authenticate by scanning a QR code
- Authentication persists across sessions
Connect to Shakespeare AI
- Start OpenCode in your project
- Run
shakespeare_connect- a QR code will be displayed - Scan the QR code with your signer app (Amber or Primal)
- Approve the connection in your signer app
- Run
shakespeare_completeto finish the connection
> shakespeare_connect
[QR Code displayed]
Scan with Amber (Android) or Primal (iOS/Android)
> shakespeare_complete
Connected successfully!
User pubkey: npub1...Check connection status
> shakespeare_status
Connected: Yes
Public Key: npub1...
Relays: wss://relay.nsec.appSelect Shakespeare AI model
After connecting, select a Shakespeare model via /models or /connect:
- Press
/connectand search for "Shakespeare" - Select "Nostr (NIP-46)" authentication
- Choose a model (e.g.,
claude-sonnet-4.5)
Or set it in your opencode.json:
{
"plugin": ["@shakespeare.diy/opencode-plugin"],
"model": "shakespeare/claude-sonnet-4.5"
}Available Models
The plugin automatically fetches available models from Shakespeare AI. Current models include:
claude-sonnet-4.5- Fast, capable model for most tasksclaude-opus-4.5- Most capable model for complex tasks
Available Tools
| Tool | Description |
|---|---|
shakespeare_connect |
Display QR code to initiate NIP-46 connection |
shakespeare_complete |
Complete the connection after scanning QR code |
shakespeare_status |
Check authentication status |
shakespeare_disconnect |
Disconnect and clear credentials |
shakespeare_sign_event |
Sign a Nostr event using remote signer |
shakespeare_get_pubkey |
Get connected user's public key |
shakespeare_init |
Initialize a new mkstack project |
shakespeare_deploy |
Deploy dist/ to shakespeare.wtf |
shakespeare_ngit |
Publish repository to Nostr Git (NIP-34) |
Usage Examples
Using Shakespeare AI for coding
Once connected, Shakespeare AI works like any other provider:
> Help me build a REST API endpoint
[Claude responds via Shakespeare AI with NIP-98 authentication]Deploy a site
> shakespeare_deploy
Building site from dist/...
Deploying to shakespeare.wtf...
Your site is live at: https://yourapp.shakespeare.wtfPublish to Nostr Git
> shakespeare_ngit
Publishing repository to Nostr Git...
Published!
Repository: my-project
Clone with: git clone nostr://npub1.../my-projectInitialize a new project
> shakespeare_init my-nostr-app
Cloning mkstack template...
Installing dependencies...
Project created at ./my-nostr-appConfiguration
Default Relays
The plugin uses this relay for NIP-46 communication:
wss://relay.nsec.app
Specify custom relays when connecting:
> shakespeare_connect with relays wss://my-relay.com,wss://other-relay.comAuthentication Storage
Credentials are stored in ~/.config/shakespeare/auth.json:
- Client keypair (for relay communication only)
- Bunker public key
- User public key
- Connected relays
Your private key is never stored - it remains in your signer app.
Supported Signer Apps
Troubleshooting
"Not connected to Nostr" error
Run shakespeare_connect followed by shakespeare_complete to establish a connection.
Models not appearing
The plugin auto-configures on first run. If models don't appear:
- Restart OpenCode
- Check that
opencode.jsonhas theprovider.shakespearesection - Run
/connectand select Shakespeare AI
Connection not persisting
Check that ~/.config/shakespeare/auth.json exists after connecting. If it's being deleted, there may be a permission issue with the config directory.
QR code not scanning
- Ensure your signer app supports NIP-46 (nostrconnect://)
- Try different relays if the default ones are unreachable
- Check that your phone and computer are on the same network (not required, but helps)
Development
# Clone the repo
git clone https://gitlab.com/soapbox-pub/shakespeare-opencode-plugin
cd shakespeare-opencode-plugin
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run devLicense
MIT