@hviana/sema 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +114 -52
- package/HOW_IT_WORKS.md +275 -184
- package/dist/src/mind/bridge.d.ts +5 -7
- package/dist/src/mind/bridge.js +6 -97
- package/dist/src/mind/match.d.ts +159 -0
- package/dist/src/mind/match.js +300 -7
- package/dist/src/mind/mechanisms/prefix-completion.d.ts +22 -0
- package/dist/src/mind/{prefix-completion.js → mechanisms/prefix-completion.js} +64 -91
- package/dist/src/mind/mechanisms/recall.js +10 -108
- package/dist/src/mind/mechanisms/reference.d.ts +6 -0
- package/dist/src/mind/mechanisms/reference.js +296 -0
- package/dist/src/mind/mind.d.ts +1 -1
- package/dist/src/mind/pipeline-mechanism.d.ts +56 -1
- package/dist/src/mind/pipeline-mechanism.js +104 -3
- package/dist/src/mind/pipeline.d.ts +1 -1
- package/dist/src/mind/pipeline.js +13 -1
- package/dist/src/mind/traverse.d.ts +38 -0
- package/dist/src/mind/traverse.js +91 -1
- package/dist/src/store.d.ts +4 -4
- package/jsr.json +6 -0
- package/package.json +1 -1
- package/src/mind/bridge.ts +10 -104
- package/src/mind/match.ts +416 -7
- package/src/mind/{prefix-completion.ts → mechanisms/prefix-completion.ts} +66 -92
- package/src/mind/mechanisms/recall.ts +9 -126
- package/src/mind/mechanisms/reference.ts +343 -0
- package/src/mind/mind.ts +12 -8
- package/src/mind/pipeline-mechanism.ts +120 -3
- package/src/mind/pipeline.ts +16 -2
- package/src/mind/traverse.ts +92 -1
- package/src/store.ts +13 -4
- package/test/33-multi-candidate.test.mjs +21 -11
- package/test/70-prefix-completion.test.mjs +1 -1
- package/test/72-prefix-candidate-supply.test.mjs +7 -9
- package/test/74-prefix-trap-not-sprung-early.test.mjs +1 -1
- package/test/76-reference-binding.test.mjs +471 -0
- package/dist/src/mind/frame-filler.d.ts +0 -15
- package/dist/src/mind/frame-filler.js +0 -535
- package/dist/src/mind/prefix-completion.d.ts +0 -59
- package/src/mind/frame-filler.ts +0 -604
- package/test/69-frame-filler.test.mjs +0 -115
package/HOW_IT_WORKS.md
CHANGED
|
@@ -37,7 +37,9 @@ or machine — can follow it from first principles.
|
|
|
37
37
|
- [18. Grounding I — counterfactual transfer (CAST)](#18-grounding-i--counterfactual-transfer-cast)
|
|
38
38
|
- [19. Grounding II — cover: the graph search](#19-grounding-ii--cover-the-graph-search)
|
|
39
39
|
- [20. Grounding III — extraction by skill](#20-grounding-iii--extraction-by-skill)
|
|
40
|
-
- [
|
|
40
|
+
- [20.5 Grounding IV — reference: voicing a slot with the context's own bytes](#205-grounding-iv--reference-voicing-a-slot-with-the-contexts-own-bytes)
|
|
41
|
+
- [20.6 Grounding V — prefix completion: the query is an opening](#206-grounding-v--prefix-completion-the-query-is-an-opening)
|
|
42
|
+
- [21. Grounding VI — recall by resonance](#21-grounding-vi--recall-by-resonance)
|
|
41
43
|
- [22. Reasoning: the multi-hop chain](#22-reasoning-the-multi-hop-chain)
|
|
42
44
|
- [23. Fusion: multi-topic answers](#23-fusion-multi-topic-answers)
|
|
43
45
|
- [24. Articulation: answering in the asker's words](#24-articulation-answering-in-the-askers-words)
|
|
@@ -1363,22 +1365,33 @@ the vocabulary the rest of the document (and the codebase) speaks.
|
|
|
1363
1365
|
resolve. (§18.5)
|
|
1364
1366
|
- **Skill / exemplar** — a learned fact shaped "answer-is-a-span-of-context",
|
|
1365
1367
|
reusable as an extraction template on unseen text (§20).
|
|
1368
|
+
- **Slot / referent** — a position a frame's instances leave VARIABLE, and the
|
|
1369
|
+
bytes the asker puts there. The one place the engine represents "an occupant
|
|
1370
|
+
supplied by the context rather than the corpus"; without it no mechanism can
|
|
1371
|
+
distinguish "unexplained" from "open" (§20.5).
|
|
1372
|
+
- **Carriage / the reference licence** —
|
|
1373
|
+
`substituteAll(cont_i, fillers_i →
|
|
1374
|
+
fillers_j) == cont_j` over two instances
|
|
1375
|
+
of one frame: the corpus attesting, byte-exactly, that the answer is a
|
|
1376
|
+
function of the fillers and nothing else. Its failure is what separates
|
|
1377
|
+
`Run gcc main.c` (derivation) from a capital invented for a country the corpus
|
|
1378
|
+
never saw (§20.5).
|
|
1366
1379
|
- **Recall tiers** — the graded fallback for whole-query resonance: exact
|
|
1367
1380
|
self-match, argument binding, clean resonance, scaffolding-dominated
|
|
1368
|
-
consensus, the nearest grounded hit, then the
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
same currency. (§21)
|
|
1381
|
+
consensus, the nearest grounded hit, then the REFUSAL PATH (the substitution
|
|
1382
|
+
bridge), then echo or silence. Each reports _what it matched_ (`accounted`),
|
|
1383
|
+
its _moves_, and `unexplained`, so the decider compares it against every other
|
|
1384
|
+
mechanism in the same currency. (§21)
|
|
1373
1385
|
- **Substitution bridge** — refusal-path grounding through corroborated
|
|
1374
1386
|
substitutions: align the query byte-for-byte against a trained context and
|
|
1375
1387
|
accept a mismatch only under corroboration, graded identity, and RAW BALANCE
|
|
1376
1388
|
(the pre-expansion mismatch must be length-balanced). Its zero-substitution
|
|
1377
1389
|
reading is the IDENTITY bridge, which is `complete` (§21.5).
|
|
1378
1390
|
- **Prefix completion** — the query is a proper byte PREFIX of exactly one
|
|
1379
|
-
trained form, which is then voiced whole. Guarded by
|
|
1380
|
-
veto, a sub-quantum floor, and uniqueness on the
|
|
1381
|
-
|
|
1391
|
+
trained form, which is then voiced whole. Guarded by an
|
|
1392
|
+
unreadable-continuation veto, a sub-quantum floor, and uniqueness on the
|
|
1393
|
+
continuation BYTES. Its supply is `formsOpenedBy`, which repairs a
|
|
1394
|
+
RETRIEVABILITY gap no k can close (§20.6).
|
|
1382
1395
|
- **Frame-filler substitution** — INVENT A LOOKUP KEY, NEVER AN ANSWER: put a
|
|
1383
1396
|
candidate filler where a definite description stands and require the store to
|
|
1384
1397
|
already hold that key byte-exactly. Constituency is read relationally, from
|
|
@@ -2467,9 +2480,8 @@ the modules of the implementation; see AGENTS.md, "Where things live".)
|
|
|
2467
2480
|
│ bridge (→ junction) · │
|
|
2468
2481
|
│ pivotInto · meaningOf │
|
|
2469
2482
|
├───────────────────────────────────┤
|
|
2470
|
-
│ recall's refusal
|
|
2471
|
-
│
|
|
2472
|
-
│ prefixCompletion · frameFiller │
|
|
2483
|
+
│ recall's refusal path (§21.5): │
|
|
2484
|
+
│ substitutionBridge │
|
|
2473
2485
|
└──┬──────────────┬────────────────┘
|
|
2474
2486
|
│ │
|
|
2475
2487
|
L2 DECOMPOSITION ┌──▼──────────┐ ┌─▼────────────────────────────┐
|
|
@@ -2536,13 +2548,13 @@ How to read the layers:
|
|
|
2536
2548
|
of computation. The junction ascent sits as a shared utility consumed by both
|
|
2537
2549
|
L3 (the bridge's Tier 1 connector search) and L4 (cross-region attention's
|
|
2538
2550
|
joint-context recovery).
|
|
2539
|
-
- **L5** are the
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2551
|
+
- **L5** are the six grounding strategies plus the two post-grounding extenders.
|
|
2552
|
+
Their candidates are **weighed together** by the grounding decider of §14.1 —
|
|
2553
|
+
no fixed priority ladder; the lightest grounding derivation wins. Their
|
|
2554
|
+
_dependency_ structure is what the diagram shows — e.g. extraction depends on
|
|
2555
|
+
the climb (to find an exemplar) and on resonance (to locate frames), but never
|
|
2556
|
+
on cover or CAST. Confluence (like CAST) depends on the climb and on canonical
|
|
2557
|
+
window identity.
|
|
2546
2558
|
- **L6** is orchestration only: `think` sequences L5, `articulate` closes the
|
|
2547
2559
|
loop, and the rationale tracer observes every layer without being depended on
|
|
2548
2560
|
by any.
|
|
@@ -3984,7 +3996,201 @@ query bytes its frames did not cover (§14.1).
|
|
|
3984
3996
|
|
|
3985
3997
|
---
|
|
3986
3998
|
|
|
3987
|
-
##
|
|
3999
|
+
## 20.5 Grounding IV — reference: voicing a slot with the context's own bytes
|
|
4000
|
+
|
|
4001
|
+
Sema is otherwise a **fully ground system**. Every item of the deduction system,
|
|
4002
|
+
every matcher and every gate compares ground bytes; nothing anywhere represents
|
|
4003
|
+
a position whose occupant comes from the context rather than the corpus. The
|
|
4004
|
+
consequence is that no mechanism can distinguish
|
|
4005
|
+
|
|
4006
|
+
```
|
|
4007
|
+
"the corpus does not explain these bytes" -> PASS, refuse
|
|
4008
|
+
"these bytes occupy a place the corpus keeps open" -> bind
|
|
4009
|
+
```
|
|
4010
|
+
|
|
4011
|
+
Both arrive as unaligned residue. That single missing distinction is why the
|
|
4012
|
+
substitution bridge refuses on `attestedQ`, why the cover charges PASS over a
|
|
4013
|
+
filename, and why a query that names something new inside an otherwise familiar
|
|
4014
|
+
frame — `How do I compile main.c?` against a corpus that knows hello.c, server.c
|
|
4015
|
+
and parser.c — grounds nothing, while the corpus attests three times over
|
|
4016
|
+
exactly what to do with a name in that slot.
|
|
4017
|
+
|
|
4018
|
+
### The act: position, not equivalence
|
|
4019
|
+
|
|
4020
|
+
A **substitution asserts equivalence** — "these two spans mean the same" — and
|
|
4021
|
+
nothing can corroborate an equivalence claim about bytes the corpus has never
|
|
4022
|
+
seen. That is why `attestedQ` demands the query-side span be attested, and the
|
|
4023
|
+
bridge is right to refuse this shape.
|
|
4024
|
+
|
|
4025
|
+
A **reference asserts no equivalence**. It asserts _position_: "this is the
|
|
4026
|
+
thing you named, where the corpus keeps one." The bytes come from the asker, so
|
|
4027
|
+
voicing them cannot fabricate corpus knowledge. What _can_ be fabricated is the
|
|
4028
|
+
**relation** claimed about them, and that is the licence's whole subject.
|
|
4029
|
+
|
|
4030
|
+
### The licence: is the answer a carriage of its fillers?
|
|
4031
|
+
|
|
4032
|
+
For two instances _i_, _j_ of one frame, one byte predicate decides:
|
|
4033
|
+
|
|
4034
|
+
```
|
|
4035
|
+
substituteAll(cont_i, fillers_i -> fillers_j) == cont_j
|
|
4036
|
+
```
|
|
4037
|
+
|
|
4038
|
+
When it holds, the corpus attests byte-exactly that the continuation is a
|
|
4039
|
+
function of the fillers and nothing else, so putting a new occupant through the
|
|
4040
|
+
same carriage is derivation rather than invention. No threshold, no similarity,
|
|
4041
|
+
no new constant — the store's own instances decide, exactly as the bridge's
|
|
4042
|
+
`unanimous` decides whether a frame is a value slot. Three readings fall out:
|
|
4043
|
+
|
|
4044
|
+
- **Carried** — the continuation quotes the fillers, so the referents are
|
|
4045
|
+
spliced in (`Run gcc main.c`). The carriage may be structural: with the slot
|
|
4046
|
+
contracted to its varying core, `Run gcc hello.c -o hello` carries its filler
|
|
4047
|
+
to _two_ places, and both follow the referent.
|
|
4048
|
+
- **Absorbed** — the continuation is constant across distinct fillers, so the
|
|
4049
|
+
test passes vacuously and the frame's answer stands as-is.
|
|
4050
|
+
- **Refused** — the continuation carries filler-_dependent_ content, which is
|
|
4051
|
+
knowledge about _which_ filler and cannot exist for a new one.
|
|
4052
|
+
|
|
4053
|
+
The refusal is load-bearing, and at corpus scale it is the only thing standing
|
|
4054
|
+
between this mechanism and invented facts. Measured on the 15.7M-node store,
|
|
4055
|
+
`What is the capital of Zamunda?` resonates to a **pure cohort** — every one of
|
|
4056
|
+
the top 14 hits an instance of `What is the capital of X?` — with an unambiguous
|
|
4057
|
+
slot. Every structural gate passes; only the licence refuses, on
|
|
4058
|
+
`replace("Tokyo", "Japan" -> "France") != "Paris"`.
|
|
4059
|
+
|
|
4060
|
+
**Any number of slots, one predicate.** A query may name several new things at
|
|
4061
|
+
once, and a frame with two slots is not two frames. Swapping every filler
|
|
4062
|
+
_simultaneously_ and demanding the attested continuation back is one test
|
|
4063
|
+
whatever the arity, so a frame whose answer tracks one slot but invents around
|
|
4064
|
+
another fails exactly as a single-slot value slot does. Simultaneity is not a
|
|
4065
|
+
detail: applied in sequence, one substitution's output becomes another's input
|
|
4066
|
+
and the result depends on the order slots happened to be found in.
|
|
4067
|
+
|
|
4068
|
+
### Why the slot is an alignment gap, not "the novel part"
|
|
4069
|
+
|
|
4070
|
+
The intuitive delimiter — "the part the corpus has never seen" — fails twice,
|
|
4071
|
+
and both failures are measured:
|
|
4072
|
+
|
|
4073
|
+
- It only **brackets** the slot. Attestation is read over W-windows, so a novel
|
|
4074
|
+
run is dilated by up to W−1 at each edge: the filler `main.c` comes back as
|
|
4075
|
+
`main.c?`, and splicing that carries the asker's punctuation into the answer.
|
|
4076
|
+
- At corpus scale it **does not fire at all**. At 325,615 contexts every window
|
|
4077
|
+
of `Zamunda` and `flurbish` is already attested somewhere, so
|
|
4078
|
+
novelty-by-existence reports "not a reference" for the very queries this
|
|
4079
|
+
exists for.
|
|
4080
|
+
|
|
4081
|
+
The gap between the query and an instance of its frame **is** the varying slot,
|
|
4082
|
+
by construction. So the frame reading reuses the same seeded aligner the bridge
|
|
4083
|
+
does and asks the opposite question of its output: the bridge **expands** a gap
|
|
4084
|
+
until the query side attests, the frame reading **contracts** it to its varying
|
|
4085
|
+
core.
|
|
4086
|
+
|
|
4087
|
+
### Where the machinery lives, and why it is not one mechanism's
|
|
4088
|
+
|
|
4089
|
+
The three parts sit at three different altitudes (§14.4), and the split is the
|
|
4090
|
+
design:
|
|
4091
|
+
|
|
4092
|
+
- the **matcher** (`frameSlots`) is bytes only, and safe for every consumer —
|
|
4093
|
+
knowing a span is variable can only improve an alignment;
|
|
4094
|
+
- the **gate** (`carriesFillers`) is the much stronger claim that a slot may be
|
|
4095
|
+
_voiced through_, so it is deliberately not folded into the matcher;
|
|
4096
|
+
- the **inventory** (`Precomputed.frames`) reports every pairing and elects no
|
|
4097
|
+
frame, because a slot is a property of a _pairing_, not of the query.
|
|
4098
|
+
Committing to one reading inside the shared container would push whichever
|
|
4099
|
+
consumer asked first onto every other. Election is each consumer's own; the
|
|
4100
|
+
reference mechanism elects the modal slot signature.
|
|
4101
|
+
|
|
4102
|
+
Making a notion available is not the same as imposing it. Two mechanisms
|
|
4103
|
+
deliberately do **not** consume it: the substitution bridge, because it grounds
|
|
4104
|
+
through its candidate's continuation _unsubstituted_ and would therefore voice
|
|
4105
|
+
the corpus's filler for the asker's referent (measured:
|
|
4106
|
+
`How do you say
|
|
4107
|
+
'flurbish' in French?` answers "the way to say hello is
|
|
4108
|
+
Bonjour"); and CAST, whose frame gate is weave-local while a slot is
|
|
4109
|
+
cohort-local — substituting one population for the other is the error §8.10
|
|
4110
|
+
names.
|
|
4111
|
+
|
|
4112
|
+
### Evidence, price, and what it refuses to say
|
|
4113
|
+
|
|
4114
|
+
Reference reports the frame it matched literally **and** every slot as
|
|
4115
|
+
`accounted`: a slot is not a hole in the explanation but an act it paid for —
|
|
4116
|
+
one STEP each — and leaving it unaccounted would charge the same act twice, once
|
|
4117
|
+
as a move and once at PASS per byte (§19.4). Its `moves` are one binding per
|
|
4118
|
+
slot plus one edge follow, so a two-slot binding claims strictly more than a
|
|
4119
|
+
one-slot one and the smaller claim wins where both are licensed. It is
|
|
4120
|
+
deliberately not CONCEPT: the ladder reserves that for halo-mediated acts, and a
|
|
4121
|
+
reference is decided by byte identity.
|
|
4122
|
+
|
|
4123
|
+
It reports no `scaffolding` — that field counts answer bytes carried through
|
|
4124
|
+
_because nothing explained them_, and a referent is carried because the slot
|
|
4125
|
+
explains it. And it is always `complete` (§14.1): the bound answer is a byte
|
|
4126
|
+
string the mechanism **constructed**, which the corpus never said, so pivoting
|
|
4127
|
+
through it would treat the engine's own construction as a trained fact. Measured
|
|
4128
|
+
without it, on a corpus that also holds `Run gcc main.c` as a context: the
|
|
4129
|
+
binding produced `Run gcc main.c`, the multi-hop chain pivoted straight past it
|
|
4130
|
+
into that context's own continuation, and the answer was lost.
|
|
4131
|
+
|
|
4132
|
+
Three structural refusals complete it: a slot under one river window is chance
|
|
4133
|
+
rather than a referent (§8.2); two slots naming the same bytes are ambiguous,
|
|
4134
|
+
since nothing says which occurrence stands for which; and a referent lying
|
|
4135
|
+
inside a completed reply is not the asker's — quoting the engine's own output
|
|
4136
|
+
back would launder invention into evidence, the same rule the weave applies when
|
|
4137
|
+
it aligns only the asker's stream (§24.5).
|
|
4138
|
+
|
|
4139
|
+
The mechanism's reach is bounded by the shared top-_k_ it reads, so a frame the
|
|
4140
|
+
corpus instantiates only _once_ within _k_ is out of range and it abstains.
|
|
4141
|
+
Abstaining on thin evidence is the honest reading, and it is what keeps this
|
|
4142
|
+
from becoming a cheaper route to the fabrications the licence exists to refuse.
|
|
4143
|
+
|
|
4144
|
+
---
|
|
4145
|
+
|
|
4146
|
+
## 20.6 Grounding V — prefix completion: the query is an opening
|
|
4147
|
+
|
|
4148
|
+
`The capital of France is` grounds nothing, while
|
|
4149
|
+
`The capital of France is Paris.` is trained and reads back byte-exact. The
|
|
4150
|
+
query is not _similar_ to that form, it is a **proper prefix** of it: every
|
|
4151
|
+
query byte is a literal match, in order, from offset zero. That is the strongest
|
|
4152
|
+
grounding relation in the store, and nothing is invented — the answer IS a
|
|
4153
|
+
trained form, voiced whole.
|
|
4154
|
+
|
|
4155
|
+
Two independent reasons keep the earlier mechanisms from reaching it, both
|
|
4156
|
+
measured. `resolve(prefix)` is null, because a proper prefix of a deposited
|
|
4157
|
+
stream has no branch of its own. And the form is not among the resonance
|
|
4158
|
+
candidates **at all**: cos(query, form) = 0.5752, yet the form is absent from
|
|
4159
|
+
`resonate(k)` at k = 24, 256 _and_ 2048, while forms scoring lower are returned
|
|
4160
|
+
— `k` only reorders within the IVF clusters already probed. So this is a
|
|
4161
|
+
**retrievability** gap, not a semantic one.
|
|
4162
|
+
|
|
4163
|
+
That distinction decides where the machinery lives. The **supply** —
|
|
4164
|
+
`formsOpenedBy` (`traverse.ts`) — answers a question about the _store_: "which
|
|
4165
|
+
trained forms does this byte run open?" It reads the write side's own sub-span
|
|
4166
|
+
window index (§11.3) and climbs containment then parents under a √N budget. Leaf
|
|
4167
|
+
ids are position-invariant where a fold is not, which is why this route works
|
|
4168
|
+
where the query's own fold cannot. It is retrieval machinery any mechanism may
|
|
4169
|
+
ask, not one mechanism's helper.
|
|
4170
|
+
|
|
4171
|
+
The **decision** is three guards, each falsified into existence:
|
|
4172
|
+
|
|
4173
|
+
1. **An unreadable continuation vetoes.** A candidate that opens with the query
|
|
4174
|
+
but saturates the bounded read continues out of sight. Skipping it is what
|
|
4175
|
+
manufactures a fragment: measured, suppressing the one disagreeing candidate
|
|
4176
|
+
let uniqueness pass on an interior fold node and voiced a mid-form slice.
|
|
4177
|
+
2. **The continuation must reach one grouping window.** Below W there is no
|
|
4178
|
+
structure to voice, whatever the modality.
|
|
4179
|
+
3. **Uniqueness**, judged on the continuation _bytes_ — the same continuation
|
|
4180
|
+
reached through two forms is one answer, not an ambiguity. A sub-quantum or
|
|
4181
|
+
unreadable competitor still _counts_ as a disagreement even though it cannot
|
|
4182
|
+
be voiced, or guard 3 passes vacuously.
|
|
4183
|
+
|
|
4184
|
+
It is a **mechanism**, registered last. Its claim is maximal (the whole query
|
|
4185
|
+
accounted, one STEP), so in the market it wins where it fires and is pruned by
|
|
4186
|
+
`worthRunning` where a cheaper incumbent exists. Last position is not timidity:
|
|
4187
|
+
recall's exact self-match makes an _identity_ claim about the query while this
|
|
4188
|
+
makes a _containment_ one, and on an exact grade tie the identity claim is the
|
|
4189
|
+
stronger evidence — the same ordering the graded ladders use throughout (§6.2).
|
|
4190
|
+
|
|
4191
|
+
---
|
|
4192
|
+
|
|
4193
|
+
## 21. Grounding VI — recall by resonance
|
|
3988
4194
|
|
|
3989
4195
|
Recall handles queries whose own decomposition composed nothing: resonate the
|
|
3990
4196
|
_whole query's gist_ and ground the nearest learned form. It is the most
|
|
@@ -4125,17 +4331,18 @@ past the reach bar (observed). Only the **above-chance** part of a similarity is
|
|
|
4125
4331
|
evidence of shared content, so the significance bar (3/√D, §8.3) is subtracted
|
|
4126
4332
|
before the conversion. Derived from the existing bars; never tuned.
|
|
4127
4333
|
|
|
4128
|
-
### 21.5 The refusal path —
|
|
4334
|
+
### 21.5 The refusal path — the substitution bridge, before silence
|
|
4129
4335
|
|
|
4130
|
-
Everything geometric has now failed.
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4336
|
+
Everything geometric has now failed. One tier remains, making a **structural**
|
|
4337
|
+
claim about the query that resonance cannot state. It reads the response's
|
|
4338
|
+
**wide candidate list** (`Precomputed.wideResonance`, §14.5) — the ranked hits,
|
|
4339
|
+
widened to an exhaustive index scan only when the top hit clears the concept
|
|
4340
|
+
threshold. When the query gist has no concept-level match to anything stored, an
|
|
4341
|
+
exhaustive scan would only score more vectors below the bar (profiled at 38–40K
|
|
4342
|
+
vectors scored per refusing query on a 325K-context store, costing 44% of
|
|
4343
|
+
think). Whether the gist ranks _anything_ at concept level is the discriminator
|
|
4344
|
+
— corpus size never was. The list is shared response-wide, so whichever
|
|
4345
|
+
mechanism first-touches it pays once and every later reader is free.
|
|
4139
4346
|
|
|
4140
4347
|
#### The substitution bridge
|
|
4141
4348
|
|
|
@@ -4197,113 +4404,6 @@ and lost to a comparison voicing the wrong country). The **identity** reading
|
|
|
4197
4404
|
zero substitutions — is additionally marked `complete` (§14.1): the query _is_
|
|
4198
4405
|
that trained context, so its continuation is the whole read-out.
|
|
4199
4406
|
|
|
4200
|
-
#### Prefix completion
|
|
4201
|
-
|
|
4202
|
-
The query is not _similar_ to a trained form; it is a **proper prefix** of one —
|
|
4203
|
-
every byte a literal match, in order, from offset zero. That is the strongest
|
|
4204
|
-
grounding relation in the store, stronger than a corroborated substitution and
|
|
4205
|
-
stronger than resonance, which only claims an angle. Nothing is invented: the
|
|
4206
|
-
answer IS a trained form, voiced whole.
|
|
4207
|
-
|
|
4208
|
-
The earlier tiers cannot reach it, for two independently measured reasons.
|
|
4209
|
-
`resolve(prefix)` is null — a proper prefix of a deposited stream has no branch
|
|
4210
|
-
of its own. And the form is frequently absent from the ranked list _at any k_:
|
|
4211
|
-
measured, cos(query, form) = 0.5752 while the form is missing from `resonate` at
|
|
4212
|
-
k = 24, 256 and 2048, with lower-scoring forms returned instead, because k only
|
|
4213
|
-
reorders within the IVF clusters already probed. This is a **retrievability**
|
|
4214
|
-
gap, not a semantic one. When the candidate list supplies nothing, a second
|
|
4215
|
-
supply proposes from the write side's own leaf-id window index: leaf ids are
|
|
4216
|
-
position-invariant (content-addressed on single bytes) where a fold is not, so a
|
|
4217
|
-
prefix shares the deposit's window nodes exactly and reaches it by climbing
|
|
4218
|
-
containment then parents, under the same √N budget everything else obeys.
|
|
4219
|
-
|
|
4220
|
-
Three guards, each falsified into existence, none droppable:
|
|
4221
|
-
|
|
4222
|
-
1. **An unreadable continuation vetoes.** Reads are bounded, so a candidate
|
|
4223
|
-
opening with the query but _saturating_ the read continues in a way nobody
|
|
4224
|
-
can see. It must not be quietly skipped — the skip is what manufactures a
|
|
4225
|
-
fragment. Measured: a query matched both a whole 138-byte form (saturating)
|
|
4226
|
-
and a 34-byte interior node; skipping the saturated candidate removed the
|
|
4227
|
-
only evidence that disagreed, uniqueness then passed, and a mid-form slice
|
|
4228
|
-
was voiced as an answer.
|
|
4229
|
-
2. **The continuation must reach one grouping window.** Below W it is
|
|
4230
|
-
sub-quantum — the fold groups nothing from it.
|
|
4231
|
-
3. **Uniqueness.** Several trained forms may open with the query and continue
|
|
4232
|
-
differently; then the corpus does not say which the asker means. Distinct
|
|
4233
|
-
continuations ⇒ refuse. Uniqueness is judged on the continuation _bytes_, not
|
|
4234
|
-
the candidate id: one continuation reached through two forms is one answer.
|
|
4235
|
-
|
|
4236
|
-
This is the documented **prefix trap**, and it is real — just not for every
|
|
4237
|
-
prefix. Measured over 15 battery probes, exactly one yields a unique
|
|
4238
|
-
continuation, and all three honest-silence probes yield none. The tier accounts
|
|
4239
|
-
for the whole query and costs one STEP; it is _not_ marked complete, since the
|
|
4240
|
-
form may carry more past the remainder voiced.
|
|
4241
|
-
|
|
4242
|
-
#### Frame-filler substitution
|
|
4243
|
-
|
|
4244
|
-
The remaining shape is compositional: "What is the capital of the country where
|
|
4245
|
-
the Eiffel Tower is?" sits one edge away from the trained "What is the capital
|
|
4246
|
-
of France?", differing by a single contiguous span where a **definite
|
|
4247
|
-
description** stands in a **proper noun's** place. Every earlier tier correctly
|
|
4248
|
-
declines — the constituent is not an edge source, the gist tiers are blind (cos
|
|
4249
|
-
= 0.0076, with "capital of Spain" scoring _higher_), and the bridge refuses on
|
|
4250
|
-
raw balance, as it must: a short span standing for a long one is exactly how a
|
|
4251
|
-
wrong fact once got voiced.
|
|
4252
|
-
|
|
4253
|
-
The reframing is the point. The bridge asks whether two spans are _similar_; a
|
|
4254
|
-
description and the noun it denotes are not similar, they are
|
|
4255
|
-
**co-referential**, so no similarity threshold can separate this case from that
|
|
4256
|
-
fabrication. So this tier does not try:
|
|
4257
|
-
|
|
4258
|
-
> **It invents a lookup key, never an answer.**
|
|
4259
|
-
|
|
4260
|
-
Build the query with a candidate filler in the description's place, and require
|
|
4261
|
-
the **store itself** to already hold that key, byte-exactly, by content address.
|
|
4262
|
-
The answer is then the trained continuation of a form the store verifiably has —
|
|
4263
|
-
the same grounding tier 0 performs. A key the store does not hold is discarded.
|
|
4264
|
-
|
|
4265
|
-
Four guards, each falsified into existence on a 15.7M-node store:
|
|
4266
|
-
|
|
4267
|
-
1. The evidence hit must literally contain the description's **rarest** unit.
|
|
4268
|
-
Pooling fillers from every ranked hit gave one query nine resolving keys
|
|
4269
|
-
dominated by the wrong one; qualifying on any _shared_ unit earned a
|
|
4270
|
-
confident wrong answer off the scaffolding unit "write".
|
|
4271
|
-
2. The frame must be **non-empty** — the description is a proper sub-span.
|
|
4272
|
-
Otherwise a "substitution" replaces the whole query.
|
|
4273
|
-
3. The key must **resolve** byte-exactly and lead somewhere.
|
|
4274
|
-
4. Exactly **one** stored form may survive. "What is the capital of Zamunda?"
|
|
4275
|
-
produces 24 resolving keys in weaker variants (Chile, India, Japan, Italy…) —
|
|
4276
|
-
fabrication, refused by ambiguity. The same discipline argument binding
|
|
4277
|
-
applies.
|
|
4278
|
-
|
|
4279
|
-
Resolution alone is not the safety argument: holding the frame fixed and varying
|
|
4280
|
-
only the filler makes byte-exact resolution look like a perfect filter, but when
|
|
4281
|
-
the description is searched too, 95,836 candidate keys were tried and 9
|
|
4282
|
-
resolved. Resolution is necessary, never sufficient; the guards are what make it
|
|
4283
|
-
sound.
|
|
4284
|
-
|
|
4285
|
-
**Where constituency comes from.** This tier substitutes one _constituent_ for
|
|
4286
|
-
another, so it must know where a constituent begins — and there is no character
|
|
4287
|
-
class here, no separator, no "word", because Sema has none. A byte value cannot
|
|
4288
|
-
say whether it delimits; asserting a class over the alphabet overrides what the
|
|
4289
|
-
corpus is able to state itself. The reading used is the store's own, already
|
|
4290
|
-
spelled out in the weave and CAST's frame gate: **a byte is frame when more than
|
|
4291
|
-
half the aligned structures share it, and a span is frame when more than half
|
|
4292
|
-
its bytes are.** Scaffolding is what many exemplars have in common; content is
|
|
4293
|
-
what tells them apart. So the spans come from literal alignment and the
|
|
4294
|
-
judgement is half-dominance — both modality-free by construction; in a grid the
|
|
4295
|
-
padding value would fall out as frame on exactly this test, with nothing
|
|
4296
|
-
rewritten. Asking "what are the units of this byte string?" has no answer here,
|
|
4297
|
-
and every attempt to derive one failed: the fold's own cuts land
|
|
4298
|
-
mid-constituent, interning is uninformative because every W-window is interned,
|
|
4299
|
-
and recognition returns only whole learnt forms — all three read _one_ string
|
|
4300
|
-
alone. Constituency is **relational**, a property of what the corpus agrees on
|
|
4301
|
-
across exemplars, and only a comparison can expose it.
|
|
4302
|
-
|
|
4303
|
-
The tier accounts for the whole query at CONCEPT + STEP, under the same
|
|
4304
|
-
restatement and manufactured-answer guards: a projection contained in the filler
|
|
4305
|
-
is the substitution restated as knowledge.
|
|
4306
|
-
|
|
4307
4407
|
### 21.6 Echo, or silence
|
|
4308
4408
|
|
|
4309
4409
|
If everything above declines, one decision remains: echo the nearest stored
|
|
@@ -4561,12 +4661,19 @@ grows with the corpus.
|
|
|
4561
4661
|
Sema's answers carry their epistemology with them, at two grains:
|
|
4562
4662
|
|
|
4563
4663
|
**Provenance** — every response is tagged with the mechanism that grounded it:
|
|
4564
|
-
`cast`, `join`, `cover`, `extract`, `
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4664
|
+
`cast`, `join`, `cover`, `extract`, `reference`, `prefix`, `recall`, or
|
|
4665
|
+
`recall-echo`. Four of these carry information a consumer can gate on
|
|
4666
|
+
mechanically:
|
|
4667
|
+
|
|
4668
|
+
- `join` — the answer was produced by intersecting independent constraint
|
|
4669
|
+
streams (confluence, §18.5): a conjunctive query no single fact holds.
|
|
4670
|
+
- `reference` — part of the answer is bytes the ASKER supplied, voiced through a
|
|
4671
|
+
slot the corpus attests as a carriage (§20.5), so a consumer knows which part
|
|
4672
|
+
came from the context rather than the corpus.
|
|
4673
|
+
- `prefix` — the query is the literal opening of exactly one trained form, which
|
|
4674
|
+
was voiced whole (§20.6).
|
|
4675
|
+
- `recall-echo` — the honesty flag of §21's echo tier: the bytes are a stored
|
|
4676
|
+
form returned verbatim for being _near_, not a derived fact.
|
|
4570
4677
|
|
|
4571
4678
|
**Rationale** — on request, the response includes the complete replayable trace:
|
|
4572
4679
|
every mechanism's entries and exits, and — at the finest grain — every rule
|
|
@@ -4789,7 +4896,8 @@ think(query, mechanisms ≔ defaultMechanisms):
|
|
|
4789
4896
|
# Weights are compared at STEP resolution (grade ≔ ⌊w/STEP⌋): sub-STEP
|
|
4790
4897
|
# costs (MICRO) are non-ordering bookkeeping. Grade TIES keep the
|
|
4791
4898
|
# earlier candidate — the mechanism list's own order (cover, cast,
|
|
4792
|
-
# confluence, extract, recall — see
|
|
4899
|
+
# confluence, extract, reference, recall, prefix — see
|
|
4900
|
+
# defaultMechanisms).
|
|
4793
4901
|
|
|
4794
4902
|
best ≔ ∅
|
|
4795
4903
|
grade(w) ≔ ⌊w / STEP⌋
|
|
@@ -5079,14 +5187,16 @@ recallByResonance(query, pre):
|
|
|
5079
5187
|
if g ≠ ∅ ∧ fracOfQuery(cos(gistOf(query), gistOf(g)), |g|) ≥ REACH:
|
|
5080
5188
|
return { bytes: g, accounted: nothing, moves: STEP }
|
|
5081
5189
|
|
|
5082
|
-
# ── the REFUSAL PATH
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5190
|
+
# ── the REFUSAL PATH ─────────────────────────────────────────────
|
|
5191
|
+
# pre.wideResonance() — the response's ONE wide candidate list, shared
|
|
5192
|
+
# by every mechanism that must look past the top-k:
|
|
5193
|
+
# hits[0].score ≥ CONCEPT_BAR
|
|
5194
|
+
# ? exhaustive resonate(gistOf(query), hubBound) # ids only
|
|
5195
|
+
# : hits # the gist ranks nothing at concept
|
|
5196
|
+
# # level, so a wider scan says nothing
|
|
5087
5197
|
|
|
5088
5198
|
# 3b. substitution / identity bridge
|
|
5089
|
-
bridged ≔ substitutionBridge(query,
|
|
5199
|
+
bridged ≔ substitutionBridge(query, pre.wideResonance)
|
|
5090
5200
|
# anchors: rarest query windows → edgeAncestors, plus wideIds
|
|
5091
5201
|
# align byte-for-byte; a mismatch substitutes only under
|
|
5092
5202
|
# CORROBORATION ∧ GRADED IDENTITY ∧ RAW BALANCE
|
|
@@ -5096,31 +5206,12 @@ recallByResonance(query, pre):
|
|
|
5096
5206
|
g ≔ project(bridged.id, guide)
|
|
5097
5207
|
manufactured ≔ g lies inside one of bridged's substituted spans
|
|
5098
5208
|
strictPrefix ≔ bridged.subs = ∅ ∧ query is a strict byte prefix
|
|
5099
|
-
of read(bridged.id) # deferred to
|
|
5209
|
+
of read(bridged.id) # deferred to §20.6
|
|
5100
5210
|
if g ≠ ∅ ∧ ¬restates(g) ∧ ¬manufactured ∧ ¬strictPrefix ∧ ¬fragment(g):
|
|
5101
5211
|
return { bytes: g, accounted: bridged.accounted,
|
|
5102
5212
|
moves: CONCEPT·|bridged.subs| + STEP,
|
|
5103
5213
|
complete: bridged.subs = ∅ } # the IDENTITY bridge
|
|
5104
5214
|
|
|
5105
|
-
# 3b′. prefix completion — the candidate list first, then the write
|
|
5106
|
-
# side's own leaf-id window index as the supply of last resort
|
|
5107
|
-
completed ≔ prefixCompletion(query, wideIds())
|
|
5108
|
-
?? prefixCompletion(query, prefixCandidates(query))
|
|
5109
|
-
# guards: an UNREADABLE continuation VETOES; the continuation
|
|
5110
|
-
# must reach W; distinct continuation BYTES ⇒ refuse
|
|
5111
|
-
if completed ≠ ∅:
|
|
5112
|
-
return { bytes: completed.form, accounted: whole_, moves: STEP }
|
|
5113
|
-
|
|
5114
|
-
# 3c. frame-filler substitution — invent a KEY, never an answer
|
|
5115
|
-
filled ≔ frameFillerSubstitution(query, wideIds())
|
|
5116
|
-
# the evidence hit must hold the description's RAREST unit;
|
|
5117
|
-
# the frame must be non-empty; the constructed key must
|
|
5118
|
-
# RESOLVE and lead somewhere; exactly ONE may survive
|
|
5119
|
-
if filled ≠ ∅:
|
|
5120
|
-
g ≔ project(filled.id, guide)
|
|
5121
|
-
if g ≠ ∅ ∧ ¬restates(g) ∧ g ⊄ filled.filler ∧ ¬fragment(g):
|
|
5122
|
-
return { bytes: g, accounted: whole_, moves: CONCEPT + STEP }
|
|
5123
|
-
|
|
5124
5215
|
# ── echo or silence — decided on the EXACT fold, never an estimate ─
|
|
5125
5216
|
topBytes ≔ read(hits[0])
|
|
5126
5217
|
if fracOfQuery(cos(gistOf(query), gistOf(topBytes)), |topBytes|) < REACH:
|
|
@@ -5588,20 +5679,20 @@ n = input/query length; D = dimension; W = fold window; N = learned contexts; k
|
|
|
5588
5679
|
all index queries are sub-linear in the collection (empirically ≈ N^0.32
|
|
5589
5680
|
distance computations).
|
|
5590
5681
|
|
|
5591
|
-
| Operation | Cost
|
|
5592
|
-
| :------------------------- |
|
|
5593
|
-
| Perceive | O(n) rolling-hash pass + O(n·D) vector work; O(n) nodes. A stream EXTENDING an already-folded one costs O(new bytes) — cuts are stable under append and unchanged segments are reused (§10.4)
|
|
5594
|
-
| Deposit (intern + windows) | O(n) content-addressed probes; the intern walk itself is O(new nodes) when a prefix was already interned
|
|
5595
|
-
| Learn a pair | O(1) edge + O(changed) halo pours + one flat-branch probe per suffix offset (suffix propagation, §12.1)
|
|
5596
|
-
| Recognise | O(n·W) bounded probes
|
|
5597
|
-
| Canonical resolution | one canonicalization + one hash probe + one verify read per candidate; only on an exact-lookup miss
|
|
5598
|
-
| Consensus climb | O(regions · k) index queries + expand-until-decided: work bounded by √N per region regardless of corpus size (LIMITed store reads, indexed existence probes)
|
|
5599
|
-
| Cover search | output-sensitive A\*LD: proportional to the lightest derivation, not the corpus (§5.2); the dominant per-query index cost is connector pre-resolution, O(sites) queries
|
|
5600
|
-
| Recall (answering tiers) | O(k) index probes + graded structural checks
|
|
5601
|
-
| Recall (refusal path) | Nothing on an answering path. One shared candidate list (exhaustive only when the top hit clears the concept bar), then O(\|query\|) content-hash probes, ≤ W anchor climbs, and one O(\|query\|·\|candidate\|)-bounded alignment each
|
|
5602
|
-
| Reasoning | ≤ K hops, each bounded by the answer's subtree
|
|
5603
|
-
| Storage | O(distinct subtrees); vector index over resonance targets only, 1-bit codes (32× compression)
|
|
5604
|
-
| Profiling | free when off; when on, one counter bump per logical operation and one timer per named phase — never read by inference
|
|
5682
|
+
| Operation | Cost | Where |
|
|
5683
|
+
| :------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------- |
|
|
5684
|
+
| Perceive | O(n) rolling-hash pass + O(n·D) vector work; O(n) nodes. A stream EXTENDING an already-folded one costs O(new bytes) — cuts are stable under append and unchanged segments are reused (§10.4) | §10 |
|
|
5685
|
+
| Deposit (intern + windows) | O(n) content-addressed probes; the intern walk itself is O(new nodes) when a prefix was already interned | §11 |
|
|
5686
|
+
| Learn a pair | O(1) edge + O(changed) halo pours + one flat-branch probe per suffix offset (suffix propagation, §12.1) | §12 |
|
|
5687
|
+
| Recognise | O(n·W) bounded probes | §15 |
|
|
5688
|
+
| Canonical resolution | one canonicalization + one hash probe + one verify read per candidate; only on an exact-lookup miss | §3.4 |
|
|
5689
|
+
| Consensus climb | O(regions · k) index queries + expand-until-decided: work bounded by √N per region regardless of corpus size (LIMITed store reads, indexed existence probes) | §17 |
|
|
5690
|
+
| Cover search | output-sensitive A\*LD: proportional to the lightest derivation, not the corpus (§5.2); the dominant per-query index cost is connector pre-resolution, O(sites) queries | §19 |
|
|
5691
|
+
| Recall (answering tiers) | O(k) index probes + graded structural checks | §21 |
|
|
5692
|
+
| Recall (refusal path) | Nothing on an answering path. One shared candidate list (exhaustive only when the top hit clears the concept bar), then O(\|query\|) content-hash probes, ≤ W anchor climbs, and one O(\|query\|·\|candidate\|)-bounded alignment each | §21.5 |
|
|
5693
|
+
| Reasoning | ≤ K hops, each bounded by the answer's subtree | §22 |
|
|
5694
|
+
| Storage | O(distinct subtrees); vector index over resonance targets only, 1-bit codes (32× compression) | §3, §12.3 |
|
|
5695
|
+
| Profiling | free when off; when on, one counter bump per logical operation and one timer per named phase — never read by inference | §26 |
|
|
5605
5696
|
|
|
5606
5697
|
Nothing on any per-query path scans the corpus; every fan-out is capped at the
|
|
5607
5698
|
hub bound, and the cap is enforced at the _store level_ through LIMITed reads
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { MindContext } from "./types.js";
|
|
2
|
+
import { type AlignGap } from "./match.js";
|
|
2
3
|
/** One accepted substitution: query span [qs,qe) stands in for the
|
|
3
|
-
* candidate context's span — recorded for the rationale trace.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
cs: number;
|
|
8
|
-
ce: number;
|
|
9
|
-
}
|
|
4
|
+
* candidate context's span — recorded for the rationale trace. The same
|
|
5
|
+
* shape the shared aligner reports a disagreement as ({@link AlignGap}); an
|
|
6
|
+
* accepted substitution is a gap that cleared this file's gates. */
|
|
7
|
+
type Substitution = AlignGap;
|
|
10
8
|
/** A bridged grounding proposal: the trained context to ground, the query
|
|
11
9
|
* spans its alignment accounts for, and the substitutions that closed it. */
|
|
12
10
|
export interface BridgeHit {
|