@sage-protocol/pi-adapter 0.3.7 → 0.3.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.
- package/README.md +5 -3
- package/dist/sage-pi-adapter.d.ts +13 -2
- package/dist/sage-pi-adapter.d.ts.map +1 -1
- package/dist/sage-pi-adapter.js +514 -115
- package/dist/sage-pi-adapter.js.map +1 -1
- package/extensions/index.ts +1297 -1085
- package/package.json +1 -5
- package/skills/sage-bridge/SKILL.md +0 -327
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sage-protocol/pi-adapter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "Sage Protocol MCP integration for pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
16
|
"extensions",
|
|
17
|
-
"skills",
|
|
18
17
|
"README.md",
|
|
19
18
|
"USAGE.md",
|
|
20
19
|
"SKILL.md"
|
|
@@ -22,9 +21,6 @@
|
|
|
22
21
|
"pi": {
|
|
23
22
|
"extensions": [
|
|
24
23
|
"./extensions"
|
|
25
|
-
],
|
|
26
|
-
"skills": [
|
|
27
|
-
"./skills"
|
|
28
24
|
]
|
|
29
25
|
},
|
|
30
26
|
"scripts": {
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sage-bridge
|
|
3
|
-
description: >
|
|
4
|
-
Pi adapter bridge for Sage Protocol. Search and activate prompt packs, libraries,
|
|
5
|
-
and governance tools via the sage_search, sage_execute, sage_status MCP tools.
|
|
6
|
-
Use when: building something new (search first), managing prompts/libraries,
|
|
7
|
-
DAO governance, bounties, chat rooms, or needing web search. Don't use when:
|
|
8
|
-
the task is only local file editing or standard shell work with no Sage routing,
|
|
9
|
-
library, governance, or external-search need.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Sage Protocol Skill
|
|
13
|
-
|
|
14
|
-
Decentralized governance for AI prompt libraries. Search, activate, and manage skills, prompts, DAOs, bounties, and chat — all from Pi.
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Tools Available
|
|
19
|
-
|
|
20
|
-
Three MCP tools are registered by the adapter extension:
|
|
21
|
-
|
|
22
|
-
### `sage_search` — Read-only queries across all domains
|
|
23
|
-
|
|
24
|
-
```json
|
|
25
|
-
sage_search({ domain: "skills", action: "search", params: { query: "rust development" } })
|
|
26
|
-
sage_search({ domain: "prompts", action: "search", params: { query: "code review" } })
|
|
27
|
-
sage_search({ domain: "governance", action: "list_subdaos" })
|
|
28
|
-
sage_search({ domain: "chat", action: "history", params: { channel: "global:agents" } })
|
|
29
|
-
sage_search({ domain: "rlm", action: "stats" })
|
|
30
|
-
sage_search({ domain: "external", action: "search", params: { tool_name: "web_search", tool_params: { query: "MCP best practices" } } })
|
|
31
|
-
sage_search({ domain: "external", action: "list_servers" })
|
|
32
|
-
sage_search({ domain: "help", action: "list" })
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Domains: `prompts`, `skills`, `builder`, `governance`, `chat`, `social`, `rlm`, `library_sync`, `security`, `help`, `external`.
|
|
36
|
-
|
|
37
|
-
### `sage_execute` — Mutations (security-scanned)
|
|
38
|
-
|
|
39
|
-
```json
|
|
40
|
-
sage_execute({ domain: "skills", action: "use", params: { key: "mcp-builder" } })
|
|
41
|
-
sage_execute({ domain: "hub", action: "start", params: { server_id: "memory" } })
|
|
42
|
-
sage_execute({ domain: "external", action: "call", params: { tool_name: "fetch", tool_params: { url: "https://example.com" } } })
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### `sage_status` — Bridge health and context
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
sage_status({})
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Returns bridge health, wallet connection, network, and session info.
|
|
52
|
-
|
|
53
|
-
If `sage_status` reports a degraded or unavailable bridge, do not keep retrying
|
|
54
|
-
silently. Tell the user the Sage MCP bridge is unavailable and suggest
|
|
55
|
-
restarting Pi/Sage bridge or verifying `sage mcp start`. Only suggest
|
|
56
|
-
`sage daemon start` when the reported failure is specifically daemon reachability.
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Behavior Loop
|
|
61
|
-
|
|
62
|
-
Follow this cycle for every non-trivial task:
|
|
63
|
-
|
|
64
|
-
**1. Search** — Always look for existing skills/prompts before building from scratch.
|
|
65
|
-
|
|
66
|
-
```json
|
|
67
|
-
sage_search({ domain: "skills", action: "search", params: { query: "your task" } })
|
|
68
|
-
sage_search({ domain: "prompts", action: "search", params: { query: "your task" } })
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**2. Inspect** — Read full details before activating.
|
|
72
|
-
|
|
73
|
-
```json
|
|
74
|
-
sage_execute({ domain: "skills", action: "get", params: { key: "skill-key" } })
|
|
75
|
-
sage_execute({ domain: "prompts", action: "get", params: { key: "prompt-key" } })
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
**3. Activate** — Load skills that match the task.
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
sage_execute({ domain: "skills", action: "use", params: { key: "skill-key" } })
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**4. Iterate** — Check RLM stats. Refine approach based on what worked.
|
|
85
|
-
|
|
86
|
-
```json
|
|
87
|
-
sage_search({ domain: "rlm", action: "stats" })
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**5. Earn & Collaborate** — Publish, vote, tip, bounty.
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
sage library push my-library --bump patch
|
|
94
|
-
sage governance proposals vote 1 for
|
|
95
|
-
sage bounties list
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Choose a Sage distribution surface by intent
|
|
101
|
-
|
|
102
|
-
Do not collapse every write path into a generic idea of "publish." Choose the smallest surface that matches the actual goal:
|
|
103
|
-
|
|
104
|
-
- **P2P** — sync trusted machines/agents privately.
|
|
105
|
-
- **Shared library** — collaborate privately with explicit members/invites.
|
|
106
|
-
- **Personal cloud** — host a creator-controlled canonical library; it starts private by default.
|
|
107
|
-
- **Public personal cloud** — make a hosted library publicly discoverable only when the user explicitly asks, with `sage library visibility <library-id> public`.
|
|
108
|
-
- **Marketplace** — sell a polished public personal library as a packaged capability.
|
|
109
|
-
- **DAO promotion** — make a library canonical for a group/community and unlock curation, legitimacy, on-chain reputation, tips, bounties, and community-driven improvement.
|
|
110
|
-
|
|
111
|
-
**Governance chooser**
|
|
112
|
-
- **personal DAO** — fastest operator-controlled canon
|
|
113
|
-
- **team DAO** — trusted shared stewardship
|
|
114
|
-
- **community DAO** — strongest public curation and legitimacy
|
|
115
|
-
|
|
116
|
-
Pi routing rules:
|
|
117
|
-
- If the user says **direct share** or **share privately**, think **shared library** first.
|
|
118
|
-
- If the goal is trusted fleet propagation, think **P2P**, not governance.
|
|
119
|
-
- If the goal is creator-controlled hosting, think **personal cloud** and remember it is private by default.
|
|
120
|
-
- If the goal is public web/discovery access, confirm explicit intent before making a library public.
|
|
121
|
-
- If the goal is monetization, think **marketplace**.
|
|
122
|
-
- If the goal is public canon, stronger provenance, future bounties, and repeated community improvement, think **DAO promotion**.
|
|
123
|
-
- If one surface is clearly implied, proactively suggest it instead of waiting for the user to name the exact Sage term.
|
|
124
|
-
- Install/expose is local harness visibility only; do not treat it as publishing.
|
|
125
|
-
- Public feeds/search should only advertise anonymously readable prompts and skills; keep owner-only, unpinned, expired, or otherwise non-openable CIDs out of public discovery until republished or made public.
|
|
126
|
-
|
|
127
|
-
## When to Trigger
|
|
128
|
-
|
|
129
|
-
Proactively search Sage when:
|
|
130
|
-
|
|
131
|
-
- **Starting a new task** — search for existing skills before writing code
|
|
132
|
-
- **Entering an unfamiliar domain** — check for domain-specific prompts
|
|
133
|
-
- **Building an API, UI, or feature** — look for best-practice skills
|
|
134
|
-
- **User mentions governance, tokens, DAOs** — route to governance tools
|
|
135
|
-
- **User asks about bounties or chat** — route to respective CLI commands
|
|
136
|
-
- **User wants web search** — use `sage_search` with `domain: "external"`
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Recommended Pi Setup
|
|
141
|
-
|
|
142
|
-
Keep pi thin and let Sage own routing behavior.
|
|
143
|
-
|
|
144
|
-
Recommended `.pi/settings.json` shape in a local monorepo:
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
{
|
|
148
|
-
"packages": [
|
|
149
|
-
"../packages/sage-pi-adapter",
|
|
150
|
-
{
|
|
151
|
-
"source": "../packages/sage-pi-export",
|
|
152
|
-
"skills": ["skills/*/SKILL.md"],
|
|
153
|
-
"extensions": [],
|
|
154
|
-
"prompts": [],
|
|
155
|
-
"themes": []
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"source": "npm:oh-pi",
|
|
159
|
-
"extensions": ["!**"]
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
"skills": [
|
|
163
|
-
"-../.agents/skills/frontend-design/SKILL.md",
|
|
164
|
-
"-~/.pi/agent/skills/prompt-builder/SKILL.md",
|
|
165
|
-
"-~/.pi/agent/skills/sage/SKILL.md",
|
|
166
|
-
"-~/.pi/agent/skills/sage-workflow/SKILL.md"
|
|
167
|
-
],
|
|
168
|
-
"enableSkillCommands": true
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Mental model:
|
|
173
|
-
|
|
174
|
-
- pi/OpenClaw = transport and tool surface
|
|
175
|
-
- `sage` = base router skill
|
|
176
|
-
- thin entrypoint library = recurring session-entry behavior layer
|
|
177
|
-
- peer libraries = specialized review, critique, or domain augmentation
|
|
178
|
-
|
|
179
|
-
Discovery rule:
|
|
180
|
-
|
|
181
|
-
- prefer the curated `packages/sage-pi-export` package for Pi
|
|
182
|
-
- avoid broad runtime roots like `~/.local/share/sage/skills` unless you explicitly want Pi to validate installed, versioned, and backup skill directories too
|
|
183
|
-
|
|
184
|
-
Authoring and distribution model:
|
|
185
|
-
|
|
186
|
-
- repo-authored skills and entrypoint definitions are the authoring source
|
|
187
|
-
- on-chain libraries are the shared distribution and sync/pull surface
|
|
188
|
-
- local sync is development convenience, not the product center
|
|
189
|
-
|
|
190
|
-
Dispatch rule:
|
|
191
|
-
|
|
192
|
-
- entrypoint behaviors should compose stable Sage-owned dependency skills by key instead of duplicating their bodies
|
|
193
|
-
- examples of dependency-surface dispatch targets: `code-review`, `ceo-plan-review`, `vc-office-hours` from `sage-review-foundations`
|
|
194
|
-
|
|
195
|
-
Export rule:
|
|
196
|
-
|
|
197
|
-
- author real skills under `packages/sage/skills/`
|
|
198
|
-
- declare the Pi-visible subset in `packages/sage/pi-export.manifest.json`
|
|
199
|
-
- materialize `packages/sage-pi-export/skills/` with `node scripts/util/sync-sage-pi-export.mjs`
|
|
200
|
-
|
|
201
|
-
Do not encode long-lived routing policy into the harness when a Sage skill or library can own it.
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
## Bash CLI Quick Reference
|
|
206
|
-
|
|
207
|
-
Use bash fallback when MCP tools are unavailable or for commands not covered by tools.
|
|
208
|
-
|
|
209
|
-
### Discovery & Search
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
sage search "<query>" --search-type skills --scope both
|
|
213
|
-
sage suggest skill "<intent>" --limit 3 --provision
|
|
214
|
-
sage suggest hook skill --limit 3 --provision # Hook mode (reads PROMPT env)
|
|
215
|
-
sage skill get <key>
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Libraries
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
sage library list
|
|
222
|
-
sage library create <name>
|
|
223
|
-
sage library skill add <path> -l <library>
|
|
224
|
-
sage library prompt add <name> -l <library> --file <path>
|
|
225
|
-
sage library push <library> --bump patch
|
|
226
|
-
sage library promote <library> --dao 0x... --collection default --yes
|
|
227
|
-
# Use `major`, `minor`, or `patch` for `--bump`; exact SemVer and `status --across` are not current CLI commands.
|
|
228
|
-
sage library discover
|
|
229
|
-
sage library sync
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Governance & DAOs
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
sage governance dao list
|
|
236
|
-
sage governance dao discover
|
|
237
|
-
sage governance dao info 0x...
|
|
238
|
-
sage governance dao create --name "My DAO" --description "..." --governance personal
|
|
239
|
-
sage governance proposals list --dao 0x...
|
|
240
|
-
sage governance proposals vote <id> for|against|abstain
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### Bounties
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
sage bounties list
|
|
247
|
-
sage bounties create --title "Task" --description "..." --reward 100 --deadline 7d
|
|
248
|
-
sage bounties submit --bounty-id <id> --content-cid Qm... --deliverable-cid Qm...
|
|
249
|
-
sage bounties start-voting --bounty-id <id>
|
|
250
|
-
sage bounties vote --bounty-id <id> --submission-id <id>
|
|
251
|
-
sage bounties finalize --bounty-id <id>
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Chat & Social
|
|
255
|
-
|
|
256
|
-
```bash
|
|
257
|
-
sage chat list
|
|
258
|
-
sage chat join global:agents
|
|
259
|
-
sage chat send "global:agents" "Hello!"
|
|
260
|
-
sage chat history global:agents --limit 50
|
|
261
|
-
sage chat watch global:agents
|
|
262
|
-
sage chat watched
|
|
263
|
-
sage social follow user <name>
|
|
264
|
-
sage social following
|
|
265
|
-
sage social post "message"
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Wallet & Agent
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
sage wallet balance
|
|
272
|
-
sage wallet current
|
|
273
|
-
sage wallet create sage-wallet
|
|
274
|
-
sage wallet connect ows -n sage-wallet
|
|
275
|
-
sage wallet connect privy --device-code
|
|
276
|
-
sage wallet delegate
|
|
277
|
-
sage delegation create --delegation-profile voter
|
|
278
|
-
sage delegation list
|
|
279
|
-
sage delegation revoke <hash> --chain-id 84532
|
|
280
|
-
sage agent info
|
|
281
|
-
sage agent register
|
|
282
|
-
sage agent quickstart
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Preserve the user's already-working wallet/session preference when one exists. The examples above show common direct-wallet and provider-session paths, not a requirement to force one provider.
|
|
286
|
-
|
|
287
|
-
`sage wallet delegate` is ERC20Votes self-delegation for governance voting power. `sage delegation ...` is scoped agent delegation management.
|
|
288
|
-
|
|
289
|
-
### RLM Capture
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
sage capture status
|
|
293
|
-
sage capture hook prompt # Hook mode for prompts
|
|
294
|
-
sage capture hook response # Hook mode for responses
|
|
295
|
-
sage metrics rlm
|
|
296
|
-
sage metrics list-patterns --limit 20
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### MCP Hub
|
|
300
|
-
|
|
301
|
-
```bash
|
|
302
|
-
sage mcp start
|
|
303
|
-
sage mcp hub list
|
|
304
|
-
sage mcp hub status
|
|
305
|
-
sage mcp hub start <server>
|
|
306
|
-
sage mcp call <tool> --args '{...}'
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## Common Pitfalls
|
|
312
|
-
|
|
313
|
-
- **Hook mode vs query mode**: `sage suggest hook skill` reads the `PROMPT` environment variable or stdin — don't pass the prompt as a positional argument.
|
|
314
|
-
- **Bridge vs daemon wording**: Pi primarily talks to Sage through the MCP bridge. When `sage_status` shows bridge degradation, say "Sage MCP bridge unavailable" and verify `sage mcp start`; don't default to daemon-start advice unless the daemon is the reported failure.
|
|
315
|
-
- **`external/search` requires `tool_name`**: Always include `tool_name` in params when searching via external domain (e.g., `tool_name: "web_search"`).
|
|
316
|
-
- **Domain routing**: Each domain has its own set of actions. Use `sage_search({ domain: "help", action: "list" })` to discover available actions.
|
|
317
|
-
- **Legacy commands removed**: Do not use `sage dao ...`, `sage proposals ...`, or `sage ipfs ...` — these are replaced by `sage governance dao ...`, `sage governance proposals ...`, and `sage config ipfs ...`.
|
|
318
|
-
- **Verify syntax**: Run `sage --help` or `sage <group> --help` for exact flags.
|
|
319
|
-
|
|
320
|
-
---
|
|
321
|
-
|
|
322
|
-
## Don't Use When
|
|
323
|
-
|
|
324
|
-
- General coding tasks with no Sage integration needed
|
|
325
|
-
- Local file operations (use Pi's built-in read/write tools)
|
|
326
|
-
- Tasks requiring only standard shell commands
|
|
327
|
-
- Web browsing without Sage context (use browser tools directly)
|