T09: crystallization

A stable agentic realization becomes deterministic code. All four exit
criteria met; 163 tests pass.

- crystallization.py: trajectory capture, stability assessment requiring the
  same path across several runs, CrystallizedDriver, pytest codegen
- crystallized/test_grant_access.py: generated, runs with no model, carries
  its lineage in the docstring
- descendant preserves the ancestor's oracle set, agrees with it across five
  lab versions, and still catches a seeded defect
- reversibility shown both ways via new M24 (grant endpoint renamed): the
  frozen descendant fails loudly rather than searching, and the agentic
  ancestor recovers from the same mutation

F-0007 (open): the 54% cost reduction must not be quoted in support of the
thesis. The T07 runtime is token-free, so the measured saving is one page
fetch, one parse and a two-candidate scoring pass. The saving the concept
actually claims - tokens, latency, retry variance - is unmeasured. Together
with F-0005 this makes a bounded live-model experiment the highest-value next
investment.

Assertions in the generated test are imported rather than restated, so it is
not fully standalone. Deliberate: paraphrased claims would be a second
unverified statement of intent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 1629012@bnt-lap001
Assistant-Session: 78d4fb13-8a1e-474b-87a3-9b9261c49a39
This commit is contained in:
tegwick 2026-08-23 00:21:48 +02:00
parent b9ad259468
commit eee7722714
28 changed files with 794 additions and 10 deletions

View file

@ -415,7 +415,7 @@ without a human, so the safety result is not bought by escalating everything.
```task
id: TD-WP-0002-T09
status: todo
status: done
priority: high
state_hub_task_id: "855a1f41-b839-57fc-87b8-198ce2a9f6b1"
```
@ -432,6 +432,31 @@ Exit: the generated test runs with zero agentic involvement, preserves the
relevant claims and oracles, retains visible lineage, and measurably costs less
to execute than the agentic ancestor.
**Done 2026-08-23.** `crystallization.py`, `crystallized/test_grant_access.py`
(generated), 163 tests pass. All four exit criteria met.
- Freezing requires the **same** path across several runs, not one success. One
run proves the agent can find a way; it does not show the surface has stopped
moving, and freezing on a single observation is how a crystallized test becomes
flaky the first time a page renders differently.
- **Reversibility demonstrated in both directions.** M24 (grant endpoint renamed)
breaks the frozen path; the descendant fails *loudly* rather than falling back
to searching — falling back would quietly turn a T5 asset into a T1 one and
hide the signal crystallization exists to produce — while the agentic ancestor
recovers from the same mutation. That is what distinguishes crystallization
from ordinary codegen: the agentic form is not discarded.
- **F-0007 (open) — the economic case is unmeasurable.** The descendant is 54%
cheaper, and that number should not be quoted in support of the thesis. The
T07 runtime consumes zero tokens, so the entire saving is one page fetch, one
parse and a two-candidate scoring pass. The saving crystallization actually
claims — model tokens, latency, retry variance — is two or three orders of
magnitude larger and entirely absent from this measurement.
- The generated test is **not fully standalone**: realization is plain `urllib`,
but assertions are *imported* rather than restated, because a generated test
that paraphrases its claims creates a second unverified statement of intent.
Right call, and it qualifies the "drops into existing CI" story — what drops in
is the realization; the claims still need the use-case module.
## Gate review and first compression pass
```task