Skip to content

Walls and hooks

What the agent can NOT do even if it wants to — and what it is reminded of on its own.

Hooks in Node (.mjs, OS-agnostic: they work the same on Windows/macOS/Linux). The ones that BLOCK exit with code 2 and the reason; the rest only inform. Only Claude Code runs hooks: in Codex/Cursor/Windsurf the job is done by the activation tables of the generated rules and the githooks (sync.ps1 -GitHooks). Their messages come out in English, or in Spanish with --lang es (see INSTALL).

Hook Event What it does
session-start.mjs SessionStart Injects the state: whether Senzu is OUTDATED (what to do and what you lose, from core/novedades.json), stack/profile, the NEXT STEP of the method that is missing (/install, /adopt; without a plan, knowing what is being done or asking about it), language, own diary detected, versions with an EOL warning, adopted conventions, git, design system, plan, devlog and the skills protocol.
prompt-router.mjs UserPromptSubmit Suggests the skill that fits the request, in English or Spanish (signals from docs/skills.md), once per skill and session.
guard.mjs PreToolUse Bash/PowerShell Looks at what is EXECUTED, not what is quoted (commit messages, heredocs to a file, echo, grep). BLOCKS: git push to a main branch, forced or without seeing which branch it goes to (to working branches, yes), writing, moving, deleting or restoring the sealed conventions from the terminal (no escape for the agent), destructive DB/git commands, rm -rf, deploy to prod without approval (escape SENZU_ALLOW_DEPLOY=1), logo generators once a logo is chosen (SENZU_ALLOW_LOGO=1), jQuery/Bootstrap (SENZU_ALLOW_LIB=1), dangerous devops (curl|bash, chmod 777, dd, mkfs, docker prune, stopping services, flushing the firewall, crontab -r); commits: protected branch, Conventional ≤72, no co-authors.
supply-guard.mjs PreToolUse Bash/PowerShell Supply-chain wall. On an install command (npm/pip/composer…) it checks the package NAMES (typosquatting, known-malware denylist) before they land; on git commit it scans what is staged (dependency manifests, skill/plugin files and .mcp.json) for install scripts with network/shell, prompt injection, exfiltration (reads secrets and opens the network), obfuscation (eval/base64/hex), hidden unicode characters and MCP servers that download and execute. BLOCKS the serious ones, WARNS about the rest. “Quoting is not doing”: it looks at what is executed, not quoted text, and also INSIDE a script the command runs (bash x.sh, python x.py…). Offline and deterministic (lists in core/hooks/data/). Cannot be turned off. Escape after verifying: SENZU_ALLOW_SUPPLY=1.
pentest-guard.mjs PreToolUse Bash/PowerShell Pentesting SCOPE wall. BLOCKS running offensive-security tools: network scanning (nmap, masscan, hping3), web discovery and fuzzing (gobuster, ffuf, nikto, wpscan, nuclei, wfuzz), injection and exploitation (sqlmap, commix, metasploit/msfconsole/msfvenom), credential brute force (hydra, medusa, ncrack), cracking (hashcat, john) and network or AD enumeration and post-exploitation (enum4linux, crackmapexec, responder, evil-winrm, wifi). “Quoting is not doing”: it looks at what is executed, not quoted text, and also INSIDE a script the command runs (bash x.sh, ./x.sh…). Senzu helps with AUTHORIZED pentesting: with written permission and scope recorded in the devlog, escape SENZU_ALLOW_PENTEST=1. Cannot be turned off.
protect-files.mjs PreToolUse Edit/Write BLOCKS editing: files generated by Senzu, secrets (.env, *.pem, credentials), dependencies/build artifacts, versioned migrations, sealed conventions.md/json (cannot be turned off), masters of the chosen logo (logos/final/) and the project’s protectedPaths.
secrets-guard.mjs PreToolUse Edit/Write BLOCKS writing real credentials (AWS, GitHub, Stripe, OpenAI/Anthropic, PEM, JWT, strings with a password); ignores placeholders.
code-hygiene.mjs PreToolUse Edit/Write BLOCKS introducing (except in scripts in the agent’s temp folder): console.log/debugger/dd()/var_dump/ray, terms banned in gustos.md §No, git conflict markers, .only/.skip/xit in tests, and the anti-AI blacklist (availability badges, numbered sections). One-off escape: a senzu-allow comment.
conventions-guard.mjs PreToolUse Edit/Write BLOCKS code that breaks the executable rules in conventions.json (/adopt): the project’s convention wins. Cannot be turned off. The path is normalized (C:, C:/, Git Bash /c/, relative) before the rules apply.
arquitectura-guard.mjs PreToolUse Edit/Write Only if the project DECLARES its architecture (senzu/arquitectura/capas.json, from /adopt or /plan). BLOCKS what it introduces: a layer that uses one it may not (domain with framework or ORM, application with HTTP), a DDD context that reaches inside another, and the controller that talks to the database. WARNS about the request array passed instead of a DTO and new code outside the declared folders. Real imports: use + PSR-4, import + tsconfig aliases, Python modules. Cannot be turned off.
backend-guard.mjs PreToolUse Edit/Write BLOCKS introducing: destructive migrations in the part that gets applied (dropping or renaming columns or tables: expand → contract pattern), env() outside config/ in Laravel, personal data in logs (whole request, bodies, passwords or tokens), migrations without an honest down(), mass assignment (the whole request into the model) and swallowed errors (empty catch, except: pass). WARNS about several writes in the same function without a transaction and about a query inside a loop (N+1). Escape: senzu-allow with the reason.
security-guard.mjs PreToolUse Edit/Write WARNS (does not block; once per file and session) about injection sinks introduced into the code: XSS (dangerouslySetInnerHTML, v-html, set:html, {@html}, Blade {!! $x !!}, innerHTML/insertAdjacentHTML/document.write with a variable), SQL injection (Prisma $queryRawUnsafe, Laravel DB::raw/whereRaw with $, execute with an f-string or concatenation in Python) and command injection or dynamic execution (exec/execSync/shell_exec/os.system with a variable, shell=True, eval). It only looks at what is introduced and at code without comments. Per-line escape: senzu-allow.
pool-guard.mjs PreToolUse Edit/Write WARNS (does not block; once per file and session) about what exhausts the database connection pool in Node/TS and Python: new PrismaClient() without a global singleton (in serverless it opens one connection per invocation), and creating a pool/client/engine inside per-request code (routes, controllers, endpoints). PHP-FPM is out of scope. Recipe: code-quality/references/database-design.md (§Conexiones y pool).
back-skill-reminder.mjs PreToolUse Edit/Write (backend) First backend edit in the session: reminds of the stack recipe, the sealed conventions and the real framework version. Does not block.
depurar-coach.mjs PostToolUse Bash/PowerShell If a test, build or check that is EXECUTED fails (not when reading a test file), it switches on the method of the depurar skill (reproduce, failing test, hypothesis, narrow down, fix the cause). At most once every 20 minutes.
front-skill-reminder.mjs PreToolUse Edit/Write (front) First UI edit: BLOCKS once if there is no design system NOR brief (it forces asking); afterwards it reminds of ui-ux-pro-max, the MASTER icon set and the hard UI rules.
format-on-save.mjs PostToolUse Formats the saved file with the stack’s tool (Pint/Prettier/ruff) if it exists. Never blocks.
edit-tracker.mjs PostToolUse Records every file the session touches (for cierre-limpio) and marks that code was edited (stop-guard then requires verification).
memoria-viva.mjs UserPromptSubmit If you state a rule or a correction (“never again…”, “I told you…”, “from now on…”), it asks the agent to note it in the project memory or in yours (all your projects). Keeps your last requests for /resume.
memoria-archivo.mjs PreToolUse Edit/Write The first time a file is about to be touched, it gives the agent what the memory and the devlog say about it (decisions, what did not work). Does not block.
estado-sesion.mjs Stop · PreCompact Saves where the session left off (requests, files, what was left uncommitted, task in progress) for the next session and for /resume. On close, BLOCKS once if you gave a rule or a correction and it was not noted in the memory.
arranque-guard.mjs PreToolUse Edit/Write (code and manifests) BLOCKS, once per step and session, the first code edit if Senzu is not installed or /adopt is missing (a project with code and no conventions). Without a plan it does NOT block: it reminds that you need to know what is going to be done and, if it is not clear, to talk it over with the user; /plan or /brief only if it is big. Never for senzu/, CLAUDE.md, AGENTS.md or the documentation. The user can drop a step with init.mjs –omitir-paso.
tarjeta-guard.mjs PreToolUse Edit/Write (senzu/plan/PLAN.md) BLOCKS moving a card to [done] without «Verificado:» (verified: the real evidence), «Cumple:» (meets: how it meets its «Para qué», the user’s goal or the audit finding it solves) and a «Devlog:» that exists. The same for plan cards and /audit cards.
feature-guard.mjs Stop · PostToolUse Bash Backend. BLOCKS closing (once per set of files) if the session touched backend code and no test, if it created or touched migrations without running them or without testing their rollback (it records the migrate commands that run), or if the code uses new environment variables that are not in .env.example.
cierre-limpio.mjs Stop BLOCKS closing (once) if you leave uncommitted files you touched in this session: either finish and commit (on a branch), or commit and say what is missing. Changes you did NOT touch (another agent such as Codex, another session or the user) are only reported: they are neither committed nor discarded without asking.
stop-guard.mjs Stop BLOCKS closing (once) if something is missing: the day’s devlog, verify-build after editing code, or mobile ui-verify after touching UI. It also warns about heavy assets added in the last 24 h (images over 500 KB, fonts without woff2, large videos).
pre-compact.mjs PreCompact Re-injects the essentials (stack, versions, design system, plan, rules) to survive context compaction.
session-end.mjs SessionEnd Cleans up the session markers.

Escapes (always with the user’s explicit approval, recorded in the devlog)

Section titled “Escapes (always with the user’s explicit approval, recorded in the devlog)”

The SENZU_ALLOW_* keys go as a prefix of the command (SENZU_ALLOW_PENTEST=1 nmap …): they authorize only THAT command, not the whole session. Exporting the variable no longer opens the door.

  • SENZU_ALLOW_DEPLOY=1 — deploy to production after the /deploy checklist is approved.
  • SENZU_ALLOW_LIB=1 — install a banned library (jQuery/Bootstrap) if the user asks for it.
  • A senzu-allow comment on the line — a one-off exception to code-hygiene (CLI script with console.log, justified test .skip, anti-AI pattern requested by name).
  • Sealed conventions: they are changed by deleting conventions.* and running /adopt again (the user’s decision).