@ssm-08/relay 0.4.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/.claude-plugin/plugin.json +13 -0
- package/LICENSE +182 -0
- package/README.md +158 -0
- package/bin/relay.mjs +394 -0
- package/commands/relay-handoff.toml +28 -0
- package/distiller.mjs +254 -0
- package/hooks/hooks.json +41 -0
- package/hooks/run-hook.cmd +11 -0
- package/hooks/session-start.mjs +110 -0
- package/hooks/stop.mjs +160 -0
- package/hooks/user-prompt-submit.mjs +176 -0
- package/lib/diff-memory.mjs +97 -0
- package/lib/filter.mjs +110 -0
- package/lib/memory.mjs +26 -0
- package/lib/sync.mjs +218 -0
- package/lib/transcript.mjs +120 -0
- package/lib/util.mjs +22 -0
- package/package.json +42 -0
- package/prompts/distill.md +65 -0
- package/scripts/installer.mjs +700 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "relay",
|
|
3
|
+
"description": "Shared team memory across Claude Code sessions via git-synced memory.md",
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"hooks": "hooks/hooks.json",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "ssm-08",
|
|
8
|
+
"url": "https://github.com/ssm-08"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/ssm-08/relay",
|
|
11
|
+
"repository": "https://github.com/ssm-08/relay",
|
|
12
|
+
"license": "UNLICENSED"
|
|
13
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
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 made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other transformations
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
51
|
+
or written communication sent to the Licensor or its representatives,
|
|
52
|
+
including but not limited to communication on electronic mailing lists,
|
|
53
|
+
source code control systems, and issue tracking systems that are managed
|
|
54
|
+
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
55
|
+
improving the Work, but excluding communication that is conspicuously
|
|
56
|
+
marked or designated in writing by the copyright owner as "Not a
|
|
57
|
+
Contribution."
|
|
58
|
+
|
|
59
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
+
whom a Contribution has been received by the Licensor and included
|
|
61
|
+
within the Work.
|
|
62
|
+
|
|
63
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
+
Work and such Derivative Works in Source or Object form.
|
|
69
|
+
|
|
70
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
(except as stated in this section) patent license to make, have made,
|
|
74
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
+
where such license applies only to those patent claims licensable
|
|
76
|
+
by such Contributor that are necessarily infringed by their
|
|
77
|
+
Contribution(s) alone or by the combined work of their Contribution(s)
|
|
78
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
79
|
+
institute patent litigation against any entity (including a cross-claim
|
|
80
|
+
or counterclaim in a lawsuit) alleging that the Work or any other
|
|
81
|
+
Contribution embodied within the Work constitutes patent or contributory
|
|
82
|
+
patent infringement, then any patent licenses granted to You under
|
|
83
|
+
this License for that Work shall terminate as of the date such
|
|
84
|
+
litigation is filed.
|
|
85
|
+
|
|
86
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
87
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
88
|
+
modifications, and in Source or Object form, provided that You
|
|
89
|
+
meet the following conditions:
|
|
90
|
+
|
|
91
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
92
|
+
Works a copy of this License; and
|
|
93
|
+
|
|
94
|
+
(b) You must cause any modified files to carry prominent notices
|
|
95
|
+
stating that You changed the files; and
|
|
96
|
+
|
|
97
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
98
|
+
that You distribute, all copyright, patent, trademark, and
|
|
99
|
+
attribution notices from the Source form of the Work,
|
|
100
|
+
excluding those notices that do not pertain to any part of
|
|
101
|
+
the Derivative Works; and
|
|
102
|
+
|
|
103
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
104
|
+
distribution, You must include a readable copy of the
|
|
105
|
+
attribution notices contained within such NOTICE file, in
|
|
106
|
+
at least one of the following places: within a NOTICE text
|
|
107
|
+
file distributed as part of the Derivative Works; within
|
|
108
|
+
the Source form or documentation, if provided along with the
|
|
109
|
+
Derivative Works; or, within a display generated by the
|
|
110
|
+
Derivative Works, if and wherever such third-party notices
|
|
111
|
+
normally appear. The contents of the NOTICE file are for
|
|
112
|
+
informational purposes only and do not modify the License.
|
|
113
|
+
You may add Your own attribution notices within Derivative
|
|
114
|
+
Works that You distribute, alongside or in addition to the
|
|
115
|
+
NOTICE text from the Work, provided that such additional
|
|
116
|
+
attribution notices cannot be construed as modifying the
|
|
117
|
+
License.
|
|
118
|
+
|
|
119
|
+
You may add Your own license statement for Your modifications and
|
|
120
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
121
|
+
publish, distribute, sublicense, and/or sell copies of the
|
|
122
|
+
Contribution, either on its own or as part of the Work.
|
|
123
|
+
|
|
124
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
125
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
126
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
127
|
+
this License, without any additional terms or conditions.
|
|
128
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
129
|
+
the terms of any separate license agreement you may have executed
|
|
130
|
+
with Licensor regarding such Contributions.
|
|
131
|
+
|
|
132
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
133
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
134
|
+
except as required for reasonable and customary use in describing the
|
|
135
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
136
|
+
|
|
137
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
138
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
139
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
140
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
141
|
+
implied, including, without limitation, any warranties or conditions
|
|
142
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
143
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
144
|
+
appropriateness of using or reproducing the Work and assume any
|
|
145
|
+
risks associated with Your exercise of permissions under this License.
|
|
146
|
+
|
|
147
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
148
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
149
|
+
unless required by applicable law (such as deliberate and grossly
|
|
150
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
151
|
+
liable to You for damages, including any direct, indirect, special,
|
|
152
|
+
incidental, or exemplary damages of any character arising as a
|
|
153
|
+
result of this License or out of the use or inability to use the
|
|
154
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
155
|
+
work stoppage, computer failure or malfunction, or all other
|
|
156
|
+
commercial damages or losses), even if such Contributor has been
|
|
157
|
+
advised of the possibility of such damages.
|
|
158
|
+
|
|
159
|
+
9. Accepting Warranty or Liability. While redistributing the Work or
|
|
160
|
+
Derivative Works thereof, You may choose to offer, and charge a fee
|
|
161
|
+
for, acceptance of support, warranty, indemnity, or other liability
|
|
162
|
+
obligations and/or rights consistent with this License. However,
|
|
163
|
+
in accepting such obligations, You may offer only on behalf to
|
|
164
|
+
the Licensor and each Contributor, assuming such liability solely
|
|
165
|
+
on Your behalf and in compliance with the conditions stated in
|
|
166
|
+
Sections 4 and 8.
|
|
167
|
+
|
|
168
|
+
END OF TERMS AND CONDITIONS
|
|
169
|
+
|
|
170
|
+
Copyright 2026 ssm-08
|
|
171
|
+
|
|
172
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
173
|
+
you may not use this file except in compliance with the License.
|
|
174
|
+
You may obtain a copy of the License at
|
|
175
|
+
|
|
176
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
177
|
+
|
|
178
|
+
Unless required by applicable law or agreed to in writing, software
|
|
179
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
180
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
181
|
+
See the License for the specific language governing permissions and
|
|
182
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Relay
|
|
2
|
+
|
|
3
|
+
Shared brain for teams using Claude Code. One memory, every session warm.
|
|
4
|
+
|
|
5
|
+
> **Git made code collaboration possible. Relay does the same for the AI working alongside your team.**
|
|
6
|
+
|
|
7
|
+
## The problem
|
|
8
|
+
|
|
9
|
+
Every Claude Code session starts blank. On a team this breaks down fast: each person's Claude gives conflicting advice because it doesn't know what was decided yesterday, what approaches failed, or what shortcuts are still in the code. You spend the first 10 minutes of every session re-briefing an AI that should already know.
|
|
10
|
+
|
|
11
|
+
The core insight: the problem isn't that Claude forgets — it's that Claude never knew in the first place.
|
|
12
|
+
|
|
13
|
+
## Why not CLAUDE.md?
|
|
14
|
+
|
|
15
|
+
`CLAUDE.md` is written by hand. It captures what you choose to document — usually the final decision, rarely the reasoning behind it. It doesn't update on its own, it doesn't know what your teammates did, and it doesn't capture the things nobody has time to write down at the moment they matter most.
|
|
16
|
+
|
|
17
|
+
| | Updates automatically | Captures reasoning | Syncs across teammates |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| `CLAUDE.md` | ❌ | ❌ | ✅ (if committed) |
|
|
20
|
+
| Claude Projects | ❌ | ❌ | ✅ |
|
|
21
|
+
| **Relay** | ✅ | ✅ | ✅ |
|
|
22
|
+
|
|
23
|
+
Relay is what `CLAUDE.md` would be if it wrote itself.
|
|
24
|
+
|
|
25
|
+
## How it works
|
|
26
|
+
|
|
27
|
+
Relay keeps a shared file in your git repo: `.relay/memory.md`. Every session reads from it at startup. Every session writes to it while you work.
|
|
28
|
+
|
|
29
|
+
**Reading** — at session start, Relay pulls the latest `.relay/memory.md` from git and quietly feeds it to Claude before you type anything. Claude already knows the context.
|
|
30
|
+
|
|
31
|
+
**Writing** — while you work, Relay watches your conversation in the background. After every few turns it pulls out what matters — decisions made, approaches that didn't pan out, temporary hacks — rewrites the file, and pushes it to git. You never notice it happening.
|
|
32
|
+
|
|
33
|
+
**Live sync** — if a teammate pushes new memory while your session is already open, Relay picks it up automatically. Before each prompt you send, it checks for updates and injects only the new sections into Claude's context. No restart needed.
|
|
34
|
+
|
|
35
|
+
The file is plain text. Read or edit it any time:
|
|
36
|
+
```bash
|
|
37
|
+
cat .relay/memory.md
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Watch the writing happen live:
|
|
41
|
+
```bash
|
|
42
|
+
tail -f .relay/log
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
**macOS / Linux:**
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
curl -fsSL https://raw.githubusercontent.com/ssm-08/relay/master/install.sh | sh
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Windows (PowerShell):**
|
|
54
|
+
|
|
55
|
+
```powershell
|
|
56
|
+
iwr -useb https://raw.githubusercontent.com/ssm-08/relay/master/install.ps1 | iex
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Clones Relay to `~/.claude/relay/`, wires the hooks, and registers `relay` on PATH via `npm link`. Idempotent — safe to re-run.
|
|
60
|
+
|
|
61
|
+
## Init (per repo, one teammate, once)
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
cd your-project
|
|
65
|
+
relay init
|
|
66
|
+
git add .relay/ .gitignore
|
|
67
|
+
git commit -m "chore: add relay shared memory"
|
|
68
|
+
git push
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Teammates install the plugin on their machine (`curl | sh` above), then just `git pull`. They don't run `init` again.
|
|
72
|
+
|
|
73
|
+
## Commands
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
relay init # bootstrap this repo (.relay/, .gitignore entries)
|
|
77
|
+
relay status # memory size, last distillation, last injection, sync state
|
|
78
|
+
relay log [--lines N] # tail relay log (distillation + injection events)
|
|
79
|
+
relay distill [--force] [--push] # run distillation manually
|
|
80
|
+
relay broadcast-skill <file> # share a skill file with all teammates
|
|
81
|
+
relay install # install hooks on a new machine (called by install.sh/ps1)
|
|
82
|
+
relay update # pull latest Relay from GitHub
|
|
83
|
+
relay uninstall # fully remove Relay from this machine
|
|
84
|
+
relay doctor # verify install is working
|
|
85
|
+
relay --version # print relay version
|
|
86
|
+
relay --help # show usage
|
|
87
|
+
|
|
88
|
+
/relay-handoff # slash command: write a handoff note and push
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Dev install (from local clone)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# macOS / Linux — from the relay repo root
|
|
95
|
+
./install.sh --from-local .
|
|
96
|
+
|
|
97
|
+
# Windows
|
|
98
|
+
.\install.ps1 --from-local .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Test without touching your real `~/.claude/`:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
node scripts/installer.mjs install --from-local . --home /tmp/fake-home
|
|
105
|
+
node scripts/installer.mjs doctor --home /tmp/fake-home
|
|
106
|
+
node scripts/installer.mjs uninstall --home /tmp/fake-home
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Repo layout
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
├── .claude-plugin/plugin.json # plugin manifest
|
|
113
|
+
├── hooks/
|
|
114
|
+
│ ├── session-start.mjs # reads memory + broadcast, injects as context
|
|
115
|
+
│ ├── stop.mjs # triggers distiller after N turns
|
|
116
|
+
│ └── user-prompt-submit.mjs # live sync: pulls memory, diffs, injects delta per prompt
|
|
117
|
+
├── commands/
|
|
118
|
+
│ └── relay-handoff.toml # /relay-handoff slash command
|
|
119
|
+
├── bin/relay.mjs # CLI: init | status | distill | install | update | ...
|
|
120
|
+
├── install.sh # macOS/Linux one-liner installer
|
|
121
|
+
├── install.ps1 # Windows one-liner installer
|
|
122
|
+
├── lib/
|
|
123
|
+
│ ├── sync.mjs # git pull / push / lock
|
|
124
|
+
│ ├── transcript.mjs # reads and slices session transcripts
|
|
125
|
+
│ ├── memory.mjs # reads and writes memory.md
|
|
126
|
+
│ ├── filter.mjs # pre-filters transcripts before calling AI
|
|
127
|
+
│ └── diff-memory.mjs # section-aware diff + hash for live sync
|
|
128
|
+
├── distiller.mjs # background process that rewrites memory.md
|
|
129
|
+
├── prompts/distill.md # the prompt that drives distillation
|
|
130
|
+
├── scripts/
|
|
131
|
+
│ ├── installer.mjs # cross-platform install/update/uninstall/doctor logic
|
|
132
|
+
│ ├── setup.ps1 # deprecated stub — forwards to install.ps1
|
|
133
|
+
│ └── test-e2e.mjs # e2e tests — no live Claude session needed
|
|
134
|
+
└── docs-site/ # full documentation (Astro Starlight)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Known issues
|
|
138
|
+
|
|
139
|
+
1. **Auth required.** Relay calls AI using your existing Claude Code login — no separate API key. If you're not signed in (`claude auth login`), distillation is skipped. Memory injection still works; only writes are blocked.
|
|
140
|
+
|
|
141
|
+
2. **Push conflicts.** If two teammates distill at the same moment and both try to push, the second one retries automatically with the latest version. In practice it resolves within one session without losing anything.
|
|
142
|
+
|
|
143
|
+
3. **Claude Code transcript format.** Relay reads Claude Code's session files directly. If a future Claude Code update changes that format, distillation may skip some turns until Relay is updated. Check `.relay/log` if memory stops updating.
|
|
144
|
+
|
|
145
|
+
4. **Tier 0 filter may miss purely conversational decisions.** The filter uses weighted scoring across signal categories (decisions, rejections, hacks, scope changes, maintenance flags) plus structural signals (session length, edit count). Most real work sessions pass. Edge case: design choices with no signal words (e.g. "let's go with dark mode") may not trigger. Workaround: use explicit language or run `relay distill --force --push` manually.
|
|
146
|
+
|
|
147
|
+
## Docs
|
|
148
|
+
|
|
149
|
+
Full documentation, architecture diagrams, cost model, and demo walkthrough:
|
|
150
|
+
|
|
151
|
+
**[ssm-08.github.io/relay](https://ssm-08.github.io/relay/)**
|
|
152
|
+
|
|
153
|
+
- [The problem](https://ssm-08.github.io/relay/problem/) — why existing tools fall short
|
|
154
|
+
- [How it works](https://ssm-08.github.io/relay/how-it-works/) — full Alice/Bob walkthrough
|
|
155
|
+
- [Architecture](https://ssm-08.github.io/relay/architecture/) — system diagrams and data flow
|
|
156
|
+
- [Cost model](https://ssm-08.github.io/relay/cost-model/) — what it costs to run
|
|
157
|
+
- [Demo script](https://ssm-08.github.io/relay/demo/) — step-by-step demo guide
|
|
158
|
+
- [FAQ](https://ssm-08.github.io/relay/faq/) — known gotchas and common questions
|