# security-gate coding standards

audience: AI coding agents first. Imperative, BLUF-ordered.

**Core principle: testing-native vocabulary, language-by-bottleneck, no stubs, no false-clean, no false-coverage-claim.**

## Vocabulary (spec §1) — enforced
Use: detector, domain, detector contract, corpus, cell, fixture, canary, anti-canary, discriminator, bench, band, delete-test.
NEVER: module, package, layer, subpath, tier, seam, port-adapter, north-star, semver, changeset. Grep every authored file before commit.

## Language by bottleneck (spec §5)
- syntactic + CPU-bound → declarative rule on the Rust engine (author a rule file, not Rust).
- type-aware / semantic → TS. // reject: porting the oracle to syntax-only ast-grep.
- deps / CVE / config → native tool.
- LLM glue / orchestrator → python. // reject: Rust-ifying LLM-latency-bound glue.

## Honesty rules (non-negotiable)
- **No stubs that claim functionality.** A placeholder says it is one, in its own README; nothing invokes it as if it worked (e.g. `engine/`).
- **No-false-clean:** degraded input (unresolved imports) → report UNRELIABLE, never clean.
- **No-false-coverage-claim:** unmeasured class → BLIND SPOT, never covered.
- **No ignored signals:** every error/warning/hint from a build/test/commit is fixed or explicitly justified benign before moving on. Green = clean, not passed-with-noise.
- **Measure before claiming:** never rank/recommend from inferred proxies; pull live results. LLM claims are k≥3, never single-run.

## Detector code rules
- Every detector meets the §4 contract incl. discriminators. Discovered by CONVENTION (file placement), no registry.
- delete-test-vs-LLM before any band-3 detector (spec §4).
- Reconstruct cells with RAW git (`command git --no-pager show`); verify clean end + canonical symbol.

## Commit rules
- Commit completed work; terse caveman messages; NEVER co-author.
- Stage explicit paths.

## Pointers
Full rationale: `docs/specs/2026-06-17-security-gate-design.md`. Validation discipline: `docs/VALIDATION.md`.

## Learned Rules

### banned-term-no-salvage-exemption | fired:1 | 2026-06-17
Salvaged `DESIGN.md` + `gate.py` docstring shipped with `layer`/`module`; justified benign as "salvage = exempt." → wrong. The vocab rule has NO provenance carve-out; the exemption was invented to save work (the "hacky quick win" the directive bans). Advisor caught it; faithful fixes existed (`layer→stage/band`, `module path→import path`, `module specifier→import specifier`).
Prevent: run the banned-term grep over the ENTIRE delivered tree incl. salvaged code/docstrings/design docs, not just newly-authored docs. Found a hit → FIX it (faithful or more-precise replacement). The ONLY benign skip is a MEASURED detector input (e.g. `*.prompt.txt` whose recall was validated — editing forces n≥3 re-validation); justify that one explicitly, never silently. Provenance ≠ exemption.
