@zabaca/lattice 1.0.2 → 1.0.3
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/commands/entity-extract.md +1 -1
- package/commands/graph-sync.md +7 -7
- package/commands/research.md +6 -6
- package/dist/main.js +15 -4
- package/package.json +1 -1
|
@@ -83,7 +83,7 @@ The goal is to ensure entities reflect the document's CURRENT state, not preserv
|
|
|
83
83
|
- Preserve existing fields like `created`, `status`, `topic` (but update `updated` date)
|
|
84
84
|
- **Replace** the `summary`, `entities` and `relationships` sections entirely
|
|
85
85
|
- If no topic field exists, derive it from the directory name
|
|
86
|
-
(e.g.,
|
|
86
|
+
(e.g., `~/.lattice/docs/claude-code/file.md` -> `topic: claude-code`)
|
|
87
87
|
|
|
88
88
|
Frontmatter template:
|
|
89
89
|
```yaml
|
package/commands/graph-sync.md
CHANGED
|
@@ -38,16 +38,16 @@ For each new or updated document identified:
|
|
|
38
38
|
Task(
|
|
39
39
|
subagent_type="general-purpose",
|
|
40
40
|
model="haiku",
|
|
41
|
-
prompt="Use /entity-extract docs/topic/document.md to extract entities. Follow all instructions and report completion."
|
|
41
|
+
prompt="Use /entity-extract ~/.lattice/docs/topic/document.md to extract entities. Follow all instructions and report completion."
|
|
42
42
|
)
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
**For multiple documents, launch agents in parallel:**
|
|
46
46
|
```
|
|
47
47
|
// In a single message, launch multiple Task tool calls:
|
|
48
|
-
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract docs/topic-a/README.md ...")
|
|
49
|
-
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract docs/topic-b/notes.md ...")
|
|
50
|
-
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract docs/topic-c/README.md ...")
|
|
48
|
+
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract ~/.lattice/docs/topic-a/README.md ...")
|
|
49
|
+
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract ~/.lattice/docs/topic-b/notes.md ...")
|
|
50
|
+
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract ~/.lattice/docs/topic-c/README.md ...")
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
This is much faster than sequential execution for multiple documents.
|
|
@@ -87,15 +87,15 @@ Summarize what was processed:
|
|
|
87
87
|
|
|
88
88
|
Processed 3 documents:
|
|
89
89
|
|
|
90
|
-
1. docs/american-holidays/README.md
|
|
90
|
+
1. ~/.lattice/docs/american-holidays/README.md
|
|
91
91
|
- 4 entities extracted
|
|
92
92
|
- 3 relationships defined
|
|
93
93
|
|
|
94
|
-
2. docs/american-holidays/thanksgiving-vs-christmas.md
|
|
94
|
+
2. ~/.lattice/docs/american-holidays/thanksgiving-vs-christmas.md
|
|
95
95
|
- 8 entities extracted
|
|
96
96
|
- 5 relationships defined
|
|
97
97
|
|
|
98
|
-
3. docs/bun-nestjs/notes.md
|
|
98
|
+
3. ~/.lattice/docs/bun-nestjs/notes.md
|
|
99
99
|
- 5 entities extracted
|
|
100
100
|
- 4 relationships defined
|
|
101
101
|
|
package/commands/research.md
CHANGED
|
@@ -65,7 +65,7 @@ If user wants new research:
|
|
|
65
65
|
### Step 6: Determine Topic and Filename
|
|
66
66
|
|
|
67
67
|
**Identify the topic directory:**
|
|
68
|
-
- Check if a relevant
|
|
68
|
+
- Check if a relevant `~/.lattice/docs/{topic-name}/` directory already exists
|
|
69
69
|
- If not, derive a new topic name from the query (kebab-case)
|
|
70
70
|
|
|
71
71
|
**Derive the research filename:**
|
|
@@ -89,7 +89,7 @@ Auto-derive from the specific focus of the query:
|
|
|
89
89
|
|
|
90
90
|
Create TWO files:
|
|
91
91
|
|
|
92
|
-
**1.
|
|
92
|
+
**1. `~/.lattice/docs/{topic-name}/README.md`** (index):
|
|
93
93
|
```markdown
|
|
94
94
|
---
|
|
95
95
|
created: [TODAY'S DATE]
|
|
@@ -115,7 +115,7 @@ Brief description of what this topic covers.
|
|
|
115
115
|
- [Related Topic](../related-topic/)
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
**2.
|
|
118
|
+
**2. `~/.lattice/docs/{topic-name}/{research-filename}.md`** (content):
|
|
119
119
|
```markdown
|
|
120
120
|
---
|
|
121
121
|
created: [TODAY'S DATE]
|
|
@@ -146,9 +146,9 @@ What this research addresses.
|
|
|
146
146
|
|
|
147
147
|
#### For EXISTING Topics (directory exists)
|
|
148
148
|
|
|
149
|
-
**1. Create**
|
|
149
|
+
**1. Create** `~/.lattice/docs/{topic-name}/{research-filename}.md` with content template above
|
|
150
150
|
|
|
151
|
-
**2. Update**
|
|
151
|
+
**2. Update** `~/.lattice/docs/{topic-name}/README.md`:
|
|
152
152
|
- Add new row to the Documents table
|
|
153
153
|
- Update the `updated` date in frontmatter
|
|
154
154
|
|
|
@@ -173,7 +173,7 @@ After creating files, confirm:
|
|
|
173
173
|
## File Structure Standard
|
|
174
174
|
|
|
175
175
|
```
|
|
176
|
-
docs/{topic-name}/
|
|
176
|
+
~/.lattice/docs/{topic-name}/
|
|
177
177
|
├── README.md # Index: links to docs, brief overview
|
|
178
178
|
├── {research-1}.md # Specific research
|
|
179
179
|
├── {research-2}.md # Additional research
|
package/dist/main.js
CHANGED
|
@@ -832,6 +832,7 @@ EmbeddingService = __legacyDecorateClassTS([
|
|
|
832
832
|
], EmbeddingService);
|
|
833
833
|
|
|
834
834
|
// src/graph/graph.service.ts
|
|
835
|
+
import { existsSync as existsSync3, unlinkSync } from "fs";
|
|
835
836
|
import { DuckDBInstance } from "@duckdb/node-api";
|
|
836
837
|
import { Injectable as Injectable6, Logger as Logger3 } from "@nestjs/common";
|
|
837
838
|
import { ConfigService as ConfigService2 } from "@nestjs/config";
|
|
@@ -874,6 +875,11 @@ class GraphService {
|
|
|
874
875
|
}
|
|
875
876
|
async connect() {
|
|
876
877
|
try {
|
|
878
|
+
const walPath = `${this.dbPath}.wal`;
|
|
879
|
+
if (existsSync3(walPath)) {
|
|
880
|
+
this.logger.warn(`Removing WAL file to prevent HNSW index replay failure`);
|
|
881
|
+
unlinkSync(walPath);
|
|
882
|
+
}
|
|
877
883
|
this.instance = await DuckDBInstance.create(this.dbPath, {
|
|
878
884
|
allow_unsigned_extensions: "true"
|
|
879
885
|
});
|
|
@@ -899,6 +905,11 @@ class GraphService {
|
|
|
899
905
|
}
|
|
900
906
|
async disconnect() {
|
|
901
907
|
if (this.connection) {
|
|
908
|
+
try {
|
|
909
|
+
await this.connection.run("CHECKPOINT;");
|
|
910
|
+
} catch {
|
|
911
|
+
this.logger.debug("Checkpoint failed during disconnect");
|
|
912
|
+
}
|
|
902
913
|
this.connection.closeSync();
|
|
903
914
|
this.connection = null;
|
|
904
915
|
this.logger.log("Disconnected from DuckDB");
|
|
@@ -1373,7 +1384,7 @@ import { Command as Command4, CommandRunner as CommandRunner4, Option as Option3
|
|
|
1373
1384
|
|
|
1374
1385
|
// src/sync/manifest.service.ts
|
|
1375
1386
|
import { createHash as createHash2 } from "crypto";
|
|
1376
|
-
import { existsSync as
|
|
1387
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1377
1388
|
import { readFile as readFile3, writeFile } from "fs/promises";
|
|
1378
1389
|
import { Injectable as Injectable8 } from "@nestjs/common";
|
|
1379
1390
|
|
|
@@ -1401,7 +1412,7 @@ class ManifestService {
|
|
|
1401
1412
|
}
|
|
1402
1413
|
async load() {
|
|
1403
1414
|
try {
|
|
1404
|
-
if (
|
|
1415
|
+
if (existsSync4(this.manifestPath)) {
|
|
1405
1416
|
const content = await readFile3(this.manifestPath, "utf-8");
|
|
1406
1417
|
this.manifest = SyncManifestSchema.parse(JSON.parse(content));
|
|
1407
1418
|
} else {
|
|
@@ -1887,7 +1898,7 @@ CascadeService = __legacyDecorateClassTS([
|
|
|
1887
1898
|
], CascadeService);
|
|
1888
1899
|
|
|
1889
1900
|
// src/sync/path-resolver.service.ts
|
|
1890
|
-
import { existsSync as
|
|
1901
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1891
1902
|
import { isAbsolute, resolve as resolve2 } from "path";
|
|
1892
1903
|
import { Injectable as Injectable10 } from "@nestjs/common";
|
|
1893
1904
|
class PathResolverService {
|
|
@@ -1909,7 +1920,7 @@ class PathResolverService {
|
|
|
1909
1920
|
if (requireInDocs && !this.isUnderDocs(resolvedPath)) {
|
|
1910
1921
|
throw new Error(`Path "${userPath}" resolves to "${resolvedPath}" which is outside the docs directory (${this.docsPath})`);
|
|
1911
1922
|
}
|
|
1912
|
-
if (requireExists && !
|
|
1923
|
+
if (requireExists && !existsSync5(resolvedPath)) {
|
|
1913
1924
|
throw new Error(`Path "${userPath}" does not exist (resolved to: ${resolvedPath})`);
|
|
1914
1925
|
}
|
|
1915
1926
|
return resolvedPath;
|