spanreed-bus 0.0.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.
- spanreed_bus-0.0.1/.claude/settings.local.json +8 -0
- spanreed_bus-0.0.1/.claude-plugin/marketplace.json +18 -0
- spanreed_bus-0.0.1/.github/workflows/ci.yml +33 -0
- spanreed_bus-0.0.1/.gitignore +30 -0
- spanreed_bus-0.0.1/.pre-commit-config.yaml +26 -0
- spanreed_bus-0.0.1/.python-version +1 -0
- spanreed_bus-0.0.1/CLAUDE.md +67 -0
- spanreed_bus-0.0.1/LICENSE +201 -0
- spanreed_bus-0.0.1/Makefile +61 -0
- spanreed_bus-0.0.1/PKG-INFO +91 -0
- spanreed_bus-0.0.1/README.md +72 -0
- spanreed_bus-0.0.1/docs/architecture.md +75 -0
- spanreed_bus-0.0.1/docs/development.md +57 -0
- spanreed_bus-0.0.1/docs/findings.md +166 -0
- spanreed_bus-0.0.1/docs/open-questions.md +30 -0
- spanreed_bus-0.0.1/docs/protocol.md +109 -0
- spanreed_bus-0.0.1/experiments/bus-test/.claude-plugin/plugin.json +8 -0
- spanreed_bus-0.0.1/experiments/bus-test/inbox.txt +5 -0
- spanreed_bus-0.0.1/experiments/bus-test/monitors/monitors.json +7 -0
- spanreed_bus-0.0.1/experiments/cross-session/README.md +54 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-alice/.claude-plugin/plugin.json +6 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-alice/hooks/hooks.json +24 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-alice/hooks/session-start.sh +14 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-alice/monitors/monitors.json +7 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-bob/.claude-plugin/plugin.json +6 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-bob/hooks/hooks.json +24 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-bob/hooks/session-start.sh +14 -0
- spanreed_bus-0.0.1/experiments/cross-session/spanreed-bob/monitors/monitors.json +7 -0
- spanreed_bus-0.0.1/plugins/spanreed/.claude-plugin/plugin.json +11 -0
- spanreed_bus-0.0.1/plugins/spanreed/.mcp.json +8 -0
- spanreed_bus-0.0.1/plugins/spanreed/hooks/hooks.json +24 -0
- spanreed_bus-0.0.1/plugins/spanreed/monitors/monitors.json +7 -0
- spanreed_bus-0.0.1/pyproject.toml +77 -0
- spanreed_bus-0.0.1/src/spanreed/__init__.py +3 -0
- spanreed_bus-0.0.1/src/spanreed/cli.py +312 -0
- spanreed_bus-0.0.1/src/spanreed/identity.py +34 -0
- spanreed_bus-0.0.1/src/spanreed/mcp_server.py +247 -0
- spanreed_bus-0.0.1/src/spanreed/protocol.py +61 -0
- spanreed_bus-0.0.1/src/spanreed/store.py +324 -0
- spanreed_bus-0.0.1/tests/__init__.py +0 -0
- spanreed_bus-0.0.1/tests/conftest.py +24 -0
- spanreed_bus-0.0.1/tests/integration/__init__.py +0 -0
- spanreed_bus-0.0.1/tests/integration/test_cli.py +366 -0
- spanreed_bus-0.0.1/tests/integration/test_mcp_server.py +215 -0
- spanreed_bus-0.0.1/tests/unit/__init__.py +0 -0
- spanreed_bus-0.0.1/tests/unit/test_smoke.py +41 -0
- spanreed_bus-0.0.1/tests/unit/test_store.py +367 -0
- spanreed_bus-0.0.1/uv.lock +879 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
|
|
3
|
+
"name": "spanreed",
|
|
4
|
+
"description": "Spanreed inter-agent message bus for local Claude Code sessions",
|
|
5
|
+
"owner": {
|
|
6
|
+
"name": "Jason Monk",
|
|
7
|
+
"email": "monkopedia@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"plugins": [
|
|
10
|
+
{
|
|
11
|
+
"name": "spanreed",
|
|
12
|
+
"description": "Inter-agent message bus: register sessions, exchange messages, escalate to user when needed.",
|
|
13
|
+
"source": "./plugins/spanreed",
|
|
14
|
+
"category": "productivity",
|
|
15
|
+
"homepage": "https://github.com/Monkopedia/spanreed"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
check:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Install uv
|
|
16
|
+
uses: astral-sh/setup-uv@v4
|
|
17
|
+
with:
|
|
18
|
+
enable-cache: true
|
|
19
|
+
|
|
20
|
+
- name: Sync dependencies
|
|
21
|
+
run: uv sync --frozen
|
|
22
|
+
|
|
23
|
+
- name: Format check
|
|
24
|
+
run: uv run ruff format --check
|
|
25
|
+
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: uv run ruff check
|
|
28
|
+
|
|
29
|
+
- name: Type check
|
|
30
|
+
run: uv run pyright
|
|
31
|
+
|
|
32
|
+
- name: Test
|
|
33
|
+
run: uv run pytest
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# OS
|
|
2
|
+
.DS_Store
|
|
3
|
+
Thumbs.db
|
|
4
|
+
|
|
5
|
+
# Editor
|
|
6
|
+
.vscode/
|
|
7
|
+
.idea/
|
|
8
|
+
*.swp
|
|
9
|
+
*~
|
|
10
|
+
|
|
11
|
+
# Python
|
|
12
|
+
__pycache__/
|
|
13
|
+
*.pyc
|
|
14
|
+
*.pyo
|
|
15
|
+
.venv/
|
|
16
|
+
venv/
|
|
17
|
+
*.egg-info/
|
|
18
|
+
build/
|
|
19
|
+
dist/
|
|
20
|
+
.pytest_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
.pyright/
|
|
23
|
+
.python-version.local
|
|
24
|
+
|
|
25
|
+
# Node
|
|
26
|
+
node_modules/
|
|
27
|
+
|
|
28
|
+
# Spanreed runtime state (when we have it)
|
|
29
|
+
state/
|
|
30
|
+
*.log
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: local
|
|
3
|
+
hooks:
|
|
4
|
+
- id: ruff-format
|
|
5
|
+
name: ruff format
|
|
6
|
+
entry: uv run ruff format
|
|
7
|
+
language: system
|
|
8
|
+
types: [python]
|
|
9
|
+
- id: ruff-check
|
|
10
|
+
name: ruff check
|
|
11
|
+
entry: uv run ruff check --fix
|
|
12
|
+
language: system
|
|
13
|
+
types: [python]
|
|
14
|
+
- id: pyright
|
|
15
|
+
name: pyright
|
|
16
|
+
entry: uv run pyright
|
|
17
|
+
language: system
|
|
18
|
+
types: [python]
|
|
19
|
+
pass_filenames: false
|
|
20
|
+
- id: pytest
|
|
21
|
+
name: pytest
|
|
22
|
+
entry: uv run pytest -q
|
|
23
|
+
language: system
|
|
24
|
+
types: [python]
|
|
25
|
+
pass_filenames: false
|
|
26
|
+
stages: [pre-push]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Working in this repo
|
|
2
|
+
|
|
3
|
+
Project ethos: **correctness over speed**. Claude can make development fast; the human's job is to ensure it stays correct and maintainable. These rules exist to keep that property as the codebase grows.
|
|
4
|
+
|
|
5
|
+
## Architecture summary
|
|
6
|
+
|
|
7
|
+
Spanreed is an inter-agent message bus for local Claude Code sessions. Each session runs a plugin (`plugins/spanreed/`) that includes:
|
|
8
|
+
|
|
9
|
+
- A **SessionStart hook** that injects bus topology into Claude's context.
|
|
10
|
+
- A **Monitor** that surfaces inbox notifications as Claude wakes events.
|
|
11
|
+
- An **MCP server** (`src/spanreed/mcp_server.py`) providing typed bus tools.
|
|
12
|
+
|
|
13
|
+
Sessions coordinate through filesystem state under `~/.claude/spanreed/` (registry, per-agent inboxes, per-session cursors). There is no central daemon; each plugin's MCP server is per-session and reads/writes shared files.
|
|
14
|
+
|
|
15
|
+
`docs/architecture.md` is the authoritative design doc. `docs/protocol.md` is the bus wire-format spec. Always defer to those over inference from code.
|
|
16
|
+
|
|
17
|
+
## Rules
|
|
18
|
+
|
|
19
|
+
1. **Docs are authoritative for design.** Behavior changes (especially anything that touches the wire format, the MCP tool surface, or filesystem layout) require updating `docs/architecture.md` or `docs/protocol.md` in the same commit. Don't infer design from code; if the doc is wrong, fix the doc.
|
|
20
|
+
|
|
21
|
+
2. **Tests required for new code paths.** If you add a function, add a test. If you change behavior, update the test. Run `make test` before commit. Pre-commit gates this.
|
|
22
|
+
|
|
23
|
+
3. **Findings ≠ design.** Empirical results from running experiments go in `docs/findings.md`. Decisions about how things *should* work go in `docs/architecture.md` or `docs/protocol.md`. Don't mix them.
|
|
24
|
+
|
|
25
|
+
4. **Open questions get tracked.** If a design decision was deferred, it goes in `docs/open-questions.md` — don't leave TODO comments in code as a substitute.
|
|
26
|
+
|
|
27
|
+
5. **No silent scope creep.** Don't add features, refactor adjacent code, or introduce abstractions beyond what the task requires. Cleanups belong in their own commits with a description of why.
|
|
28
|
+
|
|
29
|
+
6. **The README is tested by being run.** If you change install or usage flow, manually re-run the README commands and update them in the same commit. The README is not aspirational; it is the truth.
|
|
30
|
+
|
|
31
|
+
7. **Visibility over hiding.** For anything user-facing in bus UX (notification text, status indicators, monitor output), prefer verbose and legible over clean and hidden. The user wants to *see* inter-agent reasoning, not abstract it away.
|
|
32
|
+
|
|
33
|
+
8. **Surface design calls, don't decide alone.** When implementing reveals a design ambiguity not covered by the docs, ask the user before deciding. Then update the docs with the resolution.
|
|
34
|
+
|
|
35
|
+
## How to run things
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
make install # sync dependencies
|
|
39
|
+
make test # run pytest
|
|
40
|
+
make lint # ruff check + pyright
|
|
41
|
+
make fmt # ruff format + ruff check --fix
|
|
42
|
+
make check # everything (CI parity)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For dev install of the plugin: `make install-plugin` (puts the plugin into Claude Code at user scope from the local dir).
|
|
46
|
+
|
|
47
|
+
## Commit style
|
|
48
|
+
|
|
49
|
+
- Subject line ≤ 70 chars, present tense, explains intent.
|
|
50
|
+
- Body explains the **why**, not the what.
|
|
51
|
+
- Co-author trailer for Claude commits (the harness adds this automatically).
|
|
52
|
+
- One concern per commit; mixed-concern commits get split.
|
|
53
|
+
|
|
54
|
+
## Where things live
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
src/spanreed/ Python package (MCP server, store, CLI)
|
|
58
|
+
tests/ pytest tests (unit/, integration/)
|
|
59
|
+
plugins/spanreed/ the real Claude Code plugin
|
|
60
|
+
experiments/ validation scaffolds from the design phase (kept for reference)
|
|
61
|
+
docs/ architecture, protocol, findings, open questions
|
|
62
|
+
.claude-plugin/ marketplace manifest (this repo doubles as a single-plugin marketplace)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Git workflow
|
|
66
|
+
|
|
67
|
+
For now: **direct commits to main** with discipline (pre-commit must pass). Once v1 is usable, switch to **PR-based workflow** and dogfood spanreed for cross-session PR review (the project's whole motivating use case).
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer or computer failure or malfunction, or any
|
|
162
|
+
and all other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend, and
|
|
172
|
+
hold each Contributor harmless for any liability incurred by, or
|
|
173
|
+
claims asserted against, such Contributor by reason of your accepting
|
|
174
|
+
any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Jason Monk
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing permissions
|
|
201
|
+
and limitations under the License.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.PHONY: install install-dev uninstall test lint fmt fmt-check check clean experiment-monitor experiment-cross-session help
|
|
2
|
+
|
|
3
|
+
UV := uv
|
|
4
|
+
PYTHON := $(UV) run python
|
|
5
|
+
|
|
6
|
+
help:
|
|
7
|
+
@echo "Common targets:"
|
|
8
|
+
@echo " make install - install spanreed-bus + dev deps (editable)"
|
|
9
|
+
@echo " make install-plugin - load the spanreed plugin into Claude Code (user scope)"
|
|
10
|
+
@echo " make uninstall - remove installed spanreed-bus"
|
|
11
|
+
@echo " make test - run pytest"
|
|
12
|
+
@echo " make lint - run ruff check + pyright"
|
|
13
|
+
@echo " make fmt - run ruff format + ruff check --fix"
|
|
14
|
+
@echo " make fmt-check - verify formatting without modifying"
|
|
15
|
+
@echo " make check - fmt-check + lint + test (CI parity)"
|
|
16
|
+
@echo " make clean - remove build/cache artifacts"
|
|
17
|
+
@echo " make experiment-monitor - launch the bus-test plugin"
|
|
18
|
+
@echo " make experiment-cross-session - print instructions for the cross-session test"
|
|
19
|
+
|
|
20
|
+
install:
|
|
21
|
+
$(UV) sync
|
|
22
|
+
|
|
23
|
+
install-plugin:
|
|
24
|
+
@echo "Loading plugin from $(CURDIR)/plugins/spanreed into Claude Code (user scope)..."
|
|
25
|
+
claude /plugin install $(CURDIR)/plugins/spanreed --scope user
|
|
26
|
+
|
|
27
|
+
uninstall:
|
|
28
|
+
$(UV) tool uninstall spanreed-bus 2>/dev/null || true
|
|
29
|
+
|
|
30
|
+
test:
|
|
31
|
+
$(UV) run pytest
|
|
32
|
+
|
|
33
|
+
lint:
|
|
34
|
+
$(UV) run ruff check
|
|
35
|
+
$(UV) run pyright
|
|
36
|
+
|
|
37
|
+
fmt:
|
|
38
|
+
$(UV) run ruff format
|
|
39
|
+
$(UV) run ruff check --fix
|
|
40
|
+
|
|
41
|
+
fmt-check:
|
|
42
|
+
$(UV) run ruff format --check
|
|
43
|
+
$(UV) run ruff check
|
|
44
|
+
|
|
45
|
+
check: fmt-check lint test
|
|
46
|
+
|
|
47
|
+
clean:
|
|
48
|
+
rm -rf build/ dist/ .pytest_cache/ .ruff_cache/ .pyright/ src/*.egg-info/
|
|
49
|
+
find . -type d -name __pycache__ -prune -exec rm -rf {} +
|
|
50
|
+
|
|
51
|
+
experiment-monitor:
|
|
52
|
+
claude --plugin-dir $(CURDIR)/experiments/bus-test
|
|
53
|
+
|
|
54
|
+
experiment-cross-session:
|
|
55
|
+
@echo "Cross-session test requires two terminals. In two separate terminals, run:"
|
|
56
|
+
@echo ""
|
|
57
|
+
@echo " rm -rf /tmp/spanreed-test # reset state once before either session starts"
|
|
58
|
+
@echo " claude --plugin-dir $(CURDIR)/experiments/cross-session/spanreed-alice"
|
|
59
|
+
@echo " claude --plugin-dir $(CURDIR)/experiments/cross-session/spanreed-bob"
|
|
60
|
+
@echo ""
|
|
61
|
+
@echo "Then in alice's terminal, try: 'Send a message to bob asking what TS version they use.'"
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spanreed-bus
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Inter-agent message bus for local Claude Code sessions
|
|
5
|
+
Project-URL: Repository, https://github.com/Monkopedia/spanreed
|
|
6
|
+
Author-email: Jason Monk <monkopedia@gmail.com>
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: agent,bus,claude-code,ipc,mcp
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.12
|
|
15
|
+
Requires-Dist: anyio>=4.0
|
|
16
|
+
Requires-Dist: mcp>=1.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# Spanreed
|
|
21
|
+
|
|
22
|
+
An inter-agent message bus for local Claude Code sessions. Run one Claude session per repo; let them coordinate.
|
|
23
|
+
|
|
24
|
+
> **Status**: alpha. The architecture and primitives are validated (see [`docs/findings.md`](docs/findings.md)) and a working implementation is in place — pending end-to-end manual smoke test in real Claude Code. Not yet published to PyPI or the official marketplace.
|
|
25
|
+
|
|
26
|
+
Named after the [spanreed](https://stormlightarchive.fandom.com/wiki/Spanreed): a paired magical writing tool from the Stormlight Archive that transmits text across vast distances. One side writes, the other side reads.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
Once published (not yet on PyPI):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv tool install spanreed-bus
|
|
34
|
+
claude /plugin marketplace add Monkopedia/spanreed
|
|
35
|
+
claude /plugin install spanreed@spanreed
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For now, from a local clone:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone git@github.com:Monkopedia/spanreed.git
|
|
42
|
+
cd spanreed
|
|
43
|
+
uv tool install --editable .
|
|
44
|
+
claude /plugin install $(pwd)/plugins/spanreed --scope user
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The MCP server (`spanreed-mcp`) and CLI (`spanreed`) need to be on `$PATH` for the plugin to find them — `uv tool install` handles this.
|
|
48
|
+
|
|
49
|
+
## Quickstart
|
|
50
|
+
|
|
51
|
+
Open two terminals, each in a different repo:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Terminal A
|
|
55
|
+
cd ~/projects/repo-a && claude
|
|
56
|
+
|
|
57
|
+
# Terminal B
|
|
58
|
+
cd ~/projects/repo-b && claude
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
In terminal A, ask Claude to talk to the other session:
|
|
62
|
+
|
|
63
|
+
> Ask agent at repo-b what version of Node it's using.
|
|
64
|
+
|
|
65
|
+
Claude in repo-A discovers the peer, sends the question, the peer answers, the answer comes back. The conversation is visible in both transcripts.
|
|
66
|
+
|
|
67
|
+
## How it works
|
|
68
|
+
|
|
69
|
+
Two layers on Claude Code primitives:
|
|
70
|
+
|
|
71
|
+
- **MCP server** (`spanreed-mcp`, per-session) exposes the bus API as typed tools: register, send, recv, list, `wait_for_reply` with timeout.
|
|
72
|
+
- **Plugin** (auto-loaded) wires up a SessionStart hook for bus context, a Monitor for inbound wakeups, and points Claude at the MCP server.
|
|
73
|
+
|
|
74
|
+
State lives under `~/.claude/spanreed/` (registry + per-agent inboxes + per-session cursors). No central daemon — each session's MCP server is local and coordinates through shared files.
|
|
75
|
+
|
|
76
|
+
Read the full design in [`docs/architecture.md`](docs/architecture.md). Wire-format spec in [`docs/protocol.md`](docs/protocol.md).
|
|
77
|
+
|
|
78
|
+
## Update
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv tool upgrade spanreed-bus
|
|
82
|
+
claude /plugin update spanreed@spanreed
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
See [`docs/development.md`](docs/development.md) for environment setup, running tests, and contribution conventions. The [`CLAUDE.md`](CLAUDE.md) at the root captures the discipline rules — Claude sessions working on this repo should read it.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
[Apache-2.0](LICENSE).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Spanreed
|
|
2
|
+
|
|
3
|
+
An inter-agent message bus for local Claude Code sessions. Run one Claude session per repo; let them coordinate.
|
|
4
|
+
|
|
5
|
+
> **Status**: alpha. The architecture and primitives are validated (see [`docs/findings.md`](docs/findings.md)) and a working implementation is in place — pending end-to-end manual smoke test in real Claude Code. Not yet published to PyPI or the official marketplace.
|
|
6
|
+
|
|
7
|
+
Named after the [spanreed](https://stormlightarchive.fandom.com/wiki/Spanreed): a paired magical writing tool from the Stormlight Archive that transmits text across vast distances. One side writes, the other side reads.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Once published (not yet on PyPI):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv tool install spanreed-bus
|
|
15
|
+
claude /plugin marketplace add Monkopedia/spanreed
|
|
16
|
+
claude /plugin install spanreed@spanreed
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For now, from a local clone:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone git@github.com:Monkopedia/spanreed.git
|
|
23
|
+
cd spanreed
|
|
24
|
+
uv tool install --editable .
|
|
25
|
+
claude /plugin install $(pwd)/plugins/spanreed --scope user
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The MCP server (`spanreed-mcp`) and CLI (`spanreed`) need to be on `$PATH` for the plugin to find them — `uv tool install` handles this.
|
|
29
|
+
|
|
30
|
+
## Quickstart
|
|
31
|
+
|
|
32
|
+
Open two terminals, each in a different repo:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Terminal A
|
|
36
|
+
cd ~/projects/repo-a && claude
|
|
37
|
+
|
|
38
|
+
# Terminal B
|
|
39
|
+
cd ~/projects/repo-b && claude
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
In terminal A, ask Claude to talk to the other session:
|
|
43
|
+
|
|
44
|
+
> Ask agent at repo-b what version of Node it's using.
|
|
45
|
+
|
|
46
|
+
Claude in repo-A discovers the peer, sends the question, the peer answers, the answer comes back. The conversation is visible in both transcripts.
|
|
47
|
+
|
|
48
|
+
## How it works
|
|
49
|
+
|
|
50
|
+
Two layers on Claude Code primitives:
|
|
51
|
+
|
|
52
|
+
- **MCP server** (`spanreed-mcp`, per-session) exposes the bus API as typed tools: register, send, recv, list, `wait_for_reply` with timeout.
|
|
53
|
+
- **Plugin** (auto-loaded) wires up a SessionStart hook for bus context, a Monitor for inbound wakeups, and points Claude at the MCP server.
|
|
54
|
+
|
|
55
|
+
State lives under `~/.claude/spanreed/` (registry + per-agent inboxes + per-session cursors). No central daemon — each session's MCP server is local and coordinates through shared files.
|
|
56
|
+
|
|
57
|
+
Read the full design in [`docs/architecture.md`](docs/architecture.md). Wire-format spec in [`docs/protocol.md`](docs/protocol.md).
|
|
58
|
+
|
|
59
|
+
## Update
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv tool upgrade spanreed-bus
|
|
63
|
+
claude /plugin update spanreed@spanreed
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
See [`docs/development.md`](docs/development.md) for environment setup, running tests, and contribution conventions. The [`CLAUDE.md`](CLAUDE.md) at the root captures the discipline rules — Claude sessions working on this repo should read it.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
[Apache-2.0](LICENSE).
|