Skip to content

Commit 91cb83a

Browse files
committed
Add CLAUDE.md — guardrails for the boring version
1 parent 95a5fcb commit 91cb83a

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# CLAUDE.md — Lance-Graph
2+
3+
> **Updated**: 2026-03-12
4+
> **Status**: Monolith working, crate separation planned
5+
6+
---
7+
8+
## What This Is
9+
10+
"The Face." A graph database engine on LanceDB + DataFusion. Cypher + SQL in one engine.
11+
From outside: boring fast graph database. Inside: BlasGraph semiring on bitpacked Hamming SPO.
12+
13+
## ⚠ READ BEFORE WRITING CODE
14+
15+
### 1. MONOLITH STATE
16+
17+
Everything is in one crate: `crates/lance-graph/` (19,262 lines).
18+
Plan for 8-crate separation: `CRATE_SEPARATION_PLAN.md` in repo root.
19+
DO NOT start separation without reading that plan.
20+
21+
### 2. graph/spo/ IS STALE
22+
23+
`crates/lance-graph/src/graph/spo/` is a DIVERGED COPY of ladybug-rs `src/graph/spo/`.
24+
ladybug-rs version is MORE COMPLETE (TruthGate from PR 170, MerkleEpoch, SparseContainer).
25+
During crate separation, this gets REPLACED with extended versions from ladybug-rs + holograph.
26+
27+
**DO NOT** extend lance-graph's graph/spo/. Extend ladybug-rs's, then import.
28+
29+
### 3. parser.rs = ladybug-rs lance_parser
30+
31+
`src/parser.rs` is identical (12 diff lines) to `ladybug-rs/src/query/lance_parser/parser.rs`.
32+
The ladybug-rs copy is being DELETED (it's an orphaned duplicate). This repo keeps the original.
33+
34+
### 4. DataFusion Planner Is The Most Valuable Code
35+
36+
`src/datafusion_planner/` (5,633 lines) is the execution engine. Treat it carefully.
37+
The join_builder.rs, expression.rs, scan_ops.rs are production-grade DataFusion integration.
38+
DO NOT rewrite them. They're correct.
39+
40+
### 5. Tests Are Comprehensive
41+
42+
12 test files, ~9,300 lines. Especially `test_datafusion_pipeline.rs` (5,152 lines).
43+
Run them. Don't break them.
44+
45+
## Build
46+
47+
```bash
48+
cargo test # runs all tests in workspace
49+
cargo test -p lance-graph # just the main crate
50+
```
51+
52+
## Role in Four-Repo Architecture
53+
54+
```
55+
rustynum = The Muscle (SIMD substrate)
56+
ladybug-rs = The Brain (BindSpace, server)
57+
staunen = The Bet (6 instructions, no GPU)
58+
lance-graph = The Face ← THIS REPO (query surface)
59+
```
60+
61+
## Key Files (by importance)
62+
63+
```
64+
CRITICAL (don't break):
65+
src/datafusion_planner/ 5633 lines The execution engine
66+
src/parser.rs 1931 lines The Cypher parser (nom)
67+
src/logical_plan.rs 1417 lines Logical plan algebra
68+
src/query.rs 2375 lines Query builder + executor
69+
70+
IMPORT TARGETS (will be enriched during crate separation):
71+
src/graph/spo/ ~1000 lines STALE — will be replaced
72+
src/graph/fingerprint.rs 144 lines Basic fingerprint ops
73+
74+
CLEAN UTILITIES:
75+
src/error.rs 233 lines snafu errors with location
76+
src/config.rs 465 lines GraphConfig builder
77+
src/semantic.rs 1719 lines Semantic validation
78+
```
79+
80+
## What NOT To Do
81+
82+
```
83+
× Don't extend graph/spo/ here (extend in ladybug-rs, import)
84+
× Don't add BindSpace/SpineCache code (that's ladybug-rs)
85+
× Don't add qualia/awareness code (that's ladybug-rs)
86+
× Don't create a Redis protocol handler yet (wait for crate separation)
87+
× Don't use the parser.rs copy in ladybug-rs (it's being deleted there)
88+
```
89+
90+
## Session Context
91+
92+
```
93+
.claude/HANDOVER.md Session handover for this repo
94+
CRATE_SEPARATION_PLAN.md Full 8-crate plan (prompt 21)
95+
```

0 commit comments

Comments
 (0)