agentquad 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,257 @@
1
+ <div align="center">
2
+
3
+ # 🎯 AgentQuad
4
+
5
+ **四象限待办看板,每条 todo 都能起一个本地 Claude / Codex 会话。**
6
+
7
+ 全本地存储 · 原生支持 MCP · Telegram 远程驱动
8
+
9
+ [![npm version](https://img.shields.io/npm/v/agentquad.svg?style=flat-square)](https://www.npmjs.com/package/agentquad)
10
+ [![npm downloads](https://img.shields.io/npm/dm/agentquad.svg?style=flat-square)](https://www.npmjs.com/package/agentquad)
11
+ [![license](https://img.shields.io/npm/l/agentquad.svg?style=flat-square)](./LICENSE)
12
+ [![node](https://img.shields.io/node/v/agentquad.svg?style=flat-square)](https://nodejs.org)
13
+ ![platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux-blue?style=flat-square)
14
+
15
+ [English](./README.md) · [简体中文](./README.zh-CN.md)
16
+
17
+ <img src="./assets/screenshots/board.png" alt="AgentQuad 四象限看板" width="900" />
18
+
19
+ </div>
20
+
21
+ ---
22
+
23
+ ## AgentQuad 是什么?
24
+
25
+ AgentQuad 是一个**全本地的任务调度器**,按艾森豪威尔矩阵把待办分到四个象限。每张 todo 卡片都能起一个内嵌的 **Claude Code** 或 **Codex** 终端会话,让"做事"和"AI 助手"待在一起,而不是分散在两个工具里。
26
+
27
+ - ❌ **不是 Linear / Todoist** —— 它们没法在卡片里直接跑 AI 终端
28
+ - ❌ **不是 Cursor / Aider** —— 它们没有任务管理和跨项目调度
29
+ - ❌ **不是原生 Claude Code** —— 没有可视化看板、没有会话历史浏览、没有按任务隔离
30
+
31
+ ---
32
+
33
+ ## 截图
34
+
35
+ <table>
36
+ <tr>
37
+ <td align="center"><img src="./assets/screenshots/board.png" width="400" /><br/><sub>四象限看板</sub></td>
38
+ <td align="center"><img src="./assets/screenshots/ai-terminal.png" width="400" /><br/><sub>内嵌 AI 会话</sub></td>
39
+ </tr>
40
+ <tr>
41
+ <td align="center"><img src="./assets/screenshots/stats.png" width="400" /><br/><sub>统计与周报</sub></td>
42
+ <td align="center"><img src="./assets/screenshots/cmdk.png" width="400" /><br/><sub>⌘K 命令面板</sub></td>
43
+ </tr>
44
+ </table>
45
+
46
+ ---
47
+
48
+ ## 30 秒上手
49
+
50
+ ```bash
51
+ npm install -g agentquad
52
+ agentquad # 打开 http://127.0.0.1:5677
53
+ ```
54
+
55
+ 首次启动会引导你装 `claude` / `codex`。跳过首跑向导:`agentquad --no-wizard` 或 `AGENTQUAD_SKIP_WIZARD=1`。
56
+
57
+ **环境要求:** Node 20+,npm 10+,macOS 或 Linux(Windows 计划中)。
58
+
59
+ 如果 `claude` 或 `codex` 没装:
60
+
61
+ ```bash
62
+ agentquad install-tools --all
63
+ # 或手动:
64
+ npm i -g @anthropic-ai/claude-code @openai/codex
65
+ ```
66
+
67
+ 随时自检:
68
+
69
+ ```bash
70
+ agentquad doctor
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 功能特性
76
+
77
+ - **艾森豪威尔四象限看板**,支持跨象限拖拽
78
+ - **每条 todo 一个 Claude / Codex 终端**,会话持久化、可恢复
79
+ - **会话日志本地落盘**(JSONL 格式),支持搜索;不上云
80
+ - **周报 / 月报统计**,含 token 成本估算(模型单价可配置)
81
+ - **全本地** —— SQLite + 文件系统,数据从不离开你的电脑
82
+ - **⌘K 命令面板**,快速导航 + 批量操作
83
+ - **跨平台**:macOS 和 Linux
84
+
85
+ ---
86
+
87
+ ## 集成方式
88
+
89
+ ### 🔌 MCP 服务(17 个工具)
90
+
91
+ AgentQuad 内置一个 MCP Streamable HTTP 服务(`POST /mcp`)。外部 Claude Code 会话挂上之后,可以用自然语言"帮我清理重复 todo"、"最近一周我在忙啥"、"合并这三条关于登录的 todo"。
92
+
93
+ ```bash
94
+ agentquad mcp install # 写入 ~/.claude/settings.json
95
+ agentquad mcp status # 健康检查
96
+ ```
97
+
98
+ 完整工具清单 + preview/confirm 安全模型 + ⌘K 集成 → **[docs/MCP.md](./docs/MCP.md)**。
99
+
100
+ ### 💬 Telegram supergroup(每任务一个 Topic)⭐
101
+
102
+ 直接跑一个 Telegram bot,每开一个 task 自动建一个 **Forum Topic** —— 对话物理隔离;内容直接从 Claude 的 JSONL 日志读(干净,无 spinner / ANSI 噪声);任务结束 close topic + 改名 ✅。
103
+
104
+ → **[docs/TELEGRAM.md](./docs/TELEGRAM.md)**
105
+
106
+ ### 🐱 OpenClaw(微信桥接)
107
+
108
+ 把 AgentQuad 接到 [OpenClaw](https://openclaw.ai/) 的微信渠道:在微信里说"帮我做:X"就自动建 todo + 启动 Claude Code,AI 卡到决策点又能在微信里推给你选。
109
+
110
+ → **[docs/OPENCLAW.md](./docs/OPENCLAW.md)** —— 5 步启用清单。
111
+
112
+ ### 📱 手机访问(Tailscale)
113
+
114
+ 用 Tailscale 私有 mesh VPN 让手机也能用 AgentQuad,不暴露公网,5 分钟搞定。
115
+
116
+ > ⚠️ **安全提醒:** AgentQuad 内置 shell + AI 终端能力,**绝对不要**直接暴露到公网。Tailscale 是推荐的访问方式。
117
+
118
+ ```bash
119
+ agentquad config set host 0.0.0.0 # Tailscale 需要监听所有网卡
120
+ agentquad start # 或:agentquad start --expose
121
+ ```
122
+
123
+ → **[docs/MOBILE.md](./docs/MOBILE.md)**
124
+
125
+ ---
126
+
127
+ ## 配置
128
+
129
+ 配置文件:`~/.agentquad/config.json`
130
+
131
+ ```json
132
+ {
133
+ "port": 5677,
134
+ "host": "127.0.0.1",
135
+ "defaultTool": "claude",
136
+ "defaultCwd": "~",
137
+ "tools": {
138
+ "claude": { "command": "claude", "bin": "claude", "args": [] },
139
+ "codex": { "command": "codex", "bin": "codex", "args": [] }
140
+ }
141
+ }
142
+ ```
143
+
144
+ 示例:
145
+
146
+ ```bash
147
+ agentquad config set port 6000
148
+ agentquad config set tools.claude.bin /opt/homebrew/bin/claude
149
+ agentquad config set tools.codex.command codex-w # 公司内自定义 wrapper
150
+ ```
151
+
152
+ - `tools.<tool>.command` —— 启动命令名(适合 `claude-w` 这种公司内封装)
153
+ - `tools.<tool>.bin` —— 绝对路径覆盖,优先级高于 `command`
154
+
155
+ ---
156
+
157
+ ## 命令
158
+
159
+ | 命令 | 作用 |
160
+ |---|---|
161
+ | `agentquad`(无参数) | 等价于 `agentquad start`,首次启动会引导装 AI 工具 |
162
+ | `agentquad start [--port 5677] [--host 0.0.0.0] [--expose] [--no-open] [--cwd <path>] [--no-wizard]` | 启动服务 |
163
+ | `agentquad stop` | 停止服务(SIGTERM 3 秒后 SIGKILL) |
164
+ | `agentquad status` | 查看运行状态 + 活跃会话数 |
165
+ | `agentquad doctor` | 环境自检 |
166
+ | `agentquad config get/set/list` | 读/写配置 |
167
+ | `agentquad mcp install/status/uninstall` | 管理 MCP 集成 |
168
+ | `agentquad hook status/install/uninstall/bootstrap` | 管理 Claude Code hook |
169
+ | `agentquad telegram:setup-menu` | 刷新 Telegram bot 命令菜单 |
170
+ | `agentquad openclaw bootstrap` | 重装 OpenClaw 钩子 |
171
+
172
+ ---
173
+
174
+ ## 数据存储
175
+
176
+ ```
177
+ ~/.agentquad/
178
+ ├── config.json
179
+ ├── data.db # SQLite — todos / sessions / stats
180
+ ├── agentquad.pid # JSON pid 文件
181
+ └── logs/
182
+ └── ai-*.log # AI 会话 JSONL 日志
183
+ ```
184
+
185
+ 导出/迁移:整个 `~/.agentquad/` 是普通目录,tar 打包即可。
186
+
187
+ ---
188
+
189
+ <details>
190
+ <summary><b>架构</b>(点开看目录树)</summary>
191
+
192
+ ```
193
+ agentquad/
194
+ ├── package.json # 后端 deps: express / ws / node-pty / better-sqlite3
195
+ ├── src/
196
+ │ ├── cli.js # commander 入口
197
+ │ ├── config.js # ~/.agentquad/config.json 读写
198
+ │ ├── db.js # better-sqlite3 包装
199
+ │ ├── pty.js # PtyManager(node-pty 会话 Map)
200
+ │ ├── server.js # Express + ws + 路由组装
201
+ │ └── routes/
202
+ │ ├── todos.js
203
+ │ └── ai-terminal.js
204
+ └── web/
205
+ ├── package.json # 前端独立: vite + react + antd + dnd-kit + xterm
206
+ └── src/
207
+ ├── main.tsx
208
+ ├── TodoManage.tsx # 四象限看板
209
+ ├── AiTerminalMini.tsx
210
+ ├── SettingsDrawer.tsx
211
+ └── api.ts
212
+ ```
213
+
214
+ </details>
215
+
216
+ ---
217
+
218
+ ## 从源码构建
219
+
220
+ ```bash
221
+ git clone git@github.com:LIUZHENHUA521/agentquad.git
222
+ cd agentquad
223
+ npm run build:all # 一键装齐两层依赖 + 构建前端,产物在 dist-web/
224
+ npm link # 全局链接 `agentquad` 命令
225
+ ```
226
+
227
+ 更细的脚本:
228
+
229
+ ```bash
230
+ npm run setup # 只装依赖:根目录 + web/
231
+ npm run build # 只 build 前端(前提是 web/node_modules 已装好)
232
+ npm run clean # 删除 node_modules / dist-web / web/dist
233
+ ```
234
+
235
+ ---
236
+
237
+ ## 故障排除
238
+
239
+ - **端口占用**:`agentquad config set port <new>`
240
+ - **`claude` 找不到**:`agentquad config set tools.claude.bin /full/path/to/claude`
241
+ - **`node-pty` 安装报错**:通常是 node-gyp 找不到 C++ 工具链。macOS 装 Xcode Command Line Tools:`xcode-select --install`
242
+ - **终端显示 `session_not_found`**:会话已超时(30 分钟空闲会被清理),重新点"启动 AI 终端"
243
+ - **Live 终端排版乱(CJK 宽度、状态栏对不齐)**:AgentQuad 默认给 PTY 子进程注入 `LANG=LC_CTYPE=en_US.UTF-8`,让 wcwidth 跟 xterm.js (Unicode 11) 对齐。要保留 CJK locale,设 `AGENTQUAD_KEEP_CJK_LOCALE=1` 再重启。
244
+
245
+ ---
246
+
247
+ ## 贡献
248
+
249
+ 欢迎提 issue / PR。如果 AgentQuad 帮到了你,麻烦点个 ⭐ —— 真的会激励维护者继续打磨。
250
+
251
+ ---
252
+
253
+ ## License
254
+
255
+ [MIT](./LICENSE) © LIUZHENHUA521
256
+
257
+ <sub>项目历史:最早叫 `quadtodo`,v0.3.0 改名为 `agentquad`。`quadtodo` CLI 命令作为别名保留,老脚本不受影响。</sub>