@nano-step/nano-brain 2026.6.402 → 2026.6.404
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/README.md +124 -42
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,26 @@
|
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://github.com/nano-step/nano-brain)
|
|
8
8
|
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [What It Does](#what-it-does)
|
|
12
|
+
- [Use Cases](#use-cases)
|
|
13
|
+
- [Key Features](#key-features)
|
|
14
|
+
- [Prerequisites](#prerequisites)
|
|
15
|
+
- [Quick Start](#quick-start)
|
|
16
|
+
- [Verifying Downloads](#verifying-downloads)
|
|
17
|
+
- [Configuration](#configuration)
|
|
18
|
+
- [REST API](#rest-api)
|
|
19
|
+
- [CLI Commands](#cli-commands)
|
|
20
|
+
- [MCP Tools](#mcp-tools)
|
|
21
|
+
- [Search Pipeline](#search-pipeline)
|
|
22
|
+
- [Architecture](#architecture)
|
|
23
|
+
- [Migration from V1](#migration-from-v1)
|
|
24
|
+
- [Tech Stack](#tech-stack)
|
|
25
|
+
- [License](#license)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
9
29
|
## What It Does
|
|
10
30
|
|
|
11
31
|
nano-brain is a persistent memory server for AI coding agents that solves session amnesia. It automatically ingests AI sessions, notes, and codebase files, indexes everything with hybrid search (BM25 + pgvector), and serves memories via MCP tools and REST API. Built in Go with PostgreSQL — single static binary, zero CGO dependencies.
|
|
@@ -32,6 +52,33 @@ nano-brain builds a symbol graph of your codebase: functions, types, dependencie
|
|
|
32
52
|
### Notes and documentation search
|
|
33
53
|
Write structured notes, ADRs, or decision records into nano-brain. Hybrid search (BM25 + semantic) retrieves them by keyword or concept. Agents can surface the right context without you having to remember where you put it.
|
|
34
54
|
|
|
55
|
+
### Team knowledge base (no per-member setup)
|
|
56
|
+
Deploy one nano-brain server for the whole team. Every developer's AI agent connects to the same PostgreSQL instance — decisions, architecture notes, code intelligence, and session learnings are instantly shared across the team. New team members get full project context from day one without any setup on their machine.
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Dev A (office) ──┐
|
|
60
|
+
Dev B (remote) ──┼──► nano-brain on team server ──► shared PostgreSQL
|
|
61
|
+
Dev C (new hire) ──┘
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Role-based access: admins get full read/write, developers get read/write scoped to their workspace, stakeholders or reviewers get read-only access.
|
|
65
|
+
|
|
66
|
+
### Knowledge preservation when an engineer leaves
|
|
67
|
+
A senior engineer resigns. Without nano-brain, their institutional knowledge — why certain decisions were made, which parts of the codebase are fragile, what was tried and failed — walks out the door with them.
|
|
68
|
+
|
|
69
|
+
With nano-brain, their sessions are already harvested and indexed. The team can still ask "why did we pick this approach?" or "what did Alice know about the payment service?" and get answers from her past sessions.
|
|
70
|
+
|
|
71
|
+
### Freelancer / consultant context switching
|
|
72
|
+
You work on 3 client projects in parallel. Each is a separate workspace. When you switch clients, run `nano-brain wake-up` to get an instant briefing — recent work, active collections, key context — and your AI agent picks up exactly where you left off without re-reading the codebase.
|
|
73
|
+
|
|
74
|
+
### Legacy codebase archaeology
|
|
75
|
+
You inherit a 5-year-old codebase with minimal documentation and no original authors to ask. Index it into nano-brain. Your AI agent can now answer "what does this function do?", "why does this class exist?", and "if I change this file, what else breaks?" — navigating cross-file relationships without reading 200k lines manually.
|
|
76
|
+
|
|
77
|
+
Go, TypeScript, Python, JavaScript supported today. Rust, Java, and others planned.
|
|
78
|
+
|
|
79
|
+
### Pre-commit / pre-PR impact check
|
|
80
|
+
Before pushing, run `memory_impact` on your changed files to discover what else in the codebase depends on them — across files, across repos in the same workspace. Catch breaking changes before they hit CI. *(Multi-file diff-aware mode in roadmap.)*
|
|
81
|
+
|
|
35
82
|
## Key Features
|
|
36
83
|
|
|
37
84
|
- **Hybrid search** — BM25 full-text + pgvector HNSW cosine similarity + RRF fusion + recency decay
|
|
@@ -54,70 +101,105 @@ Write structured notes, ADRs, or decision records into nano-brain. Hybrid search
|
|
|
54
101
|
|
|
55
102
|
## Quick Start
|
|
56
103
|
|
|
57
|
-
|
|
104
|
+
> **Let your AI agent set this up for you.** See [SETUP_AGENT.md](docs/SETUP_AGENT.md) — a step-by-step guide your agent can follow to install, configure, and verify nano-brain, checking for missing dependencies and asking before installing anything.
|
|
58
105
|
|
|
59
|
-
|
|
106
|
+
---
|
|
60
107
|
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
"mcp": {
|
|
64
|
-
"nano-brain": {
|
|
65
|
-
"type": "remote",
|
|
66
|
-
"url": "http://localhost:3100/mcp"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
108
|
+
### Path 1 — Local machine (Ollama + Docker, ~5 min)
|
|
71
109
|
|
|
72
|
-
|
|
110
|
+
The fastest way to get started on a single machine.
|
|
111
|
+
|
|
112
|
+
**Prerequisites:** [Docker](https://docs.docker.com/get-docker/), [Ollama](https://ollama.com/download), Node.js 18+
|
|
73
113
|
|
|
74
114
|
```bash
|
|
115
|
+
# 1. Install nano-brain
|
|
75
116
|
npm install -g @nano-step/nano-brain
|
|
76
117
|
|
|
77
|
-
# Start PostgreSQL + pgvector
|
|
118
|
+
# 2. Start PostgreSQL + pgvector
|
|
78
119
|
docker run -d --name nanobrain-pg -p 5432:5432 \
|
|
79
120
|
-e POSTGRES_USER=nanobrain -e POSTGRES_PASSWORD=nanobrain -e POSTGRES_DB=nanobrain_dev \
|
|
80
121
|
pgvector/pgvector:pg17
|
|
81
122
|
|
|
82
|
-
#
|
|
123
|
+
# 3. Pull embedding model
|
|
83
124
|
ollama pull nomic-embed-text
|
|
84
125
|
|
|
85
|
-
#
|
|
126
|
+
# 4. Verify everything is in order
|
|
86
127
|
nano-brain doctor
|
|
87
128
|
|
|
88
|
-
# Start server
|
|
129
|
+
# 5. Start the server (background)
|
|
89
130
|
nano-brain serve -d
|
|
131
|
+
|
|
132
|
+
# 6. Register your project
|
|
133
|
+
nano-brain init --root=/path/to/your/project
|
|
90
134
|
```
|
|
91
135
|
|
|
92
|
-
|
|
136
|
+
**Add to your MCP client** (Claude Code, OpenCode, Cursor, etc.):
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"mcp": {
|
|
140
|
+
"nano-brain": {
|
|
141
|
+
"type": "http",
|
|
142
|
+
"url": "http://localhost:3100/mcp"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Your AI agent now has persistent memory. It will automatically index your project files and harvest sessions as you work.
|
|
93
149
|
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### Path 2 — VPS / team server (shared memory across machines)
|
|
153
|
+
|
|
154
|
+
Deploy once, connect from any machine. The whole team shares the same knowledge base.
|
|
155
|
+
|
|
156
|
+
**On the server:**
|
|
94
157
|
```bash
|
|
95
|
-
# Start PostgreSQL + pgvector
|
|
158
|
+
# 1. Start PostgreSQL + pgvector
|
|
96
159
|
docker run -d --name nanobrain-pg -p 5432:5432 \
|
|
97
160
|
-e POSTGRES_USER=nanobrain -e POSTGRES_PASSWORD=nanobrain -e POSTGRES_DB=nanobrain_dev \
|
|
98
161
|
pgvector/pgvector:pg17
|
|
99
162
|
|
|
100
|
-
#
|
|
101
|
-
|
|
163
|
+
# 2. Install and start nano-brain (with auth + public binding)
|
|
164
|
+
npm install -g @nano-step/nano-brain
|
|
165
|
+
nano-brain serve -d --host=0.0.0.0
|
|
102
166
|
|
|
103
|
-
#
|
|
104
|
-
|
|
167
|
+
# 3. Generate a bearer token for your team
|
|
168
|
+
nano-brain auth token
|
|
169
|
+
# → nbt_xxxxxxxxxxxxxxxx
|
|
170
|
+
```
|
|
105
171
|
|
|
106
|
-
|
|
107
|
-
|
|
172
|
+
**On each developer machine** — add to MCP client config:
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"mcp": {
|
|
176
|
+
"nano-brain": {
|
|
177
|
+
"type": "http",
|
|
178
|
+
"url": "http://YOUR_VPS_IP:3100/mcp",
|
|
179
|
+
"headers": {
|
|
180
|
+
"Authorization": "Bearer nbt_xxxxxxxxxxxxxxxx"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Register your local project against the remote server
|
|
189
|
+
NANO_BRAIN_SERVER=http://YOUR_VPS_IP:3100 nano-brain init --root=/path/to/project
|
|
108
190
|
```
|
|
109
191
|
|
|
110
|
-
|
|
111
|
-
>
|
|
112
|
-
> **Note:** Do NOT run `npx nano-brain` from the nano-brain source directory — npm will resolve the local package instead of the registry. Run from any other directory.
|
|
192
|
+
See [Authentication](#authentication-vps--remote-deployment) for role-based tokens (admin / developer / read-only).
|
|
113
193
|
|
|
114
|
-
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### Path 3 — Build from source
|
|
115
197
|
|
|
116
198
|
```bash
|
|
117
199
|
# Build
|
|
118
200
|
CGO_ENABLED=0 go build -o nano-brain ./cmd/nano-brain
|
|
119
201
|
|
|
120
|
-
# Start PostgreSQL + pgvector
|
|
202
|
+
# Start PostgreSQL + pgvector
|
|
121
203
|
docker run -d --name nanobrain-pg -p 5432:5432 \
|
|
122
204
|
-e POSTGRES_USER=nanobrain -e POSTGRES_PASSWORD=nanobrain -e POSTGRES_DB=nanobrain_dev \
|
|
123
205
|
pgvector/pgvector:pg17
|
|
@@ -125,22 +207,22 @@ docker run -d --name nanobrain-pg -p 5432:5432 \
|
|
|
125
207
|
# Start server
|
|
126
208
|
DATABASE_URL="postgres://nanobrain:nanobrain@localhost:5432/nanobrain_dev" ./nano-brain
|
|
127
209
|
|
|
128
|
-
# Register workspace
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
210
|
+
# Register workspace and check status
|
|
211
|
+
./nano-brain init --root=/path/to/project
|
|
212
|
+
./nano-brain status
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
132
216
|
|
|
133
|
-
|
|
134
|
-
curl -X POST http://localhost:3100/api/v1/write \
|
|
135
|
-
-H "Content-Type: application/json" \
|
|
136
|
-
-d '{"workspace":"<hash>","source_path":"notes/decision.md","content":"# Decision\nUse PostgreSQL.","tags":["decision"]}'
|
|
217
|
+
### Via npx (no global install)
|
|
137
218
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
-d '{"workspace":"<hash>","query":"database decision"}'
|
|
219
|
+
```bash
|
|
220
|
+
npx @nano-step/nano-brain@latest doctor
|
|
221
|
+
npx @nano-step/nano-brain@latest serve -d
|
|
142
222
|
```
|
|
143
223
|
|
|
224
|
+
> Also available as `npx nano-brain@latest`. Do NOT run from the nano-brain source directory — npm will resolve the local package instead of the registry.
|
|
225
|
+
|
|
144
226
|
## Verifying Downloads
|
|
145
227
|
|
|
146
228
|
Every release ships a `SHA256SUMS` asset alongside the four platform binaries.
|