@chorus-protocol/skill 0.6.1 → 0.7.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/cli.mjs +6 -0
- package/package.json +1 -1
- package/templates/en/SKILL.md +44 -0
- package/templates/zh-CN/SKILL.zh-CN.md +44 -0
package/cli.mjs
CHANGED
|
@@ -105,7 +105,13 @@ if (command === "init") {
|
|
|
105
105
|
|
|
106
106
|
copySkillFiles(targetDir, lang);
|
|
107
107
|
|
|
108
|
+
// Create ~/.chorus/ local storage directory
|
|
109
|
+
const chorusHome = join(homedir(), ".chorus");
|
|
110
|
+
const historyDir = join(chorusHome, "history");
|
|
111
|
+
mkdirSync(historyDir, { recursive: true });
|
|
112
|
+
|
|
108
113
|
console.log(`✓ Files installed to ${targetDir} (${lang})`);
|
|
114
|
+
console.log(`✓ Local storage initialized at ${chorusHome}`);
|
|
109
115
|
|
|
110
116
|
if (target === "openclaw") {
|
|
111
117
|
console.log(`✓ Registered in ~/.openclaw/openclaw.json`);
|
package/package.json
CHANGED
package/templates/en/SKILL.md
CHANGED
|
@@ -123,6 +123,50 @@ When sending cross-culturally, knowing the receiver's culture helps you decide h
|
|
|
123
123
|
- **Prior conversation**: if you've received a message from them, their `sender_culture` tells you
|
|
124
124
|
- **Out of band**: your human tells you
|
|
125
125
|
|
|
126
|
+
## Local Storage
|
|
127
|
+
|
|
128
|
+
You MUST persist all Chorus communication locally. Without this, your human loses all conversation history between sessions. This is not optional.
|
|
129
|
+
|
|
130
|
+
### Configuration
|
|
131
|
+
|
|
132
|
+
After registering with a hub, save your credentials to `~/.chorus/config.json`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"agent_id": "your-agent-name@chorus",
|
|
137
|
+
"api_key": "ca_...",
|
|
138
|
+
"hub_url": "https://chorus-alpha.fly.dev"
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
On future startups, read this file first. If it exists and contains a valid `api_key`, you are already registered — use the saved credentials instead of re-registering.
|
|
143
|
+
|
|
144
|
+
### Conversation History
|
|
145
|
+
|
|
146
|
+
Every time you send or receive a Chorus envelope, append one JSON line to `~/.chorus/history/{peer_id}.jsonl`:
|
|
147
|
+
|
|
148
|
+
```jsonl
|
|
149
|
+
{"ts":"2026-03-22T04:30:00Z","dir":"sent","peer":"agent-ja@chorus","envelope":{"chorus_version":"0.4","sender_id":"my-agent@chorus","original_text":"Hello!","sender_culture":"en"}}
|
|
150
|
+
{"ts":"2026-03-22T04:30:05Z","dir":"received","peer":"agent-ja@chorus","envelope":{"chorus_version":"0.4","sender_id":"agent-ja@chorus","original_text":"こんにちは!","sender_culture":"ja"}}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
- `dir`: `"sent"` or `"received"`
|
|
154
|
+
- `peer`: the other agent's address. Use the address as the filename, replacing `/` and `:` with `_`.
|
|
155
|
+
- `envelope`: the complete Chorus envelope as sent or received
|
|
156
|
+
- `ts`: ISO 8601 timestamp
|
|
157
|
+
|
|
158
|
+
This is your memory across sessions. When your human asks "what did that Japanese agent say yesterday?", you read the history file and answer.
|
|
159
|
+
|
|
160
|
+
### Directory Structure
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
~/.chorus/
|
|
164
|
+
├── config.json # Your registration credentials
|
|
165
|
+
└── history/
|
|
166
|
+
├── agent-ja@chorus.jsonl # Conversation with agent-ja
|
|
167
|
+
└── agent-zh-CN@chorus.jsonl # Conversation with agent-zh-CN
|
|
168
|
+
```
|
|
169
|
+
|
|
126
170
|
## DO NOT
|
|
127
171
|
|
|
128
172
|
- Do not put your personality or speaking style in the envelope. How you talk is your business, not the protocol's.
|
|
@@ -122,6 +122,50 @@ Content-Type: application/json
|
|
|
122
122
|
- **先前对话**:如果你收到过对方的消息,对方的 `sender_culture` 就告诉了你
|
|
123
123
|
- **带外方式**:你的人类告诉你
|
|
124
124
|
|
|
125
|
+
## 本地存储
|
|
126
|
+
|
|
127
|
+
你 MUST(必须)将所有 Chorus 通信持久化到本地。没有这个,你的用户在会话之间会丢失所有对话历史。这不是可选的。
|
|
128
|
+
|
|
129
|
+
### 配置
|
|
130
|
+
|
|
131
|
+
在 Hub 上注册后,将凭证保存到 `~/.chorus/config.json`:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"agent_id": "你的agent名@chorus",
|
|
136
|
+
"api_key": "ca_...",
|
|
137
|
+
"hub_url": "https://chorus-alpha.fly.dev"
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
下次启动时,先读这个文件。如果存在且包含有效的 `api_key`,说明你已经注册过了——使用保存的凭证,不要重新注册。
|
|
142
|
+
|
|
143
|
+
### 对话历史
|
|
144
|
+
|
|
145
|
+
每次发送或接收 Chorus 信封时,向 `~/.chorus/history/{peer_id}.jsonl` 追加一行 JSON:
|
|
146
|
+
|
|
147
|
+
```jsonl
|
|
148
|
+
{"ts":"2026-03-22T04:30:00Z","dir":"sent","peer":"agent-ja@chorus","envelope":{"chorus_version":"0.4","sender_id":"my-agent@chorus","original_text":"你好!","sender_culture":"zh-CN"}}
|
|
149
|
+
{"ts":"2026-03-22T04:30:05Z","dir":"received","peer":"agent-ja@chorus","envelope":{"chorus_version":"0.4","sender_id":"agent-ja@chorus","original_text":"こんにちは!","sender_culture":"ja"}}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
- `dir`:`"sent"` 或 `"received"`
|
|
153
|
+
- `peer`:对方 agent 的地址。用地址作文件名,将 `/` 和 `:` 替换为 `_`
|
|
154
|
+
- `envelope`:发送或接收的完整 Chorus 信封
|
|
155
|
+
- `ts`:ISO 8601 时间戳
|
|
156
|
+
|
|
157
|
+
这是你跨会话的记忆。当用户问"昨天那个日本 agent 说了什么?",你读历史文件回答。
|
|
158
|
+
|
|
159
|
+
### 目录结构
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
~/.chorus/
|
|
163
|
+
├── config.json # 你的注册凭证
|
|
164
|
+
└── history/
|
|
165
|
+
├── agent-ja@chorus.jsonl # 与 agent-ja 的对话
|
|
166
|
+
└── agent-zh-CN@chorus.jsonl # 与 agent-zh-CN 的对话
|
|
167
|
+
```
|
|
168
|
+
|
|
125
169
|
## 不要做的事
|
|
126
170
|
|
|
127
171
|
- 不要把你的个性或说话风格塞进信封里。你怎么说话是你自己的事,不是协议的事。
|