Saltar al contenido

Capítulo 2 de 7

Este capítulo solo está disponible en inglés y alemán. Está leyendo la versión en inglés.

Architecture

Code Guardian consists of skills, hook registrations, review agents and Python-backed guard scripts that work together on every call. This page describes the building blocks and the flow.

Building blocks

Block Scope
Skills 31, code-guardian itself plus companions
Hook scripts 15 plus 3 libraries; their rules live in 28 Python modules. Four of them block outright, two only in narrow cases, two only once switched on; the rest give hints or are deregistered
Hook registrations 15 in total: PreToolUse 6, Stop 1, PostToolUse 4, one each for UserPromptSubmit, SessionStart, SessionEnd and SubagentStop (without switched-on gates; each one adds a Stop registration)
Review agents 15, none of them carries an Edit or Write tool
Gates 7: finding, decision, deploy, data, migration, dependency, legal
Modes 5: plan, build, debug, cleanup, data analytics
Tools 82 detectors and helpers

Review agents judge, they do not change code or files. Their evidence is written as a fragment to .code-guardian-evidence/.

Flow of a call

  1. A prompt arrives, the UserPromptSubmit hook runs the intake.
  2. A skill picks the matching mode.
  3. Review agents judge.
  4. Commands pass through the PreToolUse guard scripts: deny, ask or allow. Edits to credentials or to the guards themselves are stopped only in unattended runs and in autopilot, option questions only in autopilot.
  5. PostToolUse hints add context.
  6. At the end of the response, the Stop hook runs. It can only block there through the legal and data analysis checks, and only once they are switched on (off by default). Cold review, finding check, task list, retrospective, evidence and mandate are working instructions in the skill and do not stop anything.

The command guard scripts also apply to MCP calls, not only to Claude Code's built-in tools.

Diagram

El recorrido de una solicitud a través de Code GuardianProceso: su solicitud pasa por el intake, el skill elige el modo y los agentes de revisión emiten su juicio. Los comandos, los cambios de archivos y las preguntas de decisión pasan por los bloqueos PreToolUse (denegar, preguntar, permitir), después por los avisos PostToolUse y, al final, por el hook Stop (bloqueante solo con los gates activados).Su solicitudIntakeUserPromptSubmitSkill y modo31 skills · 5 modos · 7 gatesAgentes de revisión15 agentes · solo juicio, sin herramienta Edit ni WritePruebas en .code-guardian-evidence/Llamada a herramientaBash, Edit, Write, MCPPreToolUse6 bloqueosPostToolUse4 avisosFin de la respuesta1 aviso Stopdenegarpreguntarpermitir
El recorrido de una solicitud a través de Code Guardian

In one sentence

Commands pass through hook registrations that deny, ask or allow, while skills and review agents judge without changing anything themselves.

Este capítulo como encargo para Claude Code

Cópielo, sustituya los marcadores entre corchetes angulares por sus propios datos y péguelo en Claude Code. El encargo está escrito para Claude Code.

Using the installed Code Guardian files in this project, explain which mode applies to my current task and which gates come into play.