| name | readwise-cli-control |
| description | Use when a user wants to search, export, organize, or automate Readwise or Reader data from Codex or another terminal agent, especially when browser auth should be avoided and an access token is available. |
Readwise Cli Control
Overview
This skill wraps the official Readwise CLI for headless use in Codex. Use it when the user wants direct control over Readwise or Reader without browser-based OAuth, or when they provide a Readwise access token.
For terminal agents, prefer the CLI over the remote MCP server. The official Readwise docs say the CLI is usually the simpler option for Codex and supports token auth via readwise login-with-token <token>.
Decision Rule
Use this skill when the user wants any of the following:
- Search Readwise highlights or Reader documents from Codex
- Export or summarize saved articles, PDFs, newsletters, or tweets from Reader
- Organize Reader items by location, tags, shortlist/archive state, or highlights
- Authenticate Readwise with an access token instead of a browser
- Give Codex read-only or read-write control over Readwise/Reader
Do not assume the remote MCP server accepts token-based auth. The official current MCP docs document OAuth for https://mcp2.readwise.io/mcp; the official headless/token path is the CLI.
If you need the official rationale or URLs, read references/official-notes.md.
Quick Start
- Ensure the CLI is installed and authenticated with a token:
READWISE_ACCESS_TOKEN='...'
/Users/rileybrown/.codex/skills/readwise-cli-control/scripts/setup-readwise-cli.sh --readonly false
- Run commands through the JSON wrapper:
/Users/rileybrown/.codex/skills/readwise-cli-control/scripts/readwise-json.sh reader-search-documents --query "aggregation theory"
- For read-only sessions:
READWISE_ACCESS_TOKEN='...'
/Users/rileybrown/.codex/skills/readwise-cli-control/scripts/setup-readwise-cli.sh --readonly true
Authentication Workflow
- Prefer
READWISE_ACCESS_TOKEN in the shell environment over passing the token as a literal argument.
- If
readwise is missing, run the setup script; it installs @readwise/cli.
- Use
readwise login-with-token instead of readwise login.
- After changing readonly mode, refresh the CLI tool cache with
readwise --refresh.
Readonly rules:
--readonly true hides write operations and is safer for analysis-only tasks.
- If you switch readonly off after it was on, the CLI requires re-authentication. The setup script handles this by logging in again with the token.
Common Commands
Prefer readwise --json ... so downstream parsing is reliable.
Reader document tasks:
readwise --json reader-search-documents --query "topic"
readwise --json reader-list-documents --location new
readwise --json reader-get-document-details --document-id <id>
readwise --json reader-create-document --url "https://example.com/article"
readwise --json reader-move-documents --document-ids <id1>,<id2> --location archive
readwise --json reader-add-tags-to-document --document-id <id> --tags "ai,research"
readwise --json reader-create-highlight --document-id <id> --text "The key insight is..."
readwise --json reader-export-documents
Readwise highlight tasks:
readwise --json readwise-search-highlights --vector-search-term "compounding"
readwise --json readwise-get-daily-review
If you need a command not listed here, run:
readwise --help
Output Discipline
- Use JSON output for command execution.
- Summarize large results instead of pasting raw blobs unless the user explicitly wants the raw output.
- For write operations, confirm intent if the user has not clearly asked to modify their library.
- If the token is missing, ask the user for it directly instead of falling back to browser auth.
Scripts
scripts/setup-readwise-cli.sh
Installs the official CLI if needed, authenticates with READWISE_ACCESS_TOKEN, and sets readonly mode.
scripts/readwise-json.sh
Runs the official CLI with --json. If READWISE_ACCESS_TOKEN is set, it refreshes auth first.