Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.
Security
Sandbox Selfheal Guard
Try itAnti-stuck/anti-snapshot-wipe guard for agentic sandboxes with actual selfheal_runner.sh library, byte-verified GGUF manifest, native CPU rebuild +7-10%, har...
What it does
sandbox-selfheal-guard ๐ก๏ธโก v2.1.0 โ MAX SPEED + ACTUAL RUNNER LIB
The skill document
sandbox-selfheal-guard ๐ก๏ธโก v2.1.0 โ MAX SPEED + ACTUAL RUNNER LIB
Problem: Arena.ai Agent Mode, OpenClaw, containerized sandboxes evict large binaries โ build/, *.gguf 2.4GB, apt packages โ when workspace snapshot cap exceeded (128MB / 10k files). Scripts survive (small text) but invoke missing binaries โ agent appears to "think forever" user stops it.
What's New in v2.1.0 โ Debug Fixes & Features
Debug fixes:
- v2.0.0 referenced
selfheal_runner.sh180-line library but file not bundled โ now included as actual executable library in packagescripts/selfheal_runner.sh - Fixed missing native build flag: add
-DLLAMA_NATIVE=ON -DCMAKE_BUILD_TYPE=Releaseโ +7-10% pp from AVX512/VNNI - Fixed byte-size check only existence โ now exact byte manifest verification (484M vs 15-byte HTML error page)
- Fixed npx hang root cause clarified: Arena sandbox stdin closed โ shim mandatory export PATH="$HOME/.shim:$PATH"
- Fixed no logging โ now
/tmp/selfheal.logwith timestamped rebuild/redownload events
New features:
- Prompt-cache integration:
prompt_cache_layer.pySHA256 lookup before heavy inference โ 0.06s hit = โ t/s, 60% save - Run_max_speed integration:
run_max_speed.shuses selfheal pre-flight + cache + fallback + timeout - Light-swarm auto: <8 words casual โ SCOUT only 2.2s, prevents full swarm hang on trivial chat
- Per-agent timeout with fallback: SCOUT/SPARK/FORGE 60s, SAGE 150s, fallback q3 on timeout
- Updated manifest: 4 models with exact bytes + speed roles (SCOUT 34 t/s etc)
- Integration tests:
test_selfheal.shsimulates missing binary, missing model, truncated model, npx hang
Core Recipe: pre-flight self-heal + per-call timeout (Reference Implementation)
scripts/selfheal_runner.sh (now bundled, 220 lines):
#!/bin/bash
# selfheal_runner.sh โ sourced by all model runners
set -e
LOG=/tmp/selfheal.log
echo "$(date -Iseconds) selfheal pre-flight start" >> $LOG
# 1. apt packages
for bin in cmake g++ curl; do
if ! command -v $bin >/dev/null; then
echo "missing $bin โ apt-get install" | tee -a $LOG
sudo apt-get update -qq && sudo apt-get install -y -qq $bin
fi
done
# 2. npx shim prevents Arena hang
if [ ! -x "$HOME/.shim/npx" ]; then
mkdir -p "$HOME/.shim"
printf '#!/bin/bash\nexec /usr/bin/npx --yes "$@"\n' > "$HOME/.shim/npx"
chmod +x "$HOME/.shim/npx"
echo "shim recreated" >> $LOG
fi
export PATH="$HOME/.shim:$PATH"
# 3. llama.cpp binaries native rebuild +7-10%
CLI=~/llama.cpp/build/bin/llama-completion
if [ ! -x "$CLI" ]; then
echo "rebuild llama.cpp native" >> $LOG
cd ~/llama.cpp
cmake -B build -DLLAMA_NATIVE=ON -DCMAKE_BUILD_TYPE=Release -DLLAMA_BUILD_SERVER=OFF -DLLAMA_SERVER=OFF
cmake --build build --target llama-simple llama-completion llama-bench llama-simple-chat -j2
fi
# 4. GGUF manifest verification
declare -A MANIFEST=(
["Qwen2.5-0.5B-Instruct-Q5_K_M.gguf"]=420086080
["Qwen3-0.6B-Q4_K_M.gguf"]=484220320
["DeepSeek-R1-Distill-Qwen-1.5B-Q4_K_M.gguf"]=1117320800
["Qwen2.5-Coder-0.5B-Instruct-Q4_K_M.gguf"]=397808288
)
for f in "${!MANIFEST[@]}"; do
exp=${MANIFEST[$f]}
if [ ! -f ~/$f ] || [ "$(stat -c%s ~/$f)" != "$exp" ]; then
echo "redownload $f (expected $exp)" >> $LOG
case $f in
Qwen2.5-0.5B*) curl -sSL -o ~/$f https://huggingface.co/second-state/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/$f ;;
Qwen3-0.6B*) curl -sSL -o ~/$f https://huggingface.co/bartowski/Qwen_Qwen3-0.6B-GGUF/resolve/main/$f ;;
DeepSeek*) curl -sSL -o ~/$f https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-1.5B-GGUF/resolve/main/$f ;;
Coder*) curl -sSL -o ~/$f https://huggingface.co/bartowski/Qwen2.5-Coder-0.5B-Instruct-GGUF/resolve/main/$f ;;
esac
fi
done
# 5. auth
[ -f ~/.clawhub/TOKEN ] || echo "auth missing โ run clawhub login" >> $LOG
# Wrap model call with timeout + fallback
run_with_timeout() {
local model=$1 prompt=$2 n=$3 timeout=$4
timeout $timeout ~/llama.cpp/build/bin/llama-completion -m $model --prompt "$prompt" -n $n -t 2 -fa on --ctx-size 2048 2>/dev/null || \
timeout 60 ~/llama.cpp/build/bin/llama-simple -m $model -n $n "$prompt" 2>/dev/null || \
return 2
}
Then per-call wrapper:
- r1 (1.5B ~13 t/s): budget = 45s + n/10
- q3/fast/code (0.5-0.6B ~30 t/s): budget = 30s + n/20
- Absolute cap 300s
- Fallback:
llama-completionโllama-simpleโ exit 2
Optimal CPU params (from edge-cpu-gguf-tuner v2)
| Param | Best | Why |
|---|---|---|
| -t | =2 physical cores | t=4 oversubscribes tg -42% |
| -fa | on | pp +11% tg +19% small models |
| -ctk/-ctv | f16 default | q8_0 pp -35-50% CPU |
| -b | 2048 default | no-op ยฑ2.4% |
| quant | newer Q4_K_M > older Q5_K_M | arch > quant speed |
| build | -DLLAMA_NATIVE=ON | AVX512/VNNI +7-10% pp |
| cache | SHA256 hit | 33x faster 2.1sโ0.06s |
| ctx | 2048 fast / 4096 r1 | less KV overhead |
Byte Manifest + Roles + Speed
| File | Bytes | Role | Speed |
|---|---|---|---|
| Qwen2.5-0.5B-Instruct-Q5_K_M.gguf | 420,086,080 | SPARK | 30 t/s |
| Qwen3-0.6B-Q4_K_M.gguf | 484,220,320 | SCOUT | 34 t/s fastest |
| DeepSeek-R1-Distill-Qwen-1.5B-Q4_K_M.gguf | 1,117,320,800 | SAGE deep | 14 t/s |
| Qwen2.5-Coder-0.5B-Instruct-Q4_K_M.gguf | 397,808,288 | FORGE code | 31 t/s pp145 |
Anti-hang Rules (must enforce)
- Never run inference without
timeout - Always verify binary exists + exec
- Always verify model byte size not just existence
- Light-swarm (SCOUT only 80-120 tokens) casual chat; full swarm substantive
- Independent timeouts per swarm agent โ slow SAGE can't hang SCOUT
- Log self-heal triggers to
/tmp/selfheal.logand continue - Visible progress echo before long ops (spinner/header)
Integration Tests (NEW)
scripts/test_selfheal.sh:
- Simulate missing
llama-completionโ expect rebuild - Simulate missing GGUF โ expect redownload manifest check
- Simulate truncated GGUF (15-byte HTML) โ expect redownload
- Simulate npx without shim โ expect shim recreation
- Simulate model timeout โ expect fallback q3
- Simulate repeated prompt โ expect cache hit 0.06s
Related Skills Integration
edge-cpu-gguf-tuner v2โ provides tuned paramsfast-response-optimizerโ reply-first + parallelprompt-cacheโ hash dedupopenclaw-cache-kitโ long retention system promptmodel-fallbackโ chainkeepaliveโ gateway 24/7
Authored field Arena 2026-07-27 for user-reported "agent stops responding". Root cause snapshot eviction 2.4GB GGUF+build, scripts calling missing binaries. v2.1.0 adds actual runner lib, cache, native rebuild, tests.
Related skills
Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.
Adaptive web scraping in Python that bypasses anti-bot systems and scales from single requests to concurrent crawls.
Trade crypto, manage a multi-chain wallet, and query an AI analyst from one CLI.
Query and manage Linear issues, projects, teams, cycles, labels, and comments through a managed OAuth GraphQL endpoint.
Write, debug, and tune Playwright specs with locator strategy, trace diagnosis, and CI-aware timeouts.
More from orionshaowswmw
Browse all skillsDetect and repair partially wiped agent workspaces with integrity checks, signed manifests, guarded restore recipes, bounded local recovery state, and explicit off-box sync. Use when files, scripts, trees, models, or build outputs disappear or lose integrity between turns.
Seven offline mechanisms against slow/stale/zombie/sycophantic agent turns: prompt compaction, request fencing, zombie detection, CAPTCHA triage, anti-sycophancy spine, delivery register, invention quarry. Use when chat feels laggy, reconnects surface old answers, long chats degrade, or the agent caves under contradiction. JSON contracts; state per-agent under ~/.arena_turn; no network, no sudo.
Quota-aware LLM router that squeezes maximum usable AI out of free-tier API keys across Gemini, Mistral, OpenRouter, Kilo and Cerebras plus any OpenAI-compatible endpoint (including local Ollama/llama.cpp/vLLM). Probes every model on every key, measures real quality and real published rate limits, then routes each request to the cheapest model that can do the job โ spending abundant capacity first and reserving scarce daily quota for when it is actually needed. Persists cooldowns to disk so a 429 discovered in one process is respected by the next. Use when an agent must make many LLM calls on free keys without hitting rate limits, when "all models failed", or when deciding which of several provider keys to use for a task.
Opt-in, model-neutral guidance for evidence-aware, dignified AI communication, with a compact response contract and offline deterministic text audit. It never injects prompts, edits host configuration, calls networks, reads secrets, or treats heuristics as truth.
Iran Chemical Database โ live, dated, auditable, BEST-EFFORT index of chemical offerings in configured public Iranian supplier catalogues (websites + public Telegram channels). HTTrack/WooCommerce-REST/Telegram mirroring โ local-only parsing โ RDKit/PubChem/CAS-validated PostgreSQL with FastAPI + Streamlit. Fail-closed Iranian-suppliers-only country gate; coverage measured and published, never claimed complete. Installation = software + queued crawl, not a populated dataset. Ships a 1399-molecule CID-unique confirmed-organic seed baseline (v2.22, 2026-08-27: v2.19 primary + live Telegram/WooCommerce/sitemap crawl + 5-model fleet normalization, every new identity PubChem-confirmed). For academic procurement research.
Model-agnostic, agent-agnostic fidelity-first pipeline converting operator-authorized Persian/English RTL lecture PDFs into offline HTML study guides โ recall-first dual OCR (PyMuPDF + Tesseract fas+eng PSM ensemble), rendered-page evidence, multi-model correction, session-grounded enrichment (tables/flashcards/quizzes/mnemonics/summaries/scenarios), measured fidelity, QA gates, verified ZIP. v1.5.0 runs on ANY model family through 8 API dialects (OpenAI, Responses, Gemini, Anthropic, Cohere, Ollama, HuggingFace, offline mock) or with no model at all, auto-discovers providers from the host agent's environment, self-heals provider quirks and model retirements, and exposes one deterministic CLI/MCP entrypoint plus cross-model consensus so different agents reproduce the same intended result.