Skip to main content

Cursor's Cmd+K inline prompt, but for your zsh terminal — powered by Claude.

Project description

ccli-prompt

Cursor's Cmd+K inline prompt, but for your zsh terminal.

Press Cmd+K at your prompt, type what you want ("kill port 9090", "find files bigger than 100mb", "tar this folder"), hit Enter, and a ready-to-run shell command lands on your command line. Review it, Enter to run it.

Fast because there's no claude CLI boot per call: a tiny Python daemon runs in the background, holds one open HTTPS connection to api.anthropic.com, and reuses the OAuth token you already have from Claude Code (or a plain Anthropic API key). Typical latency: ~500 ms on warm connection + Haiku inference.

Install

pipx install ccli-prompt      # recommended (isolated venv)
# or: pip install ccli-prompt

ccli-prompt install           # runs the interactive wizard (auth + model pick)

The wizard:

  1. Authentication — auto-discover from Claude Code credentials, or paste a key (accepts both sk-ant-api03-... and sk-ant-oat01-...).
  2. Model — lists live models from /v1/models. Haiku 4.5 is the default.

Requirements: macOS or Linux, zsh 5.x+, Python 3.10+. The daemon has zero dependencies (stdlib only).

Trigger it

Two ways — pick either:

Esc then K — works immediately, no terminal config needed. Press Esc, then K (sequence, not chord).

Cmd+K / Ctrl+K — remap it in your terminal to send ESC+k:

Terminal How
iTerm2 Settings → Profiles → Keys → + · Shortcut ⌘K · Action Send Escape Sequence · Esc+: k
Terminal.app Settings → Profiles → Keyboard → + · + K · Send Text · Ctrl+V then Esc, then k
Ghostty keybind = cmd+k=text:\x1bk in ~/.config/ghostty/config
Warp Settings → Keyboard → bind ⌘KSend Text · \x1bk
Alacritty [[keyboard.bindings]] with key = "K", mods = "Control", chars = "\u001bk"
Kitty map ctrl+k send_text all \x1bk in ~/.config/kitty/kitty.conf
WezTerm {key="k", mods="CTRL", action=wezterm.action.SendString("\x1bk")}

How it works

  • ccli-prompt install — copies a zsh widget to ~/.ccli-prompt/ccli.zsh, appends a source line to your ~/.zshrc, and runs the wizard.
  • The widget (bound to ^[k — what Esc+K and remapped Cmd+K send) reads your query via read-from-minibuffer, sends it over a Unix socket to the daemon, and places the response into $BUFFER so nothing runs until you press Enter.
  • The daemon (python3 -m ccli_prompt.daemon, auto-spawned on first use) reads auth from: env var → ~/.ccli-prompt/config → macOS Keychain → ~/.claude/.credentials.json. It opens one HTTPSConnection to api.anthropic.com and keeps it warm, POSTs to /v1/messages (Bearer+OAuth-beta or x-api-key depending on token prefix), caches the system prompt, and exits after 30 minutes of idleness.

Configuration

Environment variables (override the config file; set in ~/.zshrc before the source line):

export ANTHROPIC_API_KEY="sk-ant-..."       # API key or OAuth token
export CCLI_MODEL="claude-haiku-4-5"
export CCLI_MAX_TOKENS=400
export CCLI_IDLE_TIMEOUT=1800
export CCLI_SYSTEM_PROMPT_FILE="$HOME/.ccli-prompt/prompt.md"

Re-run the wizard at any time: ccli-prompt configure.

Edit the system prompt at ~/.ccli-prompt/prompt.md (copied from the package on install).

Manual daemon control

# status
[[ -S /tmp/ccli-$USER.sock ]] && echo "running" || echo "not running"

# stop
pkill -f ccli_prompt.daemon; rm -f /tmp/ccli-$USER.sock

# start manually (normally auto-starts on first Cmd+K)
python3 -m ccli_prompt.daemon &

Safety

  • Daemon's Unix socket is 0600, scoped to your user.
  • Responses only land in $BUFFER — nothing executes until you press Enter.
  • The default system prompt refuses destructive commands (rm -rf /, dd, disk formatting, force-push to main, etc.) unless you request them in those exact terms.

Uninstall

ccli-prompt uninstall
pipx uninstall ccli-prompt   # or: pip uninstall ccli-prompt

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccli_prompt-0.1.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccli_prompt-0.1.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file ccli_prompt-0.1.1.tar.gz.

File metadata

  • Download URL: ccli_prompt-0.1.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccli_prompt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 19ad16c87d2c5d953cdb8368c3205156d612d29e1988e5c88578301d73ea21cf
MD5 892346c8e12ea3ba445a9ee1ed2cb027
BLAKE2b-256 491cf754dd8e7635ac6182ca23e866ed74ffc6ebac721982ae5cc8c7dfbf386d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccli_prompt-0.1.1.tar.gz:

Publisher: workflow.yml on lucastononro/ccli-prompt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ccli_prompt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ccli_prompt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccli_prompt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9bacdb4b9bbaa00cc36d5117cf285e2100e01e5ae3c69fd779f2db874993e926
MD5 d093ee2476d7156acff7d63d05ebc9ca
BLAKE2b-256 b071efa066e527f534280c6dbc8ed914522d61fe89cfe4d67a24efdd54824518

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccli_prompt-0.1.1-py3-none-any.whl:

Publisher: workflow.yml on lucastononro/ccli-prompt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page