| name | loop-budget |
| description | Check this repo's resource budgets before and after every loop run: bench-terminal caps, one-bench/one-MCP rules, cargo serial-build limits, and the /loop engine's seeded budgets. Enforces early exit when nothing is actionable and appends a run entry to loop-run-log.md.
|
| user_invocable | true |
Loop Budget Guard — TerranSoulApp
Adapted from skills/loop-budget (cobusgreyling/loop-engineering, MIT).
This repo's scarce resources are local hardware (one GPU, one bench at a
time, D:-drive I/O) rather than API tokens — budget in concurrency and
wall-clock first.
Start of run
- Read
loop-budget.md for caps and loop-constraints.md for binding
rules.
- Enforce the hard caps BEFORE spawning anything:
- ≤ 5 concurrent BENCH terminals/workflows (
BENCH_TERMINAL_MAX=5,
enforced by the bench-terminal-guard PreToolUse hook — do not race it).
- ONE bench at a time; the isolated bench brain
:7424 exists only
during a bench.
- ONE MCP brain otherwise (reuse
:7421/:7423/:7422 in order).
- Cargo:
-j 1, CARGO_BUILD_JOBS=1, target dir on C:; serialize
cargo-heavy phases across worktrees.
- Kill stale watchers before launching a new one (mandatory pre-launch
inventory); never spawn poll/sleep watcher loops — rely on completion
notifications.
- Long commands run FOREGROUND with explicit timeouts; agents must never
background a long build and exit (the build dies with the session).
- If the state/queue has no actionable items → exit immediately with a
one-line note in
STATE.md (no sub-agent spawns, no builds).
- Before embed-heavy runs:
/api/ps must show the embed model fully
GPU-placed (size_vram == size).
In-app /loop engine budgets (brain-seeded, not hardcoded)
Every /loop carries its own budget from system.default_system_setting
rows tagged loop (fallbacks: 50 iterations, 7-day wall-clock, 1-day
consent TTL, backoff floor/ceiling). Do not hand a loop a bigger budget
than its pattern needs; pending_consent is the request, accept is the
grant.
End of run
Append one JSON object to loop-run-log.md (repo loops) — pattern,
duration_s, items_found, actions_taken, escalations, outcome; the in-app
engine journals every fire in the append-only loop_runs table
automatically.
On exceed / kill
Stop spawning → kill stale terminals/watchers → append the event to
loop-run-log.md → record the blocker in STATE.md High Priority.
Kill switch per loop-budget.md (brain_loop op=cancel, bench teardown).