[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-xenodium--agent-shell":3,"tool-xenodium--agent-shell":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",158594,2,"2026-04-16T23:34:05",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":68,"readme_en":69,"readme_zh":70,"quickstart_zh":71,"use_case_zh":72,"hero_image_url":73,"owner_login":74,"owner_name":75,"owner_avatar_url":76,"owner_bio":75,"owner_company":75,"owner_location":77,"owner_email":75,"owner_twitter":74,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":32,"env_os":89,"env_gpu":90,"env_ram":90,"env_deps":91,"category_tags":99,"github_topics":100,"view_count":32,"oss_zip_url":75,"oss_zip_packed_at":75,"status":17,"created_at":111,"updated_at":112,"faqs":113,"releases":148},8337,"xenodium\u002Fagent-shell","agent-shell","A native Emacs buffer to interact with LLM agents powered by ACP","agent-shell 是一款专为 Emacs 编辑器打造的本地化终端工具，旨在让用户直接在熟悉的编辑环境中与大语言模型（LLM）智能体进行自然交互。它基于 ACP（Agent Client Protocol，智能体客户端协议）构建，充当了 Emacs 与各类先进 AI 助手之间的桥梁。\n\n对于长期依赖 Emacs 的开发者和技术人员而言，传统的工作流往往需要在编辑器与外部命令行工具或网页聊天界面之间频繁切换，这不仅打断思路，也降低了编码效率。agent-shell 完美解决了这一痛点，它将对话体验原生融入 Emacs 缓冲区，用户无需离开当前环境即可调用 Claude Agent、Gemini CLI、Mistral Vibe 等主流 AI 智能体来完成代码生成、调试或复杂任务规划。\n\n该工具特别适合热衷于提升工作流效率的软件工程师、研究人员以及 Emacs 重度用户。其核心技术亮点在于对 ACP 协议的深度支持，这使得它具有极佳的扩展性和兼容性，能够轻松对接任何遵循该协议的智能体。此外，agent-shell 拥有活跃的社区生态，提供了包括沙箱运行、多会话管理、移动端协同及代码审查","agent-shell 是一款专为 Emacs 编辑器打造的本地化终端工具，旨在让用户直接在熟悉的编辑环境中与大语言模型（LLM）智能体进行自然交互。它基于 ACP（Agent Client Protocol，智能体客户端协议）构建，充当了 Emacs 与各类先进 AI 助手之间的桥梁。\n\n对于长期依赖 Emacs 的开发者和技术人员而言，传统的工作流往往需要在编辑器与外部命令行工具或网页聊天界面之间频繁切换，这不仅打断思路，也降低了编码效率。agent-shell 完美解决了这一痛点，它将对话体验原生融入 Emacs 缓冲区，用户无需离开当前环境即可调用 Claude Agent、Gemini CLI、Mistral Vibe 等主流 AI 智能体来完成代码生成、调试或复杂任务规划。\n\n该工具特别适合热衷于提升工作流效率的软件工程师、研究人员以及 Emacs 重度用户。其核心技术亮点在于对 ACP 协议的深度支持，这使得它具有极佳的扩展性和兼容性，能够轻松对接任何遵循该协议的智能体。此外，agent-shell 拥有活跃的社区生态，提供了包括沙箱运行、多会话管理、移动端协同及代码审查接口在内的丰富扩展插件，帮助用户构建高度定制化的 AI 辅助开发环境。通过 agent-shell，用户可以享受无缝衔接的人机协作体验，让 AI 真正成为编辑工作流中不可或缺的一部分。","#+TITLE: Emacs Agent Shell\n#+AUTHOR: Álvaro Ramírez\n\n[[https:\u002F\u002Fmelpa.org\u002F#\u002Fagent-shell][file:https:\u002F\u002Fmelpa.org\u002Fpackages\u002Fagent-shell-badge.svg]]\n\n👉 [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][Support this work via GitHub Sponsors]] by [[https:\u002F\u002Fgithub.com\u002Fxenodium][@xenodium]] (check out my [[https:\u002F\u002Fxenodium.com][blog]])\n\n[[file:agent-shell.png]]\n\n* This project needs your funding\n\nAs you pay for those useful LLM tokens, consider [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][sponsoring]] development and maintenance of this project. With your help, I can make this effort more [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][sustainable]].\n\nThank you!\n\n[[https:\u002F\u002Fxenodium.com\u002F][Alvaro]]\n\n* agent-shell\n\nA native Emacs shell to interact with LLM agents powered by ACP ([[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]]).\n\nWith agent-shell, you can chat with the likes of Gemini CLI, Claude Agent, Auggie, Mistral Vibe, or any other ACP-driven agent.\n\nWatch on [[https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=R2Ucr3amgGg][YouTube]]\n\n[[https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=R2Ucr3amgGg][file:yt.png]]\n\n* News\n\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-0-47-1-updates][agent-shell 0.47 updates]].\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-0-25-updates][agent-shell 0.25 updates]].\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-016-improvements-melpa][agent-shell 0.17 improvements + MELPA]].\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-0-5-improvements][agent-shell 0.5 improvements]].\n- [[https:\u002F\u002Fxenodium.com\u002Fintroducing-agent-shell][Introducing Emacs agent-shell (powered by ACP)]].\n- [[https:\u002F\u002Fxenodium.com\u002Fintroducing-acpel][Introducing acp.el]].\n\n* Related projects\n\n=agent-shell= relies on [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Facp.el][acp.el]] to communicate with agents via ACP ([[https:\u002F\u002Fagentclientprotocol.com\u002F][Agent Client Protocol]]).\n\nWe now have a handful of additional packages to extend the =agent-shell= experience:\n\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Femacs-skills][emacs-skills]]: Claude Agent skills for Emacs.\n- [[https:\u002F\u002Fgithub.com\u002FElleNajt\u002Fagent-shell-to-go][agent-shell-to-go]]: Interact with =agent-shell= sessions from your mobile or any other device via Slack.\n- [[https:\u002F\u002Fgithub.com\u002FEmbedded-Focus\u002Fagent-circus][agent-circus]]: Run AI coding agents in sandboxed Docker containers.\n- [[https:\u002F\u002Fgithub.com\u002Fcmacrae\u002Fagent-shell-sidebar][agent-shell-sidebar]]: A sidebar add-on for =agent-shell=.\n- [[https:\u002F\u002Fgithub.com\u002Fdcluna\u002Fagent-shell-bookmark][agent-shell-bookmark]]: Bookmark support for agent-shell sessions.\n- [[https:\u002F\u002Fgithub.com\u002Fgveres\u002Fagent-shell-workspace][agent-shell-workspace]]: Dedicated tab-bar workspace for managing multiple =agent-shell= sessions.\n- [[https:\u002F\u002Fgithub.com\u002Fjethrokuan\u002Fagent-shell-manager][agent-shell-manager]]: Tabulated view and management of =agent-shell= buffers.\n- [[https:\u002F\u002Fgithub.com\u002Fnineluj\u002Fagent-review][agent-review]]: Code review interface for =agent-shell=.\n- [[https:\u002F\u002Fgithub.com\u002Fultronozm\u002Fagent-shell-attention.el][agent-shell-attention.el]]: Mode-line attention tracker for =agent-shell=.\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell-knockknock][agent-shell-knockknock]]: Notifications for =agent-shell= via [[https:\u002F\u002Fgithub.com\u002Fkonrad1977\u002Fknockknock][knockknock.el]].\n- [[https:\u002F\u002Fgithub.com\u002Fzackattackz\u002Fagent-shell-notifications][agent-shell-notifications]]: Desktop notifications for =agent-shell= events.\n- [[https:\u002F\u002Fgithub.com\u002FElleNajt\u002Fmeta-agent-shell][meta-agent-shell]]: Multi-agent coordination system for =agent-shell= with inter-agent communication, task tracking, and project-level dispatching.\n- [[https:\u002F\u002Fgithub.com\u002Fcxa\u002Fagent-shell-macext][agent-shell-macext]]: macOS-specific enhancements for =agent-shell=.\n\n* Icons\n\nThanks to [[https:\u002F\u002Fgithub.com\u002Flobehub\u002Flobe-icons][Lobe Icons]] for the lovely icons.\n\n* Setup\n\n** External dependencies\n\n*** Claude Agent SDK\n\nFor Anthropic's [[https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Foverview][Claude Agent]] (formerly known as the Claude Code), follow [[https:\u002F\u002Fgithub.com\u002Fagentclientprotocol\u002Fclaude-agent-acp][claude-agent-acp instructions]], typically something like:\n\n#+begin_src bash\nnpm install -g @agentclientprotocol\u002Fclaude-agent-acp\n#+end_src\n\n*Note:* The =-g= flag is required to install the binary globally so it's available in your PATH. After installation, verify it's available by running =which claude-agent-acp= in your terminal.\n\nOptionally: You may also need [[https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Foverview][Claude Agent]] itself if you want to use a Claude subscription (run the CLI outside of Emacs at least once to log in to your subscription and then use =agent-shell= from Emacs). Follow Claude Agent's [[https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Foverview#get-started][get started]] for installation.\n\n*** Codex\n\nFor OpenAI's Codex, install [[https:\u002F\u002Fgithub.com\u002Fzed-industries\u002Fcodex-acp][zed\u002Fcodex-acp]] and ensure the `codex-acp` executable is in PATH.\n\n*** Gemini CLI\n\nFor Google's [[https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli][Gemini CLI]], be sure to get a recent release supporting the =--experimental-acp= flag.\n\n*** Goose\n\nFor Goose CLI, install [[https:\u002F\u002Fblock.github.io\u002Fgoose\u002Fdocs\u002Fgetting-started\u002Finstallation][goose]] and ensure the `goose` executable is in PATH.\n\n*** Cursor\n\nFor Cursor agent, install with:\n\n#+begin_src bash\nnpm install -g @blowmage\u002Fcursor-agent-acp\n#+end_src\n\nSee https:\u002F\u002Fgithub.com\u002Fblowmage\u002Fcursor-agent-acp-npm for details.\n\n*** Kiro CLI\n\nFor Kiro CLI, install with:\n\n#+begin_src bash\ncurl -fsSL https:\u002F\u002Fcli.kiro.dev\u002Finstall | bash\n#+end_src\n\nSee https:\u002F\u002Fkiro.dev\u002Fdocs\u002Fcli\u002Facp\u002F for details.\n\n*** Qwen Code\n\nFor Qwen Code, install with:\n\n#+begin_src bash\nnpm install -g @qwen-code\u002Fqwen-code@latest\n#+end_src\n\nSee https:\u002F\u002Fgithub.com\u002FQwenLM\u002Fqwen-code for details.\n\n*** Auggie\n\nFor Auggie CLI, install with:\n\n#+begin_src bash\nnpm install -g @augmentcode\u002Fauggie\n#+end_src\n\nSee https:\u002F\u002Fdocs.augmentcode.com\u002Fcli\u002Foverview for details.\n*** Mistral Vibe\n\nFor Mistral Vibe, install with:\n\n#+begin_src bash\nuv tool install mistral-vibe\n#+end_src\n\nSee https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fmistral-vibe for details.\n\n*** Factory Droid\n\nFor Factory Droid, install the =droid-acp= client:\n\n#+begin_src bash\nnpm install -g droid-acp\n#+end_src\n\nSee https:\u002F\u002Fgithub.com\u002Fyaonyan\u002Fdroid-acp for details.\n\n*** Pi\n\nFor Pi coding agent, install the =pi-acp= adapter:\n\n#+begin_src bash\nnpm install -g pi-acp\n#+end_src\n\nSee https:\u002F\u002Fgithub.com\u002Fsvkozak\u002Fpi-acp for details.\n\n** Installation\n\n=agent-shell= is powered by built-in =comint-shell=, via [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fshell-maker][shell-maker]], available on [[https:\u002F\u002Fmelpa.org\u002F#\u002Fshell-maker][MELPA]].\n\nBoth [[https:\u002F\u002Fmelpa.org\u002F#\u002Fagent-shell][agent-shell]] and its dependency [[https:\u002F\u002Fmelpa.org\u002F#\u002Facp][acp.el]] are now available on MELPA.\n\nYou can install via:\n\n#+begin_src emacs-lisp\n  (use-package agent-shell\n      :ensure t\n      :ensure-system-package\n      ;; Add agent installation configs here\n      ((claude . \"brew install claude-code\")\n       (claude-agent-acp . \"npm install -g @agentclientprotocol\u002Fclaude-agent-acp\")))\n#+end_src\n\nThis will automatically install the required dependencies ([[https:\u002F\u002Fmelpa.org\u002F#\u002Facp][acp.el]] and [[https:\u002F\u002Fmelpa.org\u002F#\u002Fshell-maker][shell-maker]]).\n\n*** Doom Emacs\n\nIf you are using Doom Emacs and would like to use the =package!= macro:\n\n#+begin_src emacs-lisp\n(package! shell-maker)\n(package! acp)\n(package! agent-shell)\n#+end_src\n\nRun =doom sync= and restart.\n\nInclude =require= before configuration:\n\n#+begin_src emacs-lisp\n(require 'acp)\n(require 'agent-shell)\n;; rest of config...\n#+end_src\n\n** Configuration\n\nConfigure authentication for the agent providers you want to use.\n\n*** Environment variables\n\nPass environment variables to the spawned agent process by customizing the `agent-shell-*-environment` variable with `agent-shell-make-environment-variables`. The helper accepts key\u002Fvalue pairs and exports them when the agent starts.\n\n#+begin_src emacs-lisp\n(setq agent-shell-anthropic-claude-environment\n      (agent-shell-make-environment-variables\n       \"ANTHROPIC_API_KEY\" (auth-source-pass-get 'secret \"anthropic-api-key\")\n       \"HTTPS_PROXY\" \"http:\u002F\u002Fproxy.example.com:8080\"))\n#+end_src\n\n**** Inheriting environment variables\n\nBy default, the agent process starts with a minimal environment. To inherit environment variables from the parent Emacs process, use the `:inherit-env t` parameter in `agent-shell-make-environment-variables`:\n\n#+begin_src emacs-lisp\n  (setenv \"ANTHROPIC_API_KEY\" (auth-source-pass-get 'secret \"anthropic-api-key\"))\n\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables :inherit-env t))\n#+end_src\n\nThis ensures that environment variables like `PATH`, `HOME`, and others from your Emacs session are available to the agent process, while still allowing you to override or add specific variables.\n\n**** Loading environment variables from files\n\nYou can load environment variables from .env files using the `:load-env` parameter. This supports both single and multiple files:\n\n#+begin_src emacs-lisp\n  ;; Load from a single .env file\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables\n         :load-env \"~\u002F.env\"\n         \"CUSTOM_VAR\" \"custom_value\"))\n\n  ;; Load from multiple .env files\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables\n         :load-env '(\"~\u002F.env\" \".env.local\")\n         :inherit-env t))\n#+end_src\n\nThe .env files should contain variables in the format `KEY=value`, with one variable per line. Comments (lines starting with `#`) and empty lines are ignored.\n\n*** Anthropic Claude\n\nFor login-based authentication (default):\n\n#+begin_src emacs-lisp\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication :login t))\n#+end_src\n\nFor API key authentication:\n\n#+begin_src emacs-lisp\n;; With string\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication :api-key \"your-anthropic-api-key-here\"))\n\n;; With function\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication\n       :api-key (lambda () (auth-source-pass-get 'secret \"anthropic-api-key\"))))\n#+end_src\n\nFor OAuth token authentication (the =CLAUDE_CODE_OAUTH_TOKEN= we get from =claude setup-token=):\n\n#+begin_src emacs-lisp\n;; With string\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication :oauth \"your-oauth-token-here\"))\n\n;; With function\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication\n       :oauth (lambda () (auth-source-pass-get \"secret\" \"anthropic-oauth-token\"))))\n#+end_src\n\nFor alternative Anthropic-compatible API endpoints, configure via environment variables:\n\n#+begin_src emacs-lisp\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables\n         \"ANTHROPIC_BASE_URL\" \"https:\u002F\u002Fapi.moonshot.cn\u002Fanthropic\"\n         \"ANTHROPIC_MODEL\" \"kimi-k2-turbo-preview\"\n         \"ANTHROPIC_SMALL_FAST_MODEL\" \"kimi-k2-turbo-preview\"))\n#+end_src\n\n*** Google Gemini\n\nFor login-based authentication (default):\n\n#+begin_src emacs-lisp\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication :login t))\n#+end_src\n\nFor API key authentication:\n\n#+begin_src emacs-lisp\n;; With string\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication :api-key \"your-google-api-key-here\"))\n\n;; With function\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication\n       :api-key (lambda () (auth-source-pass-get 'secret \"google-api-key\"))))\n#+end_src\n\nFor Vertex AI authentication:\n\n#+begin_src emacs-lisp\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication :vertex-ai t))\n#+end_src\n\n*** OpenAI Codex\n\nFor login-based authentication (default):\n\n#+begin_src emacs-lisp\n(setq agent-shell-openai-authentication\n      (agent-shell-openai-make-authentication :login t))\n#+end_src\n\nFor API key authentication:\n\n#+begin_src emacs-lisp\n;; With string\n(setq agent-shell-openai-authentication\n      (agent-shell-openai-make-authentication :api-key \"your-openai-api-key-here\"))\n\n;; With function\n(setq agent-shell-openai-authentication\n      (agent-shell-openai-make-authentication\n       :api-key (lambda () (auth-source-pass-get 'secret \"openai-api-key\"))))\n#+end_src\n\n*** Goose\n\nFor OpenAI API key authentication:\n\n#+begin_src emacs-lisp\n;; With string\n(setq agent-shell-goose-authentication\n      (agent-shell-make-goose-authentication :openai-api-key \"your-openai-api-key-here\"))\n\n;; With function\n(setq agent-shell-goose-authentication\n      (agent-shell-make-goose-authentication\n       :openai-api-key (lambda () (auth-source-pass-get 'secret \"openai-api-key\"))))\n#+end_src\n\n*** Qwen Code\n\nFor OAuth login-based authentication:\n\n#+begin_src emacs-lisp\n(setq agent-shell-qwen-authentication\n      (agent-shell-qwen-make-authentication :login t))\n#+end_src\n\n*** Auggie\n\nFor login-based authentication (default):\n\n#+begin_src emacs-lisp\n(setq agent-shell-auggie-authentication\n      (agent-shell-make-auggie-authentication :login t))\n#+end_src\n\nFor no authentication (when using alternative authentication methods):\n\n#+begin_src emacs-lisp\n(setq agent-shell-auggie-authentication\n      (agent-shell-make-auggie-authentication :none t))\n#+end_src\n\n*** Mistral Vibe\n\nFor API key authentication:\n\n#+begin_src emacs-lisp\n;; With string\n(setq agent-shell-mistral-authentication\n      (agent-shell-mistral-make-authentication :api-key \"your-mistral-api-key-here\"))\n\n;; With function (reusing the API key configured in vibe)\n(setq agent-shell-mistral-authentication\n      (agent-shell-mistral-make-authentication\n       :api-key (lambda ()\n\t          (string-trim\n\t\t   (shell-command-to-string \"source ~\u002F.vibe\u002F.env; echo $MISTRAL_API_KEY\")))))\n#+end_src\n\n*** Customizing Available Agents\n\nBy default, =agent-shell= includes configurations for all supported agents (Claude Agent, Gemini CLI, Codex, Goose, Qwen Code, and Auggie). You can customize which agents are available through the =agent-shell-agent-configs= variable.\n\n** Usage\n\n*** Quick Start\n\n=M-x agent-shell= - Start or reuse any of the known agents.\n\nYou can select and start any of the known agent shells (see =agent-shell-agent-configs=) via the =agent-shell= interactive command and enables reusing existing shells when available. With a prefix argument (=C-u M-x agent-shell=), it forces starting a new shell session, thus instantiating multiple agent shells.\n\n*** Specific Agent Commands\n\nStart a specific agent shell session directly:\n\n- =M-x agent-shell-anthropic-start-claude-code= - Start a Claude Agent session\n- =M-x agent-shell-auggie-start-agent= - Start an Auggie agent session\n- =M-x agent-shell-openai-start-codex= - Start a Codex agent session\n- =M-x agent-shell-google-start-gemini= - Start a Gemini agent session\n- =M-x agent-shell-goose-start-agent= - Start a Goose agent session\n- =M-x agent-shell-cursor-start-agent= - Start a Cursor agent session\n- =M-x agent-shell-kiro-start-agent= - Start a Kiro CLI agent session\n- =M-x agent-shell-mistral-start-vibe= - Start a Mistral Vibe agent session\n- =M-x agent-shell-qwen-start= - Start a Qwen Code agent session\n- =M-x agent-shell-droid-start-agent= - Start a Factory Droid agent session\n- =M-x agent-shell-pi-start-agent= - Start a Pi coding agent session\n\n*** Setting a default agent for all new shells\n\nYou can set a default agent to use for all new shells started via =agent-shell= like so:\n\n#+begin_src emacs-lisp\n(setq agent-shell-preferred-agent-config (agent-shell-anthropic-make-claude-code-config))\n#+end_src\n\n*** Configuring MCP servers\n\nYou can configure MCP servers directly via =agent-shell=. This allows you to avoid having to repeat\nconfigurations across every agent that you use.\n\n#+begin_src emacs-lisp\n  (setq agent-shell-mcp-servers\n        '(((name . \"notion\")\n           (type . \"http\")\n           (headers . [])\n           (url . \"https:\u002F\u002Fmcp.notion.com\u002Fmcp\"))))\n#+end_src\n\n** Running agents in Devcontainers \u002F Docker containers (Experimental)\n\n=agent-shell= provides rudimentary support for running agents and shell commands in containers.\n\nUse =agent-shell-command-prefix= to prefix the command that starts the agent, or a shell command that should be run so it is executed inside the container.\n\n*** Static command list\n\n#+begin_src emacs-lisp\n(setq agent-shell-command-prefix '(\"devcontainer\" \"exec\" \"--workspace-folder\" \".\"))\n#+end_src\n\n*** Function-based configuration\n\nFor dynamic per-agent containers, provide a function that takes the current agent-shell buffer and returns the command list:\n\n#+begin_src emacs-lisp\n(setq agent-shell-command-prefix\n      (lambda (buffer)\n        (let ((config (agent-shell-get-config buffer)))\n          (pcase (map-elt config :identifier)\n            ('claude-code '(\"docker\" \"exec\" \"claude-dev\" \"--\"))\n            ('gemini-cli '(\"docker\" \"exec\" \"gemini-dev\" \"--\"))\n            (_ '(\"devcontainer\" \"exec\" \".\"))))))\n#+end_src\n\n*** Per-session containers\n\nYou can use different containers for different shell sessions, even of the same agent type:\n\n#+begin_src emacs-lisp\n(setq agent-shell-command-prefix\n      (lambda (buffer)\n        ;; Different container based on project\n        (if (string-match \"project-a\" (buffer-name buffer))\n            '(\"docker\" \"exec\" \"project-a-dev\" \"--\")\n          '(\"docker\" \"exec\" \"project-b-dev\" \"--\"))))\n#+end_src\n\nNote that any =:environment-variables= you may have passed to =acp-make-client= will not apply to the agent process running inside the container. It's expected to inject environment variables by means of your devcontainer configuration \u002F Dockerfile.\n\nNext, set an =agent-shell-path-resolver-function= that resolves container paths in the local working directory, and vice versa.\nAgent shell provides the =agent-shell-devcontainer-resolve-path= function for use with devcontainers specifically: it reads the =workspaceFolder= specified in =.devcontainer\u002Fdevcontainer.json=, or uses the default value of =\u002Fworkspaces\u002F\u003Crepository-name>= otherwise.\n\n#+begin_src emacs-lisp\n(setq agent-shell-path-resolver-function #'agent-shell-devcontainer-resolve-path)\n#+end_src\n\nNote that this allows the agent to access files on your local file-system. While care has been taken to restrict access to files in the local working directory, it's probably possible for a malicious agent to circumvent this restriction.\n\nOptional: to prevent the agent running inside the container to access your local file-system altogether and to have it read\u002Fmodify files inside the container directly, in addition to setting the resolver function, disable the \"read\u002Fwrite text file\" client capabilities:\n\n#+begin_src emacs-lisp\n(setq agent-shell-text-file-capabilities nil)\n#+end_src\n\n*** Data storage location\n\nBy default, agent-shell stores per-project data (transcripts, screenshots, etc.) under a =.agent-shell\u002F= directory in the project root, and automatically adds that directory to =.gitignore= the first time it is created.  This is a one-time operation: removing the entry from =.gitignore= will not cause it to be re-added.\n\nYou can change where this data is stored by setting =agent-shell-dot-subdir-function= to a custom function.  The function receives one argument, SUBDIR (e.g. =\"screenshots\"=), and must return the absolute path to that subdirectory (without creating it).\n\nFor example, to store data under =user-emacs-directory= instead of the project tree, flattening the project path into a directory name:\n\n#+begin_src emacs-lisp\n(defun my\u002Fagent-shell-dot-subdir (subdir)\n  (let* ((cwd (string-remove-suffix \"\u002F\" (agent-shell-cwd)))\n         (sanitized (replace-regexp-in-string \"\u002F\" \"-\" (string-remove-prefix \"\u002F\" cwd))))\n    (expand-file-name subdir (locate-user-emacs-file (concat \"agent-shell\u002F\" sanitized)))))\n\n(setopt agent-shell-dot-subdir-function #'my\u002Fagent-shell-dot-subdir)\n#+end_src\n\nThis stores data at a path like =~\u002F.emacs.d\u002Fagent-shell\u002Fhome-user-src-myproject\u002Fscreenshots\u002F=.\n\n*** Screenshots from clipboard\n\nYou can send a screenshot from your clipboard to your shell with =agent-shell-send-clipboard-image=. Call with =C-u= to =agent-shell-send-clipboard-image-to= to select from your shells. agent-shell relies on external programs to write an image from clipboard to file as configured in =agent-shell-clipboard-image-handlers=. Preconfigured handlers are\n- =wl-paste= for Wayland desktops,\n- =xclip= for Xorg,\n- =pngpaste= for MacOS.\n\n*** Inhibiting minor modes during file writes\n\nSome minor modes (for example, =aggressive-indent-mode=) can interfere with an agent's edits.  Agent Shell can temporarily disable selected per-buffer minor modes while applying edits.\n\n#+begin_src emacs-lisp\n(setopt agent-shell-write-inhibit-minor-modes '(aggressive-indent-mode))\n#+end_src\n\nAll of the above settings can be applied on a per-project basis using [[https:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Femacs\u002Fmanual\u002Fhtml_node\u002Femacs\u002FDirectory-Variables.html][directory-local variables]].\n\n** Key bindings\n\n- =RET= - Submits prompt.\n- =M-J= - Iserts newline.\n- =C-c C-c= - Interrupt current agent operation\n- =TAB and Shift-TAB= - Navigate interactive elements\n\n  To customize =RET= binding behaviour, you can use something like:\n\n  #+begin_src emacs-lisp :lexical no\n    (use-package agent-shell\n      :bind (:map agent-shell-mode-map\n                  (\"RET\" . newline)\n                  (\"M-RET\" . shell-maker-submit)))\n  #+end_src\n\n  Or if you prefer C-c C-c to send and C-c C-k to interrupt, use the following:\n\n  #+begin_src emacs-lisp :lexical no\n    (use-package agent-shell\n      :bind (:map agent-shell-mode-map\n                  (\"RET\" . newline)\n                  (\"C-c C-c\" . shell-maker-submit)\n                  (\"C-c C-k\" . agent-shell-interrupt)))\n  #+end_src\n\n\n*** Evil\nEvil users may want to rebind ~RET~ for inserting a new line in =insert\nmode= and sending the prompt in =normal mode=.\n\nAlso, when viewing diffs (before accepting changes) it may be annoying\nhaving to enter =insert mode= to send keys (~y\u002Fn\u002Fp\u002Fq\u002Fetc~). If this is\nyour case, you can make these buffers start in Emacs mode (you can\nalways go to Evil modes if you need to with ~C-z~).\n#+begin_src emacs-lisp\n  (use-package agent-shell\n    :config\n    ;; Evil state-specific RET behavior: insert mode = newline, normal mode = send\n    (evil-define-key 'insert agent-shell-mode-map (kbd \"RET\") #'newline)\n    (evil-define-key 'normal agent-shell-mode-map (kbd \"RET\") #'comint-send-input)\n\n    ;; Configure *agent-shell-diff* buffers to start in Emacs state\n    (add-hook 'diff-mode-hook\n  \t    (lambda ()\n  \t      (when (string-match-p \"\\\\*agent-shell-diff\\\\*\" (buffer-name))\n  \t\t(evil-emacs-state)))))\n#+end_src\n\n* Customizations\n\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"Custom variable\" \"Description\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^agent-shell\"\n                                (symbol-name symbol))\n                  (custom-variable-p symbol))\n         (push `(,symbol\n                 ,(car\n                   (split-string\n                    (or (documentation-property symbol 'variable-documentation)\n                        (get (indirect-variable symbol)\n                             'variable-documentation)\n                        (get symbol 'variable-documentation)\n                        \"\")\n                    \"\\n\")))\n               rows))))\n    (sort rows (lambda (a b)\n                 (string\u003C (symbol-name (car a))\n                          (symbol-name (car b))))))\n#+END_SRC\n\n#+RESULTS:\n| Custom variable                               | Description                                                                     |\n|-----------------------------------------------+---------------------------------------------------------------------------------|\n| agent-shell-agent-configs                     | The list of known agent configurations.                                         |\n| agent-shell-anthropic-authentication          | Configuration for Anthropic authentication.                                     |\n| agent-shell-anthropic-claude-acp-command      | Command and parameters for the Anthropic Claude client.                         |\n| agent-shell-anthropic-claude-command          | Command and parameters for the Anthropic Claude client.                         |\n| agent-shell-anthropic-claude-environment      | Environment variables for the Anthropic Claude client.                          |\n| agent-shell-anthropic-default-model-id        | Default Anthropic model ID.                                                     |\n| agent-shell-anthropic-default-session-mode-id | Default Anthropic session mode ID.                                              |\n| agent-shell-auggie-acp-command                | Command and parameters for the Auggie client.                                   |\n| agent-shell-auggie-authentication             | Configuration for Auggie authentication.                                        |\n| agent-shell-auggie-environment                | Environment variables for the Auggie client.                                    |\n| agent-shell-buffer-name-format                | Format to use when generating agent shell buffer names.                         |\n| agent-shell-busy-indicator-frames             | Frames for the busy indicator animation.                                        |\n| agent-shell-clipboard-image-handlers          | Handlers for saving clipboard images to a file.                                 |\n| agent-shell-completion-mode-hook              | Hook run after entering or leaving ‘agent-shell-completion-mode’.               |\n| agent-shell-command-prefix                    | Command prefix for executing commands in a container.                           |\n| agent-shell-context-sources                   | Sources to consider when determining M-x agent-shell automatic context.         |\n| agent-shell-cursor-acp-command                | Command and parameters for the Cursor agent client.                             |\n| agent-shell-cursor-environment                | Environment variables for the Cursor agent client.                              |\n| agent-shell-display-action                    | Display action for agent shell buffers.                                         |\n| agent-shell-droid-acp-command                 | Command and parameters for the Factory Droid ACP client.                        |\n| agent-shell-droid-authentication              | Configuration for Factory Droid authentication.                                 |\n| agent-shell-droid-environment                 | Environment variables for the Factory Droid ACP client.                         |\n| agent-shell-embed-file-size-limit             | Maximum file size in bytes for embedding with ContentBlock::Resource.           |\n| agent-shell-file-completion-enabled           | Non-nil automatically enables file completion when starting shells.             |\n| agent-shell-github-acp-command                | Command and parameters for the GitHub Copilot agent client.                     |\n| agent-shell-github-default-model-id           | Default GitHub Copilot model ID.                                                |\n| agent-shell-github-default-session-mode-id    | Default GitHub Copilot session mode ID.                                         |\n| agent-shell-github-environment                | Environment variables for the GitHub Copilot agent client.                      |\n| agent-shell-google-authentication             | Configuration for Google authentication.                                        |\n| agent-shell-google-gemini-acp-command         | Command and parameters for the Gemini client.                                   |\n| agent-shell-google-gemini-environment         | Environment variables for the Google Gemini client.                             |\n| agent-shell-goose-acp-command                 | Command and parameters for the Goose client.                                    |\n| agent-shell-goose-authentication              | Configuration for Goose authentication.                                         |\n| agent-shell-goose-environment                 | Environment variables for the Goose client.                                     |\n| agent-shell-header-style                      | Style for agent shell buffer headers.                                           |\n| agent-shell-highlight-blocks                  | Whether or not to highlight source blocks.                                      |\n| agent-shell-mcp-servers                       | List of MCP servers to initialize when creating a new session.                  |\n| agent-shell-mistral-acp-command               | Command and parameters for the Mistral Vibe client.                             |\n| agent-shell-mistral-authentication            | Configuration for Mistral AI authentication.                                    |\n| agent-shell-mistral-default-model-id          | Default Mistral AI model ID.                                                    |\n| agent-shell-mistral-default-session-mode-id   | Default Mistral AI session mode ID.                                             |\n| agent-shell-mistral-environment               | Environment variables for the Mistral Vibe client.                              |\n| agent-shell-openai-authentication             | Configuration for OpenAI authentication.                                        |\n| agent-shell-openai-codex-acp-command          | Command and parameters for the OpenAI Codex client.                             |\n| agent-shell-openai-codex-environment          | Environment variables for the OpenAI Codex client.                              |\n| agent-shell-openai-default-model-id           | Default Codex model ID.                                                         |\n| agent-shell-openai-default-session-mode-id    | Default Codex session mode ID.                                                  |\n| agent-shell-opencode-acp-command              | Command and parameters for the OpenCode client.                                 |\n| agent-shell-opencode-authentication           | Configuration for OpenCode authentication.                                      |\n| agent-shell-opencode-default-model-id         | Default OpenCode model ID.                                                      |\n| agent-shell-opencode-default-session-mode-id  | Default OpenCode session mode ID.                                               |\n| agent-shell-opencode-environment              | Environment variables for the OpenCode client.                                  |\n| agent-shell-path-resolver-function            | Function for resolving remote paths on the local file-system, and vice versa.   |\n| agent-shell-permission-icon                   | Icon displayed when shell commands require permission to execute.               |\n| agent-shell-pi-acp-command                    | Command and parameters for the Pi ACP client.                                   |\n| agent-shell-pi-environment                    | Environment variables for the Pi client.                                        |\n| agent-shell-prefer-session-resume             | Prefer ACP session resume over session load when both are available.            |\n| agent-shell-prefer-viewport-interaction       | Non-nil makes ‘agent-shell’ prefer viewport interaction over shell interaction. |\n| agent-shell-preferred-agent-config            | Default agent to use for all new shells.                                        |\n| agent-shell-qwen-acp-command                  | Command and parameters for the Qwen Code client.                                |\n| agent-shell-qwen-authentication               | Configuration for Qwen Code authentication.                                     |\n| agent-shell-qwen-environment                  | Environment variables for the Qwen Code client.                                 |\n| agent-shell-screenshot-command                | The program to use for capturing screenshots.                                   |\n| agent-shell-section-functions                 | Abnormal hook run after overlays are applied (experimental).                    |\n| agent-shell-session-strategy                  | How to handle sessions when starting a new shell.                               |\n| agent-shell-show-busy-indicator               | Non-nil to show the busy indicator animation in the header and mode line.       |\n| agent-shell-show-config-icons                 | Whether to show icons in agent config selection.                                |\n| agent-shell-show-context-usage-indicator      | Non-nil to show the context usage indicator in the header and mode line.        |\n| agent-shell-show-usage-at-turn-end            | Whether to display usage information when agent turn ends.                      |\n| agent-shell-show-welcome-message              | Non-nil to show welcome message.                                                |\n| agent-shell-text-file-capabilities            | Whether agents are initialized with read\u002Fwrite text file capabilities.          |\n| agent-shell-thought-process-expand-by-default | Whether thought process sections should be expanded by default.                 |\n| agent-shell-thought-process-icon              | Icon displayed during the AI’s thought process.                                 |\n| agent-shell-tool-use-expand-by-default        | Whether tool use sections should be expanded by default.                        |\n| agent-shell-transcript-file-path-function     | Function to generate the full transcript file path.                             |\n| agent-shell-ui-mode-hook                      | Hook run after entering or leaving ‘agent-shell-ui-mode’.                       |\n| agent-shell-user-message-expand-by-default    | Whether user message sections should be expanded by default.                    |\n| agent-shell-write-inhibit-minor-modes         | List of minor mode commands to inhibit during ‘fs\u002Fwrite_text_file’ edits.       |\n\n* Commands\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"Binding\" \"Command\" \"Description\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^agent-shell\"\n                                (symbol-name symbol))\n                  (commandp symbol))\n         (push `(,(string-join\n                   (seq-filter\n                    (lambda (symbol)\n                      (not (string-match \"menu\" symbol)))\n                    (mapcar\n                     (lambda (keys)\n                       (key-description keys))\n                     (or\n                      (where-is-internal\n                       (symbol-function symbol)\n                       comint-mode-map\n                       nil nil (command-remapping 'comint-next-input))\n                      (where-is-internal\n                       symbol agent-shell-mode-map nil nil (command-remapping symbol))\n                      (where-is-internal\n                       (symbol-function symbol)\n                       agent-shell-mode-map nil nil (command-remapping symbol)))))  \" or \")\n                 ,(symbol-name symbol)\n                 ,(car\n                   (split-string\n                    (or (documentation symbol t) \"\")\n                    \"\\n\")))\n               rows))))\n    (sort rows (lambda (a b)\n                 (string\u003C (cadr a) (cadr b)))))\n#+END_SRC\n\n#+RESULTS:\n| Binding         | Command                                                 | Description                                                                   |\n|-----------------+---------------------------------------------------------+-------------------------------------------------------------------------------|\n|                 | agent-shell                                             | Start or reuse an existing agent shell.                                       |\n|                 | agent-shell--display-buffer                             | Toggle agent SHELL-BUFFER display.                                            |\n|                 | agent-shell-anthropic-start-claude-code                 | Start an interactive Claude Agent shell.                                      |\n|                 | agent-shell-auggie-start-agent                          | Start an interactive Auggie agent shell.                                      |\n|                 | agent-shell-clear-buffer                                | Clear the current shell buffer.                                               |\n|                 | agent-shell-completion-mode                             | Toggle agent shell completion with @ or \u002F prefix.                             |\n|                 | agent-shell-cursor-start-agent                          | Start an interactive Cursor agent shell.                                      |\n| C-\u003Ctab>         | agent-shell-cycle-session-mode                          | Cycle through available session modes for the current `agent-shell' session.  |\n|                 | agent-shell-delete-interaction-at-point                 | Delete interaction (request and response) at point.                           |\n|                 | agent-shell-droid-start-agent                           | Start an interactive Factory Droid agent shell.                               |\n|                 | agent-shell-fakes-load-session                          | Load and replay a traffic session from file.                                  |\n|                 | agent-shell-github-start-copilot                        | Start an interactive GitHub Copilot agent shell.                              |\n|                 | agent-shell-google-start-gemini                         | Start an interactive Gemini CLI agent shell.                                  |\n|                 | agent-shell-goose-start-agent                           | Start an interactive Goose agent shell.                                       |\n|                 | agent-shell-help-menu                                   | Transient menu for `agent-shell' commands.                                    |\n|                 | agent-shell-insert-file                                 | Insert a file into `agent-shell'.                                             |\n|                 | agent-shell-insert-shell-command-output                 | Execute a shell command and insert output as a code block.                    |\n| C-c C-c         | agent-shell-interrupt                                   | Interrupt in-progress request and reject all pending permissions.             |\n|                 | agent-shell-jump-to-latest-permission-button-row        | Jump to the latest permission button row.                                     |\n|                 | agent-shell-mistral-start-vibe                          | Start an interactive Mistral Vibe agent shell.                                |\n|                 | agent-shell-mode                                        | Major mode for agent shell.                                                   |\n|                 | agent-shell-new-shell                                   | Start a new agent shell.                                                      |\n| S-\u003Creturn>      | agent-shell-newline                                     | Insert a newline, and move to left margin of the new line.                    |\n| C-\u003Cdown> or M-n | agent-shell-next-input                                  | Cycle forwards through input history.                                         |\n| n or TAB        | agent-shell-next-item                                   | Go to next item.                                                              |\n|                 | agent-shell-next-permission-button                      | Jump to the next button.                                                      |\n|                 | agent-shell-open-transcript                             | Open the transcript file for the current `agent-shell' buffer.                |\n|                 | agent-shell-openai-start-codex                          | Start an interactive Codex agent shell.                                       |\n|                 | agent-shell-opencode-start-agent                        | Start an interactive OpenCode agent shell.                                    |\n| C-c C-o         | agent-shell-other-buffer                                | Switch to other associated buffer (viewport vs shell).                        |\n| C-\u003Cup> or M-p   | agent-shell-previous-input                              | Cycle backwards through input history, saving input.                          |\n| p or \u003Cbacktab>  | agent-shell-previous-item                               | Go to previous item.                                                          |\n|                 | agent-shell-previous-permission-button                  | Jump to the previous button.                                                  |\n|                 | agent-shell-prompt-compose                              | Compose an `agent-shell' prompt in a dedicated buffer.                        |\n|                 | agent-shell-queue-request                               | Queue or immediately send a request depending on shell busy state.            |\n|                 | agent-shell-qwen-start                                  | Start an interactive Qwen Code CLI agent shell.                               |\n|                 | agent-shell-remove-pending-request                      | Remove all pending requests or a specific request by REMOVE-INDEX.            |\n| C-x x r         | agent-shell-rename-buffer                               | Rename current shell buffer.                                                  |\n|                 | agent-shell-reset-logs                                  | Reset all log buffers.                                                        |\n|                 | agent-shell-resume-pending-requests                     | Resume processing pending requests in the queue.                              |\n|                 | agent-shell-run-all-tests                               | Run all agent-shell tests in batch mode.                                      |\n| M-r             | agent-shell-search-history                              | Search previous input history.                                                |\n|                 | agent-shell-send-current-file                           | Insert a file into `agent-shell'.                                             |\n|                 | agent-shell-send-dwim                                   | Send region or error at point to last accessed shell buffer in project.       |\n|                 | agent-shell-send-file                                   | Insert a file into `agent-shell'.                                             |\n|                 | agent-shell-send-other-file                             | Prompt to send a file into `agent-shell'.                                     |\n|                 | agent-shell-send-region                                 | Send region to last accessed shell buffer in project.                         |\n|                 | agent-shell-send-screenshot                             | Capture a screenshot and insert it into `agent-shell'.                        |\n| C-c RET         | agent-shell-set-session-mode                            | Set session mode (if any available).                                          |\n| C-c C-v         | agent-shell-set-session-model                           | Set session model.                                                            |\n| RET             | agent-shell-submit                                      | Submit current input.                                                         |\n|                 | agent-shell-toggle                                      | Toggle agent shell display.                                                   |\n|                 | agent-shell-toggle-logging                              | Toggle logging.                                                               |\n|                 | agent-shell-ui-backward-block                           | Jump to the previous block.                                                   |\n|                 | agent-shell-ui-forward-block                            | Jump to the next block.                                                       |\n|                 | agent-shell-ui-mode                                     | Minor mode for SUI block navigation.                                          |\n|                 | agent-shell-ui-toggle-fragment-at-point                 | Toggle visibility of fragment body at point.                                  |\n|                 | agent-shell-version                                     | Show `agent-shell' mode version.                                              |\n|                 | agent-shell-view-acp-logs                               | View agent shell ACP logs buffer.                                             |\n|                 | agent-shell-view-traffic                                | View agent shell traffic buffer.                                              |\n|                 | agent-shell-viewport-compose-cancel                     | Cancel prompt composition.                                                    |\n|                 | agent-shell-viewport-compose-send                       | Send the viewport composed prompt to the agent shell.                         |\n|                 | agent-shell-viewport-compose-send-and-kill              | Send the viewport composed prompt to the agent shell and kill compose buffer. |\n|                 | agent-shell-viewport-compose-send-and-wait-for-response | Send the viewport composed prompt and display response in viewport.           |\n|                 | agent-shell-viewport-cycle-session-mode                 | Cycle through available session modes.                                        |\n|                 | agent-shell-viewport-edit-mode                          | Major mode for composing agent shell prompts.                                 |\n|                 | agent-shell-viewport-interrupt                          | Interrupt active agent shell request.                                         |\n|                 | agent-shell-viewport-next-item                          | Go to next item.                                                              |\n|                 | agent-shell-viewport-next-page                          | Show next interaction (request \u002F response).                                   |\n|                 | agent-shell-viewport-previous-item                      | Go to previous item.                                                          |\n|                 | agent-shell-viewport-previous-page                      | Show previous interaction (request \u002F response).                               |\n|                 | agent-shell-viewport-refresh                            | Refresh viewport buffer content with current item from shell.                 |\n|                 | agent-shell-viewport-reply                              | Reply as a follow-up and compose another prompt\u002Fquery.                        |\n|                 | agent-shell-viewport-set-session-mode                   | Set session mode.                                                             |\n|                 | agent-shell-viewport-set-session-model                  | Set session model.                                                            |\n|                 | agent-shell-viewport-view-last                          | Display the last request\u002Fresponse interaction.                                |\n|                 | agent-shell-viewport-view-mode                          | Major mode for viewing agent shell prompts (read-only).                       |\n* Filing issues\nWhen filing an issue, please keep the checkboxes from the [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fblob\u002Fmain\u002F.github\u002FISSUE_TEMPLATE\u002Fissue.md][issue template]] and check them off as applicable. They help ensure I have enough information to help.\n\nPlease read through this section before filing issues or feature requests. I won't be able to help unless I have enough information to help. This section shows how to get the details I need.\n\n- *Versions*: What version of =agent-shell=, =acp.el=, the ACP package (e.g. =claude-code-acp=), and the agent CLI (e.g. =claude=, =gemini=) are you running?\n- *Steps to reproduce*: What exact steps lead to the issue? Be specific about what you did and in what order.\n- *ACP traffic*: See [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell?tab=readme-ov-file#how-do-i-viewget-agent-client-protocol-traffic][how to get ACP traffic]] above. This is the most useful piece of information for diagnosing issues.\n- *Screenshots*: A screenshot helps correlate what you see with the protocol data.\n- *Your agent-shell config*: Share any relevant =agent-shell= variable settings from your Emacs config.\n- *Profiling data* (for performance issues): Use =M-x profiler-start=, reproduce the issue, then =M-x profiler-report= (and =M-x profiler-stop=). Share the report.\n\n** Why doesn't =agent-shell= offer all slash commands\u002Fskills available in CLI agent?\n\n=agent-shell= can only offer the slash commands\u002Fskills advertised by the agent via [[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]]. To view what's exposed by your agent, expand the \"Available \u002Fcommands\" section. Is the command you're after missing? Please consider filing a feature-request with the respective agent (ie. Gemini CLI) or their ACP layer (claude-code-acp).\n\n[[file:slash-commands.png]]\n\n\n** Can you add support for another agent?\n\nDoes the agent support ACP ([[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]])? If so, =agent-shell= can likely support this agent. Some agents have ACP support built-in (like [[https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli][gemini-cli]]). Others require a separate ACP package (like [[https:\u002F\u002Fgithub.com\u002Fzed-industries\u002Fclaude-code-acp][claude-code-acp]] for [[https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code][claude-code]]). When filing a feature request to add a new agent, please include a link to the project supporting [[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]] (built-in or otherwise).\n\nAgents without ACP support are out of scope for integrating with =agent-shell=. Having said that, if you do build an ACP layer like =claude-agent-acp=, then =agent-shell= can work with it.\n\n** =agent-shell= not behaving as expected?\n\nCould be the agent itself missing an [[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]] feature, =agent-shell= missing the feature, or both :) So which one is it? It's hard to tell unless we look at [[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]] traffic between the two.\n\n** How do I view\u002Fget [[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]] traffic?\n\n1. =M-x agent-shell-toggle-logging= (make sure logging is ON).\n2. Reproduce the issue\n3. =M-x agent-shell-view-traffic=\n\nBrowse through traffic and see if you can spot the issue. For example, if you see a request sent by the agent asking for user permission, but =agent-shell= isn't surfacing this permission, it looks like perhaps =agent-shell= is missing a feature.\n\nFor example, here's what a [[https:\u002F\u002Fagentclientprotocol.com\u002Fprotocol\u002Fschema#session%2Frequest-permission][session\u002Frequest_permission]] request would look like from the traffic viewer.\n\n[[file:traffic.png]]\n\nSometimes including a traffic screenshot in an issue is enough. Other times including the full traffic is needed. From the traffic viewer, you can =M-x acp-traffic-save-to= to save as =.traffic=.\n\n** Where should I file bug or feature request?\n\n*** Agent issues or feature requests\n\nIf you're able to determine the agent is missing a feature (or a bug is present) in their [[https:\u002F\u002Fagentclientprotocol.com][Agent Client Protocol]] implementation, please file an issue directly with the agent folks. For example:\n\n- [[https:\u002F\u002Fgithub.com\u002Fagentclientprotocol\u002Fclaude-agent-acp][claude-agent-acp]]: For Claude Agent.\n- [[https:\u002F\u002Fgithub.com\u002Fzed-industries\u002Fcodex-acp][codex-acp]]: For Codex.\n- [[https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli][Gemini CLI]].\n- [[https:\u002F\u002Fblock.github.io\u002Fgoose\u002Fdocs\u002Fgetting-started\u002Finstallation][Goose]].\n- [[https:\u002F\u002Fgithub.com\u002FQwenLM\u002Fqwen-code][Qwen Code]].\n\n*** =agent-shell= issues or feature requests\n\nAlternatively, if you noticed =agent-shell= is missing a feature (or has a bug), please [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues][file an agent-shell issue]].\n\n*** Not sure where to file an issue?\n\nFile [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues][in agent-shell]], but please try to provide details, so I can determine whether =agent-shell= or the agent itself needs work. Traffic data would be very useful here. Provide a screenshot or a .traffic file if you think it'll help. See [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell?tab=readme-ov-file#how-do-i-viewget-agent-client-protocol-traffic][how to get ACP traffic]].\n\n* Contributing\n\nSee [[file:CONTRIBUTING.org][CONTRIBUTING.org]].\n\n* Contributors\n\n#+HTML: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fgraphs\u002Fcontributors\">\n#+HTML:   \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_agent-shell_readme_e499fb7271f8.png\" \u002F>\n#+HTML: \u003C\u002Fa>\n\nMade with [[https:\u002F\u002Fcontrib.rocks][contrib.rocks]].\n","#+TITLE: Emacs 代理 Shell\n#+AUTHOR: Álvaro Ramírez\n\n[[https:\u002F\u002Fmelpa.org\u002F#\u002Fagent-shell][file:https:\u002F\u002Fmelpa.org\u002Fpackages\u002Fagent-shell-badge.svg]]\n\n👉 [[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][通过 GitHub Sponsors 支持此项目]] 由 [[https:\u002F\u002Fgithub.com\u002Fxenodium][@xenodium]] 提供（请查看我的 [[https:\u002F\u002Fxenodium.com][博客]]）\n\n[[file:agent-shell.png]]\n\n* 本项目需要您的资助\n\n在您为那些有用的 LLM token 付费的同时，不妨考虑[[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][赞助]]本项目的开发与维护。有了您的帮助，我可以让这项工作更加[[https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fxenodium][可持续]]。\n\n感谢您！\n\n[[https:\u002F\u002Fxenodium.com\u002F][Alvaro]]\n\n* agent-shell\n\n一个原生的 Emacs shell，用于与基于 ACP（[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]）的 LLM 代理进行交互。\n\n借助 agent-shell，您可以与 Gemini CLI、Claude Agent、Auggie、Mistral Vibe 或任何其他受 ACP 驱动的代理进行对话。\n\n请观看[[https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=R2Ucr3amgGg][YouTube]]上的视频\n\n[[https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=R2Ucr3amgGg][file:yt.png]]\n\n* 新闻\n\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-0-47-1-updates][agent-shell 0.47 更新]]。\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-0-25-updates][agent-shell 0.25 更新]]。\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-016-improvements-melpa][agent-shell 0.17 改进 + MELPA]]。\n- [[https:\u002F\u002Fxenodium.com\u002Fagent-shell-0-5-improvements][agent-shell 0.5 改进]]。\n- [[https:\u002F\u002Fxenodium.com\u002Fintroducing-agent-shell][介绍 Emacs 代理 Shell（基于 ACP）]]。\n- [[https:\u002F\u002Fxenodium.com\u002Fintroducing-acpel][介绍 acp.el]]。\n\n* 相关项目\n\n=agent-shell= 依赖于[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Facp.el][acp.el]]，通过 ACP（[[https:\u002F\u002Fagentclientprotocol.com\u002F][代理客户端协议]]）与代理进行通信。\n\n我们现在还有一些额外的包来扩展 =agent-shell= 的体验：\n\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Femacs-skills][emacs-skills]]：适用于 Emacs 的 Claude Agent 技能。\n- [[https:\u002F\u002Fgithub.com\u002FElleNajt\u002Fagent-shell-to-go][agent-shell-to-go]]：通过 Slack，从您的手机或其他设备与 =agent-shell= 会话互动。\n- [[https:\u002F\u002Fgithub.com\u002FEmbedded-Focus\u002Fagent-circus][agent-circus]]：在沙盒化的 Docker 容器中运行 AI 编码代理。\n- [[https:\u002F\u002Fgithub.com\u002Fcmacrae\u002Fagent-shell-sidebar][agent-shell-sidebar]]：=agent-shell= 的侧边栏插件。\n- [[https:\u002F\u002Fgithub.com\u002Fdcluna\u002Fagent-shell-bookmark][agent-shell-bookmark]]：为 agent-shell 会话提供书签支持。\n- [[https:\u002F\u002Fgithub.com\u002Fgveres\u002Fagent-shell-workspace][agent-shell-workspace]]：专门用于管理多个 =agent-shell= 会话的标签栏工作区。\n- [[https:\u002F\u002Fgithub.com\u002Fjethrokuan\u002Fagent-shell-manager][agent-shell-manager]]：=agent-shell= 缓冲区的表格视图和管理工具。\n- [[https:\u002F\u002Fgithub.com\u002Fnineluj\u002Fagent-review][agent-review]]：=agent-shell= 的代码审查界面。\n- [[https:\u002F\u002Fgithub.com\u002Fultronozm\u002Fagent-shell-attention.el][agent-shell-attention.el]]：=agent-shell= 的模式行注意力跟踪器。\n- [[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell-knockknock][agent-shell-knockknock]]：通过[[https:\u002F\u002Fgithub.com\u002Fkonrad1977\u002Fknockknock][knockknock.el]]为 =agent-shell= 提供通知。\n- [[https:\u002F\u002Fgithub.com\u002Fzackattackz\u002Fagent-shell-notifications][agent-shell-notifications]]：为 =agent-shell= 事件提供桌面通知。\n- [[https:\u002F\u002Fgithub.com\u002FElleNajt\u002Fmeta-agent-shell][meta-agent-shell]]：一个用于 =agent-shell= 的多代理协调系统，具备代理间通信、任务跟踪和项目级调度功能。\n- [[https:\u002F\u002Fgithub.com\u002Fcxa\u002Fagent-shell-macext][agent-shell-macext]]：专为 =agent-shell= 设计的 macOS 特定增强功能。\n\n* 图标\n\n感谢[[https:\u002F\u002Fgithub.com\u002Flobehub\u002Flobe-icons][Lobe Icons]]提供的精美图标。\n\n* 设置\n\n** 外部依赖\n\n*** Claude Agent SDK\n\n对于 Anthropic 的[[https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Foverview][Claude Agent]]（前身为 Claude Code），请遵循[[https:\u002F\u002Fgithub.com\u002Fagentclientprotocol\u002Fclaude-agent-acp][claude-agent-acp 指南]]，通常如下所示：\n\n#+begin_src bash\nnpm install -g @agentclientprotocol\u002Fclaude-agent-acp\n#+end_src\n\n*注意：* 使用 =-g= 标志是为了将二进制文件全局安装，使其位于您的 PATH 中。安装完成后，请通过在终端中运行 =which claude-agent-acp= 来验证其是否可用。\n\n可选：如果您想使用 Claude 订阅，可能还需要[[https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Foverview][Claude Agent]]本身（至少在 Emacs 外部运行一次 CLI 以登录您的订阅，然后才能在 Emacs 中使用 =agent-shell=）。请按照 Claude Agent 的[[https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Foverview#get-started][入门指南]]进行安装。\n\n*** Codex\n\n对于 OpenAI 的 Codex，安装[[https:\u002F\u002Fgithub.com\u002Fzed-industries\u002Fcodex-acp][zed\u002Fcodex-acp]]，并确保 `codex-acp` 可执行文件位于 PATH 中。\n\n*** Gemini CLI\n\n对于 Google 的[[https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli][Gemini CLI]]，请确保获取支持 =--experimental-acp= 标志的最新版本。\n\n*** Goose\n\n对于 Goose CLI，安装[[https:\u002F\u002Fblock.github.io\u002Fgoose\u002Fdocs\u002Fgetting-started\u002Finstallation][goose]]，并确保 `goose` 可执行文件位于 PATH 中。\n\n*** Cursor\n\n对于 Cursor 代理，安装命令如下：\n\n#+begin_src bash\nnpm install -g @blowmage\u002Fcursor-agent-acp\n#+end_src\n\n详情请参见 https:\u002F\u002Fgithub.com\u002Fblowmage\u002Fcursor-agent-acp-npm。\n\n*** Kiro CLI\n\n对于 Kiro CLI，安装命令如下：\n\n#+begin_src bash\ncurl -fsSL https:\u002F\u002Fcli.kiro.dev\u002Finstall | bash\n#+end_src\n\n详情请参见 https:\u002F\u002Fkiro.dev\u002Fdocs\u002Fcli\u002Facp\u002F。\n\n*** Qwen Code\n\n对于 Qwen Code，安装命令如下：\n\n#+begin_src bash\nnpm install -g @qwen-code\u002Fqwen-code@latest\n#+end_src\n\n详情请参见 https:\u002F\u002Fgithub.com\u002FQwenLM\u002Fqwen-code。\n\n*** Auggie\n\n对于 Auggie CLI，安装命令如下：\n\n#+begin_src bash\nnpm install -g @augmentcode\u002Fauggie\n#+end_src\n\n详情请参见 https:\u002F\u002Fdocs.augmentcode.com\u002Fcli\u002Foverview。\n\n*** Mistral Vibe\n\n对于 Mistral Vibe，安装命令如下：\n\n#+begin_src bash\nuv tool install mistral-vibe\n#+end_src\n\n详情请参见 https:\u002F\u002Fgithub.com\u002Fmistralai\u002Fmistral-vibe。\n\n*** Factory Droid\n\n对于 Factory Droid，安装 =droid-acp= 客户端：\n\n#+begin_src bash\nnpm install -g droid-acp\n#+end_src\n\n详情请参见 https:\u002F\u002Fgithub.com\u002Fyaonyan\u002Fdroid-acp。\n\n*** Pi\n\n对于 Pi 编码代理，安装 =pi-acp= 适配器：\n\n#+begin_src bash\nnpm install -g pi-acp\n#+end_src\n\n详情请参见 https:\u002F\u002Fgithub.com\u002Fsvkozak\u002Fpi-acp。\n\n** 安装\n\n=agent-shell= 由内置的 =comint-shell= 提供支持，通过[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fshell-maker][shell-maker]]实现，可在[[https:\u002F\u002Fmelpa.org\u002F#\u002Fshell-maker][MELPA]]上找到。\n\n目前，[[https:\u002F\u002Fmelpa.org\u002F#\u002Fagent-shell][agent-shell]]及其依赖项[[https:\u002F\u002Fmelpa.org\u002F#\u002Facp][acp.el]]均已上线 MELPA。\n\n您可以通过以下方式安装：\n\n#+begin_src emacs-lisp\n  (use-package agent-shell\n      :ensure t\n      :ensure-system-package\n      ;; 在此处添加代理安装配置\n      ((claude . \"brew install claude-code\")\n       (claude-agent-acp . \"npm install -g @agentclientprotocol\u002Fclaude-agent-acp\")))\n#+end_src\n\n这将自动安装所需的依赖项（[[https:\u002F\u002Fmelpa.org\u002F#\u002Facp][acp.el]] 和 [[https:\u002F\u002Fmelpa.org\u002F#\u002Fshell-maker][shell-maker]])。\n\n*** Doom Emacs\n\n如果您使用的是 Doom Emacs，并希望使用 =package!= 宏：\n\n#+begin_src emacs-lisp\n(package! shell-maker)\n(package! acp)\n(package! agent-shell)\n#+end_src\n\n运行 =doom sync= 并重启。\n\n在配置之前加入 =require=：\n\n#+begin_src emacs-lisp\n(require 'acp)\n(require 'agent-shell)\n;; 其余配置...\n#+end_src\n\n** 配置\n\n为您想要使用的代理提供商配置身份验证。\n\n*** 环境变量\n\n通过自定义 `agent-shell-*-environment` 变量并使用 `agent-shell-make-environment-variables`，可以将环境变量传递给启动的代理进程。该助手接受键值对，并在代理启动时导出这些变量。\n\n#+begin_src emacs-lisp\n(setq agent-shell-anthropic-claude-environment\n      (agent-shell-make-environment-variables\n       \"ANTHROPIC_API_KEY\" (auth-source-pass-get 'secret \"anthropic-api-key\")\n       \"HTTPS_PROXY\" \"http:\u002F\u002Fproxy.example.com:8080\"))\n#+end_src\n\n**** 继承环境变量\n\n默认情况下，代理进程会以最小化的环境启动。若要继承父级 Emacs 进程中的环境变量，可在 `agent-shell-make-environment-variables` 中使用 `:inherit-env t` 参数：\n\n#+begin_src emacs-lisp\n  (setenv \"ANTHROPIC_API_KEY\" (auth-source-pass-get 'secret \"anthropic-api-key\"))\n\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables :inherit-env t))\n#+end_src\n\n这样可以确保来自 Emacs 会话的 `PATH`、`HOME` 等环境变量对代理进程可用，同时仍允许您覆盖或添加特定变量。\n\n**** 从文件加载环境变量\n\n您可以使用 `:load-env` 参数从 .env 文件中加载环境变量。此功能支持单个文件和多个文件：\n\n#+begin_src emacs-lisp\n  ;; 从单个 .env 文件加载\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables\n         :load-env \"~\u002F.env\"\n         \"CUSTOM_VAR\" \"custom_value\"))\n\n  ;; 从多个 .env 文件加载\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables\n         :load-env '(\"~\u002F.env\" \".env.local\")\n         :inherit-env t))\n#+end_src\n\n.env 文件应包含格式为 `KEY=value` 的变量，每行一个变量。以 `#` 开头的注释行和空行会被忽略。\n\n*** Anthropic Claude\n\n对于基于登录的身份验证（默认）：\n\n#+begin_src emacs-lisp\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication :login t))\n#+end_src\n\n对于 API 密钥身份验证：\n\n#+begin_src emacs-lisp\n;; 使用字符串\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication :api-key \"your-anthropic-api-key-here\"))\n\n;; 使用函数\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication\n       :api-key (lambda () (auth-source-pass-get 'secret \"anthropic-api-key\"))))\n#+end_src\n\n对于 OAuth 令牌身份验证（即我们从 `claude setup-token` 获取的 =CLAUDE_CODE_OAUTH_TOKEN=）：\n\n#+begin_src emacs-lisp\n;; 使用字符串\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication :oauth \"your-oauth-token-here\"))\n\n;; 使用函数\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication\n       :oauth (lambda () (auth-source-pass-get \"secret\" \"anthropic-oauth-token\"))))\n#+end_src\n\n对于替代的 Anthropic 兼容 API 端点，可通过环境变量进行配置：\n\n#+begin_src emacs-lisp\n  (setq agent-shell-anthropic-claude-environment\n        (agent-shell-make-environment-variables\n         \"ANTHROPIC_BASE_URL\" \"https:\u002F\u002Fapi.moonshot.cn\u002Fanthropic\"\n         \"ANTHROPIC_MODEL\" \"kimi-k2-turbo-preview\"\n         \"ANTHROPIC_SMALL_FAST_MODEL\" \"kimi-k2-turbo-preview\"))\n#+end_src\n\n*** Google Gemini\n\n对于基于登录的身份验证（默认）：\n\n#+begin_src emacs-lisp\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication :login t))\n#+end_src\n\n对于 API 密钥身份验证：\n\n#+begin_src emacs-lisp\n;; 使用字符串\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication :api-key \"your-google-api-key-here\"))\n\n;; 使用函数\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication\n       :api-key (lambda () (auth-source-pass-get 'secret \"google-api-key\"))))\n#+end_src\n\n对于 Vertex AI 身份验证：\n\n#+begin_src emacs-lisp\n(setq agent-shell-google-authentication\n      (agent-shell-google-make-authentication :vertex-ai t))\n#+end_src\n\n*** OpenAI Codex\n\n对于基于登录的身份验证（默认）：\n\n#+begin_src emacs-lisp\n(setq agent-shell-openai-authentication\n      (agent-shell-openai-make-authentication :login t))\n#+end_src\n\n对于 API 密钥身份验证：\n\n#+begin_src emacs-lisp\n;; 使用字符串\n(setq agent-shell-openai-authentication\n      (agent-shell-openai-make-authentication :api-key \"your-openai-api-key-here\"))\n\n;; 使用函数\n(setq agent-shell-openai-authentication\n      (agent-shell-openai-make-authentication\n       :api-key (lambda () (auth-source-pass-get 'secret \"openai-api-key\"))))\n#+end_src\n\n*** Goose\n\n对于 OpenAI API 密钥身份验证：\n\n#+begin_src emacs-lisp\n;; 使用字符串\n(setq agent-shell-goose-authentication\n      (agent-shell-make-goose-authentication :openai-api-key \"your-openai-api-key-here\"))\n\n;; 使用函数\n(setq agent-shell-goose-authentication\n      (agent-shell-make-goose-authentication\n       :openai-api-key (lambda () (auth-source-pass-get 'secret \"openai-api-key\"))))\n#+end_src\n\n*** Qwen Code\n\n对于基于 OAuth 登录的身份验证：\n\n#+begin_src emacs-lisp\n(setq agent-shell-qwen-authentication\n      (agent-shell-qwen-make-authentication :login t))\n#+end_src\n\n*** Auggie\n\n对于基于登录的身份验证（默认）：\n\n#+begin_src emacs-lisp\n(setq agent-shell-auggie-authentication\n      (agent-shell-make-auggie-authentication :login t))\n#+end_src\n\n对于无需身份验证的情况（当使用其他身份验证方法时）：\n\n#+begin_src emacs-lisp\n(setq agent-shell-auggie-authentication\n      (agent-shell-make-auggie-authentication :none t))\n#+end_src\n\n*** Mistral Vibe\n\n对于 API 密钥身份验证：\n\n#+begin_src emacs-lisp\n;; 使用字符串\n(setq agent-shell-mistral-authentication\n      (agent-shell-mistral-make-authentication :api-key \"your-mistral-api-key-here\"))\n\n;; 使用函数（复用 vibe 中配置的 API 密钥）\n(setq agent-shell-mistral-authentication\n      (agent-shell-mistral-make-authentication\n       :api-key (lambda ()\n\t          (string-trim\n\t\t   (shell-command-to-string \"source ~\u002F.vibe\u002F.env; echo $MISTRAL_API_KEY\")))))\n#+end_src\n\n*** 自定义可用代理\n\n默认情况下，=agent-shell= 包含所有受支持代理的配置（Claude Agent、Gemini CLI、Codex、Goose、Qwen Code 和 Auggie）。你可以通过 =agent-shell-agent-configs= 变量自定义哪些代理可用。\n\n** 使用方法\n\n*** 快速入门\n\n=M-x agent-shell= - 启动或复用任何已知的代理。\n\n你可以通过 =agent-shell= 的交互式命令选择并启动任何已知的代理 shell（参见 =agent-shell-agent-configs=），并在现有 shell 可用时复用它们。如果使用前缀参数（=C-u M-x agent-shell=），则会强制启动一个新的 shell 会话，从而实例化多个代理 shell。\n\n*** 特定代理命令\n\n直接启动特定代理的 shell 会话：\n\n- =M-x agent-shell-anthropic-start-claude-code= - 启动 Claude Agent 会话\n- =M-x agent-shell-auggie-start-agent= - 启动 Auggie 代理会话\n- =M-x agent-shell-openai-start-codex= - 启动 Codex 代理会话\n- =M-x agent-shell-google-start-gemini= - 启动 Gemini 代理会话\n- =M-x agent-shell-goose-start-agent= - 启动 Goose 代理会话\n- =M-x agent-shell-cursor-start-agent= - 启动 Cursor 代理会话\n- =M-x agent-shell-kiro-start-agent= - 启动 Kiro CLI 代理会话\n- =M-x agent-shell-mistral-start-vibe= - 启动 Mistral Vibe 代理会话\n- =M-x agent-shell-qwen-start= - 启动 Qwen Code 代理会话\n- =M-x agent-shell-droid-start-agent= - 启动 Factory Droid 代理会话\n- =M-x agent-shell-pi-start-agent= - 启动 Pi 编码代理会话\n\n*** 设置所有新 shell 的默认代理\n\n你可以设置一个默认代理，用于通过 =agent-shell= 启动的所有新 shell，如下所示：\n\n#+begin_src emacs-lisp\n(setq agent-shell-preferred-agent-config (agent-shell-anthropic-make-claude-code-config))\n#+end_src\n\n*** 配置 MCP 服务器\n\n你可以通过 =agent-shell= 直接配置 MCP 服务器。这样可以避免在你使用的每个代理中重复配置。\n\n#+begin_src emacs-lisp\n  (setq agent-shell-mcp-servers\n        '(((name . \"notion\")\n           (type . \"http\")\n           (headers . [])\n           (url . \"https:\u002F\u002Fmcp.notion.com\u002Fmcp\"))))\n#+end_src\n\n** 在 Devcontainers \u002F Docker 容器中运行代理（实验性）\n\n=agent-shell= 提供了在容器中运行代理和 shell 命令的基本支持。\n\n使用 =agent-shell-command-prefix= 来为启动代理的命令或需要在容器内执行的 shell 命令添加前缀。\n\n*** 静态命令列表\n\n#+begin_src emacs-lisp\n(setq agent-shell-command-prefix '(\"devcontainer\" \"exec\" \"--workspace-folder\" \".\"))\n#+end_src\n\n*** 基于函数的配置\n\n对于动态的每代理容器，可以提供一个函数，该函数接收当前的 agent-shell 缓冲区并返回命令列表：\n\n#+begin_src emacs-lisp\n(setq agent-shell-command-prefix\n      (lambda (buffer)\n        (let ((config (agent-shell-get-config buffer)))\n          (pcase (map-elt config :identifier)\n            ('claude-code '(\"docker\" \"exec\" \"claude-dev\" \"--\"))\n            ('gemini-cli '(\"docker\" \"exec\" \"gemini-dev\" \"--\"))\n            (_ '(\"devcontainer\" \"exec\" \".\"))))))\n#+end_src\n\n*** 每会话容器\n\n你可以为不同的 shell 会话使用不同的容器，即使是相同类型的代理：\n\n#+begin_src emacs-lisp\n(setq agent-shell-command-prefix\n      (lambda (buffer)\n        ;; 根据项目选择不同的容器\n        if (string-match \"project-a\" (buffer-name buffer))\n            '(\"docker\" \"exec\" \"project-a-dev\" \"--\")\n          else\n            '(\"docker\" \"exec\" \"project-b-dev\" \"--\"))))\n#+end_src\n\n请注意，你可能传递给 =acp-make-client= 的任何 =:environment-variables= 不会应用到容器内的代理进程。预期应通过你的 devcontainer 配置 \u002F Dockerfile 注入环境变量。\n\n接下来，设置一个 =agent-shell-path-resolver-function=，用于解析本地工作目录中的容器路径，反之亦然。\nAgent shell 提供了专门用于 devcontainers 的 =agent-shell-devcontainer-resolve-path= 函数：它读取 =.devcontainer\u002Fdevcontainer.json= 中指定的 =workspaceFolder=，否则使用默认值 =\u002Fworkspaces\u002F\u003Crepository-name>=。\n\n#+begin_src emacs-lisp\n(setq agent-shell-path-resolver-function #'agent-shell-devcontainer-resolve-path)\n#+end_src\n\n请注意，这允许代理访问你本地文件系统上的文件。尽管已经采取措施限制对本地工作目录中文件的访问，但恶意代理仍有可能绕过这一限制。\n\n可选：为了完全阻止容器内的代理访问你的本地文件系统，并使其直接在容器内读取或修改文件，除了设置解析函数外，还可以禁用“读写文本文件”的客户端能力：\n\n#+begin_src emacs-lisp\n(setq agent-shell-text-file-capabilities nil)\n#+end_src\n\n*** 数据存储位置\n\n默认情况下，agent-shell 会将每个项目的数据（转录本、截图等）存储在项目根目录下的 =.agent-shell\u002F= 目录中，并在首次创建该目录时自动将其添加到 =.gitignore= 中。这是一次性操作：从 =.gitignore= 中移除该条目并不会导致其再次被添加。\n\n你可以通过设置 =agent-shell-dot-subdir-function= 为自定义函数来更改数据的存储位置。该函数接收一个参数 SUBDIR（例如 =\"screenshots\"=），并必须返回该子目录的绝对路径（无需创建该目录）。\n\n例如，要将数据存储在 =user-emacs-directory= 而不是项目树中，将项目路径扁平化为目录名称：\n\n#+begin_src emacs-lisp\n(defun my\u002Fagent-shell-dot-subdir (subdir)\n  (let* ((cwd (string-remove-suffix \"\u002F\" (agent-shell-cwd)))\n         (sanitized (replace-regexp-in-string \"\u002F\" \"-\" (string-remove-prefix \"\u002F\" cwd))))\n    (expand-file-name subdir (locate-user-emacs-file (concat \"agent-shell\u002F\" sanitized)))))\n\n(setopt agent-shell-dot-subdir-function #'my\u002Fagent-shell-dot-subdir)\n#+end_src\n\n这样，数据将存储在类似 =~\u002F.emacs.d\u002Fagent-shell\u002Fhome-user-src-myproject\u002Fscreenshots\u002F= 的路径下。\n\n*** 从剪贴板发送截图\n\n你可以使用 =agent-shell-send-clipboard-image= 将剪贴板中的截图发送到你的 shell。调用时使用 =C-u= 可以选择将截图发送到你的哪个 shell。agent-shell 依赖外部程序将剪贴板中的图像按 =agent-shell-clipboard-image-handlers= 中的配置写入文件。预配置的处理程序包括：\n- =wl-paste= 用于 Wayland 桌面，\n- =xclip= 用于 Xorg，\n- =pngpaste= 用于 MacOS。\n\n*** 写文件时抑制次要模式\n\n某些次要模式（例如 =aggressive-indent-mode=）可能会干扰代理的编辑操作。Agent Shell 可以在应用编辑时临时禁用选定的每缓冲区次要模式。\n\n#+begin_src emacs-lisp\n(setopt agent-shell-write-inhibit-minor-modes '(aggressive-indent-mode))\n#+end_src\n\n以上所有设置都可以通过[[https:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Femacs\u002Fmanual\u002Fhtml_node\u002Femacs\u002FDirectory-Variables.html][目录局部变量]]在每个项目的基础上进行应用。\n\n** 键绑定\n\n- =RET= - 提交提示。\n- =M-J= - 插入新行。\n- =C-c C-c= - 中断当前代理操作\n- =TAB 和 Shift-TAB= - 导航交互式元素\n\n要自定义 =RET= 的绑定行为，可以使用如下代码：\n\n#+begin_src emacs-lisp :lexical no\n  (use-package agent-shell\n    :bind (:map agent-shell-mode-map\n                (\"RET\" . newline)\n                (\"M-RET\" . shell-maker-submit)))\n#+end_src\n\n或者，如果你更倾向于用 C-c C-c 来发送命令、用 C-c C-k 来中断，则可以使用以下配置：\n\n#+begin_src emacs-lisp :lexical no\n  (use-package agent-shell\n    :bind (:map agent-shell-mode-map\n                (\"RET\" . newline)\n                (\"C-c C-c\" . shell-maker-submit)\n                (\"C-c C-k\" . agent-shell-interrupt)))\n#+end_src\n\n\n*** Evil\nEvil 用户可能希望重新绑定 ~RET~ 键：在 =插入模式= 下插入新行，在 =普通模式= 下提交命令。\n\n此外，在查看差异（尚未接受更改时）时，每次都需要进入 =插入模式= 才能输入键值（~y\u002Fn\u002Fp\u002Fq 等），这可能会让人感到不便。如果是这种情况，可以让这些缓冲区默认以 Emacs 模式打开；如果需要切换到 Evil 模式，只需使用 ~C-z~ 即可。\n#+begin_src emacs-lisp\n  (use-package agent-shell\n    :config\n    ;; 根据 Evil 状态定制 RET 行为：插入模式下为 newline，普通模式下为 send\n    (evil-define-key 'insert agent-shell-mode-map (kbd \"RET\") #'newline)\n    (evil-define-key 'normal agent-shell-mode-map (kbd \"RET\") #'comint-send-input)\n\n    ;; 配置 *agent-shell-diff* 缓冲区默认以 Emacs 模式启动\n    (add-hook 'diff-mode-hook\n              (lambda ()\n                (when (string-match-p \"\\\\*agent-shell-diff\\\\*\" (buffer-name))\n                  (evil-emacs-state)))))\n#+end_src\n\n* 自定义选项\n\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"自定义变量\" \"描述\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^agent-shell\"\n                                (symbol-name symbol))\n                  (custom-variable-p symbol))\n         (push `(,symbol\n                 ,(car\n                   (split-string\n                    (or (documentation-property symbol 'variable-documentation)\n                        (get (indirect-variable symbol)\n                             'variable-documentation)\n                        (get symbol 'variable-documentation)\n                        \"\")\n                    \"\\n\")))\n               rows))))\n    (sort rows (lambda (a b)\n                 (string\u003C (symbol-name (car a))\n                          (symbol-name (car b))))))\n#+END_SRC\n\n#+RESULTS:\n| 自定义变量                               | 描述                                                                     |\n|-----------------------------------------------+---------------------------------------------------------------------------------|\n| agent-shell-agent-configs                     | 已知代理配置的列表。                                         |\n| agent-shell-anthropic-authentication          | Anthropic 身份验证的配置。                                     |\n| agent-shell-anthropic-claude-acp-command      | Anthropic Claude 客户端的命令及参数。                         |\n| agent-shell-anthropic-claude-command          | Anthropic Claude 客户端的命令及参数。                         |\n| agent-shell-anthropic-claude-environment      | Anthropic Claude 客户端的环境变量。                          |\n| agent-shell-anthropic-default-model-id        | 默认的 Anthropic 模型 ID。                                                     |\n| agent-shell-anthropic-default-session-mode-id | 默认的 Anthropic 会话模式 ID。                                              |\n| agent-shell-auggie-acp-command                | Auggie 客户端的命令及参数。                                   |\n| agent-shell-auggie-authentication             | Auggie 身份验证的配置。                                        |\n| agent-shell-auggie-environment                | Auggie 客户端的环境变量。                                    |\n| agent-shell-buffer-name-format                | 生成代理 Shell 缓冲区名称时使用的格式。                         |\n| agent-shell-busy-indicator-frames             | 忙碌指示器动画的帧。                                        |\n| agent-shell-clipboard-image-handlers          | 将剪贴板图像保存到文件的处理程序。                                 |\n| agent-shell-completion-mode-hook              | 进入或退出 ‘agent-shell-completion-mode’ 后执行的钩子。               |\n| agent-shell-command-prefix                    | 在容器中执行命令时使用的命令前缀。                           |\n| agent-shell-context-sources                   | 确定 M-x agent-shell 自动上下文时考虑的来源。         |\n| agent-shell-cursor-acp-command                | Cursor 代理客户端的命令及参数。                             |\n| agent-shell-cursor-environment                | Cursor 代理客户端的环境变量。                              |\n| agent-shell-display-action                    | 代理 Shell 缓冲区的显示行为。                                         |\n| agent-shell-droid-acp-command                 | Factory Droid ACP 客户端的命令及参数。                        |\n| agent-shell-droid-authentication              | Factory Droid 身份验证的配置。                                 |\n| agent-shell-droid-environment                 | Factory Droid ACP 客户端的环境变量。                         |\n| agent-shell-embed-file-size-limit             | 使用 ContentBlock::Resource 嵌入的最大文件大小（字节）。           |\n| agent-shell-file-completion-enabled           | 非 nil 值会在启动 Shell 时自动启用文件补全功能。             |\n| agent-shell-github-acp-command                | GitHub Copilot 代理客户端的命令及参数。                     |\n| agent-shell-github-default-model-id           | 默认的 GitHub Copilot 模型 ID。                                                |\n| agent-shell-github-default-session-mode-id    | 默认的 GitHub Copilot 会话模式 ID。                                         |\n| agent-shell-github-environment                | GitHub Copilot 代理客户端的环境变量。                      |\n| agent-shell-google-authentication             | Google 身份验证的配置。                                        |\n| agent-shell-google-gemini-acp-command         | Gemini 客户端的命令及参数。                                   |\n| agent-shell-google-gemini-environment         | Google Gemini 客户端的环境变量。                             |\n| agent-shell-goose-acp-command                 | Goose 客户端的命令及参数。                                    |\n| agent-shell-goose-authentication              | Goose 身份验证的配置。                                         |\n| agent-shell-goose-environment                 | Goose 客户端的环境变量。                                     |\n| agent-shell-header-style                      | 代理 Shell 缓冲区标题的样式。                                           |\n| agent-shell-highlight-blocks                  | 是否高亮显示源代码块。                                      |\n| agent-shell-mcp-servers                       | 创建新会话时要初始化的 MCP 服务器列表。                  |\n| agent-shell-mistral-acp-command               | Mistral Vibe 客户端的命令及参数。                             |\n| agent-shell-mistral-authentication            | Mistral AI 身份验证的配置。                                    |\n| agent-shell-mistral-default-model-id          | 默认的 Mistral AI 模型 ID。                                                    |\n| agent-shell-mistral-default-session-mode-id   | 默认的 Mistral AI 会话模式 ID。                                             |\n| agent-shell-mistral-environment               | Mistral Vibe 客户端的环境变量。                              |\n| agent-shell-openai-authentication             | OpenAI 身份验证的配置。                                        |\n| agent-shell-openai-codex-acp-command          | OpenAI Codex 客户端的命令及参数。                             |\n| agent-shell-openai-codex-environment          | OpenAI Codex 客户端的环境变量。                              |\n| agent-shell-openai-default-model-id           | 默认的 Codex 模型 ID。                                                         |\n| agent-shell-openai-default-session-mode-id    | 默认的 Codex 会话模式 ID。                                                  |\n| agent-shell-opencode-acp-command              | OpenCode 客户端的命令及参数。                                 |\n| agent-shell-opencode-authentication           | OpenCode 身份验证的配置。                                      |\n| agent-shell-opencode-default-model-id         | 默认的 OpenCode 模型 ID。                                                      |\n| agent-shell-opencode-default-session-mode-id  | 默认的 OpenCode 会话模式 ID。                                               |\n| agent-shell-opencode-environment              | OpenCode 客户端的环境变量。                                  |\n| agent-shell-path-resolver-function            | 用于解析本地文件系统上的远程路径，以及反向解析的函数。   |\n| agent-shell-permission-icon                   | 当 Shell 命令需要权限才能执行时显示的图标。                   |\n| agent-shell-pi-acp-command                    | Pi ACP 客户端的命令及参数。                                   |\n| agent-shell-pi-environment                    | Pi 客户端的环境变量。                                        |\n| agent-shell-prefer-session-resume             | 当同时存在 ACP 会话恢复和会话加载时，优先选择 ACP 会话恢复。 |\n| agent-shell-prefer-viewport-interaction       | 非 nil 值会使 ‘agent-shell’ 更倾向于视口交互而非 Shell 交互。 |\n| agent-shell-preferred-agent-config            | 所有新 Shell 的默认代理配置。                                         |\n| agent-shell-qwen-acp-command                  | Qwen Code 客户端的命令及参数。                                |\n| agent-shell-qwen-authentication               | Qwen Code 身份验证的配置。                                     |\n| agent-shell-qwen-environment                  | Qwen Code 客户端的环境变量。                                 |\n| agent-shell-screenshot-command                | 用于截取屏幕截图的程序。                                       |\n| agent-shell-section-functions                 | 应用叠加层后运行的异常钩子（实验性）。                    |\n| agent-shell-session-strategy                  | 启动新 Shell 时如何处理会话。                               |\n| agent-shell-show-busy-indicator               | 非 nil 值会在标题栏和模式行显示忙碌指示器动画。       |\n| agent-shell-show-config-icons                 | 是否在代理配置选择中显示图标。                                |\n| agent-shell-show-context-usage-indicator      | 非 nil 值会在标题栏和模式行显示上下文使用情况指示器。        |\n| agent-shell-show-usage-at-turn-end            | 代理回合结束时是否显示使用信息。                              |\n| agent-shell-show-welcome-message              | 非 nil 值会显示欢迎消息。                                                |\n| agent-shell-text-file-capabilities            | 代理是否被初始化为具有读写文本文件的能力。                  |\n| agent-shell-thought-process-expand-by-default | 思考过程部分是否应默认展开。                                 |\n| agent-shell-thought-process-icon              | AI 思考过程中显示的图标。                                     |\n| agent-shell-tool-use-expand-by-default        | 工具使用部分是否应默认展开。                                 |\n| agent-shell-transcript-file-path-function     | 用于生成完整转录文件路径的函数。                             |\n| agent-shell-ui-mode-hook                      | 进入或离开 ‘agent-shell-ui-mode’ 后执行的钩子。                       |\n| agent-shell-user-message-expand-by-default    | 用户消息部分是否应默认展开。                                |\n| agent-shell-write-inhibit-minor-modes         | 在 ‘fs\u002Fwrite_text_file’ 编辑期间要禁用的次要模式命令列表。       |\n\n* 命令\n#+BEGIN_SRC emacs-lisp :results table :colnames '(\"绑定\" \"命令\" \"描述\") :exports results\n  (let ((rows))\n    (mapatoms\n     (lambda (symbol)\n       (when (and (string-match \"^agent-shell\"\n                                (symbol-name symbol))\n                  (commandp symbol))\n         (push `(,(string-join\n                   (seq-filter\n                    (lambda (symbol)\n                      (not (string-match \"menu\" symbol)))\n                    (mapcar\n                     (lambda (keys)\n                       (key-description keys))\n                     (or\n                      (where-is-internal\n                       (symbol-function symbol)\n                       comint-mode-map\n                       nil nil (command-remapping 'comint-next-input))\n                      (where-is-internal\n                       symbol agent-shell-mode-map nil nil (command-remapping symbol))\n                      (where-is-internal\n                       (symbol-function symbol)\n                       agent-shell-mode-map nil nil (command-remapping symbol)))))  \" 或 \")\n                 ,(symbol-name symbol)\n                 ,(car\n                   (split-string\n                    (or (documentation symbol t) \"\")\n                    \"\\n\")))\n               rows))))\n    (sort rows (lambda (a b)\n                 (string\u003C (cadr a) (cadr b)))))\n#+END_SRC\n\n#+RESULTS:\n| 绑定         | 命令                                                 | 描述                                                                   |\n|-----------------+---------------------------------------------------------+-------------------------------------------------------------------------------|\n|                 | agent-shell                                             | 启动或复用现有的代理 Shell。                                       |\n|                 | agent-shell--display-buffer                             | 切换代理 SHELL-BUFFER 的显示。                                            |\n|                 | agent-shell-anthropic-start-claude-code                 | 启动交互式的 Claude 代理 Shell。                                      |\n|                 | agent-shell-auggie-start-agent                          | 启动交互式的 Auggie 代理 Shell。                                      |\n|                 | agent-shell-clear-buffer                                | 清空当前的 Shell 缓冲区。                                               |\n|                 | agent-shell-completion-mode                             | 切换带有 @ 或 \u002F 前缀的代理 Shell 补全功能。                             |\n|                 | agent-shell-cursor-start-agent                          | 启动交互式的 Cursor 代理 Shell。                                      |\n| C-\u003Ctab>         | agent-shell-cycle-session-mode                          | 在当前 `agent-shell` 会话中循环切换可用的会话模式。                  |\n|                 | agent-shell-delete-interaction-at-point                 | 删除光标处的交互内容（请求和响应）。                                   |\n|                 | agent-shell-droid-start-agent                           | 启动交互式的 Factory Droid 代理 Shell。                               |\n|                 | agent-shell-fakes-load-session                          | 从文件加载并回放流量会话。                                              |\n|                 | agent-shell-github-start-copilot                        | 启动交互式的 GitHub Copilot 代理 Shell。                               |\n|                 | agent-shell-google-start-gemini                         | 启动交互式的 Gemini CLI 代理 Shell。                                   |\n|                 | agent-shell-goose-start-agent                           | 启动交互式的 Goose 代理 Shell。                                        |\n|                 | agent-shell-help-menu                                   | `agent-shell` 命令的临时菜单。                                          |\n|                 | agent-shell-insert-file                                 | 将文件插入到 `agent-shell` 中。                                         |\n|                 | agent-shell-insert-shell-command-output                 | 执行 Shell 命令并将输出以代码块形式插入。                            |\n| C-c C-c         | agent-shell-interrupt                                   | 中断正在进行的请求，并拒绝所有待处理的权限。                         |\n|                 | agent-shell-jump-to-latest-permission-button-row        | 跳转到最新的权限按钮行。                                                |\n|                 | agent-shell-mistral-start-vibe                          | 启动交互式的 Mistral Vibe 代理 Shell。                                 |\n|                 | agent-shell-mode                                        | 代理 Shell 的主模式。                                                   |\n|                 | agent-shell-new-shell                                   | 启动一个新的代理 Shell。                                                |\n| S-\u003Creturn>      | agent-shell-newline                                     | 插入一个换行符，并将光标移动到新行的左边界。                          |\n| C-\u003Cdown> 或 M-n | agent-shell-next-input                                  | 按顺序向前循环浏览输入历史记录。                                        |\n| n 或 TAB        | agent-shell-next-item                                   | 移动到下一个项目。                                                      |\n|                 | agent-shell-next-permission-button                      | 跳转到下一个按钮。                                                     |\n|                 | agent-shell-open-transcript                             | 打开当前 `agent-shell` 缓冲区的对话记录文件。                         |\n|                 | agent-shell-openai-start-codex                          | 启动交互式的 Codex 代理 Shell。                                        |\n|                 | agent-shell-opencode-start-agent                        | 启动交互式的 OpenCode 代理 Shell。                                     |\n| C-c C-o         | agent-shell-other-buffer                                | 切换到另一个相关缓冲区（视口与 Shell 之间）。                          |\n| C-\u003Cup> 或 M-p   | agent-shell-previous-input                              | 按顺序向后循环浏览输入历史记录，并保存输入。                          |\n| p 或 \u003Cbacktab>  | agent-shell-previous-item                               | 移动到前一个项目。                                                      |\n|                 | agent-shell-previous-permission-button                  | 跳转到前一个按钮。                                                     |\n|                 | agent-shell-prompt-compose                              | 在专用缓冲区中编写 `agent-shell` 提示词。                              |\n|                 | agent-shell-queue-request                               | 根据 Shell 的繁忙状态，将请求加入队列或立即发送。                     |\n|                 | agent-shell-qwen-start                                  | 启动交互式的 Qwen Code CLI 代理 Shell。                                 |\n|                 | agent-shell-remove-pending-request                      | 移除所有待处理的请求，或根据 REMOVE-INDEX 移除特定的请求。             |\n| C-x x r         | agent-shell-rename-buffer                               | 重命名当前的 Shell 缓冲区。                                             |\n|                 | agent-shell-reset-logs                                  | 重置所有日志缓冲区。                                                    |\n|                 | agent-shell-resume-pending-requests                     | 恢复处理队列中的待处理请求。                                           |\n|                 | agent-shell-run-all-tests                               | 以批处理模式运行所有 `agent-shell` 测试。                              |\n| M-r             | agent-shell-search-history                              | 搜索之前的输入历史。                                                    |\n|                 | agent-shell-send-current-file                           | 将文件插入到 `agent-shell` 中。                                         |\n|                 | agent-shell-send-dwim                                   | 将区域或光标处的错误发送到项目中最近访问过的 Shell 缓冲区。           |\n|                 | agent-shell-send-file                                   | 将文件插入到 `agent-shell` 中。                                         |\n|                 | agent-shell-send-other-file                             | 提示用户发送文件到 `agent-shell`。                                     |\n|                 | agent-shell-send-region                                 | 将区域发送到项目中最近访问过的 Shell 缓冲区。                         |\n|                 | agent-shell-send-screenshot                             | 截取屏幕截图并将其插入到 `agent-shell` 中。                            |\n| C-c RET         | agent-shell-set-session-mode                            | 设置会话模式（如果有可用的模式）。                                    |\n| C-c C-v         | agent-shell-set-session-model                           | 设置会话模型。                                                          |\n| RET             | agent-shell-submit                                      | 提交当前的输入内容。                                                    |\n|                 | agent-shell-toggle                                      | 切换代理 Shell 的显示状态。                                             |\n|                 | agent-shell-toggle-logging                              | 切换日志记录功能。                                                      |\n|                 | agent-shell-ui-backward-block                           | 跳转到上一个区块。                                                     |\n|                 | agent-shell-ui-forward-block                            | 跳转到下一个区块。                                                     |\n|                 | agent-shell-ui-mode                                     | 用于 SUI 区块导航的次级模式。                                          |\n|                 | agent-shell-ui-toggle-fragment-at-point                 | 切换光标处片段内容的可见性。                                           |\n|                 | agent-shell-version                                     | 显示 `agent-shell` 模式的版本号。                                      |\n|                 | agent-shell-view-acp-logs                               | 查看代理 Shell 的 ACP 日志缓冲区。                                     |\n|                 | agent-shell-view-traffic                                | 查看代理 Shell 的流量缓冲区。                                          |\n|                 | agent-shell-viewport-compose-cancel                     | 取消提示词的编写过程。                                                  |\n|                 | agent-shell-viewport-compose-send                       | 将视口编写的提示词发送到代理 Shell。                                   |\n|                 | agent-shell-viewport-compose-send-and-kill              | 将视口编写的提示词发送到代理 Shell，并关闭编写缓冲区。                |\n|                 | agent-shell-viewport-compose-send-and-wait-for-response | 将视口编写的提示词发送到代理 Shell，并在视口中显示响应。               |\n|                 | agent-shell-viewport-cycle-session-mode                 | 循环切换可用的会话模式。                                                |\n|                 | agent-shell-viewport-edit-mode                          | 用于编写代理 Shell 提示词的主模式。                                   |\n|                 | agent-shell-viewport-interrupt                          | 中断当前的代理 Shell 请求。                                             |\n|                 | agent-shell-viewport-next-item                          | 移动到下一个项目。                                                      |\n|                 | agent-shell-viewport-next-page                          | 显示下一次交互（请求\u002F响应）。                                           |\n|                 | agent-shell-viewport-previous-item                      | 移动到前一个项目。                                                      |\n|                 | agent-shell-viewport-previous-page                      | 显示前一次交互（请求\u002F响应）。                                           |\n|                 | agent-shell-viewport-refresh                            | 使用来自 Shell 的当前项目刷新视口缓冲区内容。                          |\n|                 | agent-shell-viewport-reply                              | 作为后续回复并编写另一个提示词\u002F查询。                                  |\n|                 | agent-shell-viewport-set-session-mode                   | 设置会话模式。                                                          |\n|                 | agent-shell-viewport-set-session-model                  | 设置会话模型。                                                          |\n|                 | agent-shell-viewport-view-last                          | 显示最近一次请求\u002F响应的交互内容。                                      |\n|                 | agent-shell-viewport-view-mode                          | 用于查看代理 Shell 提示词的主模式（只读）。                            |\n* 提交问题\n提交问题时，请保留[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fblob\u002Fmain\u002F.github\u002FISSUE_TEMPLATE\u002Fissue.md][问题模板]]中的复选框，并根据实际情况勾选。这些复选框有助于确保我获得足够的信息来提供帮助。\n\n在提交问题或功能请求之前，请仔细阅读本节内容。只有当我掌握足够的信息时，才能为您提供帮助。本节将说明如何获取我所需的详细信息。\n\n- *版本信息*：您当前运行的 =agent-shell=、=acp.el=、ACP 包（例如 =claude-code-acp=）以及代理 CLI（例如 =claude=、=gemini=）分别是什么版本？\n- *复现步骤*：导致该问题的具体操作步骤是什么？请详细说明您执行了哪些操作以及它们的顺序。\n- *ACP 流量*：请参阅上方的[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell?tab=readme-ov-file#how-do-i-viewget-agent-client-protocol-traffic][如何查看\u002F获取 ACP 流量]]。这是诊断问题时最有用的信息。\n- *截图*：截图有助于将您看到的内容与协议数据对应起来。\n- *您的 agent-shell 配置*：请分享您 Emacs 配置中与 =agent-shell= 相关的变量设置。\n- *性能分析数据*（针对性能问题）：使用 =M-x profiler-start= 启动性能分析，复现问题后，再使用 =M-x profiler-report=（并 =M-x profiler-stop=）生成报告。请一并提供该报告。\n\n** 为什么 =agent-shell= 不会提供 CLI 代理中所有可用的斜杠命令\u002F技能？\n\n=agent-shell= 只能提供代理通过[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]公开的斜杠命令和技能。要查看您的代理暴露了哪些内容，请展开“Available \u002Fcommands”部分。如果您想要的命令未列出，请考虑向相应的代理（如 Gemini CLI）或其 ACP 层（如 claude-code-acp）提交功能请求。\n\n[[file:slash-commands.png]]\n\n\n** 能否添加对其他代理的支持？\n\n该代理是否支持 ACP（[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]）？如果支持，=agent-shell= 很有可能能够兼容该代理。有些代理内置了 ACP 支持（如 [[https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli][gemini-cli]]），而另一些则需要单独的 ACP 包（如 [[https:\u002F\u002Fgithub.com\u002Fzed-industries\u002Fclaude-code-acp][claude-code-acp]] 用于 [[https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code][claude-code]]）。在提交添加新代理的功能请求时，请附上支持[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]的项目链接（无论是内置还是独立的包）。\n\n不支持 ACP 的代理不在 =agent-shell= 的集成范围内。不过，如果您构建了一个类似 =claude-agent-acp= 的 ACP 层，那么 =agent-shell= 就可以与其配合使用。\n\n** =agent-shell= 行为不符合预期？\n\n这可能是代理本身缺少[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]相关功能，也可能是 =agent-shell= 缺少该功能，或者两者都有问题 :) 那到底是哪一方的问题呢？除非我们查看两者之间的[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]流量，否则很难判断。\n\n** 如何查看\u002F获取[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]流量？\n\n1. 使用 =M-x agent-shell-toggle-logging= 开启日志记录。\n2. 复现问题。\n3. 使用 =M-x agent-shell-view-traffic= 查看流量。\n\n浏览流量数据，看看是否能找到问题所在。例如，如果代理发送了一个请求，要求用户授权，但 =agent-shell= 并未提示用户进行授权，那么很可能 =agent-shell= 缺少相应功能。\n\n以下是从流量查看器中显示的一个[[https:\u002F\u002Fagentclientprotocol.com\u002Fprotocol\u002Fschema#session%2Frequest-permission][session\u002Frequest_permission]]请求示例。\n\n[[file:traffic.png]]\n\n有时，在问题中附上流量截图就足够了；而在另一些情况下，则需要提供完整的流量数据。您可以通过流量查看器使用 =M-x acp-traffic-save-to= 将流量保存为 =.traffic= 文件。\n\n** 我应该在哪里提交 bug 或功能请求？\n\n*** 代理相关的问题或功能请求\n\n如果您确定问题是由于代理在其[[https:\u002F\u002Fagentclientprotocol.com][代理客户端协议]]实现中缺少功能（或存在 bug），请直接向代理团队提交问题。例如：\n\n- [[https:\u002F\u002Fgithub.com\u002Fagentclientprotocol\u002Fclaude-agent-acp][claude-agent-acp]]：适用于 Claude Agent。\n- [[https:\u002F\u002Fgithub.com\u002Fzed-industries\u002Fcodex-acp][codex-acp]]：适用于 Codex。\n- [[https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli][Gemini CLI]]。\n- [[https:\u002F\u002Fblock.github.io\u002Fgoose\u002Fdocs\u002Fgetting-started\u002Finstallation][Goose]]。\n- [[https:\u002F\u002Fgithub.com\u002FQwenLM\u002Fqwen-code][Qwen Code]]。\n\n*** =agent-shell= 相关的问题或功能请求\n\n另一方面，如果您发现 =agent-shell= 缺少某些功能（或存在 bug），请前往[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues][提交 =agent-shell= 的问题]]。\n\n*** 不确定该在哪里提交问题？\n\n您可以先将问题提交到[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues][=agent-shell= 的仓库]]，但请尽量提供详细信息，以便我能判断是 =agent-shell= 还是代理本身需要改进。流量数据在此非常有帮助。如果您认为有帮助，请提供截图或 .traffic 文件。请参阅[[https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell?tab=readme-ov-file#how-do-i-viewget-agent-client-protocol-traffic][如何获取 ACP 流量]]。\n\n* 贡献说明\n\n请参阅[[file:CONTRIBUTING.org][CONTRIBUTING.org]]。\n\n* 贡献者\n\n#+HTML: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fgraphs\u002Fcontributors\">\n#+HTML:   \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_agent-shell_readme_e499fb7271f8.png\" \u002F>\n#+HTML: \u003C\u002Fa>\n\n由[[https:\u002F\u002Fcontrib.rocks][contrib.rocks]]制作。","# agent-shell 快速上手指南\n\n`agent-shell` 是一个原生的 Emacs Shell，基于 **ACP (Agent Client Protocol)** 协议，让你可以直接在 Emacs 中与各类 LLM 智能体（如 Claude Agent、Gemini CLI、Codex 等）进行交互。\n\n## 1. 环境准备\n\n### 系统要求\n- **Emacs**: 建议最新版本\n- **包管理器**: 需配置好 MELPA 源\n- **Node.js \u002F npm**: 大多数 ACP 客户端依赖 Node.js 环境\n- **Python \u002F uv**: 部分客户端（如 Mistral Vibe）可能需要\n\n### 前置依赖安装\n在使用 `agent-shell` 前，必须先安装对应 AI 模型的 ACP 适配器。请根据你想使用的模型选择安装：\n\n**Claude Agent (Anthropic)**\n```bash\nnpm install -g @agentclientprotocol\u002Fclaude-agent-acp\n# 验证安装\nwhich claude-agent-acp\n```\n*注：如需使用订阅服务，请先在终端运行 `claude` 命令完成登录。*\n\n**OpenAI Codex**\n确保安装 `codex-acp` 并将其加入 PATH。\n\n**Google Gemini CLI**\n需安装支持 `--experimental-acp` 标志的最新版本。\n\n**Cursor Agent**\n```bash\nnpm install -g @blowmage\u002Fcursor-agent-acp\n```\n\n**Qwen Code (通义千问)**\n```bash\nnpm install -g @qwen-code\u002Fqwen-code@latest\n```\n\n**Mistral Vibe**\n```bash\nuv tool install mistral-vibe\n```\n\n**其他模型 (Auggie, Kiro, Goose 等)**\n请参考项目 README 中的 \"External dependencies\" 章节安装对应的 CLI 工具。\n\n---\n\n## 2. 安装步骤\n\n`agent-shell` 及其依赖 (`acp.el`, `shell-maker`) 均已托管在 MELPA 上。\n\n### 方式一：使用 use-package (推荐)\n在你的 Emacs 配置文件 (`init.el` 或 `config.el`) 中添加：\n\n```emacs-lisp\n(use-package agent-shell\n    :ensure t\n    :ensure-system-package\n    ;; 可选：自动安装系统依赖示例\n    ((claude . \"brew install claude-code\")\n     (claude-agent-acp . \"npm install -g @agentclientprotocol\u002Fclaude-agent-acp\")))\n```\n\n### 方式二：Doom Emacs\n在 `packages.el` 中添加：\n```emacs-lisp\n(package! shell-maker)\n(package! acp)\n(package! agent-shell)\n```\n执行 `doom sync` 并重启 Emacs。\n\n在配置文件中加载：\n```emacs-lisp\n(require 'acp)\n(require 'agent-shell)\n```\n\n---\n\n## 3. 基本配置与使用\n\n### 认证配置\n在启动 Agent 前，需配置对应的 API Key 或登录状态。以 **Anthropic Claude** 为例：\n\n**方案 A：使用 API Key (字符串)**\n```emacs-lisp\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication :api-key \"your-anthropic-api-key-here\"))\n```\n\n**方案 B：使用 auth-source 安全读取 (推荐)**\n```emacs-lisp\n(setq agent-shell-anthropic-authentication\n      (agent-shell-anthropic-make-authentication\n       :api-key (lambda () (auth-source-pass-get 'secret \"anthropic-api-key\"))))\n```\n\n**方案 C：继承当前环境变量**\n如果已在终端导出过 `ANTHROPIC_API_KEY`，可直接继承：\n```emacs-lisp\n(setq agent-shell-anthropic-claude-environment\n      (agent-shell-make-environment-variables :inherit-env t))\n```\n\n*其他模型（Google, OpenAI 等）配置方式类似，只需将 `anthropic` 替换为 `google` 或 `openai`。*\n\n### 启动 Agent\n配置完成后，在 Emacs 中执行以下命令即可启动会话：\n\n1. 按下 `M-x` (Alt + x)。\n2. 输入 `agent-shell` 并回车。\n3. 选择你要使用的 Agent 类型（例如 `claude`, `gemini`, `cursor` 等）。\n\n此时会打开一个标准的 Comint Shell 缓冲区，你可以像使用普通终端一样与 AI 对话、发送代码或执行任务。\n\n### 进阶提示\n- **环境变量管理**: 可使用 `agent-shell-make-environment-variables` 加载 `.env` 文件或设置代理。\n- **多会话管理**: 配合 `agent-shell-workspace` 或 `agent-shell-manager` 插件可更好地管理多个并发会话。","资深 Emacs 用户李明正在重构一个遗留的 Python 微服务项目，需要频繁调用 Claude Agent 进行代码分析和重构建议。\n\n### 没有 agent-shell 时\n- **上下文割裂**：必须在浏览器标签页、终端 CLI 和 Emacs 编辑器之间反复切换，打断心流，复制粘贴代码极易出错。\n- **会话管理混乱**：多个重构任务的对话记录散落在不同窗口或浏览器无痕模式中，难以追溯之前的决策逻辑。\n- **操作效率低下**：无法直接在编辑器内选中代码块发送给 AI，每次交互都需要手动保存文件再运行外部命令，反馈延迟高。\n- **缺乏深度集成**：AI 生成的代码片段无法直接利用 Emacs 的语法高亮、跳转定义等原生功能进行即时审查。\n\n### 使用 agent-shell 后\n- **原生无缝交互**：直接在 Emacs Buffer 中通过 ACP 协议与 Claude Agent 对话，选中代码即可发送，无需离开编辑环境。\n- **统一会话管理**：所有 AI 交互历史以标准 Buffer 形式存在，可利用 Emacs 强大的多窗口布局和书签功能轻松管理多个重构任务。\n- **实时高效反馈**：修改代码后立刻在同一个缓冲区获取 AI 的分析结果，支持流式输出，大幅缩短“思考 - 执行”循环。\n- **深度工作流融合**：AI 返回的代码直接享受 Emacs 的主模式支持（如语法检查、自动补全），并可配合 `agent-review` 等插件进行专业化代码审查。\n\nagent-shell 将分散的 AI 代理能力转化为 Emacs 原生的核心工作流，让开发者在熟悉的编辑环境中实现真正的人机协作闭环。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fxenodium_agent-shell_ae60f6e4.png","xenodium",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fxenodium_81b55036.jpg","London, UK","xenodium.com","https:\u002F\u002Fgithub.com\u002Fxenodium",[81],{"name":82,"color":83,"percentage":84},"Emacs Lisp","#c065db",100,1045,142,"2026-04-16T14:55:56","GPL-3.0","Linux, macOS, Windows","未说明",{"notes":92,"python":90,"dependencies":93},"该工具是 Emacs 插件，本身无特定硬件需求，运行需求取决于所连接的外部 AI Agent（如 Claude Code, Gemini CLI, Cursor 等）。需预先在系统 PATH 中安装对应的 Agent 命令行工具（通常通过 npm 或 uv 安装）。支持多种认证方式（登录、API Key、OAuth），可通过环境变量或 .env 文件配置代理及 API 端点。",[94,95,96,97,98],"Emacs (内置 comint-shell)","shell-maker (MELPA)","acp.el (MELPA)","Node.js\u002Fnpm (用于安装各类 Agent CLI，如 claude-agent-acp, cursor-agent-acp 等)","uv (用于安装 Mistral Vibe)",[13,35,45,15,14],[101,102,103,104,105,106,107,108,109,110],"ai","claude","claude-code","codex","emacs","emacs-lisp","gemini","goose","llm","openai","2026-03-27T02:49:30.150509","2026-04-17T08:24:22.644446",[114,119,124,129,134,139,143],{"id":115,"question_zh":116,"answer_zh":117,"source_url":118},37298,"如何使用 Google 登录方式配置 Gemini CLI 到 agent-shell？","从版本 0.2.1 开始，agent-shell 已支持在配置文件中直接使用 Google 登录方式。您无需再手动填写 API Key，只需按照文档更新配置即可。具体步骤：\n1. 将 agent-shell 升级到 0.2.1 或更高版本\n2. 参考官方文档的配置部分：https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell?tab=readme-ov-file#configuration\n3. 选择登录认证方式而非 API Key 方式\n\n已有用户确认该登录配置功能正常工作。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues\u002F26",{"id":120,"question_zh":121,"answer_zh":122,"source_url":123},37296,"使用 asdf 管理 Node.js 时，启动 Claude Code 进程报错 ENOENT 怎么办？","这是一个已知问题，通常是因为 `claude-code-acp` 适配器在使用 asdf 时难以正确找到 Node 路径。建议切换到 `mise` 替代 asdf，它在 Emacs 集成方面表现更好。如果使用 mise，请确保在调用 `agent-shell` 命令之前加载 mise 包，并配置环境变量传播。示例配置如下：\n\n```elisp\n(defun mike\u002Fmise-redo-mise-auto-propagate ()\n  (interactive)\n  (dolist (cmd mise-auto-propagate-commands)\n    (advice-add cmd :around #'mise-propagate-env)))\n\n(use-package agent-shell :defer t\n  :config\n  (nconc mise-auto-propagate-commands '(...)))\n```\n注意：mise 包会在加载时自动包裹 `agent-shell` 以确保环境变量正确设置。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues\u002F23",{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},37297,"如何通过 agent-shell 指定 Claude Code 使用的 Anthropic 模型（如 Sonnet、Opus）？","可以通过两种方式指定模型：\n1. 设置环境变量 `ANTHROPIC_MODEL`，例如：`export ANTHROPIC_MODEL=claude-sonnet-4-5-20250929`\n2. 在 `~\u002F.claude\u002Fsettings.json` 文件中配置默认模型。\n\n注意：如果通过 Vertex AI 使用（即设置了 `CLAUDE_CODE_USE_VERTEX=1`），这些设置同样有效。如果模型未被正确识别，请检查是否使用了最新版本的 `agent-shell` 和 `claude-code-acp`，旧版本可能存在回归问题导致设置被忽略。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues\u002F127",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},37299,"如何让一个 Agent 会话同时服务于多个项目目录？","目前的行为是：如果在父目录启动 Agent，进入子项目后可能无法通过常规命令访问该 Agent。虽然官方尚未实现正式的\"项目关联\"功能，但变通方法是：\n1. 在包含多个项目的公共父目录中启动 Agent 会话\n2. 当需要在特定子项目中与 Agent 交互时，手动切换到对应的 Agent 缓冲区\n3. 或者等待后续版本可能支持的 `agent-shell-associate-agent` 功能，该功能允许手动将缓冲区与项目关联\n\n维护者已确认这是一个需要改进的场景，并修复了部分相关 bug（commit: 6db6fb1）。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues\u002F243",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},37300,"快捷键 C-\u003Ctab> 或 C-c C-m 无法切换到 yolo 模式，提示\"No session models available\"怎么办？","此问题通常是因为未正确加载会话模型配置。请检查以下几点：\n1. 确认已安装最新版本的 agent-shell（通过 MELPA 安装的可能不是最新版，建议从源码安装或刷新包列表）\n2. 检查本地 `agent-shell.elc` 文件中是否包含 session-modes 相关代码（可查看 pull request #141 的合并内容）\n3. 尝试手动执行 `M-x agent-shell-set-session-mode` 或 `M-x agent-shell-set-session-model` 来设置模式，而不是依赖快捷键\n4. 确保当前会话已正确初始化并连接到支持多模型的 Agent（如 Qwen）","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues\u002F152",{"id":140,"question_zh":141,"answer_zh":142,"source_url":138},37301,"如何向 Agent 发送斜杠命令（如 \u002Fabout）而不是将其作为普通文本数据发送？","当以 `\u002F` 开头输入内容时，某些 Agent 可能会将其视为普通数据而非命令。要确保命令被正确解析：\n1. 确认您使用的 Agent 支持 Agent Client Protocol (ACP)，详见 https:\u002F\u002Fagentclientprotocol.com\n2. 不同 Agent 对斜杠命令的处理方式不同，例如 Gemini 可能需要特定格式才能识别 `\u002Fabout` 等内置命令\n3. 如果直接发送无效，可以尝试在 agent-shell 中使用专门的命令发送功能，或通过配置告诉 Agent 将 `\u002F` 前缀的内容作为命令处理\n\n注意：这不是 agent-shell 本身的问题，而是取决于底层 Agent 的实现。",{"id":144,"question_zh":145,"answer_zh":146,"source_url":147},37302,"agent-shell 是否支持 Cursor Agent？如何配置？","是的，agent-shell 现已支持 Cursor Agent。维护者已在 commit 2a54603 中添加了对 Cursor 的支持。配置方法与其他支持的 Agent 类似：\n1. 确保安装了最新版本的 agent-shell\n2. 在配置文件中添加 Cursor Agent 的相关设置（具体配置项请参考 README 文档中的\"Supported Agents\"部分）\n3. 启动后即可像使用其他 Agent 一样使用 Cursor\n\n如果您有 Cursor 许可证，现在可以直接在 Emacs 中通过 agent-shell 使用它。","https:\u002F\u002Fgithub.com\u002Fxenodium\u002Fagent-shell\u002Fissues\u002F69",[]]