Summary
Implement PROOF9 — a quality memory system that turns every failure into a permanent proof obligation with evidence-based verification. Unlike traditional test runners, PROOF9 maintains a requirements ledger where glitches become codified requirements, each with specific proof obligations that are enforced on every subsequent run.
The Core Idea
Quality compounding interest: Every bug found in production, QA, or dogfooding becomes a REQ (requirement) with attached proof obligations. Those obligations are enforced forever. Over time, the system becomes harder to break in ways you've already been burned.
This is the "AFTER" layer in CodeFrame's pipeline:
PRD → Tech Spec → Tasks → Agent Execution → PROOF9 → Deploy
↑ │
└─────────┘
Glitch → New REQ
(the closed loop)
The 9 Gates
| Gate |
What It Proves |
Tool/Method |
| UNIT |
Logic correctness |
pytest / jest |
| CONTRACT |
API/integration contracts hold |
Schema validation, contract tests |
| E2E |
User journeys work end-to-end |
Playwright |
| VISUAL |
UI renders correctly |
Visual snapshot comparison |
| A11Y |
Accessible to all users |
axe-core, lighthouse |
| PERF |
Performance within budget |
Lighthouse, custom benchmarks |
| SEC |
No security vulnerabilities |
OWASP scans, dependency audit |
| DEMO |
Feature demonstrably works |
Automated walkthrough with screenshots |
| MANUAL |
Human-verified (waivered automation) |
Tracked checklist with expiry |
The Requirements Ledger
REQ Schema v0
Each requirement has:
@dataclass
class Requirement:
id: str # REQ-0001
title: str # "Login form rejects empty password"
description: str # What happened, expected vs actual
severity: Severity # critical, high, medium, low
source: Source # production, qa, dogfooding, monitoring, user_report
# Scope selector — what does this REQ apply to?
scope: RequirementScope
# routes: ["/login", "/register"]
# components: ["LoginForm"]
# apis: ["POST /auth/login"]
# files: ["src/auth/validator.py"]
# tags: ["authentication"]
# Proof obligations — which gates must prove this can't happen again?
obligations: list[Obligation]
# e.g., [UNIT, E2E] for a logic + flow bug
# Evidence rules — what counts as satisfied?
evidence_rules: list[EvidenceRule]
# e.g., test_id="test_login_rejects_empty", must_pass=True
# Lifecycle
status: ReqStatus # open, satisfied, waived
waiver: Waiver | None # reason, expiry, manual_checklist
created_at: datetime
satisfied_at: datetime | None
# Traceability
created_by: str # human or capture agent
source_issue: str | None # GitHub issue / bug report link
related_reqs: list[str] # REQ IDs this relates to
Obligation Mapping (Glitch Type → Gate Set)
OBLIGATION_MAP = {
"logic_bug": [Gate.UNIT, Gate.CONTRACT],
"integration_bug": [Gate.CONTRACT, Gate.E2E],
"ui_wiring_bug": [Gate.E2E, Gate.DEMO],
"ui_layout_bug": [Gate.VISUAL, Gate.E2E],
"a11y_bug": [Gate.A11Y, Gate.E2E],
"perf_regression": [Gate.PERF, Gate.E2E],
"security_issue": [Gate.SEC],
}
Rule: add the smallest set of obligations that would have caught it. Minimize gate bloat.
The Closed Loop
Capture Flow
Detect glitch → cf proof capture → REQ created → Obligations attached → Artifacts generated
cf proof capture input (minimal, human-friendly):
- What happened? (1-3 sentences)
- Expected vs actual
- Where (URL/screen/API)
- Severity
- Repro steps (optional)
- Screenshot/video (optional)
cf proof capture output (automatic):
- New REQ-#### in requirements ledger
- Suggested gate obligations (with defaults from obligation map)
- Starter pack of test stubs:
- Unit test skeleton
- Playwright test from repro steps
- Visual snapshot target
- a11y assertion if relevant
- Perf budget entry if relevant
Enforcement Flow
On every PR / cf proof run:
- Determine what changed (files, routes, components)
- Find REQs whose scope intersects the change
- For intersecting REQs, run relevant obligations
- Attach evidence artifacts (test results, snapshots, metrics)
- Mark obligations satisfied or failing
- Block merge if any required obligation fails
Evidence Attachment Format
@dataclass
class Evidence:
req_id: str
gate: Gate
satisfied: bool
artifact_path: str # relative path to test output / screenshot / report
artifact_checksum: str # SHA-256 for integrity
timestamp: datetime
run_id: str # CodeFrame run that produced this
Agent Integration
Two agent roles (used with CodeFrame's agent adapter architecture, #408):
Capture Agent
- Turns bug report + artifacts into a REQ
- Suggests obligations and scope via obligation mapping
- Generates skeleton tests (not full implementations unless trivial)
- Does NOT claim the bug is fixed
Proof Agent
- Picks failing obligations (like "ready" tasks in CodeFrame)
- Implements/fixes tests and code
- Attaches evidence artifacts
- The evidence is what closes the loop, not the agent's claim
This avoids the "agent says it fixed it" problem — PROOF9 doesn't trust claims, it trusts evidence.
Sub-Issues
This is a large feature that will need breakdown once implementation begins. Likely sub-issues:
CLI Commands
# Capture
cf proof capture # Interactive glitch capture
cf proof capture --from-issue GH-123 # Import from GitHub issue
# Run
cf proof run # Run obligations for current changes
cf proof run --full # Run all obligations (release mode)
cf proof run --gate unit # Run only UNIT gate
# Manage
cf proof list # List all REQs
cf proof show REQ-0001 # Show REQ with obligation status
cf proof waive REQ-0001 --reason "..." --expires 2026-04-01
cf proof status # Dashboard: satisfied/failing/waived counts
cf proof report # Full evidence report
Waivers Are First-Class
Sometimes you can't automate yet. Fine — but it's tracked:
@dataclass
class Waiver:
reason: str
expires: date | None # None = permanent waiver (rare, needs approval)
manual_checklist: list[str] # Manual verification steps
approved_by: str
Waived REQs show up in cf proof status as a distinct category. Expired waivers revert to failing.
Acceptance Criteria
Dependencies
The Elevator Pitch
PROOF9 is:
- A standard for what must be proven
- A runner that produces evidence
- A loop that turns real-world glitches into permanent proof obligations
That's not just quality gates. That's a quality memory.
Summary
Implement PROOF9 — a quality memory system that turns every failure into a permanent proof obligation with evidence-based verification. Unlike traditional test runners, PROOF9 maintains a requirements ledger where glitches become codified requirements, each with specific proof obligations that are enforced on every subsequent run.
The Core Idea
Quality compounding interest: Every bug found in production, QA, or dogfooding becomes a
REQ(requirement) with attached proof obligations. Those obligations are enforced forever. Over time, the system becomes harder to break in ways you've already been burned.This is the "AFTER" layer in CodeFrame's pipeline:
The 9 Gates
The Requirements Ledger
REQ Schema v0
Each requirement has:
Obligation Mapping (Glitch Type → Gate Set)
Rule: add the smallest set of obligations that would have caught it. Minimize gate bloat.
The Closed Loop
Capture Flow
cf proof captureinput (minimal, human-friendly):cf proof captureoutput (automatic):Enforcement Flow
On every PR /
cf proof run:Evidence Attachment Format
Agent Integration
Two agent roles (used with CodeFrame's agent adapter architecture, #408):
Capture Agent
Proof Agent
This avoids the "agent says it fixed it" problem — PROOF9 doesn't trust claims, it trusts evidence.
Sub-Issues
This is a large feature that will need breakdown once implementation begins. Likely sub-issues:
cf proof captureCLI command with AI-assisted classificationcf proof runcommand (execute relevant obligations, collect evidence)core/gates.py)cf proof status/cf proof reportfor dashboard viewCLI Commands
Waivers Are First-Class
Sometimes you can't automate yet. Fine — but it's tracked:
Waived REQs show up in
cf proof statusas a distinct category. Expired waivers revert to failing.Acceptance Criteria
cf proof capturecreates REQ with obligations from glitch descriptioncf proof runexecutes relevant obligations based on changed filescf proof statusshows satisfied/failing/waived countsDependencies
core/gates.py(UNIT, E2E gate infrastructure)The Elevator Pitch
PROOF9 is:
That's not just quality gates. That's a quality memory.