diff --git a/architect/architect-run.sh b/architect/architect-run.sh index 26b3da0..0edeb70 100755 --- a/architect/architect-run.sh +++ b/architect/architect-run.sh @@ -48,6 +48,13 @@ WORKTREE="/tmp/${PROJECT_NAME}-architect-run" # shellcheck disable=SC2034 # consumed by agent-sdk.sh and env.sh log() LOG_AGENT="architect" +# Override log() to append to architect-specific log file +# shellcheck disable=SC2034 +log() { + local agent="${LOG_AGENT:-architect}" + printf '[%s] %s: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$agent" "$*" >> "$LOG_FILE" +} + # ── Guards ──────────────────────────────────────────────────────────────── check_active architect acquire_cron_lock "/tmp/architect-run.lock" diff --git a/planner/planner-run.sh b/planner/planner-run.sh index f93f839..3c71d44 100755 --- a/planner/planner-run.sh +++ b/planner/planner-run.sh @@ -47,6 +47,13 @@ WORKTREE="/tmp/${PROJECT_NAME}-planner-run" # shellcheck disable=SC2034 # consumed by agent-sdk.sh and env.sh log() LOG_AGENT="planner" +# Override log() to append to planner-specific log file +# shellcheck disable=SC2034 +log() { + local agent="${LOG_AGENT:-planner}" + printf '[%s] %s: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$agent" "$*" >> "$LOG_FILE" +} + # ── Guards ──────────────────────────────────────────────────────────────── check_active planner acquire_cron_lock "/tmp/planner-run.lock" diff --git a/predictor/predictor-run.sh b/predictor/predictor-run.sh index 36e69ad..889fe1c 100755 --- a/predictor/predictor-run.sh +++ b/predictor/predictor-run.sh @@ -48,6 +48,13 @@ WORKTREE="/tmp/${PROJECT_NAME}-predictor-run" # shellcheck disable=SC2034 # consumed by agent-sdk.sh and env.sh log() LOG_AGENT="predictor" +# Override log() to append to predictor-specific log file +# shellcheck disable=SC2034 +log() { + local agent="${LOG_AGENT:-predictor}" + printf '[%s] %s: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$agent" "$*" >> "$LOG_FILE" +} + # ── Guards ──────────────────────────────────────────────────────────────── check_active predictor acquire_cron_lock "/tmp/predictor-run.lock" diff --git a/review/review-poll.sh b/review/review-poll.sh index 34ca9d7..72a6e85 100755 --- a/review/review-poll.sh +++ b/review/review-poll.sh @@ -30,7 +30,8 @@ LOG_AGENT="review" # Override log() to append to review-specific log file # shellcheck disable=SC2034 log() { - command log "$@" >> "$LOGFILE" + local agent="${LOG_AGENT:-review}" + printf '[%s] %s: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$agent" "$*" >> "$LOGFILE" } # Log rotation diff --git a/supervisor/supervisor-run.sh b/supervisor/supervisor-run.sh index b304b99..0411177 100755 --- a/supervisor/supervisor-run.sh +++ b/supervisor/supervisor-run.sh @@ -50,6 +50,13 @@ WORKTREE="/tmp/${PROJECT_NAME}-supervisor-run" # shellcheck disable=SC2034 # consumed by agent-sdk.sh and env.sh log() LOG_AGENT="supervisor" +# Override log() to append to supervisor-specific log file +# shellcheck disable=SC2034 +log() { + local agent="${LOG_AGENT:-supervisor}" + printf '[%s] %s: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$agent" "$*" >> "$LOG_FILE" +} + # ── Guards ──────────────────────────────────────────────────────────────── check_active supervisor acquire_cron_lock "/tmp/supervisor-run.lock"