Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .claude/SURGERY_BLACKBOARD.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Brain Surgery Blackboard — Session State

## Audit Status (2026-03-22)

- All 25 tasks across 5 roles (Surgeon, Locksmith, Bridge, Bouncer, Seal) remain PENDING — 0/25 completed
- server.rs (3717 lines) still uses CogRedis directly, not RedisAdapter
- P1 (src/query/cypher.rs) and P3 (src/query/lance_parser/) still exist — deletion tasks not started
- SPO module promoted to src/spo/ (18 files) — DONE
- SPO Merkle hardening — DONE
- 16K-bit container — DONE
- Graph SPO on BindSpace (src/graph/spo/) — PARTIAL (9 files, disconnected from server)
- Awareness loop — NOT STARTED (no awareness_loop files found)
- Path dependencies: 11 path deps, compilation requires all siblings present

session_id: "brain-surgery-2026-03"
started: "2026-03-12"
orchestration_prompt: ".claude/prompts/18_brain_surgery_orchestration.md"
Expand Down Expand Up @@ -44,3 +56,24 @@ decisions_made: []
notes: |
Read .claude/prompts/18_brain_surgery_orchestration.md for full context.
Read prompts 15, 16, 17, 17a BEFORE starting any work.

## Integration Plan Reference (2026-03-22)

The brain surgery tasks are now sequenced within the master integration plan.
They fall under **Plateau 2, Phase 2C** — only executed AFTER rustynum→ndarray
migration (2A) and lance-graph wiring (2B) are stable.

**Pre-conditions for surgery:**
- ndarray builds and tests pass (Plateau 0)
- ladybug-rs compiles with ndarray (Phase 2A)
- P1/P3 dead code deleted (Phase 2B.1-2B.2)
- lance-graph Cypher works end-to-end through server.rs (Phase 2B.4)

**Surgery task dependencies on integration phases:**
- S1/S2 (delete P1/P3): Unblocked → moved to Phase 2B.1/2B.2
- L1-L5 (crystal API, codebook, truth): Blocked on Phase 2A.4 (ndarray types)
- B1-B5 (wire SPO to server): Blocked on Phase 2B.5 (lance-graph SPO backend)
- N1-N5 (cargo deps, dedup): Blocked on Phase 2B.4 (lance-graph Cypher)
- K1-K5 (UDF, query seal): Blocked on Phase 2B.6 (server.rs rewire)

See: /home/user/INTEGRATION_PLAN.md
59 changes: 7 additions & 52 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v2
Expand All @@ -61,18 +58,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"

- uses: Swatinem/rust-cache@v2

Expand All @@ -98,18 +92,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v2
Expand All @@ -120,47 +111,12 @@ jobs:
- name: Rustfmt
run: cargo fmt --all -- --check

# ---------------------------------------------------------------------------
# Miri — catches UB in unsafe code (split_at_mut, raw pointers, etc.)
# ---------------------------------------------------------------------------
miri:
name: Miri (unsafe validation)
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@nightly
with:
components: miri

- uses: Swatinem/rust-cache@v2
with:
prefix-key: miri

# 5 min timeout per target — Miri can run 1-3h without timeout
- name: Miri — lib tests (5 min timeout)
run: timeout 300 cargo miri test --lib -- --test-threads=1
env:
MIRIFLAGS: "-Zmiri-disable-isolation"
continue-on-error: true

# ---------------------------------------------------------------------------
# Summary
# ---------------------------------------------------------------------------
ci-summary:
name: CI Summary
needs: [build, test, lint, miri]
needs: [build, test, lint]
runs-on: ubuntu-latest
if: always()
steps:
Expand All @@ -173,7 +129,6 @@ jobs:
echo " Build: ${{ needs.build.result }}"
echo " Test: ${{ needs.test.result }}"
echo " Lint: ${{ needs.lint.result }}"
echo " Miri: ${{ needs.miri.result }}"
echo ""
PASS=true
for r in "${{ needs.build.result }}" "${{ needs.test.result }}" "${{ needs.lint.result }}"; do
Expand Down
38 changes: 13 additions & 25 deletions .github/workflows/proof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
# Total: 39 proofs verifying cognitive substrate invariants.
#
# Rust version: pinned to 1.93.0 to match Dockerfile build environment.
# Rust version: pinned to 1.94.0 to match Dockerfile build environment.
# RUSTFLAGS: -D warnings with targeted -A for noise lints in evolving codebase.
# =============================================================================

Expand Down Expand Up @@ -56,18 +56,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
- uses: Swatinem/rust-cache@v2
- name: cargo check
run: cargo check --lib --tests
Expand All @@ -82,18 +80,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
- uses: Swatinem/rust-cache@v2
- name: Run foundation proofs
run: cargo test --test proof_foundation -- --test-threads=1 --show-output
Expand All @@ -108,18 +104,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
- uses: Swatinem/rust-cache@v2
- name: Run reasoning ladder proofs
run: cargo test --test proof_reasoning_ladder -- --test-threads=1 --show-output
Expand All @@ -134,18 +128,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
- uses: Swatinem/rust-cache@v2
- name: Run tactics proofs
run: cargo test --test proof_tactics -- --test-threads=1 --show-output
Expand All @@ -160,18 +152,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
- uses: Swatinem/rust-cache@v2
- name: Run level A gap proofs
run: cargo test --test proof_level_a_gaps -- --test-threads=1
Expand All @@ -186,18 +176,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Init vendor submodules
run: git submodule update --init vendor/rustynum

- name: Clone sibling repos (OBLIGATORY deps)
run: |
git clone --depth 1 https://github.com/AdaWorldAPI/rustynum.git ../rustynum
git clone --depth 1 https://github.com/AdaWorldAPI/ndarray.git ../ndarray
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust.git ../crewai-rust
git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs.git ../n8n-rs

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.93.0"
toolchain: "1.94.0"
- uses: Swatinem/rust-cache@v2
- name: Run all unit tests
run: cargo test --lib -- --test-threads=4
Expand Down
35 changes: 33 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ ladybug-rs CANNOT compile alone. It depends on sibling repos via relative paths:
```
REQUIRED (clone alongside ladybug-rs):
../rustynum/ rustynum-rs, rustynum-core, rustynum-bnn, rustynum-arrow,
rustynum-holo, rustynum-clam
rustynum-holo, rustynum-clam [MIGRATING → ndarray]
../ndarray/ AdaWorldAPI/ndarray fork — HPC compute (Plateau 2 migration target)
../crewai-rust/ crewai-vendor (feature-gated behind "crewai")
../n8n-rs/ n8n-core, n8n-workflow, n8n-arrow, n8n-grpc, n8n-hamming
```
Expand Down Expand Up @@ -109,7 +110,7 @@ There is no `fn cold_to_hot()`. Their absence IS the architecture.

```
ladybug-rs role: "The Brain" in the four-repo architecture.
rustynum = The Muscle (SIMD substrate)
rustynum = The Muscle (SIMD substrate) [MIGRATING → ndarray, see INTEGRATION_PLAN.md]
ladybug-rs = The Brain (BindSpace, SPO, server) ← THIS REPO
staunen = The Bet (6 instructions, no GPU)
lance-graph = The Face (Cypher/SQL query surface)
Expand Down Expand Up @@ -152,6 +153,36 @@ cargo build --bin ladybug-server

---

## 8. Migration: rustynum → ndarray (Plateau 2)

ladybug-rs currently depends on 6 rustynum crates for SIMD compute. These are being
superseded by `AdaWorldAPI/ndarray` (fork with 55 HPC modules, 880 tests).

**What changes:**
- `rustynum::Fingerprint` → `ndarray::hpc::fingerprint::Fingerprint<256>`
- `rustynum::hamming_distance` → `ndarray::hpc::bitwise::hamming_distance_raw`
- `rustynum::TruthValue` → `ndarray::hpc::bf16_truth::BF16Truth`
- `rustynum::Cascade` → `ndarray::hpc::cascade::Cascade`
- BLAS L1-3: `rustyblas::*` → `ndarray::hpc::blas_level{1,2,3}::*`

**What also changes:**
- lance-graph becomes the Cypher/graph query surface (replacing P1/P3 dead code)
- lance-graph semiring algebra replaces ad-hoc graph ops in src/graph/spo/
- rs-graph-llm becomes the orchestration layer (replacing direct crewAI integration)

**Migration order** (from INTEGRATION_PLAN.md Plateau 2):
1. Add ndarray as path dep (alongside rustynum, not replacing)
2. Create compat bridge (src/compat/ndarray_bridge.rs)
3. Migrate src/spo/ to ndarray types — CHECKPOINT: cargo check
4. Migrate src/nars/ to ndarray types
5. Migrate src/storage/ BindSpace — CHECKPOINT: cargo test
6. Remove rustynum deps — only after all tests pass

**DO NOT** start this migration before ndarray builds clean (Plateau 0).
**DO NOT** migrate BindSpace and SPO simultaneously — SPO first, then BindSpace.

---

## Session Documents (read in order for full context)

```
Expand Down
Loading
Loading