@openweave/weave-link 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lemur bookstores
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # 🧠 weave-graph
2
+
3
+ > **WeaveGraph** — The knowledge graph engine at the heart of OpenWeave.
4
+
5
+ Part of the [OpenWeave](../../README.md) monorepo.
6
+
7
+ ---
8
+
9
+ ## What it does
10
+
11
+ WeaveGraph manages all memory for an OpenWeave session:
12
+
13
+ - Stores **concepts, decisions, errors and corrections** as typed graph nodes
14
+ - Connects them with **semantic edges** (relates, causes, corrects, implements, depends_on)
15
+ - **Compresses context** into the graph when the LLM window reaches 75% capacity
16
+ - **Retrieves relevant nodes** from long-term memory given a query
17
+ - **Persists everything** to disk by `chat_id`, survives across sessions
18
+
19
+ ## Node Types
20
+
21
+ | Type | Description |
22
+ |---|---|
23
+ | `CONCEPT` | A key idea or term in the project |
24
+ | `DECISION` | An architectural or implementation decision |
25
+ | `MILESTONE` | A planned deliverable |
26
+ | `ERROR` | A response flagged as incorrect by the user (suppressed) |
27
+ | `CORRECTION` | The correct version linked to an ERROR node |
28
+ | `CODE_ENTITY` | A function, class, or module created during the session |
29
+
30
+ ## Edge Types
31
+
32
+ | Relation | Meaning |
33
+ |---|---|
34
+ | `RELATES` | General semantic relationship |
35
+ | `CAUSES` | A causes B |
36
+ | `CORRECTS` | A is the correction of B (B is an ERROR node) |
37
+ | `IMPLEMENTS` | A implements B (code → decision) |
38
+ | `DEPENDS_ON` | A depends on B |
39
+ | `BLOCKS` | A blocks B |
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ from weave_graph import ContextGraphManager, NodeType, EdgeType
45
+
46
+ # Initialize for a session
47
+ graph = ContextGraphManager(chat_id="proj_abc123")
48
+
49
+ # Add a decision node
50
+ decision = graph.add_node(
51
+ content="Use PostgreSQL for persistence, not SQLite — project will scale",
52
+ node_type=NodeType.DECISION,
53
+ tags=["database", "architecture"]
54
+ )
55
+
56
+ # Add a concept and relate it
57
+ concept = graph.add_node(
58
+ content="Session persistence by chat_id",
59
+ node_type=NodeType.CONCEPT
60
+ )
61
+ graph.add_edge(decision.id, concept.id, EdgeType.RELATES)
62
+
63
+ # Suppress an error and record correction
64
+ graph.suppress_error_node(
65
+ node_id=bad_response_node.id,
66
+ correction_content="Use async/await, not threading — the codebase is fully async"
67
+ )
68
+
69
+ # Query relevant context before responding
70
+ relevant = graph.query_relevant_nodes("database connection pooling", top_k=5)
71
+
72
+ # Compress context when window is getting full
73
+ compressed_summary = graph.compress_context_to_graph(
74
+ context_text=long_conversation_text,
75
+ llm_extractor_fn=my_extraction_function
76
+ )
77
+ ```
78
+
79
+ ## Storage
80
+
81
+ All data is persisted to:
82
+ ```
83
+ {storage_path}/{chat_id}/
84
+ ├── context_graph.json ← Full graph (nodes + edges)
85
+ ├── roadmap.md ← Human-readable milestone status
86
+ ├── decisions.md ← Decision log
87
+ └── errors.md ← Error pattern registry
88
+ ```
89
+
90
+ ## Installation
91
+
92
+ ```bash
93
+ pip install openweave-graph
94
+ # or within the monorepo:
95
+ pnpm --filter weave-graph dev
96
+ ```
@@ -0,0 +1,6 @@
1
+ /**
2
+ * WeaveLink - MCP Server
3
+ * Model Context Protocol server for integrating WeaveGraph with AI clients
4
+ */
5
+ export declare const version = "0.1.0";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * WeaveLink - MCP Server
3
+ * Model Context Protocol server for integrating WeaveGraph with AI clients
4
+ */
5
+ export const version = "0.1.0";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@openweave/weave-link",
3
+ "version": "0.2.0",
4
+ "description": "WeaveLink — MCP Server for integrating WeaveGraph with AI clients",
5
+ "private": false,
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "bin": {
11
+ "weave-link": "./dist/cli.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.js",
20
+ "types": "./dist/index.d.ts"
21
+ }
22
+ },
23
+ "keywords": [
24
+ "mcp",
25
+ "weave",
26
+ "ai-agent",
27
+ "model-context-protocol"
28
+ ],
29
+ "devDependencies": {
30
+ "@types/node": "22.10.2",
31
+ "typescript": "5.7.2",
32
+ "vitest": "3.0.0"
33
+ },
34
+ "dependencies": {
35
+ "@openweave/weave-graph": "0.2.0"
36
+ },
37
+ "scripts": {
38
+ "build": "tsc",
39
+ "dev": "tsc --watch",
40
+ "test": "vitest",
41
+ "lint": "eslint src --max-warnings 0",
42
+ "clean": "rm -rf dist",
43
+ "start": "node dist/cli.js"
44
+ }
45
+ }