project-brain 0.42.0 → 0.44.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 +32 -2
- package/package.json +6 -6
- package/templates/claude-tui/activity-pane/.claude-plugin/plugin.json +7 -0
- package/templates/claude-tui/activity-pane/hooks/hooks.json +1 -0
- package/templates/claude-tui/activity-pane/hooks/register.tsx +1982 -0
- package/templates/claude-tui/activity-pane/types/index.d.ts +118 -0
- package/templates/skills/brain-design-review/SKILL.md +65 -0
- package/templates/skills/brain-design-review/references/audit.md +56 -0
- package/templates/skills/brain-design-review/references/fix-loop.md +36 -0
- package/templates/skills/brain-design-review/references/probes.md +80 -0
- package/templates/skills/brain-qa-only/SKILL.md +59 -0
- package/templates/skills/brain-qa-only/references/report.md +63 -0
- package/templates/skills/brain-style/SKILL.md +50 -19
- package/templates/skills/brain-worktree/SKILL.md +18 -0
package/README.md
CHANGED
|
@@ -192,6 +192,8 @@ These five are thin wrappers over the CLI. **project-brain does not install them
|
|
|
192
192
|
|---|---|---|
|
|
193
193
|
| `/brain-audit` | *(none — host skill)* | Whole-project audit: dead code, orphan UI, broken flows, coverage gaps, plus findings by severity across security, performance and architecture |
|
|
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
|
+
| `/brain-design-review` | *(none — host skill)* | Audit a rendered UI like a designer (ten categories, AI-slop check), score it, then fix findings one commit each and re-verify |
|
|
196
|
+
| `/brain-qa-only` | *(none — host skill)* | Explore a browser, API, CLI or worker surface and report reproducible bugs with evidence; never edits product code |
|
|
195
197
|
| `/brain-commit` | *(none — host skill)* | Write a commit message in the convention the repository's own log already shows |
|
|
196
198
|
| `/brain-record` | *(none — host skill)* | Record the flow a branch touches as video evidence for a PR or ticket |
|
|
197
199
|
| `/brain-worktree` | *(none — host skill)* | Give an isolated worktree its own index (seeded from the main checkout) and its own leased port |
|
|
@@ -332,7 +334,7 @@ Every context-economy feature is its own unit in the `setup` checklist, ticked b
|
|
|
332
334
|
| `config:context-slim` | moves large user sections of CLAUDE.md into skills | nothing |
|
|
333
335
|
|
|
334
336
|
`setup` asks which parts to install — one checklist per group (Hosts, Guidance,
|
|
335
|
-
Skills, Other), asked in order, so each question is about one kind of thing — and
|
|
337
|
+
Skills, Claude TUI, Other), asked in order, so each question is about one kind of thing — and
|
|
336
338
|
remembers the answer in `~/.project-brain/setup-selection.json`. Re-running it
|
|
337
339
|
shows what is currently on disk beside what you are selecting, then a diff of
|
|
338
340
|
what will change before anything is written. A part you deselect is removed and
|
|
@@ -353,6 +355,17 @@ project-brain setup --none
|
|
|
353
355
|
|
|
354
356
|
Run `project-brain setup --with=nope` to print the list of valid ids.
|
|
355
357
|
|
|
358
|
+
#### Claude TUI
|
|
359
|
+
|
|
360
|
+
The "Claude TUI" checklist sets up Claude Code's terminal. Both units change files under `~/.claude`, so an upgrade never installs them on its own: they show up marked `NEW` and unchecked. Untick a unit to undo exactly what it wrote.
|
|
361
|
+
|
|
362
|
+
| Unit | What it changes | Undo (untick) |
|
|
363
|
+
|---|---|---|
|
|
364
|
+
| `tui:activity-pane` | Writes the `project-brain-activity` mod into a local marketplace at `~/.project-brain/claude-plugins/`, registers it in `~/.claude/settings.json` (`extraKnownMarketplaces["project-brain"]`, `enabledPlugins["project-brain-activity@project-brain"]`) and, on first install, sets `tui` to `"fullscreen"`, remembering the value it replaced; a renderer you pick later is kept on updates | Deletes both entries and the files it wrote, and puts your previous `tui` value back unless you changed it since |
|
|
365
|
+
| `tui:readable-replies` | Adds a marked block to `~/.claude/CLAUDE.md`: result first, full sentences, evidence at the end, no narration between tool calls | Deletes the block; the rest of the file stays as it was |
|
|
366
|
+
|
|
367
|
+
The activity pane is a side pane named "Actividad" with tabs for todos, commands and uncommitted changes; each changed file expands to its diff against HEAD, with line numbers, and Enter on a file name opens it in one reused nvim split (Supacode, tmux, or a Terminal window) with its diff. When subagents run, a selector shows each one with its own summary, commands and diff; the header and footer stay fixed while the body scrolls. It docks on the right only in the fullscreen renderer (`/tui fullscreen`), which is why the unit switches it on. `/activity` reopens the pane after you close it, and ctrl+o still expands tool rows in the chat. The cost it shows is Claude Code's own estimate for the session, not a bill. If another marketplace is already registered under the name `project-brain`, setup reports the unit as foreign and leaves it alone; other plugins' settings are never touched. Mods need Claude Code 2.1.287 or later, and do not load when `disableAllHooks` is set.
|
|
368
|
+
|
|
356
369
|
#### Worktree lifecycle
|
|
357
370
|
|
|
358
371
|
```bash
|
|
@@ -361,6 +374,8 @@ project-brain worktree finish [<name|path>] [--yes] # dry run unless --yes
|
|
|
361
374
|
project-brain worktree sweep [--yes] [--branches] # finish every worktree that qualifies
|
|
362
375
|
```
|
|
363
376
|
|
|
377
|
+
`create` also clones the main checkout's `node_modules` into the worktree copy-on-write (`cp -c -R` on macOS/APFS, `cp --reflink=always` on Linux), so a worktree costs ~0 extra disk instead of a second install. In a monorepo it clones every workspace package's `node_modules` too (the packages listed in `package.json` `workspaces` or `pnpm-workspace.yaml`), each only where that package exists in the worktree and has no `node_modules` yet. When the lockfile content hash matches the main checkout's, the clone is all it does. When it differs, it clones anyway and then runs the package manager's install in the worktree (`bun install`, `pnpm install`, `npm install` or `yarn install`, picked from the lockfile); because the clone is copy-on-write, the install only writes the packages that changed. That install runs the package manager's lifecycle scripts (such as `postinstall`) from the worktree's `package.json`. It has a 10-minute timeout. If it fails, times out, or the tool is missing, every clone is removed, along with any `node_modules` the install created where there was none before, so the worktree has no `node_modules` again, and `create` prints one line saying why. The Node version and platform are not compared: a clone reproduces the main checkout's folder exactly, so it works in the worktree exactly as well as it works in the main checkout. The clone is independent, so changing a dependency in the worktree never touches the main checkout. On macOS it first checks that the main checkout and the worktree are on the same APFS volume, because `cp -c` silently falls back to a full copy elsewhere (HFS+, exFAT, or across volumes). If the filesystem cannot clone, nothing is copied and `create` prints one line saying why.
|
|
378
|
+
|
|
364
379
|
A worktree is finished when it is not the main checkout, its branch is merged into the default branch (or has no commits of its own and is over an hour old), its tree is clean (a lone untracked `node_modules` symlink is tolerated), and no process is using it. `--yes` removes the directory with `git worktree remove` and the branch with `git branch -d`; it never forces and never uses `-D`, so unmerged or dirty work is never removed. `sweep` removes only worktrees under `.claude/worktrees`; it lists ones outside it as `[outside .claude]` and removes them only with `--include-outside` (or `finish <path> --yes`, since naming a worktree is explicit consent). It also lists merged branches that have no worktree (`--branches` deletes those). `create` adds `.claude/worktrees/` and the files `init` generates (`.project-brain/`, `CLAUDE.md`, `docs/modules/`, `.claude/settings.json`) to the repository's local `info/exclude`, so a fresh worktree is not dirty.
|
|
365
380
|
|
|
366
381
|
`setup` adds a default-on `SessionEnd` hook (`hooks:worktree-sweep`) that runs `worktree sweep --yes --quiet` and prints a line only when it removed something. Untick it in `setup`, or use `--without=hooks:worktree-sweep`, to opt out.
|
|
@@ -486,6 +501,18 @@ Override the table in `~/.project-brain/model-routing.json`:
|
|
|
486
501
|
|
|
487
502
|
Add `--routing-hook-strict` for enforcement: a `PreToolUse` hook that blocks a spawn naming no model and tells the model to re-issue it with one. Off by default — inheriting the session model is sometimes the right call, and the guard fails open on any payload it cannot parse. `--no-routing-hook` skips both.
|
|
488
503
|
|
|
504
|
+
#### Coding rules guard
|
|
505
|
+
|
|
506
|
+
A `PreToolUse` hook on `Edit`, `Write` and `MultiEdit` that hands an agent the installed `brain-style` skill the first time it edits a code file, so the rules arrive when code is written rather than when a prompt is typed. It reaches sub-agents too: Claude Code fires `PreToolUse` inside them, and the hook keys its once-only memory by session and agent. It is selected by default in `setup` because it is local and warn-only: it exits 0 and adds the rules as `additionalContext`, and fails open on anything it cannot read.
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
project-brain setup --with=hooks:style-guard # already on in a plain `setup`
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**Which skills apply.** A table maps file extensions to skills (code files to `brain-style`; prose, data and config files to nothing). Only a file the table cannot classify, and only when a TypeSafe token exists, goes to Jev, which sees the file path alone and answers per skill whether it applies; without a token the hook stays silent for those files. The rules text is read from `~/.claude/skills/<skill>/SKILL.md`, so editing the installed skill changes what is injected; if the skill is not installed the hook says nothing.
|
|
513
|
+
|
|
514
|
+
**Opt out.** Deselect `hooks:style-guard` in `setup`.
|
|
515
|
+
|
|
489
516
|
#### Architecture guard
|
|
490
517
|
|
|
491
518
|
A `PreToolUse` hook on `Edit`, `Write` and `MultiEdit` that checks an edit against your architecture boundaries. It is selected by default in `setup` because it is local and warn-only out of the box: the setup unit installs the hook and seeds a **global default** at `~/.project-brain/architecture.json` (hexagonal/clean preset, `"mode": "warn"`), so every project is covered with no per-project step.
|
|
@@ -528,7 +555,7 @@ A `PreToolUse` hook on `Bash` that acts only on `git commit` (including `git -C
|
|
|
528
555
|
project-brain setup --with=hooks:commit-check
|
|
529
556
|
```
|
|
530
557
|
|
|
531
|
-
`setup` ticks it by default only when a token is already configured, since the diff (first 16,000 characters) is sent to `api.typesafe.ai`. Without a token, with an empty diff, or on any error or timeout,
|
|
558
|
+
`setup` ticks it by default only when a token is already configured, since the diff (first 16,000 characters) is sent to `api.typesafe.ai`. Without a token, with an empty diff, or on any error or timeout, the Jev part does nothing. Independently of Jev, it names the source files whose staged diff adds comment lines (the `brain-style` rule is zero comments in new code); that check is local, needs no token, and only warns. The default is a warning delivered as `additionalContext`; to make the review escalation block (exit `2`, reason on stderr), write `~/.project-brain/commit-check.json`:
|
|
532
559
|
|
|
533
560
|
```json
|
|
534
561
|
{ "mode": "block" }
|
|
@@ -602,11 +629,14 @@ echo "how does auth work" | project-brain search --stdin
|
|
|
602
629
|
|
|
603
630
|
The hook only injects when it is likely to help. Before any embedding work it skips prompts that carry no code question: very short prompts (under 3 words or 15 characters, unless they name a code identifier), acknowledgements and continuations in English and Spanish ("ok", "sí", "continúa", "commit y push"), slash-command echoes, and pasted harness or agent reports. Hits scoring below 0.5 are dropped and at most 5 are kept; if nothing survives, nothing is printed. The plain CLI `search "<q>"` is not gated.
|
|
604
631
|
|
|
632
|
+
Hook output stays in the conversation, so a snippet is injected only while it is not already there: the hook reads the newest 8 MB of the session transcript (`transcript_path`), follows the live message chain back from the newest entry, and skips any snippet whose printed text, score aside, an earlier UserPromptSubmit hook output on that chain already holds. When every relevant hit is already there, nothing is printed. The skill/tool suggestion hook does the same per suggested name. Because it reads the live chain, a compaction, `/clear`, `/rewind` or an edited earlier message brings the dropped snippets back on the next prompt, and an unreadable transcript dedups nothing. No state is stored.
|
|
633
|
+
|
|
605
634
|
| Variable | Default | Effect |
|
|
606
635
|
|---|---|---|
|
|
607
636
|
| `PROJECT_BRAIN_SEARCH_MIN_SCORE` | `0.5` | Minimum reranker score (0-1) a hit needs to be injected; ignored without a reranker token, where only `PROJECT_BRAIN_SEARCH_MAX_HITS` applies |
|
|
608
637
|
| `PROJECT_BRAIN_SEARCH_MAX_HITS` | `5` | Maximum snippets injected |
|
|
609
638
|
| `PROJECT_BRAIN_SEARCH_PROMPT_FILTER` | on | Set to `0` to search every prompt, including non-code ones |
|
|
639
|
+
| `PROJECT_BRAIN_CONTEXT_DEDUP` | on | Set to `0` to inject snippets and suggestions on every prompt, even when the session already has them |
|
|
610
640
|
|
|
611
641
|
### Structural & lexical commands (`find`, `callers`, `callees`, `impact`, `trace`, `map`, `code`)
|
|
612
642
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "project-brain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.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.44.0",
|
|
53
|
+
"project-brain-linux-x64": "0.44.0",
|
|
54
|
+
"project-brain-linux-arm64": "0.44.0",
|
|
55
|
+
"project-brain-windows-x64": "0.44.0",
|
|
56
|
+
"project-brain-windows-arm64": "0.44.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/bun": "latest",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "modules": ["./register.tsx"] }
|