You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v0.5.0: Goodhart tests — hidden acceptance criteria for contract compliance
Add adversarial hidden tests that implementation agents never see, countering
Goodhart's Law (optimizing for visible test inputs rather than true contract
compliance). Graduated-disclosure remediation re-implements failing components
with behavioral hints that get progressively more specific.
New features:
- Goodhart test author (single LLM call, adversarial prompt)
- Hidden test storage isolated from visible tests
- Polish-phase Goodhart evaluation + remediation loop
- Graduated hints: Level 1 (behavioral), Level 2 (contract invariant)
- Wizard, lifecycle polish phase, integrator improvements
- Fix Haiku pricing in budget tests (0.80 -> 1.00)
1573 tests, all passing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
**Budget hypervisor**: `estimate_tokens()` provides content-aware token estimation (symbol ratio → chars/token: 3.5 for code, 4.5 for prose). `record_tokens_validated()` cross-validates reported vs estimated counts using `max()` for conservative accounting. The `claude_code` backend no longer falls back to `len(text) // 4`. The `claude_code_team` backend now tracks spend via estimation.
87
87
88
+
### Goodhart Tests (Hidden Acceptance Criteria)
89
+
90
+
During the Test phase, Pact generates two test suites per component: **visible tests** (shown to the implementation agent) and **Goodhart tests** (hidden, never shared with agents). This counters Goodhart's Law: when agents can see all tests, they optimize for passing those specific inputs rather than truly satisfying the contract.
91
+
92
+
Goodhart tests are adversarial — they probe for hardcoded returns, boundary-adjacent inputs, invariant generalization, and postcondition universality. They live in `.pact/contracts/<cid>/goodhart/` and are never loaded by `load_all_test_suites()` or `render_handoff_brief()`.
93
+
94
+
During the **polish phase**, Goodhart tests run against all implementations. Failures trigger **graduated-disclosure remediation**: the component is re-implemented with behavioral hints (not exact errors) that get more specific on each attempt (max 2 by default). The agent never sees the actual test code.
95
+
96
+
- **Level 1**: Vague behavioral hint from test description (e.g., "your add() function may not correctly handle the commutative property")
97
+
- **Level 2**: Specific contract invariant (e.g., "The contract requires: add(a,b) == add(b,a). Your implementation appears to violate this.")
98
+
99
+
Config: `max_goodhart_attempts`in pact.yaml (default: 2). Cost: ~$0.07/component for generation (1 LLM call, no research/plan).
100
+
88
101
### Casual-Pace Scheduling
89
102
90
103
Poll-based, not event-loop. Agents invoked for focused bursts, state fully persisted between bursts.
<p>Static prompt prefixes cached across API calls. 50-70% input token savings. Cache hit rates tracked in budget metrics. Research results persisted and reused across phases.</p>
556
556
</div>
557
+
<divclass="feature-card">
558
+
<spanclass="feature-icon">🎯</span>
559
+
<h3>Hidden Acceptance Criteria</h3>
560
+
<p>Goodhart tests: adversarial hidden tests the agent never sees. Catches hardcoded returns, missing validation, and invariants that hold only for visible inputs. Graduated-disclosure remediation on failure.</p>
0 commit comments