@foxden-app/foxclaw 0.2.6 → 0.2.7

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.
package/README.md CHANGED
@@ -1,297 +1,299 @@
1
- 中文 | [English](./README_EN.md)
2
-
3
- # 🦊 FoxClaw · 狸爪
4
-
5
- **一个更适配编程需求的移动端 AI 编码助手。**
6
-
7
- FoxClaw(狸爪)让你通过 Telegram 或微信远程操控本机的 Codex,实现手机端的 AI 编程。你可以离开办公桌去吃饭、在跑步机上、在陪小孩逛公园——你的 Codex 依然在正常工作,并随时向你汇报进展。
8
-
9
- 不需要公网服务器。FoxClaw 跑在你自己电脑上,在本地和 `codex app-server` 通信,审批在你电脑上完成,结果推送回手机。
10
-
11
- ## 为什么是 FoxClaw
12
-
13
- **为什么选 Codex 作为底层引擎?**
14
-
15
- 1. **开源且接口完整** — Codex 是 OpenAI 开源的 CLI agent,提供了 `codex app-server`,暴露了完整的 JSON-RPC 接口,可以被外部程序精确控制。
16
- 2. **GPT 模型体验领先** — Codex 使用 GPT 系列模型(包括 o3/o4-mini 等),在实际编码体验上表现优秀。
17
- 3. **多账号额度切换**支持多个 OpenAI 账号的免费额度(Plus 试用、Team 试用、多账号免费额度等)自动轮换。5 小时用量限制一到,自动切换下一个账号继续工作,不用手动操作。
18
-
19
- **适合这些场景:**
20
-
21
- - 🍜 离开办公桌去吃饭,Codex 继续编码,有审批需求时手机上点一下
22
- - 🚶 通勤路上、旅途中,不用打开电脑也能下发编码任务、查看进展
23
- - 🏃 在跑步机上、陪小孩逛公园,随时监控编码进程、做调试审批
24
- - 🔒 代码、shell、认证、审批、运行数据全部留在本机,不暴露到公网
25
- - 👤 只允许一个受信任的 Telegram 用户远程操作
26
-
27
- ## 从这里开始
28
-
29
- - 手头有 Codex、OpenClaw、QwenPaw、Hermes、OpenCode、Kimi CLI 之类能跑 shell 的 agent?推荐走 [Agent 辅助安装](./docs/agent-assisted-install.md)。
30
- - 对 Node、Telegram 机器人、Codex CLI 不太熟?看 [新手安装指南](./docs/install-for-beginners.md)。
31
- - GitNode、`.env` 都玩得转?直接往下看快速设置。
32
- - 卡住了?看 [故障排查](./docs/troubleshooting.md)。
33
-
34
- 最低要求:一个 Telegram bot token、你的 Telegram 数字用户 ID、Node.js 24、一份已登录的 `codex` CLI。首次安装大约 10–20 分钟。
35
-
36
- **30 秒体验**:启动 FoxClaw 后,给你的 Telegram 机器人发一句 `List files in DEFAULT_CWD`。Codex 会在本地检查那个目录,然后把结果发回 Telegram。
37
-
38
- ## 环境要求
39
-
40
- - macOS 或 Linux,`codex` CLI 可用
41
- - Codex 已完成登录认证
42
- - Node.js 24+
43
- - 一个 `@BotFather` 创建的 Telegram bot token
44
- - 你的 Telegram 数字用户 ID
45
-
46
- ## 快速设置
47
-
48
- ```bash
49
- npm install -g @foxden-app/foxclaw
50
- foxclaw init
51
- $EDITOR ~/.foxclaw/.env
52
- foxclaw doctor
53
- foxclaw start
54
- ```
55
-
56
- pnpm 用户:
57
-
58
- ```bash
59
- pnpm add -g @foxden-app/foxclaw
60
- foxclaw init
61
- $EDITOR ~/.foxclaw/.env
62
- foxclaw doctor
63
- foxclaw start
64
- ```
65
-
66
- 跑 `doctor` 或 `start` 之前先把 `.env` 填好。私聊模式最小配置:
67
-
68
- ```dotenv
69
- TG_BOT_TOKEN=123456:telegram-token
70
- TG_ALLOWED_USER_ID=123456789
71
- DEFAULT_CWD=/absolute/path/to/workspace
72
- DEFAULT_APPROVAL_POLICY=on-request
73
- DEFAULT_SANDBOX_MODE=workspace-write
74
- ```
75
-
76
- 配置文件默认在 `~/.foxclaw/.env`。想放别处的话设 `FOXCLAW_ENV=/path/to/.env`。
77
-
78
- `foxclaw start` 会自动检查环境并安装/重启后台服务,幂等操作,升级后再跑一次就行。
79
-
80
- FoxClaw 只响应 `TG_ALLOWED_USER_ID` 的消息——把机器人拉进群不代表群里所有人都能用。
81
-
82
- <details>
83
- <summary>FoxClaw 能做什么</summary>
84
-
85
- **核心能力:**
86
- - 通过 Telegram 私聊、群组、话题控制本地 Codex
87
- - 可选微信/iLink 通道,复用同一套桥接核心
88
- - 手机上完整管理 Codex 线程生命周期:创建、重命名、归档、fork、回滚、compact、review、diff
89
- - 命令、文件变更、细粒度权限审批的内联按钮——手机上一键审批
90
- - MCP elicitation 卡片——工具在 turn 中提出结构化问题时展示
91
-
92
- **多账号管理:**
93
- - Codex 账户管理:`/account`、`/quota`、`/login_device`、`/auth add <name>`
94
- - 触发用量限制时自动在本地 `auth.json_*` 之间切换认证——5 小时限制到了自动换号
95
- - `/auth` 面板查看、启用、禁用、切换候选账号
96
-
97
- **线程与会话:**
98
- - `/threads`、`/open`、`/new`、`/where`、`/interrupt`——稳定的聊天-线程绑定
99
- - 每个聊天独立的设置面板:模型、reasoning effort、Fast tier、access preset、Agent/Plan 模式
100
- - Skills、MCP、hooks、plugins、apps、feature flags、config、requirements、provider diagnostics
101
-
102
- **可靠性:**
103
- - SQLite 持久化:绑定、offset、审批、待处理提示、审计日志
104
- - 单实例进程锁,防止同一 bot token 重复 polling
105
-
106
- </details>
107
-
108
- ## 多账号切换
109
-
110
- FoxClaw 的一大特色是自动多账号切换。当一个账号的 5 小时用量限制触发时,FoxClaw 会自动切换到下一个可用账号继续工作。
111
-
112
- 设置方式:
113
-
114
- 1. 在 Codex 的 auth 目录(通常是 `~/.codex/`)中放置多个认证文件,命名为 `auth.json_personal`、`auth.json_team` 等。
115
- 2. 用 `/auth add <name>` 通过 Telegram 直接添加新账号。
116
- 3. `/auth` 查看所有候选账号状态。
117
- 4. 用 `/auth enable <n>` / `/auth disable <n>` 控制哪些账号参与自动轮换。
118
-
119
- Codex 报告用量限制错误时,FoxClaw 会自动:
120
- - 切换到下一个未失败的候选账号
121
- - 重启 app-server 加载新认证
122
- - 用新账号重试刚才失败的请求
123
-
124
- ## 服务与调试
125
-
126
- 推荐方式:
127
-
128
- ```bash
129
- foxclaw start
130
- ```
131
-
132
- Linux 上会安装/重启用户级 systemd 服务,macOS 上安装/重载 launchd。查看状态:
133
-
134
- ```bash
135
- systemctl --user status foxclaw.service
136
- journalctl --user -u foxclaw.service -f
137
- ```
138
-
139
- 需要前台调试时:
140
-
141
- ```bash
142
- foxclaw serve
143
- ```
144
-
145
- 运行时文件默认在 `~/.foxclaw`:
146
-
147
- | 用途 | 路径 |
148
- |------|------|
149
- | 数据库 | `~/.foxclaw/data/bridge.sqlite` |
150
- | Bridge 日志 | `~/.foxclaw/logs/service.log` |
151
- | 状态 | `~/.foxclaw/runtime/status.json` |
152
- | App-server 状态 | `~/.foxclaw/runtime/codex-app-server.json` |
153
- | App-server 日志 | `~/.foxclaw/logs/codex-app-server.log` |
154
-
155
- 可通过 `STORE_PATH`、`LOCK_PATH`、`CODEX_APP_SERVER_STATE_PATH`、`CODEX_APP_SERVER_LOG_PATH` 覆盖。
156
-
157
- ## telegram-codex-app-bridge 迁移
158
-
159
- FoxClaw 最初 fork 自 `Gan-Xing/telegram-codex-app-bridge`,继续以 MIT License 分发。
160
-
161
- 升级已有安装:
162
-
163
- ```bash
164
- systemctl --user disable --now telegram-codex-app-bridge.service 2>/dev/null || true
165
- test -e ~/.foxclaw || cp -a ~/.telegram-codex-app-bridge ~/.foxclaw
166
- foxclaw start
167
- ```
168
-
169
- macOS launchd 用户先卸载旧 plist:
170
-
171
- ```bash
172
- launchctl unload ~/Library/LaunchAgents/com.ganxing.telegram-codex-app-bridge.plist 2>/dev/null || true
173
- foxclaw start
174
- ```
175
-
176
- 旧目录不会被自动读取。如果要保留已有的绑定、线程缓存、审批和状态数据,手动复制一次即可。
177
-
178
- ## Telegram 设置
179
-
180
- 1. `@BotFather` 创建机器人,token 填入 `TG_BOT_TOKEN`。
181
- 2. 拿到你的 Telegram 数字用户 ID,填入 `TG_ALLOWED_USER_ID`。
182
- 3. `foxclaw start` 启动。
183
- 4. 打开和机器人的私聊,发 `/help`。
184
-
185
- 可选——群组/话题配置:
186
-
187
- ```dotenv
188
- TG_ALLOWED_CHAT_ID=-1001234567890
189
- TG_ALLOWED_TOPIC_ID=42
190
- ```
191
-
192
- - `TG_ALLOWED_CHAT_ID` 留空 → 纯私聊模式。
193
- - 只填 `TG_ALLOWED_CHAT_ID` → 允许一个群组作为默认会话范围。
194
- - 两个都填绑定到某个话题。
195
- - 配了群组后,`TG_ALLOWED_USER_ID` 的私聊依然可用。
196
-
197
- **怎么找群组和话题 ID:**
198
-
199
- 1. 先停掉 FoxClaw。
200
- 2. 在目标群组/话题里发一条消息。
201
- 3. 浏览器打开 `https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates`。
202
- 4. 找 `message.chat.id` → 填 `TG_ALLOWED_CHAT_ID`。
203
- 5. `message.message_thread_id` → 填 `TG_ALLOWED_TOPIC_ID`。
204
-
205
- > 如果 FoxClaw 还在跑,它可能会先把这条 update 消费掉,所以要先停。
206
-
207
- ## Telegram 群组检查清单
208
-
209
- 要让机器人在群组/超级群里收到普通消息:
210
-
211
- 1. 把机器人加进目标群组。
212
- 2. 在 `@BotFather` 里关掉 `privacy mode`。
213
- 3. 把机器人设为群管理员。
214
- 4. 如果是加群之后才改的隐私模式,把机器人踢出去再重新加。
215
-
216
- > 注意:即使 privacy mode 挡住了普通消息,`/status@botname` 这种显式命令可能还是能用的。所以验证群组设置时,请用一条普通文本消息测试。
217
-
218
- ## Codex App-Server 生命周期
219
-
220
- 默认配置:
221
-
222
- ```dotenv
223
- CODEX_APP_AUTOLAUNCH=true
224
- CODEX_APP_LAUNCH_CMD=codex app
225
- CODEX_APP_SERVER_STATE_PATH=
226
- CODEX_APP_SERVER_LOG_PATH=
227
- CODEX_APP_SYNC_ON_OPEN=true
228
- CODEX_APP_SYNC_ON_TURN_COMPLETE=false
229
- ```
230
-
231
- FoxClaw 会把 `codex app-server` 作为 detached 子进程启动,记录其 pid 和端口。重启时如果进程还活着就直接重连,否则拉起新进程。`/auth_reload` 和认证切换会重启 app-server 以重新加载 `auth.json`。
232
-
233
- 一般不需要手动固定 app-server 端口。
234
-
235
- ## 命令
236
-
237
- - `/help`
238
- - `/setup` — 统一设置面板
239
- - `/fast <on|off|toggle>`
240
- - `/active <steer|queue>`
241
- - `/status`、`/account`、`/quota`
242
- - `/quota_nudge <credits|usage_limit> confirm`
243
- - `/login_device`、`/login_cancel [id]`、`/logout confirm`
244
- - `/auth [list|use <n>|enable <n>|disable <n>|reload|add <name>]`
245
- - `/threads [query]`、`/threads archived`、`/open <n>`
246
- - `/goal [objective|pause|resume|done|budget <tokens|off>|clear confirm]`
247
- - `/history [limit]`、`/files <query>`、`/remote`
248
- - `/new [cwd]`
249
- - `/steer <message>`、`/takeover <message>`、`/queue <message>`
250
- - `/review [base <branch>|commit <sha>|custom <instructions>]`
251
- - `/diff`、`/fork [name]`、`/undo [n]`、`/rollback [n]`
252
- - `/rename <name>`、`/compact`、`/archive`、`/unarchive <n>`
253
- - `/skills [query]`、`/skill <name>`、`/skill_enable <name>`、`/skill_disable <name>`
254
- - `/loaded`、`/hooks`、`/plugins [query]`、`/apps [reload]`、`/features`、`/config`、`/requirements`、`/provider`
255
- - `/mcp`、`/mcp_reload`、`/mcp_login <server>`、`/mcp_resource <server> <uri>`
256
- - `/models`、`/model`、`/effort`、`/permissions`、`/access`、`/mode`、`/plan`、`/agent`
257
- - `/reveal`、`/where`、`/interrupt`
258
-
259
- 直接发文本会送到当前线程;没有绑定线程时自动创建新线程。
260
-
261
- ## 微信/iLink
262
-
263
- 微信支持默认关闭,需要手动开启:
264
-
265
- ```dotenv
266
- WX_ENABLED=true
267
- WX_ALLOWED_ILINK_USER_IDS=
268
- ```
269
-
270
- 构建完成后跑一次二维码登录:
271
-
272
- ```bash
273
- foxclaw weixin-login
274
- ```
275
-
276
- 微信运行时文件在 `~/.foxclaw/weixin`。
277
-
278
- ## Codex Skill
279
-
280
- 仓库自带一个 Codex skill:[`skills/foxclaw`](./skills/foxclaw)。用它可以让 Codex 通过 SSH 在本机或远程 Mac 上 bootstrap FoxClaw——写 `.env`、构建、跑 doctor、装 launchd、引导首次消息验证,一条龙。
281
-
282
- ## 故障排查
283
-
284
- `doctor` 报错、Telegram 没回复、服务日志看不懂、重启行为异常、迁移出问题——都看 [故障排查](./docs/troubleshooting.md)。
285
-
286
- ## 运维命令
287
-
288
- ```bash
289
- foxclaw doctor
290
- foxclaw status
291
- foxclaw start
292
- foxclaw uninstall-systemd
293
- ```
294
-
295
- ## 贡献
296
-
297
- 欢迎到 [GitHub](https://github.com/foxden-app/foxclaw) 提 issue 和 PR。
1
+ 中文 | [English](./README_EN.md)
2
+
3
+ # 🦊 FoxClaw · 狸爪
4
+
5
+ **狸爪:一个更适配编程需求的移动端 Codex 控制器。**
6
+
7
+ FoxClaw(狸爪)的目标很直接:让你用手机控制本机的 Codex,把移动端变成一个真正能用的 web coding 入口。Telegram 或微信负责交互,`codex app-server` 负责本地执行;你发任务、看进度、批审批、切线程,Codex 在电脑上继续写代码。
8
+
9
+ 这适合你离开办公桌去吃饭、在旅途中、在跑步机上,或者陪小孩逛公园的时候继续工作。人可以离开电脑,Codex 不必停;它会把关键进展、错误、审批请求和最终结果同步回手机。
10
+
11
+ 不需要公网服务器。FoxClaw 跑在你自己的电脑上,代码、shell、认证、审批和运行数据都留在本机,只把你允许的操作入口暴露给受信任的聊天账号。
12
+
13
+ ## 为什么是 FoxClaw
14
+
15
+ **为什么选 Codex 作为底层引擎?**
16
+
17
+ 1. **开源且接口完整**Codex OpenAI 开源的 CLI agent,并提供 `codex app-server`。FoxClaw 不是模拟终端输入,而是通过更完整的接口读取线程、切换模型、处理审批和恢复会话。
18
+ 2. **当前编码体验强** — FoxClaw 直接读取你本机 Codex 可用的模型列表;如果你的 Codex 环境已经有 GPT-5.5,就可以在手机端选择和使用它。对高强度编程工作流来说,Codex/GPT-5.5 的体感已经是很多人优先选择它的原因。
19
+ 3. **多账号额度切换** — 免费额度、一个月 Plus/Team 试用、多账号小额度都可以纳入本地 `auth.json_*` 候选。5 小时限制一到,FoxClaw 自动切换下一个可用账号、重启 app-server 并重试刚才的请求。
20
+
21
+ **适合这些场景:**
22
+
23
+ - 🍜 离开办公桌去吃饭,Codex 继续编码,有审批需求时手机上点一下
24
+ - 🚶 通勤路上、旅途中,不用打开电脑也能下发任务、查看进展、继续调试
25
+ - 🏃 在跑步机上、陪小孩逛公园,持续监控 Codex 的编码进程
26
+ - 🔒 代码、shell、认证、审批、运行数据全部留在本机,不暴露到公网
27
+ - 👤 只允许一个受信任的 Telegram 用户远程操作
28
+
29
+ ## 从这里开始
30
+
31
+ - 手头有 CodexOpenClaw、QwenPaw、Hermes、OpenCode、Kimi CLI 之类能跑 shell 的 agent?推荐走 [Agent 辅助安装](./docs/zh/agent-assisted-install.md)。
32
+ - Node、Telegram 机器人、Codex CLI 不太熟?看 [新手安装指南](./docs/zh/install-for-beginners.md)。
33
+ - Git、Node、`.env` 都玩得转?直接往下看快速设置。
34
+ - 卡住了?看 [故障排查](./docs/zh/troubleshooting.md)。
35
+
36
+ 最低要求:一个 Telegram bot token、你的 Telegram 数字用户 ID、Node.js 24、一份已登录的 `codex` CLI。首次安装大约 10–20 分钟。
37
+
38
+ **30 秒体验**:启动 FoxClaw 后,给你的 Telegram 机器人发一句 `List files in DEFAULT_CWD`。Codex 会在本地检查那个目录,然后把结果发回 Telegram。
39
+
40
+ ## 环境要求
41
+
42
+ - macOS 或 Linux,`codex` CLI 可用
43
+ - Codex 已完成登录认证
44
+ - Node.js 24+
45
+ - 一个 `@BotFather` 创建的 Telegram bot token
46
+ - 你的 Telegram 数字用户 ID
47
+
48
+ ## 快速设置
49
+
50
+ ```bash
51
+ npm install -g @foxden-app/foxclaw
52
+ foxclaw init
53
+ $EDITOR ~/.foxclaw/.env
54
+ foxclaw doctor
55
+ foxclaw start
56
+ ```
57
+
58
+ pnpm 用户:
59
+
60
+ ```bash
61
+ pnpm add -g @foxden-app/foxclaw
62
+ foxclaw init
63
+ $EDITOR ~/.foxclaw/.env
64
+ foxclaw doctor
65
+ foxclaw start
66
+ ```
67
+
68
+ 跑 `doctor` 或 `start` 之前先把 `.env` 填好。私聊模式最小配置:
69
+
70
+ ```dotenv
71
+ TG_BOT_TOKEN=123456:telegram-token
72
+ TG_ALLOWED_USER_ID=123456789
73
+ DEFAULT_CWD=/absolute/path/to/workspace
74
+ DEFAULT_APPROVAL_POLICY=on-request
75
+ DEFAULT_SANDBOX_MODE=workspace-write
76
+ ```
77
+
78
+ 配置文件默认在 `~/.foxclaw/.env`。想放别处的话设 `FOXCLAW_ENV=/path/to/.env`。
79
+
80
+ `foxclaw start` 会自动检查环境并安装/重启后台服务,幂等操作,升级后再跑一次就行。
81
+
82
+ FoxClaw 只响应 `TG_ALLOWED_USER_ID` 的消息——把机器人拉进群不代表群里所有人都能用。
83
+
84
+ <details>
85
+ <summary>FoxClaw 能做什么</summary>
86
+
87
+ **核心能力:**
88
+ - 通过 Telegram 私聊、群组、话题控制本地 Codex
89
+ - 可选微信/iLink 通道,复用同一套桥接核心
90
+ - 手机上完整管理 Codex 线程生命周期:创建、重命名、归档、fork、回滚、compact、review、diff
91
+ - 命令、文件变更、细粒度权限审批的内联按钮——手机上一键审批
92
+ - MCP elicitation 卡片——工具在 turn 中提出结构化问题时展示
93
+
94
+ **多账号管理:**
95
+ - Codex 账户管理:`/account`、`/quota`、`/login_device`、`/auth add <name>`
96
+ - 触发用量限制时自动在本地 `auth.json_*` 之间切换认证——5 小时限制到了自动换号
97
+ - `/auth` 面板查看、启用、禁用、切换候选账号
98
+
99
+ **线程与会话:**
100
+ - `/threads`、`/open`、`/new`、`/where`、`/interrupt`——稳定的聊天-线程绑定
101
+ - 每个聊天独立的设置面板:模型、reasoning effort、Fast tier、access preset、Agent/Plan 模式
102
+ - Skills、MCP、hooks、plugins、apps、feature flags、config、requirements、provider diagnostics
103
+
104
+ **可靠性:**
105
+ - SQLite 持久化:绑定、offset、审批、待处理提示、审计日志
106
+ - 单实例进程锁,防止同一 bot token 重复 polling
107
+
108
+ </details>
109
+
110
+ ## 多账号切换
111
+
112
+ FoxClaw 的一大特色是自动多账号切换。当一个账号的 5 小时用量限制触发时,FoxClaw 会自动切换到下一个可用账号继续工作。
113
+
114
+ 设置方式:
115
+
116
+ 1. Codex 的 auth 目录(通常是 `~/.codex/`)中放置多个认证文件,命名为 `auth.json_personal`、`auth.json_team` 等。
117
+ 2. 用 `/auth add <name>` 通过 Telegram 直接添加新账号。
118
+ 3. 用 `/auth` 查看所有候选账号状态。
119
+ 4. `/auth enable <n>` / `/auth disable <n>` 控制哪些账号参与自动轮换。
120
+
121
+ Codex 报告用量限制错误时,FoxClaw 会自动:
122
+ - 切换到下一个未失败的候选账号
123
+ - 重启 app-server 加载新认证
124
+ - 用新账号重试刚才失败的请求
125
+
126
+ ## 服务与调试
127
+
128
+ 推荐方式:
129
+
130
+ ```bash
131
+ foxclaw start
132
+ ```
133
+
134
+ Linux 上会安装/重启用户级 systemd 服务,macOS 上安装/重载 launchd。查看状态:
135
+
136
+ ```bash
137
+ systemctl --user status foxclaw.service
138
+ journalctl --user -u foxclaw.service -f
139
+ ```
140
+
141
+ 需要前台调试时:
142
+
143
+ ```bash
144
+ foxclaw serve
145
+ ```
146
+
147
+ 运行时文件默认在 `~/.foxclaw`:
148
+
149
+ | 用途 | 路径 |
150
+ |------|------|
151
+ | 数据库 | `~/.foxclaw/data/bridge.sqlite` |
152
+ | Bridge 日志 | `~/.foxclaw/logs/service.log` |
153
+ | 状态 | `~/.foxclaw/runtime/status.json` |
154
+ | App-server 状态 | `~/.foxclaw/runtime/codex-app-server.json` |
155
+ | App-server 日志 | `~/.foxclaw/logs/codex-app-server.log` |
156
+
157
+ 可通过 `STORE_PATH`、`LOCK_PATH`、`CODEX_APP_SERVER_STATE_PATH`、`CODEX_APP_SERVER_LOG_PATH` 覆盖。
158
+
159
+ ## telegram-codex-app-bridge 迁移
160
+
161
+ FoxClaw 最初 fork 自 `Gan-Xing/telegram-codex-app-bridge`,继续以 MIT License 分发。
162
+
163
+ 升级已有安装:
164
+
165
+ ```bash
166
+ systemctl --user disable --now telegram-codex-app-bridge.service 2>/dev/null || true
167
+ test -e ~/.foxclaw || cp -a ~/.telegram-codex-app-bridge ~/.foxclaw
168
+ foxclaw start
169
+ ```
170
+
171
+ macOS launchd 用户先卸载旧 plist:
172
+
173
+ ```bash
174
+ launchctl unload ~/Library/LaunchAgents/com.ganxing.telegram-codex-app-bridge.plist 2>/dev/null || true
175
+ foxclaw start
176
+ ```
177
+
178
+ 旧目录不会被自动读取。如果要保留已有的绑定、线程缓存、审批和状态数据,手动复制一次即可。
179
+
180
+ ## Telegram 设置
181
+
182
+ 1. 用 `@BotFather` 创建机器人,token 填入 `TG_BOT_TOKEN`。
183
+ 2. 拿到你的 Telegram 数字用户 ID,填入 `TG_ALLOWED_USER_ID`。
184
+ 3. `foxclaw start` 启动。
185
+ 4. 打开和机器人的私聊,发 `/help`。
186
+
187
+ 可选——群组/话题配置:
188
+
189
+ ```dotenv
190
+ TG_ALLOWED_CHAT_ID=-1001234567890
191
+ TG_ALLOWED_TOPIC_ID=42
192
+ ```
193
+
194
+ - `TG_ALLOWED_CHAT_ID` 留空 纯私聊模式。
195
+ - 只填 `TG_ALLOWED_CHAT_ID` → 允许一个群组作为默认会话范围。
196
+ - 两个都填 → 绑定到某个话题。
197
+ - 配了群组后,`TG_ALLOWED_USER_ID` 的私聊依然可用。
198
+
199
+ **怎么找群组和话题 ID:**
200
+
201
+ 1. 先停掉 FoxClaw。
202
+ 2. 在目标群组/话题里发一条消息。
203
+ 3. 浏览器打开 `https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates`。
204
+ 4. 找 `message.chat.id` → 填 `TG_ALLOWED_CHAT_ID`。
205
+ 5. `message.message_thread_id` `TG_ALLOWED_TOPIC_ID`。
206
+
207
+ > 如果 FoxClaw 还在跑,它可能会先把这条 update 消费掉,所以要先停。
208
+
209
+ ## Telegram 群组检查清单
210
+
211
+ 要让机器人在群组/超级群里收到普通消息:
212
+
213
+ 1. 把机器人加进目标群组。
214
+ 2. 在 `@BotFather` 里关掉 `privacy mode`。
215
+ 3. 把机器人设为群管理员。
216
+ 4. 如果是加群之后才改的隐私模式,把机器人踢出去再重新加。
217
+
218
+ > 注意:即使 privacy mode 挡住了普通消息,`/status@botname` 这种显式命令可能还是能用的。所以验证群组设置时,请用一条普通文本消息测试。
219
+
220
+ ## Codex App-Server 生命周期
221
+
222
+ 默认配置:
223
+
224
+ ```dotenv
225
+ CODEX_APP_AUTOLAUNCH=true
226
+ CODEX_APP_LAUNCH_CMD=codex app
227
+ CODEX_APP_SERVER_STATE_PATH=
228
+ CODEX_APP_SERVER_LOG_PATH=
229
+ CODEX_APP_SYNC_ON_OPEN=true
230
+ CODEX_APP_SYNC_ON_TURN_COMPLETE=false
231
+ ```
232
+
233
+ FoxClaw 会把 `codex app-server` 作为 detached 子进程启动,记录其 pid 和端口。重启时如果进程还活着就直接重连,否则拉起新进程。`/auth_reload` 和认证切换会重启 app-server 以重新加载 `auth.json`。
234
+
235
+ 一般不需要手动固定 app-server 端口。
236
+
237
+ ## 命令
238
+
239
+ - `/help`
240
+ - `/setup` — 统一设置面板
241
+ - `/fast <on|off|toggle>`
242
+ - `/active <steer|queue>`
243
+ - `/status`、`/account`、`/quota`
244
+ - `/quota_nudge <credits|usage_limit> confirm`
245
+ - `/login_device`、`/login_cancel [id]`、`/logout confirm`
246
+ - `/auth [list|use <n>|enable <n>|disable <n>|reload|add <name>]`
247
+ - `/threads [query]`、`/threads archived`、`/open <n>`
248
+ - `/goal [objective|pause|resume|done|budget <tokens|off>|clear confirm]`
249
+ - `/history [limit]`、`/files <query>`、`/remote`
250
+ - `/new [cwd]`
251
+ - `/steer <message>`、`/takeover <message>`、`/queue <message>`
252
+ - `/review [base <branch>|commit <sha>|custom <instructions>]`
253
+ - `/diff`、`/fork [name]`、`/undo [n]`、`/rollback [n]`
254
+ - `/rename <name>`、`/compact`、`/archive`、`/unarchive <n>`
255
+ - `/skills [query]`、`/skill <name>`、`/skill_enable <name>`、`/skill_disable <name>`
256
+ - `/loaded`、`/hooks`、`/plugins [query]`、`/apps [reload]`、`/features`、`/config`、`/requirements`、`/provider`
257
+ - `/mcp`、`/mcp_reload`、`/mcp_login <server>`、`/mcp_resource <server> <uri>`
258
+ - `/models`、`/model`、`/effort`、`/permissions`、`/access`、`/mode`、`/plan`、`/agent`
259
+ - `/reveal`、`/where`、`/interrupt`
260
+
261
+ 直接发文本会送到当前线程;没有绑定线程时自动创建新线程。
262
+
263
+ ## 微信/iLink
264
+
265
+ 微信支持默认关闭,需要手动开启:
266
+
267
+ ```dotenv
268
+ WX_ENABLED=true
269
+ WX_ALLOWED_ILINK_USER_IDS=
270
+ ```
271
+
272
+ 构建完成后跑一次二维码登录:
273
+
274
+ ```bash
275
+ foxclaw weixin-login
276
+ ```
277
+
278
+ 微信运行时文件在 `~/.foxclaw/weixin`。
279
+
280
+ ## Codex Skill
281
+
282
+ 仓库自带一个 Codex skill。用法看 [FoxClaw Skill 中文说明](./docs/zh/foxclaw-skill.md)。它可以让 Codex 通过 SSH 在本机或远程 Mac 上 bootstrap FoxClaw——写 `.env`、构建、跑 doctor、装 launchd、引导首次消息验证,一条龙。
283
+
284
+ ## 故障排查
285
+
286
+ `doctor` 报错、Telegram 没回复、服务日志看不懂、重启行为异常、迁移出问题——都看 [故障排查](./docs/zh/troubleshooting.md)。
287
+
288
+ ## 运维命令
289
+
290
+ ```bash
291
+ foxclaw doctor
292
+ foxclaw status
293
+ foxclaw start
294
+ foxclaw uninstall-systemd
295
+ ```
296
+
297
+ ## 贡献
298
+
299
+ 欢迎到 [GitHub](https://github.com/foxden-app/foxclaw) 提 issue 和 PR。