Command line interface for Drafts on macOS.
IMPORTANT: This CLI only works on macOS with Drafts running.
| Requirement | Details |
|---|---|
| Operating System | macOS only (uses AppleScript) |
| Drafts App | Must be installed AND running |
| Drafts Pro | Required for automation features |
| Go | 1.21+ (for installation) |
This CLI will NOT work if:
- You're on Linux or Windows
- Drafts app is not installed
- Drafts app is not running (it must be open)
- You don't have Drafts Pro subscription
The CLI communicates with Drafts via AppleScript (osascript). This means:
- Drafts must be running on your Mac for any command to work
- Commands execute in the context of the running Drafts app
- All data stays local on your Mac
go install github.com/nerveband/drafts/cmd/drafts@latestgit clone https://github.com/nerveband/drafts
cd drafts
go build ./cmd/drafts
# Optionally move to PATH
mv drafts /usr/local/bin/Download from Releases (macOS only).
# Make sure Drafts is running first!
open -a Drafts
# Create a draft
drafts create "Hello from the CLI"
# List your drafts
drafts list
# Get a specific draft
drafts get <uuid>$ drafts --help
Usage: drafts [--plain] <command> [<args>]
Options:
--plain output plain text instead of JSON
--help, -h display this help and exit
Commands:
new, create create new draft
prepend prepend to draft
append append to draft
replace replace content of draft
edit edit draft in $EDITOR
get get content of draft
select select active draft using fzf
list list drafts
run run a Drafts action
schema output tool-use schema for LLM integration
upgrade upgrade to the latest version
version show version information
Create a new draft.
drafts create "Content here" [options]
Options:
-t, --tag TAG Add tag (can be used multiple times)
-a, --archive Create in archive folder
-f, --flagged Create as flagged
--action ACTION Run action after creationExamples:
drafts create "Meeting notes"
drafts create "Shopping list" -t groceries -t todo
drafts create "Important!" -fGet a draft by UUID.
drafts get [UUID] # Omit UUID to get active draftList drafts with optional filtering.
drafts list [options]
Options:
-f, --filter FILTER Filter: inbox|archive|trash|all (default: inbox)
-t, --tag TAG Filter by tag (can be used multiple times)Examples:
drafts list # List inbox
drafts list -f archive # List archived
drafts list -t work # Filter by tagAdd content to an existing draft.
drafts prepend "Text" -u UUID [options]
drafts append "Text" -u UUID [options]
Options:
-u, --uuid UUID Target draft UUID (omit to use active draft)
-t, --tag TAG Add tag
--action ACTION Run action after modificationReplace entire content of a draft.
drafts replace "New content" -u UUIDOpen draft in your $EDITOR.
drafts edit [UUID] # Omit UUID to edit active draftRun a Drafts action.
drafts run "Action Name" "Text to process"
drafts run "Action Name" -u UUID # Run on existing draftOutput tool-use schema for LLM integration.
drafts schema # Full schema
drafts schema create # Schema for specific commandUpgrade to the latest version from GitHub releases.
drafts upgrade # Check for and install updatesShow version information.
drafts version # Display current versionJSON (default) - Structured output for programmatic use:
{
"success": true,
"data": {
"uuid": "ABC-123",
"content": "Note content",
"title": "Note title",
"tags": ["tag1"],
"folder": "inbox"
}
}Plain text - Human-readable output:
drafts list --plainThis CLI is designed for LLM tool use:
- JSON output by default - Easy to parse
- Structured errors - Error code, message, and recovery hints
- Tool-use schema - Get schema with
drafts schema - Full metadata - All draft properties returned
A ClawdBot skill is available for this CLI. Install to ~/.clawdbot/skills/drafts/SKILL.md.
- Is Drafts running? The app must be open:
open -a Drafts - Is Drafts Pro active? Automation requires Pro subscription
- Permissions granted? Go to System Settings > Privacy & Security > Automation and ensure Terminal (or your app) can control Drafts
Add to your PATH:
export PATH="$PATH:$(go env GOPATH)/bin"Drafts may be showing a dialog. Check the Drafts app window.
┌─────────────┐ AppleScript ┌─────────────┐
│ drafts CLI │ ──────────────────▶ │ Drafts.app │
└─────────────┘ (osascript) └─────────────┘
- No network requests
- No helper apps
- No Drafts actions to install
- Pure local AppleScript communication
go build ./cmd/drafts # Build
go test ./... # Run tests
go vet ./... # LintMIT
Forked from ernstwi/drafts. Refactored to use AppleScript backend (no helper app required).
