Languette: sharp hooks need strong guards.
A deterministic check against risky actions by coding agents.
Before a coding agent runs a shell command, a languette guard reads it and answers: allow, ask, or deny.
Nothing external decides: no web services, nothing cloud-based, and no ML or AI models. The critical execution path is deterministic, and uses "pure functions" where possible.
Who is this for?
You! ...assuming you are a real human being. A big AI vendor's safeguards are its product decision, changed on a whim. We don't have to trust them blindly. Languette is a guard you can read, test, and understand for yourself: trust, but verify. Any vendor that wants to adopt it is welcome to, under the terms of the AGPL.
What's with the name?
Languette is French for "little tongue". On a halberd the languette (or 'langet') is the strip of iron that runs down the shaft from the head, so a stray blow can't cut through the pole. These guards are that strip: protecting your work, strengthening your tools, and holding back specific agentic hazards that could ruin your day.
It's also a play on words: Shell is a little language, and languette listens for the few words in a shell command that can do damage. When it hears one, it tells the errant agent "hold your tongue!"
"The wise speak only of what they know, Gríma son of Gálmód. A witless worm have you become. Therefore be silent, and keep your forked tongue behind your teeth. I have not passed through fire and death to bandy crooked words with a serving-man till the lightning falls." — Gandalf, in J.R.R. Tolkien's The Two Towers, Book 3, Chapter 6
Install
The guards run as PreToolUse hooks in Claude Code today, on shell commands,
gh and GitHub MCP calls, and messages to other sessions; other agent hosts
are planned (#5).
It is in beta: versions are patch-only; configuration keys stay but may gain aliases (#153).
Claude Code
/plugin marketplace add mark-brannan/languette#release
/plugin install languette@languette
It needs python3 3.11 or newer, standard library only. shfmt (the parser it trusts
most) and gh (for the guards that ask GitHub) are optional. Without
python3, every Bash call is denied: the guards fail closed.
With no GitHub lookup, a Bash call waits a median 166-219 ms (p90 up to 318 ms) for the
guards: one hook process, on 16 cores of WSL2 under load. A lookup adds a network round trip.
macOS
brew install mark-brannan/tap/languette
languette install && languette doctor
Linux and WSL
sudo apt install python3 pipx shfmt gh
pipx ensurepath
pipx install languette
Open a new shell so ~/.local/bin is on your PATH, then:
languette install && languette doctor
Windows without WSL
Languette protects Claude Code inside WSL: run wsl --install, then the
Claude Code block above. An agent running natively in PowerShell is not protected.
Devcontainer, Codespace and CI
Copy devcontainer/src/languette to
.devcontainer/languette. This line installs Claude Code and languette:
"features": { "./languette": {} }
A registry and a CI Action are planned (#102). Claude Code cloud sessions build no dev container.
If you cannot run the installer
Clone the repo and add one entry per guard to settings.json, shaped like
the one below. Replace $HOME/languette with the path to your clone, and
keep the wrapper. The wrapper is what makes a missing or
crashing guard a deny: without it, a missing script is a non-blocking error
to Claude Code, and every command goes through. One entry, for Bash calls;
hooks/hooks.json lists the other tools and events the plugin wires:
{"hooks": {"PreToolUse": [{"matcher": "Bash", "hooks": [{"type": "command",
"command": "h=\"$HOME/languette/languette/run.py\"; { [ -f \"$h\" ] && python3 -I \"$h\" --guard guard-recursive-delete; } || printf '%s\\n' '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"languette/run.py (guard-recursive-delete) is missing or crashed, or python3 is not on PATH. This is a gate and fails closed.\"}}'"}]}]}}
Removing it
languette uninstall removes what languette install wrote, after asking, through Claude Code's own command.
Try it: languette scan (experimental)
It reads a shell command on stdin and prints the words each guard would judge:
$ echo 'rm -rf build && sh -c "git push --force"' | languette scan | jq -c '.segments[] | [.nested, [.words[].text]]'
[false,["rm","-rf","build"]]
[false,["sh","-c","git push --force"]]
[true,["git","push","--force"]]
From a checkout without installing, swap languette scan for python3 -m languette scan:
$ echo 'rm -rf build && sh -c "git push --force"' | python3 -m languette scan | jq -c '.segments[] | [.nested, [.words[].text]]'
The guards
Each guard checks for one kind of hazard; Configuration turns one off:
ask-first: a command the repo lists as costly, until you approve that one rundeny-always: a command the repo forbids, every timeguard-sudo: opt-in;sudo,su,doas,pkexec,run0,sudoedit,dzdorequire-well-formed: a Bash command that doesn't parse; the other guards skip itguard-disks:dd,mkfs,wipefs,shredonto disksguard-github-issues: a second issue create, transfer or delete in one human turn, or any in a loopguard-host-availability: shutdown, reboot, fork bomb,systemctl stop sshdguard-infra:terraform destroy,kubectl deleteand other destroys, until you approve that one runguard-permissions:chmod 777, recursivechmod,chown,chgrpoutside agent-owned orLANGUETTE_PERM_ALLOWpathsguard-pipe-to-shell:curl u | sh,sh <(curl ..),eval "$(wget ..)"guard-private-terms: a blocked term posted to a public repo; your redacted terms replaced firstguard-recursive-delete: a recursivermorfind -deleteoutside a generated or agent-owned directoryguard-scheduled-jobs:crontab -rguard-secrets: a pasted credentialguard-worktrees: opt-in; a branch switch when$HOMEis a worktree, or a reach into another session's worktreeguard-bypass-hooks:--no-verifyandgit -c core.hooksPath=, until you approve that one runguard-bypass-labels: a session applying a label thebypass_labelssetting names (none by default)guard-bypass-ruleset: a push direct to main, past a pull-request rule your credentials can bypassguard-cross-session-send: a message to another session: an ask; in bypass mode, a deny after a network readguard-git-stacked-base: deleting a remote branch an open PR is based on (GitHub silently closes the PR)guard-duplicate-prs: a second open PR on one issueguard-git-work-loss:add -A,stash pop, force-push,reset --hardand other moves that throw work awayguard-protected-services:systemctl stop postgresql, for the services theprotected_servicessetting namesguard-review-threads: opt-in; resolving a bot's review thread with no reply naming a commit or a linkguard-signed-comments: opt-in; a comment not from a bot's account, or without the signature you setprose-budget-commit: opt-in; agit commitwhose staged prose runs over the repo's word budgetsguard-databases(planned)guard-protected-paths(planned)
The promise
When a guard can't tell what a command it covers will do, it denies and says why. When no rule covers a command, it says nothing.
A variable where a path should be, a brace expansion, a quote it can't
resolve: each is a deny that names what the guard saw. The second half is a
limit, not a bug. A guard reads shell text; it does not open scripts or read
other languages. These are real verdicts, generated from the guards'
scenarios for a command run in ~/project, and CI fails if the table drifts:
| Command | Verdict | Why |
|---|---|---|
rm -rf build |
DENY | not an allowlisted generated dir |
rm -rf node_modules |
allow | allowlisted |
rm -rf "$DIR" |
DENY | unresolvable word; loud |
rm -rf dist{,2} |
DENY | brace expansion unresolved; loud |
sh -c "rm -rf build" |
DENY | nested text scanned |
find build -delete |
DENY | rule covers find -delete |
python3 -c "shutil.rmtree('build')" |
allow | no rule; silent (known gap) |
./cleanup.sh |
allow | no rule; silent (known gap) |
With shfmt 3.6 or later on PATH, the require-well-formed guard denies a
command that doesn't parse. Without shfmt, it falls back to bash -n, then
to its own lexer.
In a replay of 101,671 agent commands, about 1 in 3,000 didn't parse, and
each would have broken.
Bash runs a broken command in part, the lines before the error or prose in
backticks as a command; the deny stops all of it, so the agent looks again.
A command over 64 KB, or nested too deeply to parse quickly, is denied unread.
Not a sandbox
Languette checks commands before they run. It can't see what a script does once it starts.
A sandbox limits what any program can reach. It doesn't judge commands, so one that deletes your project still runs.
Use both.
Ask first
A repo lists its expensive commands in .languette/ask-first.json:
{"commands": [{"id": "e2e",
"match": [{"cmd": "npm", "args": ["run", "e2e"]},
{"cmd": "node", "script": "scripts/e2e.mjs"}],
"cost": "> 40 minutes, using all CPU cores on a typical desktop",
"approve_label": "Run e2e"}]}
When the agent tries a matching command, the guard denies it and tells the
agent to ask you first: the exact command, why now, the cost, any cheaper
form the entry lists under "cheaper", and a button labelled with
approve_label. Click it and the next matching command runs. One click is
one run: a command that runs it twice needs two, and one in a loop or xargs
is denied whatever you approved. Only your click counts, never what the agent
wrote in the question.
A match may also name "flags", single option letters the command must carry
({"cmd": "rm", "flags": ["r"]} matches rm -rf x), and "except", whole
arguments that exempt a run (["--help"]); list only a flag the program
honours.
Matching sees through wrappers: timeout 3h npm run e2e, sh -c "...",
pnpm exec node ./scripts/e2e.mjs and yarn e2e all count, while grep,
git commit -m, cat and pkill -f that merely name the script do not. A
run hidden inside a script (./ci.sh) or behind a variable ($CMD) is not
seen.
The guard reads the nearest .languette/ask-first.json at or above the
command's working directory, stopping at the repo root, else the one in
$CLAUDE_PROJECT_DIR. Your own list, ~/.config/languette/ask-first.json,
applies in every repo, and a repo's never loosens it. With no file,
it stays silent. A file that doesn't
parse, that has a key besides id, match, cost, approve_label and
cheaper, or that gives two commands the same id or approve_label,
denies every command until it is fixed, because the guard can no longer tell what the list
meant. One click pays for one run, read from the transcripts; each
spend is logged in <transcript>.languette-ask, which no guard reads.
In dontAsk, where no question reaches you, the guard says so and leaves
the run to you.
Deny always
A repo lists the commands it forbids in .languette/deny-always.json:
{"rules": [{"id": "prod-db",
"match": [{"cmd": "psql", "args": ["prod"]}],
"why": "production is reached through the release job, never by hand"}]}
Matches, lookup, your own list and a broken file work as for ask-first; {"cmd": "terraform"} alone forbids the whole program.
Configuration
Every guard is on by default except guard-worktrees,
guard-review-threads, guard-signed-comments, guard-sudo and
prose-budget-commit, which are opt-in. Turn one off (or those on) with
/plugin configure languette@languette,
or at install, by its name with underscores:
claude plugin install languette@languette --config guard_recursive_delete=false
Changing an option later, outside the installer, is languette config: alone it lists every option, languette config guard_recursive_delete=false sets one, --unset restores its default (design).
A guard is skipped only when its setting is exactly false. Unset, empty or
anything else runs it, so a misconfiguration cannot open the gate.
An opt-in guard is the reverse: it runs only when its setting is exactly
true, so a misconfiguration leaves it off. The two controls of
guard-worktrees, guard_worktrees_checkout_home and
guard_worktrees_foreign, are each on unless set to false.
One setting per guard-git-work-loss rule
guard_git_work_loss=false skips all six rules. To keep five, turn off one:
| Setting | Rule it switches off |
|---|---|
guard_git_work_loss_blanket_staging |
add -A, add ., commit -a |
guard_git_work_loss_stash |
stash pop, stash clear, a bare stash drop |
guard_git_work_loss_force_push |
a bare force push; a force push to or delete of main |
guard_git_work_loss_discard |
reset --hard, checkout ., restore ., clean -f |
guard_git_work_loss_branch_delete |
branch -D, branch --delete --force |
guard_git_work_loss_adopt |
stow --adopt (asks) |
Allowing more for guard-recursive-delete
Built in: the generated directories node_modules, dist, coverage and
.pio, and the agent's own places: /tmp, the host's temporary directory
($CLAUDE_CODE_TMPDIR, else $TMPDIR) and the host's worktree directory,
<project>/.claude/worktrees, for the project the host names
($CLAUDE_PROJECT_DIR) and the one a worktree session stands in.
To allow more, set LANGUETTE_RM_ALLOW to a colon-separated list. It adds to
the built-in lists and never replaces them; unset or empty changes nothing.
export LANGUETTE_RM_ALLOW=build:.next:/srv/agent-area
- A bare name (
build) is treated likedist: a directory with that name, below the top level of$HOMEor/. - An absolute path (
/srv/agent-area) is treated like the scratchpad: a place the agent owns. - Entries use letters, digits and
. _ @ + -only. A path has no.or..segment, and is never/or$HOME.
If the value doesn't parse, every Bash call carries a warning, and only a
recursive rm or find -delete is denied. A typo can't stop unrelated work,
and it can't open the gate either.
Settings for guard-private-terms
| Setting | Holds |
|---|---|
blocked_terms_file |
terms that deny the whole post: the term, a tab, a message for the agent |
redacted_terms_file |
terms replaced before the post leaves: the term, a tab, the replacement |
private_repos |
repos whose posts are never scanned, comma-separated: you/notes,you/scratch |
One tab-separated format, # comments, case-insensitive, re: for a regular
expression; unset, the files are blocked-terms.tsv and redacted-terms.tsv
in ~/.config/languette/. A path set but not
loading denies public posts until fixed; languette doctor says which line.
Only the file's entries count; languette doctor --init-redacted-terms writes the
default entries into it; features/fixtures/private-terms/
shows a comment beside what leaves.
Other settings
bypass_labels lists the labels guard-bypass-labels keeps for humans,
comma-separated, for example churn-ok,mixed-loops-ok; empty, the default,
guards no label.
review_thread_logins lists the logins, besides the gh login, whose reply
lets guard-review-threads pass a thread's resolve, comma-separated, for
example you,your-app; empty, the default, counts the gh login alone.
guard-signed-comments is experimental. On, it denies any comment not posted
from a bot's account (a GitHub App's, its login ending in [bot]), and any
through a GitHub MCP tool, whose account it cannot read, unless
signed_comments_mcp says ask or allow (deny is the default). It checks a signature
only for the settings you give it: signed_comments_opening and
signed_comments_signature are empty by default, and empty checks nothing.
record_decisions, off by default, keeps every verdict, with its command and
secrets masked, in $XDG_STATE_HOME/languette/decisions.jsonl, readable only by you.
Privacy and support
Guards that need GitHub's answer ask through your own gh. Session state
stays in local files. Decisions are recorded only if you turn on
record_decisions.
What languette writes
Every write, by guard. The first table is what a guard reads back to reach a verdict:
| File | Guard | Default | Read back for |
|---|---|---|---|
$TMPDIR/languette-guard-github-issues.<session> (and .held) |
guard-github-issues |
on | one issue write per human turn |
$TMPDIR/languette-guard-cross-session-send.<session> |
guard-cross-session-send |
on | whether untrusted content has been read, and which subagents are its own |
$TMPDIR/languette-guard-worktrees.<session>[.<agent>] (and .arrive) |
guard-worktrees; read by guard-git-work-loss |
opt-in | which linked worktrees were entered |
~/.cache/languette/rulesets/<repo>/<branch> |
guard-bypass-ruleset |
on | skipping the GitHub call for an hour after "needs a PR" |
The second is what no verdict reads back:
| File | Guard | Default | Why it is written |
|---|---|---|---|
~/.config/languette/redacted-terms.tsv |
guard-private-terms |
on | your configuration; written at SessionStart only when missing |
~/.local/state/languette/decisions.jsonl |
record_decisions |
opt-in | for you to read |
<transcript>.languette-ask |
ask-first, guard-infra, guard-bypass-hooks, guard-github-issues |
on | a log of which call spent which approval |
The plugin cleans up none of these: no hook runs at session end.
Questions and bugs: GitHub issues.
Strong guards
A guard is a pure function of the command and the facts it asked for; it asks no model and runs nothing, and the runner fetches the facts (the design). The verdict is deny with the reason, ask, a warning, or nothing (allow). What a guard asks for beyond the command, it declares:
| Guard | Reads |
|---|---|
guard-git-work-loss |
git: whether the tree is clean, a linked worktree or in the scratchpad; guard-worktrees' record |
require-well-formed |
a shell parser; nothing runs the command |
guard-recursive-delete |
the filesystem, and LANGUETTE_RM_ALLOW |
ask-first |
the repo's list, the session transcript, the approvals spent |
guard-bypass-hooks |
the transcript, and the approvals spent |
guard-secrets |
the repo's .languette/secrets.json, when it has one |
guard-infra |
the transcript, the approvals spent |
guard-git-stacked-base |
GitHub, through gh |
guard-duplicate-prs |
the issue's timeline on GitHub, through gh, a --body-file it posts, and the checkout's git remote |
guard-review-threads |
the files a graphql call reads; each thread it resolves, and the gh login, from GitHub through gh |
guard-bypass-ruleset |
git, for where a push lands, and GitHub's rules for the default branch, through gh, cached an hour |
guard-github-issues |
the payload's session_id, the transcript, and a door file in $TMPDIR |
guard-private-terms |
the terms file, the files a post reads, and the checkout's git remote |
guard-signed-comments |
the files a comment's body is read from, its two settings, and the gh login, from GitHub through gh |
guard-bypass-labels |
the bypass_labels setting, and a file gh api --input names |
guard-cross-session-send |
the payload's session_id and permission_mode, a record per session in $TMPDIR, and the agent-team config |
guard-worktrees |
$HOME; git, for the repo's top level and where each path lands; a record per session in $TMPDIR |
prose-budget-commit |
the staged diff, and the working-tree files a commit names, through prose-budget |
A guard that crashes is a deny naming the guard; the runner holds that rule, so no guard has to.
The contract is written as "gherkin" scenarios, in the words a person uses to state the rule. They're still completely deterministic tests, just easy for non-technical folks to read.
Scenario: a target the guard cannot resolve is denied on sight
Given the working directory is "$HOME/project"
When the agent runs `rm -rf "$DIR"`
Then the guard denies, naming "variable or command substitution"
Working on it
git clone https://github.com/mark-brannan/languette && cd languette
sudo apt install shfmt shellcheck
python3 -m venv .venv && . .venv/bin/activate && pip install -r requirements-dev.txt
python3 -m pytest # as each push runs it; --full runs every row
python3 tests/readme_table.py # regenerate the table
shellcheck --severity=warning tests/stubs/* # as CI runs it
python3 -m languette doctor # run this checkout without installing it
pipx install --force git+https://github.com/mark-brannan/languette@main
pipx install --force languette # revert to last official release
Running the tests needs pytest, pytest-bdd, pytest-xdist and PyHamcrest; the hooks do not.
The suite runs on at most 4 workers; LANGUETTE_TEST_WORKERS=N sets the cap, -n 0 runs serially.
The same run checks the shape of hooks/hooks.json, because
claude plugin validate --strict passes a malformed one. The headless smoke
test, which installs the plugin in a scratch project and confirms a recursive
rm is really blocked, stays manual: it needs a model call and a login.
features/ holds the contract as scenarios: a command in, tokens or a
verdict out.
License
Markdown files are CC BY-SA 4.0; everything else is AGPL-3.0-or-later, except where a file carries its own notice. Copyright 2026 Mark Brannan. Credit "Mark Brannan" and link this repository.
Metadata
Release files for languette 0.0.26
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| languette-0.0.26.tar.gz | 321.7 kB | With provenance | Details for languette-0.0.26.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| languette-0.0.26-py3-none-any.whl | Python 3 | none | any | Details for languette-0.0.26-py3-none-any.whl |
Total release size: 629.2 kB
Release files / languette-0.0.26.tar.gz
| Download URL | languette-0.0.26.tar.gz |
|---|---|
| Size | 321.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e2ffbb4d730160e6bb4daf4ca17cd6c19c6e45b86960e059ad7323e8e1d28e8
|
|
BLAKE2b-256 checksum How to use checksums |
6bdca49161fc14ae9a8756832df96a93bf31f7f0bd4b52bfbb62fb88546a17a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / languette-0.0.26-py3-none-any.whl
| Download URL | languette-0.0.26-py3-none-any.whl |
|---|---|
| Size | 307.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8eb714e62548a3e3ca9b5fccd0764c77ade14c1feb74e1637c7312675e0074e0
|
|
BLAKE2b-256 checksum How to use checksums |
c4f9fe47a002bb65d426ee2177c53c7fd749a650358c4d7c772fc3e68107d8c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for languette 0.0.26
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for languette-0.0.26.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.