groundtruth-rules-ai

groundtruth-rules-ai is a command for Claude Code from akahkhanna/groundtruth. It costs 61 tokens per session (1,417 once invoked), scanned B, original, MIT.

An optional command that asks helper agents to read project rule documents and suggest additional Groundtruth rules. Groundtruth is a checking system for comparing agent work with documented rules.

In plain words
What is it for?
Reviewing CLAUDE.md, AGENTS.md, SCHEMA.md, and other rule files to propose safe, reviewable checks.
Why use it?
It can find rules written in normal prose that the default literal extractor would miss, while requiring approval before activation.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

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

Good fit Reviewing CLAUDE.md, AGENTS.md, SCHEMA.md, and other rule files to propose safe, reviewable checks.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add akahkhanna/groundtruth
Claude Code
/plugin install groundtruth

Made for: Claude Code.

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-ai

README.md
[![agentmods](https://agentmods.dev/badge/commands/akahkhanna/groundtruth/groundtruth-rules-ai.svg)](https://agentmods.dev/commands/akahkhanna/groundtruth/groundtruth-rules-ai)
Your own site
<a href="https://agentmods.dev/commands/akahkhanna/groundtruth/groundtruth-rules-ai"><img src="https://agentmods.dev/badge/commands/akahkhanna/groundtruth/groundtruth-rules-ai.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 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,417 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00061 $0.01417
Opus 5 $0.00030 $0.00709
Sonnet 5 $0.00012 $0.00283
Haiku 4.5 $0.00006 $0.00142

Measured 8d ago against content hash 9d1d4347b129, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade B, and why

groundtruth-rules-ai scanned grade B with 1 finding 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 8d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

`node "$(find ~/.claude/plugins -name compile-rules.mjs -path '*groundtruth*' | head -1)" .`)
commands/groundtruth-rules-ai.md · 70 lines

How it starts

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

Groundtruth — AI rule extraction (opt-in; not on by default)

Groundtruth's default rule compiler is deterministic — it only pulls the literal backtick forms (`X` not `Y`, never `X`) from your docs, with no model. This command adds an opt-in model pass: fan out an agent to read your rule docs in prose and propose the deterministic rules the literal extractor missed — then route them through the EXACT SAME safety pipeline (grounding + the /groundtruth-rules human approval gate). Nothing here arms a rule, and the model never runs unless you invoke this command.

Do this

  1. Fan out the reading. Use the Task tool to spawn subagent(s) — the Explore agent is ideal — to read this repo's rule docs: CLAUDE.md, AGENTS.md, SCHEMA.md, ARCHITECTURE.md, docs/*.md, every **/.claude/skills/**/SKILL.md, every **/.claude/agents/*.md, .cursorrules, .windsurfrules (whichever exist). If there are many docs, fan out one subagent per doc group and run them in parallel. If $ARGUMENTS names a path, focus there. Ask each subagent to return candidate rules only in this exact shape:
    { "id": "no-<slug>", "kind": "forbid_in_added", "file_re": "<regex>", "line_re": "<regex>", "message": "<the rule, one line>", "positive_example": "<a code line the rule SHOULD flag>" }
    
    • file_re — which files the rule applies to (\\.sql$, \\.(ts|tsx)$, …); a broad source set if unsure.
    • line_re — the forbidden token/pattern; anchor identifiers with \\b. JS RegExp syntax only — no PCRE/Python inline flags like (?i) (matching is already case-insensitive); a pattern that doesn't compile in JS is inert.
    • positive_example — a minimal line the rule is meant to catch. It PROVES the rule can fire: the grounder rejects (routes to review, never armable) any candidate whose line_re doesn't match its own example. Grounding otherwise only proves a rule doesn't hit existing code — never that it fires at all.

Read the full file on GitHub · 70 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. 8d ago First seen · 70 lines · 61 tokens per session scan B 9d1d4347b129

Subscribe to this mod's changes

groundtruth-rules-ai is a command published in the GitHub repository akahkhanna/groundtruth (6 stars, last pushed 1mo ago), licensed MIT. It adds 61 tokens to every session and 1,417 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.