Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>AI GuardrailNew to Visual Studio Code? Get it now.
AI Guardrail

AI Guardrail

up2you

|
15 installs
| (0) | Free
Tells your AI coding assistant the rules of your project and checks that it followed them, with free live rules and your team's own rules
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AI Guardrail

Your team's decisions as rules: told to the AI assistant before it writes, and checked in what it wrote.

Install it without an account and the free rules check your project at once. Your team's own rules come on top, with a subscription.

Every team has decisions no model can know. Controllers call a use case. Raw SQL stays in one layer. A test name is a sentence. This table has no tenant column. They live in a wiki, in review comments and in a test suite that says no long after the code was written. An AI assistant writes good code in general and has never heard any of them, so it guesses. AI Guardrail turns each decision into a rule:

  • One rule both tells and checks. The rule's one-line instruction goes into AGENTS.md, CLAUDE.md, Cursor and Copilot, and the same rule scans the code. What the assistant is told and what is enforced cannot drift apart
  • The mistake is stopped while it is written. With Claude Code, Cursor or Codex an edit that breaks a rule is refused before it reaches the file, in seconds and not at the end of a test run. In your editor it is underlined as you type
  • One place reaches every repository. A rule changed in your panel reaches every developer's editor, every repository's AI instructions and CI the next time they load the rules, with no release and no config file to copy

A rule is a pattern over text, so it catches what a decision looks like in code, not what the code means: "raw SQL only under Infrastructure" can be a rule, "this class does one thing" cannot.

Under your own rules sits a free set for what goes wrong in any project: a table name, a translation key or an environment variable used but defined nowhere, a helper copied when it already exists two folders away, a test skipped to get the suite green, an API key inlined to "make it work", a package that was never published. The checks do not care who wrote the code: npx ai-guardrail-cli --all-copies on a project written long before any assistant lists the copied blocks and broken references it already carries.

Every rule, the team subscription and the full guide: AI Guardrail on UP2YOU

Your code never leaves your machine

Scanning is fully local. The only things that ever leave your editor:

  • Rule requests — to up2you.app when the editor starts, a setting changes or you refresh the rules; once you connect an API key they carry a session token minted from it
  • Package names — checked against the npm registry (imports), PyPI (requirements*.txt, pyproject.toml) and Packagist (composer.json) on open, on save, when an open file or a closed file git sees as changed is written to disk and when the rules refresh, to catch hallucinated dependencies and, with a subscription, packages almost nobody downloads
  • Rule metadata — only if you explicitly send feedback (rule key, verdict, file language, engine version and your note — never code or file names)

There is no telemetry, and your code is never uploaded.

Your team's own rules

You write your team's rules in your panel, in the AI Guardrail app on UP2YOU: "dates are stored in UTC", "the database is reached only through the repository layer", "use our internal client, not fetch". A rule can do more than match a line:

  • Rules fit your architecture: limit a rule to the folders it is about or keep it out of some, and require a line every file must have, such as declare(strict_types=1);
  • What the code uses is defined: every translation key passed to t() exists in your locale file, nested keys and plural forms included, with the closest existing key suggested for a typo; on request, keys nothing uses are flagged too. A rule that finds no definitions, or none for over a quarter of its uses, is paused with a warning instead of underlining every use
  • Any of our rules can be replaced: publish a rule with the same key and yours takes its place for your team
  • False positives your developers report land in your panel, so you see which rule needs narrowing
  • Our pro rules come on top
  • Recipes to start from: dependencies that point inward, one HTTP client, settings read in one place, each with examples, in the guide's writing a rule section

Connect your team below has the steps.

No panel yet? Save a rule file, the same JSON array the panel imports, as .ai-guardrail/rules.json and commit it: the CLI, the agent hooks, the MCP server and the extension run up to 5 of its rules, in file order, for everyone who checks the repository out, and the AI instructions carry them. A rule the panel would refuse does not run, and the CLI note or the status bar tooltip says why; try the file first with --rules or test_rule. An agent may write a draft, but a change to .ai-guardrail/rules.json itself needs you: Claude Code asks, Cursor and Codex refuse it, and the shell cannot change it. Rules from a panel workspace come on top and win for the same rule_key; the panel has no limit and reaches every repository of the team. In VS Code the file is read when one folder is open.

What our rules catch

  • Missing environment variables: a variable the code reads with no default that .env.example does not list, so the next person to run the project does not find out by a crash. Projects without a .env.example are left alone
  • Tables no migration creates: in Laravel, a table name used in a query, a model or a validation rule that no migration creates, such as user for users. Projects without migrations are left alone
  • Copied code: a block of 6 or more lines you just added or edited that already exists in another file or further up the same one, with a link to the existing copy. Duplication already in your last commit stays quiet; test files, migrations and blocks made mostly of declarations (markup, fields, signatures, enum cases, parameter lists) are left out. The project is indexed in memory on your machine and kept current as you type, save, or change files with git
  • Shortcuts an assistant takes in new code: skipped tests, type and lint checks silenced with no rule named, placeholder code left in place of an implementation, and errors swallowed by an empty catch block. Only lines you added or edited count, so what is already committed stays quiet
  • AI slop in new code: oversized source files, long narrating comments and commented-out code, as warnings
  • Hallucinated dependencies: imports of npm packages that were never published, known typosquats with the correct name suggested, and names in requirements*.txt, pyproject.toml and composer.json missing from PyPI or Packagist
  • Secrets: provider API keys, tokens and private keys committed into code or documentation
  • Injection and unsafe output: SQL and shell commands built from strings, unescaped HTML, code built at runtime
  • Insecure defaults: TLS verification off, weak hashing, wildcard CORS, debug mode left on
  • AI SDK and agent misuse: model keys shipped to the browser, LangChain flags that let model output load pickles, run code or call any URL, and with a subscription our pro rules for model output and agent tools
  • Tampered agent setup: invisible characters and suspicious commands in AGENTS.md, CLAUDE.md, Cursor and Copilot rules; settings that approve every command; MCP servers without a pinned version or with a key written in them, in JSON settings and in Codex's .codex/config.toml

The full, current list is in the rule catalog on AI Guardrail on UP2YOU.

It scans JavaScript, TypeScript, Vue, PHP and Blade, Python, Go, Java, C# and Ruby files, Markdown documentation for real provider keys, AI agent rule files such as AGENTS.md, .mdc and .cursorrules, and JSON, YAML and TOML files for the rules written for them; which rules apply to each language comes from the live ruleset. Some new rules run as a trial: they are marked as a trial rule and never fail a build or block an edit while they are being measured.

Rules are live data, not extension code. They are maintained centrally and improve without extension updates: the editor loads the latest rules when it starts, when a setting changes, and when you click the status bar or run AI Guardrail: Refresh Rules.

What an AI agent writes reaches you too

Agents write to disk, usually in files you never opened. AI Guardrail scans closed files git sees as changed, so their findings appear in the Problems panel as the agent works, and clear when the change is committed or reverted. Turn it off with aiGuardrail.scanChangedFiles; AI Guardrail: Scan Changed Files runs it on demand.

With Claude Code the mistake is stopped while the agent writes, before it reaches the file. Run AI Guardrail: Install Claude Code Hook, or npx ai-guardrail-cli hook install yourself. The hook:

  • Refuses an edit whose new lines carry an error, and tells the agent how to fix it
  • Asks you before silencing: an edit that turns AI Guardrail off or adds a suppress comment opens a permission prompt whose reason starts with AI Guardrail:, and is made only if you allow it
  • Stops dangerous shell commands before they run: a recursive delete of the home or project folder, or a secret file sent over the network
  • Tells the agent about a copy as it writes one, from the workspace index the editor shares with it
  • Reports what a shell command wrote as soon as the command finishes. Such a file cannot be blocked, because what the command will write is not known beforehand
  • Does not let a turn end on an error: when the agent stops while a line changed since the last commit still carries an error, the hook sends it back once with the finding, to fix it or to tell you why it is leaving it

The status bar tooltip sums up what the hook blocked.

Cursor's agent gets the same hook with npx ai-guardrail-cli hook install --cursor: a file with an error is refused before it is written and a dangerous command before it runs. In Cursor, warnings reach the agent right after the write rather than with it. Codex's agent gets it with npx ai-guardrail-cli hook install --codex: a patch with an error in any of its files is refused before it is applied, once you trust the project and review the hook with /hooks in Codex. AI Guardrail: Set Up This Project installs whichever hook the project needs. The CLI guide has the details of each.

With Copilot or no assistant at all, git can check each commit instead: npx ai-guardrail-cli git-hook install adds a pre-commit check that scans what you staged, only the changed lines, and stops a commit with an error finding. A pre-commit file of your own, or one Husky or Lefthook manages, is left alone; the lines to add are printed instead. Under the Claude Code, Cursor or Codex hook an agent cannot change that check, or skip it with --no-verify, core.hooksPath or HUSKY=0; you can.

AI Guardrail works at four points: the instructions before the assistant writes, the hook while it writes, the pre-commit check when the work is committed, and CI on the pull request. The hook and the pre-commit check run on your machine, where a person can always skip them, so keep the CI step. In the usual terms, the rule instructions are part of the prompt; the instruction files, the hook's warnings and what the MCP tools return are part of the context the model sees; and the hook, the pre-commit check and CI are part of the harness around the model.

Getting started

Install the extension and open a project. The extension costs nothing, and the free rules load anonymously, with no account and no configuration.

The same extension is on Open VSX for Cursor, VSCodium and other editors that install from there: search for AI Guardrail in the Extensions view. In Cursor the extension underlines findings for you, and the Cursor hook, npx ai-guardrail-cli hook install --cursor, is what checks the agent; each works without the other.

To set up the rest in one step, run AI Guardrail: Set Up This Project. It opens a terminal and runs npx ai-guardrail-cli init, which finds the AI coding tools the project uses and sets up what fits them: the rules' instructions, the hook for Claude Code, Cursor or Codex, the git pre-commit check and the GitHub workflow. It shows what it will write and asks before writing anything; answer c to choose the steps one by one, for example only the hook. In a project that uses an AI coding tool the extension offers this once.

Connect your team

The app is a single payment for a month or a year of your team's workspace, and it never renews automatically. Buying it opens your team's panel at up2you.app → My apps → AI Guardrail. Once your team has it:

  1. Your admin adds you under the panel's Members tab, by the email of your UP2YOU account.
  2. Create an API key at up2you.app → Profile → API keys. Scope it to the AI Guardrail workspace so the key only reaches that app's data. The key is shown once — copy it.
  3. Run AI Guardrail: Connect with API Key from the command palette and paste it. The status bar shows AG: N rules (free + pro): our pro rules now apply; they are maintained by us and update without an extension release, like the free set.
  4. Once your team publishes a rule in the panel, it loads from the workspace the key is scoped to, with no setting, and the status bar shows AG: N rules (free + pro + org). A rule of yours overrides ours with the same key. Your panel holds only your team's rules; ours arrive without being imported.

When the subscription ends, the pro rules stop loading and are removed from the offline cache. Your team's own rules keep loading for 90 days, but the panel no longer accepts changes: nothing can be added, edited or published until you renew. After that the workspace is suspended and they stop too; your rules are kept and come back when you renew. The free set keeps working throughout.

Your UP2YOU password is never stored in the editor. Revoke a key any time from the same screen: within 24 hours its session ends, your team's rules and the pro rules stop loading and their offline cache is dropped — a refused key is not an outage. The free rules keep working and nothing else on your account is affected.

Found a false positive? Open the lightbulb menu on the finding → Report false positive. Your admin sees it in the panel.

Teach your AI assistant the rules

Run AI Guardrail: Write AI Instructions and pick your tools. Each rule's one-line instruction is written where the tool reads it. Only the rules that cover a language this workspace actually contains are written, so your assistant's memory stays about your project:

Tool File
AGENTS.md (Codex and others) A marked block in AGENTS.md; the rest of the file is yours and stays as is
Claude Code .ai-guardrail/instructions.md, imported by one line in CLAUDE.md
Cursor .cursor/rules/ai-guardrail.mdc
GitHub Copilot .github/instructions/ai-guardrail.instructions.md

Nothing is written until you ask, and a file that did not change is never touched. Commit the files so every teammate's assistant gets the same rules; your team's own rules are written too. To change what the assistant is told, edit the rule in the panel, not the file. In CI, npx ai-guardrail-cli instructions --check fails when the files fall behind the rules.

Suppressing a finding

// ai-guardrail-disable-next-line
// ai-guardrail-disable-next-line client-secret-leak
// ai-guardrail-disable-line client-secret-leak -- test fixture, AG-214

Naming the rule is optional; without a name every rule on that line is silenced. A name the scanner cannot read, such as one with an underscore or a capital letter, silences nothing and is flagged itself, so a typo never quietly hides every finding on the line.

Set aiGuardrail.suppressMode to strict to require a justification after -- — suppressions without one are void, and the comment itself is flagged.

A copied block is reported on its first line, so the comment goes above that line. A file missing a required line is reported on its first line: put ai-guardrail-disable-line with the rule key on that line. An undefined key is reported where it is used, so the usual comment works there; an unused key in a JSON file cannot carry a comment, so the rule's definition files are narrowed in the panel instead.

Commands

All of them are in the command palette:

Command What it does
AI Guardrail: Rescan Open Files Scans the open editors again, asking the registry about their packages
AI Guardrail: Scan Changed Files Scans the closed files git sees as changed and opens the Problems panel
AI Guardrail: Refresh Rules Fetches the rules now instead of waiting for the next start
AI Guardrail: Write AI Instructions Writes each rule's instruction into the files your AI tools read
AI Guardrail: Set Up This Project Runs npx ai-guardrail-cli init in a terminal: instructions and checks for the AI tools this project uses
AI Guardrail: Install Claude Code Hook Runs npx ai-guardrail-cli hook install in a terminal, for the hook alone
AI Guardrail: Connect with API Key Adds your team's rules and the pro rules of your subscription
AI Guardrail: Disconnect Removes the stored key; the free rules keep working

Settings

Setting Purpose
aiGuardrail.tenantId Another workspace's rules; empty uses the workspace your API key is scoped to. A user setting
aiGuardrail.ignore Extra path segments to skip (build output is skipped by default)
aiGuardrail.suppressMode simple (default) or strict
aiGuardrail.copiesInUnchangedCode Also report copied code that is unchanged since the last commit (default off)
aiGuardrail.scanChangedFiles Also report findings in closed files git sees as changed (default on)
aiGuardrail.instructions.targets Tools to write AI instructions for: agents, claude, cursor, copilot (empty = never write)
aiGuardrail.instructions.autoUpdate Rewrite the instruction files whenever the rules change (default off). A user setting

Files over 512 KB are skipped, the workspace index holds at most 20,000 files, and at most 500 changed closed files are scanned at a time. Build output (node_modules, dist, .next, bundles, minified files) is never scanned. To skip files for everyone on the project, add a .aiguardrailignore file at the workspace root; the CLI reads the same file. One entry per line: a bare name skips every folder or file with that name, an entry with a slash is a path from the root, and # starts a comment. aiGuardrail.ignore adds to it for your editor only. Offline, the last fetched rules keep working from the cache, and the status bar says so.

Command line and CI

The same rules, suppress comments, registry check, duplicate code check and cross reference check run outside the editor with the ai-guardrail-cli package:

npx ai-guardrail-cli --fail-on error

It prints file:line:column findings or JSON (--format json) and exits with 1 when a finding reaches --fail-on, so a CI job fails before the code is merged.

The same scan can leave a record for a reviewer or an audit: --report <file> writes a verification report that says which rules ran, what was checked, what was found or silenced by a suppress comment, and what was not checked. It never contains the matched text, and it shows what the rules found in the lines checked, not that the code is correct. The CLI guide shows how to put it on the summary page of a GitHub run.

For team admins

Your team's rules live in your UP2YOU panel: create and edit them with a form, import rule packs, review member feedback, and publish changes that reach every editor the next time it loads the rules and every repository's AI instructions on the next write. See the Docs tab in your app panel for the full guide.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft