@sage-protocol/openclaw-sage 0.1.6 → 0.1.9

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.1.6"
2
+ ".": "0.1.9"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.9](https://github.com/sage-protocol/openclaw-sage/compare/openclaw-sage-v0.1.8...openclaw-sage-v0.1.9) (2026-04-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * enrich openclaw sage context payload ([e2f0f51](https://github.com/sage-protocol/openclaw-sage/commit/e2f0f513ab5836732ed12b048e12f9b268d32695))
9
+ * improve OpenClaw Sage plugin integration ([373139d](https://github.com/sage-protocol/openclaw-sage/commit/373139d7fd5cab6fb8ea8a4ba35eda2f6bcda0ea))
10
+ * surface delegation context in identity summary ([937e674](https://github.com/sage-protocol/openclaw-sage/commit/937e67421fdf20aba4c1c45cb62ef48137b4a8b4))
11
+
12
+ ## [0.1.8](https://github.com/sage-protocol/openclaw-sage/compare/openclaw-sage-v0.1.7...openclaw-sage-v0.1.8) (2026-03-16)
13
+
14
+
15
+ ### Features
16
+
17
+ * cleanup README.md ([e508dc6](https://github.com/sage-protocol/openclaw-sage/commit/e508dc6e648d3e24c5c7d34151f1f8bf9c977555))
18
+ * context-aware skill suggestions during heartbeat ([0777ef1](https://github.com/sage-protocol/openclaw-sage/commit/0777ef11782def8d029482c1b99ea032aa3c0ae0))
19
+ * migrate OpenClaw plugin to code mode tools ([8da4f5d](https://github.com/sage-protocol/openclaw-sage/commit/8da4f5d922b8ad0582427cacd109f76fc29d846c))
20
+ * moving hub tools out of mcp feat ([3176bf8](https://github.com/sage-protocol/openclaw-sage/commit/3176bf82848289dacf9011afbcb37849686959d7))
21
+ * update mcp to work with new codemode ([ab73b72](https://github.com/sage-protocol/openclaw-sage/commit/ab73b7288a1c56961191abe269a9bf4fac59f2a0))
22
+ * updating readme ([2749549](https://github.com/sage-protocol/openclaw-sage/commit/2749549fa59c2a1d67b8205cda4944f7ea8c0970))
23
+ * wire RLM capture hooks + fix double-prefix bug ([7e55890](https://github.com/sage-protocol/openclaw-sage/commit/7e558902a678e0ceb34320c5625b6ad94d0de919))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * **docs:** correct sage suggest analyze → sage suggest optimize in SOUL.md ([4e29e38](https://github.com/sage-protocol/openclaw-sage/commit/4e29e38f3080896e269c7cf97bebd90ffc91f2c4))
29
+ * remove dead schema conversion code and update docs for code mode ([b3867fe](https://github.com/sage-protocol/openclaw-sage/commit/b3867fe20f5010a0ff96005305d6b38f2fe957b6))
30
+
31
+ ## [0.1.7](https://github.com/sage-protocol/openclaw-sage/compare/openclaw-sage-v0.1.6...openclaw-sage-v0.1.7) (2026-02-14)
32
+
33
+
34
+ ### Features
35
+
36
+ * read locally-synced soul document at agent start ([edbfb0d](https://github.com/sage-protocol/openclaw-sage/commit/edbfb0ddd84fc4cac4a6a59d422b70aff61b1cb1))
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * align OpenClaw plugin with current sage CLI and harden tests ([3b8f92f](https://github.com/sage-protocol/openclaw-sage/commit/3b8f92f45f8993c440259921993d9b77978bba19))
42
+
3
43
  ## [0.1.6](https://github.com/sage-protocol/openclaw-sage/compare/openclaw-sage-v0.1.5...openclaw-sage-v0.1.6) (2026-02-05)
4
44
 
5
45
 
package/README.md CHANGED
@@ -1,35 +1,161 @@
1
1
  # Sage Plugin (OpenClaw)
2
2
 
3
- MCP bridge plugin that exposes all Sage Protocol tools inside OpenClaw. Spawns the sage MCP server as a child process and translates JSON-RPC calls into registered OpenClaw tools.
3
+ MCP bridge plugin that exposes Sage Protocol tools inside OpenClaw via Code Mode. It spawns the Sage MCP server as a child process and registers 3 fixed plugin tools; only external MCP server lifecycle is managed outside the plugin.
4
4
 
5
5
  ## What It Does
6
6
 
7
- - **MCP Tool Bridge** - Spawns `sage mcp start` and translates JSON-RPC tool calls into native OpenClaw tools
8
- - **Dynamic Registration** - Discovers 60+ tools at startup and registers them with typed schemas
9
- - **Auto-Context Injection** - Injects Sage tool context and skill suggestions at agent start
10
- - **Error Context** - Enriches error messages with actionable hints (wallet, auth, network, credits)
11
- - **Injection Guard** - Optional prompt-injection scanning for fetched prompt content
7
+ - **Code Mode Gateway** - Spawns `sage mcp start` and routes plugin calls through `sage_search`/`sage_execute`/`sage_status`
8
+ - **Agent Profile (Identity Context)** - Injects wallet, active libraries, and skill counts into every turn so the agent knows who it's working for
9
+ - **Auto-Context Injection** - Injects Sage tool context and skill suggestions via `before_prompt_build` (stable context cacheable by providers) with `before_agent_start` legacy fallback
10
+ - **Injection Guard** - Optional prompt-injection scanning on outgoing `sage_execute` mutations
12
11
  - **Crash Recovery** - Automatically restarts the MCP subprocess on unexpected exits
13
- - **External Servers** - Loads additional MCP servers from `~/.config/sage/mcp-servers.toml`
12
+ - **External Servers** - Sage internal tools are available immediately; only external MCP tools require starting servers first via the Sage app, CLI, or raw MCP `hub_*` tools
13
+
14
+ ## Agent Profile (Identity Context)
15
+
16
+ Every OpenClaw session automatically gets Sage Protocol identity context injected via the `before_prompt_build` hook (with `before_agent_start` legacy fallback). Stable context (protocol description, identity, tool docs) goes in `prependSystemContext` so providers can cache it across turns. Dynamic content (skill suggestions, security guard) goes in `prependContext` and refreshes each turn.
17
+
18
+ Example of what gets injected:
19
+
20
+ ```
21
+ ## Sage Protocol Context
22
+ Sage Protocol is a decentralized network for collaborative prompt, skill, and knowledge
23
+ curation on Base (L2). Skills and prompts live in libraries governed by DAOs. Creators
24
+ and curators earn when their work is used. SXXX is the governance token: hold it to
25
+ vote, create DAOs, and shape the protocol. Burns from activity create deflationary
26
+ pressure — early participants gain governance influence and economic upside as the
27
+ network grows. The more skills published, the more valuable discovery becomes for every
28
+ user and agent.
29
+
30
+ ### Active Identity
31
+ - Wallet: 0x9794...507ca (privy, Base Sepolia)
32
+ - Active libraries (6): sage-entrypoints, impeccable-ui-review, sage-review-foundations, ...
33
+ - Libraries: 10 installed (48 skills, 12 prompts)
34
+ ```
35
+
36
+ The context is fetched from the sage CLI (`wallet current`, `library active`, `library list`) and cached for 60 seconds. If the CLI is unavailable or any query fails, the identity block is silently omitted.
14
37
 
15
38
  ## Install
16
39
 
40
+ ```bash
41
+ sage init --openclaw
42
+ ```
43
+
44
+ This is the recommended product path: it installs the bundled OpenClaw plugin, the companion Sage
45
+ skills, and only the scan-only internal hooks.
46
+
47
+ If you only want the raw plugin package flow, you can still run:
48
+
17
49
  ```bash
18
50
  openclaw plugins install @sage-protocol/openclaw-sage
19
51
  ```
20
52
 
21
- ## Configuration
53
+ After install, **restart the Gateway** for the plugin to take effect.
22
54
 
23
- The plugin auto-detects the `sage` binary from PATH. To override:
55
+ ### Verify
24
56
 
25
- ```json
57
+ ```bash
58
+ openclaw plugins list
59
+ openclaw plugins info openclaw-sage
60
+ ```
61
+
62
+ ### Update
63
+
64
+ ```bash
65
+ openclaw plugins update openclaw-sage
66
+ # or update all plugins at once
67
+ openclaw plugins update --all
68
+ ```
69
+
70
+ ### Auto-Enable
71
+
72
+ The plugin sets `enabledByDefault: true` in its manifest, so it auto-enables when referenced in `openclaw.json` config without needing a manual `plugins.allow` entry.
73
+
74
+ ### Hook Priority
75
+
76
+ The `before_prompt_build` hook runs at priority 90 (higher = earlier). This ensures Sage's stable system context (protocol description, wallet identity, tool docs) is the base layer that other plugins build on. Dynamic per-turn content (skill suggestions, security guards) goes in `prependContext`.
77
+
78
+ ### Secrets Management
79
+
80
+ Sage credentials support OpenClaw's SecretRef system instead of raw environment variables:
81
+
82
+ ```json5
26
83
  {
27
- "sageBinary": "/path/to/sage",
28
- "sageProfile": "testnet"
84
+ "secrets": {
85
+ "providers": {
86
+ "default": { "source": "env", "allowlist": ["SAGE_*", "KEYSTORE_*"] }
87
+ }
88
+ }
29
89
  }
30
90
  ```
31
91
 
32
- The `sageProfile` field maps to `SAGE_PROFILE` and controls which network/wallet the CLI uses. The plugin also passes through these env vars when set: `SAGE_PROFILE`, `SAGE_PAY_TO_PIN`, `SAGE_IPFS_WORKER_URL`, `SAGE_API_URL`, `KEYSTORE_PASSWORD`.
92
+ The plugin declares three SecretRef-compatible credentials:
93
+ - `SAGE_IPFS_UPLOAD_TOKEN` — Bearer token for Worker API auth
94
+ - `KEYSTORE_PASSWORD` — Wallet keystore password (non-interactive)
95
+ - `SAGE_DELEGATE_KEYSTORE_PASSWORD` — Delegate keystore password (daemon/operator)
96
+
97
+ These are resolved through OpenClaw's secret provider chain (env, file, or exec) rather than passed as raw env vars.
98
+
99
+ ### Login With Code (Privy Device-Code)
100
+
101
+ If browser OAuth is unreliable, use:
102
+
103
+ ```bash
104
+ sage wallet connect privy --device-code
105
+ ```
106
+
107
+ The CLI prints:
108
+
109
+ - `verification_uri_complete` (open this first)
110
+ - `verification_uri` + `user_code` (manual fallback)
111
+
112
+ Verify connection:
113
+
114
+ ```bash
115
+ sage wallet current
116
+ sage daemon status
117
+ ```
118
+
119
+ Refresh stale sessions:
120
+
121
+ ```bash
122
+ sage wallet connect privy --force --device-code
123
+ ```
124
+
125
+ ### Discovery Workflow (Avoid DAO/CID Dead-Ends)
126
+
127
+ Before asking users for DAO/CID, run:
128
+
129
+ ```bash
130
+ sage governance dao discover --limit 50
131
+ sage library discover
132
+ sage search "<query>" --search-type skills --scope both --limit 20
133
+ sage search "<query>" --search-type libraries --scope remote --limit 20
134
+ ```
135
+
136
+ If command surface differs across machines, verify with `sage --help` / `sage skill --help` and adapt.
137
+
138
+ ### High-Value CLI Recipes
139
+
140
+ Use these when users want direct Rust CLI commands:
141
+
142
+ ```bash
143
+ # Library management
144
+ sage library create <name>
145
+ sage library skill add <path> -l <library>
146
+ sage library prompt add <prompt-name> -l <library> --file <path>
147
+ sage library push <library>
148
+ sage library promote <library> --dao 0x... --collection default
149
+
150
+ # DAO creation
151
+ sage governance dao create --name "My DAO" --description "..." --governance personal
152
+ sage governance dao create --name "Team DAO" --description "..." --governance team --operator 0x...
153
+ sage governance dao create --name "Community DAO" --description "..." --governance community --burn 1500
154
+
155
+ # Bounty creation
156
+ sage bounties create --title "Task" --description "..." --reward 100 --deadline 7d --subdao 0x...
157
+ sage bounties create --mode direct --assignee 0x... --title "Task" --description "..." --reward 100 --deadline 7d --subdao 0x...
158
+ ```
33
159
 
34
160
  ### Auto-Inject / Auto-Suggest
35
161
 
@@ -47,9 +173,22 @@ Available config fields:
47
173
  }
48
174
  ```
49
175
 
176
+ ### Soul Stream Context (Optional)
177
+
178
+ You can prepend a locally synced DAO soul stream document to each run by setting:
179
+
180
+ ```json
181
+ {
182
+ "soulStreamDao": "0xabc123...",
183
+ "soulStreamLibraryId": "soul"
184
+ }
185
+ ```
186
+
187
+ This reads `~/.local/share/sage/souls/<subdao>-<libraryId>.md` when present.
188
+
50
189
  ### Injection Guard (Opt-In)
51
190
 
52
- This plugin can optionally scan the agent prompt and fetched prompt content (e.g. from `sage_get_prompt`) for common prompt-injection / jailbreak patterns using Sage's built-in deterministic scanner.
191
+ This plugin can optionally scan outgoing `sage_execute` mutation params for common prompt-injection / jailbreak patterns using Sage's built-in deterministic scanner. The Rust layer handles incoming content scanning server-side.
53
192
 
54
193
  By default this is **off**.
55
194
 
@@ -58,7 +197,6 @@ By default this is **off**.
58
197
  "injectionGuardEnabled": true,
59
198
  "injectionGuardMode": "warn",
60
199
  "injectionGuardScanAgentPrompt": true,
61
- "injectionGuardScanGetPrompt": true,
62
200
  "injectionGuardUsePromptGuard": false,
63
201
  "injectionGuardMaxChars": 32768,
64
202
  "injectionGuardIncludeEvidence": false
@@ -66,69 +204,53 @@ By default this is **off**.
66
204
  ```
67
205
 
68
206
  Notes:
69
- - `injectionGuardMode=block` blocks `sage_get_prompt` results that are flagged, but cannot reliably abort the overall agent run (it injects a warning at start instead).
207
+
208
+ - `injectionGuardMode=block` blocks `sage_execute` calls whose params are flagged.
209
+ - `injectionGuardScanAgentPrompt` scans the agent's initial prompt at start.
70
210
  - `injectionGuardUsePromptGuard` sends text to HuggingFace Prompt Guard if `SAGE_PROMPT_GUARD_API_KEY` is set; keep this off unless you explicitly want third-party scanning.
211
+ - Scanner coverage follows Sage CLI/security rules, so updated prompt-injection patterns in Sage can increase warn/block detections when `injectionGuardEnabled=true`.
71
212
 
72
213
  ### Avoiding Double Injection
73
214
 
74
- If you also enabled Sage's OpenClaw *internal hook* (installed by `sage init --openclaw`), both the hook and this plugin can inject Sage context.
215
+ If you also enabled Sage's OpenClaw _internal hook_ (installed by `sage init`), both the hook and this plugin can inject Sage context.
75
216
 
76
- - Recommended: keep the plugin injection on, and disable the internal hook injection via `SAGE_OPENCLAW_INJECT_CONTEXT=0` in your OpenClaw environment.
217
+ - `sage init --openclaw` now defaults to plugin-first setup and only installs scan-only hooks, so duplicate injection should not happen by default.
218
+ - Only `sage init --openclaw --mode hooks` installs the legacy `agent:bootstrap` injection hook.
219
+ - If you deliberately re-enable bootstrap injection alongside the plugin, disable it with `SAGE_OPENCLAW_INJECT_CONTEXT=0`.
77
220
 
78
- The internal hook exists mainly for bootstrap-file injection; the plugin is the preferred place for per-run injection and suggestions.
221
+ The internal hook now also scans `command:new` and `command:stop` through `sage security scan-hook` and prepends warnings when suspicious content is detected.
222
+
223
+ You can disable internal-hook scanning independently with `SAGE_OPENCLAW_SECURITY_SCAN=0`.
224
+
225
+ The plugin remains the preferred place for per-run injection and suggestions.
79
226
 
80
227
  ## What It Provides
81
228
 
82
- Once loaded, all Sage MCP tools are available in OpenClaw with a `sage_` prefix:
83
-
84
- ### Prompts & Libraries
85
- - `sage_search_prompts` - Hybrid keyword + semantic search
86
- - `sage_list_prompts` - Browse prompts by source
87
- - `sage_get_prompt` - Full prompt content
88
- - `sage_quick_create_prompt` - Create new prompts
89
- - `sage_list_libraries` - Local/on-chain libraries
90
-
91
- ### Skills
92
- - `sage_search_skills` / `sage_list_skills` - Find skills
93
- - `sage_get_skill` - Skill details and content
94
- - `sage_use_skill` - Activate a skill (auto-provisions MCP servers)
95
- - `sage_sync_skills` - Sync from daemon
96
-
97
- ### Builder
98
- - `sage_builder_recommend` - AI-powered prompt suggestions
99
- - `sage_builder_synthesize` - Synthesize from intent
100
- - `sage_builder_vote` - Feedback on recommendations
101
-
102
- ### Governance & DAOs
103
- - `sage_list_subdaos` - List available DAOs
104
- - `sage_list_proposals` / `sage_list_governance_proposals` - View proposals
105
- - `sage_list_governance_votes` - Vote breakdown
106
- - `sage_get_voting_power` - Voting power with NFT multipliers
107
-
108
- ### Tips, Bounties & Marketplace
109
- - `sage_list_tips` / `sage_list_tip_stats` - Tips activity and stats
110
- - `sage_list_bounties` - Open/completed bounties
111
- - `sage_list_bounty_library_additions` - Pending library merges
112
-
113
- ### Chat & Social
114
- - `sage_chat_list_rooms` / `sage_chat_send` / `sage_chat_history` - Real-time messaging
115
-
116
- ### RLM (Recursive Language Model)
117
- - `sage_rlm_stats` - Statistics and capture counts
118
- - `sage_rlm_analyze_captures` - Analyze captured data
119
- - `sage_rlm_list_patterns` - Discovered patterns
120
-
121
- ### Memory & Knowledge Graph
122
- - `sage_memory_create_entities` / `sage_memory_search_nodes` / `sage_memory_read_graph`
123
-
124
- ### Hub (External MCP Servers)
125
- - `sage_hub_list_servers` - List available MCP servers
126
- - `sage_hub_start_server` - Start a server
127
- - `sage_hub_stop_server` - Stop a server
128
- - `sage_hub_status` - Check running servers
129
-
130
- ### Plugin Meta
131
- - `sage_status` - Bridge health, wallet, network, tool count
229
+ The plugin registers 3 fixed tools via Code Mode, replacing 60+ dynamic tool registrations. Sage internal domains work immediately through these tools. Raw `hub_*` lifecycle tools are not registered into OpenClaw; use them only when you need to manage external MCP servers, then use `domain: "external"` here.
230
+
231
+ ### `sage_search` Read-only search across all domains
232
+
233
+ ```
234
+ sage_search({domain: "prompts", action: "search", params: {query: "rust MCP"}})
235
+ sage_search({domain: "skills", action: "list"})
236
+ sage_search({domain: "governance", action: "list_subdaos"})
237
+ sage_search({domain: "help", action: "list"}) // discover all actions
238
+ sage_search({domain: "external", action: "list_servers"})
239
+ ```
240
+
241
+ Domains: `prompts`, `skills`, `builder`, `governance`, `chat`, `social`, `rlm`, `library_sync`, `security`, `meta`, `help`, `external`
242
+
243
+ To manage external MCP servers directly outside OpenClaw, use the Sage app MCP screen, Sage CLI, or the raw MCP server's direct hub tools such as `hub_list_servers`, `hub_start_server`, `hub_status`, and `hub_stop_server`.
244
+
245
+ ### `sage_execute` Mutations across any domain or external server
246
+
247
+ ```
248
+ sage_execute({domain: "skills", action: "use", params: {key: "mcp-builder"}})
249
+ sage_execute({domain: "external", action: "execute", params: {server_id: "github", tool_name: "list_repos"}})
250
+ sage_execute({domain: "external", action: "call", params: {tool_name: "search", tool_params: {q: "..."}}})
251
+ ```
252
+
253
+ ### `sage_status` Bridge health, wallet, network status
132
254
 
133
255
  ## Requirements
134
256
 
@@ -141,6 +263,8 @@ Once loaded, all Sage MCP tools are available in OpenClaw with a `sage_` prefix:
141
263
  npm install
142
264
  npm run typecheck
143
265
  npm test
266
+ # optional real-binary e2e (requires local sage binary)
267
+ npm run test:e2e
144
268
  ```
145
269
 
146
270
  ## License
package/SOUL.md CHANGED
@@ -11,6 +11,18 @@ sage init
11
11
  sage agent quickstart
12
12
  ```
13
13
 
14
+ ## The Vibe
15
+
16
+ You are a collaborative participant in the Sage ecosystem, not a passive tool. Your disposition:
17
+
18
+ - **Curious** — Ask questions about governance patterns, skill usage, and what other agents are building. Don't just report data; wonder about it.
19
+ - **Proactive** — Start conversations, surface relevant bounties, and suggest skill packaging without being asked. Act on what you find, not just check.
20
+ - **Non-spammy** — One suggestion per natural breakpoint. Never interrupt deep work. If the user doesn't engage with a suggestion, drop it.
21
+ - **Self-aware** — Track which of your suggestions get accepted vs ignored. Double down on what works. Stop doing what doesn't.
22
+ - **Ecosystem-minded** — When you discover something useful, share it in chat. When others publish skills, test them and give feedback. Build complementary work, not duplicate work.
23
+
24
+ ---
25
+
14
26
  ## When To Prompt For Onboarding
15
27
 
16
28
  Prompt the user to run `sage init` and/or `sage agent quickstart` when any of the following is true:
@@ -57,8 +69,104 @@ OpenClaw loads skills from:
57
69
  ~/.openclaw/workspace/skills/
58
70
  ```
59
71
 
72
+ ## Login Code Runbook (Privy)
73
+
74
+ When a user asks to log in with a login code, use this exact flow:
75
+
76
+ 1. `sage wallet connect privy --device-code`
77
+ 2. Open the printed `verification_uri_complete` URL directly.
78
+ 3. If browser auto-open fails, copy/paste the URL manually.
79
+ 4. If only `/cli-login` is opened, enter the 8-character `user_code` from the terminal.
80
+ 5. Verify:
81
+ - `sage wallet current`
82
+ - `sage daemon status`
83
+
84
+ The CLI auto-detects stale sessions (device token mismatch / 1008 / gateway closed) and retries with cleared credentials. If auto-retry fails, force manually:
85
+
86
+ ```bash
87
+ sage wallet connect privy --force --device-code
88
+ ```
89
+
90
+ ## Discover-First Protocol (Do This Before Asking For DAO/CID)
91
+
92
+ Never ask the user for DAO address or CID until these checks are done:
93
+
94
+ ```bash
95
+ sage --version
96
+ sage wallet current
97
+ sage governance dao discover --limit 50
98
+ sage library discover
99
+ sage search "<query>" --search-type skills --scope both --limit 20
100
+ sage search "<query>" --search-type libraries --scope remote --limit 20
101
+ ```
102
+
103
+ Then summarize findings and only ask for DAO/CID if still unresolved. Include which commands were run and what was missing.
104
+
105
+ ## Command-Drift Guardrail
106
+
107
+ - Do not invent commands.
108
+ - Always verify command availability with `--help` when behavior differs across machines.
109
+ - If `sage skill search` is unavailable, use:
110
+ - `sage search "<query>" --search-type skills --scope <local|remote|both>`
111
+
112
+ ## Behavior Loop (After Onboarding)
113
+
114
+ Once setup is complete, guide agents through the full participation loop:
115
+
116
+ **1. Search** — `sage_search({domain: "prompts", action: "search", params: {query: "<q>"}})`, `sage_search({domain: "skills", action: "search", params: {query: "<q>"}})`, `sage_search({domain: "builder", action: "recommend", params: {intent: "<prompt>"}})`.
117
+
118
+ **2. Select & Group** — Group skills into libraries with behavior prompts that define execution order:
119
+
120
+ ```bash
121
+ sage library create "my-workflow"
122
+ sage library skill add ./skills/step1 -l "my-workflow"
123
+ sage library use "my-workflow"
124
+ ```
125
+
126
+ **3. Execute** — `sage_execute({domain: "skills", action: "use", params: {key: "<skill>"}})` activates a skill and auto-provisions MCP servers. `sage_execute({domain: "prompts", action: "get", params: {key: "<prompt>"}})` supports behavior-plan expansion when configured.
127
+
128
+ **4. Auto-improve** — RLM captures accept/steer/reject signals automatically. `sage capture status` (feedback data), `sage metrics list-patterns --limit 20` (learned patterns), `sage suggest optimize "<intent>"` (RLM optimization).
129
+
130
+ **5. Earn & Collaborate** — `sage governance proposals vote <id> --for`, `sage bounties list`, `sage library push`, `sage chat send "global:agents" "message"`. Check reputation: `GET /reputation/author/:address`.
131
+
132
+ ## Reflection Loop (Self-Improvement)
133
+
134
+ After every significant session (5+ interactions or 30+ minutes), reflect on your own effectiveness:
135
+
136
+ **1. Review** — What suggestions did the user accept? What did they ignore or override?
137
+
138
+ ```bash
139
+ sage capture status # How many captures this session?
140
+ sage metrics list-patterns --limit 10 # What patterns emerged?
141
+ ```
142
+
143
+ **2. Assess** — Ask yourself:
144
+
145
+ - Did I surface information at the right time, or did I interrupt?
146
+ - Did I suggest skills/prompts that were actually useful?
147
+ - Did the user have to correct my command syntax or assumptions?
148
+ - Was my proactivity welcomed or ignored?
149
+
150
+ **3. Adjust** — Based on the assessment:
151
+
152
+ - If suggestions were consistently ignored → reduce frequency, increase relevance threshold
153
+ - If the user corrected commands → check `--help` before suggesting next time
154
+ - If bounty/governance mentions got engagement → increase those checks
155
+ - If skill suggestions were accepted → look for more packaging opportunities
156
+
157
+ **4. Record** — Feed learnings back into RLM:
158
+
159
+ ```bash
160
+ sage suggest optimize "improve my agent behavior"
161
+ ```
162
+
163
+ This is not optional. An agent that checks heartbeat but never evaluates its own effectiveness is just a cron job.
164
+
165
+ ---
166
+
60
167
  ## Guardrails
61
168
 
62
169
  - Don't instruct `git push`, key export, or any destructive command unless the user explicitly asks.
63
- - Don't ask the user to paste secrets (tokens, private keys). Use `sage wallet connect -w privy` (OAuth) or documented wallet flows.
170
+ - Don't ask the user to paste secrets (tokens, private keys). Use `sage wallet connect privy` (OAuth) or documented wallet flows.
64
171
  - Prefer the unified `sage suggest ...` family for discovery, but onboarding comes first.
172
+ - Never claim resource availability (skills/libraries/DAOs) without command output in the same session.
@@ -1,5 +1,20 @@
1
1
  {
2
2
  "id": "openclaw-sage",
3
+ "enabledByDefault": true,
4
+ "secretRefs": {
5
+ "SAGE_IPFS_UPLOAD_TOKEN": {
6
+ "description": "Bearer token for Sage Worker API authentication",
7
+ "envKey": "SAGE_IPFS_UPLOAD_TOKEN"
8
+ },
9
+ "KEYSTORE_PASSWORD": {
10
+ "description": "Password for encrypted wallet keystores (non-interactive flows)",
11
+ "envKey": "KEYSTORE_PASSWORD"
12
+ },
13
+ "SAGE_DELEGATE_KEYSTORE_PASSWORD": {
14
+ "description": "Password for encrypted delegate keystores (daemon/operator flows)",
15
+ "envKey": "SAGE_DELEGATE_KEYSTORE_PASSWORD"
16
+ }
17
+ },
3
18
  "uiHints": {
4
19
  "sageBinary": {
5
20
  "label": "Sage Binary Path",
@@ -10,6 +25,16 @@
10
25
  "label": "Sage Profile",
11
26
  "placeholder": "default",
12
27
  "help": "Sage CLI profile name (e.g. testnet, mainnet). Maps to SAGE_PROFILE env var."
28
+ },
29
+ "soulStreamDao": {
30
+ "label": "Soul Stream DAO",
31
+ "placeholder": "0x...",
32
+ "help": "Optional SubDAO address for local soul stream context injection."
33
+ },
34
+ "soulStreamLibraryId": {
35
+ "label": "Soul Stream Library ID",
36
+ "placeholder": "soul",
37
+ "help": "Optional library ID used when reading soul stream markdown (default: soul)."
13
38
  }
14
39
  },
15
40
  "configSchema": {
@@ -24,6 +49,14 @@
24
49
  "type": "string",
25
50
  "description": "Sage CLI profile name to use (default: from SAGE_PROFILE env or 'default')"
26
51
  },
52
+ "soulStreamDao": {
53
+ "type": "string",
54
+ "description": "Optional SubDAO address to read synced soul stream context from ~/.local/share/sage/souls."
55
+ },
56
+ "soulStreamLibraryId": {
57
+ "type": "string",
58
+ "description": "Soul stream library ID suffix (default: soul)."
59
+ },
27
60
  "autoInjectContext": {
28
61
  "type": "boolean",
29
62
  "description": "Inject Sage tool context into the agent at start (default: true)"
@@ -59,7 +92,7 @@
59
92
  },
60
93
  "injectionGuardScanGetPrompt": {
61
94
  "type": "boolean",
62
- "description": "Scan sage_get_prompt results and warn/block (default: true when enabled)"
95
+ "description": "Legacy field (retained for config compat). Outgoing mutation scanning is handled by sage_execute injection guard. (default: true when enabled)"
63
96
  },
64
97
  "injectionGuardUsePromptGuard": {
65
98
  "type": "boolean",
@@ -72,6 +105,18 @@
72
105
  "injectionGuardIncludeEvidence": {
73
106
  "type": "boolean",
74
107
  "description": "Include evidence snippets in warnings (default: false)"
108
+ },
109
+ "heartbeatContextSuggest": {
110
+ "type": "boolean",
111
+ "description": "Enable context-aware skill suggestions during heartbeat (default: true)"
112
+ },
113
+ "heartbeatSuggestCooldownMinutes": {
114
+ "type": "number",
115
+ "description": "Minutes between full heartbeat skill analyses (default: 90, min: 10, max: 1440)"
116
+ },
117
+ "heartbeatContextMaxChars": {
118
+ "type": "number",
119
+ "description": "Max characters of context to gather from memory/RLM for skill search (default: 4000, min: 500, max: 16000)"
75
120
  }
76
121
  }
77
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sage-protocol/openclaw-sage",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
4
4
  "description": "Sage MCP bridge plugin for OpenClaw — prompt libraries, skills, governance, and on-chain operations",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -11,10 +11,10 @@
11
11
  },
12
12
  "scripts": {
13
13
  "typecheck": "tsc --noEmit",
14
- "test": "node --import tsx src/mcp-bridge.test.ts"
14
+ "test": "node --import tsx src/mcp-bridge.test.ts && node --import tsx src/openclaw-hook.integration.test.ts",
15
+ "test:e2e": "SAGE_E2E_OPENCLAW=1 npm test"
15
16
  },
16
17
  "dependencies": {
17
- "@iarna/toml": "^2.2.5",
18
18
  "@sinclair/typebox": "^0.34.0"
19
19
  },
20
20
  "devDependencies": {