@andespindola/brainlink 0.1.0-alpha.0

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.
Files changed (52) hide show
  1. package/AGENTS.md +142 -0
  2. package/CHANGELOG.md +13 -0
  3. package/CONTRIBUTING.md +28 -0
  4. package/LICENSE +23 -0
  5. package/README.md +715 -0
  6. package/SECURITY.md +35 -0
  7. package/dist/application/add-note.js +30 -0
  8. package/dist/application/analyze-vault.js +28 -0
  9. package/dist/application/build-context.js +15 -0
  10. package/dist/application/frontend/client-css.js +294 -0
  11. package/dist/application/frontend/client-html.js +66 -0
  12. package/dist/application/frontend/client-js.js +416 -0
  13. package/dist/application/get-graph-layout.js +3 -0
  14. package/dist/application/get-graph.js +12 -0
  15. package/dist/application/index-vault.js +67 -0
  16. package/dist/application/list-agents.js +12 -0
  17. package/dist/application/list-links.js +22 -0
  18. package/dist/application/search-knowledge.js +19 -0
  19. package/dist/application/server/host-security.js +6 -0
  20. package/dist/application/server/http.js +13 -0
  21. package/dist/application/server/routes.js +88 -0
  22. package/dist/application/server/types.js +1 -0
  23. package/dist/application/start-server.js +54 -0
  24. package/dist/application/watch-vault.js +36 -0
  25. package/dist/benchmarks/large-vault.js +88 -0
  26. package/dist/cli/commands/read-commands.js +149 -0
  27. package/dist/cli/commands/write-commands.js +107 -0
  28. package/dist/cli/main.js +21 -0
  29. package/dist/cli/runtime.js +18 -0
  30. package/dist/cli/types.js +1 -0
  31. package/dist/domain/agents.js +11 -0
  32. package/dist/domain/context.js +44 -0
  33. package/dist/domain/embeddings.js +117 -0
  34. package/dist/domain/graph-analysis.js +48 -0
  35. package/dist/domain/graph-layout.js +187 -0
  36. package/dist/domain/ids.js +2 -0
  37. package/dist/domain/markdown.js +100 -0
  38. package/dist/domain/note-safety.js +54 -0
  39. package/dist/domain/tokens.js +1 -0
  40. package/dist/domain/types.js +1 -0
  41. package/dist/infrastructure/config.js +60 -0
  42. package/dist/infrastructure/file-system-vault.js +62 -0
  43. package/dist/infrastructure/sqlite/document-writer.js +50 -0
  44. package/dist/infrastructure/sqlite/graph-reader.js +108 -0
  45. package/dist/infrastructure/sqlite/schema.js +87 -0
  46. package/dist/infrastructure/sqlite/search-reader.js +156 -0
  47. package/dist/infrastructure/sqlite/types.js +1 -0
  48. package/dist/infrastructure/sqlite-index.js +20 -0
  49. package/docs/AGENT_USAGE.md +477 -0
  50. package/docs/ARCHITECTURE.md +286 -0
  51. package/docs/RELEASE.md +67 -0
  52. package/package.json +67 -0
package/README.md ADDED
@@ -0,0 +1,715 @@
1
+ # Brainlink
2
+
3
+ Local-first memory and knowledge graph for AI agents.
4
+
5
+ Brainlink turns a folder of Markdown files into a searchable, link-aware memory layer that agents can use before answering, planning, coding, documenting or handing work to another agent.
6
+
7
+ It is inspired by Obsidian-style knowledge bases: plain Markdown, `[[wiki links]]`, backlinks, tags and graph navigation. The difference is that Brainlink is built for automation first: CLI, JSON output, local HTTP API and a graph frontend.
8
+
9
+ ## Purpose
10
+
11
+ This repository exists to give agents a durable project memory that lives outside the model context window.
12
+
13
+ Without Brainlink, an agent usually depends on:
14
+
15
+ - the current prompt
16
+ - the current chat history
17
+ - files it happens to inspect in this run
18
+ - short-lived assumptions made during a task
19
+
20
+ With Brainlink, an agent can persist and retrieve:
21
+
22
+ - architecture decisions
23
+ - coding conventions
24
+ - user preferences
25
+ - operational runbooks
26
+ - previous investigation summaries
27
+ - domain concepts
28
+ - unresolved questions
29
+ - handoff notes for other agents
30
+
31
+ The goal is not to replace the model's context window. The goal is to make the model's context window smarter by filling it with the most relevant memory before the agent acts.
32
+
33
+ ## How Brainlink Improves Agents
34
+
35
+ Brainlink improves agent behavior by giving them a repeatable memory workflow:
36
+
37
+ - **Less repeated discovery:** agents can retrieve previous decisions instead of rediscovering the same context.
38
+ - **Better continuity:** long-running projects keep memory across sessions and across different agents.
39
+ - **Grounded answers:** context packages include source paths, titles, tags and relevant excerpts.
40
+ - **Safer collaboration:** agent namespaces prevent private context from different agents being mixed accidentally.
41
+ - **Inspectable memory:** humans can open the vault as plain Markdown or in Obsidian-like tools.
42
+ - **Automation-ready output:** CLI commands support `--json`, so agents and external tool servers can consume stable machine-readable responses.
43
+
44
+ ## Why
45
+
46
+ LLMs do not have infinite context. Brainlink gives agents an external memory layer:
47
+
48
+ 1. Durable knowledge is written as Markdown.
49
+ 2. Notes are connected with `[[wiki links]]`.
50
+ 3. Concepts are classified with `#tags`.
51
+ 4. Brainlink builds a local SQLite index with FTS records and local embeddings.
52
+ 5. Agents query the index before responding.
53
+ 6. Brainlink returns compact, source-backed context.
54
+
55
+ Markdown is the source of truth. `.brainlink/brainlink.db` is only a rebuildable index.
56
+
57
+ ## Features
58
+
59
+ - Local-first Markdown vault.
60
+ - Obsidian-compatible `[[wiki links]]` and `#tags`.
61
+ - Backlinks, broken-link reports, orphan detection and validation.
62
+ - Full-text, semantic and hybrid retrieval modes.
63
+ - SQLite-backed semantic candidate buckets for larger vaults.
64
+ - Agent namespaces under `agents/<agent-id>/`.
65
+ - CLI with machine-readable `--json` output.
66
+ - Short CLI alias: `blink`.
67
+ - Compatible with MCP servers that execute local CLI commands.
68
+ - Local HTTP API.
69
+ - Realtime graph UI with agent selector and colored knowledge groups.
70
+
71
+ ## Install
72
+
73
+ Requirements:
74
+
75
+ - Node.js `>=22.5.0`
76
+ - npm
77
+
78
+ ```bash
79
+ npm install -g @andespindola/brainlink
80
+ ```
81
+
82
+ The package installs two equivalent commands:
83
+
84
+ ```bash
85
+ brainlink --help
86
+ blink --help
87
+ ```
88
+
89
+ Use `brainlink` when clarity matters. Use `blink` for faster daily terminal usage.
90
+
91
+ ## Agent Autonomous Setup
92
+
93
+ This section is written for agents. If you are an AI agent operating in a user workspace, use this workflow to install and use Brainlink without requiring the user to run commands manually.
94
+
95
+ ### 1. Check Whether Brainlink Is Installed
96
+
97
+ ```bash
98
+ command -v blink || command -v brainlink
99
+ ```
100
+
101
+ If neither command exists, install it:
102
+
103
+ ```bash
104
+ npm install -g @andespindola/brainlink
105
+ ```
106
+
107
+ Then verify:
108
+
109
+ ```bash
110
+ blink --help
111
+ ```
112
+
113
+ ### 2. Choose A Vault Path
114
+
115
+ Prefer a project-local vault when memory belongs to one repository:
116
+
117
+ ```bash
118
+ BLINK_VAULT=".brainlink-vault"
119
+ ```
120
+
121
+ Use a user-level vault only when memory should span many projects:
122
+
123
+ ```bash
124
+ BLINK_VAULT="$HOME/.brainlink/vault"
125
+ ```
126
+
127
+ Initialize the vault:
128
+
129
+ ```bash
130
+ blink init "$BLINK_VAULT"
131
+ ```
132
+
133
+ ### 3. Choose An Agent Namespace
134
+
135
+ Use a stable namespace for yourself:
136
+
137
+ ```bash
138
+ BLINK_AGENT="coding-agent"
139
+ ```
140
+
141
+ Use `shared` only for knowledge that should be visible to every workflow.
142
+
143
+ ### 4. Read Memory Before Acting
144
+
145
+ Before answering or changing code, retrieve context:
146
+
147
+ ```bash
148
+ blink context "What should I know before working on this task?" \
149
+ --vault "$BLINK_VAULT" \
150
+ --agent "$BLINK_AGENT" \
151
+ --json
152
+ ```
153
+
154
+ If the context is weak, inspect raw search results:
155
+
156
+ ```bash
157
+ blink search "architecture conventions tests release" \
158
+ --vault "$BLINK_VAULT" \
159
+ --agent "$BLINK_AGENT" \
160
+ --mode hybrid \
161
+ --limit 10 \
162
+ --json
163
+ ```
164
+
165
+ ### 5. Write Durable Memory After Learning Something Useful
166
+
167
+ Only store knowledge that is likely to matter later:
168
+
169
+ ```bash
170
+ blink add "Testing Policy" \
171
+ --vault "$BLINK_VAULT" \
172
+ --agent "$BLINK_AGENT" \
173
+ --content "Run npm run check before final delivery. Related: [[Release Checklist]]. #testing #process"
174
+ ```
175
+
176
+ Rebuild the index:
177
+
178
+ ```bash
179
+ blink index --vault "$BLINK_VAULT"
180
+ ```
181
+
182
+ ### 6. Validate Memory Health
183
+
184
+ ```bash
185
+ blink validate --vault "$BLINK_VAULT" --agent "$BLINK_AGENT" --json
186
+ blink broken-links --vault "$BLINK_VAULT" --agent "$BLINK_AGENT" --json
187
+ blink orphans --vault "$BLINK_VAULT" --agent "$BLINK_AGENT" --json
188
+ ```
189
+
190
+ ### Agent Operating Loop
191
+
192
+ Use this loop during real work:
193
+
194
+ 1. Identify the task and choose `BLINK_AGENT`.
195
+ 2. Run `blink context "<task>" --vault "$BLINK_VAULT" --agent "$BLINK_AGENT" --json`.
196
+ 3. Use returned sources as project memory.
197
+ 4. Perform the task.
198
+ 5. Save only durable learnings with `blink add`.
199
+ 6. Run `blink index`.
200
+ 7. Validate with `blink validate`.
201
+
202
+ Do not store secrets, credentials, private keys, access tokens or transient chat noise.
203
+
204
+ ## Quick Start
205
+
206
+ ```bash
207
+ blink init ./vault
208
+
209
+ blink add "Architecture" \
210
+ --vault ./vault \
211
+ --content "Brainlink keeps Markdown as source of truth. #architecture"
212
+
213
+ blink add "Auth Decision" \
214
+ --vault ./vault \
215
+ --content "We chose JWT for API clients. [[Architecture]] #auth #jwt"
216
+
217
+ blink index --vault ./vault
218
+
219
+ blink search "jwt auth" --vault ./vault
220
+
221
+ blink context "how does auth work?" --vault ./vault
222
+
223
+ blink server --vault ./vault --watch
224
+ ```
225
+
226
+ Open the graph UI:
227
+
228
+ ```txt
229
+ http://127.0.0.1:4321
230
+ ```
231
+
232
+ ## Core Model
233
+
234
+ ```txt
235
+ vault/
236
+ agents/
237
+ shared/
238
+ architecture.md
239
+ coding-agent/
240
+ implementation-policy.md
241
+ research-agent/
242
+ source-review-policy.md
243
+ .brainlink/
244
+ brainlink.db
245
+ ```
246
+
247
+ Permanent data:
248
+
249
+ - Markdown notes
250
+ - optional Git history around the vault
251
+
252
+ Rebuildable data:
253
+
254
+ - `.brainlink/brainlink.db`
255
+ - full-text records
256
+ - local embedding vectors
257
+ - local embedding buckets
258
+ - chunks
259
+ - resolved links
260
+ - backlinks
261
+
262
+ ## Agent Namespaces
263
+
264
+ Brainlink separates memory by agent so multiple agents can use the same CLI without mixing private context.
265
+
266
+ Use `shared` for project-wide memory:
267
+
268
+ ```bash
269
+ blink add "Project Rules" \
270
+ --vault ./vault \
271
+ --agent shared \
272
+ --content "All agents should run tests before final answers. #process"
273
+ ```
274
+
275
+ Use a dedicated namespace for private agent memory:
276
+
277
+ ```bash
278
+ blink add "TypeScript Policy" \
279
+ --vault ./vault \
280
+ --agent coding-agent \
281
+ --content "Prefer explicit types and functional core boundaries. [[Project Rules]] #typescript"
282
+ ```
283
+
284
+ List indexed namespaces:
285
+
286
+ ```bash
287
+ blink agents --vault ./vault
288
+ blink agents --vault ./vault --json
289
+ ```
290
+
291
+ Query a single namespace:
292
+
293
+ ```bash
294
+ blink search "typescript" --vault ./vault --agent coding-agent --json
295
+ blink search "authentication token policy" --vault ./vault --agent coding-agent --mode semantic --json
296
+ blink context "how should I change this module?" --vault ./vault --agent coding-agent
297
+ blink graph --vault ./vault --agent coding-agent --json
298
+ ```
299
+
300
+ Link resolution is scoped:
301
+
302
+ 1. same agent namespace
303
+ 2. `shared`
304
+ 3. unresolved link
305
+
306
+ This allows `coding-agent` and `research-agent` to both have a note named `Architecture` without contaminating each other's private memory.
307
+
308
+ ## MCP Server Integration
309
+
310
+ Brainlink is not an MCP server. It is a CLI-first memory engine.
311
+
312
+ An MCP server can use Brainlink by spawning `blink` or `brainlink` as a subprocess and reading `--json` output. This keeps Brainlink decoupled from any specific MCP SDK while still making it usable by MCP-compatible agents.
313
+
314
+ Minimum integration contract:
315
+
316
+ ```bash
317
+ blink context "<task>" --vault "$BLINK_VAULT" --agent "$BLINK_AGENT" --json
318
+ blink add "Decision Title" --vault "$BLINK_VAULT" --agent "$BLINK_AGENT" --content "Durable memory. #decision"
319
+ blink index --vault "$BLINK_VAULT"
320
+ ```
321
+
322
+ Example Node.js wrapper inside an external MCP server:
323
+
324
+ ```js
325
+ import { execFile } from 'node:child_process'
326
+ import { promisify } from 'node:util'
327
+
328
+ const execFileAsync = promisify(execFile)
329
+
330
+ export const brainlinkContext = async ({ vault, agent, query }) => {
331
+ const { stdout } = await execFileAsync('blink', [
332
+ 'context',
333
+ query,
334
+ '--vault',
335
+ vault,
336
+ '--agent',
337
+ agent,
338
+ '--mode',
339
+ 'hybrid',
340
+ '--json'
341
+ ])
342
+
343
+ return JSON.parse(stdout)
344
+ }
345
+ ```
346
+
347
+ Recommended MCP tools exposed by the external server:
348
+
349
+ - `brainlink_context`: calls `blink context ... --json`.
350
+ - `brainlink_search`: calls `blink search ... --json`.
351
+ - `brainlink_add_note`: calls `blink add ... --json`, then `blink index`.
352
+ - `brainlink_graph`: calls `blink graph ... --json`.
353
+ - `brainlink_validate`: calls `blink validate ... --json`.
354
+
355
+ ## Graph UI
356
+
357
+ Start the local frontend:
358
+
359
+ ```bash
360
+ blink server --vault ./vault --host 127.0.0.1 --port 4321 --watch
361
+ ```
362
+
363
+ The graph UI shows:
364
+
365
+ - notes as nodes
366
+ - `[[wiki links]]` as edges
367
+ - backlinks and outgoing links
368
+ - full Markdown content for the selected note
369
+ - neutral graph nodes with segment/group metadata
370
+ - agent selector for isolated views
371
+ - realtime refresh while `--watch` is enabled
372
+
373
+ The server indexes before starting by default. Use `--no-index` to skip that step:
374
+
375
+ ```bash
376
+ blink server --vault ./vault --no-index
377
+ ```
378
+
379
+ ## HTTP API
380
+
381
+ The HTTP API is read-only and exists only to power the graph UI and local inspection workflows.
382
+
383
+ The server refuses non-loopback hosts by default. Use `--allow-public` only behind your own authentication, authorization and TLS.
384
+
385
+ Routes:
386
+
387
+ - `GET /api/agents`
388
+ - `GET /api/graph`
389
+ - `GET /api/graph-layout`
390
+ - `GET /api/search?q=<query>&limit=10&mode=hybrid`
391
+ - `GET /api/context?q=<query>&limit=12&tokens=2000&mode=hybrid`
392
+ - `GET /api/links`
393
+ - `GET /api/backlinks?title=<title>`
394
+ - `GET /api/stats`
395
+ - `GET /api/broken-links`
396
+ - `GET /api/orphans`
397
+ - `GET /api/validate`
398
+
399
+ Read routes accept `agent=<agent-id>`:
400
+
401
+ ```txt
402
+ /api/graph-layout?agent=coding-agent
403
+ /api/search?q=typescript&agent=coding-agent&mode=hybrid
404
+ /api/context?q=module-boundaries&agent=coding-agent&mode=semantic
405
+ ```
406
+
407
+ ## CLI Reference
408
+
409
+ Every command works with either `brainlink` or `blink`.
410
+
411
+ ### `init`
412
+
413
+ ```bash
414
+ blink init ./vault
415
+ ```
416
+
417
+ Initializes vault metadata.
418
+
419
+ ### `add`
420
+
421
+ ```bash
422
+ blink add "Note Title" --vault ./vault --agent coding-agent --content "Markdown content"
423
+ ```
424
+
425
+ Creates a Markdown note under `agents/<agent-id>/`. Common secret patterns are blocked by default; use `--allow-sensitive` only for an intentionally protected vault.
426
+
427
+ ### `index`
428
+
429
+ ```bash
430
+ blink index --vault ./vault
431
+ ```
432
+
433
+ Rebuilds the local index from Markdown files.
434
+
435
+ ### `agents`
436
+
437
+ ```bash
438
+ blink agents --vault ./vault
439
+ blink agents --vault ./vault --json
440
+ ```
441
+
442
+ Lists indexed agent namespaces.
443
+
444
+ ### `search`
445
+
446
+ ```bash
447
+ blink search "query" --vault ./vault --limit 10
448
+ blink search "query" --vault ./vault --agent coding-agent --json
449
+ blink search "query" --vault ./vault --mode semantic --json
450
+ ```
451
+
452
+ Runs retrieval over indexed chunks.
453
+
454
+ Modes:
455
+
456
+ - `hybrid`: default; combines SQLite FTS with local embedding similarity.
457
+ - `fts`: exact lexical retrieval through SQLite FTS.
458
+ - `semantic`: local deterministic embedding similarity only.
459
+
460
+ ### `context`
461
+
462
+ ```bash
463
+ blink context "question" --vault ./vault --limit 12 --tokens 2000
464
+ blink context "question" --vault ./vault --agent coding-agent --json
465
+ blink context "question" --vault ./vault --agent coding-agent --mode hybrid --json
466
+ ```
467
+
468
+ Builds a compact context package for an agent.
469
+
470
+ ### `links`
471
+
472
+ ```bash
473
+ blink links --vault ./vault
474
+ blink links --vault ./vault --agent coding-agent
475
+ ```
476
+
477
+ Lists indexed wiki links.
478
+
479
+ ### `backlinks`
480
+
481
+ ```bash
482
+ blink backlinks "Architecture" --vault ./vault
483
+ blink backlinks "Architecture" --vault ./vault --agent coding-agent
484
+ ```
485
+
486
+ Lists notes pointing to a target title.
487
+
488
+ ### `graph`
489
+
490
+ ```bash
491
+ blink graph --vault ./vault --json
492
+ blink graph --vault ./vault --agent coding-agent --json
493
+ ```
494
+
495
+ Prints indexed graph data.
496
+
497
+ ### `stats`
498
+
499
+ ```bash
500
+ blink stats --vault ./vault
501
+ blink stats --vault ./vault --agent coding-agent --json
502
+ ```
503
+
504
+ Prints vault metrics.
505
+
506
+ ### `broken-links`
507
+
508
+ ```bash
509
+ blink broken-links --vault ./vault
510
+ ```
511
+
512
+ Lists unresolved wiki links.
513
+
514
+ ### `orphans`
515
+
516
+ ```bash
517
+ blink orphans --vault ./vault
518
+ ```
519
+
520
+ Lists notes without incoming or outgoing links.
521
+
522
+ ### `validate`
523
+
524
+ ```bash
525
+ blink validate --vault ./vault
526
+ ```
527
+
528
+ Validates graph health. The command exits non-zero when required checks fail.
529
+
530
+ ### `doctor`
531
+
532
+ ```bash
533
+ blink doctor --vault ./vault
534
+ ```
535
+
536
+ Runs environment and vault checks.
537
+
538
+ ### `watch`
539
+
540
+ ```bash
541
+ blink watch --vault ./vault
542
+ ```
543
+
544
+ Watches Markdown files and rebuilds the index when notes change.
545
+
546
+ ### `server`
547
+
548
+ ```bash
549
+ blink server --vault ./vault --watch
550
+ ```
551
+
552
+ Starts the local read-only graph UI and HTTP API.
553
+
554
+ To bind outside localhost, pass `--allow-public` and put the server behind your own auth and TLS.
555
+
556
+ ## Machine-Readable Output
557
+
558
+ Commands with finite output support `--json`:
559
+
560
+ ```bash
561
+ blink context "question" --vault ./vault --agent coding-agent --json
562
+ ```
563
+
564
+ When running through npm scripts, use `--silent` to keep stdout clean:
565
+
566
+ ```bash
567
+ npm run --silent dev -- context "question" --vault ./vault --json
568
+ ```
569
+
570
+ ## Configuration
571
+
572
+ Brainlink reads `brainlink.config.json` or `.brainlink.json` from the current working directory.
573
+
574
+ ```json
575
+ {
576
+ "vault": ".brainlink-vault",
577
+ "host": "127.0.0.1",
578
+ "port": 4321,
579
+ "allowedVaults": [".brainlink-vault"],
580
+ "defaultSearchLimit": 10,
581
+ "defaultContextTokens": 2000,
582
+ "embeddingProvider": "local",
583
+ "defaultSearchMode": "hybrid",
584
+ "chunkSize": 1200
585
+ }
586
+ ```
587
+
588
+ Use `"embeddingProvider": "none"` when you want FTS-only indexing.
589
+
590
+ Set `BRAINLINK_ALLOWED_VAULTS` for external wrappers, including MCP servers, so a tool cannot pass arbitrary `--vault` paths:
591
+
592
+ ```bash
593
+ export BRAINLINK_ALLOWED_VAULTS="/absolute/path/to/project-vault,/absolute/path/to/team-vault"
594
+ ```
595
+
596
+ ## Note Format
597
+
598
+ Brainlink supports Markdown with optional frontmatter:
599
+
600
+ ```md
601
+ ---
602
+ title: "Auth Decision"
603
+ agent: "coding-agent"
604
+ type: "decision"
605
+ ---
606
+
607
+ # Auth Decision
608
+
609
+ We chose JWT for API clients.
610
+
611
+ Related:
612
+
613
+ - [[Architecture]]
614
+ - [[API Gateway]]
615
+
616
+ #auth #jwt #decision
617
+ ```
618
+
619
+ Supported signals:
620
+
621
+ - `title` frontmatter
622
+ - `agent` frontmatter
623
+ - first `# Heading`
624
+ - file name fallback
625
+ - `[[Wiki Link]]`
626
+ - `[[Wiki Link#Section]]`
627
+ - `[[Wiki Link|Alias]]`
628
+ - `#tags`
629
+
630
+ ## Development
631
+
632
+ ```bash
633
+ npm install
634
+ npm run build
635
+ npm run test
636
+ npm run check
637
+ ```
638
+
639
+ Large vault benchmark:
640
+
641
+ ```bash
642
+ npm run benchmark:large -- --notes 5000
643
+ ```
644
+
645
+ Use `--keep` to keep the generated temporary vault for inspection.
646
+
647
+ Local CLI:
648
+
649
+ ```bash
650
+ npm run dev -- --help
651
+ npm run dev -- server --vault .brainlink-vault --watch
652
+ ```
653
+
654
+ Package smoke test:
655
+
656
+ ```bash
657
+ npm run pack:smoke
658
+ ```
659
+
660
+ ## Architecture
661
+
662
+ ```txt
663
+ src/
664
+ application/ use cases
665
+ cli/ command-line adapter
666
+ domain/ pure knowledge rules
667
+ infrastructure/ filesystem and SQLite adapters
668
+ ```
669
+
670
+ Detailed notes:
671
+
672
+ - [Agent Usage](docs/AGENT_USAGE.md)
673
+ - [Architecture](docs/ARCHITECTURE.md)
674
+ - [Release](docs/RELEASE.md)
675
+
676
+ ## Current Limits
677
+
678
+ - Semantic search uses deterministic local embeddings, not a remote model provider.
679
+ - Semantic search uses SQLite embedding buckets to narrow candidates before cosine scoring.
680
+ - `embeddingProvider` currently supports `local` and `none`.
681
+ - Link resolution is title-based inside each agent namespace, with `shared` as fallback.
682
+ - No embedded MCP server is shipped; MCP integration is done by external servers wrapping the CLI.
683
+ - HTTP API is local and unauthenticated.
684
+ - Watch mode depends on the platform filesystem watcher.
685
+
686
+ ## Alpha Scope
687
+
688
+ `0.1.0-alpha.0` is intended to prove the local-first memory loop:
689
+
690
+ - Markdown as durable memory.
691
+ - SQLite FTS plus local embeddings and semantic buckets as rebuildable retrieval index.
692
+ - CLI as the primary agent interface.
693
+ - HTTP graph API and frontend as inspection tools.
694
+ - Agent namespaces to avoid context mixing.
695
+
696
+ The alpha includes local semantic retrieval. Remote embedding providers, remote auth, advanced deduplication and graph editing are future milestones.
697
+
698
+ ## Security
699
+
700
+ Brainlink is local-first by default.
701
+
702
+ - Do not expose the HTTP server publicly without authentication.
703
+ - Brainlink blocks common secret patterns by default when adding notes. Use `--allow-sensitive` only for intentional, protected vaults.
704
+ - Do not store secrets, credentials, API keys or regulated personal data unless the vault is protected by your own storage controls.
705
+ - Treat `.brainlink/brainlink.db` as disposable derived data.
706
+
707
+ See [SECURITY.md](SECURITY.md).
708
+
709
+ ## Contributing
710
+
711
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
712
+
713
+ ## License
714
+
715
+ MIT. See [LICENSE](LICENSE).