Forge provides two runtime hooks that bring architecture enforcement directly into your AI agent’s edit loop. forgeSentinel is a non-blocking reporter: it fires after a file has been written and surfaces any new violations as a reminder, letting the agent correct them in the next step. forgeSmith is a write gate: it fires before a file is written and can outright deny the operation if the proposed content introduces a CRITICAL or ERROR violation. The two hooks cover different agents and different points in the write lifecycle, but they share the same underlying detection logic, guaranteeing consistent results everywhere.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ronaldjdev/forge/llms.txt
Use this file to discover all available pages before exploring further.
forgeSentinel — Violation Reporter
forgeSentinel is a PostToolUse hook: it runs after the agent has already written a file. Its job is to analyze the modified file against all active architecture rules (R1-R13) and report any violations as a reminder so the agent can self-correct.When It Runs
forgeSentinel fires after any of the following tool invocations:| Agent | Tool(s) That Trigger the Hook |
|---|---|
| Claude Code | Edit, Write, MultiEdit |
| Codex CLI | Edit, Write, apply_patch |
| OpenCode | Via SKILL.md system |
What It Does
Identifies the modified file
Reads the path of the file that was just written from the tool-use output.
Runs violation detection
Invokes the shared detection logic in
forgeSentinel-lib.mjs against the modified file, checking all rules R1-R13.Invoking Manually
You can run forgeSentinel directly from the command line using the path appropriate for your agent:Shared Detection Library
All forgeSentinel adapters delegate toforgeSentinel-lib.mjs, which contains the canonical violation-detection functions:
| Function | Rules Checked |
|---|---|
checkLayers() | R1-R9 — layer dependency rules |
checkImportConventions() | R10-R12 — import format conventions |
checkPlatformForDomain() | R13 — domain artifacts inside platform/ |
forgeSmith — Write Gate (Cursor Only)
forgeSmith is a preToolUse hook available exclusively in Cursor. Unlike forgeSentinel, it intercepts the write before it happens and can return aDENY decision, preventing the file from being written at all.
When It Runs
forgeSmith fires in Cursor before any file write operation. It analyzes the proposed file content — not the existing file on disk — for architecture violations.What It Does
Intercepts the proposed write
Receives the full proposed file content before it is committed to disk.
Analyzes for CRITICAL and ERROR violations
Runs the same detection logic from
forgeSentinel-lib.mjs against the proposed content, focusing on rules that produce CRITICAL or ERROR severity.Severity Threshold
| Severity | Violation Examples | forgeSmith Decision |
|---|---|---|
| CRITICAL | R1, R2, R5, R6, R10, R12, R12b, R13 | DENY |
| ERROR | R3, R4, R8, R9, R11 | DENY |
| WARNING | R7 | Allow (report only) |
Managing the forgeSmith Hook
Inline Ignores in Hooks
Both forgeSentinel and forgeSmith respect inline ignore comments. If a violation on a specific line is intentional, annotate it and the hook will skip that line:Hook Summary
forgeSentinel
PostToolUse — fires after write. Non-blocking reporter for Claude Code, Codex CLI, and OpenCode. Shared library:
forgeSentinel-lib.mjs.forgeSmith
preToolUse — fires before write. Blocking write gate for Cursor. Denies CRITICAL and ERROR violations before they reach disk.