๐Ÿค CoalMine

August 13, 2026 ยท View on GitHub

๐Ÿค CoalMine

A mine's canary dies first so the miners live โ€” these nine die first so your codebase lives.

9 Quality-Safeguard Canaries for AI Coding Agents โ€” Detect code rot, weak rules, hallucinations, supply-chain vulnerabilities, brittle architectures, and API contract drift before they pollute your codebase.

version license status SKILL.md skills

Claude Code Antigravity Cursor Codex Gemini CLI Cline Copilot claude.ai

Design Principles ยท Benchmark ยท Contributing ยท Changelog ยท Security ยท Privacy ยท Releases

Part of TheColliery โ€” siblings: CoalTipple (model/effort routing) ยท CoalBoard (consensus & debate board) ยท CoalHearth (session warm-resume) ยท CoalFace (fan-out discipline) ยท CoalWash (memory defrag) ยท CoalLedger (docs health).


๐Ÿค The 9 Canaries

Skill NameCatchesRun Mode
rot-canaryDead code, bugs, resource leaks, race conditions, silent failures, stale docsAuto + Manual (runs on session end / manual trigger)
gold-standardAudits project completeness against world-class exemplarsOne-time (triggered once, governs the session)
source-groundingPrevents AI hallucinations by forcing cross-source verificationAlways-on (background rule for all chat sessions)
supply-chain-auditAudits dependency vulnerabilities, licenses, phone-home code, and build/CI securityOn-demand (manually run when relevant)
resilience-auditAudits failure path handling (FMEA), rollbacks, retry limits, and idempotencyOn-demand (manually run when relevant)
telemetry-canaryAudits observability, log structures, metrics, and telemetry qualityOn-demand (manually run when relevant)
testability-canaryAudits testing ease, code coupling, mockability, and Dependency Injection (DI)On-demand (manually run when relevant)
scale-canaryAudits performance scaling issues, O(N2)O(N^2) loops, and duplicate (N+1) database queriesOn-demand (manually run when relevant)
drift-canaryPrevents contract and schema drift (API/database contract inconsistencies)On-demand (manually run when relevant)

Run Mode Details:

  • ๐Ÿ“Œ Always-on: Runs implicitly in the background to verify facts.
  • ๐Ÿ”„ Auto + Manual: Scans affected files at session end via lifecycle hooks (auto-wired in Claude Code; manual snippets in platform-configs/hooks/ for other agents). Manual trigger via /rot-canary.
  • โšก One-time: Governs the session by scanning and filling project-local rules.
  • ๐ŸŽฏ On-demand: Manually run for specific tasks to conserve tokens.

Canaries follow grounding in evidence, zero grade inflation, and report before fixing. Fixes apply through a safe loop: Stash/Commit -> Apply fix -> Run build+tests -> Auto-revert if tests fail.


๐Ÿ”Œ Universal Agent Support

SKILL.md is an open standard compatible with all major AI coding agents:

AI AgentTarget Skills FolderInstallation ShortcutChoice Tool Support
Claude Codeplugin cache (recommended) or ~/.claude/skills//plugin install coalmine@coalmineโœ… Native: AskUserQuestion
Antigravity.agents/skills/node scripts/install.mjs antigravityโœ… Native: built-in question prompt
Cursor.cursor/skills/node scripts/install.mjs cursorโœ… Native: built-in ask-question tool
Devin Desktop (ex-Windsurf).windsurf/skills/node scripts/install.mjs windsurfโœ… Native: suggested_responses
GitHub Copilot.github/skills/node scripts/install.mjs copilotโœ… Native: askQuestions
Cline.claude/skills/node scripts/install.mjs clineโœ… Native: ask_question
Gemini CLI (business-tier; individual tiers ended 2026-06-18 โ†’ Antigravity CLI).gemini/skills/node scripts/install.mjs geminiโœ… Native: ask_user
Goose.agents/skills/node scripts/install.mjs gooseโš ๏ธ Text Fallback: no question tool
Amp.agents/skills/node scripts/install.mjs ampโš ๏ธ Text Fallback: tool not documented
Junie.junie/skills/node scripts/install.mjs junieโš ๏ธ Text Fallback: tool not documented
Codex.agents/skills/node scripts/install.mjs codexโœ… Native: request_user_input
Kiro.kiro/skills/node scripts/install.mjs kiroโš ๏ธ Text Fallback: tool not documented
Augment Code.augment/skills/node scripts/install.mjs augmentโš ๏ธ Text Fallback: tool not documented

Skill paths follow the cross-vendor Agent Skills spec. Cline reads .claude/skills/, Junie reads .junie/skills/, Kiro reads .kiro/skills/, Augment reads .augment/skills/, others use .agents/skills/.

What ports where

PartPortable?
The 9 skills (the audits)โœ… All targets natively via Agent Skills spec
Interactive choice menus (ask_question)โœ… Native question tools on most agents; text fallback on Goose/Amp/Junie
Sub-agent fan-out + tiersโœ… Supported if host has sub-agent system; inline fallback
rot-canary auto-cadenceโœ… Auto-wired on Claude Code; ๐Ÿ”ง primed on Antigravity 2.0 via a one-time hooks.json copy (see Install) + manual snippets in platform-configs/hooks/ for other hook-capable agents; โ›” unsupported on Cline/Junie

Manual Fallback: Copy conformed skill body from plugin/skills/<name>/SKILL.md (strip YAML frontmatter) into AGENTS.md / rules file.


๐Ÿš€ Install

Per-platform, at a glance โ€” every canary is a read/analyze skill, so it runs wherever a SKILL.md loads; only the rot-canary auto-cadence hook is host-dependent (Claude Code auto-wires it; a manual snippet covers other hook-capable hosts).

PlatformTierInstall
Claude Codevalidated/plugin marketplace add HetCreep/CoalMine โ†’ /plugin install coalmine@coalmine (Option A) โ€” auto-wires the rot-canary Stop-hook
Antigravityvalidated (canaries) ยท primed (auto-cadence)file-copy the skills to the global ~/.gemini/config/skills/ or per-project <workspace>/.agents/skills/ (node scripts/install.mjs antigravity); for the full auto-cadence (conductor + rot-canary) on AG 2.0's hook engine, copy platform-configs/hooks/antigravity-hooks.json to <workspace>/.agents/hooks.json or ~/.gemini/config/hooks.json and adjust the CoalMine path
Cursor ยท Codex ยท Cline ยท Copilot ยท Gemini CLI ยท โ€ฆworks withnode scripts/install.mjs <agent> โ€” file-copy into the agent's skills folder (targets in Universal Agent Support)
claude.ai (web / app)works withDownload a per-skill ZIP from Releases and upload as a custom skill (Option A3) โ€” read/analyze skills only, manual invocation, no hooks

primed (the Antigravity auto-cadence status โ€” a feature-automation marker, never a platform-trust tier; Antigravity's own platform tier is validated above, independent of this) = built + hermetically tested against the empirically-verified AG 2.0 hook spec (pilot 2026-07-12 โ€” which did fire CoalMine's Stop cadence live on AG; corroborated against the official docs 2026-07-13). Delivery of the injected context into the agent is emitted per spec but not yet confirmed end-to-end โ€” one real AG session run flips it to confirmed. The 9 canaries themselves are already validated on AG.

Option A โ€” Claude Code Plugin (No clone needed)

/plugin marketplace add HetCreep/CoalMine
/plugin install coalmine@coalmine

๐Ÿ”ง Maintainers: plugin/ is generated output. After edits in skills/, skills/_shared/, hooks/, or .claude-plugin/plugin.json, run node scripts/build-plugin.mjs.

Option A2 โ€” skills.sh (One line)

npx skills add HetCreep/CoalMine

Option A3 โ€” claude.ai (web / desktop app)

Download a canary's ZIP from the Releases page (one asset per skill, built by CI on every tag) and upload it as a custom skill (Settings โ†’ Capabilities โ†’ Skills). Manual invocation only โ€” no hooks there. Don't hand-zip skills/ yourself โ€” our own frontmatter description runs up to our 1024-char cap, well past claude.ai's 200-char skill-listing limit; every published ZIP has its description deterministically trimmed to fit (scripts/build-claude-ai-zips.mjs, source skills/*/SKILL.md files are never edited). Each Release also carries a SHA256SUMS.txt covering every ZIP โ€” you'll typically have just the one skill's ZIP, not all nine, so verify with sha256sum --ignore-missing -c SHA256SUMS.txt (the plain -c form reports the other eight as FAILED). On Windows: $f='rot-canary.zip'; (Get-FileHash $f).Hash -ieq (Select-String $f SHA256SUMS.txt).Line.Split()[0] (swap in the ZIP you downloaded). Steps + capability notes: CLAUDE-AI-INSTALL.

Option B โ€” Universal Installer

1. Clone the Repository

git clone https://github.com/HetCreep/CoalMine.git

2. Run the Installer

Run from your project's root folder (not inside the CoalMine clone):

cd /path/to/your-project
node /path/to/CoalMine/scripts/install.mjs <agent|all|PATH>
  • Supported <agent>: antigravity, cursor, codex, cline, copilot, windsurf, amp, goose, junie, gemini, kiro, augment (for claude, prefer the plugin above) โ€” see Universal Agent Support for target folders + choice-tool support.
  • all auto-detects and installs to all configured agents in the directory.
  • The installer sets up pre-commit/pre-push gates where git actually reads hooks โ€” your core.hooksPath if the repo sets one (husky, lefthook, a tracked .githooks/), otherwise .git/hooks โ€” writes trigger rules, and generates .coalmine.json config.

3. Verify & Uninstall

  • Verify: node /path/to/CoalMine/scripts/verify.mjs <agent|PATH>
  • Uninstall: node scripts/install.mjs --uninstall <agent|PATH>

Commands

CommandWhat it does
the 9 canariesSee The 9 Canaries โ€” each triggers on its own name/keywords (e.g. /rot-canary) or matching conversation context
/coalmine:statsMeasurement dashboard โ€” canary activity this session + rule-freshness status across the project's rules home
/coalmine:updateSelf-update โ€” check for a newer CoalMine version and offer to apply it, or set how updates are handled

๐Ÿ”‹ One button: install โ€” the suite drives itself

Installing is the power button. The agent conducts the canaries and asks for consent before running expensive tasks:

WhatWhen it firesYour part
gold-standardOffered once on new projects, and again when a rule's revalidate date passesRun now / Queue / Skip
rot-canaryAuto-scans touched files at session end (QUICK); findings end with a fix menuChoose a fix option
memory-drift advisoryOne quiet systemMessage (reaches the session transcript and an interactive user) at session end when code changed but no MEMORY.md update was recorded โ€” not part of the scan report, never blocks; needs a root MEMORY.md, off via memoryDriftNudge=falseUpdate MEMORY + crystallize if worth keeping
SpecialistsOffered when conversation enters their domain (deps, schemas, async, loops, etc.)Accept / Skip
source-groundingAlways-on background fact verificationโ€”

Consent Rule: Nothing expensive runs silently. Revocable via .coalmine.json, ~/.claude/.rot-canary-off, or --uninstall.


โš™๏ธ Configure (.coalmine.json)

Zero-config to start โ€” and two config levels when you want them: a global ~/.claude/.coalmine.json overlaid per key by the project config (project wins), so a globally-installed CoalMine can be tuned or shut off per project โ€” a project that doesn't need it stops loading (and burning tokens) there (disabledCanaries: ["all"] is the full off-switch; enableConductor: false silences only the session-start conductor, leaving rot-canary's auto-scan running).

Where the per-project config lives โ€” the read order (identical across the series, one flock): (1) <project>/.<the running agent's own dir>/coal/coalmine.json โ€” the dir of the agent actually executing (Claude Code: .claude); (2) other known agent dirs, fixed order .claude โ†’ .agents โ†’ .gemini (first found wins); (3) LEGACY: <project>/.coalmine.json at the project root (the pre-2026-08-08 shape) โ€” still read normally, no breakage for an existing config. The installer generates the default at the new own-dir home for a never-configured project (an existing config at any candidate, including the legacy path, is left alone); node scripts/configure.mjs writes back wherever the config was found, migrating a legacy-location config to the new own-dir home on that write (nothing is auto-moved on a mere read). Write the global layer with node scripts/configure.mjs --global <flags>. The high-impact keys:

KeyDefaultWhat it does
languageautoLanguage for prompts and nudges (auto | en | th | ja | zh | es)
enableConductortrueMaster switch for rules injection at session start
rotCanaryModeautorot-canary session-end auto-scan (auto | manual | off)
memoryDriftNudgetrueQuiet session-end advisory when code changed but MEMORY.md didn't โ€” no report, never blocks (needs a root MEMORY.md)
defaultTierautoForce an execution tier (Light | Standard | Heavy | auto)
disabledCanaries[]Canaries to disable (e.g. ["rot-canary"] or ["all"])
scanExcludePaths[]Path fragments/globs skipped by the session-end auto-scan โ€” lab tooling only (scratch probes, one-shot harnesses); shipped/tracked source is never excluded by this key

Full key reference: every key + default lives in scripts/lib/config-schema.mjs and the commented template platform-configs/.coalmine.json โ€” or run node scripts/configure.mjs --help.


Permissions

CoalMine asks for the least it needs: read (main + spawned scan workers, repo-scoped) ยท exec for read-only probes only (build --dry, lint, dead-code checks) ยท scratch-write confined to os.tmpdir() session state and one ~/.claude update-check stamp ยท ask before any fix or spend. It never requests target-file writes or deletes, and its hooks/scripts never touch the network on their own โ€” a canary's own web check (source-grounding, CVE lookups) is the agent's own judgment call through its normal tools, not a CoalMine background call. A spawned scan worker gets strictly less than the orchestrator: no spawn power of its own, no write/delete tools, no prompts to the user. Hooks auto-wire on Claude Code and carry a tested Antigravity 2.0 contract on the same files โ€” capability-keyed, never a hardcoded platform list.

Full series matrix + the must-fail set: Permission Matrix


๐Ÿ“ Ultra-Short Summary Format

Canaries report in a lean shape (one-line verdict + severity table of confirmed findings) to save tokens. Seven canaries (all but gold-standard/source-grounding, whose output isn't per-defect) call Claude Code's ReportFindings panel when it's callable โ€” click-to-file, fix-lifecycle tracking, no chat duplication; the table below is the fallback wherever the panel tool isn't available:

| # | path:line | category | severity | finding | evidence |

Severity levels: CRITICAL ยท HIGH ยท MEDIUM ยท LOW. Clean scan outputs a single line.


โšก Escalation Tiers

TierTriggerOrchestrationToken Cost
LightSmall scope / targeted reviewPrimary agent, quickVery Low ๐ŸŸข
StandardModerate scope / module reviewMulti-threaded routing, detailedModerate ๐ŸŸก
HeavyLarge scope / release prepSub-agent fan-out, deep pathsHigh ๐Ÿ”ด

๐Ÿ“Š Benchmark

Headline (measured 2026-07-03, skill v3.8.4): 7 canaries measured over 82 fixtures (60 planted defects + 22 clean decoys) ร— 4 engines (Claude Fable 5 / Opus 4.8 / Sonnet 5 + Gemini 3.5 Flash), K=3-5 repeated runs per arm โ€” recall at 100% on 5 of 7 suites for every engine ยท zero decoy false alarms across the entire batch (~200 clean-file opportunities) ยท the two suites that separate engines are drift-canary (88% median โ€” engines split on which side is authoritative) and rot-canary (92% median on opus/haiku/AG โ€” the one item needs whole-file reachability reasoning).

Each canary is measured AV-Comparatives-style โ€” recall, precision, decoy false-positives, and severity accuracy over fixed fixture corpora, scored mechanically, cross-engine, with repeated runs (flips extend K per the locked methodology). Honest scope: small, dated samples authored in-project โ€” a regression floor, not an independent benchmark; re-run on model/skill changes.

Full method, per-category scoring, and the cross-engine comparison live in the series records: TheColliery/.github/benchmarks/CoalMine.


๐Ÿงญ Design Principles

Bound by the 11 principles of the Quantum Computer Spec: maximum performance, zero visible errors, single-brand, minimum power, essential accessories, error correction, determinism, isolation, measurement, trustworthiness, and entanglement.


๐Ÿงญ Part of TheColliery

CoalMine is the quality-safeguard canary suite of a family of sibling skills built to one engineering doctrine:

Install one, it stands alone; install all, they compose without conflict.

The shared doctrine: Phoenix-13 hooks (zero-dependency, no network, fail-silent, no child processes, deterministic), single-source-of-truth config schemas, and a strict no-overkill discipline. More at TheColliery.


๐Ÿ“„ License

Apache License 2.0. See LICENSE for details.