v1.1 · MIT

Make Claude Code actually follow the rules.

hardgate installs 7-location enforcement on any Claude Code plugin, skill, or slash command so the harness physically cannot ignore it. Not advisory. Not "please remember." A real exit 2 that blocks the tool call before it executes.

The problem

You write a skill that says "always use context-mode instead of raw Bash." You put it in CLAUDE.md. You add it as a Hard Rule. Claude Code follows it for a while, then quietly stops — especially in long sessions when the rule scrolls out of attention, or when it's rushing to finish.

Skills, CLAUDE.md rules, and slash commands are all advisory. The model reads them and chooses to comply. Under pressure, it chooses not to. Hardgate makes compliance non-optional.

Three enforcement levels

Level 3 — Blocking

PreToolUse hook returns exit 2. The harness blocks the tool call. The model doesn't get to choose.

Level 2 — Reminder

SessionStart injection + per-turn memory file. Keeps the rule visible in long sessions.

Level 1 — Advisory

CLAUDE.md rule text. Gives the model refusal language so it doesn't thrash when blocked.

Install in 90 seconds

mkdir -p ~/.claude/skills/hard-gate-installer ~/.claude/commands

# drop SKILL.md, hard-gate.md, disable-gate.md into place
# restart the Code tab

/hard-gate

The skill discovers your installed plugins, skills, and commands, asks which one to gate, writes all 7 artifacts, and gives you a paste-ready test prompt. Restart, paste, verify.

Requirements

Claude Desktop with Cowork enabled (Windows or Mac), or Claude Code CLI. Any paid plan. Python 3 on PATH. The target you want to gate must already be installed.