nano-brain 2026.8.2 → 2026.8.4
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 +45 -11
- package/docker-compose.yml +1 -1
- package/package.json +1 -1
- package/src/bench/runner.ts +19 -2
- package/src/cli/utils.ts +2 -0
- package/src/jobs/watcher.ts +1 -1
package/README.md
CHANGED
|
@@ -636,17 +636,15 @@ nano-brain status # Show index health, collections, model status
|
|
|
636
636
|
|
|
637
637
|
```bash
|
|
638
638
|
nano-brain mcp # Start MCP server (stdio)
|
|
639
|
-
nano-brain mcp --http
|
|
639
|
+
nano-brain mcp --http # Start MCP server (HTTP/SSE, default port 8282)
|
|
640
|
+
nano-brain mcp --http --port=3100 --host=0.0.0.0 # Custom port (e.g. Docker default 3100)
|
|
640
641
|
```
|
|
641
642
|
|
|
642
643
|
### Remote Server (Daemon)
|
|
643
644
|
|
|
644
645
|
```bash
|
|
645
|
-
nano-brain
|
|
646
|
-
nano-brain
|
|
647
|
-
nano-brain serve stop # Stop the daemon
|
|
648
|
-
nano-brain serve --foreground # Run in foreground (for debugging)
|
|
649
|
-
nano-brain serve --port=8080 # Custom port
|
|
646
|
+
nano-brain mcp --http --daemon --port=8282 # Start HTTP/SSE server as background daemon
|
|
647
|
+
nano-brain mcp --http --daemon --port=3100 # Custom port (e.g. Docker default)
|
|
650
648
|
```
|
|
651
649
|
|
|
652
650
|
### Docker Deployment
|
|
@@ -666,6 +664,10 @@ Environment variables for volume mounts:
|
|
|
666
664
|
- `NANO_BRAIN_HOME` — Path to data directory (default: `~/.nano-brain`)
|
|
667
665
|
- `NANO_BRAIN_WORKSPACE` — Path to your project workspace to index as codebase (mounted read-only, passed as `--root`)
|
|
668
666
|
|
|
667
|
+
Runtime environment variables:
|
|
668
|
+
- `OPENCODE_STORAGE_DIR` — Override OpenCode session storage path (useful in Docker where container homedir differs from host). Example: `/Users/tamlh/.local/share/opencode/storage`
|
|
669
|
+
- `NANO_BRAIN_EMBEDDING_CONCURRENCY` — Number of parallel embedding requests to Ollama (default: `3`)
|
|
670
|
+
|
|
669
671
|
### Search
|
|
670
672
|
|
|
671
673
|
```bash
|
|
@@ -691,7 +693,7 @@ nano-brain tags # List all tags with counts
|
|
|
691
693
|
|
|
692
694
|
```bash
|
|
693
695
|
nano-brain update # Reindex all collections
|
|
694
|
-
nano-brain
|
|
696
|
+
nano-brain reindex # Index codebase in current workspace
|
|
695
697
|
nano-brain reset --confirm # Reset all data (requires confirmation)
|
|
696
698
|
nano-brain reset --dry-run # Preview what would be deleted
|
|
697
699
|
```
|
|
@@ -737,11 +739,26 @@ nano-brain cache stats # Show cache statistics
|
|
|
737
739
|
|
|
738
740
|
### Benchmarking
|
|
739
741
|
|
|
742
|
+
Measures search quality (P@5, R@10, MRR) and latency across FTS, vector, and hybrid modes.
|
|
743
|
+
|
|
740
744
|
```bash
|
|
741
|
-
nano-brain bench
|
|
742
|
-
nano-brain bench --
|
|
743
|
-
nano-brain bench
|
|
744
|
-
nano-brain bench --
|
|
745
|
+
nano-brain bench generate # Generate fixtures (scale-100)
|
|
746
|
+
nano-brain bench generate --scale=1000 # Larger corpus (valid: 100,1000,5000,10000,100000)
|
|
747
|
+
nano-brain bench run # Run benchmark suite (scale-100)
|
|
748
|
+
nano-brain bench run --scale=1000 # Run at larger scale
|
|
749
|
+
nano-brain bench compare new.json baseline.json # Regression check
|
|
750
|
+
nano-brain bench compare new.json baseline.json --save=baseline.json --force # Save + force
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
See [`benchmarks/README.md`](benchmarks/README.md) for full explanation of metrics, corpus generation, and regression detection.
|
|
754
|
+
|
|
755
|
+
Current results on v2026.8.3 (100 docs, Ollama local):
|
|
756
|
+
|
|
757
|
+
```
|
|
758
|
+
Mode P@5 R@10 MRR Latency (p50)
|
|
759
|
+
FTS 0.975 0.985 1.000 1ms
|
|
760
|
+
Vector 0.875 0.925 1.000 29ms
|
|
761
|
+
Hybrid 0.835 0.970 1.000 34ms
|
|
745
762
|
```
|
|
746
763
|
|
|
747
764
|
### Logging
|
|
@@ -755,6 +772,23 @@ nano-brain logs --clear # Delete all log files
|
|
|
755
772
|
nano-brain logs path # Print log directory path
|
|
756
773
|
```
|
|
757
774
|
|
|
775
|
+
### Code Intelligence
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
nano-brain context <symbol> # 360° view of a code symbol (callers, callees, flows)
|
|
779
|
+
nano-brain code-impact <symbol> # Analyze impact of changing a symbol
|
|
780
|
+
nano-brain detect-changes # Map current git changes to affected symbols and flows
|
|
781
|
+
nano-brain wake-up # Generate a compact context briefing for session start
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
### Memory Intelligence
|
|
785
|
+
|
|
786
|
+
```bash
|
|
787
|
+
nano-brain consolidate # Run consolidation job manually
|
|
788
|
+
nano-brain categorize-backfill # Backfill LLM categorization on existing documents
|
|
789
|
+
nano-brain learning rollback [id] # Manage self-learning system; rollback to a previous config version
|
|
790
|
+
```
|
|
791
|
+
|
|
758
792
|
## Project Structure
|
|
759
793
|
|
|
760
794
|
```
|
package/docker-compose.yml
CHANGED
|
@@ -33,7 +33,7 @@ services:
|
|
|
33
33
|
- nano-brain-node-modules:/app/node_modules
|
|
34
34
|
- ${NANO_BRAIN_HOME:-~/.nano-brain}:/root/.nano-brain
|
|
35
35
|
- ${NANO_BRAIN_WORKSPACE:-/Users/tamlh/workspaces/NUSTechnology/Projects/zengamingx}:${NANO_BRAIN_WORKSPACE:-/Users/tamlh/workspaces/NUSTechnology/Projects/zengamingx}:ro
|
|
36
|
-
- ${
|
|
36
|
+
- ${OPENCODE_DATA_DIR:-~/.ai-sandbox/tools/opencode/home/.local/share/opencode}:/root/.local/share/opencode:ro
|
|
37
37
|
environment:
|
|
38
38
|
- NODE_ENV=production
|
|
39
39
|
- OLLAMA_HOST=http://host.docker.internal:11434
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nano-brain",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.4",
|
|
4
4
|
"description": "Persistent memory and code intelligence for AI coding agents. Local MCP server with self-learning hybrid search (BM25 + vector + knowledge graph + LLM reranking), automatic session ingestion, codebase indexing, and 22 tools. Learns your preferences over time. Works with OpenCode, Claude, Cursor, Windsurf, and any MCP client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/bench/runner.ts
CHANGED
|
@@ -212,9 +212,21 @@ async function measureQuality(
|
|
|
212
212
|
|
|
213
213
|
async function insertDocs(
|
|
214
214
|
dbPath: string,
|
|
215
|
-
fixturesDir: string
|
|
215
|
+
fixturesDir: string,
|
|
216
|
+
ollamaUrl: string | null
|
|
216
217
|
): Promise<LatencyStats> {
|
|
217
218
|
const store = createStore(dbPath);
|
|
219
|
+
store.ensureVecTable(768);
|
|
220
|
+
|
|
221
|
+
let embedder: { embed(text: string): Promise<{ embedding: number[] }>; dispose(): void } | null = null;
|
|
222
|
+
if (ollamaUrl) {
|
|
223
|
+
try {
|
|
224
|
+
embedder = await createEmbeddingProvider({ embeddingConfig: { url: ollamaUrl } });
|
|
225
|
+
} catch {
|
|
226
|
+
embedder = null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
218
230
|
const docsDir = path.join(fixturesDir, 'docs');
|
|
219
231
|
const docFiles = fs.readdirSync(docsDir).filter(f => f.endsWith('.md'));
|
|
220
232
|
const insertTimes: number[] = [];
|
|
@@ -240,9 +252,14 @@ async function insertDocs(
|
|
|
240
252
|
active: true,
|
|
241
253
|
projectHash,
|
|
242
254
|
});
|
|
255
|
+
if (embedder) {
|
|
256
|
+
const { embedding } = await embedder.embed(content);
|
|
257
|
+
store.insertEmbedding(hash, 0, 0, embedding, 'nomic-embed-text');
|
|
258
|
+
}
|
|
243
259
|
insertTimes.push(Date.now() - t0);
|
|
244
260
|
}
|
|
245
261
|
} finally {
|
|
262
|
+
embedder?.dispose();
|
|
246
263
|
store.close();
|
|
247
264
|
}
|
|
248
265
|
|
|
@@ -427,7 +444,7 @@ export async function runBenchmarkSuite(opts: RunOptions): Promise<BenchResult>
|
|
|
427
444
|
}
|
|
428
445
|
|
|
429
446
|
console.log(' Inserting docs...');
|
|
430
|
-
const insertLatency = await insertDocs(testDbPath, fixturesDir);
|
|
447
|
+
const insertLatency = await insertDocs(testDbPath, fixturesDir, ollamaUrl);
|
|
431
448
|
|
|
432
449
|
console.log(' Running quality metrics...');
|
|
433
450
|
const { quality, latency: queryLatency } = await measureQuality(testDbPath, groundTruth, ollamaUrl);
|
package/src/cli/utils.ts
CHANGED
|
@@ -54,6 +54,8 @@ export function getHttpPort(): number {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export function resolveOpenCodeStorageDir(): string {
|
|
57
|
+
// Explicit override (useful in Docker where homedir != host homedir)
|
|
58
|
+
if (process.env.OPENCODE_STORAGE_DIR) return process.env.OPENCODE_STORAGE_DIR;
|
|
57
59
|
// XDG path (Linux): ~/.local/share/opencode/storage
|
|
58
60
|
const xdgData = process.env.XDG_DATA_HOME || path.join(os.homedir(), '.local', 'share');
|
|
59
61
|
const xdgPath = path.join(xdgData, 'opencode', 'storage');
|
package/src/jobs/watcher.ts
CHANGED
|
@@ -129,7 +129,7 @@ export function startWatcher(options: WatcherOptions): Watcher {
|
|
|
129
129
|
pollIntervalMs = 300000,
|
|
130
130
|
sessionPollMs = 120000,
|
|
131
131
|
embedIntervalMs = 60000,
|
|
132
|
-
sessionStorageDir = path.join(os.homedir(), '.local/share/opencode/storage'),
|
|
132
|
+
sessionStorageDir = process.env.OPENCODE_STORAGE_DIR ?? path.join(os.homedir(), '.local/share/opencode/storage'),
|
|
133
133
|
outputDir = path.join(os.homedir(), '.nano-brain/sessions'),
|
|
134
134
|
storageConfig,
|
|
135
135
|
dbPath,
|