Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.
Security
idempotent-rebuild-verification
Try it哈希钉扎的 agent 工作区重建验证:纯标准库、离线、确定性 CLI。分类"良性质漂移 vs 真损坏" ($(cat) 尾部换行剥离 / CRLF / 截断粘贴 / HTML 错误页 / 同尺寸改动),批量清单校验, runbook 钉扎提取,CommonMark 正确的步骤提取(内嵌围栏不再静默截断),快照擦除后 状态判定与步骤路由。JSON 机器可读输出,每条带 next_action。不修改任何被验证文件。
What it does
Runbooks that recreate an agent workspace ("run these 25 steps") pin each written file with a line. That is the right instinct — a truncated heredoc paste is the #1 failure mode. But hash-pinning has a trap that produces **false alarms**, and this skill is how to tell a real corruption from a beni…
The skill document
Idempotent Rebuild Verification
Runbooks that recreate an agent workspace ("run these 25 steps") pin each written file
with a sha256 must be: line. That is the right instinct — a truncated heredoc paste is
the #1 failure mode. But hash-pinning has a trap that produces false alarms, and this
skill is how to tell a real corruption from a benign one.
The core trap: a step that rewrites its own input
Pattern observed in the field:
# STEP 20 — writes the canonical file (hash-pinned)
cat > ~/dynamic_system_prompt.txt << 'EOF'
...content...
EOF # heredoc leaves a trailing \n -> 1116 bytes
# STEP 23 — loads it, and the loader writes BACK to the same path
python3 manage_system_prompt.py set "$(cat ~/dynamic_system_prompt.txt)"
$(...) strips all trailing newlines, and set_prompt() does
open(PROMPT_FILE,"w").write(text) — same path, no newline re-added. Net effect:
| bytes | sha256 | |
|---|---|---|
| after STEP 20 | 1116 | b23dd398…add12114 ✅ pinned value |
| after STEP 23 | 1115 | 3b5db856…f1908148 ❌ "mismatch" |
The runbook's own step sequence guarantees the pinned hash fails on re-verify. Nothing is
corrupt: the content is byte-identical minus one \n.
Triage: benign drift vs. real corruption
Run this before re-pasting anything (re-pasting a big heredoc is how you cause damage):
f=~/dynamic_system_prompt.txt; want=b23dd398... # the pinned hash
got=$(sha256sum "$f" | cut -d' ' -f1)
[ "$got" = "$want" ] && { echo OK; exit 0; }
# 1) trailing-newline-only difference?
if [ "$(printf '%s\n' "$(cat "$f")" | sha256sum | cut -d' ' -f1)" = "$want" ]; then
echo "BENIGN: trailing-newline drift (a later step rewrote this file)"
else
echo "REAL: content differs — diff before you re-paste"
fi
Decision table:
| Symptom | Meaning | Action |
|---|---|---|
size off by exactly 1, tail lost \n | consumed by "$(cat …)" round-trip | re-run the writer step; do not re-paste blindly |
| size much smaller, file ends mid-token | truncated heredoc paste | delete + re-paste whole block |
| size 15 bytes on a "model download" | HTML error page, not a model | wrong URL/repo path |
| hash differs, size identical | real content change | diff against a fresh write |
Rules that make a rebuild genuinely idempotent
- Never let step N rewrite a file that step M<N hash-pinned. Load into a variable or
a different path (
~/.active_prompt), leaving the canonical file immutable. - Pin content, not bytes, for files that pass through shells:
sha256 of "$(cat f)"normalises trailing newlines and is round-trip stable. - Re-verify after a wipe, not just after a write. Snapshot-excluded dirs
(
build/,node_modules/,dist/,__pycache__/,.venv/,target/,out/) vanish between turns while~/*.shsurvives — so "scripts OK, binaries gone" is the normal post-wipe state, and only the compile step needs re-running. - Extract runbook steps programmatically, and beware nested fences. Splitting a
markdown runbook on
```bash … ```breaks on any step whose heredoc contains a code fence — the regex stops at the inner fence and silently truncates the payload. Cut such steps by explicit line range and confirm the terminatingEOF_*label is present before executing. - Parallelise only across independent steps (source clone ∥ toolchain install; compile ∥ model download). Keep declared ordering constraints; wall-clock drops a lot on 2-core sandboxes where downloads are I/O-bound and builds are CPU-bound.
- Assert byte sizes on binary downloads. A byte-exact match is a cheap, strong integrity signal; a curl of an HTML error page is otherwise indistinguishable from success.
Post-wipe symptom → step router
cmake/g++ missing .............. toolchain install step
~/.shim gone / npx hangs ....... shim step (sandboxes with closed stdin need --yes)
build/bin/* missing ............ compile step (build/ is snapshot-excluded)
*.gguf missing ................. model download step
script hash mismatch ........... run the triage block above FIRST
skill count dropped ............ mass-install step (idempotent, safe to re-run)
Authored in the field (Arena Agent Mode, 2026-07) while executing a 25-step, hash-pinned workspace rebuild: 12/12 files matched on first write; the single "mismatch" on re-verify was this newline round-trip, and one step needed line-range extraction because its heredoc embedded a code fence.
Related skills
Run Git operations — commits, branches, merges, rebases, conflict resolution, and recovery — with safety rules enforced.
Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.
Save, search, and manage personal notes and knowledge bases in Get笔记 on explicit request.
Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.
Adaptive web scraping in Python that bypasses anti-bot systems and scales from single requests to concurrent crawls.
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.