brainx-skill 1.0.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/lib/prompts.js ADDED
@@ -0,0 +1,166 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs/promises');
4
+ const path = require('node:path');
5
+
6
+ class NonInteractiveInstallError extends Error {
7
+ constructor() {
8
+ super('Interactive installation requires a terminal.');
9
+ this.name = 'NonInteractiveInstallError';
10
+ }
11
+ }
12
+
13
+ function harnessLabel(adapter) {
14
+ return adapter.promptLabel || adapter.label;
15
+ }
16
+
17
+ function harnessRoot(adapter) {
18
+ return adapter.homePath.slice(0, -1);
19
+ }
20
+
21
+ async function isDirectory(directory, fsApi) {
22
+ try {
23
+ return (await fsApi.stat(directory)).isDirectory();
24
+ } catch (error) {
25
+ if (error.code === 'ENOENT') {
26
+ return false;
27
+ }
28
+ throw error;
29
+ }
30
+ }
31
+
32
+ async function detectHarnesses(options) {
33
+ const fsApi = options.fsApi || fs;
34
+ const pathApi = options.pathApi || path;
35
+ const detected = [];
36
+ const seen = new Set();
37
+
38
+ for (const adapter of options.adapters) {
39
+ if (seen.has(adapter.id)) {
40
+ continue;
41
+ }
42
+ seen.add(adapter.id);
43
+ const root = harnessRoot(adapter);
44
+ const globalRoot = pathApi.resolve(options.homeDir, ...root);
45
+ const projectRoot = pathApi.resolve(options.cwd, ...root);
46
+ const globalDetected = await isDirectory(globalRoot, fsApi);
47
+ const projectDetected = globalRoot === projectRoot
48
+ ? globalDetected
49
+ : await isDirectory(projectRoot, fsApi);
50
+
51
+ if (globalDetected || projectDetected) {
52
+ detected.push({
53
+ id: adapter.id,
54
+ label: harnessLabel(adapter),
55
+ displayPath: globalDetected ? `~/${root.join('/')}` : projectRoot,
56
+ });
57
+ }
58
+ }
59
+
60
+ return detected;
61
+ }
62
+
63
+ function createPromptApi(input, output) {
64
+ const { AutoComplete, Select } = require('enquirer');
65
+ return {
66
+ select(options) {
67
+ return new Select({ ...options, stdin: input, stdout: output }).run();
68
+ },
69
+ multiSelect(options) {
70
+ return new AutoComplete({
71
+ ...options,
72
+ multiple: true,
73
+ stdin: input,
74
+ stdout: output,
75
+ }).run();
76
+ },
77
+ };
78
+ }
79
+
80
+ function writeDetectedHarnesses(output, detected) {
81
+ output.write('Detected harnesses\n\n');
82
+ if (detected.length === 0) {
83
+ output.write(' None\n\n');
84
+ return;
85
+ }
86
+ const width = Math.max(...detected.map((item) => item.label.length));
87
+ for (const item of detected) {
88
+ output.write(` ${item.label.padEnd(width)} ${item.displayPath}\n`);
89
+ }
90
+ output.write('\n');
91
+ }
92
+
93
+ async function promptForInstall(options) {
94
+ const input = options.stdin || process.stdin;
95
+ const output = options.stdout || process.stdout;
96
+ if (!input.isTTY) {
97
+ throw new NonInteractiveInstallError();
98
+ }
99
+
100
+ const detected = options.detected || await detectHarnesses(options);
101
+ const detectedIds = detected.map((item) => item.id);
102
+ const prompt = options.promptApi || createPromptApi(input, output);
103
+ writeDetectedHarnesses(output, detected);
104
+
105
+ let selectedHarnessIds;
106
+ if (detectedIds.length > 0) {
107
+ const mode = await prompt.select({
108
+ name: 'mode',
109
+ message: 'Install for detected harnesses only, or add more?',
110
+ initial: 0,
111
+ choices: [
112
+ {
113
+ name: 'detected',
114
+ message: `Detected only (${detectedIds.join(', ')})`,
115
+ },
116
+ { name: 'customize', message: 'Customize...' },
117
+ ],
118
+ });
119
+ if (mode === 'detected') {
120
+ selectedHarnessIds = detectedIds;
121
+ }
122
+ }
123
+
124
+ if (!selectedHarnessIds) {
125
+ const initiallySelected = new Set(
126
+ detectedIds.length > 0 ? detectedIds : options.adapters.map((adapter) => adapter.id),
127
+ );
128
+ selectedHarnessIds = await prompt.multiSelect({
129
+ name: 'harnesses',
130
+ message: 'Select harnesses',
131
+ hint: 'Type to filter, space to select, enter to confirm',
132
+ initial: [...initiallySelected],
133
+ choices: options.adapters.map((adapter) => ({
134
+ name: adapter.id,
135
+ message: harnessLabel(adapter),
136
+ hint: `(${adapter.homePath.join('/')})`,
137
+ })),
138
+ validate(value) {
139
+ return value.length > 0 || 'Select at least one harness.';
140
+ },
141
+ footer() {
142
+ const labels = this.selected.map((choice) => choice.message);
143
+ return labels.length > 0 ? `Selected: ${labels.join(', ')}` : '';
144
+ },
145
+ });
146
+ }
147
+
148
+ const scope = await prompt.select({
149
+ name: 'scope',
150
+ message: 'Install location',
151
+ initial: 1,
152
+ choices: [
153
+ { name: 'project', message: 'Project (current repository)' },
154
+ { name: 'global', message: 'Global (~)' },
155
+ ],
156
+ });
157
+
158
+ return { selectedHarnessIds, scope };
159
+ }
160
+
161
+ module.exports = {
162
+ NonInteractiveInstallError,
163
+ detectHarnesses,
164
+ promptForInstall,
165
+ writeDetectedHarnesses,
166
+ };
package/lib/receipt.js ADDED
@@ -0,0 +1,143 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('node:crypto');
4
+ const fs = require('node:fs/promises');
5
+ const path = require('node:path');
6
+ const {
7
+ PACKAGE_NAME,
8
+ RECEIPT_SCHEMA_VERSION,
9
+ SKILL_NAME_PATTERN,
10
+ } = require('./constants');
11
+ const { resolveDestinationRoot, samePath } = require('./paths');
12
+
13
+ class ReceiptValidationError extends Error {
14
+ constructor(message) {
15
+ super(message);
16
+ this.name = 'ReceiptValidationError';
17
+ }
18
+ }
19
+
20
+ function validateReceipt(receipt, adapters, destinations, pathApi = path) {
21
+ if (!receipt || typeof receipt !== 'object' || Array.isArray(receipt)) {
22
+ throw new ReceiptValidationError('BrainX receipt must be a JSON object');
23
+ }
24
+ if (receipt.schemaVersion !== RECEIPT_SCHEMA_VERSION) {
25
+ throw new ReceiptValidationError(`Unsupported BrainX receipt schema: ${receipt.schemaVersion}`);
26
+ }
27
+ if (receipt.packageName !== PACKAGE_NAME) {
28
+ throw new ReceiptValidationError(`Receipt belongs to a different package: ${receipt.packageName}`);
29
+ }
30
+ if (!receipt.adapters || typeof receipt.adapters !== 'object' || Array.isArray(receipt.adapters)) {
31
+ throw new ReceiptValidationError('BrainX receipt must contain adapter records');
32
+ }
33
+
34
+ const adapterById = new Map(adapters.map((adapter) => [adapter.id, adapter]));
35
+ for (const id of Object.keys(receipt.adapters)) {
36
+ if (!adapterById.has(id)) {
37
+ throw new ReceiptValidationError(`Unknown adapter in BrainX receipt: ${id}`);
38
+ }
39
+ }
40
+
41
+ for (const adapter of adapters) {
42
+ const record = receipt.adapters[adapter.id];
43
+ if (record === undefined) {
44
+ continue;
45
+ }
46
+ if (!record || typeof record !== 'object' || Array.isArray(record)) {
47
+ throw new ReceiptValidationError(`Invalid ${adapter.label} receipt record`);
48
+ }
49
+ if (record.label !== adapter.label || typeof record.destination !== 'string') {
50
+ throw new ReceiptValidationError(`Invalid ${adapter.label} receipt identity`);
51
+ }
52
+ const expectedDestination = destinations && destinations[adapter.id];
53
+ if (expectedDestination && !samePath(record.destination, expectedDestination, pathApi)) {
54
+ throw new ReceiptValidationError(
55
+ `${adapter.label} receipt destination does not match ${expectedDestination}`,
56
+ );
57
+ }
58
+ if (!pathApi.isAbsolute(record.destination)
59
+ || !resolveDestinationRoot(record.destination, adapter, pathApi)) {
60
+ throw new ReceiptValidationError(
61
+ `Unsafe ${adapter.label} receipt destination: ${record.destination}`,
62
+ );
63
+ }
64
+ if (typeof record.packageVersion !== 'string' || record.packageVersion.length === 0) {
65
+ throw new ReceiptValidationError(`Invalid ${adapter.label} package version in receipt`);
66
+ }
67
+ if (!Array.isArray(record.skills) || record.skills.length === 0) {
68
+ throw new ReceiptValidationError(`Invalid ${adapter.label} skill ownership list`);
69
+ }
70
+
71
+ const seen = new Set();
72
+ for (const skill of record.skills) {
73
+ if (!skill || typeof skill !== 'object' || !SKILL_NAME_PATTERN.test(skill.name || '')) {
74
+ throw new ReceiptValidationError(`Invalid ${adapter.label} skill ownership entry`);
75
+ }
76
+ if (seen.has(skill.name)) {
77
+ throw new ReceiptValidationError(`Duplicate ${adapter.label} skill in receipt: ${skill.name}`);
78
+ }
79
+ seen.add(skill.name);
80
+ const expectedPath = pathApi.join(record.destination, skill.name);
81
+ if (typeof skill.directory !== 'string' || !samePath(skill.directory, expectedPath, pathApi)) {
82
+ throw new ReceiptValidationError(
83
+ `Unsafe ${adapter.label} owned path for ${skill.name}: ${skill.directory}`,
84
+ );
85
+ }
86
+ if (typeof skill.digest !== 'string' || !/^[a-f0-9]{64}$/.test(skill.digest)) {
87
+ throw new ReceiptValidationError(`Invalid ${adapter.label} digest for ${skill.name}`);
88
+ }
89
+ }
90
+ }
91
+
92
+ return receipt;
93
+ }
94
+
95
+ async function readReceipt(receiptPath, adapters, destinations, options = {}) {
96
+ const fsApi = options.fsApi || fs;
97
+ const pathApi = options.pathApi || path;
98
+ let contents;
99
+ try {
100
+ contents = await fsApi.readFile(receiptPath, 'utf8');
101
+ } catch (error) {
102
+ if (error.code === 'ENOENT') {
103
+ return null;
104
+ }
105
+ throw new ReceiptValidationError(`Cannot read BrainX receipt at ${receiptPath}: ${error.message}`);
106
+ }
107
+
108
+ let receipt;
109
+ try {
110
+ receipt = JSON.parse(contents);
111
+ } catch (error) {
112
+ throw new ReceiptValidationError(`Invalid JSON in BrainX receipt at ${receiptPath}: ${error.message}`);
113
+ }
114
+ return validateReceipt(receipt, adapters, destinations, pathApi);
115
+ }
116
+
117
+ async function writeReceiptAtomic(receiptPath, receipt, options = {}) {
118
+ const fsApi = options.fsApi || fs;
119
+ const pathApi = options.pathApi || path;
120
+ const uuid = options.uuid || crypto.randomUUID;
121
+ const stateDir = pathApi.dirname(receiptPath);
122
+ const temporaryPath = pathApi.join(stateDir, `.receipt-${uuid()}.tmp`);
123
+
124
+ await fsApi.mkdir(stateDir, { recursive: true });
125
+ try {
126
+ await fsApi.writeFile(temporaryPath, `${JSON.stringify(receipt, null, 2)}\n`, {
127
+ encoding: 'utf8',
128
+ flag: 'wx',
129
+ mode: 0o600,
130
+ });
131
+ await fsApi.rename(temporaryPath, receiptPath);
132
+ } catch (error) {
133
+ await fsApi.rm(temporaryPath, { force: true }).catch(() => {});
134
+ throw error;
135
+ }
136
+ }
137
+
138
+ module.exports = {
139
+ ReceiptValidationError,
140
+ readReceipt,
141
+ validateReceipt,
142
+ writeReceiptAtomic,
143
+ };
package/manifest.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "skills": [
4
+ "brainx-install"
5
+ ]
6
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "brainx-skill",
3
+ "version": "1.0.0",
4
+ "description": "Portable BrainX Agent Skills for Claude Code, Codex, and Cursor",
5
+ "license": "Apache-2.0",
6
+ "type": "commonjs",
7
+ "bin": {
8
+ "brainx": "bin/brainx.js"
9
+ },
10
+ "files": [
11
+ "adapters/",
12
+ "bin/",
13
+ "lib/",
14
+ "skills/brainx-install/",
15
+ "manifest.json",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "dependencies": {
23
+ "enquirer": "^2.4.1"
24
+ },
25
+ "scripts": {
26
+ "test": "node --test test/bundle.test.js test/cli.test.js test/installer.test.js test/paths.test.js test/prompts.test.js",
27
+ "prepublishOnly": "npm test"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/Wilsonnijc-bot/BrainX-skill.git"
32
+ },
33
+ "keywords": [
34
+ "agent-skills",
35
+ "brainx",
36
+ "claude-code",
37
+ "codex",
38
+ "cursor"
39
+ ]
40
+ }
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: brainx-install
3
+ description: Install or configure BrainX, change its package version or device target, and resolve BrainX ecosystem compatibility. Use whenever a user asks to install, set up, upgrade, downgrade, pin, migrate, or reconcile BrainX packages; switch or select CPU, CUDA 12, CUDA 13, or TPU support. Do not use for general BrainX modeling.
4
+ ---
5
+
6
+ # BrainX Install
7
+
8
+ ## Objective
9
+
10
+ Install the BrainX meta-package into one confirmed Python virtual environment, verify, then report the result. BrainX is a meta-package that installs a curated set of BrainX components known to work well together. Treat each published BrainX release as an indivisible compatibility set; never assemble independently selected subpackage versions.
11
+
12
+ ## Core Rules
13
+
14
+ 1. BrainX package must use a Python interpreter at version `>=3.11`.
15
+ 2. For a clean environment with no requested version, prefer to use the unpinned BrainX install matching the confirmed device. If a BrainX component already exists in the environment, or a requested version is specified, select one non-separated release from [compatibility-and-release-matching.md]. Never mix component versions from different rows.
16
+ 3. Require the user to explicitly choose `cpu`, `cuda12`, `cuda13`, or `tpu`. Detection is evidence, not consent.
17
+ 4. Before any mutation, must present the complete specification to the user clearly, show the run location, interpreter, venv path, device extra, release, complete component set, existing packages, expected results, and exact commands.
18
+ 5. Create or modify nothing until the user confirms that complete specification.
19
+ 6. After confirmation, install only the selected BrainX meta-package release. Do not install ecosystem components individually.
20
+
21
+ ## Workflow
22
+
23
+ Follow this order without skipping the confirmation gate:
24
+
25
+ ```text
26
+ read-only inspection
27
+ -> explicit device choice
28
+ -> coherent release selection
29
+ -> complete installation specification
30
+ -> explicit user confirmation
31
+ -> venv creation or reuse
32
+ -> pip 23+ upgrade
33
+ -> one confirmed BrainX install
34
+ -> BrainX/JAX import and device verification
35
+ -> final report
36
+ ```
37
+
38
+ ## 1. Read-Only Inspection
39
+
40
+ Record the intended run location first. Perform no package installation, or environment creation during inspection.
41
+
42
+ Choose read-only inspection methods that fit the operating system.
43
+
44
+ Collect enough evidence to identify:
45
+
46
+ - OS, version, architecture, and CPU;
47
+ - visible NVIDIA or TPU hardware and the driver, toolkit, container, or runtime evidence needed to distinguish `cuda12`, `cuda13`, and `tpu`;
48
+ - the active Python executable and version, environment-manager state, pip version, and viable candidate interpreters;
49
+ - existing `.venv`, `.venv-brainx`, or user-designated target environments without creating or activating them;
50
+ - installed versions of BrainX, BrainUnit, BrainState, BrainEvent, BrainTools, BrainTrace or BrainScale, BrainCell, BrainPy, BrainPy-State, BrainMass, PINNx, JAX, JAXlib, and Optax in every environment relevant to the request.
51
+
52
+ Prefer package metadata and platform-native tools over imports or newly installed helpers. Record missing evidence explicitly as `unknown`, `not_detected`, or a command error rather than guessing. Organize the result in whatever concise structured form best fits the task.
53
+
54
+ ## 2. Confirm the Device Target
55
+
56
+ Determine whether the intended installation is for:
57
+
58
+ - `cpu`
59
+ - `cuda12`
60
+ - `cuda13`
61
+ - `tpu`
62
+
63
+ Do not treat detected hardware as the user's choice. If the target is unstated, implied, contradictory, or unclear, question the user directly and persistently until they explicitly choose one device target. Resolve whether they mean the current machine, a container, a remote host, a cluster node, or another deployment environment. Never infer CUDA 12 or CUDA 13 from GPU visibility alone; consider the NVIDIA driver, toolkit or container runtime, and the intended execution host.
64
+
65
+ Reflect the understood requirement back to the user before release selection. Use wording such as:
66
+
67
+ > Understanding your need: you want to install BrainX for **NVIDIA CUDA 12** on **the target environment you identified**, using the `cuda12` extra. Is that correct?
68
+
69
+ Replace the example values with the user's actual target. If evidence is uncertain, explain the ambiguity and ask a focused question instead of filling in a likely answer. Recommend `cpu` when accelerator support is absent or uncertain, but still require explicit confirmation. Do not proceed until the user confirms or corrects the reflected device target.
70
+
71
+ ## 3. Select One Release
72
+
73
+ When no BrainX meta-package or ecosystem component is installed and the user has not requested a specific version, do not open the compatibility reference. Prefer the unpinned official quick-install form that matches the confirmed device target: `BrainX`, `BrainX[cpu]`, `BrainX[cuda12]`, `BrainX[cuda13]`, or `BrainX[tpu]`.
74
+
75
+ When BrainX packages are already installed or the user requests a specific pinned version, follow **Reference Routing** at the end of this skill, then apply the matching procedure below.
76
+
77
+ - With one exact component match, choose the newest row containing that exact version.
78
+ - When one BrainX ecosystem component is installed and its version does not appear in any compatibility matrix row, compare it with the versions declared for that same component across all rows. Choose the BrainX release containing the closest semantic version, favor the newer BrainX release if two rows are equally close, propose installing that entire BrainX release rather than the component alone, and disclose the component version change.
79
+ - With multiple installed components that do not identify one coherent row, show the competing candidate rows and require the user to choose. Do not construct a compromise tuple.
80
+ - Treat an installed `BrainX` meta-package version as the release anchor, but surface any component drift from its row.
81
+ - Do not use JAX or Optax alone as a legacy release anchor unless the user explicitly asks to preserve it.
82
+
83
+ ## 4. Choose the Venv
84
+
85
+ Use the intended run location as the base:
86
+
87
+ - Propose `<run-location>/.venv` when it does not exist.
88
+ - If `.venv` exists and its interpreter is Python `>=3.11`, inspect it and propose reuse.
89
+ - If `.venv` exists but is unsuitable, propose `<run-location>/.venv-brainx`.
90
+ - Never delete, rebuild, overwrite, or silently repurpose an existing environment.
91
+ - Never install into the global interpreter or an unrelated environment.
92
+
93
+ Resolve the exact interpreter inside the proposed venv using the conventions of the confirmed platform and environment manager. Do not rely on shell activation or assume that a bare `python` or `pip` command targets the intended environment.
94
+
95
+ ## 5. Present the Complete Specification
96
+
97
+ The agent must report the complete proposed setup before any mutation. This is a mandatory reporting contract, not a rigid implementation script. Use concrete values and preserve the following visible structure:
98
+
99
+ ```text
100
+ Confirming the setup:
101
+
102
+ Python environment
103
+ - Run location:
104
+ - Python version:
105
+ - Virtual-environment path:
106
+ - Environment action: create or reuse
107
+
108
+ Device target
109
+ - Intended execution environment:
110
+ - Detected hardware evidence:
111
+ - User-confirmed target: CPU, NVIDIA CUDA 12, NVIDIA CUDA 13, or TPU
112
+ - Selected BrainX extra: cpu, cuda12, cuda13, or tpu
113
+
114
+ BrainX target package state
115
+ - Current BrainX ecosystem packages and versions:
116
+ - Expected final package set after installation, using exact pins or declared constraints
117
+
118
+ Planned changes
119
+ - Packages that will be installed, upgraded, or downgraded:
120
+ - Exact commands that will run:
121
+ Please confirm the entire setup or correct it.
122
+ ```
123
+
124
+ For an existing-package or pinned-version workflow, list the BrainX meta-package and every component declared by the selected compatibility row under `Expected final package set`, using the exact target version or constraint. For a clean unpinned install, state that pip will resolve the latest Python-compatible BrainX release and its declared dependencies; do not invent exact versions before resolution.
125
+
126
+ End by asking the user to confirm the entire setup or correct it, and state explicitly that no environment will be created or modified before confirmation.
127
+
128
+ Do not combine specification and installation in one turn unless the user has already confirmed this exact environment, release, and device extra.
129
+
130
+ ## 6. Install and Verify
131
+
132
+ Use exactly the confirmed venv, interpreter, device extra, and unpinned or pinned release method.
133
+
134
+ 1. Create or reuse the confirmed venv.
135
+ 2. Upgrade pip to version 23 or newer.
136
+ 3. Install the BrainX meta-package. Never install BrainX components separately.
137
+
138
+ If any confirmed choice must change, stop, present a corrected specification, and obtain new approval.
139
+
140
+ If pip fails, stop and skip verification. Leave the failed environment intact for diagnosis.
141
+
142
+ After pip succeeds, verify the installation with this simple command:
143
+
144
+ ```bash
145
+ python -c "import BrainX, jax; print('BrainX OK'); print('JAX devices:', jax.devices())"
146
+ ```
147
+
148
+ Run it through the exact confirmed venv interpreter; the bare `python` spelling is illustrative.
149
+
150
+ Verification passes only when:
151
+
152
+ - both `BrainX` and `jax` import successfully;
153
+ - the command prints `BrainX OK`;
154
+ - `jax.devices()` reports the user-confirmed backend: CPU for `cpu`, a CUDA device for `cuda12` or `cuda13`, or a TPU device for `tpu`.
155
+
156
+ Do not modify manifests, lockfiles, requirements files, or unrelated environments.
157
+
158
+ ## 7. Report
159
+
160
+ Report:
161
+
162
+ - environment path;
163
+ - resolved BrainX release and device extra;
164
+ - pip command and result;
165
+ - verification command output;
166
+ - final status: `PASS` or `FAIL`, with the reason.
167
+
168
+ For a pip failure, include the exit status and relevant stderr and state that verification was not run. For a verification failure, identify the failed condition. Report `PASS` only when both imports succeed and JAX sees the confirmed backend.
169
+
170
+ ## Official Commands to use
171
+
172
+ Use these official BrainX documentation examples to understand the supported syntax. They are educational patterns, not a rigid workflow or permission to bypass the confirmed interpreter, venv, release behavior, or device choice.
173
+
174
+ ### Quick Install and Dependency Resolution
175
+
176
+ When no BrainX meta-package or ecosystem component is already installed, prefer the official unpinned quick-install family:
177
+
178
+ ```bash
179
+ pip install -U BrainX
180
+ ```
181
+
182
+ For a new BrainX environment when user has no existing brainX packages, the bare command and the unpinned `BrainX[cpu]`, `BrainX[cuda12]`, `BrainX[cuda13]`, and `BrainX[tpu]` commands are equally default; choose the one matching the user-confirmed device target. These are the cleanest installation methods because they let pip choose the latest BrainX release compatible with the confirmed Python version and resolve only the dependency changes that release requires. Use an exact release pin only when the user has existing brainX packages, or requests a specific release, reproducibility, or compatibility with an existing BrainX environment.
183
+
184
+ | Command | BrainX itself | Dependencies |
185
+ |---|---|---|
186
+ | `pip install -U BrainX` | Replaced with the latest Python-compatible BrainX version if a different version is installed | Replaced only when needed to satisfy that BrainX release's constraints |
187
+ | `pip install -U 'BrainX[cuda12]'` | Same as above | Same, plus CUDA 12 JAX dependencies |
188
+ | `pip install 'BrainX==2025.9.15'` | Upgraded or downgraded to exactly `2025.9.15` if another version is installed | Replaced only when their installed versions do not satisfy `2025.9.15`'s requirements |
189
+
190
+ ### Hardware-Specific Installs
191
+
192
+ For a clean environment, each unpinned command below is the default for its corresponding confirmed target. Choose the extra that matches the platform and CUDA toolchain:
193
+
194
+ ```bash
195
+ # CPU only
196
+ pip install -U BrainX[cpu]
197
+
198
+ # NVIDIA GPU (CUDA 12.x)
199
+ pip install -U BrainX[cuda12]
200
+
201
+ # NVIDIA GPU (CUDA 13.x)
202
+ pip install -U BrainX[cuda13]
203
+
204
+ # TPU
205
+ pip install -U BrainX[tpu]
206
+ ```
207
+
208
+ ### Pin a Specific BrainX Release
209
+
210
+ BrainX releases use date-style versions:
211
+
212
+ ```bash
213
+ pip install BrainX==2025.9.15
214
+ ```
215
+
216
+ When an exact release is requested, preserve the confirmed hardware extra while applying the selected BrainX release pin.
217
+
218
+ ## Reference Routing
219
+
220
+ Open [references/compatibility-and-release-matching.md](references/compatibility-and-release-matching.md) when the target environment already contains BrainX or BrainX ecosystem packages, or when the user requests a specific pinned BrainX version. Use its matrix to match existing packages, reconcile version drift, evaluate pinned-version compatibility, and select one coherent BrainX release with its declared component versions.
221
+
222
+ Do not open this reference for a clean installation when no BrainX packages are present and no specific version is requested; use the unpinned quick-install path instead.
@@ -0,0 +1,42 @@
1
+ # BrainX Package Version Matrix
2
+
3
+ This reference records the package versions explicitly declared by each BrainX release.
4
+
5
+ ## How to read this table
6
+
7
+ * `—` means the package or dependency was **not explicitly listed** in that release. It does not prove that the package was unsupported or unavailable.
8
+ * **Removed** means the release explicitly removed the package from the default BrainX bundle.
9
+ * **Not bundled** means the package remained outside the default bundle after its removal.
10
+ * **BrainTrace** replaced **BrainScale** beginning with `v2025.12.2`.
11
+ * Optax may have been installed transitively in earlier releases, but `v2026.7.9` was the first release to declare `optax>=0.2.8` explicitly.
12
+
13
+ ## Version compatibility matrix
14
+
15
+ | BrainX release | JAX | BrainUnit | BrainState | BrainEvent | BrainTools | BrainTrace / BrainScale | BrainCell | BrainPy | BrainPy-State | BrainMass | PINNx | Optax |
16
+ | ------------------------ | ------------------- | --------- | ---------- | ---------- | ---------- | ----------------------- | --------- | ------- | ------------- | --------- | --------------- | --------- |
17
+ | `v2026.7.9` | `>=0.8.0, <=0.10.2` | `0.5.1` | `0.5.2` | `0.1.2` | `0.3.0` | BrainTrace `0.2.4` | `0.1.0` | `2.8.1` | `0.1.0` | `0.1.1` | **Not bundled** | `>=0.2.8` |
18
+ | `v2026.6.29` | `>=0.8.0, <=0.10.2` | `0.5.1` | `0.5.2` | `0.1.1` | `0.3.0` | BrainTrace `0.2.2` | `0.1.0` | `2.8.0` | `0.1.0` | `0.1.1` | **Removed** | — |
19
+ | `v2026.6.19` | `>=0.8.0, <=0.10.2` | `0.5.1` | `0.5.1` | `0.1.1` | `0.3.0` | BrainTrace `0.2.1` | `0.1.0` | `2.8.0` | `0.1.0` | `0.1.1` | `0.0.3` | — |
20
+ | `v2026.6.18` | — | `0.4.0` | `0.5.0` | `0.1.0` | `0.1.10` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.1.0` | `0.0.5` | `0.0.3` | — |
21
+ | `v2026.6.14` | — | `0.4.0` | `0.5.0` | `0.1.0` | `0.1.10` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.0.4` | `0.0.5` | `0.0.3` | — |
22
+ | `v2026.6.11` | — | `0.4.0` | `0.4.2` | `0.1.0` | `0.1.10` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.0.4` | `0.0.5` | `0.0.3` | — |
23
+ | `v2026.6.8` | `>=0.6.0, <=0.10.1` | `0.3.2` | `0.4.0` | `0.1.0` | `0.1.9` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.0.4` | `0.0.5` | `0.0.3` | — |
24
+ | `v2026.3.12` | `>=0.6.0, <=0.9.1` | `0.2.0` | `0.3.0` | `0.0.7` | `0.1.8` | BrainTrace `0.1.2` | `0.0.8` | `2.7.7` | `0.0.4` | `0.0.5` | `0.0.3` | — |
25
+ | `v2026.1.31` | `>=0.6.0, <0.9.0` | `0.1.4` | `0.2.10` | `0.0.5` | `0.1.8` | BrainTrace `0.1.2` | `0.0.7` | `2.7.6` | `0.0.3` | `0.0.5` | `0.0.3` | — |
26
+ | `v2026.1.22` | `>=0.6.0` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.8` | BrainTrace `0.1.2` | `0.0.7` | `2.7.6` | `0.0.3` | `0.0.5` | `0.0.3` | — |
27
+ | `v2026.1.21` | `>=0.6.0` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.7` | BrainTrace `0.1.2` | `0.0.7` | `2.7.6` | `0.0.3` | `0.0.5` | `0.0.3` | — |
28
+ | `v2026.1.19` | `>=0.6.0` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.7` | BrainTrace `0.1.2` | `0.0.7` | `2.7.5` | `0.0.3` | `0.0.5` | `0.0.3` | — |
29
+ | `v2026.1.16` | `>=0.6.0` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.7` | BrainTrace `0.1.2` | `0.0.6` | `2.7.5` | `0.0.2` | `0.0.4` | `0.0.3` | — |
30
+ | `v2025.12.26` | `>=0.6.0` | `0.1.3` | `0.2.8` | `0.0.5` | `0.1.6` | BrainTrace `0.1.2` | `0.0.6` | `2.7.5` | `0.0.2` | `0.0.4` | `0.0.3` | — |
31
+ | `v2025.12.25` | `>=0.6.0` | `0.1.3` | `0.2.8` | `0.0.5` | `0.1.6` | BrainTrace `0.1.2` | `0.0.6` | — | `0.0.1` | `0.0.4` | `0.0.3` | — |
32
+ | `v2025.12.2` | `>=0.6.0` | `0.1.2` | `0.2.6` | `0.0.4` | `0.1.4` | BrainTrace `0.1.1` | `0.0.6` | `2.7.2` | — | `0.0.4` | `0.0.3` | — |
33
+ | `v2025.10.13` | `>=0.6.0, <0.8.0` | `0.1.1` | `0.2.3` | `0.0.4` | `0.1.3` | BrainScale `0.1.0` | `0.0.6` | `2.7.1` | — | `0.0.4` | — | — |
34
+ | `v2025.9.15` | `>=0.4.35, <0.8.0` | `0.1.1` | `0.1.10` | `0.0.4` | `0.0.11` | BrainScale `0.0.10` | `0.0.4` | — | — | `0.0.3` | — | — |
35
+
36
+ ## Installation rule
37
+
38
+ Treat each row as one declared BrainX package set.
39
+
40
+ Do not independently combine the newest release of every subpackage. Choose a BrainX release and use the package versions declared for that release.
41
+
42
+ A `—` entry must not be converted into an assumption. Before installing an unlisted dependency, inspect the selected BrainX release metadata or dependency files.