project-brain 0.32.0 → 0.33.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 +19 -0
- package/package.json +6 -6
- package/templates/skills/brain-audit/SKILL.md +11 -7
package/README.md
CHANGED
|
@@ -353,6 +353,8 @@ The bridge is [`mcp-proxy`](https://github.com/sparfenyuk/mcp-proxy), installed
|
|
|
353
353
|
|
|
354
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
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
|
+
|
|
356
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.
|
|
357
359
|
|
|
358
360
|
#### Model routing for sub-agents
|
|
@@ -427,6 +429,19 @@ Check system health: Ollama availability, LanceDB status, and staleness of the i
|
|
|
427
429
|
project-brain health
|
|
428
430
|
```
|
|
429
431
|
|
|
432
|
+
### `bench` — measure retrieval quality
|
|
433
|
+
|
|
434
|
+
Published embedding leaderboards score a different corpus and a different task. A percent-or-two delta on someone else's benchmark says nothing about whether YOUR queries still surface the right file after changing model, dimension or chunking — so `bench` measures against ground truth from *this* repository instead.
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
project-brain bench mine [--out .project-brain/bench/queries.jsonl] [--limit N] # mine ground truth from git history
|
|
438
|
+
project-brain bench .project-brain/bench/queries.jsonl [--project <id>] [--pipeline full|hybrid]
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
`bench mine` walks non-merge commits and turns each one into a query: the commit subject (plus a short first body paragraph) as the query, the files it changed as the expected source(s). It skips release/version-bump commits, mass edits (more than ~8 files), and commits that touched only non-indexed files (lockfiles, `package.json`, `CHANGELOG.md`). Deterministic — the same repo history mines the same file every time.
|
|
442
|
+
|
|
443
|
+
`bench` then runs every query and reports recall@1/5/10 and MRR. `--pipeline hybrid` (default) measures `hybridSearch` alone — the retrieval signal in isolation. `--pipeline full` runs the exact path `search_context` runs (threshold + MMR + token budget), scoring what an agent actually receives, at the cost of conflating retrieval quality with post-processing behavior.
|
|
444
|
+
|
|
430
445
|
### `search`
|
|
431
446
|
|
|
432
447
|
Search the indexed context and print compact results. Primarily used internally: `init` installs a `UserPromptSubmit` hook (`project-brain search --stdin`) in `.claude/settings.json` that auto-injects relevant context on every prompt, so retrieval is deterministic rather than relying on the AI to call a tool.
|
|
@@ -460,8 +475,12 @@ project-brain okf validate [dir] # conformance (SPEC §11). Offline.
|
|
|
460
475
|
project-brain okf sync [dir] # index the concepts so search returns them
|
|
461
476
|
project-brain okf audit [dir] # cross-check the bundle against the code graph
|
|
462
477
|
project-brain okf audit --symbol <name> # which concepts to re-read after <name> changes
|
|
478
|
+
project-brain okf audit --json # one JSON object instead of prose, for CI/tooling
|
|
479
|
+
project-brain okf audit --judge # ask Claude whether a stale finding's reasoning still holds
|
|
463
480
|
```
|
|
464
481
|
|
|
482
|
+
`--judge` is opt-in and costs money: it sends `claude-opus-5` the concept's prose plus the actual code diff, for every `stale` finding where the code moved but the reasoning might not have (never for `uncommitted`, `expired`, or a broken anchor). Needs Anthropic credentials (`ANTHROPIC_API_KEY` or `ant auth login`) — without them the run aborts judging and falls back to the plain, unjudged audit. A "still holds" verdict never auto-attests; it only moves the finding into a non-failing `judged` backlog for a human to confirm with a `verified` entry.
|
|
483
|
+
|
|
465
484
|
`init` writes `index.md` and `log.md` and stops — **no seeded concepts**, because a bundle shipped with examples makes the first `audit` report coverage gaps across the whole repo. Type directories appear when the first concept needs them.
|
|
466
485
|
|
|
467
486
|
It also re-renders `CLAUDE.md`. `project-brain init` runs before any bundle exists, so the knowledge-bundle section is omitted then; `okf init` adds it once there is something to point at. That section asks the assistant to **decide, at the end of a task, whether anything belongs in the bundle** — and says plainly that most tasks produce nothing. A checkpoint that feels obliged to produce a file is a concept mill, and noise in a knowledge bundle is worse than gaps. Projects with no bundle never see the instruction.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "project-brain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.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.33.0",
|
|
53
|
+
"project-brain-linux-x64": "0.33.0",
|
|
54
|
+
"project-brain-linux-arm64": "0.33.0",
|
|
55
|
+
"project-brain-windows-x64": "0.33.0",
|
|
56
|
+
"project-brain-windows-arm64": "0.33.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/bun": "latest",
|
|
@@ -287,15 +287,17 @@ The absence gates (`Observability`, `Testing`, `Design System`, `Type Safety`, `
|
|
|
287
287
|
|
|
288
288
|
1. Discovery — stack, architecture, feature map, via the routing table.
|
|
289
289
|
2. Apply gates → proposed module set with per-module rationale.
|
|
290
|
-
3. **Present the proposal and wait for confirmation.** Report the token implication of the chosen set.
|
|
290
|
+
3. **Present the proposal and wait for confirmation.** Report the token implication of the chosen set as a range, and label it an estimate: sum the line counts of the confirmed modules' reference files, then add an order-of-magnitude probe cost per module on top. A number with no method behind it is a guess wearing a token count.
|
|
291
291
|
4. **Offer `Runtime` separately, after the module set is settled, and wait.** State that enabling it executes the project's code on this machine, list the declared commands it would run, and name the ones it will not touch. Declining is normal and costs only the `executed` tier. Never fold this into step 3 — a user confirming twenty static modules has not consented to run anything.
|
|
292
292
|
- **4b. Offer `Browser` separately, after `Runtime`, and wait.** Only when a UI or HTML entry point was detected and a browser tool is present. Name the target URL and where it came from, the tool filling the walker and measurer roles, whether any role runs in the user's real browser session, the candidate flows (up to five, ranked by product centrality), and the total pass count. Wait for the flow list to be confirmed before any browser opens. Declining costs only the `observed` tier.
|
|
293
|
-
5.
|
|
294
|
-
6. Collect findings using the schema above, each with its evidence tier and its ruled-out alternative. Leave `Refutation` empty; step
|
|
295
|
-
7. **
|
|
296
|
-
8.
|
|
297
|
-
9.
|
|
298
|
-
10.
|
|
293
|
+
5. Dispatch each confirmed module — or a small batch of cheap, related modules — to its own subagent. Its brief: the module's `references/<module>.md` path, the discovery summary from step 1, the finding schema, and a hard cap on the reply — schema-shaped findings only, no tool transcripts, no reasoning trace. The subagent reads only its reference file, verifies against real code — project-brain first, `Read` only to confirm lines it points at — and **runs the probe each check names**; a check whose probe was not run produces no finding, not an `inferred` one. Route mechanical sweeps (literal counts, orphan-asset greps, token adoption) to a fast model tier and reasoning-heavy modules (security, reachability, architecture) to a stronger one — the same split the Refutation Mode table already tracks by model id, so record it there instead of a second place. The main thread keeps discovery and aggregation; it does not read module references or run probes itself. Where the host has no subagent mechanism, fall back to running modules sequentially in the main context and say so in the Executive Summary.
|
|
294
|
+
6. Collect findings using the schema above, each with its evidence tier and its ruled-out alternative. Leave `Refutation` empty; refutation (step 9) fills it.
|
|
295
|
+
7. **Deduplicate before refuting.** Two findings are the same finding when they share a file with overlapping line ranges, or share a symbol and the same root cause — even when two different modules reported it. Keep the copy with the higher severity, or the stronger evidence tier on a tie, and list every module that reported it. This runs before the Refutation Manifest so no refuter is ever paid to kill a duplicate.
|
|
296
|
+
8. **Present the Refutation Manifest and wait** — deduplicated findings collected, how many are eligible at Medium or above, how many are left raw below threshold, how many refuters that means, and the resolved mode with model ids where they are known. Answers are `all`, `critical+high only`, or `none`. A user who replied `refute all` at step 3 has pre-authorised it; print the manifest as a notice and continue. `none` stamps every finding `declined by user` — it does not silently skip the stage.
|
|
297
|
+
9. Refute. One subagent per eligible finding, fresh context, the brief and nothing else — on a different model than the one that produced the finding, when the host lets you choose; the Refutation Mode table already records the model ids this yields, so name it there and not twice. Escalate to a second refuter only on `undetermined` at Critical or High, telling it which probes were already inconclusive.
|
|
298
|
+
10. Apply the verdicts: drop `refuted` findings into the ledger, reduce `weakened` ones to the severity the refuter named, cap `undetermined` at Medium, and record the mode on every finding. Run one more light dedup pass, restricted to findings whose severity changed under refutation — step 7 saw them at their pre-refutation severity and could not have grouped them correctly.
|
|
299
|
+
11. Record every module's `Out of static reach` items that mattered — they become Coverage Gaps, not silent omissions.
|
|
300
|
+
12. **Persist the report.** Once the Output Contract is filled, write the full report to `.project-brain/audits/<YYYY-MM-DD>-audit.md` in the audited repo — and the SARIF file next to it when SARIF emission is on — then print the path. A report this size does not survive the next context compaction, and a dated file gives the next audit something to diff against. When a previous report exists in that directory, the Executive Summary names new, resolved, and unchanged findings by fingerprint, reusing the SARIF fingerprint definition even when SARIF itself is off.
|
|
299
301
|
|
|
300
302
|
## Output Contract
|
|
301
303
|
|
|
@@ -313,6 +315,8 @@ The Executive Summary carries one line naming the refutation mode, both model id
|
|
|
313
315
|
|
|
314
316
|
Never invent issues — every finding is backed by repo evidence. Visual quality has a hard static ceiling: the modules say what the code determines and list the rest under Coverage Gaps. An aesthetic verdict with no evidence behind it is the one failure mode this audit cannot recover from, because the user has no way to tell it apart from a real finding.
|
|
315
317
|
|
|
318
|
+
The finished report is written to disk, not left in the transcript — see Execution Steps step 12 for the path and the diff-against-previous-run contract. This section governs its shape; that step governs its survival.
|
|
319
|
+
|
|
316
320
|
## SARIF Emission (optional)
|
|
317
321
|
|
|
318
322
|
Prose is the default and remains the default — most readers of this audit read the report themselves, and turning SARIF on does not change or replace a single line of the Output Contract above. SARIF is an additional, opt-in artefact for teams that want findings in code scanning: pass `--sarif <path>` (or the session equivalent) to also emit a SARIF 2.1.0 document alongside the prose report.
|