@dtoolkit/dbrain 0.2.1 → 0.2.3
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 +26 -89
- package/package.json +11 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Iván Campillo
|
|
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,33 +1,34 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="logo.png" alt="dbrain"
|
|
2
|
+
<img src="logo.png" alt="dbrain" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
+
<h1 align="center">@dtoolkit/dbrain</h1>
|
|
6
|
+
<p align="center">Your distributed mind. Persistent knowledge across all your AIs.</p>
|
|
7
|
+
|
|
5
8
|
<p align="center">
|
|
6
|
-
<a href="https://www.npmjs.com/package/dbrain"><img src="https://img.shields.io/npm/v/dbrain
|
|
7
|
-
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg
|
|
8
|
-
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-green?style=for-the-badge" alt="Node"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@dtoolkit/dbrain"><img src="https://img.shields.io/npm/v/@dtoolkit/dbrain.svg" alt="npm"></a>
|
|
10
|
+
<a href="../../LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
|
|
9
11
|
</p>
|
|
10
12
|
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
Every AI conversation starts from zero. Switch machines, switch apps, and your AI forgets everything. **dbrain** fixes that.
|
|
14
|
-
|
|
15
13
|
Install it once, connect every AI you use — Claude Code at home, Claude Code at work, Gemini on your phone. All share the same identity, the same memories, the same knowledge.
|
|
16
14
|
|
|
17
15
|
```
|
|
18
16
|
[Home] Claude Code ──MCP──┐
|
|
19
17
|
[Work] Claude Code ──MCP──┤ ┌─────────────────────────────────┐
|
|
20
18
|
[Mobile] Gemini ──REST──────┼────→│ dbrain (your mind) │
|
|
21
|
-
[Server] OpenClaw ──REST────┤ │ identity + memory + knowledge
|
|
19
|
+
[Server] OpenClaw ──REST────┤ │ identity + memory + knowledge │
|
|
22
20
|
[Other] Custom AI ──API────┘ └─────────────────────────────────┘
|
|
23
21
|
```
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g @dtoolkit/dbrain
|
|
27
|
+
```
|
|
26
28
|
|
|
27
|
-
## Quick
|
|
29
|
+
## Quick start
|
|
28
30
|
|
|
29
31
|
```bash
|
|
30
|
-
npm install -g dbrain
|
|
31
32
|
dbrain init # interactive wizard — creates DB, config, identity
|
|
32
33
|
dbrain start # starts API on :7878 + dashboard on :7879
|
|
33
34
|
```
|
|
@@ -38,46 +39,9 @@ Then connect Claude Code from any machine:
|
|
|
38
39
|
dbrain connect claude
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
The wizard asks for the brain URL and token (shown during `init`):
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
┌ dbrain — Connect to a brain
|
|
45
|
-
│
|
|
46
|
-
◇ Brain URL
|
|
47
|
-
│ http://localhost:7878
|
|
48
|
-
│
|
|
49
|
-
◇ Access token
|
|
50
|
-
│ sk-dbr_...
|
|
51
|
-
│
|
|
52
|
-
◇ Brain found
|
|
53
|
-
│
|
|
54
|
-
● Brain: dBrain — 2 entities, 0 facts
|
|
55
|
-
│
|
|
56
|
-
◇ Claude Code configured
|
|
57
|
-
│
|
|
58
|
-
◇ Files updated ──────────────────────────────────────────────╮
|
|
59
|
-
│ │
|
|
60
|
-
│ ~/.claude.json MCP server registered │
|
|
61
|
-
│ ~/.claude/settings.json Permissions granted │
|
|
62
|
-
│ ~/.claude/CLAUDE.md Behavioral instructions installed │
|
|
63
|
-
│ │
|
|
64
|
-
├──────────────────────────────────────────────────────────────╯
|
|
65
|
-
│
|
|
66
|
-
└ Connected. Restart Claude Code to activate.
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Restart Claude Code and it will start using the brain. You can also skip the wizard:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
dbrain connect claude http://your-server:7878 --token=sk-dbr_...
|
|
73
|
-
```
|
|
74
|
-
|
|
75
42
|
## Docker
|
|
76
43
|
|
|
77
44
|
```bash
|
|
78
|
-
git clone https://github.com/ivncmp/dbrain.git
|
|
79
|
-
cd dbrain
|
|
80
|
-
cp .env.example .env # edit token, names, port
|
|
81
45
|
docker compose up -d
|
|
82
46
|
```
|
|
83
47
|
|
|
@@ -87,7 +51,7 @@ Then from any client machine:
|
|
|
87
51
|
dbrain connect claude http://your-server:7878
|
|
88
52
|
```
|
|
89
53
|
|
|
90
|
-
## How
|
|
54
|
+
## How it works
|
|
91
55
|
|
|
92
56
|
The brain has 4 layers:
|
|
93
57
|
|
|
@@ -98,7 +62,7 @@ The brain has 4 layers:
|
|
|
98
62
|
| **Knowledge** | Structured facts organized by PARA | `entities` + `facts` tables with hot/warm/cold tiers |
|
|
99
63
|
| **Recall** | Full-text search over all facts | FTS5 with OR logic for multi-language queries |
|
|
100
64
|
|
|
101
|
-
### Memory
|
|
65
|
+
### Memory tiers
|
|
102
66
|
|
|
103
67
|
Memories fade if you don't use them — like a real brain.
|
|
104
68
|
|
|
@@ -108,11 +72,7 @@ Memories fade if you don't use them — like a real brain.
|
|
|
108
72
|
| **warm** | 8–30 days since last access |
|
|
109
73
|
| **cold** | > 30 days — fading, candidate for archival |
|
|
110
74
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
## MCP Tools
|
|
114
|
-
|
|
115
|
-
Available to any MCP client (Claude Code, etc.):
|
|
75
|
+
## MCP tools
|
|
116
76
|
|
|
117
77
|
| Tool | Purpose |
|
|
118
78
|
| --------------- | ------------------------------------------- |
|
|
@@ -142,20 +102,18 @@ All endpoints require `Authorization: Bearer <token>` except `/health`.
|
|
|
142
102
|
| `POST` | `/search` | Full-text search over all facts |
|
|
143
103
|
| `GET` | `/memory/summary` | Overview: entities x tiers |
|
|
144
104
|
|
|
145
|
-
## CLI
|
|
146
|
-
|
|
147
|
-
| Command | Where | Purpose |
|
|
148
|
-
| ---------------------- | ------ | ----------------------------------------- |
|
|
149
|
-
| `dbrain init [path]` | Server | Create a new brain (DB, config, identity) |
|
|
150
|
-
| `dbrain start [path]` | Server | Start the API server + dashboard |
|
|
151
|
-
| `dbrain connect <client> [url]` | Client | Connect a client to a running brain |
|
|
152
|
-
| `dbrain status [path]` | Server | Check brain status |
|
|
105
|
+
## CLI commands
|
|
153
106
|
|
|
154
|
-
|
|
107
|
+
| Command | Where | Purpose |
|
|
108
|
+
| -------------------------------- | ------ | ----------------------------------------- |
|
|
109
|
+
| `dbrain init [path]` | Server | Create a new brain (DB, config, identity) |
|
|
110
|
+
| `dbrain start [path]` | Server | Start the API server + dashboard |
|
|
111
|
+
| `dbrain connect <client> [url]` | Client | Connect a client to a running brain |
|
|
112
|
+
| `dbrain status [path]` | Server | Check brain status |
|
|
155
113
|
|
|
156
114
|
## Dashboard
|
|
157
115
|
|
|
158
|
-
Web dashboard on port `7879`. Shows brain stats, entities with PARA categories, fact tiers, conversations, and full-text search.
|
|
116
|
+
Web dashboard on port `7879`. Shows brain stats, entities with PARA categories, fact tiers, conversations, and full-text search.
|
|
159
117
|
|
|
160
118
|
## Stack
|
|
161
119
|
|
|
@@ -169,28 +127,7 @@ Web dashboard on port `7879`. Shows brain stats, entities with PARA categories,
|
|
|
169
127
|
| CLI | @clack/prompts |
|
|
170
128
|
| Dashboard | React 18 (CDN, no build step) |
|
|
171
129
|
|
|
172
|
-
##
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
git clone https://github.com/ivncmp/dbrain.git
|
|
176
|
-
cd dbrain
|
|
177
|
-
npm install # installs deps + builds (prepare script)
|
|
178
|
-
npx dbrain init # create a brain (only needed once)
|
|
179
|
-
npm run dev # starts the server with file watching
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
| Script | What it does |
|
|
183
|
-
| -------------------- | ---------------------------------------- |
|
|
184
|
-
| `npm run dev` | Dev server with file watching (tsx) |
|
|
185
|
-
| `npm run build` | Compile TypeScript + copy dashboard HTML |
|
|
186
|
-
| `npm start` | Start the compiled server from `dist/` |
|
|
187
|
-
| `npm test` | Run tests with vitest |
|
|
188
|
-
| `npm run lint` | ESLint check |
|
|
189
|
-
| `npm run lint:fix` | ESLint auto-fix |
|
|
190
|
-
| `npm run format` | Prettier format |
|
|
191
|
-
| `npm run check` | Lint + format + build (full pipeline) |
|
|
192
|
-
|
|
193
|
-
## Environment Variables
|
|
130
|
+
## Environment variables
|
|
194
131
|
|
|
195
132
|
For non-interactive setup (Docker, CI):
|
|
196
133
|
|
|
@@ -206,4 +143,4 @@ For non-interactive setup (Docker, CI):
|
|
|
206
143
|
|
|
207
144
|
## License
|
|
208
145
|
|
|
209
|
-
[MIT](LICENSE)
|
|
146
|
+
[MIT](../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtoolkit/dbrain",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Your distributed mind. Persistent knowledge across all your AIs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
"llm",
|
|
34
34
|
"sqlite"
|
|
35
35
|
],
|
|
36
|
-
"scripts": {
|
|
37
|
-
"dev": "tsx watch src/cli/index.ts start",
|
|
38
|
-
"cli": "tsx src/cli/index.ts",
|
|
39
|
-
"build": "tsc && cp src/dashboard/index.html src/dashboard/logo*.png dist/dashboard/ && rm -rf dist/dashboard/icons && cp -r src/dashboard/icons dist/dashboard/icons && chmod +x dist/cli/index.js",
|
|
40
|
-
"start": "node dist/cli/index.js start",
|
|
41
|
-
"test": "vitest run --passWithNoTests"
|
|
42
|
-
},
|
|
43
36
|
"dependencies": {
|
|
44
|
-
"@dtoolkit/core": "workspace:*",
|
|
45
37
|
"@clack/prompts": "^1.3.0",
|
|
46
38
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
47
39
|
"better-sqlite3": "^12.9.0",
|
|
48
40
|
"dotenv": "^17.4.2",
|
|
49
41
|
"fastify": "^5.8.5",
|
|
50
42
|
"picocolors": "^1.1.1",
|
|
51
|
-
"zod": "^4.4.2"
|
|
43
|
+
"zod": "^4.4.2",
|
|
44
|
+
"@dtoolkit/core": "0.1.0"
|
|
52
45
|
},
|
|
53
46
|
"devDependencies": {
|
|
54
47
|
"@types/better-sqlite3": "^7.6.13",
|
|
55
48
|
"@types/node": "^25.6.0",
|
|
56
49
|
"tsx": "^4.21.0",
|
|
57
50
|
"vitest": "^4.1.5"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"dev": "tsx watch src/cli/index.ts start",
|
|
54
|
+
"cli": "tsx src/cli/index.ts",
|
|
55
|
+
"build": "tsc && cp src/dashboard/index.html src/dashboard/logo*.png dist/dashboard/ && rm -rf dist/dashboard/icons && cp -r src/dashboard/icons dist/dashboard/icons && chmod +x dist/cli/index.js",
|
|
56
|
+
"start": "node dist/cli/index.js start",
|
|
57
|
+
"test": "vitest run --passWithNoTests"
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
}
|