heredoc-guard
Skill0 starsChanged 16 days agoApache-2.0View on GitHub
Deny command substitution in unquoted shell heredocs before execution.
In this repository64 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- verify-lead-waitSkill
- verify-merge-receiptsSkill
- branded-docSkill
- explanatory-docSkill
- 1passwordSkill
- agada-benchSkill
- agent-browserSkill
- agent-routingSkill
- architectural-conformance-auditSkill
- audio-dashboardSkill
- brain-store-fallbackSkill
- claude-desktop-researchSkill
- cmux-agentsSkill
- cmuxSkill
- coachSkill
- coderabbitSkill
- codex-workflowsSkill
- collab-monitorSkill
- content-demo-creationSkill
- convention-auditSkill
- cursor-workflowsSkill
- cyberSkill
- deploy-verifySkill
- drive-filingSkill
- eas-prebuild-checkSkill
- ecosystem-healthSkill
- eli5Skill
- false-green-gateSkill
- figma-loopSkill
- fleet-wrap-gateSkill
- fleet-wrapSkill
- frustration-captureSkill
- gemini-researchSkill
- git-guardianSkill
- github-researchSkill
- golem-installSkill
- grill-meSkill
- html-dashboardSkill
- human-confirm-gateSkill
- i-have-adhdSkill
- install-runbook-linterSkill
- large-planSkill
- m1-window-gateSkill
- model-pin-gateSkill
- never-fabricateSkill
- orcSkill
- plan-councilSkill
- pr-loopSkill
- qa-verdict-gateSkill
- qa-videoSkill
- repogolemSkill
- research-lifecycleSkill
- reviewer-order-gateSkill
- session-handoffSkill
- skill-creatorSkill
- stitch-designSkill
- t3-visualsSkill
- tmp-blockSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 11
If a value must expand, compute it first: put v=$(cmd) on its own line before the heredoc, then use $v in the unquoted body.
≈ “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
Heredoc guard
Unquoted heredocs (<<EOF, <<-EOF) expand backticks and $(command) in
their bodies. A backticked command in generated Markdown can run on the host.
Quote the delimiter: <<'EOF', <<"EOF", <<\EOF, or <<E"OF".
If a value must expand, compute it first: put v=$(cmd) on its own line before
the heredoc, then use $v in the unquoted body. Quoting preserves literal text;
precomputing preserves the intended computed value.
Escaped backticks/dollars, variable expansion and arithmetic alone are allowed.
There is no environment bypass. Commands without a heredoc operator return allow
before shell inspection; << split by escaped newlines still counts. Invalid or
unsupported syntax and inspection limits in heredoc-bearing commands deny with
a plain refusal; the ledger keeps the stage and short cause. ANSI-C escapes in
delimiters require a plain quoted rewrite; ordinary ANSI-C quoted arguments are
treated as strings.
Scope: inspect the outer shell command, including executable substitutions.
Quoted interpreter payloads such as bash -c '…' are strings and are not
recursively interpreted. Quotes inside an unquoted heredoc body do not protect it.
This is a heredoc guard, not a full shell syntax validator.
Claude uses the fail-closed launcher; Codex uses codex-policy-hook.py.
Codex uses the standard ^(Bash|apply_patch)$ matcher. The gate immediately
allows non-Bash events; native patch content is never parsed as shell.
Each denial appends one JSONL record to the heredoc guard ledger in the user's
Claude logs directory, following tmp-block's durable logs convention. Override
the destination with HEREDOC_GUARD_LEDGER; tests and probes use isolated ledgers.
Records contain ts,
command_sha256, rule, and a short static reason, never raw command text.
Missing or invalid commands use the SHA-256 of the empty string. An unwritable
ledger still denies with the same plain refusal.
Source wiring does not prove installed/native enforcement. Installation and
native acceptance belong to the lead after merge; this change installs nothing.
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.

