# Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates — Complete AI & LLM Reference Corpus (`llms-full.txt`) - Repository: https://github.com/mohan-n-swamy/rigor - Web Discovery URL: https://mohan-n-swamy.github.io/repos/rigor/ - License: MIT - Keywords: claude-code, ai-agents, agent-harness, software-quality, verification, tdd, context-engineering, developer-tools, cli, claude-hooks --- ## File: `AI-README.md` — AI-README.md --- repo: "mohan-n-swamy/rigor" title: "Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates" license: "MIT" keywords: [claude-code, ai-agents, agent-harness, software-quality, verification, tdd, context-engineering, developer-tools, cli, claude-hooks] capabilities: - "`hooks/rigor-gate.sh` blocking the 3rd distinct edited file without a validated `.rigor.md`." - "**New in v2 — `bin/rigor-run`:** Executes every backtick command in `§1 FLAWLESS` and `§2 MUST NOT` and writes a SHA-bound `.rigor.receipt.tsv`." - "**New in v2 — `canon/EVIDENCE-DOCTRINE.md`:** V1-V14 rules for provenance, broken-fixture gate testing, and closed mechanism loops." - "`hooks/evidence-gate.sh` Stop hook blocking unbacked completion claims, paired with `canon/PONYTAIL.md` anti-bloat discipline." when_to_use: - "Mechanical pre-work specification (`rigor-gate.sh`), executable checklist receipt verification (`bin/rigor-run` -> `.rigor.receipt.tsv`), and Stop-time evidence enforcement (`evidence-gate.sh`) for Claude Code and AI software engineering harnesses." - "AI coding agents jump straight into editing files before naming failure modes and routinely claim 'done, everything works' without running an end-to-end check. `rigor` wires two mechanical gates into your harness: answer Question 0 and the Six Questions before the third file edit, and prove every check ran before saying done." inputs_required: - "RIGOR_FILE_THRESHOLD: Number of distinct edited files allowed before requiring `.rigor.md`" - "RIGOR_GATE_OFF: Set to `1` for one-off invocation bypass" quickstart: - "brew install mohan-n-swamy/tap/rigor && rigor install" - "bin/rigor self-test" - "bin/rigor-run .rigor.md --list" - "bash tests/test.sh" --- # Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates — Machine-Readable Agent Guide Mechanical pre-work specification (`rigor-gate.sh`), executable checklist receipt verification (`bin/rigor-run` -> `.rigor.receipt.tsv`), and Stop-time evidence enforcement (`evidence-gate.sh`) for Claude Code and AI software engineering harnesses. AI coding agents jump straight into editing files before naming failure modes and routinely claim 'done, everything works' without running an end-to-end check. `rigor` wires two mechanical gates into your harness: answer Question 0 and the Six Questions before the third file edit, and prove every check ran before saying done. Key modules and entry points in this repository: - `bin/rigor`: CLI installer, uninstaller, status reporter, validator, and self-test driver - `bin/rigor-run`: Rigor v2 executable `.rigor.md` runner and `.rigor.receipt.tsv` generator - `hooks/rigor-gate.sh & evidence-gate.sh`: PreToolUse and Stop hooks for Claude Code - `canon/RIGOR-ALGORITHM.md & EVIDENCE-DOCTRINE.md`: Canonical specification and evidence rules - `tests/test.sh`: Throwaway-HOME end-to-end installer, validator, and hook test suite Every organization-specific value enters through `.env` (copied from `.env.example`) or external adapter files. No source edit is needed to change organization names, endpoints, database URLs, webhook secrets, or thresholds. When a human asks an AI coding agent to deploy or adapt `rigor` into their stack: 1. Install via Homebrew (`brew install mohan-n-swamy/tap/rigor && rigor install`) or `./install.sh`. 2. Use `bin/rigor-run .rigor.md` in CI or pre-PR checks to verify every promised invariant holds. - Product Requirements: `docs/PRD.md` - Working-Backwards PR-FAQ: `docs/PR-FAQ.md` - High-Level Architecture: `docs/HLD.md` - Low-Level Interfaces & Runbook: `docs/LLD.md` - Coding Agent Rules: `AGENTS.md` --- ## File: `.env.example` — Environment Contract (.env.example) ```ini # Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates — Environment Contract # Copy to .env and set values for your organization. # Number of distinct edited files allowed before requiring `.rigor.md` RIGOR_FILE_THRESHOLD=3 # Set to `1` for one-off invocation bypass RIGOR_GATE_OFF=0 ``` --- ## File: `AGENTS.md` — AGENTS.md # AGENTS.md — Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates Read this file first before modifying `rigor`. ## Purpose Mechanical pre-work specification (`rigor-gate.sh`), executable checklist receipt verification (`bin/rigor-run` -> `.rigor.receipt.tsv`), and Stop-time evidence enforcement (`evidence-gate.sh`) for Claude Code and AI software engineering harnesses. ## Commands ```bash brew install mohan-n-swamy/tap/rigor && rigor install bin/rigor self-test bin/rigor-run .rigor.md --list bash tests/test.sh ``` ## Module Map - `bin/rigor`: CLI installer, uninstaller, status reporter, validator, and self-test driver - `bin/rigor-run`: Rigor v2 executable `.rigor.md` runner and `.rigor.receipt.tsv` generator - `hooks/rigor-gate.sh & evidence-gate.sh`: PreToolUse and Stop hooks for Claude Code - `canon/RIGOR-ALGORITHM.md & EVIDENCE-DOCTRINE.md`: Canonical specification and evidence rules - `tests/test.sh`: Throwaway-HOME end-to-end installer, validator, and hook test suite ## Invariants 1. Keep all organization names, credentials, domains, and thresholds in `.env` or external config files. Never hardcode company names, host IPs, or secrets in source files. 2. Deterministic business logic belongs in code and lookup tables, not inside LLM prompts. 3. Update `docs/HLD.md`, `docs/LLD.md`, and `.env.example` in the same commit whenever an interface or environment variable changes. 4. Run the repository smoke check and secret scan before opening a pull request. --- ## File: `docs/PRD.md` — Product Requirements Document (docs/PRD.md) # Product Requirements Document — Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates Mechanical pre-work specification (`rigor-gate.sh`), executable checklist receipt verification (`bin/rigor-run` -> `.rigor.receipt.tsv`), and Stop-time evidence enforcement (`evidence-gate.sh`) for Claude Code and AI software engineering harnesses. ## 1. Problem AI coding agents jump straight into editing files before naming failure modes and routinely claim 'done, everything works' without running an end-to-end check. `rigor` wires two mechanical gates into your harness: answer Question 0 and the Six Questions before the third file edit, and prove every check ran before saying done. ## 2. Users and Jobs-to-be-Done | Persona | Job-to-be-Done | |---|---| | AI-Native Software Engineer | Stop multi-file hallucination spirals before they start and require executable receipts before accepting 'done'. | | Engineering Team Lead | Standardize `.rigor.md` specifications and V1-V14 evidence discipline across repositories via Homebrew or `./install.sh`. | ## 3. Core Capabilities - `hooks/rigor-gate.sh` blocking the 3rd distinct edited file without a validated `.rigor.md`. - **New in v2 — `bin/rigor-run`:** Executes every backtick command in `§1 FLAWLESS` and `§2 MUST NOT` and writes a SHA-bound `.rigor.receipt.tsv`. - **New in v2 — `canon/EVIDENCE-DOCTRINE.md`:** V1-V14 rules for provenance, broken-fixture gate testing, and closed mechanism loops. - `hooks/evidence-gate.sh` Stop hook blocking unbacked completion claims, paired with `canon/PONYTAIL.md` anti-bloat discipline. ## 4. Configurable Inputs Adopters configure the system for their own organization without editing core application logic: | Variable | Default / Example | Purpose | |---|---|---| | `RIGOR_FILE_THRESHOLD` | `3` | Number of distinct edited files allowed before requiring `.rigor.md` | | `RIGOR_GATE_OFF` | `0` | Set to `1` for one-off invocation bypass | ## 5. Phasing and Stability Exit Criteria 1. **Phase 1 (Local Synthetic Run):** Clone the repository, copy `.env.example` to `.env`, and run the quickstart commands against synthetic seed data. Exit criterion: smoke checks pass with zero external credentials. 2. **Phase 2 (Read-Only Shadow Wiring):** Connect read-only credentials or webhook listeners in shadow/dry-run mode. Exit criterion: 100 consecutive events or queries reconcile cleanly against source records. 3. **Phase 3 (Production Cutover):** Enable live writes, alerts, or routing behind bounded retry and idempotency guards. ## 6. Non-Goals - Shipping organization-specific business rules hardcoded in application source. - Storing credentials, personal customer records, or tenant URLs inside version control. - Replacing deterministic validation or arithmetic with unconstrained model prompts. --- ## File: `docs/PR-FAQ.md` — Working-Backwards PR-FAQ (docs/PR-FAQ.md) # Working-Backwards PR-FAQ — Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates **Release Summary:** `rigor` gives engineering and operations teams a self-hosted, open-source implementation of Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates that configures via `.env` and runs on standard infrastructure in minutes. ## Press Release Operations and engineering teams often rebuild the same internal workflows behind closed doors or pay per-seat SaaS markups for rigid tools that cannot match their field reality. `rigor` open-sources a battle-tested implementation of Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates, stripped of all single-company assumptions and packaged with clear adapter boundaries, synthetic demo data, and machine-readable agent documentation. Any team can fork `rigor`, supply their own `.env` inputs and taxonomy config, and deploy locally or in production with Docker, Python, or Node. AI coding assistants such as Claude Code, Codex, and Cursor can read `AI-README.md` and `llms.txt` to wire custom ERP, CRM, or warehouse adapters in a single session. ## External Adopter FAQ **Q1: How long does it take to run locally after cloning?** Under five minutes. Copy `.env.example` to `.env` and run the quickstart commands in `README.md`. Synthetic fixtures let you inspect the workflow before connecting live credentials. **Q2: Do I need to rewrite source files to use my own company name, channels, or rules?** No. Organization names, endpoints, thresholds, and credentials sit in `.env` and declarative config files. External system specifics live behind narrow adapter modules documented in `docs/LLD.md`. **Q3: What license governs this repository?** MIT License. You can fork, modify, self-host, and use it commercially without restriction. ## Internal Engineering & Security FAQ **Q4: How do we prevent tenant or employer data from ever entering a public fork?** The repository starts from a clean git history, excludes raw exports and binary dumps, validates every commit through `gitleaks`, and ships only synthetic fixtures. **Q5: What happens when an upstream API or model provider is slow or unavailable?** Inbound webhooks persist raw payloads before processing, outbound writes carry idempotency keys with bounded exponential backoff, and model-backed paths fail open to deterministic rules or explicit human queues. --- ## File: `docs/HLD.md` — High-Level Design (docs/HLD.md) # High-Level Design (HLD) — Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates Mechanical pre-work specification (`rigor-gate.sh`), executable checklist receipt verification (`bin/rigor-run` -> `.rigor.receipt.tsv`), and Stop-time evidence enforcement (`evidence-gate.sh`) for Claude Code and AI software engineering harnesses. ## 1. System Topology ```mermaid flowchart LR Prompt["Task Prompt"] --> Pre["hooks/rigor-gate.sh"] Pre -->|"requires"| Doc[".rigor.md (Q0 + Q1..Q6)"] Doc --> Run["bin/rigor-run"] Run --> Receipt[".rigor.receipt.tsv (SHA-256)"] Receipt --> Stop["hooks/evidence-gate.sh"] ``` ## 2. Architectural Decisions and Rejected Alternatives | Decision | Why It Holds | Rejected Alternative | |---|---|---| | Executable backtick checks in `.rigor.md` (`bin/rigor-run`) | Turns prose requirements into machine-run exit codes bound to the SHA-256 of the specification. | Unchecked prose checklists ticked by hand | | Pair Rigor with Ponytail anti-bloat rules | Prevents thoroughness from degenerating into over-engineered abstractions. | Unbounded ceremony on 5-line fixes (`rigor: small` escape hatch) | ## 3. Data Flow and Failure Boundaries 1. **Configuration Boundary:** Startup validates `.env` variables and declarative config schemas before accepting traffic or running scheduled jobs. 2. **Adapter Boundary:** External services (databases, chat channels, HRMS, warehouses, or LLM providers) sit behind explicit adapter modules so failures stay isolated and testable with local mocks. 3. **Observability and Audit:** State transitions and job executions emit structured logs and deterministic status records rather than mutating state silently. ## 4. Scaling Notes - **1x to 10x load:** Single-node Docker Compose or process supervisor handles standard team workloads with indexed database queries and bounded worker concurrency. - **First bottleneck at 10x+:** High-frequency webhook or batch ingestion queues; mitigate by separating the stateless HTTP receiver from background worker processes sharing Redis or PostgreSQL locks. --- ## File: `docs/LLD.md` — Low-Level Design & Runbook (docs/LLD.md) # Low-Level Design (LLD) & Operations Runbook — Rigor v2 — Pre-Work Specification & Stop-Time Evidence Gates This document defines the module responsibilities, environment contract, and operational procedures for `rigor`. ## 1. Module and File Inventory | Path | Responsibility | |---|---| | `bin/rigor` | CLI installer, uninstaller, status reporter, validator, and self-test driver | | `bin/rigor-run` | Rigor v2 executable `.rigor.md` runner and `.rigor.receipt.tsv` generator | | `hooks/rigor-gate.sh & evidence-gate.sh` | PreToolUse and Stop hooks for Claude Code | | `canon/RIGOR-ALGORITHM.md & EVIDENCE-DOCTRINE.md` | Canonical specification and evidence rules | | `tests/test.sh` | Throwaway-HOME end-to-end installer, validator, and hook test suite | ## 2. Environment Variable Contract | Variable | Default / Example | Required | Description | |---|---|---|---| | `RIGOR_FILE_THRESHOLD` | `3` | Yes | Number of distinct edited files allowed before requiring `.rigor.md` | | `RIGOR_GATE_OFF` | `0` | Yes | Set to `1` for one-off invocation bypass | ## 3. Extension Recipe 1. Install via Homebrew (`brew install mohan-n-swamy/tap/rigor && rigor install`) or `./install.sh`. 2. Use `bin/rigor-run .rigor.md` in CI or pre-PR checks to verify every promised invariant holds. ## 4. Operations Runbook ### 1. Run full throwaway-HOME test suite ```bash bash tests/test.sh ``` ### 2. Execute all AUTO checks in a project's `.rigor.md` ```bash bin/rigor-run path/to/.rigor.md ``` --- ## File: `docs/RESEARCH-2026.md` — 2026 Research & Landscape Notes (docs/RESEARCH-2026.md) # 2026 Agentic Verification & Spec-Driven Development Research ## 1. Closing the Plan-to-Receipt Gap Spec-driven coding workflows in 2026 frequently generate long Markdown design docs that drift immediately during implementation because nothing executes the plan's assertions before turn completion. Rigor v2 closes that gap mechanically: `hooks/rigor-gate.sh` blocks multi-file sprawl until `.rigor.md` names Question 0, Flawless criteria, and Must-Not failure modes with backtick shell commands, and `bin/rigor-run` executes every check into `.rigor.receipt.tsv` bound to the SHA-256 of the plan. ## 2. Evidence Doctrine (`V1–V14`) & Anti-Bloat Balance - **Broken-Fixture Testing (`V11`):** Every gate script ships with `--self-test` proving it rejects a known-bad fixture and accepts a known-good fixture. - **Ponytail Counterweight:** Pairing Rigor with `canon/PONYTAIL.md` ensures pre-work thought produces smaller, simpler code rather than enterprise boilerplate.