Kortex Guardrails
Set engineering rules in plain English. Enforce them automatically on every commit.
Overview
Kortex Guardrails lets engineering leads define rules for a project in plain English. From the moment rules are set, every commit — from every engineer and every AI agent — is checked against them automatically.
Violate a rule? The commit is blocked. Not flagged. Not warned. Blocked — with a plain English explanation of which rule was broken and why it exists.
Setting up Guardrails
1. Add rules in the dashboard
Go to your project page → Guardrails tab → add a rule with a title and description.
Examples:
- No direct database calls from route handlers — All database access must go through the service layer. Route handlers should only call service functions.
- All API responses must use the standard envelope — Every response must be wrapped in
{ data, error, meta }. Never return raw objects. - Never log sensitive user data — Do not log passwords, tokens, PII, or financial data. Use redacted placeholders.
2. Install the git hook
This installs a pre-commit hook that runs kodingo check-rules before every commit. If any rule is violated, the commit is blocked.
3. Every commit is now protected
When a violation is detected:
╔════════════════════════════════════════════════════════════╗
║ KORTEX GUARDRAIL VIOLATION — COMMIT BLOCKED ║
╚════════════════════════════════════════════════════════════╝
1 rule violated:
✕ No direct database calls from route handlers
All database access must go through the service layer.
→ This diff calls db.query() directly inside a route handler.
Fix the violations above or contact your engineering lead to update the rules.
To bypass in an emergency: git commit --no-verify
How it works
When a commit is made, Kortex:
- 01Captures the staged diff via
git diff --cached - 02Fetches all rules for the project
- 03Checks the diff against each rule using Kortex inference (Claude Haiku)
- 04If any rule is violated, exits with code 1 — blocking the commit
- 05If all rules pass, the commit proceeds normally
Emergency bypass
If you need to commit urgently and bypass guardrails:
Only use this in genuine emergencies. Bypassed commits are not checked and violations will not be reported.
Managing rules
Rules are managed from the Guardrails tab on your project dashboard. Any team member with project access can view rules. Adding and deleting rules requires dashboard access.
Checking rules manually
Runs the guardrail check against your current staged diff without making a commit.