Skip to content

arigraph: remove the S1 similarity probe; add EpisodicMemory::basins() (structure, not similarity)#722

Merged
AdaWorldAPI merged 2 commits into
mainfrom
claude/happy-hamilton-0azlw4
Jul 18, 2026
Merged

arigraph: remove the S1 similarity probe; add EpisodicMemory::basins() (structure, not similarity)#722
AdaWorldAPI merged 2 commits into
mainfrom
claude/happy-hamilton-0azlw4

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Two commits, one theme: the probe collapsed typed structure into a similarity scalar; this replaces it with the real, structural episodic-basin code.

1 — Remove the S1 community-basin probe + jc dev-coupling (commit 5e1393a)

The probe pooled ~1450 typed relation planes into one undirected similarity graph and read a scalar φ as a "community-id earns the mint" verdict — a flattening artifact (structure ≠ similarity, which the (8:8)/ClassView substrate exists to enforce). The verdict was retracted; rather than iterate a probe that misused the substrate and sat coupled to the scientific jc crate, the whole line is removed.

  • delete crates/lance-graph/examples/p_community_basin_agree.rs
  • remove the jc dev-dependency from crates/lance-graph/Cargo.toml + Cargo.lock (jc was reachable only via that dev-dep)
  • the earlier real-corpus variant + its schema.org data blob + python extractor never merged; dropped by resetting this branch to clean main

The G0 harness (g0_graph_loadbearing.rs, #716) is untouched — it uses no jc.

2 — Add EpisodicMemory::basins() (commit 5a5bc4c)

The usable episodic-witness basin partition, done the right way — structure only, no similarity pooling. AriGraph had communities() (structural, #714) but no experiential partition; this is the complement.

  • EpisodicBasins { entities, labels, num_basins } + basin_of / members, the same accessor shape as Communities so a caller can read and compare the two partitions directly.
  • EpisodicMemory::basins(): deterministic union-find over per-episode entity co-occurrence (parse each "subject - relation - object" triplet; union all entities seen together in one episode). Sorted entities + union-by-lower-root → a stable partition.
  • Re-exported from arigraph/mod.rs.

Honest scope: this is the experiential complement to communities() (entities grouped by what was observed together), not the le-contract 6-slot horizontal basin:role register frame — that stays EVENTUAL per context-role-traversal-tissue.md.

Record

EPIPHANIES.md E-S1-PROBE-REMOVED-1; AGENT_LOG.md (both entries).

Verification

  • cargo build -p lance-graph --examples green without jc.
  • cargo test -p lance-graph --lib -- graph::arigraph::episodic → 16/16 (5 new basin tests: co-occurrence grouping, shared-entity merge, single-episode union, empty-safe, deterministic); clippy clean on the additions.

🤖 Generated with Claude Code

https://claude.ai/code/session_016b33swuXE23hKtqxsHu9p1

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Schema.org edge extraction script and a Rust probe that computes taxonomy basins, per-relation-plane alignment, cross-context bridges, and pure-context versus pooled community agreement. Documentation records the corrected interpretation and retracts the earlier pooled measurement.

Changes

Schema.org structured measurement

Layer / File(s) Summary
Ontology edge extraction
crates/lance-graph/examples/data/extract_ontology_edges.py
Parses Schema.org Turtle data and writes is_a plus property domain/range edges to TSV.
Taxonomy and basin computation
crates/lance-graph/examples/p_community_basin_agree_real.rs
Loads extracted triples, identifies taxonomic relationships, computes depth-based basin labels, and derives co-membership vectors.
Per-plane agreement and controls
crates/lance-graph/examples/p_community_basin_agree_real.rs
Measures aligned and bridge planes, builds cross-family matrices, compares pure is_a communities with basin depths, and reports pooled results as a negative control.
Corrected measurement record
.claude/board/AGENT_LOG.md, .claude/board/EPIPHANIES.md, .claude/plans/...
Documents the pooled-measurement retraction, structured replacement findings, and per-context probe execution details.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Ontology
  participant Extractor
  participant RustProbe
  participant Metrics
  Ontology->>Extractor: parse Schema.org Turtle
  Extractor->>RustProbe: provide schemaorg_edges.tsv
  RustProbe->>Metrics: compute taxonomy basins and relation-plane statistics
  RustProbe->>Metrics: compare pure-context and pooled community agreement
  Metrics-->>RustProbe: return correlations, bridges, and verdict
Loading

Possibly related PRs

Suggested reviewers: claude

Poem

I’m a rabbit with planes in my graph,
Sorting bridges along every path.
Pure basins align, pooled trails deceive,
So old mint claims now take their leave.
Hop, hop—structured truths we retrieve!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions removing an S1 similarity probe and adding EpisodicMemory::basins(), but the changes are schema.org probe docs, an extractor, and a Rust example. Rename the PR to reflect the actual schema.org decomposition probe, RDF extractor, and updated measurement verdicts.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_e65d3c64-38e2-474c-a7d5-773c47bca099)

@AdaWorldAPI AdaWorldAPI changed the title feat(probe): S1 real-corpus verdict on schema.org — community ≢ is_a basin (φ<0.2 at every depth) feat(probe): S1 structured per-plane decomposition on schema.org (pooled verdict retracted) Jul 18, 2026
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review July 18, 2026 09:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdb6656db8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let mut familied: HashSet<&str> = HashSet::new();
for (s, r, o) in &raw {
if is_taxonomic(r) {
isa_parent.entry(s.clone()).or_insert_with(|| o.clone());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Canonicalize multi-parent taxonomy basins

When schema.org classes have multiple is_a parents, this keeps only whichever parent appears first in the TSV; the committed fixture has many such subjects (for example classes with two or three parents), and the extractor/RDF iteration is not ordered, so regenerating or merely reordering the same ontology can change the depth-1 family assignments and therefore all intra/cross plane counts for identical data. Please choose a deterministic canonical parent or account for all parents before deriving the basin labels.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
crates/lance-graph/examples/p_community_basin_agree_real.rs (1)

379-379: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add missing unit tests for algorithmic helpers.

As per coding guidelines, "Add Rust unit tests alongside implementations via #[cfg(test)] modules". Please add a basic test module at the end of the file for the deterministic functions to ensure correctness and prevent regressions.

🧪 Proposed test module
     println!(
         "\nVERDICT (structured): the data is STRUCTURED, not dissimilar. Aligned planes\n\
          stay inside taxonomy families (the within-context identity leg); crossing\n\
          planes are TYPED, NAMED family→family contexts — the horizontal basin:role\n\
          frame the (8:8) register carries — not evidence for an opaque community-id\n\
          lane. The mint question goes back to the council WITH this decomposition:\n\
          what the taxonomy does not organize is carried by typed cross-contexts, so\n\
          the candidate carrier is the horizontal 6-context frame, not a new blob id."
     );
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_comembership_empty() {
+        let co = comembership(&[]);
+        assert!(co.is_empty());
+    }
+
+    #[test]
+    fn test_depth1_family() {
+        let mut p = HashMap::new();
+        p.insert("child".to_string(), "parent".to_string());
+        p.insert("parent".to_string(), "root".to_string());
+        assert_eq!(depth1_family("child", &p), "parent");
+        assert_eq!(depth1_family("parent", &p), "root");
+        assert_eq!(depth1_family("root", &p), "root");
+    }
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/lance-graph/examples/p_community_basin_agree_real.rs` at line 379, Add
a #[cfg(test)] module at the end of the file covering the deterministic
algorithmic helper functions defined in the example, with basic assertions for
expected outputs and key edge cases. Keep the tests alongside the existing
implementations and avoid testing nondeterministic or external-resource
behavior.

Source: Coding guidelines

crates/lance-graph/examples/data/extract_ontology_edges.py (1)

15-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Format the script and use pathlib.Path.

The script contains multiple statements per line, which degrades readability and triggers static analysis warnings. Additionally, constructing file paths with string formatting can be cleanly replaced by pathlib.Path to natively resolve the path traversal warning.

♻️ Proposed refactor
-import sys, rdflib
+import sys
+import rdflib
+from pathlib import Path
 from rdflib import RDFS, URIRef
+
 def local(u):
     s = str(u)
     for sep in ('#', '/'):
-        if sep in s: s = s.rsplit(sep, 1)[-1]
+        if sep in s:
+            s = s.rsplit(sep, 1)[-1]
     return s.strip()
+
 SCH = rdflib.Namespace("https://schema.org/")
-g = rdflib.Graph(); g.parse("data/ontologies/schemaorg.ttl", format="turtle")
+g = rdflib.Graph()
+g.parse("data/ontologies/schemaorg.ttl", format="turtle")
 edges = []
+
 for s, o in g.subject_objects(RDFS.subClassOf):
     if isinstance(s, URIRef) and isinstance(o, URIRef):
         a, b = local(s), local(o)
-        if a and b and a != b: edges.append((a, "is_a", b))
+        if a and b and a != b:
+            edges.append((a, "is_a", b))
+
 dom, rng = {}, {}
-for p, c in g.subject_objects(SCH.domainIncludes): dom.setdefault(p, []).append(c)
-for p, c in g.subject_objects(SCH.rangeIncludes):  rng.setdefault(p, []).append(c)
+for p, c in g.subject_objects(SCH.domainIncludes):
+    dom.setdefault(p, []).append(c)
+for p, c in g.subject_objects(SCH.rangeIncludes):
+    rng.setdefault(p, []).append(c)
+
 for p in set(dom) & set(rng):
     pn = local(p)
     for d in dom[p]:
         for r in rng[p]:
             if isinstance(d, URIRef) and isinstance(r, URIRef):
                 a, b = local(d), local(r)
-                if a and b and a != b: edges.append((a, pn, b))
-out = sys.argv[1] if len(sys.argv) > 1 else "."
-with open(f"{out}/schemaorg_edges.tsv", "w") as f:
-    for s, r, o in edges: f.write(f"{s}\t{r}\t{o}\n")
-print(f"{len(edges)} edges -> {out}/schemaorg_edges.tsv")
+                if a and b and a != b:
+                    edges.append((a, pn, b))
+
+out = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(".")
+out_file = out / "schemaorg_edges.tsv"
+with out_file.open("w") as f:
+    for s, r, o in edges:
+        f.write(f"{s}\t{r}\t{o}\n")
+
+print(f"{len(edges)} edges -> {out_file}")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/lance-graph/examples/data/extract_ontology_edges.py` around lines 15 -
42, Reformat the script by placing each statement and control-flow action on its
own line, including imports, assignments, conditionals, appends, and file
writes. Update the output-path handling around out and the schemaorg_edges.tsv
write to use pathlib.Path, joining the directory and filename via Path
operations instead of string formatting, while preserving the existing default
directory and output behavior.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/board/AGENT_LOG.md:
- Around line 1-7: Update the 2026-07-18 “OPERATOR CORRECTION” entry in
AGENT_LOG.md to include the commit identifier and commit message for the
documented changes. Preserve the existing deliverables, test status, and
outcome, and add the commit details in the ledger’s established format.

In @.claude/board/EPIPHANIES.md:
- Around line 1-10: Correct the φ comparison labels across the measurement
record: in .claude/board/EPIPHANIES.md lines 1-10, explicitly identify .199 as
pooled best-depth φ retained as a negative control and .468 as the structured
pure is_a-plane result, without framing them as comparable before/after
measurements; apply the same labels in .claude/board/AGENT_LOG.md lines 3-4; and
update the harness annotation in
.claude/plans/graphrag-doc-retrieval-soa-integration-v1.md lines 490-500 to
distinguish the pooled negative control from the structured result.

In `@crates/lance-graph/examples/p_community_basin_agree_real.rs`:
- Around line 166-175: Update comembership to avoid underflow when labels is
empty by using a saturating subtraction for the capacity calculation. Preserve
the existing pairwise iteration and output behavior for non-empty slices.

---

Nitpick comments:
In `@crates/lance-graph/examples/data/extract_ontology_edges.py`:
- Around line 15-42: Reformat the script by placing each statement and
control-flow action on its own line, including imports, assignments,
conditionals, appends, and file writes. Update the output-path handling around
out and the schemaorg_edges.tsv write to use pathlib.Path, joining the directory
and filename via Path operations instead of string formatting, while preserving
the existing default directory and output behavior.

In `@crates/lance-graph/examples/p_community_basin_agree_real.rs`:
- Line 379: Add a #[cfg(test)] module at the end of the file covering the
deterministic algorithmic helper functions defined in the example, with basic
assertions for expected outputs and key edge cases. Keep the tests alongside the
existing implementations and avoid testing nondeterministic or external-resource
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4da4c3ab-5a13-4c6a-bd88-c02c33a4b834

📥 Commits

Reviewing files that changed from the base of the PR and between 25b8313 and bdb6656.

⛔ Files ignored due to path filters (1)
  • crates/lance-graph/examples/data/schemaorg_edges.tsv is excluded by !**/*.tsv
📒 Files selected for processing (5)
  • .claude/board/AGENT_LOG.md
  • .claude/board/EPIPHANIES.md
  • .claude/plans/graphrag-doc-retrieval-soa-integration-v1.md
  • crates/lance-graph/examples/data/extract_ontology_edges.py
  • crates/lance-graph/examples/p_community_basin_agree_real.rs

Comment thread .claude/board/AGENT_LOG.md Outdated
Comment on lines +1 to +7
## 2026-07-18 — OPERATOR CORRECTION absorbed: pooled-flattening retraction → structured per-plane probe (E-S1-STRUCTURED-DECOMP-1) — main thread

- **The correction:** "you made a fatal error throwing everything black box accumulated... instead of being happy that we can structure the data you do low IQ similarity." Exactly right: the first real-corpus run pooled 1452 typed relation planes + is_a into ONE adjacency blob and read a scalar φ off the mush — Frankenstein flattening + similarity reflex. Verdict retracted (E-S1-SCHEMAORG-VERDICT-1 Status → RETRACTED).
- **The rewrite:** `p_community_basin_agree_real.rs` is now the STRUCTURED measurement: [1] per-plane intra/cross decomposition, [2] aggregate (taxonomy organizes 20.9% of familied relational mass; 227 aligned / 987 bridge planes), [3] cross-context family→family matrix (~6 role families emerge: Text/Intangible/Person/Number/URL/Place — the horizontal basin:role frame FROM data), [4] pure-context leg (is_a-only φ=0.468 vs 0.199 pooled — agreement doubles when the context is pure), [5] pooled number demoted to labeled NEGATIVE CONTROL.
- **Mint implication corrected:** cross-context structure is typed/named → candidate carrier = the horizontal (8:8) frame, not an opaque community-id lane; decision to the council with the decomposition.
- **Board:** EPIPHANIES E-S1-STRUCTURED-DECOMP-1 (+ Status flip on the retracted entry); plan §6 both probe annotations corrected. Same branch/PR #722; fmt+clippy clean.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Record the commit identifier in the board entry.

This entry includes deliverables and test status but omits the required commit SHA/message. Add it so the append-only ledger remains auditable.

As per coding guidelines, .claude/board/AGENT_LOG.md entries must include deliverables, commit, tests, and outcome.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/board/AGENT_LOG.md around lines 1 - 7, Update the 2026-07-18
“OPERATOR CORRECTION” entry in AGENT_LOG.md to include the commit identifier and
commit message for the documented changes. Preserve the existing deliverables,
test status, and outcome, and add the commit details in the ledger’s established
format.

Source: Coding guidelines

Comment thread .claude/board/EPIPHANIES.md Outdated
Comment on lines +1 to +10
## 2026-07-18 — E-S1-STRUCTURED-DECOMP-1 — OPERATOR CORRECTION: the schema.org "DISTINCT → mint" verdict was a POOLED-FLATTENING ARTIFACT ("throwing everything black box accumulated... low IQ similarity"). Restructured probe: decompose by TYPED relation plane instead of pooling → 227 taxonomy-aligned planes + 987 typed bridge planes; pure-context φ RISES 0.199→0.468; the cross-context matrix converges on ~6 named role families (Text/Intangible/Person/Number/URL/Place) — the horizontal basin:role frame EMERGING FROM DATA

**Status:** SHIPPED (`examples/p_community_basin_agree_real.rs` rewritten as the structured measurement; pooled number demoted to negative control). E-S1-SCHEMAORG-VERDICT-1 Status flipped to RETRACTED.

- **The error (own it precisely):** the first real-corpus run pooled ALL relation planes (`author`/`location`/`recipient`/… — 1452 DISTINCT typed contexts) + the is_a rail into ONE undirected weight-summed adjacency, ran Leiden on the blob, and compared the mush to the taxonomy with a single scalar φ. That is black-box accumulation + the System-1 similarity reflex — the exact Frankenstein flattening the `(8:8)` substrate forbids (every relation is its own context:role plane; family-codec-smith's "don't blur unlike functions into one codec" is the same rule). Of course a mongrel of hundreds of contexts mismatches one rail; φ=0.01 measured MY destruction of structure, not the data's semantics. "DISTINCT → community-id earns the mint" is RETRACTED.
- **The structured measurement (what the data actually says, schema.org 961 entities):**
- Per-plane decomposition: 227 planes ≥80% intra-family (taxonomy-ALIGNED contexts — the within-context identity leg holds there); 987 planes ≤20% intra (TYPED bridges, e.g. `actor: CreativeWork→Organization`, `recipient: Action→Intangible`); taxonomy organizes 20.9% of familied relational mass directly.
- **Pure-context leg: φ = 0.468 @ k=1 on the is_a plane ALONE (vs 0.199 pooled)** — agreement more than doubles the moment the context is pure. The pooled number is kept in the example as a labeled NEGATIVE CONTROL.
- **The horizontal frame emerges:** the cross-context matrix's top pairs converge on ~6 role families — Text, Intangible, Person, Number, URL, Place — i.e. the operator's "6 context / episodic-witness basin:role" frame (E-CONTEXT-ROLE-TISSUE-1 horizontal orientation) shows up FROM data, named and typed, not imposed.
- **Mint implication (corrected):** what the taxonomy does not organize is carried by TYPED, NAMED cross-contexts — the natural carrier is the horizontal `basin:role` frame the `(8:8)` register already sanctions, NOT an opaque community-id blob lane. The mint question returns to the council WITH this decomposition; no "community-id earns the mint" claim survives.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Correct the φ baseline labeling across the measurement record.

The .199 value is the pooled depth-sweep result retained as a negative control; .468 is the structured pure is_a-plane result. Do not describe this as a pure-context before/after increase unless both values come from comparable measurements.

  • .claude/board/EPIPHANIES.md#L1-L10: label the comparison as pooled best-depth φ=.199 versus pure-is_a φ=.468.
  • .claude/board/AGENT_LOG.md#L3-L4: use the same explicit labels in the operator-correction entry.
  • .claude/plans/graphrag-doc-retrieval-soa-integration-v1.md#L490-L500: update the harness annotation to distinguish the pooled negative control from the structured result.
📍 Affects 3 files
  • .claude/board/EPIPHANIES.md#L1-L10 (this comment)
  • .claude/board/AGENT_LOG.md#L3-L4
  • .claude/plans/graphrag-doc-retrieval-soa-integration-v1.md#L490-L500
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/board/EPIPHANIES.md around lines 1 - 10, Correct the φ comparison
labels across the measurement record: in .claude/board/EPIPHANIES.md lines 1-10,
explicitly identify .199 as pooled best-depth φ retained as a negative control
and .468 as the structured pure is_a-plane result, without framing them as
comparable before/after measurements; apply the same labels in
.claude/board/AGENT_LOG.md lines 3-4; and update the harness annotation in
.claude/plans/graphrag-doc-retrieval-soa-integration-v1.md lines 490-500 to
distinguish the pooled negative control from the structured result.

Comment on lines +166 to +175
fn comembership(labels: &[u32]) -> Vec<f64> {
let n = labels.len();
let mut v = Vec::with_capacity(n * (n - 1) / 2);
for i in 0..n {
for j in (i + 1)..n {
v.push(if labels[i] == labels[j] { 1.0 } else { 0.0 });
}
}
v
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix potential integer underflow on empty slices.

If labels is empty, n = 0, causing n - 1 to underflow usize and panic. Using saturating_sub safely handles this edge case.

🐛 Proposed fix
 fn comembership(labels: &[u32]) -> Vec<f64> {
     let n = labels.len();
-    let mut v = Vec::with_capacity(n * (n - 1) / 2);
+    let mut v = Vec::with_capacity(n * n.saturating_sub(1) / 2);
     for i in 0..n {
         for j in (i + 1)..n {
             v.push(if labels[i] == labels[j] { 1.0 } else { 0.0 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn comembership(labels: &[u32]) -> Vec<f64> {
let n = labels.len();
let mut v = Vec::with_capacity(n * (n - 1) / 2);
for i in 0..n {
for j in (i + 1)..n {
v.push(if labels[i] == labels[j] { 1.0 } else { 0.0 });
}
}
v
}
fn comembership(labels: &[u32]) -> Vec<f64> {
let n = labels.len();
let mut v = Vec::with_capacity(n * n.saturating_sub(1) / 2);
for i in 0..n {
for j in (i + 1)..n {
v.push(if labels[i] == labels[j] { 1.0 } else { 0.0 });
}
}
v
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/lance-graph/examples/p_community_basin_agree_real.rs` around lines 166
- 175, Update comembership to avoid underflow when labels is empty by using a
saturating subtraction for the capacity calculation. Preserve the existing
pairwise iteration and output behavior for non-empty slices.

AdaWorldAPI pushed a commit that referenced this pull request Jul 18, 2026
The S1 community-basin probe pooled ~1450 typed relation planes into one
undirected similarity graph and read a scalar phi as a "community-id earns
the mint" verdict — a flattening artifact (structure != similarity) that was
retracted. jc is the scientific crate; this empirical probe does not belong
coupled to it.

- delete crates/lance-graph/examples/p_community_basin_agree.rs
- remove the jc dev-dependency from crates/lance-graph/Cargo.toml + Cargo.lock
  (jc was reachable only via that dev-dep)
- the #722-only real-corpus variant + its schema.org data blob + python
  extractor never merged; dropped by resetting this branch to clean main

G0 harness (#716, no jc) is untouched. Board: EPIPHANIES E-S1-PROBE-REMOVED-1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016b33swuXE23hKtqxsHu9p1
@AdaWorldAPI
AdaWorldAPI force-pushed the claude/happy-hamilton-0azlw4 branch from bdb6656 to 941aba7 Compare July 18, 2026 10:16
The S1 community-basin probe pooled ~1450 typed relation planes into one
undirected similarity graph and read a scalar phi as a "community-id earns
the mint" verdict — a flattening artifact (structure != similarity) that was
retracted. jc is the scientific crate; this empirical probe does not belong
coupled to it.

- delete crates/lance-graph/examples/p_community_basin_agree.rs
- remove the jc dev-dependency from crates/lance-graph/Cargo.toml + Cargo.lock
  (jc was reachable only via that dev-dep)
- the #722-only real-corpus variant + its schema.org data blob + python
  extractor never merged; dropped by resetting this branch to clean main

G0 harness (#716, no jc) is untouched. Board: EPIPHANIES E-S1-PROBE-REMOVED-1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016b33swuXE23hKtqxsHu9p1
@AdaWorldAPI
AdaWorldAPI force-pushed the claude/happy-hamilton-0azlw4 branch from 941aba7 to 5e1393a Compare July 18, 2026 10:16
@AdaWorldAPI AdaWorldAPI changed the title feat(probe): S1 structured per-plane decomposition on schema.org (pooled verdict retracted) chore: remove the S1 community-basin probe + jc dev-coupling Jul 18, 2026
Adds the experiential complement to communities(): entities grouped by
co-occurrence in stored episodes (what was observed together) rather than
by structural graph connectivity (what is linked).

- EpisodicBasins { entities, labels, num_basins } with basin_of / members,
  same accessor shape as Communities so the two partitions read alike and a
  caller can compare them directly.
- EpisodicMemory::basins(): deterministic union-find over per-episode entity
  co-occurrence, parsing each "subject - relation - object" triplet; sorted
  entities + union-by-lower-root give a stable partition.
- Re-exported from arigraph/mod.rs.

Structure only, no similarity pooling. This is NOT the le-contract 6-slot
horizontal basin:role register frame (that stays EVENTUAL); it is the plain
experiential grouping the operator asked for as usable code.

16/16 episodic lib tests green (5 new); clippy clean on the additions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016b33swuXE23hKtqxsHu9p1
@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_312faee6-d180-4407-bf4e-f7de1826960d)

@AdaWorldAPI AdaWorldAPI changed the title chore: remove the S1 community-basin probe + jc dev-coupling arigraph: remove the S1 similarity probe; add EpisodicMemory::basins() (structure, not similarity) Jul 18, 2026
@AdaWorldAPI
AdaWorldAPI merged commit b525d98 into main Jul 18, 2026
7 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Jul 18, 2026
…lready frozen atoms

The #719 spec proposed a new Cognition 0x03 ConceptDomain with a
cognitive_<verb> CODEBOOK block. That duplicated types that already
exist: the cognitive task types (inference/deduction/induction/abduction/
counterfactual/extrapolation/syllogism/synthesis/fan-out) are global
frozen atoms in holograph::dntree — epistemic verbs 72-95 (INFERS=74,
DEDUCES=82, INDUCES=83, ABDUCES=84, PREDICTS=89, HYPOTHESIZES=81) and
frameworks 0x80-0x8F (COUNTERFACTUAL=0x84, ABDUCTION=0x85, CAUSALITY=0x83);
syllogism is the shipped NARS syllogize() op; synthesis/fan-out are
orchestration ops.

Corrections:
- §2 rewritten: reference the frozen atoms, never mint a Cognition domain;
  byte 0x03 stays reserved (RESERVE-DON'T-RECLAIM). A thinking/task row
  carries classid=its domain, task-type=a frozen atom index in a lane,
  thinking-lane materialisation=a read-mode property (ValueSchema::Thinking).
- §2a added: persona/play-style modeling is per-consumer opt-in + its own
  mint (chess play-style nice-to-have; business consumers not conform).
- §0c: cognitive_* and cognitive_board classid rows removed; only chess
  0x06 remains a concept mint; BoardAggregates@188 is a value tenant only.
- §0/§4/§5/§6/§7: Cognition origination removed; community-id does not
  mint (S1 retracted by #722); one open knob left (BoardAggregates width).

No bytes were ever minted (the spec was a proposal), so this is a pre-mint
correction with zero on-chain reclaim.

Records E-COGNITIVE-ATOMS-ALREADY-FROZEN (EPIPHANIES prepend) and updates
the D-TRI-1 STATUS_BOARD row.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Awg6TXocHcwTtc6eGsHcdD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants