@zabaca/lattice 1.0.16 → 1.0.18
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/graph-sync.md +27 -69
- package/commands/research.md +5 -22
- package/dist/main.js +2203 -1568
- package/package.json +2 -1
- package/commands/entity-extract.md +0 -177
package/commands/graph-sync.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Sync modified docs to knowledge graph
|
|
3
3
|
model: sonnet
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Sync modified documents in `~/.lattice/docs/` to the knowledge graph.
|
|
7
7
|
|
|
8
8
|
## Configuration
|
|
9
9
|
|
|
@@ -33,61 +33,26 @@ This will show:
|
|
|
33
33
|
|
|
34
34
|
If no documents need syncing, report that and exit.
|
|
35
35
|
|
|
36
|
-
### Step 2:
|
|
36
|
+
### Step 2: Sync to Graph
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
1. Use the **Task subagent pattern** with Haiku model for parallel execution
|
|
41
|
-
2. Launch multiple Task agents simultaneously (one per document)
|
|
42
|
-
3. Each agent should:
|
|
43
|
-
- Invoke `/entity-extract <path>`
|
|
44
|
-
- Follow expanded instructions
|
|
45
|
-
- Extract entities and update frontmatter
|
|
46
|
-
- Report completion
|
|
47
|
-
|
|
48
|
-
**Example Task agent invocation:**
|
|
49
|
-
```
|
|
50
|
-
Task(
|
|
51
|
-
subagent_type="general-purpose",
|
|
52
|
-
model="haiku",
|
|
53
|
-
prompt="Use /entity-extract ~/.lattice/docs/topic/document.md to extract entities. Follow all instructions and report completion."
|
|
54
|
-
)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**For multiple documents, launch agents in parallel:**
|
|
58
|
-
```
|
|
59
|
-
// In a single message, launch multiple Task tool calls:
|
|
60
|
-
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract ~/.lattice/docs/topic-a/README.md ...")
|
|
61
|
-
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract ~/.lattice/docs/topic-b/notes.md ...")
|
|
62
|
-
Task(subagent_type="general-purpose", model="haiku", prompt="/entity-extract ~/.lattice/docs/topic-c/README.md ...")
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
This is much faster than sequential execution for multiple documents.
|
|
66
|
-
|
|
67
|
-
### Step 3: Sync to Graph
|
|
68
|
-
|
|
69
|
-
After all entity extractions are complete:
|
|
38
|
+
Run sync to process all changed documents:
|
|
70
39
|
|
|
71
40
|
```bash
|
|
72
41
|
lattice sync
|
|
73
42
|
```
|
|
74
43
|
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
44
|
+
This will automatically:
|
|
45
|
+
- **Extract entities** using AI (Claude Haiku) for each new/updated document
|
|
46
|
+
- **Generate embeddings** for semantic search
|
|
47
|
+
- **Create entity relationships** in the graph
|
|
48
|
+
- **Update the sync manifest** with new hashes
|
|
78
49
|
|
|
79
|
-
|
|
50
|
+
The sync command includes built-in rate limiting (500ms between extractions) to avoid API throttling.
|
|
80
51
|
|
|
81
|
-
|
|
82
|
-
- Update document nodes in FalkorDB
|
|
83
|
-
- Generate embeddings for semantic search
|
|
84
|
-
- Create entity relationships
|
|
85
|
-
- Update the sync manifest
|
|
86
|
-
|
|
87
|
-
### Step 4: Report Results
|
|
52
|
+
### Step 3: Report Results
|
|
88
53
|
|
|
89
54
|
Summarize what was processed:
|
|
90
|
-
- Number of documents
|
|
55
|
+
- Number of documents synced
|
|
91
56
|
- Entities extracted per document
|
|
92
57
|
- Graph sync statistics (added, updated, unchanged)
|
|
93
58
|
- Any errors encountered
|
|
@@ -95,35 +60,28 @@ Summarize what was processed:
|
|
|
95
60
|
## Example Output
|
|
96
61
|
|
|
97
62
|
```
|
|
98
|
-
##
|
|
99
|
-
|
|
100
|
-
Processed 3 documents:
|
|
101
|
-
|
|
102
|
-
1. ~/.lattice/docs/american-holidays/README.md
|
|
103
|
-
- 4 entities extracted
|
|
104
|
-
- 3 relationships defined
|
|
105
|
-
|
|
106
|
-
2. ~/.lattice/docs/american-holidays/thanksgiving-vs-christmas.md
|
|
107
|
-
- 8 entities extracted
|
|
108
|
-
- 5 relationships defined
|
|
63
|
+
## Graph Sync
|
|
109
64
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
- 4 relationships defined
|
|
65
|
+
lattice status:
|
|
66
|
+
- 3 documents need syncing (2 new, 1 updated)
|
|
113
67
|
|
|
114
|
-
|
|
68
|
+
lattice sync:
|
|
69
|
+
- ~/.lattice/docs/american-holidays/README.md → 4 entities extracted
|
|
70
|
+
- ~/.lattice/docs/american-holidays/thanksgiving-vs-christmas.md → 8 entities extracted
|
|
71
|
+
- ~/.lattice/docs/bun-nestjs/notes.md → 5 entities extracted
|
|
115
72
|
|
|
73
|
+
Summary:
|
|
116
74
|
- Added: 2
|
|
117
75
|
- Updated: 1
|
|
118
76
|
- Unchanged: 126
|
|
119
|
-
- Duration:
|
|
77
|
+
- Duration: 3.2s
|
|
120
78
|
```
|
|
121
79
|
|
|
122
80
|
## Important Notes
|
|
123
81
|
|
|
124
|
-
- **
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
- Safe to run frequently - won't duplicate or corrupt data
|
|
128
|
-
-
|
|
129
|
-
- **Batch syncing
|
|
82
|
+
- **AI extraction is automatic** - no need for manual `/entity-extract` calls
|
|
83
|
+
- **Incremental sync** - only processes changed documents
|
|
84
|
+
- **Self-correcting** - Claude validates extractions and fixes errors automatically
|
|
85
|
+
- **Safe to run frequently** - won't duplicate or corrupt data
|
|
86
|
+
- **No frontmatter required** - documents are plain markdown
|
|
87
|
+
- **Batch syncing** - run once after multiple research sessions for efficiency
|
package/commands/research.md
CHANGED
|
@@ -104,15 +104,6 @@ Create TWO files:
|
|
|
104
104
|
|
|
105
105
|
**1. `~/.lattice/docs/{topic-name}/README.md`** (index):
|
|
106
106
|
```markdown
|
|
107
|
-
---
|
|
108
|
-
created: [TODAY'S DATE]
|
|
109
|
-
updated: [TODAY'S DATE]
|
|
110
|
-
status: active
|
|
111
|
-
topic: {topic-name}
|
|
112
|
-
summary: >
|
|
113
|
-
Brief description of the topic area for semantic search.
|
|
114
|
-
---
|
|
115
|
-
|
|
116
107
|
# {Topic Title}
|
|
117
108
|
|
|
118
109
|
Brief description of what this topic covers.
|
|
@@ -130,15 +121,6 @@ Brief description of what this topic covers.
|
|
|
130
121
|
|
|
131
122
|
**2. `~/.lattice/docs/{topic-name}/{research-filename}.md`** (content):
|
|
132
123
|
```markdown
|
|
133
|
-
---
|
|
134
|
-
created: [TODAY'S DATE]
|
|
135
|
-
updated: [TODAY'S DATE]
|
|
136
|
-
status: complete
|
|
137
|
-
topic: {topic-name}
|
|
138
|
-
summary: >
|
|
139
|
-
Detailed summary of this specific research for semantic search.
|
|
140
|
-
---
|
|
141
|
-
|
|
142
124
|
# {Research Title}
|
|
143
125
|
|
|
144
126
|
## Purpose
|
|
@@ -157,13 +139,14 @@ What this research addresses.
|
|
|
157
139
|
1. [Source](URL)
|
|
158
140
|
```
|
|
159
141
|
|
|
142
|
+
**Note:** No frontmatter required - entities, relationships, and summaries are automatically extracted by AI during `lattice sync`.
|
|
143
|
+
|
|
160
144
|
#### For EXISTING Topics (directory exists)
|
|
161
145
|
|
|
162
146
|
**1. Create** `~/.lattice/docs/{topic-name}/{research-filename}.md` with content template above
|
|
163
147
|
|
|
164
148
|
**2. Update** `~/.lattice/docs/{topic-name}/README.md`:
|
|
165
149
|
- Add new row to the Documents table
|
|
166
|
-
- Update the `updated` date in frontmatter
|
|
167
150
|
|
|
168
151
|
### Step 8: Confirmation
|
|
169
152
|
|
|
@@ -171,17 +154,17 @@ After creating files, confirm:
|
|
|
171
154
|
- Topic directory path
|
|
172
155
|
- README.md created/updated
|
|
173
156
|
- Research file created with name
|
|
174
|
-
- Remind user to run `/graph-sync` to
|
|
157
|
+
- Remind user to run `/graph-sync` to sync to knowledge graph
|
|
175
158
|
|
|
176
159
|
## Important Notes
|
|
177
160
|
|
|
178
|
-
- **Do NOT** auto-run
|
|
161
|
+
- **Do NOT** auto-run graph sync - use `/graph-sync` separately
|
|
179
162
|
- **Always create README.md** for new topics (lightweight index)
|
|
180
163
|
- **Always create separate research file** (never put research content in README)
|
|
181
164
|
- Use kebab-case for all directory and file names
|
|
182
|
-
- Include today's date in YYYY-MM-DD format
|
|
183
165
|
- Always cite sources with URLs
|
|
184
166
|
- Cross-link to related research topics when relevant
|
|
167
|
+
- **No frontmatter needed** - AI extracts entities automatically during sync
|
|
185
168
|
|
|
186
169
|
## File Structure Standard
|
|
187
170
|
|