diff --git a/Agent.md b/Agent.md index ed6bb9b..2b3615d 100644 --- a/Agent.md +++ b/Agent.md @@ -1,6 +1,6 @@ # EMRG — Agent.md -> This is the Codex-compatible project context file. See `README.md` for the canonical project description (中文). +> This is the Codex-compatible project context file. See `README.md` for the canonical project description (English). ## Project Overview @@ -34,8 +34,8 @@ EMRG is a self-evolving AI agent architecture experiment. Python implementation, - Client auto-detects/starts the server on launch; server stays running on client exit - Server logs are discarded (`stderr=DEVNULL`) - Client logs go to `./.emrg/emrg-client.log` -- **README language**: `README.md` = Chinese (default), `README.en.md` = English -- **Project context files**: `README.md` = Chinese, `Agent.md` = English +- **README language**: `README.md` = English (default), `README.cn.md` = Chinese +- **Project context files**: `README.md` = English, `Agent.md` = English ## Current Features diff --git a/README.cn.md b/README.cn.md new file mode 100644 index 0000000..023627a --- /dev/null +++ b/README.cn.md @@ -0,0 +1,339 @@ +# 🧱 EMRG + +

+ 一个会写代码的 AI 编程助手——而且它还会重写自己 +

+ +

+ Python + License + Status + Tests + PRs Welcome +

+ +

+ 🇬🇧 English | 🇨🇳 中文 +

+ +--- + +**如果每次使用,你的编程助手都在变得更好,会怎样?** + +EMRG 是一个关于*自主进化*的实验。它能帮你写代码——读文件、跑命令、做编辑——但核心差异在于:**你的每一条吐槽 (`/rant`) 都会驱动它自我改进**。你说它哪里不好,下一个演化周期它就自己写代码改。配合 GitHub 社区动态和竞品更新,EMRG 在后台持续进化,越用越顺手。完全开源,完全透明。 + +> *"EMRG 是一个自我进化的 AI 智能体架构实验。"* — [MANIFESTO](MANIFESTO.md) + +--- + +## ✨ 为什么你会爱上它 + +| 特性 | 说明 | +|---|---| +| 🖥️ **Electron GUI(主入口)** | 非开发者主入口——安装即用:首次启动引导配置 API Key、聊天/会话/工具状态/设置全图形化。v0.2.5 完全重设计:浅/深双主题跟随系统、工具过程友好化(折叠展开)、多模型管理(增删改/设默认/对话中切换)、空状态欢迎屏、回到底部按钮。v0.2.6 键盘可达性补全:模型切换器/右键菜单/对话列表 ↑↓ 导航、表单 Enter 提交。v0.2.7 macOS 签名+公证零 Gatekeeper 弹窗。**v0.2.8:TUI 全部 15 个 / 指令 GUI 均可使用**(`/rant` 进化对话框、`/memory` 记忆浏览器、`/skills` 技能列表、会话管理、模型切换)。**GUI 配好即 TUI 可用**(配置共享) | +| 🧠 **读写改跑,样样精通** | 完整的工具调用能力——bash、文件读写、diff 编辑 | +| 🔄 **吐槽驱动进化** | 你的 `/rant` 直接驱动后台演化循环——吐槽 → 分析 → 写代码 → 提 PR → 自动变强。**演化工作区自愈**(v0.2.8):打包安装版按需 clone 仓库 + 自动补齐 projects/tasks 配置 | +| 📝 **永不忘事** | 项目记忆 + 会话记忆 + 每日日志——上下文持续保留,不怕断线 | +| 🖥️ **颜值在线的 TUI** | 斜杠命令自动补全、会话选择器、流式 Markdown 渲染、请求计时器、ESC 中断。`/rant` `/model` `/memory` 等进阶命令 | +| ⚡ **并行工具调用** | 独立的工具调用并发执行,速度飞快 | +| 🔌 **微内核守护进程** | `emrgd` 持久运行——随时重连,状态不丢 | +| 🎮 **Vim 友好** | `j`/`k` 导航、`Ctrl+W`/`Ctrl+K` 编辑、`Tab` 展开工具卡片 | +| 🌍 **100% 开源** | MIT 协议——没有围墙,没有厂商锁定。**面向国际化**(v0.2.8):全部 prompt 与文档默认英文,提供中文版 | + +--- + +## 🚀 快速开始 + +### 📦 下载安装包(推荐,Phase 4 一键安装) + +到 [GitHub Releases](https://github.com/argszero/emrg/releases) 下载对应平台的安装文件,双击安装即可: + +| 平台 | 安装文件 | 说明 | +|------|---------|------| +| macOS (Apple Silicon) | `EMRG--macos-arm64.pkg` | 双击安装(用户级,无需管理员密码),GUI 到 `~/Applications/EMRG.app` | +| macOS (Intel) | `EMRG--macos-x64.pkg` | 同上 | +| Windows | `EMRG--windows-x64.exe` | Inno Setup 免 UAC,开始菜单快捷方式,PATH 自动注册(含原生 TUI,cmd/PowerShell 直接 `emrg`) | +| Linux | `EMRG--linux-x86_64.AppImage` | 首次运行自解压到 `~/.emrg/install/` | +| Linux (ARM64) | `EMRG--linux-aarch64.AppImage` | 同上 | + +> **Windows SmartScreen 提示**:Windows 安装包未做 Authenticode 签名(发布者显示"未知"),首次下载/运行时 SmartScreen 可能提示"通常不会下载此文件"或"Windows 已保护你的电脑"。这是未签名软件的常见安全提醒,不代表文件有问题(EMRG 完全开源,源码可审计)。放行方法: +> (1) 浏览器下载提示 → 点**保留**(或三个点 → 保留) +> (2) 双击 exe 若提示"Windows 已保护你的电脑" → 点**更多信息** → 点**仍要运行** +> (3) 或右键 exe → 属性 → 勾选**解除锁定**(若有)→ 确定 → 双击运行 + +安装包内置完整运行时(standalone Python 3.13 + 依赖 + git + gh + GUI),**干净机器(无 python/uv/git/gh/node)零前置依赖**,100% 离线安装。安装后: + +**三步开始使用:** +1. 启动台 / 开始菜单点击 **EMRG**(GUI) +2. 首次启动引导配置 **API Key / 模型** +3. 开始对话——**TUI 同步可用**(新开终端运行 `emrg`) + +> **卸载**:macOS 运行"卸载 EMRG.app";Windows 控制面板卸载;Linux 运行 `~/.emrg/install/bin/emrg-uninstall`(或删 AppImage + 软链)。卸载保留 `~/.emrg` 中非 EMRG 的用户文件,并生成终止报告与数据快照。 +> +> **macOS 签名与公证**:v0.2.7 起 macOS 安装包已用 Developer ID 双证书签名并完成 Apple 公证(零 Gatekeeper 弹窗,双击直接安装)。仅当安装包未签名时(如自建旧版本),才需要首次打开右键 → 打开。 + +### 🍎 macOS(源码安装) + +**一键安装:** + +```bash +curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash +``` + +**一键卸载:** + +```bash +curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge +``` + +### 🐧 Linux(源码安装) + +**一键安装:** + +```bash +curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash +``` + +**一键卸载:** + +```bash +curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge +``` + +### 🪟 Windows (WSL2,源码安装) + +**一键安装:** + +```powershell +# 安装 WSL2(如已安装可跳过) +wsl --install + +# 进入 WSL,执行安装 +wsl +curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash +``` + +**一键卸载:** + +```bash +# 在 WSL 中执行 +curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge +``` + +> 源码安装前置依赖(install.sh 会自动检测提示):git、python 3.11+、uv。gh CLI 推荐安装。Windows 原生版(非 WSL)请用上方安装包。 + +### 🖥️ 首次配置(GUI 第一) + +安装完成后,**打开 GUI 完成首次配置**: + +1. **macOS**:启动台 → 点击 **EMRG**;**Windows**:开始菜单 → **EMRG** +2. 首次启动引导会带你配置 **API Key / 接口地址 / 模型**(也随时可在设置 ⚙ 中修改) +3. 保存后即可开始对话——**配置写入 `~/.emrg/config.toml`,GUI 与 TUI 共享** + +> 💡 **GUI 配好,TUI 直接用**:安装包内置完整 TUI。GUI 保存的配置(API Key/模型/工作目录)写入 `~/.emrg/config.toml`,终端新开窗口运行 `emrg` 即进入 TUI,无需重复配置。v0.2.8 起 GUI 支持**全部 15 个 / 指令**——输入框输入 `/` 弹出补全菜单(与 TUI 一致)。 + +### ⌨️ 使用 TUI + +```bash +emrg +``` + +输入 `/help` 查看所有命令,或者直接开始说话——EMRG 会读文件、跑命令、做编辑。 + +### 🔧 高级配置(可选) + +> GUI 保存设置会重写 config 并丢失注释——高级用户可直接编辑 `~/.emrg/config.toml`(首次配置无需手动编辑,GUI 引导即可)。 + +`~/.emrg/config.toml` 模板示例(GUI 保存后自动生成等价内容): + +```toml +[llm] +base_url = "https://api.deepseek.com" +api_key = "sk-..." +model = "deepseek-chat" +max_tokens = 8192 +temperature = 0.7 +context_window = 131072 +auto_compact_threshold = 0.0 +# vision: 模型是否支持 OpenAI vision API(image_url)。不支持的模型(如 DeepSeek)保持 false, +# 粘贴的图片会降级为文本占位符,避免 API 报错。 +vision = false + +# 多模型支持 — 使用 /model 指令在模型间切换 +[[llm.models]] +name = "deepseek-v3" +model = "deepseek-chat" +context_window = 131072 +vision = false + +[[llm.models]] +name = "gpt-4o" +model = "gpt-4o" +context_window = 128000 +vision = true +``` + +--- + +## 🎮 命令一览 + +> v0.2.8 起**全部命令在 GUI 与 TUI 均可使用**。GUI 中输入框敲 `/` 弹出补全菜单;TUI 中 `/help` 列出全部。 + +| 命令 | 功能 | +|---|---| +| **直接打字** | 问 EMRG 任何事——它会读文件、跑命令、做编辑 | +| `/` | 命令自动补全菜单——输入即过滤,↑↓ 选择 | +| `/resume [id]` | 切换会话——不带参数进入交互式选择器(↑↓/j/k 导航) | +| `/sessions` | 浏览所有已保存的会话(↑↓/j/k 导航) | +| `/clear` | 清空当前会话——重新开始 | +| `/compact` | 压缩长对话以节省上下文 | +| `/memory` | 浏览项目和会话记忆 | +| `/rename [标题]` | 给当前会话起个好记的名字 | +| `/model [name]` | 切换 LLM 模型——不带参数进入交互式选择器 | +| `/rant <反馈> [@]` | 吐槽、建议、夸奖——演化系统会听,`@project` 定向到特定项目 | +| `/help` | 查看所有键盘快捷键和命令帮助 | +| `/image` | 从剪贴板插入图片到输入框(支持多张,逐个 Enter 插入) | +| `/delete [id]` | 删除会话——不带参数进入交互式选择器 | +| `/rewind` | 回退对话——选择历史消息点,截断后续内容 | +| `/trigger` | 触发演化任务——交互式选择器(↑↓/j/k) | +| `/skills` | 列出已加载的技能模块 | +| `/version` | 显示 EMRG 版本和实例信息 | +| `Esc` | 中断正在运行的响应 | +| `Ctrl+C` / `exit` | 退出 | + +--- + +## 🔄 吐槽驱动演化(核心特色) + +EMRG 不只是一个工具——它是一个**会听吐槽、会自我改进**的编程伙伴。 + +**你的吐槽是演化的第一推动力**。每次 `/rant` 都会被演化循环读取、分析、转化为代码改进: + +``` + 📢 你的吐槽 (/rant) ←── 最主要的输入 + 📥 GitHub Issues & PRs + 📥 竞品动态 (Codex, Claude Code) + 📥 跨项目学习 + ↓ + 🧬 演化循环(每 30 分钟) + (准备 → 回顾 → 发现 → 改进 → 提交 → 记录) + ↓ + ✅ pytest + import 检查 + ✅ git commit + push → PR + ✅ 演化日志 +``` + +**真实案例**:有人 rant "TUI 需要像 Codex 那样的 `/` 自动补全"。下一个演化周期,EMRG 自己实现了——完整的前缀过滤和方向键导航。合并,部署,搞定。**你对它吐槽什么,它就改进什么。** + +**演化环境健壮性**:演化循环在非交互环境运行,无法执行交互式 `gh auth login`。若 `gh` 未认证,循环会自动从 git 凭据存储(osxkeychain / credential helper)提取 token 作为 `GH_TOKEN` 使用(不落盘、不打印明文);PR 评论/LGTM 计数查询自动走 REST API(GraphQL 需额外 `read:org` scope)。宿主只需配好 git 凭据,演化即可全自动运行。打包安装版演化工作区**自愈**(v0.2.8):按需 clone 仓库、对齐安装版本 tag、自动补齐 `projects.yml`/`tasks.yml`——无需手动配置。 + +> 💡 详见 [MANIFESTO.md](MANIFESTO.md) —— 这是 EMRG 的设计宪章,阐述了 AI 时代自主进化的核心理念。 + +--- + +## 🏗️ 架构 + +``` +┌─────────────┐ WebSocket (ws://) ┌──────────────┐ +│ emrg TUI │ ◄─────────────────────► │ emrgd │ +│ (客户端) │ TCP loopback + 首帧认证 │ (守护进程) │ +│ │ token (emrgd.port) │ │ +│ • 聊天 │ │ • LLM 循环 │ +│ • Markdown │ │ • 工具执行 │ +│ • 工具卡片 │ │ • 演化引擎 │ +│ • 自动补全 │ │ • 会话管理 │ +└─────────────┘ └──────────────┘ +``` + +- **`emrgd`** — 守护进程:运行 LLM 工具调用循环,管理会话,驱动演化 +- **`emrg`** — 你的终端:流式 Markdown、命令自动补全、会话浏览器 +- **Skills** — 动态加载模块(浏览器控制、安装器等) +- **Memory** — YAML frontmatter + Markdown 文件,自动索引,可搜索 + +--- + +## 📊 与竞品对比 + +| | Claude Code | Codex | **EMRG** | +|---|---|---|---| +| AI 驱动编程 | ✅ | ✅ | ✅ | +| 工具调用 (bash, read, write, edit, glob, grep) | ✅ | ✅ | ✅ | +| 会话记忆与上下文 | ✅ | ✅ | ✅ | +| `/` 命令自动补全 | ✅ | ✅ | ✅ | +| 方向键会话选择器 | ✅ | ✅ | ✅ | +| ESC 中断 | ✅ | ✅ | ✅ | +| **自主进化** | ❌ | ❌ | ✅ *全自动* | +| **后台守护进程** | ❌ | ❌ | ✅ *持久运行* | +| **吐槽驱动自我改进** | ❌ | ❌ | ✅ */rant → 演化 → PR* | +| **开源** | ❌ | ❌ | ✅ *MIT* | + +EMRG 不只是追赶——它自己追上来。 + +--- + +## 🧪 开发 + +```bash +git clone https://github.com/argszero/emrg.git +cd emrg +uv sync # 安装依赖 +uv run pytest tests/ -v # 跑测试(当前 480 项) +uv run python -m emrg # 启动 TUI +# CI 含 actionlint workflow 门禁(#444):workflow 解析错误在 PR 即失败 + +# 可选:Electron GUI(非开发者主入口,Phase 3) +cd emrg/gui +npm ci # 安装依赖(生产模式可 --omit=dev) +npm start # 启动 GUI(自动拉起 daemon) +npm test # 运行 Node 测试(58 项:22 daemon_client + 7 integration + 25 renderer smoke + 4 app-commands;集成测试在 CI 跑,本地可 npm run test:integration) +``` + +CI 通过 GitHub Actions 自动运行测试并检查冲突标记(`.github/workflows/test.yml`)。 + +### 项目结构 + +``` +emrg/ +├── emrg/ # 核心包 +│ ├── server/ # 守护进程——LLM 循环、工具执行、演化引擎 +│ ├── client/ # TUI——基于 python-tui 的交互式聊天 +│ ├── gui/ # Electron GUI(非开发者主入口,Phase 3) +│ ├── tools/ # bash, read, write, edit, glob, grep +│ ├── skills/ # 动态加载模块 +│ └── __main__.py # CLI 入口 +├── tests/ +├── .github/workflows/ # CI 流水线(pytest + 冲突标记检查) +├── MANIFESTO.md # 设计宪章 +└── pyproject.toml +``` + +--- + +## ❓ 常见问题 + +**这是真的吗——它真的会改自己的代码?**
+真的。演化循环读取演化提示词,回顾 rant + issue + 竞品工具,修改源码,跑测试,然后提交 PR。如果测试失败,自动回滚。 + +**它会把自己搞崩吗?**
+每次改动都会通过 `pytest` 和 import 检查验证后才提交。失败的改动会被丢弃。最坏的情况就是回滚。 + +**支持哪些 LLM?**
+任何兼容 OpenAI API 的模型。已测试 DeepSeek 和 OpenAI。支持 Anthropic(通过代理)、Ollama、vLLM 及其他本地模型。 + +**和 Claude Code 或 Codex 有什么不同?**
+它们是产品。EMRG 是一个关于*闭环进化*的实验——AI 改进 AI。此外:完全开源、无厂商锁定、你掌控自己的数据。 + +**为什么 Windows 安装包会提示"未知发布者"?**
+Windows 安装包未做 Authenticode 签名(该证书需付费申请,暂不采购),因此 SmartScreen 会显示"发布者:未知"并可能阻止运行。这是微软对新发布/未签名软件的通用安全提醒,**不代表文件有问题**——EMRG 完全开源(MIT),源码可审计。放行:浏览器提示点"保留";运行提示点"更多信息 → 仍要运行";或右键 exe → 属性 → 勾选"解除锁定"。macOS 安装包已签名+公证(v0.2.7+),无此问题。 + +--- + +## 📜 许可证 + +MIT — 详见 [LICENSE](LICENSE) 了解完整条款,[MANIFESTO.md](MANIFESTO.md) 了解代码背后的设计哲学。 + +--- + +

+ argszero 和持续进化的 AI 共同打造 ❤️ +

diff --git a/README.en.md b/README.en.md deleted file mode 100644 index be1a250..0000000 --- a/README.en.md +++ /dev/null @@ -1,336 +0,0 @@ -# 🧱 EMRG - -

- The AI coding agent that writes code — and rewrites itself. -

- -

- Python - License - Status - Tests - PRs Welcome -

- -

- 🇬🇧 English | 🇨🇳 中文 -

- ---- - -**What if your coding assistant got better every time you used it?** - -EMRG is an experiment in *autonomous self-improvement*. It's an AI agent that helps you code — reading files, running commands, making edits — but the key difference is: **every `/rant` you send drives it to improve itself**. Tell it what bothers you, and the next evolution cycle writes code to fix it. Combined with GitHub community activity and competitor tracking, EMRG evolves continuously in the background, getting better the more you use it. All open source, all transparent. - -> *"EMRG 是一个自我演进的 AI 智能体架构实验。"* — [MANIFESTO](MANIFESTO.md) - ---- - -## ✨ Why you'll love it - -| What | What it means | -|---|---| -| 🖥️ **Electron GUI (main entry)** | Non-developer entry point — install and go: first-run wizard configures API key, chat/sessions/tool status/settings all graphical. v0.2.5 full redesign: light/dark theme (follows system), friendly tool status rows, multi-model management, empty-state welcome, back-to-bottom button. v0.2.6 keyboard accessibility: ↑↓ nav, Enter submit in forms (all components keyboard-usable). v0.2.7 macOS code signing + notarization — zero Gatekeeper dialogs. **GUI configured = TUI ready** (shared config) | -| 🧠 **Reads, writes, edits, runs** | Full tool-calling agent — bash, files, diffs | -| 🔄 **Gets better on its own** | Background evolution cycles review rants + GitHub + competitor tools, then auto-PR improvements | -| 📝 **Never forgets** | Project memory + session memory + daily logs — context that persists | -| 🖥️ **Beautiful TUI** | Slash-command autocomplete, session picker, streaming markdown, elapsed timer, ESC interrupt. Advanced commands: `/rant` `/model` `/memory` | -| ⚡ **Parallel tools** | Independent tool calls run concurrently for speed | -| 🔌 **Micro-kernel daemon** | `emrgd` runs persistently — reconnect anytime without losing state | -| 🎮 **Vim-friendly** | `j`/`k` navigation, `Ctrl+W`/`Ctrl+K` editing, `Tab` to expand tool cards | -| 🌍 **100% open source** | MIT license — no walled garden, no vendor lock-in | - ---- - -## 🚀 Quick Start - -### 📦 Download installer (recommended, Phase 4 one-click) - -Download the installer for your platform from [GitHub Releases](https://github.com/argszero/emrg/releases) and double-click: - -| Platform | Installer | Notes | -|----------|-----------|-------| -| macOS (Apple Silicon) | `EMRG--macos-arm64.pkg` | Double-click (user-level install, no admin password); GUI at `~/Applications/EMRG.app` | -| macOS (Intel) | `EMRG--macos-x64.pkg` | Same | -| Windows | `EMRG--windows-x64.exe` | Inno Setup, no UAC, Start-menu shortcut, PATH auto-registered (native TUI: run `emrg` directly in cmd/PowerShell) | -| Linux | `EMRG--linux-x86_64.AppImage` | Self-extracts to `~/.emrg/install/` on first run | -| Linux (ARM64) | `EMRG--linux-aarch64.AppImage` | Same | - -> **Windows SmartScreen notice**: The Windows installer is not Authenticode-signed (publisher shows "Unknown"), so SmartScreen may show "usually doesn't download" or "Windows protected your PC" on first download/run. This is a standard security prompt for unsigned software — it does **not** mean the file is bad (EMRG is fully open source and auditable). To proceed: -> (1) Browser download prompt → click **Keep** (or ⋯ → Keep) -> (2) If double-clicking shows "Windows protected your PC" → click **More info** → click **Run anyway** -> (3) Or right-click the exe → Properties → check **Unblock** (if present) → OK → double-click to run - -The installer bundles a full runtime (standalone Python 3.13 + deps + git + gh + GUI) — **zero prerequisites on a clean machine (no python/uv/git/gh/node)**, 100% offline install. After install: - -**Three steps to start:** -1. Launch **EMRG** (GUI) from Launchpad / Start menu -2. First-run wizard configures **API Key / model** -3. Start chatting — **TUI is ready too** (run `emrg` in a new terminal) - -> **Uninstall**: macOS run "卸载 EMRG.app" (uninstall app); Windows uninstall from Control Panel; Linux run `~/.emrg/install/bin/emrg-uninstall` (or delete the AppImage + symlink). Uninstall preserves non-EMRG user files in `~/.emrg`, and writes a termination report + data snapshot. **Windows uninstall is thorough** (v0.2.2+): kills GUI first to prevent daemon respawn, full whitelist cleanup of runtime files, `[UninstallDelete]` fallback removes install/, no residue in `~/.emrg`. -> -> **macOS signing & notarization**: since v0.2.7, macOS packages are signed with Developer ID dual-cert and notarized by Apple (zero Gatekeeper dialogs — double-click to install directly). Only for unsigned builds (e.g. self-built old versions) is right-click → Open needed on first launch. - -### 🍎 macOS (source install) - -**Install:** - -```bash -curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -``` - -**Uninstall:** - -```bash -curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge -``` - -### 🐧 Linux (source install) - -**Install:** - -```bash -curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -``` - -**Uninstall:** - -```bash -curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge -``` - -### 🪟 Windows (WSL2, source install) - -**Install:** - -```powershell -# Install WSL2 (skip if already installed) -wsl --install - -# Enter WSL, then install -wsl -curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -``` - -**Uninstall:** - -```bash -# Run inside WSL -curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge -``` - -> Source-install prerequisites (install.sh auto-detects and prompts): git, python 3.11+, uv. gh CLI recommended. For native Windows (non-WSL), use the installer above. - -### 🖥️ First-time config (GUI first) - -After installing, **open the GUI to configure**: - -1. **macOS**: Launchpad → **EMRG**; **Windows**: Start menu → **EMRG** -2. The first-run wizard walks you through **API Key / base URL / model** (also editable anytime in Settings ⚙) -3. Save and start chatting — **config is written to `~/.emrg/config.toml`, shared by GUI and TUI** - -> 💡 **GUI configured = TUI ready**: the installer bundles a full TUI. Config saved in the GUI (API key/model/workdir) goes to `~/.emrg/config.toml`, so running `emrg` in a new terminal enters the TUI with no re-configuration. The GUI covers most daily operations; the TUI offers advanced commands like `/rant` `/model` `/memory`. - -### ⌨️ Using the TUI - -```bash -emrg -``` - -Type `/help` for all commands, or just start talking — EMRG reads files, runs commands, and makes edits. - -### 🔧 Advanced config (optional) - -> The GUI rewrites config on save and drops comments — advanced users can edit `~/.emrg/config.toml` directly (no manual editing needed for first-time setup; the GUI wizard handles it). - -`~/.emrg/config.toml` template example (the GUI generates equivalent content on save): - -```toml -[llm] -base_url = "https://api.deepseek.com" -api_key = "sk-..." -model = "deepseek-chat" -max_tokens = 8192 -temperature = 0.7 -context_window = 131072 -auto_compact_threshold = 0.0 -# vision: whether the model supports the OpenAI vision API (image_url). Keep false for -# non-vision models (e.g. DeepSeek) — pasted images degrade to text placeholders to avoid API errors. -vision = false - -# Multi-model support — use /model to switch between models -[[llm.models]] -name = "deepseek-v3" -model = "deepseek-chat" -context_window = 131072 -vision = false - -[[llm.models]] -name = "gpt-4o" -model = "gpt-4o" -context_window = 128000 -vision = true -``` - ---- - -## 🎮 Commands - -> The GUI covers most daily operations (chat/sessions/settings/model switching); the TUI offers these advanced commands. - -| Command | What it does | -|---|---| -| **Just type** | Ask EMRG anything — it reads files, runs commands, makes edits | -| `/` | Autocomplete menu — type to filter, ↑↓ to select | -| `/resume [id]` | Switch sessions — no args for interactive picker (↑↓/j/k to navigate) | -| `/sessions` | Browse all saved sessions (↑↓/j/k to navigate) | -| `/clear` | Clear current session — start fresh | -| `/compact` | Compress long conversations to save context | -| `/memory` | Browse project & session memories | -| `/rename [title]` | Give your session a memorable name | -| `/model [name]` | Switch LLM model — no args for interactive picker | -| `/rant [@]` | Complain, suggest, praise — evolution listens; `@project` targets a specific project | -| `/help` | Show keyboard shortcuts and command help | -| `/image` | Insert clipboard image into the input field (multiple supported, one per Enter) | -| `/delete [id]` | Delete a session — no args for interactive picker | -| `/rewind` | Rewind conversation — pick a history point and truncate after it | -| `/trigger` | Trigger an evolution task — interactive picker (↑↓/j/k) | -| `/skills` | List loaded skill modules | -| `/version` | Show EMRG version and instance info | -| `Esc` | Interrupt a running response mid-stream | -| `Ctrl+C` / `exit` | Quit | - ---- - -## 🔄 Rant-Driven Evolution (the core feature) - -EMRG isn't just a tool — it's a coding partner that **listens to your complaints and improves itself**. **Your rants are the primary driver of evolution.** Every `/rant` is read, analyzed, and turned into code improvements: - -``` - 📢 Your rants (/rant) ←── primary input - 📥 GitHub Issues & PRs - 📥 Competitor tools (Codex, Claude Code) - 📥 Cross-project learning - ↓ - 🧬 Evolution Cycle (every 30 min) - (Prepare → Review → Discover → Improve → Commit → Record) - ↓ - ✅ pytest + import check - ✅ git commit + push → PR - ✅ Evolution log -``` - -**Real example**: Someone ranted "TUI needs `/` autocomplete like Codex." Next evolution cycle, EMRG built it — complete with prefix filtering and arrow-key navigation. Merged. Deployed. Done. **What you rant about, it improves.** - -> 💡 See [MANIFESTO.md](MANIFESTO.md) — EMRG's design charter on autonomous evolution in the AI era. - ---- - -## 🏗️ Architecture - -``` -┌─────────────┐ WebSocket (ws://) ┌──────────────┐ -│ emrg TUI │ ◄─────────────────────► │ emrgd │ -│ (client) │ TCP loopback + auth │ (daemon) │ -│ │ token (emrgd.port) │ │ -│ │ │ │ -│ • Chat │ │ • LLM loop │ -│ • Markdown │ │ • Tools │ -│ • ToolCards│ │ • Evolution │ -│ • Autocomplete │ • Sessions │ -└─────────────┘ └──────────────┘ -``` - -- **`emrgd`** — The daemon: runs the LLM tool-calling loop, manages sessions, drives evolution -- **`emrg`** — Your terminal: streaming markdown, command autocomplete, session browser -- **Skills** — Dynamically loaded modules (browser harness, installers, etc.) -- **Memory** — YAML frontmatter + Markdown files, auto-indexed, searchable - ---- - -## 📊 vs. the competition - -| | Claude Code | Codex | **EMRG** | -|---|---|---|---| -| AI-powered coding | ✅ | ✅ | ✅ | -| Tool-calling (bash, read, write, edit, glob, grep) | ✅ | ✅ | ✅ | -| Session memory & context | ✅ | ✅ | ✅ | -| `/` command autocomplete | ✅ | ✅ | ✅ | -| Arrow-key session picker | ✅ | ✅ | ✅ | -| ESC interrupt | ✅ | ✅ | ✅ | -| **Self-evolution** | ❌ | ❌ | ✅ *autonomous* | -| **Background daemon** | ❌ | ❌ | ✅ *persistent* | -| **Learns from rants** | ❌ | ❌ | ✅ */rant → PR* | -| **Open source** | ❌ | ❌ | ✅ *MIT* | - -EMRG doesn't just keep up — it catches up on its own. - ---- - -## 🧪 Development - -```bash -git clone https://github.com/argszero/emrg.git -cd emrg -uv sync # install deps -uv run pytest tests/ -v # run tests (currently 473 items) -uv run python -m emrg # launch TUI -# CI includes actionlint workflow gate (#444): workflow parse errors fail PR CI - -# Optional: Electron GUI (non-developer entry point, Phase 3) -cd emrg/gui -npm ci # install deps (production: --omit=dev) -npm start # launch GUI (auto-starts daemon) -npm test # run Node tests (44: 22 daemon_client + 7 integration + 15 renderer smoke; integration runs in CI, local: npm run test:integration) -``` - -CI runs tests and checks for conflict markers automatically via GitHub Actions (`.github/workflows/test.yml`). - -### Project structure - -``` -emrg/ -├── emrg/ # Core package -│ ├── server/ # Daemon — LLM loop, tool execution, evolution -│ ├── client/ # TUI — python-tui based interactive chat -│ ├── gui/ # Electron GUI (non-developer entry point, Phase 3) -│ ├── tools/ # bash, read, write, edit, glob, grep -│ ├── skills/ # Dynamically loadable modules -│ └── __main__.py # CLI entry point -├── tests/ -├── .github/workflows/ # CI pipeline (pytest + conflict marker check) -├── MANIFESTO.md # Design constitution -└── pyproject.toml -``` - ---- - -## ❓ FAQ - -**Is this real — does it actually modify its own code?**
-Yes. The evolution cycle reads the evolution prompt, reviews rants + issues + competitor tools, makes source changes, runs tests, and submits a PR. If tests fail, it rolls back. - -**Can it break itself?**
-Every change is validated by `pytest` and an import check before commit. Failed changes are discarded. The worst case is a rollback. - -**What LLMs work with it?**
-Any OpenAI-compatible API. Tested with DeepSeek and OpenAI. Works with Anthropic (via proxy), Ollama, vLLM, and other local models. - -**How is this different from Claude Code or Codex?**
-They're products. EMRG is an experiment in *closing the loop* — the AI improves the AI. Also: fully open source, no vendor lock-in, and you control your data. - -**Why does the Windows installer show "Unknown publisher"?**
-The Windows installer is not Authenticode-signed (that certificate costs money to obtain and is not procured yet), so SmartScreen shows "Publisher: Unknown" and may block the run. This is a standard Microsoft security prompt for newly released/unsigned software — it does **not** mean the file is bad: EMRG is fully open source (MIT) and auditable. To proceed: click "Keep" on the browser prompt; click "More info → Run anyway" on the run prompt; or right-click the exe → Properties → check "Unblock". The macOS installer is signed + notarized (v0.2.7+) and has no such prompt. - ---- - -## 📜 License - -MIT — see [LICENSE](LICENSE) for the full terms and [MANIFESTO.md](MANIFESTO.md) for the philosophy behind the code. - ---- - -

- Built with ❤️ by argszero — and a continuously evolving AI. -

diff --git a/README.md b/README.md index 1ea43f7..e56baac 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 🧱 EMRG

- 一个会写代码的 AI 编程助手——而且它还会重写自己 + The AI coding agent that writes code — and rewrites itself.

@@ -13,138 +13,138 @@

- 🇬🇧 English | 🇨🇳 中文 + 🇬🇧 English | 🇨🇳 中文

--- -**如果每次使用,你的编程助手都在变得更好,会怎样?** +**What if your coding assistant got better every time you used it?** -EMRG 是一个关于*自主进化*的实验。它能帮你写代码——读文件、跑命令、做编辑——但核心差异在于:**你的每一条吐槽 (`/rant`) 都会驱动它自我改进**。你说它哪里不好,下一个演化周期它就自己写代码改。配合 GitHub 社区动态和竞品更新,EMRG 在后台持续进化,越用越顺手。完全开源,完全透明。 +EMRG is an experiment in *autonomous self-improvement*. It's an AI agent that helps you code — reading files, running commands, making edits — but the key difference is: **every `/rant` you send drives it to improve itself**. Tell it what bothers you, and the next evolution cycle writes code to fix it. Combined with GitHub community activity and competitor tracking, EMRG evolves continuously in the background, getting better the more you use it. All open source, all transparent. -> *"EMRG 是一个自我进化的 AI 智能体架构实验。"* — [MANIFESTO](MANIFESTO.md) +> *"EMRG 是一个自我演进的 AI 智能体架构实验。"* — [MANIFESTO](MANIFESTO.md) --- -## ✨ 为什么你会爱上它 +## ✨ Why you'll love it -| 特性 | 说明 | +| What | What it means | |---|---| -| 🖥️ **Electron GUI(主入口)** | 非开发者主入口——安装即用:首次启动引导配置 API Key、聊天/会话/工具状态/设置全图形化。v0.2.5 完全重设计:浅/深双主题跟随系统、工具过程友好化(折叠展开)、多模型管理(增删改/设默认/对话中切换)、空状态欢迎屏、回到底部按钮。v0.2.6 键盘可达性补全:模型切换器/右键菜单/对话列表 ↑↓ 导航、表单 Enter 提交。v0.2.7 macOS 签名+公证零 Gatekeeper 弹窗。**GUI 配好即 TUI 可用**(配置共享) | -| 🧠 **读写改跑,样样精通** | 完整的工具调用能力——bash、文件读写、diff 编辑 | -| 🔄 **吐槽驱动进化** | 你的 `/rant` 直接驱动后台演化循环——吐槽 → 分析 → 写代码 → 提 PR → 自动变强 | -| 📝 **永不忘事** | 项目记忆 + 会话记忆 + 每日日志——上下文持续保留,不怕断线 | -| 🖥️ **颜值在线的 TUI** | 斜杠命令自动补全、会话选择器、流式 Markdown 渲染、请求计时器、ESC 中断。`/rant` `/model` `/memory` 等进阶命令 | -| ⚡ **并行工具调用** | 独立的工具调用并发执行,速度飞快 | -| 🔌 **微内核守护进程** | `emrgd` 持久运行——随时重连,状态不丢 | -| 🎮 **Vim 友好** | `j`/`k` 导航、`Ctrl+W`/`Ctrl+K` 编辑、`Tab` 展开工具卡片 | -| 🌍 **100% 开源** | MIT 协议——没有围墙,没有厂商锁定 | +| 🖥️ **Electron GUI (main entry)** | Non-developer entry point — install and go: first-run wizard configures API key, chat/sessions/tool status/settings all graphical. v0.2.5 full redesign: light/dark theme (follows system), friendly tool status rows, multi-model management, empty-state welcome, back-to-bottom button. v0.2.6 keyboard accessibility: ↑↓ nav, Enter submit in forms. v0.2.7 macOS code signing + notarization — zero Gatekeeper dialogs. **v0.2.8: all 15 TUI slash commands now work in the GUI** (`/rant` evolution dialog, `/memory` browser, `/skills` list, session management, model switcher). **GUI configured = TUI ready** (shared config) | +| 🧠 **Reads, writes, edits, runs** | Full tool-calling agent — bash, files, diffs | +| 🔄 **Gets better on its own** | Background evolution cycles review rants + GitHub + competitor tools, then auto-PR improvements. **Self-healing workspace** (v0.2.8): packaged installs clone the repo on demand and bootstrap projects/tasks automatically | +| 📝 **Never forgets** | Project memory + session memory + daily logs — context that persists | +| 🖥️ **Beautiful TUI** | Slash-command autocomplete, session picker, streaming markdown, elapsed timer, ESC interrupt. Advanced commands: `/rant` `/model` `/memory` | +| ⚡ **Parallel tools** | Independent tool calls run concurrently for speed | +| 🔌 **Micro-kernel daemon** | `emrgd` runs persistently — reconnect anytime without losing state | +| 🎮 **Vim-friendly** | `j`/`k` navigation, `Ctrl+W`/`Ctrl+K` editing, `Tab` to expand tool cards | +| 🌍 **100% open source** | MIT license — no walled garden, no vendor lock-in. **Internationalized** (v0.2.8): all prompts and docs in English, Chinese version available | --- -## 🚀 快速开始 +## 🚀 Quick Start -### 📦 下载安装包(推荐,Phase 4 一键安装) +### 📦 Download installer (recommended, Phase 4 one-click) -到 [GitHub Releases](https://github.com/argszero/emrg/releases) 下载对应平台的安装文件,双击安装即可: +Download the installer for your platform from [GitHub Releases](https://github.com/argszero/emrg/releases) and double-click: -| 平台 | 安装文件 | 说明 | -|------|---------|------| -| macOS (Apple Silicon) | `EMRG--macos-arm64.pkg` | 双击安装(用户级,无需管理员密码),GUI 到 `~/Applications/EMRG.app` | -| macOS (Intel) | `EMRG--macos-x64.pkg` | 同上 | -| Windows | `EMRG--windows-x64.exe` | Inno Setup 免 UAC,开始菜单快捷方式,PATH 自动注册(含原生 TUI,cmd/PowerShell 直接 `emrg`) | -| Linux | `EMRG--linux-x86_64.AppImage` | 首次运行自解压到 `~/.emrg/install/` | -| Linux (ARM64) | `EMRG--linux-aarch64.AppImage` | 同上 | +| Platform | Installer | Notes | +|----------|-----------|-------| +| macOS (Apple Silicon) | `EMRG--macos-arm64.pkg` | Double-click (user-level install, no admin password); GUI at `~/Applications/EMRG.app` | +| macOS (Intel) | `EMRG--macos-x64.pkg` | Same | +| Windows | `EMRG--windows-x64.exe` | Inno Setup, no UAC, Start-menu shortcut, PATH auto-registered (native TUI: run `emrg` directly in cmd/PowerShell) | +| Linux | `EMRG--linux-x86_64.AppImage` | Self-extracts to `~/.emrg/install/` on first run | +| Linux (ARM64) | `EMRG--linux-aarch64.AppImage` | Same | -> **Windows SmartScreen 提示**:Windows 安装包未做 Authenticode 签名(发布者显示"未知"),首次下载/运行时 SmartScreen 可能提示"通常不会下载此文件"或"Windows 已保护你的电脑"。这是未签名软件的常见安全提醒,不代表文件有问题(EMRG 完全开源,源码可审计)。放行方法: -> (1) 浏览器下载提示 → 点**保留**(或三个点 → 保留) -> (2) 双击 exe 若提示"Windows 已保护你的电脑" → 点**更多信息** → 点**仍要运行** -> (3) 或右键 exe → 属性 → 勾选**解除锁定**(若有)→ 确定 → 双击运行 +> **Windows SmartScreen notice**: The Windows installer is not Authenticode-signed (publisher shows "Unknown"), so SmartScreen may show "usually doesn't download" or "Windows protected your PC" on first download/run. This is a standard security prompt for unsigned software — it does **not** mean the file is bad (EMRG is fully open source and auditable). To proceed: +> (1) Browser download prompt → click **Keep** (or ⋯ → Keep) +> (2) If double-clicking shows "Windows protected your PC" → click **More info** → click **Run anyway** +> (3) Or right-click the exe → Properties → check **Unblock** (if present) → OK → double-click to run -安装包内置完整运行时(standalone Python 3.13 + 依赖 + git + gh + GUI),**干净机器(无 python/uv/git/gh/node)零前置依赖**,100% 离线安装。安装后: +The installer bundles a full runtime (standalone Python 3.13 + deps + git + gh + GUI) — **zero prerequisites on a clean machine (no python/uv/git/gh/node)**, 100% offline install. After install: -**三步开始使用:** -1. 启动台 / 开始菜单点击 **EMRG**(GUI) -2. 首次启动引导配置 **API Key / 模型** -3. 开始对话——**TUI 同步可用**(新开终端运行 `emrg`) +**Three steps to start:** +1. Launch **EMRG** (GUI) from Launchpad / Start menu +2. First-run wizard configures **API Key / model** +3. Start chatting — **TUI is ready too** (run `emrg` in a new terminal) -> **卸载**:macOS 运行"卸载 EMRG.app";Windows 控制面板卸载;Linux 运行 `~/.emrg/install/bin/emrg-uninstall`(或删 AppImage + 软链)。卸载保留 `~/.emrg` 中非 EMRG 的用户文件,并生成终止报告与数据快照。**Windows 卸载彻底**(v0.2.2+):先终止 GUI 进程防止 daemon 复活,白名单全量清理运行时文件,`[UninstallDelete]` 兜底删除 install/,`~/.emrg` 卸载后不残留。 +> **Uninstall**: macOS run "卸载 EMRG.app" (uninstall app); Windows uninstall from Control Panel; Linux run `~/.emrg/install/bin/emrg-uninstall` (or delete the AppImage + symlink). Uninstall preserves non-EMRG user files in `~/.emrg`, and writes a termination report + data snapshot. > -> **macOS 签名与公证**:v0.2.7 起 macOS 安装包已用 Developer ID 双证书签名并完成 Apple 公证(零 Gatekeeper 弹窗,双击直接安装)。仅当安装包未签名时(如自建旧版本),才需要首次打开右键 → 打开。 +> **macOS signing & notarization**: since v0.2.7, macOS packages are signed with Developer ID dual-cert and notarized by Apple (zero Gatekeeper dialogs — double-click to install directly). Only for unsigned builds (e.g. self-built old versions) is right-click → Open needed on first launch. -### 🍎 macOS(源码安装) +### 🍎 macOS (source install) -**一键安装:** +**Install:** ```bash curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash ``` -**一键卸载:** +**Uninstall:** ```bash curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge ``` -### 🐧 Linux(源码安装) +### 🐧 Linux (source install) -**一键安装:** +**Install:** ```bash curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash ``` -**一键卸载:** +**Uninstall:** ```bash curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge ``` -### 🪟 Windows (WSL2,源码安装) +### 🪟 Windows (WSL2, source install) -**一键安装:** +**Install:** ```powershell -# 安装 WSL2(如已安装可跳过) +# Install WSL2 (skip if already installed) wsl --install -# 进入 WSL,执行安装 +# Enter WSL, then install wsl curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash ``` -**一键卸载:** +**Uninstall:** ```bash -# 在 WSL 中执行 +# Run inside WSL curl -sSL https://raw.githubusercontent.com/argszero/emrg/master/install.sh | bash -s -- purge ``` -> 源码安装前置依赖(install.sh 会自动检测提示):git、python 3.11+、uv。gh CLI 推荐安装。Windows 原生版(非 WSL)请用上方安装包。 +> Source-install prerequisites (install.sh auto-detects and prompts): git, python 3.11+, uv. gh CLI recommended. For native Windows (non-WSL), use the installer above. -### 🖥️ 首次配置(GUI 第一) +### 🖥️ First-time config (GUI first) -安装完成后,**打开 GUI 完成首次配置**: +After installing, **open the GUI to configure**: -1. **macOS**:启动台 → 点击 **EMRG**;**Windows**:开始菜单 → **EMRG** -2. 首次启动引导会带你配置 **API Key / 接口地址 / 模型**(也随时可在设置 ⚙ 中修改) -3. 保存后即可开始对话——**配置写入 `~/.emrg/config.toml`,GUI 与 TUI 共享** +1. **macOS**: Launchpad → **EMRG**; **Windows**: Start menu → **EMRG** +2. The first-run wizard walks you through **API Key / base URL / model** (also editable anytime in Settings ⚙) +3. Save and start chatting — **config is written to `~/.emrg/config.toml`, shared by GUI and TUI** -> 💡 **GUI 配好,TUI 直接用**:安装包内置完整 TUI。GUI 保存的配置(API Key/模型/工作目录)写入 `~/.emrg/config.toml`,终端新开窗口运行 `emrg` 即进入 TUI,无需重复配置。GUI 覆盖大部分日常操作;TUI 提供 `/rant` `/model` `/memory` 等进阶命令。 +> 💡 **GUI configured = TUI ready**: the installer bundles a full TUI. Config saved in the GUI (API key/model/workdir) goes to `~/.emrg/config.toml`, so running `emrg` in a new terminal enters the TUI with no re-configuration. Since v0.2.8 the GUI supports **all 15 slash commands** — type `/` in the input box for an autocomplete menu (same as the TUI). -### ⌨️ 使用 TUI +### ⌨️ Using the TUI ```bash emrg ``` -输入 `/help` 查看所有命令,或者直接开始说话——EMRG 会读文件、跑命令、做编辑。 +Type `/help` for all commands, or just start talking — EMRG reads files, runs commands, and makes edits. -### 🔧 高级配置(可选) +### 🔧 Advanced config (optional) -> GUI 保存设置会重写 config 并丢失注释——高级用户可直接编辑 `~/.emrg/config.toml`(首次配置无需手动编辑,GUI 引导即可)。 +> The GUI rewrites config on save and drops comments — advanced users can edit `~/.emrg/config.toml` directly (no manual editing needed for first-time setup; the GUI wizard handles it). -`~/.emrg/config.toml` 模板示例(GUI 保存后自动生成等价内容): +`~/.emrg/config.toml` template example (the GUI generates equivalent content on save): ```toml [llm] @@ -155,11 +155,11 @@ max_tokens = 8192 temperature = 0.7 context_window = 131072 auto_compact_threshold = 0.0 -# vision: 模型是否支持 OpenAI vision API(image_url)。不支持的模型(如 DeepSeek)保持 false, -# 粘贴的图片会降级为文本占位符,避免 API 报错。 +# vision: whether the model supports the OpenAI vision API (image_url). Keep false for +# non-vision models (e.g. DeepSeek) — pasted images degrade to text placeholders to avoid API errors. vision = false -# 多模型支持 — 使用 /model 指令在模型间切换 +# Multi-model support — use /model to switch between models [[llm.models]] name = "deepseek-v3" model = "deepseek-chat" @@ -175,178 +175,164 @@ vision = true --- -## 🎮 命令一览 +## 🎮 Commands -> GUI 覆盖大部分日常操作(聊天/会话/设置/模型切换);TUI 提供以下进阶命令。 +> Since v0.2.8, **all commands work in both the GUI and the TUI**. In the GUI, type `/` in the input box for an autocomplete menu; in the TUI, `/help` lists everything. -| 命令 | 功能 | +| Command | What it does | |---|---| -| **直接打字** | 问 EMRG 任何事——它会读文件、跑命令、做编辑 | -| `/` | 命令自动补全菜单——输入即过滤,↑↓ 选择 | -| `/resume [id]` | 切换会话——不带参数进入交互式选择器(↑↓/j/k 导航) | -| `/sessions` | 浏览所有已保存的会话(↑↓/j/k 导航) | -| `/clear` | 清空当前会话——重新开始 | -| `/compact` | 压缩长对话以节省上下文 | -| `/memory` | 浏览项目和会话记忆 | -| `/rename [标题]` | 给当前会话起个好记的名字 | -| `/model [name]` | 切换 LLM 模型——不带参数进入交互式选择器 | -| `/rant <反馈> [@]` | 吐槽、建议、夸奖——演化系统会听,`@project` 定向到特定项目 | -| `/help` | 查看所有键盘快捷键和命令帮助 | -| `/image` | 从剪贴板插入图片到输入框(支持多张,逐个 Enter 插入) | -| `/delete [id]` | 删除会话——不带参数进入交互式选择器 | -| `/rewind` | 回退对话——选择历史消息点,截断后续内容 | -| `/trigger` | 触发演化任务——交互式选择器(↑↓/j/k) | -| `/skills` | 列出已加载的技能模块 | -| `/version` | 显示 EMRG 版本和实例信息 | -| `Esc` | 中断正在运行的响应 | -| `Ctrl+C` / `exit` | 退出 | +| **Just type** | Ask EMRG anything — it reads files, runs commands, makes edits | +| `/` | Autocomplete menu — type to filter, ↑↓ to select | +| `/resume [id]` | Switch sessions — no args for interactive picker (↑↓/j/k to navigate) | +| `/sessions` | Browse all saved sessions (↑↓/j/k to navigate) | +| `/clear` | Clear current session — start fresh | +| `/compact` | Compress long conversations to save context | +| `/memory` | Browse project & session memories | +| `/rename [title]` | Give your session a memorable name | +| `/model [name]` | Switch LLM model — no args for interactive picker | +| `/rant [@]` | Complain, suggest, praise — evolution listens; `@project` targets a specific project | +| `/help` | Show keyboard shortcuts and command help | +| `/image` | Insert clipboard image into the input field (multiple supported, one per Enter) | +| `/delete [id]` | Delete a session — no args for interactive picker | +| `/rewind` | Rewind conversation — pick a history point and truncate after it | +| `/trigger` | Trigger an evolution task — interactive picker (↑↓/j/k) | +| `/skills` | List loaded skill modules | +| `/version` | Show EMRG version and instance info | +| `Esc` | Interrupt a running response mid-stream | +| `Ctrl+C` / `exit` | Quit | --- -## 🔄 吐槽驱动演化(核心特色) +## 🔄 Rant-Driven Evolution (the core feature) -EMRG 不只是一个工具——它是一个**会听吐槽、会自我改进**的编程伙伴。 - -**你的吐槽是演化的第一推动力**。每次 `/rant` 都会被演化循环读取、分析、转化为代码改进: +EMRG isn't just a tool — it's a coding partner that **listens to your complaints and improves itself**. **Your rants are the primary driver of evolution.** Every `/rant` is read, analyzed, and turned into code improvements: ``` - 📢 你的吐槽 (/rant) ←── 最主要的输入 + 📢 Your rants (/rant) ←── primary input 📥 GitHub Issues & PRs - 📥 竞品动态 (Codex, Claude Code) - 📥 跨项目学习 - ↓ - 🧬 演化循环(每 30 分钟) - (准备 → 回顾 → 发现 → 改进 → 提交 → 记录) - ↓ - ✅ pytest + import 检查 + 📥 Competitor tools (Codex, Claude Code) + 📥 Cross-project learning + ↓ + 🧬 Evolution Cycle (every 30 min) + (Prepare → Review → Discover → Improve → Commit → Record) + ↓ + ✅ pytest + import check ✅ git commit + push → PR - ✅ 演化日志 + ✅ Evolution log ``` -**真实案例**:有人 rant "TUI 需要像 Codex 那样的 `/` 自动补全"。下一个演化周期,EMRG 自己实现了——完整的前缀过滤和方向键导航。合并,部署,搞定。**你对它吐槽什么,它就改进什么。** +**Real example**: Someone ranted "TUI needs `/` autocomplete like Codex." Next evolution cycle, EMRG built it — complete with prefix filtering and arrow-key navigation. Merged. Deployed. Done. **What you rant about, it improves.** -**演化环境健壮性**:演化循环在非交互环境运行,无法执行交互式 `gh auth login`。若 `gh` 未认证,循环会自动从 git 凭据存储(osxkeychain / credential helper)提取 token 作为 `GH_TOKEN` 使用(不落盘、不打印明文);PR 评论/LGTM 计数查询自动走 REST API(GraphQL 需额外 `read:org` scope)。宿主只需配好 git 凭据,演化即可全自动运行。 +**Robust evolution environment**: the evolution cycle runs in a non-interactive environment where interactive `gh auth login` is impossible. If `gh` is unauthenticated, the cycle automatically extracts a token from git credential storage (osxkeychain / credential helper) as `GH_TOKEN` (never persisted, never printed); PR comment/LGTM counting queries automatically use the REST API (GraphQL needs an extra `read:org` scope). The host only needs git credentials configured — evolution runs fully automatically. On packaged installs, the evolution workspace **self-heals** (v0.2.8): clones the repo on demand, aligns to the installed release tag, and bootstraps `projects.yml`/`tasks.yml` — no manual setup. -> 💡 详见 [MANIFESTO.md](MANIFESTO.md) —— 这是 EMRG 的设计宪章,阐述了 AI 时代自主进化的核心理念。 +> 💡 See [MANIFESTO.md](MANIFESTO.md) — EMRG's design charter on autonomous evolution in the AI era. --- -## 🏗️ 架构 +## 🏗️ Architecture ``` ┌─────────────┐ WebSocket (ws://) ┌──────────────┐ │ emrg TUI │ ◄─────────────────────► │ emrgd │ -│ (客户端) │ TCP loopback + 首帧认证 │ (守护进程) │ +│ (client) │ TCP loopback + auth │ (daemon) │ │ │ token (emrgd.port) │ │ -│ • 聊天 │ │ • LLM 循环 │ -│ • Markdown │ │ • 工具执行 │ -│ • 工具卡片 │ │ • 演化引擎 │ -│ • 自动补全 │ │ • 会话管理 │ -└─────────────┘ └──────────────┘ +│ │ │ │ +│ • Chat │ │ • LLM loop │ +│ • Markdown │ │ • Tools │ +│ • ToolCards│ │ • Evolution │ +│ • Autocomplete │ • Sessions │ +└─────────────┘ └──────────────┘ ``` -- **`emrgd`** — 守护进程:运行 LLM 工具调用循环,管理会话,驱动演化 -- **`emrg`** — 你的终端:流式 Markdown、命令自动补全、会话浏览器 -- **Skills** — 动态加载模块(浏览器控制、安装器等) -- **Memory** — YAML frontmatter + Markdown 文件,自动索引,可搜索 +- **`emrgd`** — The daemon: runs the LLM tool-calling loop, manages sessions, drives evolution +- **`emrg`** — Your terminal: streaming markdown, command autocomplete, session browser +- **Skills** — Dynamically loaded modules (browser harness, installers, etc.) +- **Memory** — YAML frontmatter + Markdown files, auto-indexed, searchable --- -## 📊 与竞品对比 +## 📊 vs. the competition | | Claude Code | Codex | **EMRG** | |---|---|---|---| -| AI 驱动编程 | ✅ | ✅ | ✅ | -| 工具调用 (bash, read, write, edit, glob, grep) | ✅ | ✅ | ✅ | -| 会话记忆与上下文 | ✅ | ✅ | ✅ | -| `/` 命令自动补全 | ✅ | ✅ | ✅ | -| 方向键会话选择器 | ✅ | ✅ | ✅ | -| ESC 中断 | ✅ | ✅ | ✅ | -| **自主进化** | ❌ | ❌ | ✅ *全自动* | -| **后台守护进程** | ❌ | ❌ | ✅ *持久运行* | -| **吐槽驱动自我改进** | ❌ | ❌ | ✅ */rant → 演化 → PR* | -| **开源** | ❌ | ❌ | ✅ *MIT* | - -EMRG 不只是追赶——它自己追上来。 - -### 社区需求的差异化回应 - -HN 社区([讨论帖](https://news.ycombinator.com/item?id=49119274))对 agent UI 提出的高频需求,EMRG 已原生覆盖: - -| 社区需求 | EMRG 的答案 | -|---|---| -| **可检查产物 (inspectable artifacts)** | 一切皆文件:状态文件(`open_source_*_state.md`、`promote_*_state.md`)、记忆索引(YAML frontmatter + Markdown)、演化日志(`evolution-*.json`)——`/memory` 随时可查 | -| **git 文件夹即状态** | 项目跟踪基于 git:projects.yml 记录仓库路径,演化饱和检测以 git HEAD 为准——状态与版本控制天然同步 | -| **工具栏专属快捷键** | 终端即工具栏:`Ctrl+A/E/W/K/U` 编辑、`j`/`k` 导航、`ESC` 中断、`/` 命令补全——零鼠标操作 | -| **会话/项目管理** | `/sessions` 会话浏览器、`/rename`、`/resume`、`/rewind`、项目作用域会话 + 项目自动跟踪 | - -**定位**:终端优先、TUI 驱动、会话记忆、`git 即状态`——EMRG 不需要浏览器插件或额外面板,一切在终端内可检查、可追溯。 +| AI-powered coding | ✅ | ✅ | ✅ | +| Tool-calling (bash, read, write, edit, glob, grep) | ✅ | ✅ | ✅ | +| Session memory & context | ✅ | ✅ | ✅ | +| `/` command autocomplete | ✅ | ✅ | ✅ | +| Arrow-key session picker | ✅ | ✅ | ✅ | +| ESC interrupt | ✅ | ✅ | ✅ | +| **Self-evolution** | ❌ | ❌ | ✅ *autonomous* | +| **Background daemon** | ❌ | ❌ | ✅ *persistent* | +| **Learns from rants** | ❌ | ❌ | ✅ */rant → PR* | +| **Open source** | ❌ | ❌ | ✅ *MIT* | + +EMRG doesn't just keep up — it catches up on its own. --- -## 🧪 开发 +## 🧪 Development ```bash git clone https://github.com/argszero/emrg.git cd emrg -uv sync # 安装依赖 -uv run pytest tests/ -v # 跑测试(当前 473 项) -uv run python -m emrg # 启动 TUI -# CI 含 actionlint workflow 门禁(#444):workflow 解析错误在 PR 即失败 +uv sync # install deps +uv run pytest tests/ -v # run tests (currently 480 items) +uv run python -m emrg # launch TUI +# CI includes actionlint workflow gate (#444): workflow parse errors fail PR CI -# 可选:Electron GUI(非开发者主入口,Phase 3) +# Optional: Electron GUI (non-developer entry point, Phase 3) cd emrg/gui -npm ci # 安装依赖(生产模式可 --omit=dev) -npm start # 启动 GUI(自动拉起 daemon) -npm test # 运行 Node 测试(44 项:22 daemon_client + 7 integration + 15 renderer smoke;集成测试在 CI 跑,本地可 npm run test:integration) +npm ci # install deps (production: --omit=dev) +npm start # launch GUI (auto-starts daemon) +npm test # run Node tests (58: 22 daemon_client + 7 integration + 25 renderer smoke + 4 app-commands; integration runs in CI, local: npm run test:integration) ``` -CI 通过 GitHub Actions 自动运行测试并检查冲突标记(`.github/workflows/test.yml`)。 +CI runs tests and checks for conflict markers automatically via GitHub Actions (`.github/workflows/test.yml`). -### 项目结构 +### Project structure ``` emrg/ -├── emrg/ # 核心包 -│ ├── server/ # 守护进程——LLM 循环、工具执行、演化引擎 -│ ├── client/ # TUI——基于 python-tui 的交互式聊天 -│ ├── gui/ # Electron GUI(非开发者主入口,Phase 3) +├── emrg/ # Core package +│ ├── server/ # Daemon — LLM loop, tool execution, evolution +│ ├── client/ # TUI — python-tui based interactive chat +│ ├── gui/ # Electron GUI (non-developer entry point, Phase 3) │ ├── tools/ # bash, read, write, edit, glob, grep -│ ├── skills/ # 动态加载模块 -│ └── __main__.py # CLI 入口 +│ ├── skills/ # Dynamically loadable modules +│ └── __main__.py # CLI entry point ├── tests/ -├── .github/workflows/ # CI 流水线(pytest + 冲突标记检查) -├── MANIFESTO.md # 设计宪章 +├── .github/workflows/ # CI pipeline (pytest + conflict marker check) +├── MANIFESTO.md # Design constitution └── pyproject.toml ``` --- -## ❓ 常见问题 +## ❓ FAQ -**这是真的吗——它真的会改自己的代码?**
-真的。演化循环读取演化提示词,回顾 rant + issue + 竞品工具,修改源码,跑测试,然后提交 PR。如果测试失败,自动回滚。 +**Is this real — does it actually modify its own code?**
+Yes. The evolution cycle reads the evolution prompt, reviews rants + issues + competitor tools, makes source changes, runs tests, and submits a PR. If tests fail, it rolls back. -**它会把自己搞崩吗?**
-每次改动都会通过 `pytest` 和 import 检查验证后才提交。失败的改动会被丢弃。最坏的情况就是回滚。 +**Can it break itself?**
+Every change is validated by `pytest` and an import check before commit. Failed changes are discarded. The worst case is a rollback. -**支持哪些 LLM?**
-任何兼容 OpenAI API 的模型。已测试 DeepSeek 和 OpenAI。支持 Anthropic(通过代理)、Ollama、vLLM 及其他本地模型。 +**What LLMs work with it?**
+Any OpenAI-compatible API. Tested with DeepSeek and OpenAI. Works with Anthropic (via proxy), Ollama, vLLM, and other local models. -**和 Claude Code 或 Codex 有什么不同?**
-它们是产品。EMRG 是一个关于*闭环进化*的实验——AI 改进 AI。此外:完全开源、无厂商锁定、你掌控自己的数据。 +**How is this different from Claude Code or Codex?**
+They're products. EMRG is an experiment in *closing the loop* — the AI improves the AI. Also: fully open source, no vendor lock-in, and you control your data. -**为什么 Windows 安装包会提示"未知发布者"?**
-Windows 安装包未做 Authenticode 签名(该证书需付费申请,暂不采购),因此 SmartScreen 会显示"发布者:未知"并可能阻止运行。这是微软对新发布/未签名软件的通用安全提醒,**不代表文件有问题**——EMRG 完全开源(MIT),源码可审计。放行:浏览器提示点"保留";运行提示点"更多信息 → 仍要运行";或右键 exe → 属性 → 勾选"解除锁定"。macOS 安装包已签名+公证(v0.2.7+),无此问题。 +**Why does the Windows installer show "Unknown publisher"?**
+The Windows installer is not Authenticode-signed (that certificate costs money to obtain and is not procured yet), so SmartScreen shows "Publisher: Unknown" and may block the run. This is a standard Microsoft security prompt for newly released/unsigned software — it does **not** mean the file is bad: EMRG is fully open source (MIT) and auditable. To proceed: click "Keep" on the browser prompt; click "More info → Run anyway" on the run prompt; or right-click the exe → Properties → check "Unblock". The macOS installer is signed + notarized (v0.2.7+) and has no such prompt. --- -## 📜 许可证 +## 📜 License -MIT — 详见 [LICENSE](LICENSE) 了解完整条款,[MANIFESTO.md](MANIFESTO.md) 了解代码背后的设计哲学。 +MIT — see [LICENSE](LICENSE) for the full terms and [MANIFESTO.md](MANIFESTO.md) for the philosophy behind the code. ---

- argszero 和持续进化的 AI 共同打造 ❤️ + Built with ❤️ by argszero — and a continuously evolving AI.

diff --git a/pyproject.toml b/pyproject.toml index 3a4f0bc..352d01d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ emrg = "emrg.__main__:main" allow-direct-references = true [tool.hatch.build] -include = ["emrg/**/*.py", "emrg/**/*.md", "emrg/**/*.j2", "LICENSE", "README.md", "README.en.md"] +include = ["emrg/**/*.py", "emrg/**/*.md", "emrg/**/*.j2", "LICENSE", "README.md", "README.cn.md"] [build-system] requires = ["hatchling"]