Skip to content

Commit b901502

Browse files
author
Jan Hübener
committed
fix: update module placement — BNN/SPO are first-class, use existing types
- spo_harvest.rs → src/search/ (next to hdr_cascade.rs, not extensions/) - shift_detector.rs → src/search/ (next to distribution.rs) - harvest_to_nars() returns crate::nars::TruthValue (not new type) - CausalTrajectory edges compatible with src/search/causal.rs Pearl ladder - Note two gestalt.rs files (qualia/Buber vs extensions/spo/Bundling) - spo feature is default-on, rustynum-bnn is unconditional dep
1 parent 834d80f commit b901502

1 file changed

Lines changed: 49 additions & 32 deletions

File tree

.claude/prompts/00_SESSION_A_META.md

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,45 @@ Your job: wire the SPO distance harvest, stripe shift detector, CLAM path encodi
1414

1515
---
1616

17-
## DIRECTORY STRUCTURE
17+
## MODULE PLACEMENT
18+
19+
SPO and BNN are default-on, first-class dependencies (not experimental). New modules integrate with existing top-level modules — don't duplicate types that already exist.
1820

1921
```
20-
src/
21-
core/
22-
simd.rs ← 348-line duplicate SIMD (DELETE after rustynum port lands)
23-
rustynum_accel.rs ← rustynum SIMD dispatch interface
24-
fingerprint.rs ← content-addressable fingerprint
25-
scent.rs ← scent/similarity operations
26-
vsa.rs ← VSA bind/bundle/permute
27-
search/
28-
hdr_cascade.rs ← adaptive cascade + SigmaGate (already wired)
29-
extensions/spo/
30-
gestalt.rs ← 965 lines, committed (DO NOT rewrite)
31-
spo.rs ← existing SPO encoding (53KB)
22+
EXISTING (use these, extend them, DO NOT duplicate):
23+
src/nars/
24+
truth.rs ← TruthValue with revision, from_evidence() — USE THIS
25+
inference.rs ← InferenceRule trait (Deduction, Abduction, Induction)
26+
evidence.rs ← Evidence tracking
27+
src/search/
28+
hdr_cascade.rs ← SigmaGate already wired (PR 158)
29+
causal.rs ← Pearl's causal ladder Rung 1/2/3 (37KB)
30+
src/qualia/
31+
gestalt.rs ← Buber I/Thou/It role binding (19KB) — different from SPO gestalt
32+
resonance.rs ← Qualia resonance (34KB)
33+
src/extensions/spo/
34+
gestalt.rs ← BundlingProposal, TiltReport, PlaneCalibration (PR 158, 34KB)
35+
spo.rs ← SPO encoding (53KB)
3236
mod.rs ← module declarations
33-
jina_api.rs ← Jina embedding API
34-
jina_cache.rs ← Jina cache layer
35-
graph/
37+
jina_api.rs / jina_cache.rs
38+
src/core/
39+
simd.rs ← 173-line thin delegator (DELETE after rustynum SIMD port)
40+
rustynum_accel.rs ← rustynum SIMD dispatch interface
41+
fingerprint.rs / scent.rs / vsa.rs
42+
src/graph/
3643
avx_engine.rs ← fingerprint graph engine (SIMD cleaned up)
37-
nars/ ← NARS truth value types
38-
cypher_bridge.rs ← Cypher → BindSpace bridge
39-
40-
NEW FILES TO CREATE (all under src/extensions/spo/):
41-
spo_harvest.rs ← Phase 2: SPO distance + harvest + NARS + inference
42-
shift_detector.rs ← Phase 3: stripe shift detector
43-
clam_path.rs ← Phase 5: CLAM path encoding
44-
causal_trajectory.rs ← Phase 6: resonator instrumentation
44+
45+
NEW FILES — placed where they naturally belong:
46+
src/search/spo_harvest.rs ← Phase 2: SPO distance (next to hdr_cascade.rs)
47+
src/search/shift_detector.rs ← Phase 3: stripe shift (next to distribution.rs)
48+
src/extensions/spo/clam_path.rs ← Phase 5: CLAM path encoding (SPO-specific)
49+
src/extensions/spo/causal_trajectory.rs ← Phase 6: resonator instrumentation
50+
51+
CRITICAL TYPE REUSE:
52+
harvest_to_nars() → MUST return crate::nars::TruthValue (already has revision rule)
53+
TypedInference → should use/extend crate::nars::InferenceRule trait
54+
CausalTrajectory → edges must be compatible with src/search/causal.rs Pearl ladder
55+
ShiftDetector → next to src/search/distribution.rs (same domain)
4556
```
4657

4758
## WHAT'S ALREADY COMMITTED
@@ -115,7 +126,7 @@ Each document is self-contained with implementation-grade code examples. This me
115126

116127
## PHASE 2: SPO Distance Harvest
117128

118-
**File: `ladybug-rs/src/extensions/spo/spo_harvest.rs` (NEW)**
129+
**File: `ladybug-rs/src/search/spo_harvest.rs` (NEW — next to hdr_cascade.rs)**
119130

120131
This is the cosine replacement. 238× fewer cycles, 7.3× more information per computation. The detailed spec is in `spo_distance_harvest_cosine_replacement_prompt.md`. Key deliverables:
121132

@@ -141,13 +152,15 @@ impl SpoDistanceResult {
141152
### 2.2 Functions to Build
142153

143154
```
144-
spo_distance(a, b) → SpoDistanceResult — the core 13-cycle computation
145-
harvest_to_nars(result) → NarsTruth — frequency from core ratio, confidence from entropy
146-
harvest_to_inference(result) → TypedInference — dominant halo type → typed query action
147-
AccumulatedHarvest::accumulate(result) — EMA + NARS revision across searches
148-
feed_sigma_graph(result) → Vec<SigmaEdge> — emit typed edges from harvest
155+
spo_distance(a, b) → SpoDistanceResult — the core 13-cycle computation
156+
harvest_to_nars(result) → crate::nars::TruthValue — USE EXISTING TYPE (has revision rule)
157+
harvest_to_inference(result) → TypedInference — dominant halo type → typed query action
158+
AccumulatedHarvest::accumulate(result) — EMA + nars::TruthValue revision across searches
159+
feed_sigma_graph(result) → Vec<SigmaEdge> — emit typed edges from harvest
149160
```
150161

162+
**CRITICAL**: `harvest_to_nars()` returns `crate::nars::TruthValue`, NOT a new NarsTruth type. The existing type already has `revision()`, `from_evidence()`, `deduction()`, etc. — use them.
163+
151164
### 2.3 Key Constraint
152165

153166
The XOR bitmasks (`x_xor`, `y_xor`, `z_xor`) computed for distance are the SAME bitmasks used for `cross_plane_vote()`. The halo extraction is FREE — no extra compute. Do not compute XOR twice.
@@ -156,7 +169,7 @@ The XOR bitmasks (`x_xor`, `y_xor`, `z_xor`) computed for distance are the SAME
156169

157170
## PHASE 3: Distance Granularity + Stripe Shift Detector
158171

159-
**Extends: `src/extensions/spo/spo_harvest.rs` + new `src/extensions/spo/shift_detector.rs`**
172+
**Extends: `src/search/spo_harvest.rs` + new `src/search/shift_detector.rs`**
160173

161174
Detailed specs in `spo_distance_granularity_investigation.md` and `sigma_stripe_shift_detector_addendum.md`.
162175

@@ -198,7 +211,7 @@ impl ShiftDetector {
198211
}
199212
```
200213

201-
**Wire into CollapseGate (already exists in src/extensions/spo/gestalt.rs):
214+
**Wire into CollapseGate** (already exists in `src/extensions/spo/gestalt.rs`, also connects to `src/search/distribution.rs`):
202215
- Shift toward noise → bias HOLD
203216
- Shift toward foveal → bias FLOW
204217
- Bimodal → speciation event
@@ -256,6 +269,8 @@ One u16. Three query types. O(log n + k):
256269

257270
Detailed spec in `nars_causal_trajectory_hydration_prompt.md`. This is the biggest new module.
258271

272+
**NOTE**: `src/search/causal.rs` (37KB) already implements Pearl's 3-rung causal ladder (Correlate/Intervene/Counterfact). The causal trajectory recorder should produce edges compatible with that system — Rung 1 from halo correlations, Rung 2 from BPReLU intervention asymmetry, Rung 3 from ClamPath sibling (counterfactual) queries.
273+
259274
### 6.1 Core Structures
260275

261276
```rust
@@ -306,6 +321,8 @@ FullSimultaneous — all three at once → Gestalt snap (rare)
306321

307322
**Extends existing: `ladybug-rs/src/extensions/spo/gestalt.rs` (DO NOT rewrite — add to it)**
308323

324+
**NOTE**: There are TWO gestalt modules — `src/qualia/gestalt.rs` (Buber I/Thou/It, 19KB) and `src/extensions/spo/gestalt.rs` (BundlingProposal, 34KB). Phase 7 extends the SPO one. The qualia one maps Buber roles to Xyz geometry — it's complementary, not redundant.
325+
309326
### 7.1 Wire detect_bundling() Into CLAM Harvest Loop
310327

311328
When `AccumulatedHarvest` SO/SP/PO evidence crosses `CollapseMode` threshold → auto-create `BundlingProposal`.

0 commit comments

Comments
 (0)