@nano-step/nano-brain 2026.5.26 → 2026.5.30
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 +76 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,7 +111,9 @@ search:
|
|
|
111
111
|
|
|
112
112
|
harvester:
|
|
113
113
|
opencode:
|
|
114
|
-
|
|
114
|
+
db_root: "" # e.g., ~/.ai-sandbox/opencode-dbs (multi-DB, highest priority)
|
|
115
|
+
db_path: "" # e.g., ~/.local/share/opencode/opencode.db (single DB)
|
|
116
|
+
session_dir: "" # e.g., ~/.local/share/opencode/storage (legacy JSON)
|
|
115
117
|
claudecode:
|
|
116
118
|
enabled: false
|
|
117
119
|
session_dir: ""
|
|
@@ -130,16 +132,68 @@ telemetry:
|
|
|
130
132
|
logging:
|
|
131
133
|
level: info
|
|
132
134
|
file: "" # empty = stdout only
|
|
135
|
+
|
|
136
|
+
summarization:
|
|
137
|
+
enabled: false # set to true to generate LLM summaries of harvested sessions
|
|
138
|
+
provider_url: "" # OpenAI-compatible endpoint, e.g. https://ai-proxy.example.com/v1
|
|
139
|
+
api_key: "" # or set NANO_BRAIN_SUMMARIZE_API_KEY env var
|
|
140
|
+
model: "nano-brain" # model name passed to the provider
|
|
141
|
+
max_tokens: 8000 # max tokens per LLM completion
|
|
142
|
+
concurrency: 3 # parallel map-phase LLM calls
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Session Summarization
|
|
146
|
+
|
|
147
|
+
When `summarization.enabled: true`, nano-brain automatically generates structured markdown summaries of each harvested session using an OpenAI-compatible LLM provider. Summaries are:
|
|
148
|
+
|
|
149
|
+
- Stored in PostgreSQL under collection `session-summary` for semantic search via the standard query/vsearch API (PG is the source of truth)
|
|
150
|
+
- Idempotent — unchanged sessions are skipped; re-harvested sessions overwrite old summaries
|
|
151
|
+
|
|
152
|
+
> **Note**: as of `harvest-summary-only` (May 2026), summaries are no longer written to disk as `.md` files. The legacy `output_dir` YAML key is silently ignored for backward compat. Any pre-existing files under `~/.nano-brain/summaries/` are stale artifacts and can be safely deleted.
|
|
153
|
+
|
|
154
|
+
**Quick setup with ai-proxy:**
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
summarization:
|
|
158
|
+
enabled: true
|
|
159
|
+
provider_url: "https://ai-proxy.example.com/v1"
|
|
160
|
+
api_key: "" # set NANO_BRAIN_SUMMARIZE_API_KEY instead
|
|
161
|
+
model: "claude-sonnet-4-5"
|
|
162
|
+
max_tokens: 8000
|
|
163
|
+
concurrency: 3
|
|
133
164
|
```
|
|
134
165
|
|
|
166
|
+
Or via environment variable:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
export NANO_BRAIN_SUMMARIZE_API_KEY="sk-..."
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Large sessions (100K+ tokens) are handled via map-reduce chunking — no session is too large.
|
|
173
|
+
|
|
135
174
|
### Environment Variables
|
|
136
175
|
|
|
137
176
|
| Variable | Description |
|
|
138
177
|
|----------|-------------|
|
|
178
|
+
| `NANO_BRAIN_CONFIG` | Path to YAML config file (12-factor; useful in Docker/k8s). Precedence: `--config` flag > `NANO_BRAIN_CONFIG` > `~/.nano-brain/config.yml`. Leading/trailing whitespace is stripped. If the env-pointed file does not exist, a `WARNING:` is printed to stderr and defaults are used (operator can spot typos). |
|
|
139
179
|
| `DATABASE_URL` | PostgreSQL connection string |
|
|
140
180
|
| `VOYAGE_API_KEY` | Voyage AI API key |
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
181
|
+
| `OPENCODE_DB_ROOT` | OpenCode per-project DB root directory (multi-DB mode) |
|
|
182
|
+
| `OPENCODE_DB_PATH` | OpenCode single SQLite database path |
|
|
183
|
+
| `OPENCODE_STORAGE_DIR` | OpenCode session directory (legacy) |
|
|
184
|
+
| `NANO_BRAIN_SUMMARIZE_API_KEY` | API key for the summarization LLM provider |
|
|
185
|
+
| `NANO_BRAIN_*` | Override any config field (e.g., `NANO_BRAIN_SERVER_PORT=3100`) |
|
|
186
|
+
|
|
187
|
+
**Docker example** — run the server in a container against a host PostgreSQL:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# /path/to/container-config.yml uses host.docker.internal for DB/Ollama
|
|
191
|
+
docker run -d \
|
|
192
|
+
-e NANO_BRAIN_CONFIG=/etc/nano-brain/config.yml \
|
|
193
|
+
-v /path/to/container-config.yml:/etc/nano-brain/config.yml:ro \
|
|
194
|
+
-p 3100:3100 \
|
|
195
|
+
nano-brain:latest
|
|
196
|
+
```
|
|
143
197
|
|
|
144
198
|
## REST API
|
|
145
199
|
|
|
@@ -151,6 +205,7 @@ logging:
|
|
|
151
205
|
| GET | `/api/status` | Server status with version, uptime, workspace stats |
|
|
152
206
|
| POST | `/api/v1/init` | Register workspace |
|
|
153
207
|
| GET | `/api/v1/workspaces` | List all workspaces (with doc counts) |
|
|
208
|
+
| DELETE | `/api/v1/workspaces/:hash` | Permanently delete a workspace + cascade docs/chunks/embeddings |
|
|
154
209
|
| GET | `/api/v1/wake-up` | Workspace briefing |
|
|
155
210
|
| POST | `/api/harvest` | Trigger session harvesting |
|
|
156
211
|
| POST | `/api/reload-config` | Hot-reload configuration |
|
|
@@ -171,8 +226,11 @@ Workspace is passed in the JSON body for POST, query param for GET.
|
|
|
171
226
|
| PUT | `/api/v1/collections/:name` | Rename collection |
|
|
172
227
|
| DELETE | `/api/v1/collections/:name` | Remove collection |
|
|
173
228
|
| GET | `/api/v1/tags` | List tags with counts |
|
|
229
|
+
| POST | `/api/v1/get` | Get single document by source_path or id |
|
|
230
|
+
| POST | `/api/v1/multi-get` | Batch fetch documents by paths or ids |
|
|
174
231
|
| POST | `/api/v1/reindex` | Queue reindex (202) |
|
|
175
232
|
| POST | `/api/v1/update` | Queue update (202) |
|
|
233
|
+
| POST | `/api/v1/summarize` | Trigger LLM summarization of harvested sessions |
|
|
176
234
|
| POST | `/api/v1/wake-up` | Workspace briefing with session_dir |
|
|
177
235
|
|
|
178
236
|
### MCP Endpoints
|
|
@@ -188,12 +246,19 @@ Workspace is passed in the JSON body for POST, query param for GET.
|
|
|
188
246
|
|---------|-------------|
|
|
189
247
|
| `nano-brain` (no args) | Start HTTP server (default: port 3100) |
|
|
190
248
|
| `nano-brain init --root=<path>` | Register workspace |
|
|
249
|
+
| `nano-brain workspaces list` | List registered workspaces with doc counts |
|
|
250
|
+
| `nano-brain workspaces remove --workspace=<hash> [--dry-run\|--force]` | Permanently delete a workspace + all its documents/chunks/embeddings |
|
|
191
251
|
| `nano-brain write` | Write document via CLI |
|
|
192
|
-
| `nano-brain query` | Hybrid search |
|
|
193
|
-
| `nano-brain search` | BM25 keyword search |
|
|
194
|
-
| `nano-brain vsearch` | Vector similarity search |
|
|
252
|
+
| `nano-brain query [--scope=all] [--tags=t1,t2]` | Hybrid search (BM25 + vector + RRF + recency) |
|
|
253
|
+
| `nano-brain search [--scope=all] [--tags=t1,t2]` | BM25 keyword search |
|
|
254
|
+
| `nano-brain vsearch [--scope=all] [--tags=t1,t2]` | Vector similarity search |
|
|
255
|
+
| `nano-brain wake-up --workspace=<hash>` | Workspace briefing (collections, stats, recent memories) |
|
|
256
|
+
| `nano-brain get <source_path\|uuid> --workspace=<hash>` | Fetch a single document by source_path or UUID |
|
|
257
|
+
| `nano-brain tags --workspace=<hash>` | List all tags with document counts |
|
|
258
|
+
| `nano-brain multi-get --workspace=<hash> --paths=p1,p2` | Fetch multiple documents in one round-trip |
|
|
195
259
|
| `nano-brain collection add\|remove\|list` | Manage collections |
|
|
196
260
|
| `nano-brain harvest` | Trigger session harvesting |
|
|
261
|
+
| `nano-brain cleanup-stale-raw [--dry-run]` | Delete pre-#192 raw OpenCode session docs superseded by summaries |
|
|
197
262
|
| `nano-brain bench generate\|run\|compare\|stress` | Benchmarking suite |
|
|
198
263
|
| `nano-brain db:migrate` | Run pending goose migrations |
|
|
199
264
|
| `nano-brain db:migrate --from-v1 <path>` | Import V1 SQLite data |
|
|
@@ -204,7 +269,7 @@ Workspace is passed in the JSON body for POST, query param for GET.
|
|
|
204
269
|
|
|
205
270
|
## MCP Tools
|
|
206
271
|
|
|
207
|
-
nano-brain exposes
|
|
272
|
+
nano-brain exposes 13 tools via MCP (Model Context Protocol):
|
|
208
273
|
|
|
209
274
|
| Tool | Description |
|
|
210
275
|
|------|-------------|
|
|
@@ -217,6 +282,10 @@ nano-brain exposes 9 tools via MCP (Model Context Protocol):
|
|
|
217
282
|
| `memory_status` | Server and embedding status |
|
|
218
283
|
| `memory_update` | Trigger re-embedding |
|
|
219
284
|
| `memory_wake_up` | Workspace briefing |
|
|
285
|
+
| `memory_graph` | Knowledge graph view (module → function → dep) |
|
|
286
|
+
| `memory_trace` | Call chain trace from entry point |
|
|
287
|
+
| `memory_impact` | Cross-file change impact analysis |
|
|
288
|
+
| `memory_symbols` | Symbol search (functions, types, constants) |
|
|
220
289
|
|
|
221
290
|
### MCP Configuration
|
|
222
291
|
|