H8Harnessscope: coreweight: 1fix: assisted

    H8: Hook errors use structured format (what/rule/fix)

    Why this rule exists (Empirical Evidence)

    Production git and Claude Code hook audits show that emitting structured error output (what failed, which rule triggered, and the exact fix command) lets coding agents self-correct immediately. Unstructured one-line hook failures force agents to guess or read hook source code, multiplying retry loops.

    Multi-Project Dev Discipline Audit (2026)
    Anti-pattern (Triggers H8)
    # Anti-pattern triggering H8 (Hook errors use structured format (what/rule/fix))
    echo 'commit rejected' >&2 && exit 1
    Compliant pattern (Passes H8)
    # Compliant harness passing H8 (Hook errors use structured format (what/rule/fix))
    fail_with_help 'Staged .env file' 'Rule S1: never commit secrets' 'Run: git reset HEAD .env'
    Verify locally or online
    npm install -g agentlint-ai && agentlint fix H8

    More Harness checks