Agent Emacs: The Living Workspace
This skill provides a persistent, high-performance Emacs environment designed specifically for AI agents. It replaces fragmented CLI tools with a unified "Living Image" workflow.
Core Concepts
- 1. The Daemon: All work happens inside a persistent Emacs daemon (
emacs-agent.service). - The Socket: Communication is handled via
emacsclient -s /tmp/emacs0/server. - Buffers as State: Files, terminal outputs, and remote connections are treated as persistent buffers. State is maintained between agent turns.
Operational Workflow
1. Structural Editing
Do not use regex for complex code changes. Use ELisp forms to manipulate the AST.
CODEBLOCK0
2. Remote Infrastructure (TRAMP)
Manage remote nodes transparently. Opening a remote file automatically establishes a persistent SSH tunnel.
CODEBLOCK1
3. Project Management (Magit)
Use Magit for all Git operations to ensure high-integrity commits and staging.
Advanced Workflows
For detailed patterns on recursive data processing (RLM), memory management, and REPL-based accuracy, see:
Guaranteed Accuracy
Always use the Emacs Lisp REPL for math, data manipulation, or status calculations. Accuracy is paramount; do not attempt manual calculations.
Initialization
Run
scripts/bootstrap.sh to ensure the daemon is active and the
agent-init.el configuration is loaded.
Agent Emacs:动态工作空间
本技能为AI代理提供持久化、高性能的Emacs环境,用统一的动态镜像工作流替代零散的CLI工具。
核心概念
- 1. 守护进程:所有工作均在持久化Emacs守护进程(emacs-agent.service)内完成。
- 套接字:通过emacsclient -s /tmp/emacs0/server进行通信。
- 缓冲区即状态:文件、终端输出和远程连接均作为持久化缓冲区处理。代理轮次间的状态得以保持。
操作工作流
1. 结构化编辑
不要对复杂代码变更使用正则表达式。应使用ELisp形式操作抽象语法树。
bash
emacsclient -s /tmp/emacs0/server --eval (with-current-buffer \main.lisp\ (goto-char (point-max)) (insert \\n(new-function)\))
2. 远程基础设施(TRAMP)
透明管理远程节点。打开远程文件会自动建立持久化SSH隧道。
elisp
(find-file /ssh:user@remote-node:/etc/config.json)
3. 项目管理(Magit)
所有Git操作均使用Magit,确保提交和暂存的高完整性。
高级工作流
关于递归数据处理(RLM)、内存管理和基于REPL的精确性的详细模式,请参阅:
精度保证
始终使用Emacs Lisp REPL进行数学运算、数据处理或状态计算。精度至关重要;请勿尝试手动计算。
初始化
运行scripts/bootstrap.sh以确保守护进程处于活动状态,并加载agent-init.el配置。