project-brain 0.31.0 → 0.32.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
@@ -319,6 +319,18 @@ On this repository that took a worktree's first index from 2m38s to 2.1s.
319
319
 
320
320
  It copies nothing, and indexes normally, when the main checkout has no index, when the worktree already has one, or when the two would disagree about the embedding model. Vectors from a different model are not comparable, and that is the one case sync could not correct on its own.
321
321
 
322
+ #### Auto-compact window
323
+
324
+ Setup sets Claude Code's `autoCompactWindow` to 400K tokens (`config:auto-compact`, checked by default). Every request re-sends the whole conversation, and those cache reads count against your plan. A 1M-context model left on its default compacts near 967K, so a long session keeps re-reading a far larger context than the work needs. With the cap it compacts near 387K. 200K models aren't affected.
325
+
326
+ If you already set `autoCompactWindow` to a value of your own, setup reports it as foreign and leaves it alone. To use the full window for one session, start it with `claude --autocompact 1000000`. The setting ranks below that flag, which is why setup doesn't write the `CLAUDE_CODE_AUTO_COMPACT_WINDOW` env var: the env var outranks the flag and would take the option away.
327
+
328
+ #### Commit attribution
329
+
330
+ Claude Code appends `Co-Authored-By` and `Claude-Session: <link>` trailers to the commits and PRs it writes. The harness adds them, not the model, so a rule in a skill can't keep them out. `config:no-commit-attribution` sets `"attribution": {"commit": "", "pr": ""}` in `~/.claude/settings.json`, and that stops them.
331
+
332
+ It ships **unchecked**: it changes what every commit and PR says in every repo on the machine, and some teams want the trailer. Attribution text you already wrote is reported as foreign and left alone.
333
+
322
334
  #### chrome-devtools autoConnect
323
335
 
324
336
  If a detected host runs the [chrome-devtools MCP server](https://github.com/ChromeDevTools/chrome-devtools-mcp) without `--autoConnect`, setup offers to add it (`config:chrome-autoconnect`). Without the flag those browser tools launch a throwaway, logged-out Chrome profile; with it they drive the Chrome you are already signed into, which is the only way to reach a flow behind a login.
@@ -327,6 +339,24 @@ It is the one unit that ships **unchecked**, on purpose. Attaching to your own b
327
339
 
328
340
  The flag is only half of it — Chrome refuses the connection until you open `chrome://inspect/#remote-debugging` and turn on "Allow remote debugging for this browser instance" yourself. Setup never flips that toggle; it prints the step after writing the flag. Entries already wired another way (`--browserUrl`, `--wsEndpoint`) or explicitly opted out (`--no-auto-connect`) are left untouched.
329
341
 
342
+ It also costs something the config file does not show, so setup prints that too. An attached server holds the CDP connection for its whole life and buffers what the browser reports on it across every tab; nothing releases it early, because your own Chrome outlives the session. Measured on one machine: two servers attached for ~2 days reached 1.6 GB and 742 MB of RSS, and kept growing after Chrome had been closed. And a host runs one MCP server **per session**, so the flag written once buys one attachment per open session — six sessions is six of them. Restarting a session is what frees its attachment.
343
+
344
+ If that multiplication is the problem rather than the flag itself, the next unit converts it.
345
+
346
+ #### chrome-devtools shared server
347
+
348
+ `service:chrome-shared-server` replaces one server per session with one server for every session. It takes the command a detected host already runs, puts it behind an HTTP bridge held open by a login service, and rewrites each host entry to point at `http://127.0.0.1:39100/mcp`. Sessions then cost a client connection each; the machine carries one process and one CDP attachment.
349
+
350
+ It is **unchecked** by default, and it is the only unit that installs an OS service (launchd on macOS, a systemd user unit on Linux; elsewhere it does not appear) and a Python tool. Both are answers to give on purpose.
351
+
352
+ The bridge is [`mcp-proxy`](https://github.com/sparfenyuk/mcp-proxy), installed with `uv` if it is missing. It calls `stdio_client` once at startup and reuses that session for every client, so all clients genuinely share one child, and its JSON-RPC ids cannot collide because it proxies at the MCP semantic layer rather than relaying bytes. Setup pins its SDK below 2: installed without that constraint, the tool resolves an SDK where `request_ctx` no longer exists and every invocation dies at import.
353
+
354
+ The command moves across **verbatim**, so whatever flags you already answered for — `--autoConnect` included — carry over, and this unit decides none of them. Removing it restores each entry from a record written at install rather than reconstructing a command.
355
+
356
+ If a host already points at a bridge you set up yourself, under any service name, setup reads that service's command instead. autoConnect then shows `current` when the flag is in that command (`foreign` when it isn't; edit it there), and this unit shows `foreign`: the service is yours, and setup never installs over it or removes it. A service counts only when some host entry's URL uses its `--port`.
357
+
358
+ Two limits worth knowing. Sharing the server shares its state: one page list visible to every session, one profile, and process-level flags (`--headless`, `--viewport`, `--blockedUrlPattern`) that can no longer differ per session; `--pageIdRouting`, on by default, is what stops sessions from acting on each other's tabs. And collapsing N attachments to one does not bound how large that one grows — a single attached server was the 1.6 GB measurement — so setup prints the restart command for your platform when it finishes.
359
+
330
360
  #### Model routing for sub-agents
331
361
 
332
362
  Setup also writes model-routing guidance into each detected host's rules file: which **tier** — `fast`, `balanced`, or `deep` — a delegated sub-agent should run at for a given kind of task, and how to set that tier *on that host*.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-brain",
3
- "version": "0.31.0",
3
+ "version": "0.32.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.31.0",
53
- "project-brain-linux-x64": "0.31.0",
54
- "project-brain-linux-arm64": "0.31.0",
55
- "project-brain-windows-x64": "0.31.0",
56
- "project-brain-windows-arm64": "0.31.0"
52
+ "project-brain-darwin-arm64": "0.32.1",
53
+ "project-brain-linux-x64": "0.32.1",
54
+ "project-brain-linux-arm64": "0.32.1",
55
+ "project-brain-windows-x64": "0.32.1",
56
+ "project-brain-windows-arm64": "0.32.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/bun": "latest",
@@ -27,9 +27,11 @@ stay there.
27
27
 
28
28
  ### Escalate, don't start deep
29
29
 
30
- Run the fast tier first. On a failed or empty result, retry one tier up. Two
31
- fast attempts plus one balanced still costs less than one deep attempt, and
32
- most delegations never need the escalation.
30
+ Run the cheapest tier the task table allows. On a failed or empty result,
31
+ retry one tier up. The escalation pays because most delegations never need it,
32
+ not because the tiers are far apart in price — see Relative cost. A task the
33
+ table already puts at `deep` goes there first: a wrong answer from a cheaper
34
+ tier costs a retry plus the parent's turns spent acting on it.
33
35
 
34
36
  ### Verification must be asymmetric
35
37
 
@@ -42,8 +44,10 @@ better reader; it is a different one.
42
44
 
43
45
  Where the host exposes a reasoning-effort setting, raise it before raising the
44
46
  tier: balanced at high effort often beats deep at low effort, and costs less.
45
- Tier and effort are independent knobs, and only one of them is usually the
46
- answer.
47
+ Current models at low or medium effort often match the previous generation at
48
+ high, so start low for routine work and raise it only when the result falls
49
+ short. Tier and effort are independent knobs, and only one of them is usually
50
+ the answer.
47
51
 
48
52
  ### Run independent delegations in parallel
49
53
 
@@ -53,9 +57,11 @@ cost the same tokens as three in sequence, and a third of the wall-clock.
53
57
 
54
58
  ### Relative cost
55
59
 
56
- Order of magnitude, not a price list: fast ≈ 1×, balanced ≈ 5×, deep ≈ 25×.
57
- Enough to calibrate a decision, coarse enough to stay true after a price
58
- change.
60
+ Per token, at list price: fast ≈ 1×, balanced ≈ 2×, deep ≈ 4×. The tiers are
61
+ closer than they used to be, so the per-token price rarely settles the choice.
62
+ What does is the tokens spent: a deeper tier at high effort thinks longer, and
63
+ a cheap tier that gets it wrong costs a retry and the parent's turns acting on
64
+ it. Judge by the cost of the finished task, not of one call.
59
65
 
60
66
  ### project-brain's own routing
61
67
 
@@ -58,7 +58,7 @@ The shape is the easy half. These are what make a message look native:
58
58
  - **Trailing period.** Copy the dominant choice. Most repos omit it.
59
59
  - **Subject length.** Match the observed median rather than a textbook 50 characters.
60
60
  - **Body presence.** If most non-trivial commits carry a body, write one. If the log is subjects-only, do not start a new tradition unprompted.
61
- - **Trailers.** Reuse only trailers that already appear (`Refs:`, `Closes #`, `BREAKING CHANGE:`). **Never add AI or co-author attribution unless the history already shows it** — introducing `Co-Authored-By` into a repo that has never used it is a visible, unrequested change to the project's record.
61
+ - **Trailers.** Reuse only trailers that already appear (`Refs:`, `Closes #`, `BREAKING CHANGE:`). **Never add AI or co-author attribution unless the history already shows it** — introducing `Co-Authored-By` into a repo that has never used it is a visible, unrequested change to the project's record. A `Co-Authored-By` or `Claude-Session:` line the host appends on its own is not yours to write or strip; `project-brain setup` turns it off through the `config:no-commit-attribution` unit.
62
62
 
63
63
  ## Step 3 — Write the message about the change
64
64
 
@@ -108,6 +108,17 @@ prints the `chrome://inspect` toggle it depends on) and give each worktree its o
108
108
  name on `new_page`: pages in different contexts share no cookies or storage, and every
109
109
  page-scoped tool routes by `pageId`. A worktree then costs a context, not a browser.
110
110
 
111
+ That shares the browser, not the server. Each session still attaches to it separately, and
112
+ an attachment holds its CDP connection for the session's whole life while buffering what
113
+ the browser reports — measured at 1.6 GB after ~2 days, still growing after Chrome closed.
114
+ Six sessions is six of those.
115
+
116
+ To share the SERVER too, `project-brain setup` offers `service:chrome-shared-server`: one
117
+ `chrome-devtools-mcp` behind an HTTP bridge, held open by a login service, with every host
118
+ entry pointed at the URL instead of spawning its own. Sessions then cost a connection each.
119
+ Nothing bounds how large that one server grows, so it still wants restarting between long
120
+ stretches of browser work — setup prints the command for your platform.
121
+
111
122
  A CDP port is a port like any other. Lease it with `port_acquire` instead of assuming
112
123
  9222, for the same reason the app's own port is leased.
113
124