constraints

A command-line interface for viewing and editing this project's coding rules, called constraints, and checking files against them.

In plain words
What is it for?
Use it to list active rules, check a file or code snippet, review violation history, and add or amend project constraints.
Why use it?
It shows why a coding action was blocked and lets you find violations before writing or changing files.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/fwornle/coding/constraints
Clone the repo
git clone --depth 1 https://github.com/fwornle/coding

Made for: Claude Code.

Per session 75 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 705 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00075 $0.00705
Opus 5 $0.00037 $0.00352
Sonnet 5 $0.00015 $0.00141
Haiku 4.5 $0.00007 $0.00071

Measured yesterday against content hash 3009653539db, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

constraints scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/constraints.md · 64 lines

How it starts

The opening of the file, as written. The whole thing — 64 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/constraints

The constraints CLI (bin/constraints) is the query and authoring surface for this project's guardrails. It runs in-process on the host, reusing ConstraintEngine — the same code the PreToolUse / UserPromptSubmit hooks run — so it works even when coding-services is down.

  • Rules: $CODING_REPO/.constraint-monitor.yaml (single canonical file, no cwd-walking)
  • Enforcement: the hooks, not this CLI. This CLI inspects; the hooks block.

When to use

  • Before writing a file you suspect touches a rule (parallel versions, console.*, PlantUML naming, backup files) — cheaper than being blocked and retrying.
  • After a hook blocks a tool call, to read the rule text and decide whether to fix or override.
  • When the user asks "what constraints are active?", "why did that get blocked?", or asks to add or amend a rule.

Commands

constraints list                       # every rule: ● enabled / ○ disabled, severity, message
constraints list --enabled-only

constraints check --file src/foo.ts    # read the file, check it, print violations
constraints check --file src/foo.ts --content 'const a = 1'   # check a snippet, keep the path label
cat buffer.ts | constraints check --file src/foo.ts           # stdin wins; --file is the path label

constraints status                     # compliance score, risk level, active violation count
constraints violations --limit 20      # recent violations and their metrics

constraints update rules.json          # array of {id, pattern, message, severity, enabled}
constraints update -                   # ...or the same JSON on stdin

--json on any command emits the raw payload. --verbose re-enables the engine's stderr logging.

Reading the output

check exits 1 when it finds an error or critical violation and 0 otherwise, so it composes directly:

constraints check --file src/foo.ts || echo "fix before writing"

Severity marks: 🛑 critical · ❌ error · ⚠️ warning · ℹ️ info.

Read the full file on GitHub · 64 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 64 lines · 75 tokens per session scan A 3009653539db

Subscribe to this mod's changes

constraints is a command published in the GitHub repository fwornle/coding (2 stars, last pushed yesterday), licensed MIT. It adds 75 tokens to every session and 705 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.