project-brain 0.30.2 → 0.32.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.
package/README.md
CHANGED
|
@@ -194,7 +194,7 @@ These five are thin wrappers over the CLI. **project-brain does not install them
|
|
|
194
194
|
| `/brain-okf` | *(none — host skill)* | Write an OKF concept: the reasoning behind code, anchored to a verified symbol and checkable by `okf audit` |
|
|
195
195
|
| `/brain-commit` | *(none — host skill)* | Write a commit message in the convention the repository's own log already shows |
|
|
196
196
|
| `/brain-record` | *(none — host skill)* | Record the flow a branch touches as video evidence for a PR or ticket |
|
|
197
|
-
| `/brain-worktree` | *(none — host skill)* | Give an isolated worktree its own index and its own leased port |
|
|
197
|
+
| `/brain-worktree` | *(none — host skill)* | Give an isolated worktree its own index (seeded from the main checkout) and its own leased port |
|
|
198
198
|
| `brain-style` | *(none — host skill)* | Keep written code declarative: a comment only where it says something the code cannot |
|
|
199
199
|
|
|
200
200
|
Unlike the `/brain-*` commands above, these have no CLI equivalent. They are **host skills**: the logic lives in `SKILL.md` and runs inside the assistant, which calls project-brain's MCP tools to do the work. That is what lets `brain-audit` answer "is this export dead?" with `find_callers` instead of guessing from a grep, and what lets `brain-okf` verify an anchor with `find_symbol` before writing it.
|
|
@@ -311,6 +311,26 @@ project-brain setup --none
|
|
|
311
311
|
|
|
312
312
|
Run `project-brain setup --with=nope` to print the list of valid ids.
|
|
313
313
|
|
|
314
|
+
#### Worktrees start from the main checkout's index
|
|
315
|
+
|
|
316
|
+
`init` inside a linked git worktree copies the main checkout's vectors, manifest and graph before indexing, then syncs only what differs. Every path those artefacts store is repository-relative, so one checkout's index describes another equally well, and sync re-hashes each file anyway — a stale or wrong-branch base costs a few extra embeddings, never a wrong index.
|
|
317
|
+
|
|
318
|
+
On this repository that took a worktree's first index from 2m38s to 2.1s.
|
|
319
|
+
|
|
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
|
+
|
|
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
|
+
|
|
314
334
|
#### chrome-devtools autoConnect
|
|
315
335
|
|
|
316
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.
|
|
@@ -319,6 +339,22 @@ It is the one unit that ships **unchecked**, on purpose. Attaching to your own b
|
|
|
319
339
|
|
|
320
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.
|
|
321
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
|
+
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.
|
|
357
|
+
|
|
322
358
|
#### Model routing for sub-agents
|
|
323
359
|
|
|
324
360
|
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.
|
|
3
|
+
"version": "0.32.0",
|
|
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.
|
|
53
|
-
"project-brain-linux-x64": "0.
|
|
54
|
-
"project-brain-linux-arm64": "0.
|
|
55
|
-
"project-brain-windows-x64": "0.
|
|
56
|
-
"project-brain-windows-arm64": "0.
|
|
52
|
+
"project-brain-darwin-arm64": "0.32.0",
|
|
53
|
+
"project-brain-linux-x64": "0.32.0",
|
|
54
|
+
"project-brain-linux-arm64": "0.32.0",
|
|
55
|
+
"project-brain-windows-x64": "0.32.0",
|
|
56
|
+
"project-brain-windows-arm64": "0.32.0"
|
|
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
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
|
@@ -36,6 +36,14 @@ the MCP server refuses to boot in an uninitialized worktree instead of minting a
|
|
|
36
36
|
graph there. Both turn a silent lie into a message that names the fix. Your job is to run
|
|
37
37
|
the fix before the agent hits it.
|
|
38
38
|
|
|
39
|
+
Its own brain no longer means building one from scratch. `init` in a linked worktree
|
|
40
|
+
copies the main checkout's vectors, manifest and graph first, then syncs the difference —
|
|
41
|
+
every path stored in those artefacts is repository-relative, so they describe any checkout
|
|
42
|
+
of the repository equally well. Measured on this repository: 2m38s down to 2.1s, because
|
|
43
|
+
only the files that actually differ get embedded. It copies nothing when the main checkout
|
|
44
|
+
has no index, when the worktree already has one, or when the two would disagree about the
|
|
45
|
+
embedding model, and a full index in those cases is the correct answer, not a failure.
|
|
46
|
+
|
|
39
47
|
## The one identifier rule
|
|
40
48
|
|
|
41
49
|
`project-brain worktree status --json` returns both spellings. They are not
|
|
@@ -100,6 +108,17 @@ prints the `chrome://inspect` toggle it depends on) and give each worktree its o
|
|
|
100
108
|
name on `new_page`: pages in different contexts share no cookies or storage, and every
|
|
101
109
|
page-scoped tool routes by `pageId`. A worktree then costs a context, not a browser.
|
|
102
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
|
+
|
|
103
122
|
A CDP port is a port like any other. Lease it with `port_acquire` instead of assuming
|
|
104
123
|
9222, for the same reason the app's own port is leased.
|
|
105
124
|
|