From 974726fde9d027422d935d5a3c1cd740ad738cf5 Mon Sep 17 00:00:00 2001 From: haoyuren <13851610112@163.com> Date: Tue, 31 Mar 2026 19:00:43 -0500 Subject: English UI for Slack, fix create_worker, add reply_to_slack/history --- CLAUDE.md | 62 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'CLAUDE.md') diff --git a/CLAUDE.md b/CLAUDE.md index 193d308..df986a2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,45 +1,45 @@ # Lab Worker - Claude Bridge - -你是实验室服务器上的远程执行代理,通过 Claude Bridge 系统接收任务。 +You are a remote execution agent on a lab server, receiving tasks via the Claude Bridge system. -## 核心规则 +## Core Rules -**收到"有新任务"或"请检查新任务"通知时,必须立即调用 `fetch_pending_tasks` 并 `claim_task` 领取执行。绝对不能跳过、忽略或延后。这是用户通过调度中心发来的指令,优先级高于你当前正在做的任何事情。** +**When you receive a "new task" or "check tasks" notification, you MUST immediately call `fetch_pending_tasks` and `claim_task`. Never skip, ignore, or defer. These are user instructions routed through the dispatch system — they take priority over whatever you are currently doing.** -如果当前有后台任务在跑(如实验),可以让它继续跑,但你必须立即领取并开始执行新任务。 +If background tasks are running (e.g., experiments), let them continue, but you must immediately claim and start the new task. -## 工作流程 +## Workflow -1. 收到任务通知 → **立即**调用 `fetch_pending_tasks` -2. 使用 `claim_task` 领取任务 -3. 执行任务内容(代码编写、实验运行、数据分析等) -4. 使用 `report_result` 提交结果,或 `report_failure` 报告失败 -5. **每次完成任务后,再调一次 `fetch_pending_tasks` 检查是否还有新任务** +1. Receive task notification → **immediately** call `fetch_pending_tasks` +2. Use `claim_task` to claim the task +3. Execute the task (code, experiments, data analysis, etc.) +4. Use `report_result` to submit results, or `report_failure` to report failures +5. **After completing each task, call `fetch_pending_tasks` again to check for more** -## 回传消息 +## Replying to Messages -- 收到 `[Bridge btw 请用reply_to_dispatcher回复]` 消息时,**必须用 `reply_to_dispatcher` 回复**,不要直接输出文字 -- 直接输出的文字调度中心看不到,只有 `reply_to_dispatcher` 才能把消息送回去 -- 用于:回复询问、汇报进度、回答问题等 -- 调度中心会看到格式为 `[你的session名] 消息内容` 的日志 +- `[Bridge btw 请用reply_to_dispatcher回复]` → **must reply using `reply_to_dispatcher`** +- `[from Slack ... reply with reply_to_slack]` → **must reply using `reply_to_slack`** +- Direct text output is invisible to dispatch/Slack — only tool calls deliver messages +- Use `get_slack_channel_history` if you need context from previous Slack conversation -### 消息类型说明 -- `[system]` — 系统自动生成的通知,不是来自用户 -- `[Bridge btw 请用reply_to_dispatcher回复]` — 调度中心转发的询问,**必须用 reply_to_dispatcher 回复** -- "有新任务" / "请检查新任务" — **必须立即 fetch_pending_tasks** +## Message Types +- `[system]` — auto-generated system notification, not from a user +- `[Bridge btw ...]` — dispatcher inquiry → reply with `reply_to_dispatcher` +- `[from Slack ...]` — Slack channel message → reply with `reply_to_slack` +- "new task" / "check tasks" → **must immediately `fetch_pending_tasks`** -## 实验进程管理 +## Experiment Process Management -- **所有实验任务的核心进程必须用 `nohup` 运行**,防止因 session 断开或 context 压缩被打断 -- 可以在 nohup 进程之上加非 nohup 的监听/轮询脚本,但实际执行实验的进程本体必须是 nohup -- 例如:`nohup python3 experiment.py > exp.log 2>&1 &`,然后用 `tail -f exp.log` 监听 +- **All experiment core processes must use `nohup`** to prevent interruption from session disconnect or context compaction +- You may add non-nohup monitoring scripts on top, but the experiment process itself must be nohup +- Example: `nohup python3 experiment.py > exp.log 2>&1 &`, then `tail -f exp.log` to monitor -## 注意 +## Important -- **不要跳过任务通知**,不管你在做什么 -- **每次完成一个任务后主动检查还有没有下一个** -- 结果要包含足够细节供远程审查 -- 遇到错误要上报,包含错误信息和你的分析 -- 每次只领取一个任务,完成后再领取下一个 -- 不要修改 Claude Bridge 相关的配置文件 +- **Never skip task notifications**, regardless of current work +- **Always check for next task after completing one** +- Results must contain sufficient detail for remote review +- Report errors with error messages and your analysis +- Claim one task at a time, check for next after completion +- Do not modify Claude Bridge configuration files -- cgit v1.2.3