Emacs agent-shell (由 ACP 提供支持)
Emacs agent-shell (powered by ACP)

原始链接: https://xenodium.com/introducing-agent-shell

## Emacs Agent-Shell:原生代理体验 一个新的 Emacs 包,**agent-shell**,提供了与 AI 代理交互的原生 shell 体验,由 Agent Client Protocol (ACP) 提供支持。与 **acp.el** 库(Emacs Lisp 的 ACP 实现)一同开发,agent-shell 旨在将 AI 代理无缝集成到 Emacs 工作流程中。 与典型的代理交互不同,agent-shell 利用 Emacs 的 `comint-mode`,将代理交互视为常规缓冲区——无需在字符模式和行模式之间切换。ACP 的一个关键优势是其代理无关的方法;用户可以通过配置客户端轻松切换代理(例如 Gemini 和 Claude Code,如示例所示)。 为了辅助开发并降低成本,作者还创建了一个用于检查 ACP 通信的“流量缓冲区”和一个重放记录会话的“假代理”系统。 `agent-shell` 和 `acp.el` 现在可在 GitHub 上获取,作者欢迎贡献和反馈。也请求资金支持持续开发,因为使用云 LLM 服务会产生费用。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Emacs agent-shell (由 ACP 提供支持) (xenodium.com) 12 分,Karrot_Kream 发表于 22 分钟前 | 隐藏 | 过去 | 收藏 | 1 条评论 另请参阅:https://xenodium.com/agent-shell-0-5-improvements xenodium 发表于 10 分钟前 [–] agent-shell:一个原生的 Emacs 体验,用于与由 ACP(Agent Client Protocol)https://agentclientprotocol.com 提供支持的不同 AI 代理交互。回复 考虑申请 YC 2026 冬季批次!申请截止日期为 11 月 10 日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文
Introducing Emacs agent-shell (powered by ACP)

Not long ago, I introduced acp.el, an Emacs lisp implementation of ACP (Agent Client Protocol), the agent protocol developed between Zed and Google folks.

While I've been happily accessing LLMs from my beloved text editor via chatgpt-shell (a multi-model package I built), I've been fairly slow on the AI agents uptake. Probably a severe case of old-man-shouts-at-cloud sorta thing, but hey I want well-integrated tools in my text editor. When I heard of ACP, I knew this was the thing I was waiting for to play around with agents.

With an early acp.el client library in place, I set out to build an Emacs-native agent integration… Today, I have an initial version of agent-shell I can share.

agent-shell is a native Emacs shell, powered by comint-mode (check out Mickey's comint article btw). As such, we don't have to dance between char and line modes to interact with things. agent-shell is just a regular Emacs buffer like any other you're used to.

Agent-agnostic

Thanks to ACP, we can now build agent-agnostic experiences by simply configuring our clients to communicate with their respective agents using a common protocol. As users, we benefit from a single, consistent experience, powered by any agent of our choice.

Configuring different agents from agent-shell boils down which agent we want running in the comms process. Here's an example of Gemini CLI vs Claude Code configuration:

(defun agent-shell-start-gemini-agent ()
  "Start an interactive Gemini CLI agent shell."
  (interactive)
  (agent-shell--start
   :new-session t
   :mode-line-name "Gemini"
   :buffer-name "Gemini"
   :shell-prompt "Gemini> "
   :shell-prompt-regexp "Gemini> "
   :needs-authentication t
   :authenticate-request-maker (lambda ()
                                 (acp-make-authenticate-request :method-id "gemini-api-key"))
   :client-maker (lambda ()
                   (acp-make-client :command "gemini"
                                    :command-params '("--experimental-acp")
                                    :environment-variables (list (format "GEMINI_API_KEY=%s" (agent-shell-google-key)))))))
(defun agent-shell-start-claude-code-agent ()
  "Start an interactive Claude Code agent shell."
  (interactive)
  (agent-shell--start
   :new-session t
   :mode-line-name "Claude Code"
   :buffer-name "Claude Code"
   :shell-prompt "Claude Code> "
   :shell-prompt-regexp "Claude Code> "
   :client-maker (lambda ()
                   (acp-make-client :command "claude-code-acp"
                                    :environment-variables (list (format "ANTHROPIC_API_KEY=%s" (agent-shell-anthropic-key)))))))

I've yet to try other agents. If you get another agent running, I'd love to hear about it. Maybe submit a pull request?

Traffic

While I've been relying on my acp.el client library, I'm still fairly new to the protocol. I often inspect traffic to see what's going on. After staring at json for far too long, I figured I may as well build some tooling around acp.el to make my life easier. I added a traffic buffer for that. From agent-shell, you can invoke it via M-x agent-shell-view-traffic.

Fake agents

Developing agent-shell against paid agents got expensive quickly. Not only expensive, but my edit-compile-run cycle also became boringly slow waiting for agents. While I knew I wanted some sort of fake agent to work against, I didn't want to craft the fake traffic myself. Remember that traffic buffer I showed ya? Well, I can now save that traffic to disk and replay it later. This enabled me to run problematic sessions once and quickly replay multiple times to fix things. While re-playing has its quirks and limitations, it's done the job for now.

You can see a Claude Code session below, followed by its replayed counterpart via fake infrastructure.

What's next

Getting here took quite a bit of work. Having said that, it's only a start. I myself need to get more familiar with agent usage and evolve the package UX however it feels most natural within its new habitat. Lately, I've been experimenting with a quick diff buffer, driven by n/p keys, shown along the permission dialog.

#+ATTR_HTML: :width 99%

While I've implemented enough parts of the Agent Client Protocol Schema to make the package useful, it's hardly complete. I've yet to fully familiarize myself with most protocol features.

Take them for a spin

Both of my new Emacs packages, agent-shell and acp.el, are now available on GitHub. As an agent user, go straight to agent-shell. If you're a package author and would like to build an ACP experience, then give acp.el a try. Both packages are brand new and may have rough edges. Be sure to file bugs or feature requests as needed.

I've been heads down, working on these packages for some time. If you're using cloud LLM services, you're likely already paying for tokens. If you find my work useful, please consider routing some of those coins to help fund it. Maybe my tools make you more productive at work? Ask your employer to support the work. These packages not only take time and effort, but also cost me money. Help fund the work.

powered by LMNO.lol

privacy policy · terms of service

联系我们 contact @ memedata.com