wisdomgraph 0.2.0__tar.gz → 0.3.0__tar.gz
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.
- {wisdomgraph-0.2.0/wisdomgraph.egg-info → wisdomgraph-0.3.0}/PKG-INFO +76 -13
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/README.md +73 -10
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/pyproject.toml +4 -3
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_mcp.py +233 -4
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/__init__.py +1 -1
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/__main__.py +192 -6
- wisdomgraph-0.3.0/wisdom/local.py +197 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/mcp.py +290 -2
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0/wisdomgraph.egg-info}/PKG-INFO +76 -13
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdomgraph.egg-info/SOURCES.txt +1 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/LICENSE +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/setup.cfg +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_cache.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_classify.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_detect.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_ingest.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_reflect.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_security.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/tests/test_validate.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/cache.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/classify.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/connect.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/detect.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/docker.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/export.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/ingest.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/merge.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/reflect.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/report.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/security.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/skill-claw.md +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/skill.md +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/traverse.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdom/validate.py +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdomgraph.egg-info/dependency_links.txt +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdomgraph.egg-info/entry_points.txt +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdomgraph.egg-info/requires.txt +0 -0
- {wisdomgraph-0.2.0 → wisdomgraph-0.3.0}/wisdomgraph.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wisdomgraph
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Graph-native persistent cognition for AI agents using Neo4j, DIKW, and MCP
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/cklam12345/wisdomGraph
|
|
7
7
|
Project-URL: Repository, https://github.com/cklam12345/wisdomGraph
|
|
8
8
|
Project-URL: Issues, https://github.com/cklam12345/wisdomGraph/issues
|
|
9
|
-
Keywords: claude,claude-code,openclaw,neo4j,knowledge-graph,graphrag,dikw,wisdom,memory,accumulative,llm,skill,agent-memory,dozerdb,mcp,model-context-protocol
|
|
9
|
+
Keywords: claude,claude-code,openclaw,neo4j,knowledge-graph,graphrag,dikw,wisdom,memory,accumulative,llm,skill,agent-memory,agentic-memory,multi-agent,dozerdb,mcp,model-context-protocol,codex
|
|
10
10
|
Requires-Python: >=3.10
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
@@ -76,11 +76,14 @@ Dynamic: license-file
|
|
|
76
76
|
[](LICENSE)
|
|
77
77
|
[](https://neo4j.com)
|
|
78
78
|
[](https://claude.ai/code)
|
|
79
|
+
[](https://openai.com/codex)
|
|
79
80
|
[](https://openclaw.ai)
|
|
80
81
|
|
|
82
|
+
> **Graph-native persistent cognition for AI agents.**
|
|
83
|
+
>
|
|
81
84
|
> **graphify gives you a snapshot. wisdomGraph gives you memory that compounds.**
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
Use wisdomGraph from Claude Code, Codex, OpenClaw, or any MCP host. Feed it your codebases, notes, papers, conversations — every run **merges** into a living Neo4j graph. The graph doesn't reset. It accumulates. Facts become patterns. Patterns become insights. Insights become wisdom.
|
|
84
87
|
|
|
85
88
|
```
|
|
86
89
|
/wisdom . # absorb this project into the wisdom graph
|
|
@@ -133,15 +136,51 @@ The feedback loop is critical: when a Wisdom node is queried and found useful, i
|
|
|
133
136
|
|
|
134
137
|
## Install
|
|
135
138
|
|
|
136
|
-
**Requires:** Python 3.10+ and one of: [Claude Code](https://claude.ai/code), [OpenClaw](https://openclaw.ai)
|
|
139
|
+
**Requires:** Python 3.10+ and one of: [Claude Code](https://claude.ai/code), [Codex](https://openai.com/codex), [OpenClaw](https://openclaw.ai), or another MCP host
|
|
137
140
|
|
|
138
141
|
**And one of:** [Neo4j Aura Free](https://neo4j.com/cloud/platform/aura-graph-database/) (cloud, no install) or [DozerDB](https://dozerdb.org) (local Docker, APOC included)
|
|
139
142
|
|
|
140
143
|
```bash
|
|
141
|
-
pip install 'wisdomgraph[mcp]'
|
|
144
|
+
pip install 'wisdomgraph[mcp]'
|
|
145
|
+
wisdom quickstart
|
|
142
146
|
```
|
|
143
147
|
|
|
144
|
-
|
|
148
|
+
`wisdom quickstart` is the end-to-end first-time setup. It prepares storage, verifies the Neo4j connection, and registers wisdomGraph with detected MCP hosts.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Local managed Neo4j/DozerDB backend + detected MCP hosts
|
|
152
|
+
wisdom quickstart
|
|
153
|
+
|
|
154
|
+
# Local backend + Codex only
|
|
155
|
+
wisdom quickstart --host codex
|
|
156
|
+
|
|
157
|
+
# Existing Neo4j or DozerDB instance
|
|
158
|
+
wisdom quickstart --storage existing --uri bolt://localhost:7689 --user neo4j --password <password>
|
|
159
|
+
|
|
160
|
+
# Neo4j Aura
|
|
161
|
+
wisdom quickstart --storage aura --uri bolt+s://xxxxxxxx.databases.neo4j.io --user neo4j --password <password>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The MCP server itself never starts Docker or creates databases. Storage setup is explicit through `quickstart`, `local`, `docker`, or `connect`.
|
|
165
|
+
|
|
166
|
+
### Option A — Managed local backend (recommended first run)
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
wisdom local up
|
|
170
|
+
wisdom doctor
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
This starts a managed DozerDB/Neo4j container named `wisdomgraph-neo4j`, stores data under `~/.wisdom/neo4j`, generates a local password, saves the connection, and leaves MCP startup cleanly separate.
|
|
174
|
+
|
|
175
|
+
Useful commands:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
wisdom local status
|
|
179
|
+
wisdom local logs
|
|
180
|
+
wisdom local down
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Option B — Neo4j Aura (zero local database)
|
|
145
184
|
|
|
146
185
|
1. Create a free account at [neo4j.com/cloud/aura](https://neo4j.com/cloud/aura)
|
|
147
186
|
2. Create a free AuraDB instance — copy the connection URI and password
|
|
@@ -153,7 +192,7 @@ wisdom connect bolt+s://xxxxxxxx.databases.neo4j.io --user neo4j --password <you
|
|
|
153
192
|
|
|
154
193
|
Free tier: 200,000 nodes. Enough for years of accumulated wisdom.
|
|
155
194
|
|
|
156
|
-
### Option
|
|
195
|
+
### Option C — Legacy/manual DozerDB Docker (full control, APOC included)
|
|
157
196
|
|
|
158
197
|
```bash
|
|
159
198
|
wisdom docker up # pulls graphstack/dozerdb:5.26.3.0 and starts it
|
|
@@ -181,6 +220,8 @@ Open [localhost:7474](http://localhost:7474) — Neo4j Browser is your visual wi
|
|
|
181
220
|
| Platform | Install command |
|
|
182
221
|
|----------|----------------|
|
|
183
222
|
| Claude Code (Linux/Mac) | `wisdom install` |
|
|
223
|
+
| Claude Code MCP | `wisdom mcp-install` |
|
|
224
|
+
| Codex MCP | `wisdom mcp-install --host codex` |
|
|
184
225
|
| Claude Code (Windows) | `wisdom install --platform windows` |
|
|
185
226
|
| OpenClaw | `wisdom install --platform claw` |
|
|
186
227
|
|
|
@@ -192,11 +233,11 @@ Then open your AI coding assistant and type:
|
|
|
192
233
|
|
|
193
234
|
---
|
|
194
235
|
|
|
195
|
-
##
|
|
236
|
+
## MCP integration (v0.2.0+)
|
|
196
237
|
|
|
197
|
-
wisdomGraph ships as a native **Model Context Protocol (MCP) server
|
|
238
|
+
wisdomGraph ships as a native **Model Context Protocol (MCP) server**. Once registered, Claude, Codex, or another MCP host can call wisdomGraph tools directly — no `/wisdom` slash command needed.
|
|
198
239
|
|
|
199
|
-
###
|
|
240
|
+
### Claude Code setup
|
|
200
241
|
|
|
201
242
|
```bash
|
|
202
243
|
wisdom mcp-install
|
|
@@ -215,14 +256,33 @@ This writes the MCP server entry to `.claude/settings.json` in your current proj
|
|
|
215
256
|
}
|
|
216
257
|
```
|
|
217
258
|
|
|
218
|
-
Restart Claude Code. wisdomGraph is now live in
|
|
259
|
+
Restart Claude Code. wisdomGraph is now live in that project.
|
|
260
|
+
|
|
261
|
+
### Codex setup (v0.3.0+)
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
wisdom mcp-install --host codex
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
This runs the Codex MCP registration:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
codex mcp add wisdomGraph -- wisdom mcp
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Start a new Codex session. Codex can now launch `wisdom mcp` and use the same Neo4j-backed DIKW graph as Claude Code.
|
|
219
274
|
|
|
220
275
|
### MCP tools
|
|
221
276
|
|
|
222
|
-
| Tool | What
|
|
277
|
+
| Tool | What agents use it for |
|
|
223
278
|
|---|---|
|
|
224
279
|
| `wisdom_ingest` | Absorb a file, directory, or URL into Neo4j |
|
|
225
280
|
| `wisdom_remember` | Store a fact, decision, or insight explicitly |
|
|
281
|
+
| `wisdom_learn` | Record an attempt, outcome, and lesson learned |
|
|
282
|
+
| `wisdom_status` | Read DIKW tier counts and edge/source totals |
|
|
283
|
+
| `wisdom_list` | List nodes by DIKW tier, project, and connectivity |
|
|
284
|
+
| `wisdom_trace` | Trace why an insight or wisdom node exists |
|
|
285
|
+
| `wisdom_explain` | Explain a node with its DIKW chain and sources |
|
|
226
286
|
| `wisdom_query` | Run a read-only Cypher traversal |
|
|
227
287
|
| `wisdom_reflect` | Trigger DIKW promotion pipeline |
|
|
228
288
|
| `wisdom_report` | Get tier counts + top Wisdom nodes as markdown |
|
|
@@ -246,6 +306,9 @@ wisdom mcp-install
|
|
|
246
306
|
|
|
247
307
|
# Register globally (all projects on this machine)
|
|
248
308
|
wisdom mcp-install --project ~
|
|
309
|
+
|
|
310
|
+
# Register globally with Codex
|
|
311
|
+
wisdom mcp-install --host codex
|
|
249
312
|
```
|
|
250
313
|
|
|
251
314
|
---
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://neo4j.com)
|
|
8
8
|
[](https://claude.ai/code)
|
|
9
|
+
[](https://openai.com/codex)
|
|
9
10
|
[](https://openclaw.ai)
|
|
10
11
|
|
|
12
|
+
> **Graph-native persistent cognition for AI agents.**
|
|
13
|
+
>
|
|
11
14
|
> **graphify gives you a snapshot. wisdomGraph gives you memory that compounds.**
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Use wisdomGraph from Claude Code, Codex, OpenClaw, or any MCP host. Feed it your codebases, notes, papers, conversations — every run **merges** into a living Neo4j graph. The graph doesn't reset. It accumulates. Facts become patterns. Patterns become insights. Insights become wisdom.
|
|
14
17
|
|
|
15
18
|
```
|
|
16
19
|
/wisdom . # absorb this project into the wisdom graph
|
|
@@ -63,15 +66,51 @@ The feedback loop is critical: when a Wisdom node is queried and found useful, i
|
|
|
63
66
|
|
|
64
67
|
## Install
|
|
65
68
|
|
|
66
|
-
**Requires:** Python 3.10+ and one of: [Claude Code](https://claude.ai/code), [OpenClaw](https://openclaw.ai)
|
|
69
|
+
**Requires:** Python 3.10+ and one of: [Claude Code](https://claude.ai/code), [Codex](https://openai.com/codex), [OpenClaw](https://openclaw.ai), or another MCP host
|
|
67
70
|
|
|
68
71
|
**And one of:** [Neo4j Aura Free](https://neo4j.com/cloud/platform/aura-graph-database/) (cloud, no install) or [DozerDB](https://dozerdb.org) (local Docker, APOC included)
|
|
69
72
|
|
|
70
73
|
```bash
|
|
71
|
-
pip install 'wisdomgraph[mcp]'
|
|
74
|
+
pip install 'wisdomgraph[mcp]'
|
|
75
|
+
wisdom quickstart
|
|
72
76
|
```
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
`wisdom quickstart` is the end-to-end first-time setup. It prepares storage, verifies the Neo4j connection, and registers wisdomGraph with detected MCP hosts.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Local managed Neo4j/DozerDB backend + detected MCP hosts
|
|
82
|
+
wisdom quickstart
|
|
83
|
+
|
|
84
|
+
# Local backend + Codex only
|
|
85
|
+
wisdom quickstart --host codex
|
|
86
|
+
|
|
87
|
+
# Existing Neo4j or DozerDB instance
|
|
88
|
+
wisdom quickstart --storage existing --uri bolt://localhost:7689 --user neo4j --password <password>
|
|
89
|
+
|
|
90
|
+
# Neo4j Aura
|
|
91
|
+
wisdom quickstart --storage aura --uri bolt+s://xxxxxxxx.databases.neo4j.io --user neo4j --password <password>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The MCP server itself never starts Docker or creates databases. Storage setup is explicit through `quickstart`, `local`, `docker`, or `connect`.
|
|
95
|
+
|
|
96
|
+
### Option A — Managed local backend (recommended first run)
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
wisdom local up
|
|
100
|
+
wisdom doctor
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This starts a managed DozerDB/Neo4j container named `wisdomgraph-neo4j`, stores data under `~/.wisdom/neo4j`, generates a local password, saves the connection, and leaves MCP startup cleanly separate.
|
|
104
|
+
|
|
105
|
+
Useful commands:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
wisdom local status
|
|
109
|
+
wisdom local logs
|
|
110
|
+
wisdom local down
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Option B — Neo4j Aura (zero local database)
|
|
75
114
|
|
|
76
115
|
1. Create a free account at [neo4j.com/cloud/aura](https://neo4j.com/cloud/aura)
|
|
77
116
|
2. Create a free AuraDB instance — copy the connection URI and password
|
|
@@ -83,7 +122,7 @@ wisdom connect bolt+s://xxxxxxxx.databases.neo4j.io --user neo4j --password <you
|
|
|
83
122
|
|
|
84
123
|
Free tier: 200,000 nodes. Enough for years of accumulated wisdom.
|
|
85
124
|
|
|
86
|
-
### Option
|
|
125
|
+
### Option C — Legacy/manual DozerDB Docker (full control, APOC included)
|
|
87
126
|
|
|
88
127
|
```bash
|
|
89
128
|
wisdom docker up # pulls graphstack/dozerdb:5.26.3.0 and starts it
|
|
@@ -111,6 +150,8 @@ Open [localhost:7474](http://localhost:7474) — Neo4j Browser is your visual wi
|
|
|
111
150
|
| Platform | Install command |
|
|
112
151
|
|----------|----------------|
|
|
113
152
|
| Claude Code (Linux/Mac) | `wisdom install` |
|
|
153
|
+
| Claude Code MCP | `wisdom mcp-install` |
|
|
154
|
+
| Codex MCP | `wisdom mcp-install --host codex` |
|
|
114
155
|
| Claude Code (Windows) | `wisdom install --platform windows` |
|
|
115
156
|
| OpenClaw | `wisdom install --platform claw` |
|
|
116
157
|
|
|
@@ -122,11 +163,11 @@ Then open your AI coding assistant and type:
|
|
|
122
163
|
|
|
123
164
|
---
|
|
124
165
|
|
|
125
|
-
##
|
|
166
|
+
## MCP integration (v0.2.0+)
|
|
126
167
|
|
|
127
|
-
wisdomGraph ships as a native **Model Context Protocol (MCP) server
|
|
168
|
+
wisdomGraph ships as a native **Model Context Protocol (MCP) server**. Once registered, Claude, Codex, or another MCP host can call wisdomGraph tools directly — no `/wisdom` slash command needed.
|
|
128
169
|
|
|
129
|
-
###
|
|
170
|
+
### Claude Code setup
|
|
130
171
|
|
|
131
172
|
```bash
|
|
132
173
|
wisdom mcp-install
|
|
@@ -145,14 +186,33 @@ This writes the MCP server entry to `.claude/settings.json` in your current proj
|
|
|
145
186
|
}
|
|
146
187
|
```
|
|
147
188
|
|
|
148
|
-
Restart Claude Code. wisdomGraph is now live in
|
|
189
|
+
Restart Claude Code. wisdomGraph is now live in that project.
|
|
190
|
+
|
|
191
|
+
### Codex setup (v0.3.0+)
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
wisdom mcp-install --host codex
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This runs the Codex MCP registration:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
codex mcp add wisdomGraph -- wisdom mcp
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Start a new Codex session. Codex can now launch `wisdom mcp` and use the same Neo4j-backed DIKW graph as Claude Code.
|
|
149
204
|
|
|
150
205
|
### MCP tools
|
|
151
206
|
|
|
152
|
-
| Tool | What
|
|
207
|
+
| Tool | What agents use it for |
|
|
153
208
|
|---|---|
|
|
154
209
|
| `wisdom_ingest` | Absorb a file, directory, or URL into Neo4j |
|
|
155
210
|
| `wisdom_remember` | Store a fact, decision, or insight explicitly |
|
|
211
|
+
| `wisdom_learn` | Record an attempt, outcome, and lesson learned |
|
|
212
|
+
| `wisdom_status` | Read DIKW tier counts and edge/source totals |
|
|
213
|
+
| `wisdom_list` | List nodes by DIKW tier, project, and connectivity |
|
|
214
|
+
| `wisdom_trace` | Trace why an insight or wisdom node exists |
|
|
215
|
+
| `wisdom_explain` | Explain a node with its DIKW chain and sources |
|
|
156
216
|
| `wisdom_query` | Run a read-only Cypher traversal |
|
|
157
217
|
| `wisdom_reflect` | Trigger DIKW promotion pipeline |
|
|
158
218
|
| `wisdom_report` | Get tier counts + top Wisdom nodes as markdown |
|
|
@@ -176,6 +236,9 @@ wisdom mcp-install
|
|
|
176
236
|
|
|
177
237
|
# Register globally (all projects on this machine)
|
|
178
238
|
wisdom mcp-install --project ~
|
|
239
|
+
|
|
240
|
+
# Register globally with Codex
|
|
241
|
+
wisdom mcp-install --host codex
|
|
179
242
|
```
|
|
180
243
|
|
|
181
244
|
---
|
|
@@ -4,15 +4,16 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "wisdomgraph"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Graph-native persistent cognition for AI agents using Neo4j, DIKW, and MCP"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
11
11
|
license-files = ["LICENSE"]
|
|
12
12
|
keywords = [
|
|
13
13
|
"claude", "claude-code", "openclaw", "neo4j", "knowledge-graph",
|
|
14
14
|
"graphrag", "dikw", "wisdom", "memory", "accumulative", "llm",
|
|
15
|
-
"skill", "agent-memory", "
|
|
15
|
+
"skill", "agent-memory", "agentic-memory", "multi-agent", "dozerdb",
|
|
16
|
+
"mcp", "model-context-protocol", "codex",
|
|
16
17
|
]
|
|
17
18
|
requires-python = ">=3.10"
|
|
18
19
|
dependencies = [
|
|
@@ -448,13 +448,145 @@ def test_learn_failure_defaults_to_high_confidence():
|
|
|
448
448
|
|
|
449
449
|
# ── Tool list ─────────────────────────────────────────────────────────────────
|
|
450
450
|
|
|
451
|
-
def
|
|
451
|
+
def test_status_returns_counts():
|
|
452
|
+
from wisdom.mcp import _handle_status
|
|
453
|
+
|
|
454
|
+
fake_stats = {
|
|
455
|
+
"Knowledge": 74,
|
|
456
|
+
"Experience": 16,
|
|
457
|
+
"Insight": 11,
|
|
458
|
+
"Wisdom": 6,
|
|
459
|
+
"Source": 30,
|
|
460
|
+
"edges": 215,
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
with patch("wisdom.mcp._get_driver", return_value=MagicMock()), \
|
|
464
|
+
patch("wisdom.connect.status", return_value=fake_stats):
|
|
465
|
+
result = _handle_status({})
|
|
466
|
+
|
|
467
|
+
assert not result.isError
|
|
468
|
+
text = result.content[0].text
|
|
469
|
+
assert "Knowledge" in text
|
|
470
|
+
assert "Insight" in text
|
|
471
|
+
assert "215" in text
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
def test_list_defaults_to_insight_nodes():
|
|
475
|
+
from wisdom.mcp import _handle_list
|
|
476
|
+
|
|
477
|
+
session = MagicMock()
|
|
478
|
+
session.run.return_value = iter([
|
|
479
|
+
{
|
|
480
|
+
"id": "insight:abc",
|
|
481
|
+
"label": "Agent infrastructure positioning",
|
|
482
|
+
"tier": "insight",
|
|
483
|
+
"project": "wisdomGraph",
|
|
484
|
+
"confidence": 0.95,
|
|
485
|
+
"degree": 3,
|
|
486
|
+
}
|
|
487
|
+
])
|
|
488
|
+
driver = _make_driver(session)
|
|
489
|
+
|
|
490
|
+
with patch("wisdom.mcp._get_driver", return_value=driver):
|
|
491
|
+
result = _handle_list({})
|
|
492
|
+
|
|
493
|
+
assert not result.isError
|
|
494
|
+
text = result.content[0].text
|
|
495
|
+
assert "Insight nodes" in text
|
|
496
|
+
assert "Agent infrastructure" in text
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
def test_list_rejects_invalid_tier():
|
|
500
|
+
from wisdom.mcp import _handle_list
|
|
501
|
+
result = _handle_list({"tier": "source"})
|
|
502
|
+
assert result.isError
|
|
503
|
+
assert "tier" in result.content[0].text
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
def test_trace_requires_id_or_label():
|
|
507
|
+
from wisdom.mcp import _handle_trace
|
|
508
|
+
result = _handle_trace({})
|
|
509
|
+
assert result.isError
|
|
510
|
+
assert "id" in result.content[0].text
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
def test_trace_returns_node_neighborhood():
|
|
514
|
+
from wisdom.mcp import _handle_trace
|
|
515
|
+
|
|
516
|
+
node_record = {
|
|
517
|
+
"id": "insight:abc",
|
|
518
|
+
"label": "Agent infrastructure positioning",
|
|
519
|
+
"tier": "insight",
|
|
520
|
+
"content": "Persistent cognition for agents.",
|
|
521
|
+
"principle": None,
|
|
522
|
+
"confidence": 0.95,
|
|
523
|
+
}
|
|
524
|
+
edge_record = {
|
|
525
|
+
"source": "Repo visit",
|
|
526
|
+
"relation": "REVEALS",
|
|
527
|
+
"target": "Agent infrastructure positioning",
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
session = MagicMock()
|
|
531
|
+
session.run.side_effect = [
|
|
532
|
+
SimpleNamespace(single=lambda: node_record),
|
|
533
|
+
iter([edge_record]),
|
|
534
|
+
]
|
|
535
|
+
driver = _make_driver(session)
|
|
536
|
+
|
|
537
|
+
with patch("wisdom.mcp._get_driver", return_value=driver), \
|
|
538
|
+
patch("wisdom.traverse.walk_dikw_path", return_value=[]), \
|
|
539
|
+
patch("wisdom.traverse.get_provenance", return_value=[]):
|
|
540
|
+
result = _handle_trace({"label": "Agent infrastructure"})
|
|
541
|
+
|
|
542
|
+
assert not result.isError
|
|
543
|
+
text = result.content[0].text
|
|
544
|
+
assert "Trace" in text
|
|
545
|
+
assert "Agent infrastructure positioning" in text
|
|
546
|
+
assert "REVEALS" in text
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def test_explain_requires_label():
|
|
550
|
+
from wisdom.mcp import _handle_explain
|
|
551
|
+
result = _handle_explain({})
|
|
552
|
+
assert result.isError
|
|
553
|
+
assert "label" in result.content[0].text
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
def test_explain_formats_dikw_chain():
|
|
557
|
+
from wisdom.mcp import _handle_explain
|
|
558
|
+
|
|
559
|
+
explanation = {
|
|
560
|
+
"id": "insight:abc",
|
|
561
|
+
"label": "Agent infrastructure positioning",
|
|
562
|
+
"tier": "insight",
|
|
563
|
+
"content": "Persistent cognition for agents.",
|
|
564
|
+
"confidence": 0.95,
|
|
565
|
+
"dikw_chain": [{"label": "WisdomGraph", "tier": "knowledge"}],
|
|
566
|
+
"sources": [{"uri": "README.md"}],
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
with patch("wisdom.mcp._get_driver", return_value=_make_driver()), \
|
|
570
|
+
patch("wisdom.traverse.explain_node", return_value=explanation):
|
|
571
|
+
result = _handle_explain({"label": "Agent infrastructure"})
|
|
572
|
+
|
|
573
|
+
assert not result.isError
|
|
574
|
+
text = result.content[0].text
|
|
575
|
+
assert "DIKW chain" in text
|
|
576
|
+
assert "README.md" in text
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
def test_tool_list_has_ten_tools():
|
|
452
580
|
from wisdom.mcp import _TOOL_DEFS
|
|
453
581
|
names = {t["name"] for t in _TOOL_DEFS}
|
|
454
582
|
assert names == {
|
|
455
583
|
"wisdom_ingest",
|
|
456
584
|
"wisdom_remember",
|
|
457
585
|
"wisdom_learn",
|
|
586
|
+
"wisdom_status",
|
|
587
|
+
"wisdom_list",
|
|
588
|
+
"wisdom_trace",
|
|
589
|
+
"wisdom_explain",
|
|
458
590
|
"wisdom_query",
|
|
459
591
|
"wisdom_reflect",
|
|
460
592
|
"wisdom_report",
|
|
@@ -482,7 +614,7 @@ def test_mcp_install_writes_settings(tmp_path):
|
|
|
482
614
|
import sys
|
|
483
615
|
from wisdom.__main__ import _install_mcp
|
|
484
616
|
|
|
485
|
-
_install_mcp(project_dir=tmp_path)
|
|
617
|
+
_install_mcp(project_dir=tmp_path, host="claude")
|
|
486
618
|
|
|
487
619
|
settings_path = tmp_path / ".claude" / "settings.json"
|
|
488
620
|
assert settings_path.exists()
|
|
@@ -499,10 +631,107 @@ def test_mcp_install_idempotent(tmp_path):
|
|
|
499
631
|
import json
|
|
500
632
|
from wisdom.__main__ import _install_mcp
|
|
501
633
|
|
|
502
|
-
_install_mcp(project_dir=tmp_path)
|
|
503
|
-
_install_mcp(project_dir=tmp_path)
|
|
634
|
+
_install_mcp(project_dir=tmp_path, host="claude")
|
|
635
|
+
_install_mcp(project_dir=tmp_path, host="claude")
|
|
504
636
|
|
|
505
637
|
settings_path = tmp_path / ".claude" / "settings.json"
|
|
506
638
|
settings = json.loads(settings_path.read_text())
|
|
507
639
|
# Should still be a single entry, not a list
|
|
508
640
|
assert isinstance(settings["mcpServers"]["wisdomGraph"], dict)
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
def test_mcp_install_codex_noops_when_existing():
|
|
644
|
+
from wisdom.__main__ import _install_mcp
|
|
645
|
+
|
|
646
|
+
completed = SimpleNamespace(returncode=0, stdout="", stderr="")
|
|
647
|
+
with patch("shutil.which", return_value="/usr/bin/codex"), \
|
|
648
|
+
patch("subprocess.run", return_value=completed) as run:
|
|
649
|
+
_install_mcp(host="codex")
|
|
650
|
+
|
|
651
|
+
run.assert_called_once_with(
|
|
652
|
+
["codex", "mcp", "get", "wisdomGraph"],
|
|
653
|
+
stdout=-3,
|
|
654
|
+
stderr=-3,
|
|
655
|
+
check=False,
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
def test_mcp_install_rejects_unknown_host():
|
|
660
|
+
from wisdom.__main__ import _install_mcp
|
|
661
|
+
|
|
662
|
+
with pytest.raises(SystemExit):
|
|
663
|
+
_install_mcp(host="unknown")
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
# ── local backend / quickstart CLI ────────────────────────────────────────────
|
|
667
|
+
|
|
668
|
+
def test_local_up_starts_managed_backend_without_existing_container(tmp_path, monkeypatch):
|
|
669
|
+
import wisdom.local as local
|
|
670
|
+
|
|
671
|
+
calls = []
|
|
672
|
+
|
|
673
|
+
def fake_run(cmd, capture=False):
|
|
674
|
+
calls.append(cmd)
|
|
675
|
+
if cmd[:2] == ["docker", "info"]:
|
|
676
|
+
return SimpleNamespace(returncode=0, stdout="", stderr="")
|
|
677
|
+
if cmd[:3] == ["docker", "ps", "-q"]:
|
|
678
|
+
return SimpleNamespace(returncode=0, stdout="", stderr="")
|
|
679
|
+
if cmd[:3] == ["docker", "ps", "-aq"]:
|
|
680
|
+
return SimpleNamespace(returncode=0, stdout="", stderr="")
|
|
681
|
+
return SimpleNamespace(returncode=0, stdout="ok", stderr="")
|
|
682
|
+
|
|
683
|
+
monkeypatch.setattr(local, "BASE_DIR", tmp_path / "neo4j")
|
|
684
|
+
monkeypatch.setattr(local, "PASSWORD_PATH", tmp_path / "local-password")
|
|
685
|
+
|
|
686
|
+
with patch("wisdom.local.shutil.which", return_value="/usr/bin/docker"), \
|
|
687
|
+
patch("wisdom.local._run", side_effect=fake_run), \
|
|
688
|
+
patch("wisdom.local._wait_for_port", return_value=True), \
|
|
689
|
+
patch("wisdom.local.save_connection") as save:
|
|
690
|
+
local.up(password="test-password")
|
|
691
|
+
|
|
692
|
+
assert any(cmd[:3] == ["docker", "run", "-d"] for cmd in calls)
|
|
693
|
+
save.assert_called_once_with(local.URI, local.USER, "test-password")
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
def test_local_up_reuses_existing_running_backend():
|
|
697
|
+
import wisdom.local as local
|
|
698
|
+
|
|
699
|
+
def fake_run(cmd, capture=False):
|
|
700
|
+
if cmd[:2] == ["docker", "info"]:
|
|
701
|
+
return SimpleNamespace(returncode=0, stdout="", stderr="")
|
|
702
|
+
if cmd[:3] == ["docker", "ps", "-q"]:
|
|
703
|
+
return SimpleNamespace(returncode=0, stdout="abc123\n", stderr="")
|
|
704
|
+
return SimpleNamespace(returncode=0, stdout="", stderr="")
|
|
705
|
+
|
|
706
|
+
with patch("wisdom.local.shutil.which", return_value="/usr/bin/docker"), \
|
|
707
|
+
patch("wisdom.local._run", side_effect=fake_run), \
|
|
708
|
+
patch("wisdom.local.save_connection") as save:
|
|
709
|
+
local.up(password="test-password")
|
|
710
|
+
|
|
711
|
+
save.assert_called_once_with(local.URI, local.USER, "test-password")
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
def test_quickstart_local_registers_requested_host(monkeypatch):
|
|
715
|
+
import sys
|
|
716
|
+
from wisdom.__main__ import _run_quickstart
|
|
717
|
+
|
|
718
|
+
monkeypatch.setattr(sys, "argv", ["wisdom", "quickstart", "--host", "codex"])
|
|
719
|
+
|
|
720
|
+
with patch("wisdom.local.up") as local_up, \
|
|
721
|
+
patch("wisdom.__main__._doctor") as doctor, \
|
|
722
|
+
patch("wisdom.__main__._install_mcp") as install_mcp:
|
|
723
|
+
_run_quickstart()
|
|
724
|
+
|
|
725
|
+
local_up.assert_called_once_with()
|
|
726
|
+
doctor.assert_called_once_with(connect_only=True)
|
|
727
|
+
install_mcp.assert_called_once_with(host="codex")
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
def test_quickstart_existing_requires_uri(monkeypatch):
|
|
731
|
+
import sys
|
|
732
|
+
from wisdom.__main__ import _run_quickstart
|
|
733
|
+
|
|
734
|
+
monkeypatch.setattr(sys, "argv", ["wisdom", "quickstart", "--storage", "existing", "--host", "none"])
|
|
735
|
+
|
|
736
|
+
with pytest.raises(SystemExit):
|
|
737
|
+
_run_quickstart()
|