groundtruth-rules

groundtruth-rules is a command for coding agents from akahkhanna/groundtruth. It costs 19 tokens per session (1,169 once invoked), scanned A, original, MIT.

A review gate for proposed Groundtruth rules, which are automated checks compiled from a project's documentation.

In plain words
What is it for?
It lists proposed and already-active rules and supports approving selected rules, approving all clean rules, or disabling rules by ID.
Why use it?
It lets developers decide which suggested rules become active, so extracted guidance is not enforced without approval.

Command

Part of the groundtruth plugin — 7 commands, 5 hooks shipped together

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/akahkhanna/groundtruth/groundtruth-rules
Clone the repo
git clone --depth 1 https://github.com/akahkhanna/groundtruth

Or install groundtruth, the plugin that ships this one along with the rest of its 7 commands, 5 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for groundtruth-rules

README.md
[![agentmods](https://agentmods.dev/badge/commands/akahkhanna/groundtruth/groundtruth-rules.svg)](https://agentmods.dev/commands/akahkhanna/groundtruth/groundtruth-rules)
Your own site
<a href="https://agentmods.dev/commands/akahkhanna/groundtruth/groundtruth-rules"><img src="https://agentmods.dev/badge/commands/akahkhanna/groundtruth/groundtruth-rules.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,169 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.00019 $0.01169
Opus 5 $0.00010 $0.00584
Sonnet 5 $0.00004 $0.00234
Haiku 4.5 $0.00002 $0.00117

Measured 4d ago against content hash 88c33d8bb303, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

groundtruth-rules 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 4d ago.

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.

commands/groundtruth-rules.md · 32 lines

How it starts

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

Groundtruth's compiler reads your project's rule docs — CLAUDE.md, SCHEMA.md, **/ARCHITECTURE.md, docs/*.md, every .claude/skills/**/SKILL.md, every .claude/agents/*.md, .cursorrules/.windsurfrules — and proposes deterministic rules. Nothing is enforced until you approve it here. This command is that gate.

Argument: $ARGUMENTS — empty or list ⇒ just show the candidates; approve-all ⇒ arm every clean candidate; unarm <id …>remove those rules from the active set (silence a rule that's firing wrongly — the verdict card prints each rule's [id] for exactly this); otherwise a space-separated list of rule ids to arm.

Do this:

  1. Read .claude/groundtruth/proposed-rules.json (the candidates) and .claude/groundtruth/compiled-rules.json (already-approved/active — may not exist yet). If proposed-rules.json is missing, the compiler hasn't run: tell the user to start a fresh session (init re-proposes) or run node "<plugin>/hooks/compile-rules.mjs" . from the repo root, then stop.

  2. Present the candidates, grouped — be concise, one line each:

    • Already armed (in compiled-rules.json): id · severity · message.
    • Clean — safe to approve (proposed, status: "armable", not already armed): id · message · source. These match zero existing code lines, so arming them can only fire on new code — low risk.
    • Needs review (status: "review"): id · message · hits existing code matches · the sample line. Warn the user: a candidate that already matches committed code is either (a) catching a real existing problem, or (b) over-broad and will false-fire on legitimate code (e.g. a doc says avoid `map` but .map( is everywhere). Only arm one of these if you've read the sample and confirmed it's a real rule with the right scope.
  3. Decide what to do based on the argument:

    • approve-all → arm all clean candidates only. Never auto-arm a review candidate — those need a human eye.
    • unarm <id …>remove exactly those ids from compiled-rules.json (write back the array minus them; if a named id isn't armed, say so and skip it). This is the frictionless "silence a wrong rule" path — no doc edit, no restart. Confirm which were removed and that they stop firing next turn. Then STOP (don't fall through to the arm path).
    • a list of ids → arm exactly those (a review candidate is allowed only when explicitly named).
    • empty / list → show the table, write nothing, and end with a crystal-clear next action the user can copy verbatim — e.g.:

      To arm all N clean rules, reply with the whole line: /groundtruth-rules approve-all — or just tell me "approve the clean rules" in plain words and I'll arm them. To pick specific ones: /groundtruth-rules <id> <id>. To skip for now: do nothing — nothing is enforced until you approve. Note for the user: a bare approve-all or rule id typed on its own gets read as a command name and fails with "unknown command" — type it as an argument on the same line as /groundtruth-rules, or just ask in plain language (this command runs as me, so I can arm them from a natural-language request too).

  4. To arm: write .claude/groundtruth/compiled-rules.json as the union of (already-approved rules) + (newly approved candidates). For each rule keep only the runtime fields — id, source, kind, file_re, line_re, severity, message, and unless_re if present — and drop the proposal-only fields (status, hits, sample, positive_example, reason). Default severity to "warn". Preserve the existing severity of any already-approved rule (never demote a human's block back to warn). Dedup by id. Write valid JSON (an array).

  5. Confirm: "Armed N rule(s) at warn. Active next turn — the Stop hook re-reads compiled-rules.json each run; no restart. To make one halt the turn instead of warn, set its severity to "block" (or /groundtruth-block on for global block mode). After editing your docs, start a new session (init re-proposes) and re-run /groundtruth-rules to approve the delta."

Read the full file on GitHub · 32 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. 4d ago First seen · 32 lines · 19 tokens per session scan A 88c33d8bb303

Subscribe to this mod's changes

groundtruth-rules is a command published in the GitHub repository akahkhanna/groundtruth (6 stars, last pushed 1mo ago), licensed MIT. It adds 19 tokens to every session and 1,169 once invoked, about $0.0001 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.