diff --git a/architect/architect-run.sh b/architect/architect-run.sh index 6052d0b..18de885 100755 --- a/architect/architect-run.sh +++ b/architect/architect-run.sh @@ -49,7 +49,7 @@ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; } # ── Guards ──────────────────────────────────────────────────────────────── check_active architect acquire_cron_lock "/tmp/architect-run.lock" -check_memory 2000 +memory_guard 2000 log "--- Architect run start ---" diff --git a/gardener/gardener-run.sh b/gardener/gardener-run.sh index abaf0a0..00ea611 100755 --- a/gardener/gardener-run.sh +++ b/gardener/gardener-run.sh @@ -60,7 +60,7 @@ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; } # ── Guards ──────────────────────────────────────────────────────────────── check_active gardener acquire_cron_lock "/tmp/gardener-run.lock" -check_memory 2000 +memory_guard 2000 log "--- Gardener run start ---" diff --git a/lib/formula-session.sh b/lib/formula-session.sh index 264c8e1..d1830be 100644 --- a/lib/formula-session.sh +++ b/lib/formula-session.sh @@ -6,7 +6,6 @@ # # Functions: # acquire_cron_lock LOCK_FILE — PID lock with stale cleanup -# check_memory [MIN_MB] — skip if available RAM too low # load_formula FORMULA_FILE — sets FORMULA_CONTENT # build_context_block FILE [FILE ...] — sets CONTEXT_BLOCK # build_prompt_footer [EXTRA_API_LINES] — sets PROMPT_FOOTER (API ref + env) @@ -51,23 +50,6 @@ acquire_cron_lock() { trap 'rm -f "$_CRON_LOCK_FILE"' EXIT } -# check_memory [MIN_MB] -# Exits 0 (skip) if available memory is below MIN_MB (default 2000). -check_memory() { - local min_mb="${1:-2000}" - # Graceful fallback if free command is not available (procps not installed) - if ! command -v free &>/dev/null; then - log "run: free not found, skipping memory check" - return 0 - fi - local avail_mb - avail_mb=$(free -m | awk '/Mem:/{print $7}') - if [ "${avail_mb:-0}" -lt "$min_mb" ]; then - log "run: skipping — only ${avail_mb}MB available (need ${min_mb})" - exit 0 - fi -} - # ── Agent identity resolution ──────────────────────────────────────────── # resolve_agent_identity @@ -168,7 +150,7 @@ ensure_profile_repo() { # Checks if the agent has a .profile repo by querying Forgejo API. # Returns 0 if repo exists, 1 otherwise. _profile_has_repo() { - local agent_identity="${1:-${AGENT_IDENTITY:-}}" + local agent_identity="${AGENT_IDENTITY:-}" if [ -z "$agent_identity" ]; then if ! resolve_agent_identity; then @@ -204,8 +186,8 @@ _count_undigested_journals() { # Runs a claude -p one-shot to digest undigested journals into lessons-learned.md # Returns 0 on success, 1 on failure. _profile_digest_journals() { - local agent_identity="${1:-${AGENT_IDENTITY:-}}" - local model="${2:-${CLAUDE_MODEL:-opus}}" + local agent_identity="${AGENT_IDENTITY:-}" + local model="${CLAUDE_MODEL:-opus}" if [ -z "$agent_identity" ]; then if ! resolve_agent_identity; then diff --git a/planner/planner-run.sh b/planner/planner-run.sh index 4cc3800..47e057f 100755 --- a/planner/planner-run.sh +++ b/planner/planner-run.sh @@ -48,7 +48,7 @@ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; } # ── Guards ──────────────────────────────────────────────────────────────── check_active planner acquire_cron_lock "/tmp/planner-run.lock" -check_memory 2000 +memory_guard 2000 log "--- Planner run start ---" diff --git a/predictor/predictor-run.sh b/predictor/predictor-run.sh index 0fdc8fa..b76ae64 100755 --- a/predictor/predictor-run.sh +++ b/predictor/predictor-run.sh @@ -49,7 +49,7 @@ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; } # ── Guards ──────────────────────────────────────────────────────────────── check_active predictor acquire_cron_lock "/tmp/predictor-run.lock" -check_memory 2000 +memory_guard 2000 log "--- Predictor run start ---" diff --git a/supervisor/supervisor-run.sh b/supervisor/supervisor-run.sh index 57a3f95..907c228 100755 --- a/supervisor/supervisor-run.sh +++ b/supervisor/supervisor-run.sh @@ -51,7 +51,7 @@ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; } # ── Guards ──────────────────────────────────────────────────────────────── check_active supervisor acquire_cron_lock "/tmp/supervisor-run.lock" -check_memory 2000 +memory_guard 2000 log "--- Supervisor run start ---"