Skip to content
oetrPublic

About

ENslop / DEslop

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Ende: LLM harness for Emacs

Ask questions, improve text, and work with AI agents without leaving Emacs.

  • Chat in Org files and keep conversations alongside your notes.
  • Write with help inserting, summarizing, and reviewing changes to text.
  • Work on projects with agents that can inspect files, make edits, and run tests when you allow them.
  • Keep working while jobs run in the background; monitor or cancel them from the dashboard.

Getting started

You’ll need Emacs 30.1 or later and curl. Ende supports local servers such as llama.cpp, plus OpenAI, OpenAI Codex, Anthropic, DeepSeek, and OpenRouter.

Clone Ende and add the following to your Emacs init file. Adjust the checkout path and server address to suit your setup.

(add-to-list 'load-path "/path/to/ende-mode/lisp")
(require 'ende)
(setq ende-providers '(openai-codex local deepseek openrouter))

(setq ende-builtin-provider-settings
      '((openai :transport auto)
        (openai-codex
         :auth-method codex-oauth
         :account default
         :transport websocket)))

(setq ende-custom-providers
      '((local
         :display-name "llama.cpp ⏿"
         :api openai-chat-completions
         :auth-method none
	 :chat-system-layout leading-only
         :base-url "http://localhost:9931/v1/"
	 :models-url "http://localhost:9931/v1/models")
	))

(global-set-key (kbd "C-c e") #'ende-selector-open)

Your ~/.authinfo.gpg can look like this:

machine openrouter.ai port 443 login default password ****
machine api.deepseek.com port 443 login default password ****
  1. Start your llama.cpp server with a model loaded.
  2. Write a question as an Org heading and place point on it.
  3. Press C-c e, select local with n or p, choose a model with m, then press a to ask.

To see your jobs, press C-c e, then d. Hosted providers also need credentials, configured through Emacs auth-source or OAuth, as appropriate.

Configuration

Ende has two layers of configuration: Emacs settings for providers and defaults, and Org blocks for the permissions of a conversation.

Providers and models

In the init file example above, ende-providers controls which profiles appear in the selector. Use ende-builtin-provider-settings to configure built-in profiles and ende-custom-providers for your own servers.

The selector lets you switch providers with n and p, choose a model with m, and adjust available model controls. It remembers your choices per buffer for the current Emacs session by default.

You can also set defaults in a profile. For example, replace the local entry above with this one, using the model ID and context size of your server:

(local :display-name "llama.cpp ⏿"
       :api openai-chat-completions
       :auth-method none
       :chat-system-layout leading-only
       :base-url "http://localhost:9931/v1/"
       :models ("YOUR-MODEL-ID")
       :context-window 32768
       :model-settings (("YOUR-MODEL-ID" :temperature 0.2)))

:models sets a fixed list instead of discovering models; its first entry is selected initially. Omit it to use discovery. Profile settings can also include :output-tokens, :request-timeout, and :max-concurrency.

For hosted APIs, store keys in a netrc or plstore auth-source file such as .authinfo.gpg; the host, numeric port, and login must match the profile. For Codex OAuth, select openai-codex, press A to open the connection editor, then l to sign in. After completing the browser login, press RET in the editor to apply it.

Emacs-wide options

Run M-x customize-group RET ende RET to browse settings and their descriptions. You can also set them in your init file. For example:

(setq ende-model-selection-scope 'global     ; share choices across buffers
      ende-auto-compact '(:tokens 24000))    ; compact long chats automatically

Choose a compaction threshold appropriate for your model’s context size. Other options include ende-insert-instruction and ende-history-retain-prompts; use C-h v to read what each setting does.

Agent permissions

By default, no project, web, or command tools are enabled; the progress tool remains available. Decide which tools and files an agent can use. For example, put this block in an Org chat file at your project root to allow searching and reading any Python file in the project without allowing edits or commands:

#+begin_ende
(root ".")
(clear-tools)
(resource source :type file (include "*.py"))
(tools search_project read_file)
(set-tool-resources search_project read_file :resources source)
#+end_ende

A block before the first heading applies to the file; a block under a heading applies to that subtree. With point on a question heading, use M-x ende-inspect-config-at-point to check the effective permissions. Agent work requires a model and connection that support tool calling.

Here, resource defines the allowed files, tools enables actions, and set-tool-resources connects the two. The root "." is the chat buffer’s default-directory, normally the chat file’s directory. Change *.py to match your project.

Add capabilities

Add these forms inside the same block to allow edits to the permitted files:

(tools edit_file)
(set-tool-resources edit_file :resources source)

edit_file changes files on disk, not unsaved visiting buffers. To allow fetching a particular documentation site, add:

(resource docs :type url (include "https://docs.python.org/3/**"))
(tools web_fetch)
(set-tool-resources web_fetch :resources docs)

For a specific host command, enable it and give it an exact allowlist:

(tools run_host_command)
(restrict-host-commands (:fixed-args "git" "status" "--short"))

Host commands run with Emacs’s permissions and are not confined by file resources. Without a restriction, the host-command tool allows any command.

For builds and tests, you can instead grant a disposable sandbox. For sandbox-only commands, omit the host-command forms above. Add these forms, replacing the image placeholder with a locally available image and its SHA-256 digest:

(resource build-files :type file (include "*.py") (include "Makefile"))
(podman-image "your-image@sha256:YOUR-64-HEX-DIGEST")
(tools run_sandbox_command)
(set-tool-resources run_sandbox_command :resources build-files)

Include the files your build needs. The sandbox requires rootless Podman and writable /dev/shm.

Reuse and delegation

To reuse a policy, save its forms in a local file and use (config ".ende/read-only.conf") inside an Ende block instead of pasting them each time. Paths are relative to the chat buffer’s default-directory; nested imports are relative to the importing file. Only import policies you trust.

You can also add a read-only reviewer to the example above:

(agent-config reviewer
  (purpose "Review Python code without editing it.")
  (root ".")
  (tools search_project read_file)
  (set-tool-resources search_project read_file :resources source))
(tools spawn_agent)
(spawn-agent-config reviewer)

The reviewer has its own tool permissions; it does not automatically inherit the caller’s access. The last two forms allow the caller to delegate to that role.

About

ENslop / DEslop

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages