agent-infra-fixer
Skill5 starsChanged 11 days agoApache-2.0View on GitHub
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.
- Deletes or force-pushes
In this repository168 other files it gives its agents.
- abel-sell-the-alphaSkill
- agent-governance-gap-analysisSkill
- agent-receiptSkill
- agent-skills-gapSkill
- ai-dnaSkill
- ai-festival-posterSkill
- ai-teamSkill
- albro-founder-brandSkill
- anatomySkill
- andy-raskin-strategic-narrativeSkill
- ar-aging-and-cash-applicationSkill
- asshauer-performance-contentSkill
- autonomous-researchSkill
- awwwards-sitesSkill
- better-typographySkill
- bourgoin-why-we-buySkill
- brain-scanSkill
- brath-b2b-demand-frameworkSkill
- braun-poke-the-bearSkill
- broll-pickerSkill
- claritySkill
- client-commsSkill
- cli-ux-reviewSkill
- clone-my-voiceSkill
- clone-yourselfSkill
- costa-negotiation-dynamicsSkill
- crawler-access-auditSkill
- cv-job-matchSkill
- data-globeSkill
- decision-ledgerSkill
- denney-persona-angle-formatSkill
- dicks-homework-five-secondSkill
- domain-uptime-monitorSkill
- dreyer-funnel-diagnosisSkill
- dry-three-copy-testsSkill
- dunford-obviously-awesomeSkill
- edge-find-skillsSkill
- fede-cloneSkill
- fede-voiceSkill
- fehr-clarity-taste-strategySkill
- fitzpatrick-mom-testSkill
- flores-founder-content-machineSkill
- founders-handbookSkill
- foxwell-meta-creativeSkill
- frankus-geo-auditsSkill
- gahan-b2b-creator-blueprintSkill
- galloway-youtube-outlier-packagingSkill
- generate-imageSkill
- geo-dominationSkill
- gerhardt-founder-brandSkill
- german-taxes-elsterSkill
- goetz-challenger-marketingSkill
- greger-creator-squadSkill
- handley-everybody-writesSkill
- harness-firstSkill
- hire-founding-engineerSkill
- hott-ugly-adsSkill
- http-error-triageSkill
- hubspot-crm-cleanupSkill
- humanizerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
No eval, no skill draft - reproduce, fix, verify, record.
- Very specific: line 62
Keep guard test inputs outside the installed skill.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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
- 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.
- Fix the environment (hook, wrapper, permission config), minimal diff.
- Verify with a trigger/benign pair: the fix must fire on the bad input and stay silent on good input.
- Record in
$FORGE_ROOT/ledger.jsonlasdecision: "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.
python3 scripts/fix-hooks.py --exit2 # ~/.claude/hooks, diff only
python3 scripts/fix-hooks.py --hooks-dir /root/.claude/hooks --exit2 --applyThen verify each fixed hook with a must-block input: exit 2 AND non-empty stderr. 2026-09-16: this class was the #1 mined cluster on both test machines (117 errors in 40% of one machine's sessions, 180 in 22 sessions on the other). The generic fixer reproduces the six hand-made fixes byte for byte.
Known failure class: over-broad guard patterns
A guard that blocks legitimate work is as costly as a missing guard: the agent loses a turn,
invents a workaround, and learns nothing. Substring patterns are the usual cause:
rm -rf / matches every rm -rf /tmp/x, truncate matches "truncated", curl.*|.*sh
matches | head, and heavy-task patterns match pgrep/du arguments, code strings and
commands already wrapped in ssh <server> '...'.
Replay every past block through the current hooks, and prove the guards still hold:
python3 scripts/replay-hook-blocks.py --must-block /path/to/local-guard-cases.txt [--dump DIR]now passes: the block no longer fires (fixed hook, or confirm it was a false positive).still blocked: inspect each reason; keep the true positives, narrow the rest.must-block cases missedmust be 0. Verify guards negatively: loosening a pattern untilrm -rf ~passes is worse than any false positive. Keep guard test inputs outside the installed skill. The repository's negative-test fixture is undertests/agent-infra-fixer/and is not part of this package.
Fix pattern: match what is EXECUTED, not text. Anchor destructive targets (/, ~,
$HOME, * as the whole argument), allow --force-with-lease, parse command position
(skip heredoc bodies and quoted ssh payloads) for heavy-task rules.
2026-09-17 on one real machine: 135 blocks in 26 sessions, 129 were false positives; after the
rewrite 6 remain blocked (all true positives) and 0 must-block cases were missed.
Reference implementations: examples/block-destructive.sh and examples/block-heavy-local.sh
(set DEV_SERVER); both parse in python3 and read the hook JSON from stdin.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

