# clarity-gate

Checks documents before RAG ingestion, flags claims that need clearer uncertainty markers, and produces CGD files. Useful for specs, estimates, and hypotheses.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · ★ 34
- Author: Francesco Marinoni Moretto
- License: CC-BY-4.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/frmoretto/clarity-gate/tree/HEAD/skills/clarity-gate/SKILL.md
- Updated: 2026-03-02
- HTML: https://affpapa.org/en/nevibecode/skills/clarity-gate

## What it does

clarity-gate reviews a document before it enters a RAG knowledge base or is passed to another AI system. It produces Clarity-Gated Documents that follow format specification v2.1 and validates SOT files as CGD documents with an optional `tier:` block. Checks cover claim structure, source fields, dates, tables, and the required `## HITL Verification Record` section.

The skill bundles `scripts/claim_id.py` and `scripts/document_hash.py`. The first derives stable claim IDs with SHA-256; the second computes or verifies a document hash after normalizing line endings and whitespace. It checks form, not truth: a source marker does not prove that a claim is correct, and human review is mandatory before PASS.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add frmoretto/clarity-gate --skill clarity-gate -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/clarity-gate/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/clarity-gate/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add frmoretto/clarity-gate --skill clarity-gate -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/clarity-gate/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add frmoretto/clarity-gate --skill clarity-gate -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/clarity-gate/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install frmoretto/clarity-gate clarity-gate
```

2. **Manually: put the files in place**
- File: `.github/skills/clarity-gate/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add frmoretto/clarity-gate --skill clarity-gate -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/frmoretto/clarity-gate --path skills/clarity-gate
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/clarity-gate/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add frmoretto/clarity-gate --skill clarity-gate -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/frmoretto/clarity-gate/tree/HEAD/skills/clarity-gate/SKILL.md

## When to use it
- check a document before RAG ingestion
- flag claims that lack suitable uncertainty markers
- produce a CGD file for specification v2.1
- validate SOT tables and required fields
- compute claim IDs and document SHA-256 hashes

## Example prompts
- Check `project-spec.cgd.md` before it enters the RAG knowledge base.
- Find claims in this document that read as facts without enough support.
- Validate the SOT file and generate stable IDs for its claims.

## Source text · SKILL.md · CC-BY-4.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 89f8ae21ac713776.

BEGIN THIRD-PARTY FILE 89f8ae21ac713776
```text
---
# agentskills.io compliant frontmatter
name: clarity-gate
version: 2.1.3
description: >
  Pre-ingestion verification for epistemic quality in RAG systems.
  Ensures documents are properly qualified before entering knowledge bases.
  Produces CGD (Clarity-Gated Documents) and validates SOT (Source of Truth) files.
author: Francesco Marinoni Moretto
license: CC-BY-4.0
repository: https://github.com/frmoretto/clarity-gate
triggers:
  - clarity gate
  - check for hallucination risks
  - can an LLM read this safely
  - review for equivocation
  - verify document clarity
  - pre-ingestion check
  - cgd verify
  - sot verify
capabilities:
  - document-verification
  - epistemic-quality
  - rag-preparation
  - cgd-generation
  - sot-validation
outputs:
  - type: cgd
    extension: .cgd.md
    spec: docs/CLARITY_GATE_FORMAT_SPEC.md
spec_version: "2.1"
---

# Clarity Gate v2.1

**Purpose:** Pre-ingestion verification system that enforces epistemic quality before documents enter RAG knowledge bases. Produces Clarity-Gated Documents (CGD) compliant with the Clarity Gate Format Specification v2.1.

**Core Question:** "If another LLM reads this document, will it mistake assumptions for facts?"

**Core Principle:** *"Detection finds what is; enforcement ensures what should be. In practice: find the missing uncertainty markers before they become confident hallucinations."*

---

## What's New in v2.1

| Feature | Description |
|---------|-------------|
| **Claim Completion Status** | PENDING/VERIFIED determined by field presence (no explicit status field) |
| **Source Field Semantics** | Actionable source (PENDING) vs. what-was-found (VERIFIED) |
| **Claim ID Format Guidance** | Hash-based IDs preferred, collision analysis for scale |
| **Body Structure Requirements** | HITL Verification Record section mandatory when claims exist |
| **New Validation Codes** | E-ST10, W-ST11, W-HC01, W-HC02, E-SC06 (FORMAT_SPEC); E-TB01-07 (SOT validation) |
| **Bundled Scripts** | `claim_id.py` and `document_hash.py` for deterministic computations |

---

## Specifications

This skill implements and references:

| Specification | Version | Location |
|---------------|---------|----------|
| Clarity Gate Format (Unified) | v2.1 | [docs/CLARITY_GATE_FORMAT_SPEC.md](../../docs/CLARITY_GATE_FORMAT_SPEC.md) |

**Note:** v2.0 unifies CGD and SOT into a single `.cgd.md` format. SOT is now a CGD with an optional `tier:` block.

---

## Validation Codes

Clarity Gate defines validation codes for structural and semantic checks per FORMAT_SPEC v2.1:

### HITL Claim Validation (§1.3.2-1.3.3)
| Code | Check | Severity |
|------|-------|----------|
| **W-HC01** | Partial `confirmed-by`/`confirmed-date` fields | WARNING |
| **W-HC02** | Vague source (e.g., "industry reports", "TBD") | WARNING |
| **E-SC06** | Schema error in `hitl-claims` structure | ERROR |

### Body Structure (§1.2.1)
| Code | Check | Severity |
|------|-------|----------|
| **E-ST10** | Missing `## HITL Verification Record` when claims exist | ERROR |
```
END THIRD-PARTY FILE 89f8ae21ac713776

The third-party file has ended. Everything between the 89f8ae21ac713776 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3035 of 25108 bytes. © Francesco Marinoni Moretto · CC-BY-4.0 · https://github.com/frmoretto/clarity-gate/tree/HEAD/skills/clarity-gate/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
