@zabaca/lattice 0.3.3 → 1.0.0
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/README.md +68 -64
- package/dist/main.js +1675 -1585
- package/package.json +63 -59
package/README.md
CHANGED
|
@@ -24,30 +24,31 @@ That's it. Two commands to build a knowledge base.
|
|
|
24
24
|
| Feature | Lattice | Other GraphRAG Tools |
|
|
25
25
|
|---------|---------|---------------------|
|
|
26
26
|
| **LLM for extraction** | Your Claude Code subscription | Separate API key + costs |
|
|
27
|
-
| **Setup time** |
|
|
28
|
-
| **
|
|
27
|
+
| **Setup time** | 2 minutes | 30+ minutes |
|
|
28
|
+
| **Database** | Embedded DuckDB (zero config) | Docker containers required |
|
|
29
|
+
| **External dependencies** | None | 2-3 (DB + vector + graph) |
|
|
29
30
|
| **API keys needed** | 1 (Voyage AI for embeddings) | 2-3 (LLM + embedding + rerank) |
|
|
30
31
|
| **Workflow** | `/research` → `/graph-sync` | Custom scripts |
|
|
31
32
|
|
|
32
33
|
---
|
|
33
34
|
|
|
34
|
-
## Quick Start (
|
|
35
|
+
## Quick Start (2 Minutes)
|
|
35
36
|
|
|
36
37
|
### What You Need
|
|
37
38
|
|
|
38
39
|
- **Claude Code** (you probably already have it)
|
|
39
|
-
- **Docker** (for FalkorDB)
|
|
40
40
|
- **Voyage AI API key** ([get one here](https://www.voyageai.com/) - embeddings only, ~$0.01/1M tokens)
|
|
41
41
|
|
|
42
|
-
### 1. Install
|
|
42
|
+
### 1. Install
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
bun add -g @zabaca/lattice
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
lattice init --global # Install Claude Code commands
|
|
45
|
+
bun add -g @zabaca/lattice # Install CLI
|
|
46
|
+
export VOYAGE_API_KEY=your-key-here # Set API key
|
|
47
|
+
lattice init --global # Install Claude Code commands
|
|
49
48
|
```
|
|
50
49
|
|
|
50
|
+
That's it. No Docker. No containers. DuckDB is embedded.
|
|
51
|
+
|
|
51
52
|
### 2. Start Researching
|
|
52
53
|
|
|
53
54
|
```bash
|
|
@@ -67,7 +68,7 @@ The `/research` command will:
|
|
|
67
68
|
The `/graph-sync` command will:
|
|
68
69
|
- Detect all new/changed documents
|
|
69
70
|
- Extract entities using Claude Code (your subscription)
|
|
70
|
-
- Sync to
|
|
71
|
+
- Sync to DuckDB for semantic search
|
|
71
72
|
|
|
72
73
|
---
|
|
73
74
|
|
|
@@ -152,6 +153,24 @@ Semantic search across the knowledge graph.
|
|
|
152
153
|
|
|
153
154
|
```bash
|
|
154
155
|
lattice search "query" # Search all entity types
|
|
156
|
+
lattice search "query" -l Tool # Filter by label
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### `lattice sql`
|
|
160
|
+
|
|
161
|
+
Execute raw SQL queries against DuckDB.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
lattice sql "SELECT * FROM nodes LIMIT 10"
|
|
165
|
+
lattice sql "SELECT label, COUNT(*) FROM nodes GROUP BY label"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### `lattice rels`
|
|
169
|
+
|
|
170
|
+
Show relationships for a node.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
lattice rels "TypeScript" # Show all relationships for an entity
|
|
155
174
|
```
|
|
156
175
|
|
|
157
176
|
### `lattice validate`
|
|
@@ -182,15 +201,24 @@ lattice ontology # Show entity types and relationship types
|
|
|
182
201
|
| Variable | Description | Default |
|
|
183
202
|
|----------|-------------|---------|
|
|
184
203
|
| `VOYAGE_API_KEY` | Voyage AI API key for embeddings | *required* |
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
204
|
+
| `DUCKDB_PATH` | Path to DuckDB database file | `./.lattice.duckdb` |
|
|
205
|
+
| `EMBEDDING_DIMENSIONS` | Embedding vector dimensions | `512` |
|
|
206
|
+
|
|
207
|
+
### Database Location
|
|
208
|
+
|
|
209
|
+
Lattice stores its knowledge graph in a single `.lattice.duckdb` file in your docs directory. This file contains:
|
|
210
|
+
- All extracted entities (nodes)
|
|
211
|
+
- Relationships between entities
|
|
212
|
+
- Vector embeddings for semantic search
|
|
213
|
+
|
|
214
|
+
You can back up, copy, or version control this file like any other.
|
|
187
215
|
|
|
188
216
|
<details>
|
|
189
217
|
<summary><b>How It Works (Technical Details)</b></summary>
|
|
190
218
|
|
|
191
219
|
### Entity Extraction
|
|
192
220
|
|
|
193
|
-
When you run `/graph-sync`, Claude Code extracts entities from your documents and writes them to YAML frontmatter. The Lattice CLI then syncs this to
|
|
221
|
+
When you run `/graph-sync`, Claude Code extracts entities from your documents and writes them to YAML frontmatter. The Lattice CLI then syncs this to DuckDB.
|
|
194
222
|
|
|
195
223
|
```yaml
|
|
196
224
|
---
|
|
@@ -208,57 +236,35 @@ relationships:
|
|
|
208
236
|
|
|
209
237
|
You don't need to write this manually — Claude Code handles it automatically.
|
|
210
238
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
falkordb-data:
|
|
239
|
+
### Database Schema
|
|
240
|
+
|
|
241
|
+
Lattice uses two main tables:
|
|
242
|
+
|
|
243
|
+
```sql
|
|
244
|
+
-- Nodes (entities)
|
|
245
|
+
CREATE TABLE nodes (
|
|
246
|
+
label VARCHAR NOT NULL, -- Entity type: Document, Technology, etc.
|
|
247
|
+
name VARCHAR NOT NULL, -- Unique identifier
|
|
248
|
+
properties JSON, -- Additional metadata
|
|
249
|
+
embedding FLOAT[512], -- Vector for semantic search
|
|
250
|
+
PRIMARY KEY(label, name)
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
-- Relationships
|
|
254
|
+
CREATE TABLE relationships (
|
|
255
|
+
source_label VARCHAR NOT NULL,
|
|
256
|
+
source_name VARCHAR NOT NULL,
|
|
257
|
+
relation_type VARCHAR NOT NULL,
|
|
258
|
+
target_label VARCHAR NOT NULL,
|
|
259
|
+
target_name VARCHAR NOT NULL,
|
|
260
|
+
properties JSON,
|
|
261
|
+
PRIMARY KEY(source_label, source_name, relation_type, target_label, target_name)
|
|
262
|
+
);
|
|
236
263
|
```
|
|
237
264
|
|
|
238
|
-
|
|
239
|
-
docker-compose up -d
|
|
240
|
-
```
|
|
265
|
+
### Vector Search
|
|
241
266
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
<details>
|
|
245
|
-
<summary><b>Kubernetes (k3s)</b></summary>
|
|
246
|
-
|
|
247
|
-
For production deployments, use the provided k3s manifests:
|
|
248
|
-
|
|
249
|
-
```bash
|
|
250
|
-
kubectl apply -f infra/k3s/namespace.yaml
|
|
251
|
-
kubectl apply -f infra/k3s/pv.yaml
|
|
252
|
-
kubectl apply -f infra/k3s/pvc.yaml
|
|
253
|
-
kubectl apply -f infra/k3s/deployment.yaml
|
|
254
|
-
kubectl apply -f infra/k3s/service.yaml
|
|
255
|
-
|
|
256
|
-
# Optional: NodePort for external access
|
|
257
|
-
kubectl apply -f infra/k3s/nodeport-service.yaml
|
|
258
|
-
|
|
259
|
-
# Optional: Ingress
|
|
260
|
-
kubectl apply -f infra/k3s/ingress.yaml
|
|
261
|
-
```
|
|
267
|
+
Lattice uses DuckDB's VSS extension for HNSW-based vector similarity search with cosine distance.
|
|
262
268
|
|
|
263
269
|
</details>
|
|
264
270
|
|
|
@@ -273,7 +279,6 @@ kubectl apply -f infra/k3s/ingress.yaml
|
|
|
273
279
|
|
|
274
280
|
- Node.js >= 18.0.0
|
|
275
281
|
- Bun (recommended) or npm
|
|
276
|
-
- Docker (for FalkorDB)
|
|
277
282
|
|
|
278
283
|
### Setup
|
|
279
284
|
|
|
@@ -282,7 +287,6 @@ git clone https://github.com/Zabaca/lattice.git
|
|
|
282
287
|
cd lattice
|
|
283
288
|
bun install
|
|
284
289
|
cp .env.example .env
|
|
285
|
-
docker-compose -f infra/docker-compose.yaml up -d
|
|
286
290
|
```
|
|
287
291
|
|
|
288
292
|
### Running Locally
|
|
@@ -329,4 +333,4 @@ MIT License - see [LICENSE](LICENSE) for details.
|
|
|
329
333
|
|
|
330
334
|
---
|
|
331
335
|
|
|
332
|
-
Built with [
|
|
336
|
+
Built with [DuckDB](https://duckdb.org/), [Voyage AI](https://www.voyageai.com/), and [Claude Code](https://claude.ai/code)
|