Updated Emacs AI setup: gptel + gptel-agent

Published 2026-03-16

tag(s): #emacs #yell-at-cloud #programming

I won't re-iterate my hesitations around the AI hype, already wrote plenty of posts on that.
But as I said before, I feel it would be silly of me not to take advantage of the resources I have access to at work to...well, at this point it is late to stay ahead of the pack (and I don't believe in such kind of mentality anyway). More like, catch up? Try to stay relevant?

At the very least, I get to know what's the landscape of AI-assisted coding. And learn about the different tools.
From there, who knows. I might convert to a believer, or (more likely, and this is the case so far) I will have more nuanced views on the matter.

So far, doing the chat thing for rubber ducking, and replacing search with a conversational session with Copilot has been working fine.
The former is pretty great (I don't have a Justin-like coworker to constantly chat about the minutiae of each other's code).[1]
Search and conversation is hit an miss. Sometimes it is great, sometimes it misunderstands what I am looking for completely. Other times I "smell" that it is giving me BS, and I am usually right about that instinct. Not always, to be fair.
And, DDG/Google sometimes did send me on wild goose chases, too.

Code completion isn't as great for me. Because it throws me off my line of thinking, and I am fast enough typer. The cost of reading the suggestions and deciding to accept them or not is more than just typing the next thing.
And stylistically, whatever models I tried weren't close to my (code) writing. I hated most of the variable names, or the way they structured blocks, or the logging messages...
All this to say, I didn't have much use for Copilot.el. At first I kept Copilot-chat around, but after watching this video I moved to gptel, which seemed like a more integrated thing, with the feature to invoke it and replace text in buffers in-place.

And last Friday, on a call, someone shared their VS Code screen while they were doing "agentic development". Not sure if that qualifies as "vibe coding". I am not up to date on the lingo. 🙃
But that got me curious enough to try gptel-agent today. I asked it to add a binding to a command, and to commit changes...little things, just to get my feet wet.

Enough blabber, where's the code?

It's not a lot. So far?


(require 'gptel)
(setopt gptel-backend (gptel-make-gh-copilot "Copilot"
                        :host "api.business.githubcopilot.com"))

(require 'gptel-agent)
(setopt gptel-agent-dirs (list (expand-file-name "~/.config/agents")))

(defvar-keymap hoagie-gptel-keymap
  :doc "Keymap for gptel."
  :name "Gptel Copilot"
  "c" '("copilot dwim"  . gptel-send)
  "t" '("transient" . gptel-menu)
  "a" '("add..." . gptel-add)
  "f" '("free form chat" . gptel)
  "A" '("agent" . gptel-agent))
(keymap-set hoagie-shortcut-keymap "c" hoagie-gptel-keymap)
    

F5-c is my "Copilot prefix". I like having a quick binding to gpt-send, although to be honest I should use it more often. I also don't know if over time I will keep using the independent chat, or always stay within the agent thingy.
It is interesting that gptel-agent comes with four pre-configured "personalities" (personas? subagents? directives???): researcher, introspector, executor, and gptel-plan. The last one says it is for high-level stuff. ?_?

Footnotes
  1. He doesn't have an independent online presence, what should I do in these cases? Send y'all to his LinkedIn? GitHub?
    I will share this link with him and update the post ;)

Share your thoughts (via email)

Back to top

Back to homepage