|
| 1 | +// SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | += Session 2026-04-05 — KRLAdapter.jl Phase 4 prep (from other claude) |
| 3 | +Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 4 | +:toc: |
| 5 | +:sectnums: |
| 6 | + |
| 7 | +*Author of this note:* Claude Opus 4.6 session on KRL stack recovery, |
| 8 | +2026-04-05. *For:* any future claude working on verisim-modular-experiment |
| 9 | +Phase 4 (KRLAdapter.jl dogfood). *Purpose:* document KRLAdapter.jl's |
| 10 | +current state so Phase 4 has a concrete target. |
| 11 | + |
| 12 | +== KRLAdapter.jl — summary as of 2026-04-05 |
| 13 | + |
| 14 | +*Location:* `/var/mnt/eclipse/repos/KRLAdapter.jl/` |
| 15 | +*GitHub:* `https://github.com/hyperpolymath/KRLAdapter.jl` |
| 16 | +*UUID:* `28b5845d-d150-4ffa-a60e-3b762afb26c8` |
| 17 | +*License:* MPL-2.0 (Julia ecosystem consistency; PMPL preferred) |
| 18 | +*Status:* Created greenfield 2026-04-05. CRG grade D. 51 tests passing. |
| 19 | +*Dependencies:* `KnotTheory` 1.x, `Skein` 0.3.x — community libs, read-only. |
| 20 | + |
| 21 | +== What KRLAdapter.jl owns |
| 22 | + |
| 23 | +=== TangleIR (src/ir.jl) |
| 24 | + |
| 25 | +The canonical IR defined *here*, not in the community libs: |
| 26 | + |
| 27 | +[source,julia] |
| 28 | +---- |
| 29 | +struct TangleIR |
| 30 | + id::UUID # fresh uuid4 per IR instance |
| 31 | + ports_in::Vector{Port} # open tangle boundary — empty for closed diagrams |
| 32 | + ports_out::Vector{Port} |
| 33 | + crossings::Vector{CrossingIR} # sign ∈ {-1, +1}, arcs::NTuple{4,Int} |
| 34 | + components::Vector{Vector{Int}} |
| 35 | + metadata::TangleMetadata # name, source_text, tags, provenance, extra |
| 36 | +end |
| 37 | +---- |
| 38 | + |
| 39 | +Provenance values: `:user | :derived | :rewritten | :imported`. |
| 40 | + |
| 41 | +=== Current adapters |
| 42 | + |
| 43 | +* `src/adapters/knottheory.jl` — `pd_to_ir`, `ir_to_pd`, `alexander`, `jones`, |
| 44 | + `determinant`, `signature`, `simplify` + convenience `trefoil_ir`/`figure_eight_ir`/`unknot_ir`. |
| 45 | +* `src/adapters/skein.jl` — `store_ir!`, `fetch_ir`, `query_ir`. |
| 46 | + |
| 47 | +=== No Verisim adapter yet |
| 48 | + |
| 49 | +This is the Phase 4 slot. Currently empty. The KRLAdapter.jl README and the |
| 50 | +project's memory file (`feedback_krl_adapter_boundary.md`) note that a slim |
| 51 | +VerisimCore interface should remain open rather than committing to the full |
| 52 | +octad engine. |
| 53 | + |
| 54 | +== What KRLAdapter.jl would need from VerisimCore |
| 55 | + |
| 56 | +Based on current KRLAdapter.jl usage patterns and the Path B split |
| 57 | +(Core = {Semantic, Provenance, Temporal}), KRLAdapter.jl's needs appear to |
| 58 | +map cleanly: |
| 59 | + |
| 60 | +[cols="2,3,1",options="header"] |
| 61 | +|=== |
| 62 | +|VerisimCore shape |KRLAdapter.jl usage |Load-bearing? |
| 63 | + |
| 64 | +|*Provenance* |
| 65 | +|`TangleMetadata.provenance` ∈ `{user, derived, rewritten, imported}` — every |
| 66 | +derived IR carries a `parent_id` pointer and operation tag. Rewrite-graph |
| 67 | +traceability is intrinsic to what the adapter does. |
| 68 | +|YES |
| 69 | + |
| 70 | +|*Semantic* |
| 71 | +|`TangleMetadata.tags::Vector{String}` + `metadata.extra::Dict{Symbol,Any}` |
| 72 | +— free-form semantic annotations attached to IRs. Skein persists these as |
| 73 | +metadata rows keyed `krl_*` and `tag_N`. |
| 74 | +|YES (for any non-trivial query semantics) |
| 75 | + |
| 76 | +|*Temporal* |
| 77 | +|Every `TangleIR` has a `UUID` (content-independent identity, first-seen at |
| 78 | +construction time). Skein records have `created_at`/`updated_at` timestamps. |
| 79 | +LWW conflict-resolution semantics would be needed if two sessions wrote |
| 80 | +the same IR name concurrently. |
| 81 | +|PROBABLY (depends on multi-session story) |
| 82 | +|=== |
| 83 | + |
| 84 | +*Federable shapes KRLAdapter.jl likely does NOT need:* Vector (no similarity |
| 85 | +queries over IRs at this stage), Tensor (no multi-dim representations), |
| 86 | +Spatial (no geometric embedding), Document (IRs are structured, not |
| 87 | +document-blob-ish), Graph (rewrite provenance is linear per-IR, not |
| 88 | +cross-entity). |
| 89 | + |
| 90 | +*Preliminary Phase 4 hypothesis:* KRLAdapter.jl is a clean Core-only client. |
| 91 | +Good candidate for the experiment's positive result. |
| 92 | + |
| 93 | +== Integration hook points (when Phase 4 arrives) |
| 94 | + |
| 95 | +Existing Skein-adapter metadata already encodes Verisim-relevant info with |
| 96 | +a `krl_*` prefix for easy discrimination: |
| 97 | + |
| 98 | +* `krl_ir_uuid` — the TangleIR's `id::UUID` |
| 99 | +* `krl_provenance` — `user|derived|rewritten|imported` |
| 100 | +* `krl_source_text` — original KRL source (if available) |
| 101 | +* `tag_0`, `tag_1`, … — user-supplied semantic tags |
| 102 | + |
| 103 | +To wire VerisimCore in, the most natural extension point is a new |
| 104 | +`src/adapters/verisim.jl` with: |
| 105 | + |
| 106 | +[source,julia] |
| 107 | +---- |
| 108 | +# Hypothetical shape — not yet implemented |
| 109 | +store_ir_verisim!(core::VerisimCore, ir::TangleIR; name, tags) -> UUID |
| 110 | +fetch_ir_verisim(core::VerisimCore, id::UUID) -> TangleIR |
| 111 | +query_ir_verisim(core::VerisimCore; predicates...) -> Vector{UUID} |
| 112 | +prove_consonance(core::VerisimCore, ir1::TangleIR, ir2::TangleIR) -> ConsonanceVerdict |
| 113 | +---- |
| 114 | + |
| 115 | +The `prove_consonance` entry is the VCL-shaped one — stating claims about |
| 116 | +whether two IRs should be treated as equivalent given their provenance + |
| 117 | +tag semantics + temporal ordering. |
| 118 | + |
| 119 | +== Suggested Phase 4 test scenarios |
| 120 | + |
| 121 | +. *Round-trip UUID preservation* — already tested against Skein, reuse pattern against VerisimCore. |
| 122 | +. *Rewrite-graph traversal* — derive `trefoil → simplify → simplified-trefoil`, |
| 123 | + verify `parent_id` chains recoverable from VerisimCore. |
| 124 | +. *Cross-session consonance* — two synthetic sessions derive the same IR |
| 125 | + independently; VCL should see this as consonant, not conflicting. |
| 126 | +. *Consonance with a federated Vector shape* — add Jones-polynomial |
| 127 | + similarity search via federation, verify claims compose. |
| 128 | +. *Degradation case* — omit Semantic: what VCL claims weaken? Expected |
| 129 | + answer: tag-based queries become unsound, provenance claims stay sound. |
| 130 | + |
| 131 | +== Non-interference concern for KRLAdapter.jl |
| 132 | + |
| 133 | +If VerisimCore federates Vector (for Jones-polynomial similarity search), |
| 134 | +KRLAdapter.jl's existing `determinant`/`signature` integer invariants |
| 135 | +are Semantic-layer facts, not Vector-layer facts. Phase 2's |
| 136 | +non-interference proof obligation should verify that federating Vector |
| 137 | +does not weaken claims about these Semantic-layer invariants. |
| 138 | + |
| 139 | +== Do not modify |
| 140 | + |
| 141 | +* `KnotTheory.jl` — read-only community lib |
| 142 | +* `Skein.jl` — read-only community lib |
| 143 | +* `KRLAdapter.jl` itself — can be modified, but the `:verisim_core` extra |
| 144 | + in `TangleMetadata.extra` is the intended extension slot, not new |
| 145 | + breaking fields in TangleIR. |
| 146 | + |
| 147 | +== References |
| 148 | + |
| 149 | +* KRLAdapter.jl README: `/var/mnt/eclipse/repos/KRLAdapter.jl/README.adoc` |
| 150 | +* KRLAdapter.jl READINESS: `/var/mnt/eclipse/repos/KRLAdapter.jl/READINESS.md` |
| 151 | +* memory: `feedback_krl_adapter_boundary.md` |
| 152 | +* memory: `vcl-rename.md` (notes KRLAdapter as Verisim-interface slot) |
| 153 | +* Session context: KRL stack recovery 2026-04-05 — see KRLAdapter.jl git log. |
0 commit comments