Skip to content

Chapter 2 of 7

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 26, code-guardian itself plus companions
Guard scripts 27 plus 2 libraries; their rules live in 17 Python modules
Hook registrations 29 in total: PreToolUse 11, Stop 9, PostToolUse 5, one each for UserPromptSubmit, SessionStart, SessionEnd and SubagentStop
Review agents 13, 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 64 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. Every tool call passes through the PreToolUse guard scripts: deny, ask or allow.
  5. PostToolUse hints add context.
  6. At the end of the response, the Stop guard scripts run, among them cold review, finding check, task list, retrospective, evidence, mandate, legal and data analysis.

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

Diagram

How a request travels through Code GuardianFlow: your request passes the intake, the skill picks the mode, review agents judge. Every tool call passes the PreToolUse gates (deny, ask, allow), then the PostToolUse hints, and at the end the Stop gates.Your requestIntakeUserPromptSubmitSkill and mode26 skills · 5 modes · 7 gatesReview agents13 agents · judgement only, no Edit or Write toolEvidence to .code-guardian-evidence/Tool callBash, Edit, Write, MCPPreToolUse11 gatesPostToolUse5 hintsEnd of answer9 Stop gatesdenyaskallow
How a request travels through Code Guardian

In one sentence

Every tool call passes through hook registrations that deny, ask or allow, while skills and review agents judge without changing anything themselves.

This chapter as a task for Claude

Copy it, replace the angle brackets with your own details, paste it into 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.