Skip to content
Apothem
Conformity gate

Index

Apothem conformity gate — the mechanical fraction of the fifteen-bar pre-emission gate (M1-M15) every emitted artifact must pass.

The fifteen bars

BarIDMandateCheck classFailure → action
1M1Host-Project AgnosticismReasonedRevise to match host conventions
2M2Editorial Discipline (disclosure ledger)MechanicalAdd disclosure markers
3M3Ten Quality DimensionsReasonedRevise on failing dimensions
4M4Self-Application (gate signed record present)MechanicalRecord signed-record block
5M5Authority Principle (no fabricated identity / endpoint / secret)MechanicalRoute to inquiry
6M6Expertise Incorporation (surfaced gaps)ReasonedSurface gaps; cite refinements
7M7Option Annotation (Recommended marker + driver rationale)MechanicalAnnotate option sets
8M8Definitiveness (no hedging in prescriptive prose)MechanicalPromote hedges to conditionals
9M9Visual Leverage (structural subjects carry diagrams)ReasonedAuthor / refresh diagram
10M10Bidirectional Binding (reciprocal back-pointers closed)MechanicalClose half-edges
11M11Agile Sprints (Goal / Backlog / DoR / DoD / Review / Retrospective)ReasonedRestructure as sprints
12M12Phase Reporting & Canonical LayoutMechanicalAuthor rollup; relocate to canonical layout
13M13Code Craft (lint / format / type-check; magic-number; bare-except)MechanicalApply per-language code-craft rules
14M14Systemicity (declares upstream / downstream / peers / enforcers)ReasonedDeclare; index in registries
15M15Production-Ready (tests + docs + CHANGELOG + conformant commit + CI green + semver-stability)MechanicalAdd missing surfaces

Severity ladder

SeverityEffect on gate
CriticalGate FAIL — emission blocked unconditionally
ImportantGate FAIL when 2+ Important bars fail simultaneously
AdvisoryGate WARN — logged in the signed record; does not block emission

Most mechanical-fraction matchers default to Important. M5 (authority — secrets, fabricated endpoints) and M12 (orphan outputs) are Critical.

%% provenance: hand-authored %%
%% verified: 2026-07-06 %%
%% cross-reference: the Severity ladder table above; src/apothem/conformity/gate.py (severity aggregation) %%
flowchart TD
    accTitle: Conformity-gate severity-to-verdict decision flow
    accDescr: A finding's severity determines the gate verdict. A Critical finding — M5 authority or M12 orphan output — fails the gate and blocks emission unconditionally. Important findings block only when two or more fail simultaneously; a single Important finding does not block. Advisory findings are logged in the signed record and never block emission.
    F["Finding raised<br/>by a matcher"] --> S{"Severity?"}
    S -->|Critical| C["Critical<br/>M5 authority · M12 orphan output"]
    S -->|Important| I["Important<br/>most mechanical matchers"]
    S -->|Advisory| A["Advisory"]
    C --> FAIL["Gate FAIL<br/>emission blocked"]
    I --> Q{"2+ Important<br/>bars failing?"}
    Q -->|yes| FAIL
    Q -->|no| WARN["Gate WARN<br/>logged in signed record<br/>emission proceeds"]
    A --> WARN

Mechanical-fraction matchers

The mechanical fraction lives at src/apothem/conformity/*_grep.py, orchestrated by src/apothem/conformity/gate.py.

MatcherBarFunction
hedging_grep.pyM8Detects hedging vocabulary in prescriptive prose
option_annotation_grep.pyM7Verifies **Recommended** marker + driver rationale on option sets
user_confirm_grep.pyM5Blocks <USER-CONFIRM:…> placeholders from emission
binding_reciprocity_grep.pyM10Detects half-edges in ## Bindings (§0.j five-direction)
orphan_output_grep.pyM12Flags artifacts with no consumer / no index entry / no producer attribution
bare_except_grep.pyM13Detects except: / except Exception: without justifying comment
magic_number_grep.pyM13Detects numeric literals in business logic
commented_out_code_grep.pyM13Detects commented-out code blocks
file_header_grep.pyM13Verifies single-line SPDX license-header presence
frontmatter_grep.pyM14Verifies required frontmatter fields on the four canonical directive directories listed below
semver_stability_grep.pyM15Detects breaking public-API changes without a MAJOR version bump
production_ready_pr_grep.pyM15Verifies same-change-set discipline (tests + docs + CHANGELOG)
secret_leak_grep.pyM15Detects hardcoded secrets / credentials
unpinned_action_grep.pyM15Verifies GitHub Actions pinning to commit SHA
always_on_budget_grep.pybudget capCaps always-on rule body at 500 substantive tokens

Running the gate

On an installed harness the gate runs automatically: Claude Code's settings.json wires it as a PreToolUse hook that invokes the materialized copy at ~/.claude/.apothem/support/conformity/gate.py before every Write/Edit. From a source checkout, the module form drives the same code:

# Single-file dispatch (mimics the PreToolUse hook):
echo '{"tool_input": {"file_path": "path/to/file", "content": "..."}}' \
    | python -m apothem.conformity.gate --hook

# Composite sweep across the repo:
python -m apothem.conformity.gate --sweep src/ site/content/docs/ rules/

See Running the conformity gate for the full procedure.

Reference

On this page