@zabaca/lattice 1.0.11 → 1.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zabaca/lattice",
3
- "version": "1.0.11",
3
+ "version": "1.0.17",
4
4
  "description": "Human-initiated, AI-powered knowledge graph for markdown documentation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,9 +19,9 @@
19
19
  "check:fix": "tsc --noEmit && biome check --write .",
20
20
  "lattice": "bun run src/main.ts",
21
21
  "prepublishOnly": "bun run build",
22
- "release:patch": "bun run check && bun test && bun pm version patch && bun publish && git push && git push --tags",
23
- "release:minor": "bun run check && bun test && bun pm version minor && bun publish && git push && git push --tags",
24
- "release:major": "bun run check && bun test && bun pm version major && bun publish && git push && git push --tags",
22
+ "release:patch": "bun run check && bun test && bun pm version patch && git push && git push --tags && bun publish",
23
+ "release:minor": "bun run check && bun test && bun pm version minor && git push && git push && bun publish",
24
+ "release:major": "bun run check && bun test && bun pm version major && git push && git push && bun publish",
25
25
  "release:dry": "bun publish --dry-run"
26
26
  },
27
27
  "keywords": [
@@ -43,6 +43,7 @@
43
43
  "url": "https://github.com/Zabaca/lattice.git"
44
44
  },
45
45
  "dependencies": {
46
+ "@anthropic-ai/claude-agent-sdk": "^0.1.67",
46
47
  "@duckdb/node-api": "1.3.1-alpha.23",
47
48
  "@nestjs/common": "^10.0.0",
48
49
  "@nestjs/config": "^3.0.0",
@@ -1,177 +0,0 @@
1
- ---
2
- description: Extract entities from existing document and add to frontmatter
3
- argument-hint: file-path
4
- model: haiku
5
- ---
6
-
7
- Extract entities and relationships from the markdown file "$ARGUMENTS" and update its frontmatter.
8
-
9
- ## Configuration
10
-
11
- **⚠️ CRITICAL: All documentation lives in `~/.lattice/docs/`**
12
-
13
- | Path | Purpose |
14
- |------|---------|
15
- | `~/.lattice/docs/` | Root documentation directory (ALWAYS use this) |
16
- | `~/.lattice/docs/{topic}/` | Topic directories |
17
- | `~/.lattice/docs/{topic}/*.md` | Research documents |
18
-
19
- **NEVER use project-local `docs/` directories. ALWAYS use absolute path `~/.lattice/docs/`.**
20
-
21
- **If the argument "$ARGUMENTS" is a relative path like `docs/topic/file.md`, convert it to `~/.lattice/docs/topic/file.md`.**
22
-
23
- ## IMPORTANT: Always Re-Extract
24
-
25
- Even if the document already has frontmatter with entities:
26
- - **RE-READ** the entire document content
27
- - **RE-EXTRACT** entities based on CURRENT content
28
- - **REPLACE** existing entities with fresh extraction
29
- - **DO NOT skip** because "entities already exist"
30
-
31
- The goal is to ensure entities reflect the document's CURRENT state, not preserve stale metadata from previous extractions.
32
-
33
- ## Process
34
-
35
- 1. **Verify file exists**:
36
- - Check if "$ARGUMENTS" exists
37
- - If not, inform user and suggest the correct path
38
- - Verify it's a markdown file
39
-
40
- 2. **Read and analyze the document**:
41
- - Read the full content of the file
42
- - Check for existing frontmatter
43
- - Analyze document context and purpose
44
-
45
- 3. **Extract entities** by identifying:
46
- - **Technologies**: Languages, frameworks, databases, libraries, tools mentioned
47
- - **Concepts**: Patterns, methodologies, theories, architectural approaches
48
- - **Tools & Services**: Software, platforms, applications referenced
49
- - **Processes**: Workflows, procedures, methodologies described
50
- - **Organizations**: Companies, teams, projects mentioned
51
-
52
- Guidelines:
53
- - Focus on 3-10 most significant entities for the document
54
- - Use specific names (e.g., "PostgreSQL" not "database")
55
- - Prefer proper nouns and technical terms
56
- - Entities should be directly relevant to the document's focus
57
-
58
- 4. **Generate document summary**:
59
- - Create a 2-3 sentence summary (50-100 words) that captures:
60
- - The document's main purpose/topic
61
- - Key technologies or concepts covered
62
- - Primary conclusions or recommendations (if any)
63
-
64
- Summary guidelines:
65
- - Write in third person
66
- - Include key terms that enable semantic search
67
- - Focus on what the document IS ABOUT, not just what it contains
68
- - Make it suitable for embedding generation
69
-
70
- Example:
71
- ```yaml
72
- summary: >
73
- Research on integrating multiple messaging platforms (Slack, Teams, Discord)
74
- into a unified API. Covers platform API comparisons, recommended tech stack
75
- (NestJS, PostgreSQL, Redis), and a phased implementation approach for
76
- bi-directional message synchronization.
77
- ```
78
-
79
- 5. **Extract relationships** between entities:
80
- - **REFERENCES**: This entity references/relates to another entity
81
-
82
- Use `source: this` when the document itself references an entity.
83
- Use entity names as source/target when entities reference each other.
84
-
85
- 6. **Determine entity types** (choose most appropriate):
86
- - `Topic`: Research domains (usually auto-derived from directory)
87
- - `Technology`: Programming languages, frameworks, databases
88
- - `Concept`: Patterns, theories, methodologies
89
- - `Tool`: Software, services, platforms
90
- - `Process`: Workflows, procedures, methodologies
91
- - `Person`: People
92
- - `Organization`: Companies, teams, projects
93
-
94
- 7. **Update frontmatter**:
95
- - If frontmatter exists: **REPLACE** entities and relationships with fresh extraction
96
- - If no frontmatter: Create new frontmatter block
97
- - Preserve existing fields like `created`, `status`, `topic` (but update `updated` date)
98
- - **Replace** the `summary`, `entities` and `relationships` sections entirely
99
- - If no topic field exists, derive it from the directory name
100
- (e.g., `~/.lattice/docs/claude-code/file.md` -> `topic: claude-code`)
101
-
102
- Frontmatter template:
103
- ```yaml
104
- ---
105
- created: YYYY-MM-DD
106
- updated: YYYY-MM-DD
107
- status: complete|ongoing|draft
108
- topic: auto-derived-from-directory
109
- summary: >
110
- 2-3 sentence summary capturing the document's purpose, key topics,
111
- and conclusions. Written in third person with key terms for semantic search.
112
- entities:
113
- - name: EntityName
114
- type: Topic|Technology|Concept|Tool|Process|Person|Organization
115
- description: Brief description of entity and its role in this document
116
- - name: AnotherEntity
117
- type: Concept
118
- description: Another entity description
119
- relationships:
120
- - source: this
121
- relation: REFERENCES
122
- target: MainTopic
123
- - source: EntityA
124
- relation: REFERENCES
125
- target: EntityB
126
- graph:
127
- domain: detected-domain
128
- ---
129
- ```
130
-
131
- 8. **Entity naming consistency**:
132
- - Check if similar entities exist in other documents
133
- - Use exact same names when referring to same entities
134
- - Be specific: "React" not "React library"
135
- - Use canonical names (e.g., "TypeScript" not "TS")
136
-
137
- 9. **Relationship guidelines**:
138
- - Start with "source: this" for primary entity the document covers
139
- - Include 3-7 key relationships
140
- - Relationships should help build knowledge graph connections
141
- - Avoid redundant relationships
142
-
143
- 10. **Validate and auto-fix** (retry loop):
144
- After saving, run validation:
145
-
146
- ```bash
147
- lattice validate 2>&1 | grep -A10 "$ARGUMENTS"
148
- ```
149
-
150
- **If validation reports errors for this file:**
151
- 1. Parse the error message to identify the issue
152
- 2. Fix the frontmatter:
153
- - **Invalid entity type** (e.g., "Platform", "Feature"): Change to valid type
154
- - **Invalid relation** (e.g., "AFFECTS", "ENABLES"): Change to valid relation
155
- - **String instead of object**: Reformat to proper object structure
156
- 3. Save the fixed frontmatter
157
- 4. Re-run validation
158
- 5. Repeat until validation passes (max 3 attempts)
159
-
160
- **Valid entity types:** `Topic`, `Technology`, `Concept`, `Tool`, `Process`, `Person`, `Organization`, `Document`
161
-
162
- **Valid relations:** `REFERENCES`
163
-
164
- 11. **Confirmation**:
165
- - Show the file path
166
- - Show the generated summary
167
- - List extracted entities with types
168
- - List extracted relationships
169
- - Confirm validation passed (or show fixes made)
170
-
171
- ## Important Notes
172
-
173
- - **Preserve existing content**: Do not modify the markdown content itself, only the frontmatter
174
- - **YAML validity**: Ensure all YAML is properly formatted
175
- - **Replace strategy**: Always replace entities/relationships with fresh extraction (don't merge with old)
176
- - **Be selective**: Focus on entities that would be valuable for knowledge graph connections
177
- - **Descriptions**: Write descriptions from the perspective of how the entity is used/discussed in THIS document