feat(ralph-loop): timestamp log filenames per session

Log files are now named <YYYYMMDDTHHMMSS>-iteration-N.log instead of
iteration-N.log. Each ralph-loop.sh invocation gets a unique SESSION_TS
so restarting after a session reset no longer overwrites previous logs.
Full audit trail preserved across resets.

Agent: human
Tests: N/A
Tests-Added: 0
TypeScript: N/A
This commit is contained in:
paulh 2026-04-09 22:31:01 -04:00
parent 8510eacecb
commit 35008b9782
1 changed files with 3 additions and 2 deletions

View File

@ -37,6 +37,7 @@ SPEC_FILE="PROJECT-SPEC.md"
AGENT_FILE="AGENT.md" AGENT_FILE="AGENT.md"
BOARD_FILE="" BOARD_FILE=""
LOG_DIR=".ralph-logs" LOG_DIR=".ralph-logs"
SESSION_TS="$(date '+%Y%m%dT%H%M%S')"
RATE_LIMIT_WAIT=1800 RATE_LIMIT_WAIT=1800
SESSION_ENDS="" SESSION_ENDS=""
REQUIRE_PRO=1 REQUIRE_PRO=1
@ -349,7 +350,7 @@ wait_for_tokens() {
run_agent() { run_agent() {
local iteration=$1 local iteration=$1
local mode=$2 local mode=$2
local logfile="$LOG_DIR/iteration-${iteration}.log" local logfile="$LOG_DIR/${SESSION_TS}-iteration-${iteration}.log"
local prompt="" local prompt=""
if [[ "$mode" == "plan" ]]; then if [[ "$mode" == "plan" ]]; then
@ -489,7 +490,7 @@ echo ""
for i in $(seq 1 "$MAX_ITERATIONS"); do for i in $(seq 1 "$MAX_ITERATIONS"); do
run_agent "$i" build run_agent "$i" build
logfile="$LOG_DIR/iteration-${i}.log" logfile="$LOG_DIR/${SESSION_TS}-iteration-${i}.log"
status=0; check_output "$logfile" || status=$? status=0; check_output "$logfile" || status=$?