project-brain 0.17.0 → 0.18.1

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 CHANGED
@@ -6,25 +6,34 @@ project-brain indexes your project files into a local LanceDB vector store using
6
6
 
7
7
  ## Quick Start
8
8
 
9
+ **1. Install globally.** Pick *one* line — they all deliver the same self-contained binary:
10
+
9
11
  ```bash
10
- # 1. Install globally — pick one
11
- curl -fsSL https://raw.githubusercontent.com/jcsoftdev/project-brain/main/scripts/install.sh | sh
12
- bun install -g project-brain # or npm / pnpm / yarn
13
- brew install jcsoftdev/tap/project-brain
12
+ brew install jcsoftdev/tap/project-brain # Homebrew
13
+ curl -fsSL https://raw.githubusercontent.com/jcsoftdev/project-brain/main/scripts/install.sh | sh # no package manager
14
+ bun install -g project-brain # or npm / pnpm / yarn
15
+ ```
14
16
 
15
- # 2. One-time: register in your AI tools (Claude, Codex, Cursor, Gemini, Windsurf, Zed, VS Code)
16
- # Also installs the brain-audit and brain-okf host skills. --no-skills to opt out.
17
+ **2. Register in your AI tools.** Once per machine — Claude, Codex, Cursor, Gemini, Windsurf, Zed, VS Code. Also installs the `brain-audit` and `brain-okf` host skills (`--no-skills` to opt out):
18
+
19
+ ```bash
17
20
  project-brain setup
21
+ ```
18
22
 
19
- # 3. Per-project: initialize, index, and install git hook
23
+ **3. Initialize a project.** Detects the stack, indexes it, installs the git hook:
24
+
25
+ ```bash
20
26
  cd my-project
21
27
  project-brain init
28
+ ```
22
29
 
23
- # 4. Optional, per-project: start a knowledge bundle for the *why*
30
+ **4. Optional — start a knowledge bundle** for the *why*, not the *what*:
31
+
32
+ ```bash
24
33
  project-brain okf init
25
34
  ```
26
35
 
27
- The `curl` line needs no package manager at all — the binary ships self-contained. See [Install](#install) for every channel and the platforms each covers.
36
+ See [Install](#install) for every channel, the platforms each covers, and how upgrades work.
28
37
 
29
38
  After `init`, the following run **automatically** without any extra steps:
30
39
 
@@ -42,44 +51,46 @@ After `init`, the following run **automatically** without any extra steps:
42
51
 
43
52
  ## Install
44
53
 
45
- ### Registry (recommended)
54
+ Every channel ships the same artifact: a `bun build --compile` binary with the
55
+ runtime, WASM grammars and templates embedded. Nothing else is needed at runtime.
46
56
 
47
- ```bash
48
- bun install -g project-brain
49
- # or
50
- npm install -g project-brain
51
- ```
57
+ | Channel | Command | Platforms | Upgrade with |
58
+ |---|---|---|---|
59
+ | **Homebrew** | `brew install jcsoftdev/tap/project-brain` | macOS (Apple Silicon), Linux | `brew upgrade project-brain` |
60
+ | **curl** | see [below](#curl-no-package-manager) | macOS (Apple Silicon), Linux x64/arm64 | re-run the installer |
61
+ | **Registry** | `bun install -g project-brain` (or npm / pnpm / yarn) | all, including Intel macOS and Windows | `project-brain update` |
62
+ | **Scoop** | `scoop install project-brain` — *bucket not published yet* | Windows | `scoop update project-brain` |
52
63
 
53
- ### No package manager
64
+ **Intel macOS**: no prebuilt binary. Homebrew and curl both refuse rather than
65
+ hand you an arm64 binary — use a registry install there.
54
66
 
55
- The published binary is a `bun build --compile` artifact with the runtime, WASM grammars and templates embedded, so it needs no Node, no Bun, and nothing else at runtime.
67
+ `project-brain update` reads the binary's own path to work out which channel
68
+ installed it and prints the matching command. For a channel it cannot drive it
69
+ says so rather than guessing: a guessed `npm install -g` would leave a second
70
+ copy shadowing the first.
71
+
72
+ ### curl (no package manager)
56
73
 
57
74
  ```bash
58
75
  curl -fsSL https://raw.githubusercontent.com/jcsoftdev/project-brain/main/scripts/install.sh | sh
59
76
  ```
60
77
 
61
- Installs to `~/.local/bin` (override with `BRAIN_INSTALL_DIR`). Pin a version with `BRAIN_VERSION=v0.16.0`. To update, re-run it.
62
-
63
- Apple Silicon, Linux x64 and Linux arm64 have published binaries. **Intel macOS does not** — the script says so instead of handing you an arm64 binary; use a registry install there.
64
-
65
- ### Homebrew / Scoop
66
-
67
- Each release attaches a generated `project-brain.rb` and `project-brain.json`, checksummed against the real assets. Once a tap and bucket exist:
68
-
69
- ```bash
70
- brew install jcsoftdev/tap/project-brain # macOS (Apple Silicon), Linux
71
- scoop install project-brain # Windows
72
- ```
78
+ | Variable | Default | Purpose |
79
+ |---|---|---|
80
+ | `BRAIN_INSTALL_DIR` | `~/.local/bin` | Where the binary lands |
81
+ | `BRAIN_VERSION` | latest release | Pin a tag, e.g. `v0.17.0` |
73
82
 
74
- Whichever channel you use, `project-brain update` reads the binary's own path to work out how it was installed and prints the right command — `brew upgrade`, `scoop update`, or the package manager's. For a channel it cannot drive it says so rather than guessing, because a guessed `npm install -g` would leave a second copy shadowing the first.
83
+ The script verifies the downloaded binary actually runs on your machine before
84
+ moving it onto your PATH, so a wrong-arch or truncated download fails at install
85
+ time instead of at first use.
75
86
 
76
87
  ### Build it yourself
77
88
 
78
89
  ```bash
79
- git clone https://github.com/jcsoftdev/project-brain
90
+ git clone git@github.com:jcsoftdev/project-brain.git # or https://github.com/jcsoftdev/project-brain.git
80
91
  cd project-brain
81
92
  bun build ./src/cli.ts ./src/parser/worker.ts --compile --outfile project-brain
82
- ./project-brain --help
93
+ ./project-brain --version
83
94
  ```
84
95
 
85
96
  `worker.ts` is a required second entrypoint — without it the parser's worker pool cannot resolve its own imports inside the compiled binary and silently extracts zero symbols.
@@ -359,6 +370,7 @@ BRAIN_HTTP_TOKEN=your-secret project-brain serve --http [--port 3000]
359
370
  | `BRAIN_EMBED_CONCURRENCY` | `1` | `1`–`16` | Concurrent embed requests. Defaults to `1` — a single local Ollama instance is GPU-compute-bound, so concurrency>1 adds no throughput, only false-timeout risk. Raise it only against a genuine multi-host pool (`BRAIN_OLLAMA_HOSTS`) or remote inference API where separate hardware actually runs requests in parallel. |
360
371
  | `BRAIN_OLLAMA_HOSTS` | — | comma-separated URLs | Pool of Ollama hosts for round-robin embedding (e.g. `http://127.0.0.1:11434,http://127.0.0.1:11435`). Falls through to the next host on failure; only `null`s when every host fails. |
361
372
  | `BRAIN_EMBED_MODEL` | `qwen3-embedding:0.6b` | model name | Override the embedding model (see table above). |
373
+ | `BRAIN_SYNC_WINDOW_FILES` | `200` | `1`+ | Files held in memory at once during a sync. Their content, chunks and vectors are live together and released when the window is stored, so peak memory tracks this number rather than repository size. Lower it on a memory-constrained host; raising it buys nothing once a window already fills an embed batch. |
362
374
 
363
375
  A partial or total embed failure makes `sync`/`reindex` exit non-zero (`1`) — check the exit code in automation (CI, git hooks), not just stderr text.
364
376
 
package/bin/project-brain CHANGED
@@ -42,7 +42,19 @@ try {
42
42
  // Setting process.env mid-process (in this parent, or inside cli.ts)
43
43
  // is too late and the "vector index statistics include centroids" WARN
44
44
  // still fires.
45
- env: { ...process.env, LANCE_INCLUDE_VECTOR_CENTROIDS: process.env.LANCE_INCLUDE_VECTOR_CENTROIDS ?? "false" },
45
+ env: {
46
+ ...process.env,
47
+ LANCE_INCLUDE_VECTOR_CENTROIDS: process.env.LANCE_INCLUDE_VECTOR_CENTROIDS ?? "false",
48
+ // Which pid the long-running `serve` should treat as its client.
49
+ //
50
+ // execFileSync blocks this shim for the child's whole life, so the child's
51
+ // parent is THIS process, not the AI tool that launched it. A server that
52
+ // watched its parent would see the shim alive forever and never notice the
53
+ // tool crashing — the leak that left servers running for days. Hand down
54
+ // our own parent so it watches the tool. Already-set wins, so a caller can
55
+ // point it somewhere deliberately.
56
+ BRAIN_CLIENT_PID: process.env.BRAIN_CLIENT_PID ?? String(process.ppid),
57
+ },
46
58
  });
47
59
  } catch (err) {
48
60
  if (err && typeof err.status === "number") process.exit(err.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-brain",
3
- "version": "0.17.0",
3
+ "version": "0.18.1",
4
4
  "type": "module",
5
5
  "description": "Local-first MCP server that gives AI tools semantic memory of your codebase.",
6
6
  "author": "jcsoftdev",
@@ -49,11 +49,11 @@
49
49
  "zod": "^4.4.3"
50
50
  },
51
51
  "optionalDependencies": {
52
- "project-brain-darwin-arm64": "0.17.0",
53
- "project-brain-linux-x64": "0.17.0",
54
- "project-brain-linux-arm64": "0.17.0",
55
- "project-brain-windows-x64": "0.17.0",
56
- "project-brain-windows-arm64": "0.17.0"
52
+ "project-brain-darwin-arm64": "0.18.1",
53
+ "project-brain-linux-x64": "0.18.1",
54
+ "project-brain-linux-arm64": "0.18.1",
55
+ "project-brain-windows-x64": "0.18.1",
56
+ "project-brain-windows-arm64": "0.18.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/bun": "latest",