Skip to content

Commit f03d7e7

Browse files
docs(lockdown): CLAUDE.md + banners — block recurrence of legacy-preservation patching (#175)
## Summary Owner directive 2026-05-27 (received during a session that had just shipped PR #170 doing exactly the patching the directive forbids): > We are no longer treating preservation as a proof-engineering problem. … Do not optimize for smallest patch size. Make sure that never happens again, and it is very clear what the work is wherever needs documenting; no further time can be spent on the 'old approach'. This PR makes the directive impossible to miss across every doc surface an agent (or human) might encounter when picking up \`formal/\` work. ## What this changes ### NEW: \`CLAUDE.md\` at repo root Agent-facing guidance with: - 60-second TL;DR of why preservation in \`Semantics.v\` cannot be closed. - Explicit **DO NOT** list (5 items): no closing legacy preservation, no extending \`Semantics.v\` with closure-supporting lemmas, no closing \`region_liveness_at_split_l1\` axiom via proof tricks, no following pre-2026-05-26 closure plans, no patching legacy \`Typing.v\`. - Affirmative path: read \`PRESERVATION-DESIGN.md\` first; work proceeds per-layer (L1 / L2 / L3 / L4). - File reference table marking each \`formal/*.v\` as legacy-frozen vs active-layered vs forward-looking. - Two diagnostic questions to ask before touching \`formal/\`. ### Banner: \`formal/PRESERVATION-DESIGN.md\` CANONICAL banner at top. Same 4-item anti-pattern list as CLAUDE.md plus the **anti-pattern detector**: "if a session is producing sibling-region-disjointness side conditions, region-weakening predicates indexed on syntactic shape, or admit-shuffling between Semantics.v and a new lemma — escalate to a layer-design discussion." ### Banner: \`formal/PRESERVATION-HANDOFF.md\` Strengthened from "Superseded" to "ARCHAEOLOGY ONLY — do NOT follow the closure plans in this file." Keeps the historical 910→12 reduction data for diagnostic value but explicitly marks it not-a-plan. ### Surgery: \`ROADMAP.adoc\` - v0.1 "Coq: close preservation to Qed" checkbox rewritten in layered terms (the work is per-layer derivation, not legacy-theorem closure). - The 230-line **§ Preservation closure plan** body (5 phases, all aimed at closing the falsified theorem) is removed. Git history retains it for forensic value. - Replaced with a brief "superseded by four-layer redesign" section pointing at the design doc + CLAUDE.md. ### Memory store \`~/.claude/.../memory/feedback_ephapax_no_patching_legacy_preservation.md\` captures the durable directive. The \`MEMORY.md\` index surfaces it in the always-on disambiguation block alongside the existing ephapax/affinescript disambiguation entry so future Claude sessions see it on load. ## What this does NOT change - No \`.v\` files. The Coq code is untouched. - No PR closures. PRs landed before this lockdown remain as-is. - No deletion of \`PRESERVATION-HANDOFF.md\`; the per-case diagnostic data may still inform layered-design work. ## Test plan - [x] \`cat CLAUDE.md\` renders sensibly at repo root - [x] \`PRESERVATION-DESIGN.md\` banner is the first visual block after the title - [x] \`ROADMAP.adoc\` no longer contains "Lemma B" / "5-phase" / "close preservation to Qed" as instructions - [x] No Coq files modified (no rebuild needed) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5741ee3 commit f03d7e7

4 files changed

Lines changed: 226 additions & 249 deletions

File tree

CLAUDE.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<!-- SPDX-License-Identifier: PMPL-1.0-or-later -->
2+
<!-- Copyright (c) 2026 Jonathan D.A. Jewell -->
3+
4+
# CLAUDE.md — Ephapax agent guidance
5+
6+
> **Read this before touching `formal/`.** Several Claude sessions
7+
> burned hours walking the pre-discovery patching path. This file
8+
> exists so that doesn't happen again.
9+
10+
## TL;DR — the work, in one paragraph
11+
12+
Ephapax preservation as originally stated in `formal/Semantics.v` is
13+
**provably false**. `formal/Counterexample.v` exhibits a concrete
14+
configuration that types, steps, and lands at an untypable post-state
15+
— all three lemmas `Qed`. The work is therefore **not** to close
16+
`Theorem preservation` in `Semantics.v`. The work is the **four-layer
17+
principled redesign** (L1 region capabilities / L2 modality / L3 echo
18+
/ L4 dyadic mode) documented in `formal/PRESERVATION-DESIGN.md`.
19+
Preservation is **re-derived** in the new architecture from explicit
20+
invariants, not forced through the old one.
21+
22+
## DO NOT
23+
24+
These are anti-patterns that have wasted real session time. Refuse
25+
them if asked; if asked anyway, push back and link this file.
26+
27+
1. **DO NOT close `Theorem preservation` in `formal/Semantics.v`.**
28+
It is FALSE. No proof technique closes it because no proof
29+
exists. The `Admitted.` is correct.
30+
31+
2. **DO NOT extend `formal/Semantics.v`** with new lemmas aimed at
32+
closing the legacy preservation: not Lemma B variants
33+
(`sibling_typing_transfers_across_step` /
34+
`step_output_context_eq` were earlier attempts in this class),
35+
not `region_add_typing_for_non_values`, not strengthened
36+
substitution lemmas. The legacy judgment lacks the structural
37+
invariant the counterexample demands; no lemma collection bolted
38+
onto it will help.
39+
40+
3. **DO NOT close the `region_liveness_at_split_l1` axiom in
41+
`formal/Semantics_L1.v` by adding proof tricks, side-conditions
42+
discharged ad-hoc, or strengthened lemma signatures within the
43+
current judgment shape.** This is *the same kind of patching
44+
that produced the legacy admits*, one layer up. The axiom is
45+
false-as-stated; it surfaces a real gap that L2/L3 close
46+
structurally (cross-layer dependency — see
47+
PRESERVATION-DESIGN.md §5.1).
48+
49+
4. **DO NOT follow the "Preservation closure plan" steps in
50+
historical PRs / branches / comments.** Anything dated before
51+
2026-05-26 (the counterexample landing) that proposes closing
52+
`preservation` to `Qed.` is pre-discovery. PRs #92, #102, #104,
53+
#106, #114, #116, #117, #121 are part of the historical
54+
reduction-from-910-goals record; treat them as archaeology, not
55+
instructions.
56+
57+
5. **DO NOT patch the legacy `Typing.v` judgment.** It is the
58+
pre-redesign judgment. Counterexample.v depends on its falsity
59+
for the regression theorem. Leave it.
60+
61+
## DO
62+
63+
1. **DO read `formal/PRESERVATION-DESIGN.md` first.** It is the
64+
canonical design source. The four-layer architecture, the
65+
missing-invariant statement, and the per-layer plan are all
66+
there.
67+
68+
2. **DO continue the layered build:**
69+
- L1 (`TypingL1.v` + `Semantics_L1.v`): R-threading, mostly in
70+
place; preservation_l1 has open admits — these are L1 design
71+
follow-ups, not legacy patching.
72+
- L2 (`TypingL2.v` + `Modality.v`): skeleton landed (#168);
73+
mode-specific rules + cross-layer integration are next.
74+
- L3 (`Echo.v`): forward-looking scaffold (#166, #167); not
75+
wired into L1 yet — that's L1 ⇒ L3 follow-up.
76+
- L4: not started; design in §7 of the design doc.
77+
78+
3. **DO derive preservation per-layer.** `preservation_l1` is
79+
proved in the L1 vocabulary, against the L1 judgment, using L1
80+
invariants. Same for L2, L3. There is no single
81+
`preservation` for the unified calculus until L4 composition.
82+
83+
4. **DO escalate before patching.** If a proof attempt requires
84+
adding a side-condition to fix a sibling-region-disjointness
85+
issue (or analogous cross-rule constraint), that is the signal
86+
to escalate to a layer-design discussion — the architecture is
87+
asking for a new invariant, not a clever lemma.
88+
89+
## File reference
90+
91+
| File | Status | What it is |
92+
|---|---|---|
93+
| `formal/Syntax.v` | shared AST | safe to edit (with care) |
94+
| `formal/Typing.v` | **legacy** `has_type` | frozen — depends on counterexample's regression role |
95+
| `formal/Semantics.v` | shared `step` + falsified `preservation` | frozen for the preservation theorem; `step` may need extension at L2/L3 |
96+
| `formal/Counterexample.v` | three Qed lemmas | the verified soundness gap; do not edit the legacy section |
97+
| `formal/TypingL1.v` | L1 judgment | active layered work |
98+
| `formal/Semantics_L1.v` | L1 lemmas + `preservation_l1` | active layered work |
99+
| `formal/Modality.v` | L2 thin-poset infrastructure | active |
100+
| `formal/TypingL2.v` | L2 judgment skeleton | active |
101+
| `formal/Echo.v` | L3 scaffold | forward-looking |
102+
| `formal/PRESERVATION-DESIGN.md` | **canonical design source** | read this first |
103+
| `formal/PRESERVATION-HANDOFF.md` | **superseded** diagnostic record | historical only |
104+
| `ROADMAP.adoc` | scheduling | preservation entries point at design doc |
105+
106+
## If you're unsure
107+
108+
Two questions to ask before touching `formal/`:
109+
110+
1. **Am I about to add an `Admitted` or `Axiom` to close a gap in
111+
the old judgment?** If yes — stop. The old judgment is provably
112+
incomplete; the right answer is to encode the missing invariant
113+
in a new layer, not to admit it.
114+
115+
2. **Am I about to close an L1/L2/L3 admit by reasoning that
116+
crosses layers?** If yes — check
117+
`PRESERVATION-DESIGN.md §5.1` (cross-layer dependency). The
118+
layered design intentionally splits some closures across L1+L2
119+
or L1+L3; trying to close them within L1 alone is the trap.
120+
121+
If unsure: ask the owner before writing code. Pause to escalate
122+
costs less than a 4-hour patching session.
123+
124+
## Memory hooks
125+
126+
If you have access to the user's auto-memory store, relevant entries
127+
include:
128+
129+
- `project_ephapax_four_layer_redesign.md` — the canonical project
130+
state for this redesign.
131+
- `feedback_ephapax_no_patching_legacy_preservation.md` — the
132+
durable directive captured from the 2026-05-27 conversation that
133+
produced this CLAUDE.md.
134+
- `feedback_ephapax_affine_proofs_not_done.md` — what counts as
135+
"done" for the ephapax-affine half.

0 commit comments

Comments
 (0)