An Emacs coding assistant that provides a two-pane interface: chat on the left and the current file on the right. It supports Claude (Anthropic) and GPT (OpenAI), streams responses, and can run tools with configurable approvals.
- Two-pane layout for chat + file view
- Streaming responses from Anthropic and OpenAI
- Built-in tools for file I/O, shell commands, and search
- Configurable approval modes for tool execution
- Model selection across providers
- Emacs 27.1+
- An API key for Anthropic or OpenAI
Manual setup:
(add-to-list 'load-path "/path/to/harp")
(require 'harp);; API keys
(setq harp-api-key-anthropic "your-anthropic-key")
;; or
(setq harp-api-key-openai "your-openai-key")
;; Provider and model
(setq harp-default-provider 'anthropic)
(setq harp-model "claude-sonnet-4-20250514")
(setq harp-max-tokens 8192)
;; Tool approvals: none, dangerous-only, full
(setq harp-approval-mode 'dangerous-only)
;; Optional per-project overrides
;; (setq harp-project-approval-alist '(("/abs/project/root" . full)))See CONFIG.md for a complete list of customization options.
M-x harp-startto open the two-pane interfaceM-x harp-quitto close itM-x harp-select-modelto switch models and providers
In the chat buffer:
| Key | Action |
|---|---|
RET / C-c C-c |
Send message or approve tool |
y / n |
Approve or reject tool prompts |
C-c C-k |
Cancel the current request |
M-n |
Jump to next file link |
M-p |
Jump to previous file link |
C-c C-o |
Open file link at point |
C-c C-l |
List all file links in buffer |
Responses are automatically highlighted:
- Fenced code blocks (
```) get language-specific syntax highlighting when the major mode is available - Inline code (
`code`) is rendered in a distinct face - File paths like
/path/to/file.el:42become clickable links- Click or press
RETto open in the file pane - Paths from
write_file/edit_fileresults are shown in orange to indicate modifications - Line numbers are supported—opening jumps to the specified line
- Click or press
read_file- read a filewrite_file- write a fileedit_file- replace exact text in a filerun_shell- run a shell commandglob- find files by patterngrep- search with regexlist_directory- list directory contents
Tool approvals are controlled by harp-approval-mode and can be overridden
per project with harp-project-approval-alist.
# Byte-compile all .el files
emacs -Q -batch -L . -f batch-byte-compile *.el
# Treat warnings as errors
emacs -Q -batch -L . --eval "(setq byte-compile-error-on-warn t)" -f batch-byte-compile *.el
# Run tests (if present)
emacs -Q -batch -L . -l harp-test.el -f ert-run-tests-batch-and-exitMIT. See LICENSE.