nexus-workbench 0.2.1__tar.gz

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.
Files changed (93) hide show
  1. nexus_workbench-0.2.1/.claude-plugin/marketplace.json +16 -0
  2. nexus_workbench-0.2.1/.claude-plugin/plugin.json +11 -0
  3. nexus_workbench-0.2.1/.codex-plugin/plugin.json +14 -0
  4. nexus_workbench-0.2.1/.github/ISSUE_TEMPLATE/bug_report.yml +50 -0
  5. nexus_workbench-0.2.1/.github/ISSUE_TEMPLATE/config.yml +5 -0
  6. nexus_workbench-0.2.1/.github/ISSUE_TEMPLATE/feature_request.yml +20 -0
  7. nexus_workbench-0.2.1/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  8. nexus_workbench-0.2.1/.github/workflows/ci.yml +41 -0
  9. nexus_workbench-0.2.1/.github/workflows/release-insai.yml +68 -0
  10. nexus_workbench-0.2.1/.github/workflows/release.yml +104 -0
  11. nexus_workbench-0.2.1/.gitignore +16 -0
  12. nexus_workbench-0.2.1/.mcp.json +1 -0
  13. nexus_workbench-0.2.1/CHANGELOG.md +94 -0
  14. nexus_workbench-0.2.1/CONTRIBUTING.md +187 -0
  15. nexus_workbench-0.2.1/LICENSE +202 -0
  16. nexus_workbench-0.2.1/PKG-INFO +602 -0
  17. nexus_workbench-0.2.1/README.md +576 -0
  18. nexus_workbench-0.2.1/SECURITY.md +63 -0
  19. nexus_workbench-0.2.1/docs/contract.md +1221 -0
  20. nexus_workbench-0.2.1/docs/tools.md +942 -0
  21. nexus_workbench-0.2.1/llms-install.md +60 -0
  22. nexus_workbench-0.2.1/pyproject.toml +67 -0
  23. nexus_workbench-0.2.1/scripts/bump_version.py +153 -0
  24. nexus_workbench-0.2.1/scripts/changelog_notes.py +50 -0
  25. nexus_workbench-0.2.1/server.json +46 -0
  26. nexus_workbench-0.2.1/skills/band-power-by-stage/SKILL.md +119 -0
  27. nexus_workbench-0.2.1/skills/connect-workbench/SKILL.md +212 -0
  28. nexus_workbench-0.2.1/skills/edf-intake/SKILL.md +94 -0
  29. nexus_workbench-0.2.1/skills/event-detector-eval/SKILL.md +142 -0
  30. nexus_workbench-0.2.1/skills/leakage-check/SKILL.md +108 -0
  31. nexus_workbench-0.2.1/skills/nights-by-person/SKILL.md +68 -0
  32. nexus_workbench-0.2.1/skills/preprocess-and-qc/SKILL.md +94 -0
  33. nexus_workbench-0.2.1/skills/prereg/SKILL.md +126 -0
  34. nexus_workbench-0.2.1/skills/review-loop/SKILL.md +105 -0
  35. nexus_workbench-0.2.1/skills/scorer-agreement/SKILL.md +124 -0
  36. nexus_workbench-0.2.1/skills/signal-qc/SKILL.md +104 -0
  37. nexus_workbench-0.2.1/skills/stats-rails/SKILL.md +95 -0
  38. nexus_workbench-0.2.1/skills/verify-before-verdict/SKILL.md +113 -0
  39. nexus_workbench-0.2.1/src/nexus_workbench/__init__.py +3 -0
  40. nexus_workbench-0.2.1/src/nexus_workbench/__main__.py +9 -0
  41. nexus_workbench-0.2.1/src/nexus_workbench/auth.py +375 -0
  42. nexus_workbench-0.2.1/src/nexus_workbench/bridge.py +162 -0
  43. nexus_workbench-0.2.1/src/nexus_workbench/cli.py +701 -0
  44. nexus_workbench-0.2.1/src/nexus_workbench/client.py +815 -0
  45. nexus_workbench-0.2.1/src/nexus_workbench/commands.py +922 -0
  46. nexus_workbench-0.2.1/src/nexus_workbench/local/__init__.py +26 -0
  47. nexus_workbench-0.2.1/src/nexus_workbench/local/api.py +713 -0
  48. nexus_workbench-0.2.1/src/nexus_workbench/local/bandpower.py +161 -0
  49. nexus_workbench-0.2.1/src/nexus_workbench/local/edf.py +543 -0
  50. nexus_workbench-0.2.1/src/nexus_workbench/local/errors.py +18 -0
  51. nexus_workbench-0.2.1/src/nexus_workbench/local/events.py +336 -0
  52. nexus_workbench-0.2.1/src/nexus_workbench/local/formats.py +374 -0
  53. nexus_workbench-0.2.1/src/nexus_workbench/local/labels.py +136 -0
  54. nexus_workbench-0.2.1/src/nexus_workbench/local/preprocess.py +381 -0
  55. nexus_workbench-0.2.1/src/nexus_workbench/local/quality.py +264 -0
  56. nexus_workbench-0.2.1/src/nexus_workbench/local/report.py +200 -0
  57. nexus_workbench-0.2.1/src/nexus_workbench/local/sample.py +256 -0
  58. nexus_workbench-0.2.1/src/nexus_workbench/local/staging.py +92 -0
  59. nexus_workbench-0.2.1/src/nexus_workbench/login.py +398 -0
  60. nexus_workbench-0.2.1/src/nexus_workbench/marks.py +220 -0
  61. nexus_workbench-0.2.1/src/nexus_workbench/mcp_errors.py +162 -0
  62. nexus_workbench-0.2.1/src/nexus_workbench/mcp_server.py +1943 -0
  63. nexus_workbench-0.2.1/src/nexus_workbench/prompts.py +158 -0
  64. nexus_workbench-0.2.1/src/nexus_workbench/scopes.py +99 -0
  65. nexus_workbench-0.2.1/src/nexus_workbench/setup_cmd.py +675 -0
  66. nexus_workbench-0.2.1/src/nexus_workbench/tables.py +70 -0
  67. nexus_workbench-0.2.1/src/nexus_workbench/update_check.py +187 -0
  68. nexus_workbench-0.2.1/tests/__init__.py +0 -0
  69. nexus_workbench-0.2.1/tests/conftest.py +43 -0
  70. nexus_workbench-0.2.1/tests/fake_api.py +1384 -0
  71. nexus_workbench-0.2.1/tests/local/__init__.py +0 -0
  72. nexus_workbench-0.2.1/tests/local/conftest.py +38 -0
  73. nexus_workbench-0.2.1/tests/local/test_api.py +347 -0
  74. nexus_workbench-0.2.1/tests/local/test_bandpower.py +74 -0
  75. nexus_workbench-0.2.1/tests/local/test_edf.py +171 -0
  76. nexus_workbench-0.2.1/tests/local/test_events.py +234 -0
  77. nexus_workbench-0.2.1/tests/local/test_formats.py +160 -0
  78. nexus_workbench-0.2.1/tests/local/test_preprocess.py +285 -0
  79. nexus_workbench-0.2.1/tests/local/test_quality.py +210 -0
  80. nexus_workbench-0.2.1/tests/local/test_sample.py +116 -0
  81. nexus_workbench-0.2.1/tests/local/test_staging.py +84 -0
  82. nexus_workbench-0.2.1/tests/test_agent_ergonomics.py +467 -0
  83. nexus_workbench-0.2.1/tests/test_auth.py +291 -0
  84. nexus_workbench-0.2.1/tests/test_cli.py +971 -0
  85. nexus_workbench-0.2.1/tests/test_cli_v11.py +508 -0
  86. nexus_workbench-0.2.1/tests/test_client.py +386 -0
  87. nexus_workbench-0.2.1/tests/test_manifests.py +133 -0
  88. nexus_workbench-0.2.1/tests/test_mcp_local.py +339 -0
  89. nexus_workbench-0.2.1/tests/test_mcp_server.py +598 -0
  90. nexus_workbench-0.2.1/tests/test_mcp_v11.py +503 -0
  91. nexus_workbench-0.2.1/tests/test_setup_cmd.py +674 -0
  92. nexus_workbench-0.2.1/tests/test_skills.py +83 -0
  93. nexus_workbench-0.2.1/tests/test_v11_api.py +613 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "insai",
3
+ "owner": {
4
+ "name": "Insai"
5
+ },
6
+ "metadata": {
7
+ "description": "Plugins for Insai Workbench."
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "nexus-workbench",
12
+ "source": "./",
13
+ "description": "Access to an Insai Workbench workspace from Claude Code, read-only unless you choose write scopes, plus local tools for EEG files. Early access. For research use only."
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "nexus-workbench",
3
+ "version": "0.2.1",
4
+ "description": "Access to an Insai Workbench workspace from Claude Code: reads by default, and with the scopes you choose, marks proposed for review, review tasks and analyses. Plus local tools for EEG files. Early access. For research use only.",
5
+ "author": {
6
+ "name": "Insai"
7
+ },
8
+ "homepage": "https://insai.tech/workbench",
9
+ "license": "Apache-2.0",
10
+ "keywords": ["eeg", "sleep", "edf", "mcp", "workbench"]
11
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "nexus-workbench",
3
+ "version": "0.2.1",
4
+ "description": "Access to an Insai Workbench workspace from Codex: reads by default, and with the scopes you choose, marks proposed for review, review tasks and analyses. Plus local tools for EEG files. Early access. For research use only.",
5
+ "skills": "./skills/",
6
+ "mcpServers": "./.mcp.json",
7
+ "interface": {
8
+ "displayName": "Insai Workbench",
9
+ "shortDescription": "Read your Workbench recordings",
10
+ "longDescription": "Access to an Insai Workbench workspace: reads by default, and with the scopes you choose at sign-in, marks proposed as a review layer, review tasks and analyses. Plus local tools for EEG files. Early access. For research use only. Not for clinical decision-making.",
11
+ "developerName": "Insai",
12
+ "websiteUrl": "https://insai.tech/workbench"
13
+ }
14
+ }
@@ -0,0 +1,50 @@
1
+ name: Bug report
2
+ description: Something does not work as the docs say.
3
+ labels: [bug]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for the report. Never paste a token, a recording or patient data here.
9
+ For a security problem, use SECURITY.md instead.
10
+ - type: textarea
11
+ id: what
12
+ attributes:
13
+ label: What happened
14
+ description: What you ran or asked the agent, and what you saw. Paste error text as is.
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: expected
19
+ attributes:
20
+ label: What you expected
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: doctor
25
+ attributes:
26
+ label: Output of `nexus-workbench doctor`
27
+ description: It shows only the last four characters of a token. Remove any paths you do not want to share.
28
+ render: text
29
+ - type: textarea
30
+ id: debug
31
+ attributes:
32
+ label: Details from NEXUS_DEBUG=1 (optional)
33
+ description: For "Something went wrong while reading the file", rerun with NEXUS_DEBUG=1 and paste the traceback, with file paths removed.
34
+ render: text
35
+ - type: dropdown
36
+ id: agent
37
+ attributes:
38
+ label: Agent
39
+ options:
40
+ - Claude Code
41
+ - Codex
42
+ - Command line only
43
+ - Other
44
+ validations:
45
+ required: true
46
+ - type: input
47
+ id: os
48
+ attributes:
49
+ label: Operating system
50
+ placeholder: macOS 15, Ubuntu 24.04, Windows 11
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Report a security problem
4
+ url: https://github.com/Insai/nexus-workbench/security/advisories/new
5
+ about: Report it privately. See SECURITY.md. Do not open a public issue.
@@ -0,0 +1,20 @@
1
+ name: Feature request
2
+ description: Suggest a tool, a skill or a change.
3
+ labels: [enhancement]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What are you trying to do
9
+ description: The research task, and where the current tools fall short.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: idea
14
+ attributes:
15
+ label: What would help
16
+ description: A tool, an argument, a skill or a docs change. Keep in mind that tools read by default, and writes are scoped proposals that members review.
17
+ - type: textarea
18
+ id: other
19
+ attributes:
20
+ label: Anything else
@@ -0,0 +1,11 @@
1
+ ## What this changes
2
+
3
+ <!-- One or two sentences. -->
4
+
5
+ ## Checks
6
+
7
+ - [ ] `uv run pytest -q`, `uv run ruff check .` and `uv run ruff format --check .` pass
8
+ - [ ] Tests added or updated for any change in behaviour
9
+ - [ ] `docs/contract.md` or `docs/tools.md` edited first if the API, a tool or an error code changed
10
+ - [ ] `CHANGELOG.md` updated
11
+ - [ ] No token, recording, patient data or private path in the diff
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ concurrency:
11
+ group: ci-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ check:
16
+ name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
17
+ runs-on: ${{ matrix.os }}
18
+ timeout-minutes: 20
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ os: [ubuntu-latest, macos-latest]
23
+ python-version: ["3.10", "3.12"]
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+ with:
27
+ persist-credentials: false
28
+ - uses: astral-sh/setup-uv@v10.3.3
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ enable-cache: true
32
+ - name: Install
33
+ run: uv sync
34
+ - name: Tests
35
+ run: uv run pytest -q
36
+ - name: Lint
37
+ run: uv run ruff check .
38
+ - name: Format
39
+ run: uv run ruff format --check .
40
+ - name: Build
41
+ run: uv build
@@ -0,0 +1,68 @@
1
+ name: Release insai
2
+
3
+ # The `insai` package (packages/insai): it installs nexus-workbench and adds the `insai`
4
+ # command. Push a tag like insai-v0.0.1 to build and publish it to PyPI. Run it by hand
5
+ # (workflow_dispatch) for a dry build that publishes nothing.
6
+
7
+ on:
8
+ push:
9
+ tags:
10
+ - "insai-v*.*.*"
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ concurrency:
17
+ group: release-insai-${{ github.ref }}
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ build:
22
+ name: Build and check
23
+ runs-on: ubuntu-latest
24
+ timeout-minutes: 10
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+ with:
28
+ persist-credentials: false
29
+ - uses: astral-sh/setup-uv@v10.3.3
30
+ with:
31
+ python-version: "3.12"
32
+ enable-cache: false
33
+ - name: Check the tag matches the version
34
+ if: github.event_name == 'push'
35
+ env:
36
+ TAG: ${{ github.ref_name }}
37
+ run: |
38
+ version=$(python3 -c "import tomllib;print(tomllib.load(open('packages/insai/pyproject.toml','rb'))['project']['version'])")
39
+ test "$TAG" = "insai-v$version" || { echo "::error::tag $TAG does not match insai $version"; exit 1; }
40
+ - name: Build
41
+ run: uv build packages/insai --out-dir dist
42
+ # Needs nexus-workbench on PyPI already: publish it (tag vX.Y.Z) before insai.
43
+ - name: The insai command runs
44
+ run: uvx --from "$(ls dist/*.whl)" insai --version
45
+ - uses: actions/upload-artifact@v7
46
+ with:
47
+ name: dist-insai
48
+ path: dist/
49
+ if-no-files-found: error
50
+
51
+ publish:
52
+ name: Publish to PyPI
53
+ needs: build
54
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/insai-v')
55
+ runs-on: ubuntu-latest
56
+ timeout-minutes: 10
57
+ environment:
58
+ name: pypi
59
+ url: https://pypi.org/p/insai
60
+ permissions:
61
+ id-token: write
62
+ steps:
63
+ - uses: actions/download-artifact@v8
64
+ with:
65
+ name: dist-insai
66
+ path: dist/
67
+ - name: Publish with trusted publishing
68
+ uses: pypa/gh-action-pypi-publish@v1.14.3
@@ -0,0 +1,104 @@
1
+ name: Release
2
+
3
+ # Push a tag like v1.2.3 to build, publish to PyPI and create a GitHub release.
4
+ # Run it by hand (workflow_dispatch) for a dry build: it builds and uploads the files
5
+ # as an artifact, and publishes nothing.
6
+
7
+ on:
8
+ push:
9
+ tags:
10
+ - "v*.*.*"
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ concurrency:
17
+ group: release-${{ github.ref }}
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ build:
22
+ name: Build and check
23
+ runs-on: ubuntu-latest
24
+ timeout-minutes: 20
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+ with:
28
+ persist-credentials: false
29
+ - uses: astral-sh/setup-uv@v10.3.3
30
+ with:
31
+ python-version: "3.12"
32
+ enable-cache: false
33
+ - name: Check the tag matches the version
34
+ if: github.event_name == 'push'
35
+ env:
36
+ TAG: ${{ github.ref_name }}
37
+ run: python3 scripts/bump_version.py --check "$TAG"
38
+ - name: Show the version (dry build)
39
+ if: github.event_name != 'push'
40
+ run: python3 scripts/bump_version.py --show
41
+ - name: Install
42
+ run: uv sync
43
+ - name: Tests
44
+ run: uv run pytest -q
45
+ - name: Lint
46
+ run: uv run ruff check .
47
+ - name: Format
48
+ run: uv run ruff format --check .
49
+ - name: Build
50
+ run: uv build
51
+ - uses: actions/upload-artifact@v7
52
+ with:
53
+ name: dist
54
+ path: dist/
55
+ if-no-files-found: error
56
+
57
+ publish:
58
+ name: Publish to PyPI
59
+ needs: build
60
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
61
+ runs-on: ubuntu-latest
62
+ timeout-minutes: 10
63
+ environment:
64
+ name: pypi
65
+ url: https://pypi.org/p/nexus-workbench
66
+ permissions:
67
+ id-token: write
68
+ steps:
69
+ - uses: actions/download-artifact@v8
70
+ with:
71
+ name: dist
72
+ path: dist/
73
+ - name: Publish with trusted publishing
74
+ uses: pypa/gh-action-pypi-publish@v1.14.3
75
+
76
+ github-release:
77
+ name: Create the GitHub release
78
+ needs: publish
79
+ runs-on: ubuntu-latest
80
+ timeout-minutes: 10
81
+ permissions:
82
+ contents: write
83
+ steps:
84
+ - uses: actions/checkout@v7
85
+ with:
86
+ persist-credentials: false
87
+ - uses: actions/download-artifact@v8
88
+ with:
89
+ name: dist
90
+ path: dist/
91
+ - name: Write the release notes from the changelog
92
+ env:
93
+ TAG: ${{ github.ref_name }}
94
+ run: python3 scripts/changelog_notes.py "$TAG" > release-notes.md
95
+ - name: Create the release
96
+ env:
97
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98
+ TAG: ${{ github.ref_name }}
99
+ run: >-
100
+ gh release create "$TAG" dist/*
101
+ --repo "$GITHUB_REPOSITORY"
102
+ --title "$TAG"
103
+ --notes-file release-notes.md
104
+ --verify-tag
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .coverage
10
+ htmlcov/
11
+ .env
12
+ .env.*
13
+ *.edf
14
+ !tests/data/*.edf
15
+ .DS_Store
16
+ .wt/
@@ -0,0 +1 @@
1
+ {"mcpServers":{"nexus":{"command":"uvx","args":["nexus-workbench","mcp"]}}}
@@ -0,0 +1,94 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are listed here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.2.1] - 2026-11-24
8
+
9
+ Small changes that help an agent on its first try.
10
+
11
+ ### Added
12
+
13
+ - When a tool cannot run, its error now also comes as structured data: a stable `code`
14
+ from docs/contract.md, the reason, `howToFix` (the exact commands to run in your own
15
+ terminal, such as `nexus-workbench login --scope marks:write`), `localAlternative` (the
16
+ local tools that still work, for example when you are signed out or agent access is not
17
+ on yet), `retryAfter` after a rate limit, and `requestId` when the server sends one. The
18
+ sentence for you is still there. No step ever asks for a token in the chat.
19
+ - Four MCP prompts: `qc_edf_file`, `scorer_agreement`, `band_power_by_stage` and
20
+ `review_workspace_recordings`. The first three work signed out on the files
21
+ `nexus-workbench sample` writes.
22
+ - A one-line notice when a newer version is on PyPI: in one tool result per session and in
23
+ `doctor`. It checks at most once a day, waits at most two seconds, and says nothing when
24
+ offline. `NEXUS_WORKBENCH_NO_UPDATE_CHECK=1` turns it off.
25
+ - `server.json` for the MCP Registry and `llms-install.md` with install steps for agents.
26
+ - "Try it in 60 seconds" in the README: three things to ask that work signed out.
27
+
28
+ ### Changed
29
+
30
+ - The command line prints the server's request id after an error message when there is
31
+ one (with `--json`, as `requestId`).
32
+ - `scripts/bump_version.py` also sets the version in `server.json`.
33
+
34
+ ## [0.2.0] - 2026-11-24
35
+
36
+ The first public release. It connects Claude Code and Codex to an Insai Workbench
37
+ workspace and adds local tools for EEG files. It implements agent API version 1.1
38
+ (docs/contract.md): scopes, per-epoch and per-event reads, and writes that land as a
39
+ review layer for members to review. Writes work only in a workspace where Insai staff
40
+ have switched on agent writes.
41
+
42
+ ### Added
43
+
44
+ - Command line `nexus-workbench` (also installed as `nexus`):
45
+ - `setup`: install the command with uv, register the MCP server `nexus` with Claude
46
+ Code and Codex, copy the skills, and sign in. `--agent`, `--no-login`, `--dry-run`,
47
+ `--yes`.
48
+ - `login`: sign in by approving this computer in the browser and typing the code shown,
49
+ or with `--token` by pasting a token. `--keyring` stores it in the system keyring.
50
+ - `logout`, `whoami`, `recordings`, `doctor` and `mcp`.
51
+ - `members`, `tasks`, `nights`, `layers`, `events`, `stages`, `quality`, `marks`,
52
+ `propose` (with `--dry-run`), `withdraw`, `task give` and `analyse`, each with `--json`
53
+ and an example in `--help`. `events --save` and `stages --save` write files the local
54
+ comparisons read. Tables have aligned columns and respect `NO_COLOR`.
55
+ - `sample`: write a synthetic night (EDF, two hypnograms, two event files) to try the
56
+ local tools on.
57
+ - `qc` and `preprocess` for local EDF files.
58
+ - Error messages with a stable code and the next step, and a JSON error object under
59
+ `--json`.
60
+ - Scopes. `nexus-workbench login --scope <scope>` (repeatable; `read` is always included)
61
+ asks for `detail`, `marks:write`, `tasks:write` or `analysis:run`. The approved scopes
62
+ are saved with the token and shown by `login`, `whoami` and `doctor`. The approval page
63
+ refuses write scopes in a workspace without agent writes.
64
+ - MCP server `nexus` with 22 tools, each with typed output and annotations:
65
+ - Read (`read` scope): `whoami`, `list_projects`, `list_recordings`, `get_recording`,
66
+ `list_members`, `list_tasks`, `list_nights`, `list_layers`.
67
+ - Detail (`detail` scope): `get_events`, `get_stages`, `get_quality`, `list_marks`.
68
+ - Write: `propose_marks` and `withdraw_marks` (`marks:write`), `create_review_task`
69
+ (`tasks:write`), `request_analysis` (`analysis:run`). Proposed marks form a review
70
+ layer of the token's own and never change anyone's scoring. `request_analysis` is
71
+ checked and then answered with `not_available` for now; use Analyse on the recording
72
+ page.
73
+ - Local (no account, no network): `inspect_edf`, `check_signal_quality`,
74
+ `compute_band_power`, `compare_hypnograms`, `compare_events`, `preprocess`.
75
+ `preprocess` band-passes, notches, resamples and picks channels into a new EDF file
76
+ and never changes the input. `compare_hypnograms` and `compare_events` can take one
77
+ side from a Workbench recording.
78
+ - The server lists detail and write tools only when the saved token has their scope,
79
+ read from the credentials file at start with no call.
80
+ - Thirteen skills: `connect-workbench`, `edf-intake`, `signal-qc`, `preprocess-and-qc`,
81
+ `band-power-by-stage`, `scorer-agreement`, `event-detector-eval`, `review-loop`,
82
+ `nights-by-person`, `prereg`, `verify-before-verdict`, `leakage-check`, `stats-rails`.
83
+ - Plugins for Claude Code (`.claude-plugin/`) and Codex (`.codex-plugin/`), from the
84
+ `insai` marketplace in this repository.
85
+ - The local tools as a Python module, `nexus_workbench.local.api`.
86
+ - Requesting agent access. A workspace without agent access answers "Agent access is not
87
+ on for this workspace yet" and points to Request agent access in Workbench (account
88
+ menu, Connect an agent). The local tools work without it.
89
+ - Releases from a version tag: the package goes to PyPI with trusted publishing, and the
90
+ GitHub release gets the changelog section as notes. `scripts/bump_version.py` sets the
91
+ version in all four places it is written.
92
+
93
+ [0.2.1]: https://github.com/Insai/nexus-workbench/releases/tag/v0.2.1
94
+ [0.2.0]: https://github.com/Insai/nexus-workbench/releases/tag/v0.2.0
@@ -0,0 +1,187 @@
1
+ # Contributing
2
+
3
+ Thanks for helping. Bug reports, fixes and clearer docs are all welcome.
4
+
5
+ ## Set up
6
+
7
+ You need [uv](https://docs.astral.sh/uv/) and git.
8
+
9
+ ```sh
10
+ git clone https://github.com/Insai/nexus-workbench.git
11
+ cd nexus-workbench
12
+ uv sync
13
+ ```
14
+
15
+ `uv sync` creates `.venv` with the package and the dev tools.
16
+
17
+ ## Check your change
18
+
19
+ Run these from the repository root. All of them must pass before a pull request is
20
+ merged.
21
+
22
+ ```sh
23
+ uv run pytest -q
24
+ uv run ruff check .
25
+ uv run ruff format --check .
26
+ uv build
27
+ claude plugin validate . --strict
28
+ ```
29
+
30
+ The last line needs Claude Code. It checks the plugin and marketplace manifests.
31
+
32
+ Tests never contact Workbench. The workspace tools are tested against a fake API in
33
+ `tests/fake_api.py`, which implements the contract's version 1.1 rules (scopes, switches,
34
+ blinding, caps, `opId`, audit). A change to those rules starts in the contract, then the
35
+ fake, then the client.
36
+
37
+ ## Test a wheel before a release
38
+
39
+ A development build is not on the package index, so `setup` run from it cannot install
40
+ it from there. Point uv at the folder that holds the wheel:
41
+
42
+ ```sh
43
+ uv build
44
+ UV_FIND_LINKS=dist uvx --from dist/nexus_workbench-<version>-py3-none-any.whl nexus-workbench setup
45
+ ```
46
+
47
+ Or install the wheel yourself with `uv tool install <path-to-wheel>`, then run
48
+ `nexus-workbench setup`.
49
+
50
+ To keep your own agent config untouched, set `CLAUDE_CONFIG_DIR`, `CODEX_HOME`,
51
+ `UV_TOOL_DIR`, `UV_TOOL_BIN_DIR` and `NEXUS_WORKBENCH_CONFIG_DIR` to empty folders
52
+ first.
53
+
54
+ ## Testing a branch against a staging server
55
+
56
+ To try a branch before it is released, install it from that branch:
57
+
58
+ ```sh
59
+ uv tool install --force git+https://github.com/Insai/nexus-workbench@<branch>
60
+ ```
61
+
62
+ Point it at the server you test against in the shell you use for the rest of these
63
+ steps:
64
+
65
+ ```sh
66
+ export NEXUS_API_URL=<staging API URL>
67
+ ```
68
+
69
+ Sign in with the scopes you want to test. Each `--scope` adds one; `read` is always
70
+ included:
71
+
72
+ ```sh
73
+ nexus-workbench login --scope detail --scope marks:write --scope tasks:write
74
+ ```
75
+
76
+ Then register the MCP server without signing in again:
77
+
78
+ ```sh
79
+ nexus-workbench setup --no-login
80
+ ```
81
+
82
+ `setup` saves `NEXUS_API_URL` with the server entry, so your agent talks to the same
83
+ server. Restart the agent session to pick it up. To go back to the released version, run
84
+ `uv tool install --force nexus-workbench`, unset `NEXUS_API_URL`, then run
85
+ `nexus-workbench setup` again.
86
+
87
+ ## Rules for changes
88
+
89
+ - **Contract first.** [docs/contract.md](docs/contract.md) is the source of truth for the
90
+ Workbench API and the error codes. A change to a request, a reply or a code starts as
91
+ an edit to that file. [docs/tools.md](docs/tools.md) does the same for the local tools.
92
+ - **Writes are scoped and reviewed.** A tool changes Workbench only with a write scope the
93
+ person chose, and its result is a proposal members review or exactly what the person
94
+ could do from the page (contract section 7). Read tools stay read-only. A local tool
95
+ never changes an existing file; `preprocess` writes only a new one.
96
+ - **Privacy.** No tool returns names, paths, EDF header identity fields or raw samples.
97
+ Keep the rules in the README's Privacy section true.
98
+ - **Plain language.** Short sentences. Say what happened and what to do next. No hype
99
+ words. Keep the research-use notice where it is.
100
+ - **Tests.** Every change in behaviour comes with a test. Update tests that assert text
101
+ you changed.
102
+ - **Changelog.** Add a line under the unreleased version in
103
+ [CHANGELOG.md](CHANGELOG.md).
104
+
105
+ ## Releasing
106
+
107
+ Pushing a tag like `v1.2.3` runs [.github/workflows/release.yml](.github/workflows/release.yml).
108
+ It checks that the tag matches the version in the package, runs the checks, builds,
109
+ publishes to PyPI and creates a GitHub release with the changelog section as notes and
110
+ the built files attached.
111
+
112
+ The version is written in five places: `pyproject.toml`,
113
+ `src/nexus_workbench/__init__.py`, `.claude-plugin/plugin.json`,
114
+ `.codex-plugin/plugin.json` and `server.json` (the MCP Registry entry, twice).
115
+ `scripts/bump_version.py` sets them all, and a test fails if they differ.
116
+
117
+ 1. Set the version:
118
+
119
+ ```sh
120
+ python scripts/bump_version.py 1.2.3
121
+ ```
122
+
123
+ 2. In [CHANGELOG.md](CHANGELOG.md), replace `unreleased` in the `## [1.2.3]` heading
124
+ with today's date, like `## [1.2.3] – 2030-01-31`.
125
+ 3. Check that the release will be accepted, then run the checks above:
126
+
127
+ ```sh
128
+ python scripts/bump_version.py --check v1.2.3
129
+ ```
130
+
131
+ 4. Commit on `main` and push the commit.
132
+ 5. Tag and push the tag:
133
+
134
+ ```sh
135
+ git tag v1.2.3
136
+ git push origin v1.2.3
137
+ ```
138
+
139
+ 6. Approve the `pypi` deployment in the Actions run, if the environment asks for it.
140
+ 7. After the release, set the next development version, like
141
+ `python scripts/bump_version.py 1.2.4.dev0`, and add a new unreleased section to the
142
+ changelog.
143
+
144
+ The release stops before publishing if any of the versions differs from the tag,
145
+ if a version contains `dev`, or if the changelog section is missing or still says
146
+ unreleased.
147
+
148
+ To try the build without publishing, run the Release workflow by hand from the Actions
149
+ tab. It builds and uploads `dist/` as an artifact, and skips PyPI and the GitHub
150
+ release.
151
+
152
+ ### One-time setup
153
+
154
+ PyPI uses trusted publishing, so there is no token to store.
155
+
156
+ 1. On PyPI, open Your account, then Publishing, and add a pending publisher under
157
+ GitHub (it turns into a normal trusted publisher on the first upload):
158
+ - PyPI project name: `nexus-workbench`
159
+ - Owner: `Insai`
160
+ - Repository name: `nexus-workbench`
161
+ - Workflow name: `release.yml`
162
+ - Environment name: `pypi`
163
+ 2. On GitHub, open the repository's Settings, then Environments, and create an
164
+ environment named `pypi`:
165
+ - Required reviewers: add at least one maintainer, so every upload waits for a
166
+ person to approve it.
167
+ - Deployment branches and tags: choose selected branches and tags, and add the tag
168
+ rules `v*.*.*` and `insai-v*.*.*`.
169
+
170
+ ### The `insai` package
171
+
172
+ `packages/insai` is a small package that installs `nexus-workbench` and adds the `insai`
173
+ command (the same CLI). Pushing a tag like `insai-v0.0.1` runs
174
+ [.github/workflows/release-insai.yml](.github/workflows/release-insai.yml), which builds it,
175
+ checks the `insai` command runs, and publishes it through the same `pypi` environment.
176
+
177
+ - Its version lives only in `packages/insai/pyproject.toml` and
178
+ `packages/insai/src/insai/__init__.py`.
179
+ - Publish `nexus-workbench` first: `insai` depends on it, and the release checks the
180
+ command runs against the version on PyPI.
181
+ - PyPI needs a second trusted publisher: project `insai`, owner `Insai`, repository
182
+ `nexus-workbench`, workflow `release-insai.yml`, environment `pypi`.
183
+
184
+ ## Report a problem
185
+
186
+ Open an issue with the bug report or feature request form. For a security problem, see
187
+ [SECURITY.md](SECURITY.md) instead.