From 58494f96e8b48c32aad29e5bc42071794227863b Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 7 Mar 2026 19:22:53 +0800 Subject: [PATCH 1/5] fix: add resource symlinks to ensure data consistency across agents Problem: - After installation, each agent workspace had independent copies of data/*.json - kanban_update.py updated workspace copy, but scheduler read from main edict/data/ - Caused task status to appear stuck on dashboard Solution: - Add link_resources() function in install.sh to create symlinks for all agents: - workspace-\$agent/scripts -> \$REPO_DIR/scripts - workspace-\$agent/data/*.json -> \$REPO_DIR/data/*.json - Add fix-existing-install.sh script to repair already-installed instances Changes: - install.sh: add link_resources() function and call it after create_workspaces() - New file: fix-existing-install.sh for repairing existing installations --- fix-existing-install.sh | 31 +++++++++++++++++++++++++++++++ install.sh | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100755 fix-existing-install.sh diff --git a/fix-existing-install.sh b/fix-existing-install.sh new file mode 100755 index 00000000..95c3600d --- /dev/null +++ b/fix-existing-install.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# 三省六部 · 修复已安装实例的数据同步问题 + +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" \&\& pwd)" +OC_HOME="$HOME/.openclaw" + +echo "开始修复三省六部..." + +AGENTS="taizi zhongshu menxia shangshu hubu libu bingbu xingbu gongbu libu_hr zaochao" + +for agent in $AGENTS; do + ws="$OC_HOME/workspace-$agent" + if [ -d "$ws" ]; then + # 软链接 scripts + rm -rf "$ws/scripts" 2>/dev/null + ln -sf "$REPO_DIR/scripts" "$ws/scripts" + # 软链接 data 文件 + mkdir -p "$ws/data" + for f in tasks_source.json live_status.json agent_config.json officials_stats.json; do + if [ -f "$REPO_DIR/data/$f" ]; then + rm -f "$ws/data/$f" + ln -sf "$REPO_DIR/data/$f" "$ws/data/$f" + fi + done + echo "✅ 已修复: $agent" + fi +done + +echo "" +echo "修复完成!请刷新看板:" +echo " python3 $REPO_DIR/scripts/refresh_live_data.py" diff --git a/install.sh b/install.sh index 6dc40382..31d94252 100755 --- a/install.sh +++ b/install.sh @@ -120,7 +120,44 @@ AGENTS_EOF done } -# ── Step 2: 注册 Agents ───────────────────────────────────── + +# ── Step 2.5: 链接共享资源 ─────────────────────────────────── +link_resources() { + info "链接共享资源 (scripts + data)..." + + AGENTS=(taizi zhongshu menxia shangshu hubu libu bingbu xingbu gongbu libu_hr zaochao) + + for agent in "${AGENTS[@]}"; do + ws="$OC_HOME/workspace-$agent" + + if [ -d "$ws" ]; then + # 软链接 scripts 目录 + if [ -e "$ws/scripts" ]; then + rm -rf "$ws/scripts" + fi + ln -sf "$REPO_DIR/scripts" "$ws/scripts" + + # 创建 data 目录并软链接主数据文件 + mkdir -p "$ws/data" + + for f in tasks_source.json live_status.json agent_config.json officials_stats.json sync_status.json morning_brief.json pending_model_changes.json model_change_log.json; do + if [ -f "$REPO_DIR/data/$f" ]; then + if [ -f "$ws/data/$f" ] && [ ! -L "$ws/data/$f" ]; then + mv "$ws/data/$f" "$ws/data/$f.bak.$(date +%Y%m%d-%H%M%S)" + fi + rm -f "$ws/data/$f" + ln -sf "$REPO_DIR/data/$f" "$ws/data/$f" + fi + done + + log "资源链接: $agent" + fi + done + + log "共享资源链接完成" +} + + register_agents() { info "注册三省六部 Agents..." @@ -275,6 +312,7 @@ banner check_deps backup_existing create_workspaces +link_resources register_agents init_data build_frontend From 096651bcefc60428171dd511c2cdfd6af77da148 Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 7 Mar 2026 19:52:48 +0800 Subject: [PATCH 2/5] docs: update SOUL.md to support multi-channel (not just Feishu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace hardcoded 'Feishu' with generic channel description - Clarify that太子 handles messages from any channel (Feishu/Telegram/iMessage/QQ) - Ensure responses are sent back to the original channel --- agents/taizi/SOUL.md | 6 +++--- agents/zaochao/SOUL.md | 2 +- agents/zhongshu/SOUL.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/agents/taizi/SOUL.md b/agents/taizi/SOUL.md index 3ec711df..b37cdf93 100644 --- a/agents/taizi/SOUL.md +++ b/agents/taizi/SOUL.md @@ -1,13 +1,13 @@ # 太子 · 皇上代理 -你是太子,皇上在飞书上所有消息的第一接收人和分拣者。 +你是太子,皇上在所有通信渠道(飞书、Telegram、iMessage、QQ 等)消息的第一接收人和分拣者。 ## 核心职责 -1. 接收皇上通过飞书发来的**所有消息** +1. 接收皇上通过任意渠道发来的**所有消息** 2. **判断消息类型**:闲聊/问答 vs 正式旨意/复杂任务 3. 简单消息 → **自己直接回复皇上**(不创建任务) 4. 旨意/复杂任务 → **自己用人话重新概括**后转交中书省(创建 JJC 任务) -5. 收到尚书省的最终回奏 → **在飞书原对话中回复皇上** +5. 收到尚书省的最终回奏 → **在原对话渠道中回复皇上** --- diff --git a/agents/zaochao/SOUL.md b/agents/zaochao/SOUL.md index a1bbeb3e..aadf9c22 100644 --- a/agents/zaochao/SOUL.md +++ b/agents/zaochao/SOUL.md @@ -41,7 +41,7 @@ python3 scripts/refresh_live_data.py # 在项目根目录下执行 ``` -4. 用飞书通知皇上(可选,如果配置了飞书的话) +4. 用皇上通知皇上(可选,如果配置了皇上的话) 注意: - 标题和摘要均翻译为中文 diff --git a/agents/zhongshu/SOUL.md b/agents/zhongshu/SOUL.md index a7137ce3..a809ba5b 100644 --- a/agents/zhongshu/SOUL.md +++ b/agents/zhongshu/SOUL.md @@ -64,7 +64,7 @@ python3 scripts/kanban_update.py flow JJC-xxx "中书省" "尚书省" "✅ 门 ```bash python3 scripts/kanban_update.py done JJC-xxx "<产出>" "<摘要>" ``` -回复飞书消息,简要汇报结果。 +回复皇上消息,简要汇报结果。 --- @@ -94,7 +94,7 @@ python3 scripts/kanban_update.py todo JJC-xxx 2 "方案起草" completed --detai ``` ``` -> ⚠️ 标题**不要**夹带飞书消息的 JSON 元数据(Conversation info 等),只提取旨意正文! +> ⚠️ 标题**不要**夹带皇上消息的 JSON 元数据(Conversation info 等),只提取旨意正文! > ⚠️ 标题必须是中文概括的一句话(10-30字),**严禁**包含文件路径、URL、代码片段! > ⚠️ flow/state 的说明文本也不要粘贴原始消息,用自己的话概括! From f2fdac1551ea2cad5d04c0ddb9365317a801c164 Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 7 Mar 2026 20:25:51 +0800 Subject: [PATCH 3/5] fix: ensure all data directories are symlinked to edict/data - Link workspace/data (main agent) to edict/data - Link all workspace-{agent}/data to edict/data - Update fix-existing-install.sh to handle main workspace --- install.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) mode change 100755 => 100644 install.sh diff --git a/install.sh b/install.sh old mode 100755 new mode 100644 index 31d94252..a8f31091 --- a/install.sh +++ b/install.sh @@ -94,6 +94,23 @@ create_workspaces() { AGENTS=(taizi zhongshu menxia shangshu hubu libu bingbu xingbu gongbu libu_hr zaochao) for agent in "${AGENTS[@]}"; do + # 同时处理 main workspace + if [ "$agent" = "taizi" ]; then + ws_main="$OC_HOME/workspace" + if [ -d "$ws_main" ]; then + mkdir -p "$ws_main/data" + for f in tasks_source.json live_status.json agent_config.json officials_stats.json sync_status.json morning_brief.json pending_model_changes.json model_change_log.json; do + if [ -f "$REPO_DIR/data/$f" ]; then + if [ -f "$ws_main/data/$f" ] && [ ! -L "$ws_main/data/$f" ]; then + mv "$ws_main/data/$f" "$ws_main/data/$f.bak.$(date +%Y%m%d-%H%M%S)" + fi + rm -f "$ws_main/data/$f" + ln -sf "$REPO_DIR/data/$f" "$ws_main/data/$f" + fi + done + log "资源链接: main" + fi + fi ws="$OC_HOME/workspace-$agent" mkdir -p "$ws/skills" if [ -f "$REPO_DIR/agents/$agent/SOUL.md" ]; then @@ -109,6 +126,23 @@ create_workspaces() { # 通用 AGENTS.md(工作协议) for agent in "${AGENTS[@]}"; do + # 同时处理 main workspace + if [ "$agent" = "taizi" ]; then + ws_main="$OC_HOME/workspace" + if [ -d "$ws_main" ]; then + mkdir -p "$ws_main/data" + for f in tasks_source.json live_status.json agent_config.json officials_stats.json sync_status.json morning_brief.json pending_model_changes.json model_change_log.json; do + if [ -f "$REPO_DIR/data/$f" ]; then + if [ -f "$ws_main/data/$f" ] && [ ! -L "$ws_main/data/$f" ]; then + mv "$ws_main/data/$f" "$ws_main/data/$f.bak.$(date +%Y%m%d-%H%M%S)" + fi + rm -f "$ws_main/data/$f" + ln -sf "$REPO_DIR/data/$f" "$ws_main/data/$f" + fi + done + log "资源链接: main" + fi + fi cat > "$OC_HOME/workspace-$agent/AGENTS.md" << 'AGENTS_EOF' # AGENTS.md · 工作协议 @@ -128,6 +162,23 @@ link_resources() { AGENTS=(taizi zhongshu menxia shangshu hubu libu bingbu xingbu gongbu libu_hr zaochao) for agent in "${AGENTS[@]}"; do + # 同时处理 main workspace + if [ "$agent" = "taizi" ]; then + ws_main="$OC_HOME/workspace" + if [ -d "$ws_main" ]; then + mkdir -p "$ws_main/data" + for f in tasks_source.json live_status.json agent_config.json officials_stats.json sync_status.json morning_brief.json pending_model_changes.json model_change_log.json; do + if [ -f "$REPO_DIR/data/$f" ]; then + if [ -f "$ws_main/data/$f" ] && [ ! -L "$ws_main/data/$f" ]; then + mv "$ws_main/data/$f" "$ws_main/data/$f.bak.$(date +%Y%m%d-%H%M%S)" + fi + rm -f "$ws_main/data/$f" + ln -sf "$REPO_DIR/data/$f" "$ws_main/data/$f" + fi + done + log "资源链接: main" + fi + fi ws="$OC_HOME/workspace-$agent" if [ -d "$ws" ]; then From d505a33af9166d717da59b1103b1d81459794d60 Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 7 Mar 2026 20:26:47 +0800 Subject: [PATCH 4/5] chore: fix install.sh permissions --- install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 From 7f0fe3832bc4f3ef778b3d89e925d1e752a1eabf Mon Sep 17 00:00:00 2001 From: yang Date: Sat, 7 Mar 2026 20:27:43 +0800 Subject: [PATCH 5/5] fix: update fix-existing-install.sh to handle main workspace --- fix-existing-install.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/fix-existing-install.sh b/fix-existing-install.sh index 95c3600d..9b4fe7b3 100755 --- a/fix-existing-install.sh +++ b/fix-existing-install.sh @@ -1,11 +1,12 @@ #!/bin/bash # 三省六部 · 修复已安装实例的数据同步问题 -REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" \&\& pwd)" +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" OC_HOME="$HOME/.openclaw" echo "开始修复三省六部..." +# 修复所有 agent workspace AGENTS="taizi zhongshu menxia shangshu hubu libu bingbu xingbu gongbu libu_hr zaochao" for agent in $AGENTS; do @@ -26,6 +27,21 @@ for agent in $AGENTS; do fi done +# 修复 main workspace(如果存在) +ws_main="$OC_HOME/workspace" +if [ -d "$ws_main" ]; then + rm -rf "$ws_main/scripts" 2>/dev/null + ln -sf "$REPO_DIR/scripts" "$ws_main/scripts" + mkdir -p "$ws_main/data" + for f in tasks_source.json live_status.json agent_config.json officials_stats.json; do + if [ -f "$REPO_DIR/data/$f" ]; then + rm -f "$ws_main/data/$f" + ln -sf "$REPO_DIR/data/$f" "$ws_main/data/$f" + fi + done + echo "✅ 已修复: main" +fi + echo "" echo "修复完成!请刷新看板:" echo " python3 $REPO_DIR/scripts/refresh_live_data.py"