You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ece85d5
Browse filesBrowse the repository at this point in the historyBrowse files
Release 1.1.0: plugin/ layout, new tools, tests, CI, restructured skills
Packaging
- Move everything the plugin installs under plugin/ (manifest, MCP server,
skills, examples, hooks, scripts, evals); marketplace source -> ./plugin.
Install size drops from 68 MB to ~2 MB; papers/tutorials/usecases stay in
the repo only
- uv lockfile for the server script; SessionStart hook pre-warms the uv
environment so the first MCP connection does not time out
- /braina:check skill + scripts/smoke_test.py for installation self-checks
- Remove duplicate check_frites.py / check_hoi.py; check_env.py prints the
JAX backend
- CHANGELOG.md; version 1.1.0
MCP tools (22 -> 34)
- HOI: expose method, samples_path and bootstrap CIs (n_boots,
ci_percentiles, random_state -> <output>_ci.nc) on every metric; add
hoi_tc, hoi_sinfo, hoi_infotot, hoi_transfer_entropy, hoi_dotot,
hoi_redundancy_phiid, hoi_atoms_phiid; label the appended target y in
multiplet names
- Frites: norm/n_jobs (covgc), estimator (dfc), normalized (ccf), n_jobs on
all conn tools; mcp/cluster_th/cluster_alpha/random_state/estimator on
frites_wf_mi and frites_wf_conn_comod; frites_wf_mi_combine via
save_workflow pickles; frites_conn_reshape and frites_conn_net;
frites_sim_ar gains sf/dt/n_std/stim_onset/random_state and stores sfreq
- convert_to_nc (.fif epochs, .mat, .csv, .npy -> labelled .nc) and
plot_result (PNG of any output)
Tests and evals
- pytest suite (tests/, run with uv run tests/run_tests.py) covering all
34 tools; GitHub Actions CI; six claude plugin eval cases mirroring
TESTING.md
Skills
- Short SKILL.md per skill plus references/ files read on demand; document
the new tools and parameters, drop limitations fixed since 1.0.0, cite
papers by their GitHub URL; README, CLAUDE.md and TESTING.md updated
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+35-14Lines changed: 35 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,32 +15,52 @@ The user may be a novice in computational neuroscience. Explain mathematical con
15
15
uv run check_env.py
16
16
17
17
# Run the verification test suite for Frites + HOI
18
-
uv run mcp/verify_libs.py
18
+
uv run plugin/mcp/verify_libs.py
19
+
20
+
# Run the pytest suite over all MCP tools (synthetic data, ~30 s)
21
+
uv run tests/run_tests.py
22
+
23
+
# End-to-end smoke test of the installation (what /braina:check runs)
24
+
uv run plugin/scripts/smoke_test.py
19
25
20
26
# Launch the MCP server standalone
21
-
uv run mcp/braina_mcp.py
27
+
uv run plugin/mcp/braina_mcp.py
28
+
29
+
# Refresh the server lockfile after editing its dependency block
30
+
uv lock --script plugin/mcp/braina_mcp.py
31
+
32
+
# Behavioural evals of the skills
33
+
claude plugin eval plugin
22
34
23
35
# Run any example script (all use uv inline dependencies)
24
-
uv run examples/frites/conn/plot_covgc.py
25
-
uv run examples/hoi/metrics/plot_oinfo.py
36
+
uv run plugin/examples/frites/conn/plot_covgc.py
37
+
uv run plugin/examples/hoi/metrics/plot_oinfo.py
26
38
```
27
39
28
40
All scripts use `uv` with PEP 723 inline script metadata (`# /// script` blocks) for dependency management — no virtualenv setup needed.
29
41
30
42
## Architecture
31
43
32
-
### MCP Server (`mcp/braina_mcp.py`)
44
+
### Repository layout
33
45
34
-
The central integration layer. A FastMCP server exposing 22 tools that wrap Frites and HOI library functions with standardized file-based I/O. Each tool takes file paths as input (`.npy` or `.nc`), calls the underlying library function, saves results, and returns a text summary (shape, coords, min/mean/max). Exceptions are caught and returned as `Error in <tool>: ...` strings. The server is declared in `.claude-plugin/plugin.json` under `mcpServers`. This is registered as a Claude Code MCP server (`braina`).
46
+
Everything the plugin installs lives under `plugin/` (manifest, MCP server + lockfile, skills, examples, hooks, scripts, evals); the marketplace points at it (`.claude-plugin/marketplace.json`, `source: ./plugin`). Papers, tutorials, use cases, tests and CI stay at the root and are not installed.
47
+
48
+
### MCP Server (`plugin/mcp/braina_mcp.py`)
49
+
50
+
The central integration layer. A FastMCP server exposing 34 tools that wrap Frites and HOI library functions with standardized file-based I/O. Each tool takes file paths as input (`.npy` or `.nc`), calls the underlying library function, saves results, and returns a text summary (shape, coords, min/mean/max). Exceptions are caught and returned as `Error in <tool>: ...` strings. The server is declared in `plugin/.claude-plugin/plugin.json` under `mcpServers`; `plugin/hooks/hooks.json` pre-warms its uv environment at session start. This is registered as a Claude Code MCP server (`braina`).
35
51
36
52
`load_data`/`save_data` are internal I/O helpers (not exposed as MCP tools) that handle the `.npy` vs `.nc` dispatch for every tool.
Skills: `orientation`, `frites-connectivity`, `hoi-metrics`, `workflows`, `check` — each a short `SKILL.md` plus `references/*.md` read on demand. When adding or changing a tool, update the matching reference file, the pytest suite (`tests/test_mcp_tools.py`, which asserts the tool count) and `CHANGELOG.md`.
44
64
45
65
### Core Libraries
46
66
@@ -60,9 +80,10 @@ Tool categories:
60
80
61
81
## Working in this Repo
62
82
63
-
- Consult `/examples` for usage patterns before writing new analysis code.
64
-
- Read `mcp/braina_mcp.py` for canonical function signatures and parameter conventions.
83
+
- Consult `plugin/examples` for usage patterns before writing new analysis code.
84
+
- Read `plugin/mcp/braina_mcp.py` for canonical function signatures and parameter conventions.
65
85
- For library internals, read source on GitHub via `gh api` or `gh browse` against `brainets/frites` and `brainets/hoi`.
66
-
- When writing analysis scripts, test with small dummy data first (see `mcp/verify_libs.py` for patterns).
86
+
- When writing analysis scripts, test with small dummy data first (see `plugin/mcp/verify_libs.py` for patterns).
67
87
- Prefer JAX for high-performance math in HOI contexts; use xarray/MNE structures for Frites connectivity.
88
+
- Papers are cited in the skills by their GitHub URL under `papers/`; the installed plugin does not ship them.
68
89
- Frites must be `>=0.4.5`; earlier versions crash on import under NumPy 2. HOI has never restricted the NumPy version. With Frites `>=0.4.5`, NumPy 2 is supported.
Copy file name to clipboardExpand all lines: README.md
+60-35Lines changed: 60 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,11 @@ at the Institut de Neurosciences de la Timone:
22
22
(O-information, synergy, redundancy, RSI, DTC, InfoTopo), GPU-capable via
23
23
JAX.
24
24
25
-
It ships as an MCP server (22 tools wrapping Frites and HOI) plus 4 skills
26
-
that know how to pick the right tool, explain what it actually computes, and
27
-
run the statistics correctly — grounded in the real library source, not just
28
-
tool docstrings.
25
+
It ships as an MCP server (34 tools wrapping Frites and HOI, plus data
26
+
conversion and plotting) and 5 skills that know how to pick the right tool,
27
+
explain what it actually computes, run the statistics correctly and check
28
+
the installation — grounded in the real library source, not just tool
29
+
docstrings.
29
30
30
31
## Quick start
31
32
@@ -35,8 +36,11 @@ claude plugin marketplace add brainets/braina
35
36
claude plugin install braina@braina-plugins
36
37
```
37
38
38
-
That's it — no need to clone the repo or run from inside it. Then, in any
39
-
Claude Code session:
39
+
That's it — no need to clone the repo or run from inside it. The first
40
+
session pre-warms the Python environment in the background (about 150 MB of
41
+
wheels, once); if the `braina` MCP server shows "Connection closed" in that
42
+
very first session, run `/braina:check` or simply start a new session. Then,
43
+
in any Claude Code session:
40
44
41
45
> **You:** I have LFP recordings from two regions during a working-memory
42
46
> task (`data.nc`). Does region A drive region B?
@@ -61,26 +65,31 @@ Claude Code session:
61
65
|`frites-connectivity`| Explains each Frites connectivity tool (Granger causality, transfer entropy, PID, coherence, cross-correlation, ...) once one's been picked. |
62
66
|`hoi-metrics`| Explains HOI's higher-order metrics (O-info, synergy, redundancy, DTC, ...) — including sign-convention gotchas and CPU/GPU notes. |
63
67
|`workflows`| Explains permutation testing, cluster correction, bootstrapping, and fixed/random-effect inference, for Frites *and* HOI output. |
0 commit comments