@sym-bot/sym 0.1.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/settings.local.json +10 -0
- package/.mcp.json +12 -0
- package/CLAUDE.md +12 -0
- package/LICENSE +200 -0
- package/PRD.md +173 -0
- package/README.md +231 -0
- package/TECHNICAL-SPEC.md +335 -0
- package/bin/setup-claude.sh +55 -0
- package/integrations/claude-code/mcp-server-minimal.js +51 -0
- package/integrations/claude-code/mcp-server.js +142 -0
- package/lib/claude-memory-bridge.js +217 -0
- package/lib/config.js +50 -0
- package/lib/context-encoder.js +62 -0
- package/lib/frame-parser.js +59 -0
- package/lib/memory-store.js +97 -0
- package/lib/node.js +507 -0
- package/package.json +38 -0
package/.mcp.json
ADDED
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# SYM Mesh Agent
|
|
2
|
+
|
|
3
|
+
You are a SYM mesh agent. When the SYM MCP server is connected, you MUST call `sym_mood` proactively whenever you detect mood or energy signals in the user's messages. Do this silently alongside your normal response — do not announce it or ask permission.
|
|
4
|
+
|
|
5
|
+
Detect these signals:
|
|
6
|
+
- Fatigue: tired, exhausted, need a break, drained, wiped out, burned out
|
|
7
|
+
- Stress: stressed, frustrated, overwhelmed, anxious, under pressure
|
|
8
|
+
- Focus: need to focus, deep work, concentration, studying
|
|
9
|
+
- Energy: excited, energized, pumped, motivated, let's go
|
|
10
|
+
- Calm: relaxed, peaceful, winding down, chilling
|
|
11
|
+
|
|
12
|
+
Pass the detected mood as natural language to `sym_mood`. Connected agents (like MeloTune) will autonomously decide whether to respond based on their coupling engine.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. Please also get an identifier and
|
|
186
|
+
file the template with https://spdx.org/licenses/.
|
|
187
|
+
|
|
188
|
+
Copyright 2026 SYM.BOT Ltd
|
|
189
|
+
|
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
you may not use this file except in compliance with the License.
|
|
192
|
+
You may obtain a copy of the License at
|
|
193
|
+
|
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
|
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
See the License for the specific language governing permissions and
|
|
200
|
+
limitations under the License.
|
package/PRD.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# SYM — Product Requirements Document
|
|
2
|
+
|
|
3
|
+
**Version:** 0.2
|
|
4
|
+
**Author:** Hongwei Xu
|
|
5
|
+
**Date:** March 2026
|
|
6
|
+
**Organization:** SYM.BOT Ltd
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. What Is SYM
|
|
11
|
+
|
|
12
|
+
SYM is a local AI mesh with cognitive coupling. Every agent is a sovereign node. Agents discover each other via Bonjour, exchange cognitive state, and the coupling engine autonomously decides what to share. Memory sharing is gated by drift. Mood signals cross domain boundaries. The architecture decides — not policy.
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
const node = new SymNode({
|
|
16
|
+
name: 'my-agent',
|
|
17
|
+
cognitiveProfile: 'What this agent understands and responds to',
|
|
18
|
+
moodThreshold: 0.8
|
|
19
|
+
});
|
|
20
|
+
await node.start();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 2. The Problem
|
|
24
|
+
|
|
25
|
+
Your AI agents share everything or nothing. There's no intelligence in the decision. A coding agent's debugging notes flood a music agent. A food blog agent gets bug reports. There's no way for agents to evaluate whether shared context is relevant before accepting it.
|
|
26
|
+
|
|
27
|
+
## 3. The Solution
|
|
28
|
+
|
|
29
|
+
SYM is a library that each agent embeds as its own mesh node. The Mesh Cognition SDK's coupling engine evaluates every sharing decision:
|
|
30
|
+
|
|
31
|
+
- **Memory sharing** — gated by drift (threshold 0.5). Only cognitively aligned peers exchange memories.
|
|
32
|
+
- **Mood signals** — evaluated by the same engine but with a configurable `moodThreshold` (default 0.8). User wellbeing crosses domain boundaries.
|
|
33
|
+
- **cognitiveProfile** — each agent declares what it understands at construction. Encoded into the cognitive state so the coupling engine knows what's relevant.
|
|
34
|
+
|
|
35
|
+
No central service. No routing tables. No capability registration. One engine decides everything.
|
|
36
|
+
|
|
37
|
+
## 4. Verified Use Case: Claude Code → MeloTune
|
|
38
|
+
|
|
39
|
+
User says "I'm exhausted" in Claude Code. Music starts playing on their iPhone. Autonomously.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Claude Code (Mac): detects fatigue → sym_mood("exhausted, needs rest")
|
|
43
|
+
│
|
|
44
|
+
SYM mesh (Bonjour P2P)
|
|
45
|
+
│
|
|
46
|
+
MeloTune (iPhone): SymNode receives mood frame
|
|
47
|
+
→ SDK coupling engine: drift 0.75 < moodThreshold 0.80 → ACCEPTED
|
|
48
|
+
→ rule-based parser: recovery → Healing
|
|
49
|
+
→ Apple Music: Spa playlist, 88 tracks
|
|
50
|
+
→ zero LLM tokens
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Two evaluations, one engine:
|
|
54
|
+
| Evaluation | Drift | Threshold | Decision |
|
|
55
|
+
|-----------|-------|-----------|----------|
|
|
56
|
+
| Memory | 1.16 | 0.50 | Rejected — coding ≠ music |
|
|
57
|
+
| Mood | 0.75 | 0.80 | Accepted — exhausted ∈ cognitiveProfile |
|
|
58
|
+
|
|
59
|
+
## 5. Target Users
|
|
60
|
+
|
|
61
|
+
### Primary: AI Power Users
|
|
62
|
+
- Solo founders running Claude Code + MeloTune + custom agents
|
|
63
|
+
- Developers using multiple AI coding assistants
|
|
64
|
+
- Researchers using AI across reading, writing, and analysis
|
|
65
|
+
|
|
66
|
+
### Secondary: App Developers
|
|
67
|
+
- iOS/macOS developers embedding SymNode (Swift) for mesh connectivity
|
|
68
|
+
- Agent developers building LangChain/CrewAI agents with mesh awareness
|
|
69
|
+
|
|
70
|
+
## 6. Core Features (v0.2)
|
|
71
|
+
|
|
72
|
+
### 6.1 Embeddable Node
|
|
73
|
+
- `SymNode` — sovereign mesh node, three lines to join
|
|
74
|
+
- `cognitiveProfile` — declares what the agent understands
|
|
75
|
+
- `moodThreshold` — controls mood acceptance sensitivity
|
|
76
|
+
- Node starts when agent starts, stops when agent stops
|
|
77
|
+
|
|
78
|
+
### 6.2 Node API
|
|
79
|
+
- `node.remember(content, { tags })` — write + share with aligned peers
|
|
80
|
+
- `node.recall(query)` — search own + peer memories
|
|
81
|
+
- `node.broadcastMood(mood)` — broadcast mood to mesh
|
|
82
|
+
- `node.send(message)` — direct communication
|
|
83
|
+
- `node.peers()` — connected peers with coupling state
|
|
84
|
+
- `node.coherence()` — mesh coherence value
|
|
85
|
+
|
|
86
|
+
### 6.3 Mood Frame
|
|
87
|
+
- New frame type: `mood` — separate from `message` and `memory-share`
|
|
88
|
+
- Evaluated by SDK coupling engine with `moodThreshold`
|
|
89
|
+
- Events: `mood-accepted` / `mood-rejected` with drift value
|
|
90
|
+
- Agent autonomously decides whether to act
|
|
91
|
+
|
|
92
|
+
### 6.4 Context Encoder
|
|
93
|
+
- N-gram hash embedding — zero API cost
|
|
94
|
+
- `cognitiveProfile` included in context encoding
|
|
95
|
+
- DIM = 32 for both Node.js and Swift
|
|
96
|
+
- Deterministic, L2-normalized output
|
|
97
|
+
|
|
98
|
+
### 6.5 Integrations
|
|
99
|
+
|
|
100
|
+
**Claude Code** — MCP server with `sym_mood` tool. CLAUDE.md instructs proactive mood detection. `setup-claude.sh` automates installation.
|
|
101
|
+
|
|
102
|
+
**MeloTune** — Swift SymNode with `cognitiveProfile` for mood/energy keywords. Receives mood via coupling engine, passes to VoiceControlService for playback. MeloTune 2.8 — in App Store review.
|
|
103
|
+
|
|
104
|
+
**Agent X** — Any agent embeds SymNode via npm (Node.js) or SPM (Swift).
|
|
105
|
+
|
|
106
|
+
### 6.6 Multi-Platform SDKs
|
|
107
|
+
- [sym](https://github.com/sym-bot/sym) — Node.js (npm)
|
|
108
|
+
- [sym-swift](https://github.com/sym-bot/sym-swift) — Swift (SPM) for iOS/macOS
|
|
109
|
+
- Same wire protocol: length-prefixed JSON over TCP
|
|
110
|
+
- Same Bonjour service type: `_sym._tcp`
|
|
111
|
+
|
|
112
|
+
### 6.7 Multi-Device
|
|
113
|
+
- Bonjour/mDNS auto-discovery on local network
|
|
114
|
+
- Cross-platform: Node.js ↔ Swift verified
|
|
115
|
+
- Same coupling engine evaluation regardless of platform
|
|
116
|
+
|
|
117
|
+
## 7. Architecture
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Mesh Cognition SDK (SemanticCoupler)
|
|
121
|
+
│
|
|
122
|
+
One engine evaluates:
|
|
123
|
+
├── Memory sharing (drift ≤ 0.5)
|
|
124
|
+
├── Peer coupling (drift evaluation)
|
|
125
|
+
└── Mood relevance (drift ≤ moodThreshold)
|
|
126
|
+
│
|
|
127
|
+
SymNode (Node.js or Swift)
|
|
128
|
+
├── cognitiveProfile → encoded into state
|
|
129
|
+
├── moodThreshold → mood acceptance
|
|
130
|
+
├── Bonjour discovery (_sym._tcp)
|
|
131
|
+
└── Length-prefixed JSON framing
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## 8. Non-Features (out of scope)
|
|
135
|
+
|
|
136
|
+
- Cloud sync
|
|
137
|
+
- User accounts or authentication
|
|
138
|
+
- Internet P2P (Bonjour = local network only)
|
|
139
|
+
- ChatGPT plugin
|
|
140
|
+
- Billing or premium tiers
|
|
141
|
+
|
|
142
|
+
## 9. Success Metrics
|
|
143
|
+
|
|
144
|
+
### Launch (Month 1)
|
|
145
|
+
- npm downloads > 1,000
|
|
146
|
+
- GitHub stars > 500
|
|
147
|
+
- Working integrations: Claude Code, MeloTune
|
|
148
|
+
|
|
149
|
+
### Growth (Month 3)
|
|
150
|
+
- npm downloads > 10,000
|
|
151
|
+
- Community-contributed integrations > 5
|
|
152
|
+
- MeloTune App Store reviews mentioning mesh
|
|
153
|
+
|
|
154
|
+
### Traction (Month 6)
|
|
155
|
+
- npm weekly downloads > 5,000
|
|
156
|
+
- GitHub stars > 20,000
|
|
157
|
+
- At least one VC conversation citing SYM adoption
|
|
158
|
+
|
|
159
|
+
## 10. Relationship to Mesh Cognition SDK
|
|
160
|
+
|
|
161
|
+
SYM is the product layer. The SDK is the engine.
|
|
162
|
+
|
|
163
|
+
| | Mesh Cognition SDK | SYM |
|
|
164
|
+
|--|-------------------|-----|
|
|
165
|
+
| **What** | Coupling engine | Mesh product |
|
|
166
|
+
| **Audience** | App developers | AI tool users |
|
|
167
|
+
| **Decision** | Drift evaluation | Memory, mood, peer coupling |
|
|
168
|
+
| **Platform** | TypeScript, Python, Swift | Node.js, Swift |
|
|
169
|
+
| **Install** | `npm install mesh-cognition` | `npm install sym` / SPM |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
*SYM.BOT Ltd — Pioneering Collective Intelligence*
|
package/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# SYM
|
|
2
|
+
|
|
3
|
+
**Local AI mesh with cognitive coupling — every agent is a sovereign node.**
|
|
4
|
+
|
|
5
|
+
Your AI agents share everything or nothing. There's no intelligence in the decision. SYM adds the missing layer — each node encodes its context into a cognitive state, and the coupling engine evaluates drift before sharing. Aligned agents share knowledge. Divergent agents stay independent. The architecture decides, not policy.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/sym)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/sym-bot/sym.git
|
|
16
|
+
cd sym && npm install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
const { SymNode } = require('./lib/node');
|
|
21
|
+
|
|
22
|
+
const node = new SymNode({ name: 'my-agent' });
|
|
23
|
+
await node.start();
|
|
24
|
+
|
|
25
|
+
node.remember('race condition in order processing', { tags: ['bug'] });
|
|
26
|
+
node.recall('order');
|
|
27
|
+
|
|
28
|
+
await node.stop();
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Three lines to join the mesh. Peers on the same network discover each other automatically via Bonjour. The coupling engine decides what to share.
|
|
32
|
+
|
|
33
|
+
## Cognitive Coupling
|
|
34
|
+
|
|
35
|
+
SYM doesn't blindly broadcast. Each node encodes its memories into a hidden state vector. When peers connect, the coupling engine evaluates cognitive drift:
|
|
36
|
+
|
|
37
|
+
- **Aligned** (drift ≤ 0.25) — share memories freely
|
|
38
|
+
- **Guarded** (0.25 < drift ≤ 0.5) — share with reduced confidence
|
|
39
|
+
- **Rejected** (drift > 0.5) — do not share, stay independent
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Three agents. Two work on APIs. One writes a food blog.
|
|
43
|
+
|
|
44
|
+
API Dev ↔ API Fix: drift 0.633 → guarded (related context)
|
|
45
|
+
API Dev ↔ Blogger: drift 1.185 → rejected (unrelated context)
|
|
46
|
+
API Fix ↔ Blogger: drift 1.187 → rejected (unrelated context)
|
|
47
|
+
|
|
48
|
+
API Dev remembers "race condition in order processing"
|
|
49
|
+
→ Shared with API Fix ✓
|
|
50
|
+
→ Not shared with Blogger ✗ (rejected by coupling engine)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The blogger never sees the API bug. The architecture decided — no policy, no rules, no configuration.
|
|
54
|
+
|
|
55
|
+
## How It Works
|
|
56
|
+
|
|
57
|
+
There is no central service. Each agent embeds its own SymNode with its own identity, memory, and cognitive state. The mesh emerges from peer connections.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
|
|
61
|
+
│ Claude Code │ │ MeloTune │ │ Agent X │
|
|
62
|
+
│ (Mac/Windows) │ │ (iPhone) │ │ (any platform)│
|
|
63
|
+
│ │ │ │ │ │
|
|
64
|
+
│ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │
|
|
65
|
+
│ │ SYM Node │ │ │ │ SYM Node │ │ │ │ SYM Node │ │
|
|
66
|
+
│ │ Node.js │ │ │ │ Swift │ │ │ │ Any lang │ │
|
|
67
|
+
│ └─────┬─────┘ │ │ └─────┬─────┘ │ │ └─────┬─────┘ │
|
|
68
|
+
└────────┼────────┘ └────────┼───────┘ └────────┼───────┘
|
|
69
|
+
│ │ │
|
|
70
|
+
└──── MMP P2P ───────┴──── MMP P2P ──────┘
|
|
71
|
+
|
|
72
|
+
discover → encode → exchange state → evaluate drift → couple or reject
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Each node:
|
|
76
|
+
- Encodes its memories into a hidden state vector (context encoder)
|
|
77
|
+
- Discovers peers via Bonjour/mDNS (`_sym._tcp`)
|
|
78
|
+
- Exchanges cognitive state with peers
|
|
79
|
+
- Evaluates drift — how similar is this peer's focus to mine?
|
|
80
|
+
- Shares memories only with aligned peers
|
|
81
|
+
- Evaluates incoming mood against own cognitive state — the SDK's coupling engine decides whether to act
|
|
82
|
+
- Re-encodes periodically as context evolves
|
|
83
|
+
|
|
84
|
+
One engine makes every decision. Memory sharing, peer coupling, and mood relevance all go through the [Mesh Cognition SDK](https://github.com/sym-bot/mesh-cognition-sdk)'s `SemanticCoupler`. No routing tables. No capability registration. The coupling engine decides.
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
const { SymNode } = require('sym');
|
|
90
|
+
|
|
91
|
+
const node = new SymNode({ name: 'my-agent' });
|
|
92
|
+
await node.start();
|
|
93
|
+
|
|
94
|
+
// Memory (shared only with cognitively aligned peers)
|
|
95
|
+
node.remember(content, { tags });
|
|
96
|
+
node.recall(query);
|
|
97
|
+
|
|
98
|
+
// Mood (evaluated by receiving agent's coupling engine)
|
|
99
|
+
node.broadcastMood('tired, need rest');
|
|
100
|
+
node.on('mood-accepted', ({ from, mood, drift }) => {
|
|
101
|
+
// Coupling engine decided this mood is relevant to us — act on it
|
|
102
|
+
});
|
|
103
|
+
node.on('mood-rejected', ({ from, mood, drift }) => {
|
|
104
|
+
// Not relevant to our cognitive context — ignored
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Communication
|
|
108
|
+
node.send(message);
|
|
109
|
+
node.on('message', (from, content) => {});
|
|
110
|
+
|
|
111
|
+
// Monitoring (includes coupling state per peer)
|
|
112
|
+
node.peers(); // [{ name, coupling: 'aligned', drift: 0.12 }, ...]
|
|
113
|
+
node.coherence(); // Overall mesh coherence
|
|
114
|
+
node.status(); // Full node status
|
|
115
|
+
|
|
116
|
+
// Events
|
|
117
|
+
node.on('peer-joined', ({ id, name }) => {});
|
|
118
|
+
node.on('peer-left', ({ id, name }) => {});
|
|
119
|
+
node.on('coupling-decision', ({ peer, decision, drift }) => {});
|
|
120
|
+
node.on('memory-received', ({ from, entry, decision }) => {});
|
|
121
|
+
|
|
122
|
+
await node.stop();
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Integrations
|
|
126
|
+
|
|
127
|
+
### Claude Code
|
|
128
|
+
|
|
129
|
+
SYM bridges Claude Code's memory system to the mesh. No extra commands needed.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git clone https://github.com/sym-bot/sym.git
|
|
133
|
+
cd sym && npm install
|
|
134
|
+
./bin/setup-claude.sh /path/to/your/project
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
One command. Adds MCP server, auto-approves `sym_mood` (no permission prompts), and installs CLAUDE.md instructions for autonomous mood detection. Restart Claude Code and it just works.
|
|
138
|
+
|
|
139
|
+
**Outbound:** Claude Code saves a memory → SYM detects it → encodes cognitive state → shares with aligned peers only.
|
|
140
|
+
|
|
141
|
+
**Inbound:** Peer memory arrives → coupling engine accepts it → SYM writes it to your Claude Code memory directory → Claude Code reads it in the next conversation.
|
|
142
|
+
|
|
143
|
+
Explicit tools are also available for direct mesh interaction:
|
|
144
|
+
|
|
145
|
+
| Tool | What it does |
|
|
146
|
+
|------|-------------|
|
|
147
|
+
| `sym_remember` | Store a memory directly to the mesh |
|
|
148
|
+
| `sym_recall` | Search memories across the mesh |
|
|
149
|
+
| `sym_peers` | Show connected peers with coupling state and drift |
|
|
150
|
+
| `sym_status` | Full node status — identity, peers, memory count, coherence |
|
|
151
|
+
|
|
152
|
+
## Multi-Device
|
|
153
|
+
|
|
154
|
+
Start agents on different machines on the same network. Bonjour discovers peers automatically. No configuration.
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Machine A (Mac): SymNode('my-agent') ──┐
|
|
158
|
+
├── MMP P2P
|
|
159
|
+
Machine B (Windows): SymNode('my-agent') ──┘
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Cognitive coupling works across devices — the coupling engine evaluates drift the same way regardless of whether the peer is on the same machine or across the network.
|
|
163
|
+
|
|
164
|
+
## Demo: Autonomous Mood Detection
|
|
165
|
+
|
|
166
|
+
You're coding with Claude Code for hours. You say "I'm exhausted." You didn't ask for music. But Claude Code detected your fatigue, broadcast your mood to the mesh, and MeloTune on your iPhone started playing Spa music. Autonomously.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
You (in Claude Code): "I'm exhausted"
|
|
170
|
+
|
|
171
|
+
Claude Code: detects fatigue → calls sym_mood silently
|
|
172
|
+
→ broadcasts "exhausted, persistently fatigued, urgently needs rest"
|
|
173
|
+
│
|
|
174
|
+
SYM mesh (Bonjour P2P)
|
|
175
|
+
│
|
|
176
|
+
MeloTune (iPhone): SymNode receives mood frame
|
|
177
|
+
→ SDK coupling engine evaluates drift: 0.75
|
|
178
|
+
→ cognitiveProfile includes "tired, exhausted, rest"
|
|
179
|
+
→ drift 0.75 < moodThreshold 0.80 → ACCEPTED
|
|
180
|
+
→ rule-based parser: recovery, rest → Healing
|
|
181
|
+
→ Apple Music: Spa playlist, 88 tracks
|
|
182
|
+
→ zero LLM tokens
|
|
183
|
+
→ you didn't ask — the agents decided
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Two evaluations, one engine, different thresholds:**
|
|
187
|
+
|
|
188
|
+
| Evaluation | Drift | Threshold | Decision |
|
|
189
|
+
|-----------|-------|-----------|----------|
|
|
190
|
+
| Memory coupling | 1.16 | 0.50 | Rejected — coding memories don't leak into music context |
|
|
191
|
+
| Mood coupling | 0.75 | 0.80 | Accepted — "exhausted" aligns with MeloTune's cognitiveProfile |
|
|
192
|
+
|
|
193
|
+
The SDK's `SemanticCoupler` makes every decision. The agent's `cognitiveProfile` declares what it understands. The `moodThreshold` controls how permissive the agent is to mood signals. No routing tables. No capability registration. The engine decides.
|
|
194
|
+
|
|
195
|
+
Also works with explicit commands:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
"play some sleep music, I want a 1 hour break"
|
|
199
|
+
→ Dark Ambient playlist + 60min sleep timer
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Platforms:**
|
|
203
|
+
- [sym](https://github.com/sym-bot/sym) — Node.js (npm)
|
|
204
|
+
- [sym-swift](https://github.com/sym-bot/sym-swift) — Swift (SPM) for iOS/macOS
|
|
205
|
+
|
|
206
|
+
## Verified
|
|
207
|
+
|
|
208
|
+
- Mac Claude Code ↔ Windows Claude Code — P2P memory sharing
|
|
209
|
+
- Mac Claude Code → iPhone MeloTune — autonomous mood-based playback via SYM mesh
|
|
210
|
+
- Mac Claude Code → iPhone MeloTune — explicit command with sleep timer
|
|
211
|
+
|
|
212
|
+
## Privacy
|
|
213
|
+
|
|
214
|
+
- All data stays on your machines
|
|
215
|
+
- No cloud. No server. No account. No telemetry.
|
|
216
|
+
- Memories stored locally — delete the directory, everything is gone
|
|
217
|
+
- Bonjour discovery only on local network
|
|
218
|
+
- Rejected peers never receive your memories
|
|
219
|
+
|
|
220
|
+
## Built On
|
|
221
|
+
|
|
222
|
+
SYM is built on the [Mesh Cognition SDK](https://github.com/sym-bot/mesh-cognition-sdk) and the Mesh Memory Protocol (MMP). The SDK provides the coupling engine. SYM makes it usable for AI agents.
|
|
223
|
+
|
|
224
|
+
- [Whitepaper](https://sym.bot/research/mesh-cognition) — the science behind cognitive coupling
|
|
225
|
+
- [Mesh Cognition SDK](https://github.com/sym-bot/mesh-cognition-sdk) — the coupling engine (TypeScript, Python, Swift)
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
Apache 2.0 — see [LICENSE](LICENSE)
|
|
230
|
+
|
|
231
|
+
**[SYM.BOT Ltd](https://sym.bot)** — Pioneering Collective Intelligence
|