-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-loop.sh
More file actions
executable file
·40 lines (34 loc) · 1.39 KB
/
start-loop.sh
File metadata and controls
executable file
·40 lines (34 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# 启动自动循环
# 每次迭代完成后,Stop hook 会在新 Terminal 窗口中启动下一轮
# Auto-detect GENESIS_DIR from script location
GENESIS_DIR="$(cd "$(dirname "$0")" && pwd)"
LOOP_FLAG_FILE="$GENESIS_DIR/hooks/loop_claude_code.txt"
RUNLOG_DIR="$GENESIS_DIR/claude_iteration/runlog"
# 获取最近的 runlog 文件名(最多 3 个)
get_recent_runlogs() {
if [ -d "$RUNLOG_DIR" ]; then
local files=$(ls -1 "$RUNLOG_DIR"/*.md 2>/dev/null | sort -r | head -3 | xargs -I {} basename {} 2>/dev/null)
if [ -n "$files" ]; then
echo "$files" | paste -sd ',' - | sed 's/,/, /g'
else
echo "(no runlogs yet)"
fi
else
echo "(runlog dir not found)"
fi
}
# 设置循环标志为 true
echo "true" > "$LOOP_FLAG_FILE"
# 获取最近的 runlog 列表
RECENT_RUNLOGS=$(get_recent_runlogs)
echo "================================================"
echo "自动循环已启用"
echo "每次迭代完成后会自动在新 Terminal 窗口中启动下一轮"
echo "停止循环: ./stop-loop.sh"
echo "Recent runlogs: $RECENT_RUNLOGS"
echo "================================================"
echo ""
# 启动第一轮
cd "$GENESIS_DIR"
claude --dangerously-skip-permissions "Execute one iteration per the contract in CLAUDE.md. Check GitHub Issues first, then claude_iteration/state.md for next step. Recent runlogs: $RECENT_RUNLOGS"