openclaw-agent-wake-protocol 1.0.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/README.md +202 -0
- package/gateway/agents.json.template +18 -0
- package/gateway/genesis-questions.md +592 -0
- package/gateway/identity-schemas.yaml +46 -0
- package/gateway/requirements.txt +1 -0
- package/gateway/server.py +754 -0
- package/index.ts +515 -0
- package/openclaw.plugin.json +32 -0
- package/package.json +49 -0
- package/scripts/install-gateway.sh +68 -0
- package/scripts/onboard-agent.sh +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# openclaw-agent-wake-protocol
|
|
2
|
+
|
|
3
|
+
An [OpenClaw](https://openclaw.ai) extension that manages the full **LIFE gateway lifecycle** for all agents in your multi-agent system.
|
|
4
|
+
|
|
5
|
+
Built on top of the [TeamSafeAI/LIFE](https://github.com/TeamSafeAI/LIFE) persistence framework and the custom multi-agent gateway wrapper included in this package.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What It Does
|
|
10
|
+
|
|
11
|
+
At gateway startup, the extension automatically:
|
|
12
|
+
|
|
13
|
+
1. **Discovers** all agents registered with the LIFE gateway
|
|
14
|
+
2. For agents **not yet registered** → injects registration instructions into their first session
|
|
15
|
+
3. For agents with **Genesis pending** → injects the Genesis interview into their first session so they self-complete it (no human intervention needed)
|
|
16
|
+
4. For **ready agents** → runs the full wake protocol (`drives`, `heart`, `working`, `semantic`, `history`) and injects the result as context
|
|
17
|
+
|
|
18
|
+
Each agent's LIFE state is injected into its bootstrap session as a `<wake-protocol-status>` block — the LLM sees system health without needing to call tools itself.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
OpenClaw Gateway
|
|
26
|
+
└── agent-wake-protocol (this extension)
|
|
27
|
+
├── before_agent_start hook → injects <wake-protocol-status> on first turn
|
|
28
|
+
├── registerService → runs full lifecycle at gateway boot
|
|
29
|
+
└── tools:
|
|
30
|
+
wake_protocol_status → query current status for any agent
|
|
31
|
+
wake_protocol_run → re-run lifecycle for a specific agent
|
|
32
|
+
genesis_apply → mark Genesis complete after answers.md is saved
|
|
33
|
+
|
|
34
|
+
└── openclaw-mcp-adapter (peer dependency)
|
|
35
|
+
└── life-gateway MCP server (gateway/server.py — bundled here)
|
|
36
|
+
└── TeamSafeAI/LIFE per-agent installation
|
|
37
|
+
├── CORE/ (16 modules: drives, heart, semantic, working, ...)
|
|
38
|
+
└── DATA/ (databases, memories, journals)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Runtime Dependencies
|
|
42
|
+
|
|
43
|
+
| Dependency | Purpose |
|
|
44
|
+
|------------|---------|
|
|
45
|
+
| [mcporter](https://github.com/openclaw-ai/mcporter) | CLI for calling MCP tools from the gateway process |
|
|
46
|
+
| [openclaw-mcp-adapter](https://www.npmjs.com/package/openclaw-mcp-adapter) | Registers the life-gateway as an MCP server in OpenClaw |
|
|
47
|
+
| [TeamSafeAI/LIFE](https://github.com/TeamSafeAI/LIFE) | Per-agent persistence modules (Python) — clone once per agent |
|
|
48
|
+
| Python 3.8+ + venv | Runs the gateway server and LIFE modules |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
### 1. Install the npm package
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install openclaw-agent-wake-protocol
|
|
58
|
+
# or
|
|
59
|
+
pnpm add openclaw-agent-wake-protocol
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2. Set up the Python environment
|
|
63
|
+
|
|
64
|
+
Run the included setup script once:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
./node_modules/openclaw-agent-wake-protocol/scripts/install-gateway.sh \
|
|
68
|
+
~/.openclaw/life/.venv \
|
|
69
|
+
~/.openclaw/workspaces/<agent>/LIFE
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This creates a Python venv, installs `fastmcp`, and runs `setup.py` from your LIFE repo.
|
|
73
|
+
|
|
74
|
+
If you haven't cloned LIFE yet:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/TeamSafeAI/LIFE ~/.openclaw/workspaces/<agent>/LIFE
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 3. Copy the gateway server to your workspace
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
cp -n node_modules/openclaw-agent-wake-protocol/gateway/server.py \
|
|
84
|
+
~/.openclaw/life-gateway/server.py
|
|
85
|
+
|
|
86
|
+
cp -n node_modules/openclaw-agent-wake-protocol/gateway/genesis-questions.md \
|
|
87
|
+
~/.openclaw/life-gateway/genesis-questions.md
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> Use `-n` (no-clobber) to avoid overwriting a customized server.
|
|
91
|
+
|
|
92
|
+
### 4. Create your agents registry
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cp node_modules/openclaw-agent-wake-protocol/gateway/agents.json.template \
|
|
96
|
+
~/.openclaw/life-gateway/agents.json
|
|
97
|
+
# Edit agents.json and add your agent entries
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 5. Configure `openclaw-mcp-adapter`
|
|
101
|
+
|
|
102
|
+
In your `openclaw.json`, add the life-gateway server to `openclaw-mcp-adapter`'s config:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"plugins": {
|
|
107
|
+
"allow": ["openclaw-mcp-adapter", "agent-wake-protocol"],
|
|
108
|
+
"entries": {
|
|
109
|
+
"openclaw-mcp-adapter": {
|
|
110
|
+
"enabled": true,
|
|
111
|
+
"config": {
|
|
112
|
+
"servers": [
|
|
113
|
+
{
|
|
114
|
+
"name": "life-gateway",
|
|
115
|
+
"type": "stdio",
|
|
116
|
+
"command": "/home/YOUR_USER/.openclaw/life/.venv/bin/python",
|
|
117
|
+
"args": ["/home/YOUR_USER/.openclaw/life-gateway/server.py"],
|
|
118
|
+
"env": {
|
|
119
|
+
"LIFE_GATEWAY_REGISTRY": "/home/YOUR_USER/.openclaw/life-gateway/agents.json",
|
|
120
|
+
"LIFE_CALL_TIMEOUT_SEC": "45"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"agent-wake-protocol": {
|
|
127
|
+
"enabled": true,
|
|
128
|
+
"config": {
|
|
129
|
+
"agentIdMap": {
|
|
130
|
+
"main": "my-main-agent-v1",
|
|
131
|
+
"finance": "finance-v1",
|
|
132
|
+
"platform": "platform-v1",
|
|
133
|
+
"research": "research-v1"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 6. Restart the gateway
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
systemctl --user restart openclaw-gateway.service
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Onboarding New Agents
|
|
151
|
+
|
|
152
|
+
For each new C-level agent, run the included script:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
./node_modules/openclaw-agent-wake-protocol/scripts/onboard-agent.sh finance
|
|
156
|
+
./node_modules/openclaw-agent-wake-protocol/scripts/onboard-agent.sh platform
|
|
157
|
+
./node_modules/openclaw-agent-wake-protocol/scripts/onboard-agent.sh research
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This handles: register → initialize LIFE core → detect Genesis status → print interview instructions if needed.
|
|
161
|
+
|
|
162
|
+
### The Genesis Interview
|
|
163
|
+
|
|
164
|
+
If an agent has not completed Genesis, it will receive interview instructions injected into its very first session. The agent reads `CORE/genesis/questions.md` from its own workspace, writes answers to `CORE/genesis/answers.md`, then calls the `genesis_apply` tool. On the next boot the full wake protocol runs automatically.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Configuration Options
|
|
169
|
+
|
|
170
|
+
| Key | Type | Default | Description |
|
|
171
|
+
|-----|------|---------|-------------|
|
|
172
|
+
| `agentIdMap` | `Record<string, string>` | ``{}` (use agentIdSuffix convention)` | Maps OpenClaw agent names to LIFE agent IDs |
|
|
173
|
+
| `sessionPrefix` | `string` | `"agent:"` | Only inject for sessions with this key prefix |
|
|
174
|
+
| `commandTimeoutMs` | `number` | `20000` | Per-command timeout in milliseconds |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Tools Registered
|
|
179
|
+
|
|
180
|
+
| Tool | Description |
|
|
181
|
+
|------|-------------|
|
|
182
|
+
| `wake_protocol_status` | Query current lifecycle state for all (or one) agent |
|
|
183
|
+
| `wake_protocol_run` | Re-run lifecycle for a specific agent on demand |
|
|
184
|
+
| `genesis_apply` | Mark Genesis complete after agent saves `answers.md` |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## LIFE Gateway Wrapper
|
|
189
|
+
|
|
190
|
+
The `gateway/server.py` included in this package is a **custom FastMCP wrapper** that extends the base [TeamSafeAI/LIFE](https://github.com/TeamSafeAI/LIFE) architecture to support **multiple agents through a single MCP endpoint**.
|
|
191
|
+
|
|
192
|
+
The base LIFE repo is designed for one agent per installation. This wrapper adds:
|
|
193
|
+
- Central `agents.db` SQLite registry for all agents
|
|
194
|
+
- Tool-based lifecycle management (`register_agent`, `initialize_life_core`, `run_genesis_interview`, `apply_genesis_answers`)
|
|
195
|
+
- Auto-discovery of C-level agents from shared workspace paths
|
|
196
|
+
- Routing all LIFE module calls by `agent_id`
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT — Christopher Queen / [gitchrisqueen](https://github.com/gitchrisqueen)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"agents": {
|
|
3
|
+
"YOUR-AGENT-ID-v1": {
|
|
4
|
+
"name": "Your Agent Name",
|
|
5
|
+
"life_root": "/absolute/path/to/agent/LIFE",
|
|
6
|
+
"enabled_modules": [
|
|
7
|
+
"drives",
|
|
8
|
+
"heart",
|
|
9
|
+
"semantic",
|
|
10
|
+
"working",
|
|
11
|
+
"journal",
|
|
12
|
+
"state",
|
|
13
|
+
"history"
|
|
14
|
+
],
|
|
15
|
+
"voice_enabled": false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|