← ClaudeAtlas

agent-infra-fixerlisted

Fix the agent's own environment when skill-miner surfaces infra-class failures - broken or over-broad hooks, permission-mode denials, wrappers, sandboxing, expired CLI auth. Use when session mining shows hook errors ("No stderr output", repeated "BLOCKED" on legitimate commands), denied permissions, or environment breakage that no skill could fix. The rule is that infra failures get fixed in the environment, never worked around with skills.
getedgehq/skills · ★ 3 · AI & Automation · score 71
Install: claude install-skill getedgehq/skills
# agent-infra-fixer skill-miner classifies clusters as `infra` or `task`. Infra clusters come here. No eval, no skill draft - reproduce, fix, verify, record. ## Process 1. **Reproduce.** Re-run the failing component on a triggering input. For hooks: pipe a realistic tool-input JSON into the hook script and check exit code AND which stream the message lands on. 2. **Fix the environment** (hook, wrapper, permission config), minimal diff. 3. **Verify with a trigger/benign pair**: the fix must fire on the bad input and stay silent on good input. 4. **Record** in `$FORGE_ROOT/ledger.jsonl` as `decision: "infra-fix"` so the next mining run can confirm the cluster count dropped. ## Known failure class: stdout-block hooks PreToolUse hooks that print block reasons to **stdout** instead of **stderr** surface to the agent as `hook error: No stderr output` - the block works but the agent never sees WHY, retries, and the error count explodes. Exit code must be 2 with the reason on stderr. Detector/fixer: for every `exit 2` in a `*.sh` hook, the echo / printf / `cat <<EOF` lines of the same block get `>&2`; `--exit2` also turns a message + `exit 1` (which does not block at all) into `exit 2`. Dry run prints a diff; `--apply` writes `.bak-stderr` backups. Idempotent. ```bash python3 scripts/fix-hooks.py --exit2 # ~/.claude/hooks, diff only python3 scripts/fix-hooks.py --hooks-dir /root/.claude/hooks --exit2 --apply ``` Then verify each fixed hook wi