@pella-labs/pinakes 0.1.0 → 0.1.2
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 +21 -0
- package/README.md +43 -50
- package/package.json +4 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pella Labs
|
|
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pella-labs/pinakes
|
|
2
2
|
|
|
3
3
|
Local stdio MCP server that indexes a [Karpathy-style](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) two-level knowledge wiki (project + personal) into SQLite and exposes it to any coding LLM via [Cloudflare-style code-mode](https://blog.cloudflare.com/code-mode-mcp/).
|
|
4
4
|
|
|
@@ -9,37 +9,14 @@ Local stdio MCP server that indexes a [Karpathy-style](https://gist.github.com/k
|
|
|
9
9
|
|
|
10
10
|
Markdown is canonical. SQLite is the index. If the index is corrupted or lost, rebuild it from markdown.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# Clone and build
|
|
16
|
-
git clone <repo-url> && cd knowledge-graph
|
|
17
|
-
pnpm install
|
|
18
|
-
pnpm run build
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Requires **Node.js 24 LTS** (`^24.10.0`) and **pnpm** (`>=10.30.0`).
|
|
22
|
-
|
|
23
|
-
## Quick start
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# Initialize a wiki directory
|
|
27
|
-
mkdir -p .kg/wiki
|
|
28
|
-
echo "# My Project\nSome knowledge about the project." > .kg/wiki/overview.md
|
|
29
|
-
|
|
30
|
-
# Start the stdio server
|
|
31
|
-
pnpm run kg -- serve --wiki-path .kg/wiki
|
|
12
|
+
Requires **Node.js 24 LTS** (`^24.10.0`).
|
|
32
13
|
|
|
33
|
-
|
|
34
|
-
pnpm run kg -- rebuild --wiki-path .kg/wiki
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## MCP client configuration
|
|
14
|
+
## Install
|
|
38
15
|
|
|
39
16
|
### Claude Code
|
|
40
17
|
|
|
41
18
|
```bash
|
|
42
|
-
claude mcp add
|
|
19
|
+
claude mcp add pinakes -- npx @pella-labs/pinakes serve --wiki-path ./wiki
|
|
43
20
|
```
|
|
44
21
|
|
|
45
22
|
Or add to `.claude/settings.json`:
|
|
@@ -47,9 +24,9 @@ Or add to `.claude/settings.json`:
|
|
|
47
24
|
```json
|
|
48
25
|
{
|
|
49
26
|
"mcpServers": {
|
|
50
|
-
"
|
|
27
|
+
"pinakes": {
|
|
51
28
|
"command": "npx",
|
|
52
|
-
"args": ["
|
|
29
|
+
"args": ["@pella-labs/pinakes", "serve", "--wiki-path", "./wiki"]
|
|
53
30
|
}
|
|
54
31
|
}
|
|
55
32
|
}
|
|
@@ -61,22 +38,21 @@ Add to `~/.config/goose/profiles.yaml`:
|
|
|
61
38
|
|
|
62
39
|
```yaml
|
|
63
40
|
extensions:
|
|
64
|
-
|
|
65
|
-
name:
|
|
41
|
+
pinakes:
|
|
42
|
+
name: pinakes
|
|
66
43
|
type: stdio
|
|
67
44
|
cmd: npx
|
|
68
45
|
args:
|
|
69
|
-
-
|
|
70
|
-
- /path/to/knowledge-graph/src/cli/index.ts
|
|
46
|
+
- "@pella-labs/pinakes"
|
|
71
47
|
- serve
|
|
72
48
|
- --wiki-path
|
|
73
|
-
-
|
|
49
|
+
- ./wiki
|
|
74
50
|
```
|
|
75
51
|
|
|
76
52
|
### Codex
|
|
77
53
|
|
|
78
54
|
```bash
|
|
79
|
-
export CODEX_MCP_SERVERS='{"
|
|
55
|
+
export CODEX_MCP_SERVERS='{"pinakes":{"command":"npx","args":["@pella-labs/pinakes","serve","--wiki-path","./wiki"]}}'
|
|
80
56
|
```
|
|
81
57
|
|
|
82
58
|
### OpenCode
|
|
@@ -86,9 +62,9 @@ Add to `opencode.json`:
|
|
|
86
62
|
```json
|
|
87
63
|
{
|
|
88
64
|
"mcp": {
|
|
89
|
-
"
|
|
65
|
+
"pinakes": {
|
|
90
66
|
"command": "npx",
|
|
91
|
-
"args": ["
|
|
67
|
+
"args": ["@pella-labs/pinakes", "serve", "--wiki-path", "./wiki"]
|
|
92
68
|
}
|
|
93
69
|
}
|
|
94
70
|
}
|
|
@@ -101,14 +77,27 @@ Add to Cursor settings (Settings > MCP Servers):
|
|
|
101
77
|
```json
|
|
102
78
|
{
|
|
103
79
|
"mcpServers": {
|
|
104
|
-
"
|
|
80
|
+
"pinakes": {
|
|
105
81
|
"command": "npx",
|
|
106
|
-
"args": ["
|
|
82
|
+
"args": ["@pella-labs/pinakes", "serve", "--wiki-path", "./wiki"]
|
|
107
83
|
}
|
|
108
84
|
}
|
|
109
85
|
}
|
|
110
86
|
```
|
|
111
87
|
|
|
88
|
+
## Quick start
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Create a wiki directory in your project
|
|
92
|
+
mkdir -p wiki
|
|
93
|
+
echo "# My Project" > wiki/overview.md
|
|
94
|
+
|
|
95
|
+
# Test it directly
|
|
96
|
+
npx @pella-labs/pinakes serve --wiki-path ./wiki
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The server indexes all `.md` files in the wiki directory, watches for changes, and serves them over stdio.
|
|
100
|
+
|
|
112
101
|
## Example queries
|
|
113
102
|
|
|
114
103
|
### Search
|
|
@@ -120,6 +109,9 @@ kg_search({ query: "authentication flow", scope: "project" })
|
|
|
120
109
|
### Execute (code-mode)
|
|
121
110
|
|
|
122
111
|
```javascript
|
|
112
|
+
// Browse the wiki index
|
|
113
|
+
kg_execute({ code: `return kg.project.index()` })
|
|
114
|
+
|
|
123
115
|
// Full-text search
|
|
124
116
|
kg_execute({ code: `return kg.project.fts("bcrypt")` })
|
|
125
117
|
|
|
@@ -145,18 +137,18 @@ kg_execute({
|
|
|
145
137
|
## CLI commands
|
|
146
138
|
|
|
147
139
|
```bash
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
140
|
+
npx @pella-labs/pinakes serve --wiki-path <dir> # Start the stdio MCP server
|
|
141
|
+
npx @pella-labs/pinakes rebuild --wiki-path <dir> # Full rebuild from markdown
|
|
142
|
+
npx @pella-labs/pinakes status # Health check + row counts
|
|
143
|
+
npx @pella-labs/pinakes audit [--tail] [--n 20] # Tail the audit log
|
|
144
|
+
npx @pella-labs/pinakes purge --scope <s> --confirm # Delete a scope's DB
|
|
145
|
+
npx @pella-labs/pinakes export --scope <s> [--out f] # Dump nodes + edges as JSON
|
|
146
|
+
npx @pella-labs/pinakes import --scope <s> --in f # Restore from dump
|
|
155
147
|
```
|
|
156
148
|
|
|
157
149
|
## Embedder configuration
|
|
158
150
|
|
|
159
|
-
The default embedder is bundled (`Xenova/all-MiniLM-L6-v2`, 384 dimensions, runs locally). You can upgrade
|
|
151
|
+
The default embedder is bundled (`Xenova/all-MiniLM-L6-v2`, 384 dimensions, runs locally). You can upgrade via environment variables:
|
|
160
152
|
|
|
161
153
|
### Ollama (local, free)
|
|
162
154
|
|
|
@@ -180,13 +172,13 @@ export KG_EMBED_PROVIDER=openai
|
|
|
180
172
|
export KG_OPENAI_API_KEY=your-key-here
|
|
181
173
|
```
|
|
182
174
|
|
|
183
|
-
Changing the embedder requires a full rebuild (`
|
|
175
|
+
Changing the embedder requires a full rebuild (`pinakes rebuild`) since the vector dimensions change.
|
|
184
176
|
|
|
185
177
|
## Architecture
|
|
186
178
|
|
|
187
179
|
- **Single process**: MCP server, file watcher, SQLite writer, read pool, embedder, and QuickJS sandbox all in one Node process
|
|
188
180
|
- **Single writer, multi reader**: one writer connection + 2 reader connections per DB, WAL mode
|
|
189
|
-
- **Two-level KG**: project wiki (
|
|
181
|
+
- **Two-level KG**: project wiki (`./wiki/`) + personal wiki (`~/.kg/wiki/`), fully isolated by default
|
|
190
182
|
- **Privacy invariant**: personal KG bindings are only injected when `scope` includes `'personal'`
|
|
191
183
|
- **Budget gate**: every response stays under `max_tokens` (default 5000, hard cap 25000)
|
|
192
184
|
- **Deterministic IDs**: `sha1(scope + ':' + source_uri + ':' + section_path)` means re-indexing is idempotent
|
|
@@ -194,6 +186,7 @@ Changing the embedder requires a full rebuild (`kg rebuild`) since the vector di
|
|
|
194
186
|
## Development
|
|
195
187
|
|
|
196
188
|
```bash
|
|
189
|
+
git clone https://github.com/pella-labs/pinakes.git && cd pinakes
|
|
197
190
|
pnpm install
|
|
198
191
|
pnpm run dev # Watch mode
|
|
199
192
|
pnpm run test # Run tests (vitest)
|
|
@@ -205,4 +198,4 @@ pnpm run lint # eslint
|
|
|
205
198
|
|
|
206
199
|
## License
|
|
207
200
|
|
|
208
|
-
|
|
201
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pella-labs/pinakes",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Local stdio MCP server that indexes a Karpathy-style two-level knowledge wiki into SQLite and exposes it to a coding LLM via Cloudflare-style code-mode.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vitest": "^2.1.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
|
-
"build": "tsc",
|
|
47
|
+
"build": "tsc && chmod +x dist/cli/index.js",
|
|
48
48
|
"dev": "tsx watch src/server.ts",
|
|
49
49
|
"lint": "eslint src",
|
|
50
50
|
"typecheck": "tsc --noEmit",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"test:budget": "vitest run src/__tests__/budget --passWithNoTests",
|
|
56
56
|
"db:migrate": "drizzle-kit migrate",
|
|
57
57
|
"db:generate": "drizzle-kit generate",
|
|
58
|
-
"kg": "tsx src/cli/index.ts"
|
|
58
|
+
"kg": "tsx src/cli/index.ts",
|
|
59
|
+
"publish:npm": "pnpm publish --access public"
|
|
59
60
|
}
|
|
60
61
|
}
|