# A Space to test what a coding-agent guardrail says about a shell command

**URL:** <https://discuss.huggingface.co/t/a-space-to-test-what-a-coding-agent-guardrail-says-about-a-shell-command/190936>\
**Category:** Spaces\
**Created:** [October 23, 2026, 5:32am UTC](https://discuss.huggingface.co/t/a-space-to-test-what-a-coding-agent-guardrail-says-about-a-shell-command/190936 "2026-10-23T05:32:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayaannnnnnn](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Ayaannnnnnn](https://discuss.huggingface.co/u/Ayaannnnnnn)\
**Post date:** [October 23, 2026, 5:32am UTC](https://discuss.huggingface.co/t/a-space-to-test-what-a-coding-agent-guardrail-says-about-a-shell-command/190936/1 "2026-10-23T05:32:08Z")

</div>

Hi all! I made a small Space where you can paste a shell command an AI coding agent might run and see what a guardrail would answer before it runs: allow, review (ask the user) or block, and which step decided it.

> **[laya-guard trial - a Hugging Face Space by Ayaannnnnnn](https://huggingface.co/spaces/Ayaannnnnnn/laya-guard-trial)**
>
> See what laya-guard says about an agent's shell command

How it’s built, in case it’s useful to anyone doing the same:

- It’s a ZeroGPU Gradio Space, but the model (Laya, ~322M) runs on CPU at about 0.1–0.3 s per call. ZeroGPU only needs one `@spaces.GPU` function to exist, so there’s one that is never called and visitors’ GPU quota isn’t touched. That’s how a free account can host a small CPU model now that CPU Basic needs PRO.
- The page is custom HTML served by `gr.Server` (a FastAPI subclass): `GET /`, `POST /api/judge`. `GRADIO_SSR_MODE=false` is needed for the custom `/` route.
- `preload_from_hub` pulls the model files at build time, so a woken Space doesn’t download them.
- Input is capped (4,000 chars, 32 KB body), with 20 requests/min per visitor and 300/min overall; nothing is logged.

The guard itself is laya-guard (MIT), hooks for Claude Code, Codex, Cursor, Gemini CLI and 7 more agents: [GitHub - scs0209/laya-guard: Free local guardrail for AI coding agents: every tool\_call judged on-device (regex + Laya), allow/review/block · GitHub](https://github.com/scs0209/laya-guard)

Feedback welcome, especially commands it gets wrong.

---

<div class="post-metadata">

**Author:** ![nootxlm](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nootxlm/32/63395_2.png) [@nootxlm](https://discuss.huggingface.co/u/nootxlm)\
**Post date:** [October 23, 2026, 5:56am UTC](https://discuss.huggingface.co/t/a-space-to-test-what-a-coding-agent-guardrail-says-about-a-shell-command/190936/2 "2026-10-23T05:56:07Z")

</div>

A useful early test: hold what a command does fixed and vary only how it is spelled — plain, wrapped in bash -c, assembled from variables, or decoded from base64 — and require the same verdict for every spelling; the share that flips is a direct measure of whether the guard is judging the effect or the surface text. The paired opposite matters too: near-identical spellings with different effects should reliably split.

---

<div class="post-metadata">

**Author:** ![capitaharlock](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@capitaharlock](https://discuss.huggingface.co/u/capitaharlock)\
**Post date:** [October 26, 2026, 7:38am UTC](https://discuss.huggingface.co/t/a-space-to-test-what-a-coding-agent-guardrail-says-about-a-shell-command/190936/3 "2026-10-26T07:38:16Z")

</div>

For the 4,000-character and 32 KB body caps on POST /api/judge, do oversized submissions get an explicit “not evaluated” response, rather than allow/review/block or a verdict on a truncated command?
