@dp-pcs/ogp 0.3.3 → 0.4.3

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.
Files changed (112) hide show
  1. package/README.md +317 -61
  2. package/dist/cli/completion.d.ts +5 -0
  3. package/dist/cli/completion.d.ts.map +1 -0
  4. package/dist/cli/completion.js +148 -0
  5. package/dist/cli/completion.js.map +1 -0
  6. package/dist/cli/config.d.ts +3 -0
  7. package/dist/cli/config.d.ts.map +1 -0
  8. package/dist/cli/config.js +207 -0
  9. package/dist/cli/config.js.map +1 -0
  10. package/dist/cli/expose.d.ts.map +1 -1
  11. package/dist/cli/expose.js +20 -13
  12. package/dist/cli/expose.js.map +1 -1
  13. package/dist/cli/federation.d.ts +14 -0
  14. package/dist/cli/federation.d.ts.map +1 -1
  15. package/dist/cli/federation.js +347 -23
  16. package/dist/cli/federation.js.map +1 -1
  17. package/dist/cli/project.d.ts +4 -3
  18. package/dist/cli/project.d.ts.map +1 -1
  19. package/dist/cli/project.js +34 -24
  20. package/dist/cli/project.js.map +1 -1
  21. package/dist/cli/setup.d.ts +23 -0
  22. package/dist/cli/setup.d.ts.map +1 -1
  23. package/dist/cli/setup.js +560 -32
  24. package/dist/cli/setup.js.map +1 -1
  25. package/dist/cli.js +358 -35
  26. package/dist/cli.js.map +1 -1
  27. package/dist/daemon/agent-comms.d.ts.map +1 -1
  28. package/dist/daemon/agent-comms.js +15 -10
  29. package/dist/daemon/agent-comms.js.map +1 -1
  30. package/dist/daemon/heartbeat.d.ts +22 -0
  31. package/dist/daemon/heartbeat.d.ts.map +1 -0
  32. package/dist/daemon/heartbeat.js +119 -0
  33. package/dist/daemon/heartbeat.js.map +1 -0
  34. package/dist/daemon/intent-registry.d.ts.map +1 -1
  35. package/dist/daemon/intent-registry.js +19 -10
  36. package/dist/daemon/intent-registry.js.map +1 -1
  37. package/dist/daemon/keypair.d.ts +1 -0
  38. package/dist/daemon/keypair.d.ts.map +1 -1
  39. package/dist/daemon/keypair.js +151 -18
  40. package/dist/daemon/keypair.js.map +1 -1
  41. package/dist/daemon/message-handler.d.ts.map +1 -1
  42. package/dist/daemon/message-handler.js +30 -16
  43. package/dist/daemon/message-handler.js.map +1 -1
  44. package/dist/daemon/notify.d.ts +19 -0
  45. package/dist/daemon/notify.d.ts.map +1 -1
  46. package/dist/daemon/notify.js +376 -73
  47. package/dist/daemon/notify.js.map +1 -1
  48. package/dist/daemon/openclaw-bridge.d.ts +34 -0
  49. package/dist/daemon/openclaw-bridge.d.ts.map +1 -0
  50. package/dist/daemon/openclaw-bridge.js +261 -0
  51. package/dist/daemon/openclaw-bridge.js.map +1 -0
  52. package/dist/daemon/peers.d.ts +21 -0
  53. package/dist/daemon/peers.d.ts.map +1 -1
  54. package/dist/daemon/peers.js +125 -20
  55. package/dist/daemon/peers.js.map +1 -1
  56. package/dist/daemon/projects.d.ts +9 -6
  57. package/dist/daemon/projects.d.ts.map +1 -1
  58. package/dist/daemon/projects.js +30 -20
  59. package/dist/daemon/projects.js.map +1 -1
  60. package/dist/daemon/server.d.ts +17 -0
  61. package/dist/daemon/server.d.ts.map +1 -1
  62. package/dist/daemon/server.js +188 -77
  63. package/dist/daemon/server.js.map +1 -1
  64. package/dist/shared/config.d.ts +52 -1
  65. package/dist/shared/config.d.ts.map +1 -1
  66. package/dist/shared/config.js +18 -11
  67. package/dist/shared/config.js.map +1 -1
  68. package/dist/shared/framework-detection.d.ts +31 -0
  69. package/dist/shared/framework-detection.d.ts.map +1 -0
  70. package/dist/shared/framework-detection.js +91 -0
  71. package/dist/shared/framework-detection.js.map +1 -0
  72. package/dist/shared/help.d.ts +5 -0
  73. package/dist/shared/help.d.ts.map +1 -0
  74. package/dist/shared/help.js +281 -0
  75. package/dist/shared/help.js.map +1 -0
  76. package/dist/shared/meta-config.d.ts +44 -0
  77. package/dist/shared/meta-config.d.ts.map +1 -0
  78. package/dist/shared/meta-config.js +89 -0
  79. package/dist/shared/meta-config.js.map +1 -0
  80. package/dist/shared/migration.d.ts +57 -0
  81. package/dist/shared/migration.d.ts.map +1 -0
  82. package/dist/shared/migration.js +255 -0
  83. package/dist/shared/migration.js.map +1 -0
  84. package/docs/CLI-REFERENCE.md +1361 -0
  85. package/docs/GETTING-STARTED.md +953 -0
  86. package/docs/MIGRATION.md +202 -0
  87. package/docs/MULTI-FRAMEWORK-DEMO.md +352 -0
  88. package/docs/MULTI-FRAMEWORK-DESIGN.md +378 -0
  89. package/docs/MULTI-FRAMEWORK-IMPL.md +197 -0
  90. package/docs/case-studies/CRASH_RESOLUTION_20260407.md +190 -0
  91. package/docs/case-studies/OpenClaw_Hermes_Status_Report_20260407.md +142 -0
  92. package/docs/case-studies/OpenClaw_Stability_Fix_Summary.md +209 -0
  93. package/docs/case-studies/README.md +40 -0
  94. package/docs/case-studies/crash_observations.md +250 -0
  95. package/docs/cloudflare-named-tunnel-setup.md +126 -0
  96. package/docs/federation-flow.md +27 -37
  97. package/docs/hermes-implementation-checklist.md +4 -0
  98. package/docs/project-intent-testing.md +97 -0
  99. package/docs/quickstart.md +12 -4
  100. package/docs/rendezvous.md +13 -14
  101. package/docs/scopes.md +13 -13
  102. package/package.json +12 -6
  103. package/scripts/completion.bash +123 -0
  104. package/scripts/completion.zsh +372 -0
  105. package/scripts/install-skills.js +19 -1
  106. package/scripts/test-migration-execute.js +74 -0
  107. package/scripts/test-migration.js +42 -0
  108. package/scripts/test-project-intents.mjs +614 -0
  109. package/skills/ogp/SKILL.md +197 -64
  110. package/skills/ogp-agent-comms/SKILL.md +107 -41
  111. package/skills/ogp-expose/SKILL.md +183 -25
  112. package/skills/ogp-project/SKILL.md +110 -88
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  skill_name: ogp-agent-comms
3
- version: 0.2.2
4
- description: Interactive wizard to configure agent-to-agent communication policies (updated for OGP 0.2.24+ peer identity and 0.2.28+ multi-agent routing)
3
+ version: 0.6.0
4
+ description: Interactive wizard to configure agent-to-agent communication policies (updated for multi-framework `--for` workflows, OGP 0.2.24+ peer identity, and 0.2.28+ multi-agent routing)
5
5
  trigger: Use when the user wants to configure how their agent responds to incoming agent-comms messages from federated peers
6
6
  ---
7
7
  ## Prerequisites
@@ -9,9 +9,11 @@ trigger: Use when the user wants to configure how their agent responds to incomi
9
9
  The OGP daemon must be installed. If you see errors like 'ogp: command not found', install it first:
10
10
 
11
11
  ```bash
12
- npm install -g github:dp-pcs/ogp --ignore-scripts
12
+ npm install -g @dp-pcs/ogp
13
13
  ogp-install-skills
14
14
  ogp setup
15
+ ogp agent-comms interview
16
+ ogp config show
15
17
  ```
16
18
 
17
19
  Full documentation: https://github.com/dp-pcs/ogp
@@ -37,10 +39,22 @@ Agent-comms policies control HOW your agent responds to incoming messages (separ
37
39
  **Two layers:**
38
40
  1. **Scope grants** (doorman) - Controls which intents/topics are ALLOWED
39
41
  2. **Response policies** (this skill) - Controls HOW your agent RESPONDS
42
+ 3. **Human delivery preferences** - Controls WHERE and WHEN your agent surfaces federated requests back to the human
43
+
44
+ **Important default:** when a federation request is approved, OGP auto-enables the `general` topic for that peer. Everything else still needs explicit policy if the user wants something more restrictive or more open.
40
45
 
41
46
  **Multi-Agent Routing (v0.2.28+):**
42
47
  When using `notifyTargets` in your OGP config, federation messages can be routed to specific agents based on the message context. Each agent can have its own agent-comms policies.
43
48
 
49
+ **Human delivery behavior (v0.4.2+):**
50
+ Use `humanDeliveryTarget` plus `inboundFederationPolicy.mode` to tell the agent whether it should forward everything, summarize, act autonomously, or wait for approval before replying.
51
+
52
+ OGP now evaluates delegated-authority rules—global defaults, per-peer overrides, message-class-specific rules (`agent-work`, `human-relay`, `approval-request`, `status-update`), and topic overrides—before finalizing delivery behavior. This determines whether the agent may reply directly or must escalate to the configured human session. On OpenClaw, `/hooks/agent` is the preferred delivery path; it tries to request the actual human session key only when `hooks.allowRequestSessionKey=true` and the requested key matches configured prefixes. When the flag is false, the hook runs in the default session (`agent:main:main`), so Telegram sender identity continues to appear as injected/system/`cli`, which is the accepted `v0.4.2` limitation documented in the README and changelog. Lifecycle events such as federation approvals now surface through these same hook-driven turns, so humans see the lifecycle update without needing to poll another channel.
53
+
54
+ On OpenClaw, human-facing federated work should be handled through the platform's hook-driven agent turn (`/hooks/agent`). Direct `sessions.send` injection is a lower-level fallback or sync mechanism, not the primary behavioral path.
55
+
56
+ **Multi-Framework note:** Policies are framework-local. Use `ogp --for openclaw ...` for OpenClaw state and `ogp --for hermes ...` for Hermes state.
57
+
44
58
  ## Interactive Flow
45
59
 
46
60
  When invoked, guide the user through this flow:
@@ -49,35 +63,60 @@ When invoked, guide the user through this flow:
49
63
 
50
64
  ```bash
51
65
  # Verify OGP is running and has peers
52
- ogp status
53
- ogp federation list --status approved
66
+ ogp config show
67
+ ogp --for openclaw status
68
+ ogp --for openclaw federation list --status approved
54
69
  ```
55
70
 
56
71
  If no approved peers, inform the user they need to federate first.
57
72
 
58
- ### Step 2: Show Current Configuration
73
+ ### Step 2: Re-run the Delegated-Authority Interview First
74
+
75
+ When the user is configuring overall human-delivery or autonomy behavior, start with the canonical interview command instead of approximating it manually:
76
+
77
+ ```bash
78
+ ogp --for openclaw agent-comms interview
79
+ ```
80
+
81
+ Use the Hermes variant when the active framework is Hermes:
82
+
83
+ ```bash
84
+ ogp --for hermes agent-comms interview
85
+ ```
86
+
87
+ This command updates:
88
+ - `humanDeliveryTarget` when the framework supports it
89
+ - `inboundFederationPolicy.mode`
90
+ - delegated-authority defaults for human surfacing, relay handling, approval-required topics, and trusted-peer autonomy
91
+
92
+ After the interview, continue with per-peer or per-topic policy commands only if the user wants something more specific.
93
+
94
+ ### Step 3: Show Current Configuration
59
95
 
60
96
  ```bash
61
97
  # Show current policies
62
- ogp agent-comms policies
98
+ ogp --for openclaw agent-comms policies
63
99
  ```
64
100
 
65
- ### Step 3: Ask What to Configure
101
+ ### Step 4: Ask What to Configure
66
102
 
67
103
  Present options:
68
104
  1. **Global defaults** - Apply to all peers (current and future)
69
105
  2. **Specific peer(s)** - Configure individual peers
70
106
  3. **View current policies** - Just show what's configured
71
107
 
72
- ### Step 4: For Specific Peers - Multi-Select
108
+ ### Step 5: For Specific Peers - Multi-Select
73
109
 
74
110
  If configuring specific peers, show the list and allow multi-select:
75
111
 
112
+ Use the peer list from:
113
+
76
114
  ```bash
77
- # List peers for selection
78
- ogp federation list --status approved --json
115
+ ogp --for openclaw federation list --status approved
79
116
  ```
80
117
 
118
+ Prefer the peer ID shown in the list. Some commands also accept a display-name match, but the peer ID is the safest input.
119
+
81
120
  Example interaction:
82
121
  ```
83
122
  Select peers to configure:
@@ -88,7 +127,7 @@ Select peers to configure:
88
127
  Selected: Stanislav, Alice
89
128
  ```
90
129
 
91
- ### Step 5: Configure Topics
130
+ ### Step 6: Configure Topics
92
131
 
93
132
  Ask which topics the agent should engage on:
94
133
 
@@ -113,17 +152,18 @@ For each topic (or all topics), set the response level:
113
152
  | `summary` | High-level responses only, no specifics |
114
153
  | `escalate` | Ask human before responding |
115
154
  | `deny` | Politely decline to discuss |
155
+ | `off` | Block the topic entirely |
116
156
 
117
157
  ### Step 7: Save Configuration
118
158
 
119
159
  ```bash
120
160
  # Save policies for selected peers
121
- ogp agent-comms configure <peer-id> \
161
+ ogp --for openclaw agent-comms configure <peer-id> \
122
162
  --topics "memory-management,testing,general" \
123
163
  --level full
124
164
 
125
165
  # Or set global defaults
126
- ogp agent-comms configure --global \
166
+ ogp --for openclaw agent-comms configure --global \
127
167
  --topics "general,testing" \
128
168
  --level summary
129
169
  ```
@@ -132,7 +172,7 @@ ogp agent-comms configure --global \
132
172
 
133
173
  ```bash
134
174
  # Show the updated configuration
135
- ogp agent-comms policies <peer-id>
175
+ ogp --for openclaw agent-comms policies <peer-id>
136
176
  ```
137
177
 
138
178
  ## CLI Commands
@@ -140,7 +180,7 @@ ogp agent-comms policies <peer-id>
140
180
  ### View All Policies
141
181
 
142
182
  ```bash
143
- ogp agent-comms policies
183
+ ogp --for openclaw agent-comms policies
144
184
  ```
145
185
 
146
186
  Shows global defaults and per-peer overrides.
@@ -148,7 +188,7 @@ Shows global defaults and per-peer overrides.
148
188
  ### View Peer Policy
149
189
 
150
190
  ```bash
151
- ogp agent-comms policies 302a300506032b65
191
+ ogp --for openclaw agent-comms policies 302a300506032b65
152
192
  ```
153
193
 
154
194
  Shows effective policy for a specific peer (global + overrides).
@@ -156,7 +196,7 @@ Shows effective policy for a specific peer (global + overrides).
156
196
  ### Configure Global Defaults
157
197
 
158
198
  ```bash
159
- ogp agent-comms configure --global \
199
+ ogp --for openclaw agent-comms configure --global \
160
200
  --topics "general,testing" \
161
201
  --level summary \
162
202
  --notes "Default: be helpful but don't overshare"
@@ -165,7 +205,7 @@ ogp agent-comms configure --global \
165
205
  ### Configure Specific Peer
166
206
 
167
207
  ```bash
168
- ogp agent-comms configure <peer-id> \
208
+ ogp --for openclaw agent-comms configure <peer-id> \
169
209
  --topics "memory-management,testing,general" \
170
210
  --level full \
171
211
  --notes "Stan is a trusted collaborator"
@@ -174,29 +214,29 @@ ogp agent-comms configure <peer-id> \
174
214
  ### Configure Multiple Peers at Once
175
215
 
176
216
  ```bash
177
- ogp agent-comms configure stan,leonardo,alice \
217
+ ogp --for openclaw agent-comms configure 302a300506032b65,5f8b2c,9d4e1f \
178
218
  --topics "testing" \
179
219
  --level full
180
220
  ```
181
221
 
182
- **Note:** Peers are referenced by their alias (the friendly name you assigned during federation), not their full peer ID.
222
+ **Note:** Prefer peer IDs. Partial peer IDs or display-name matches may work, but peer IDs are canonical.
183
223
 
184
224
  ### Add Topic to Existing Policy
185
225
 
186
226
  ```bash
187
- ogp agent-comms add-topic <peer-id> calendar --level escalate
227
+ ogp --for openclaw agent-comms add-topic <peer-id> calendar --level escalate
188
228
  ```
189
229
 
190
230
  ### Remove Topic
191
231
 
192
232
  ```bash
193
- ogp agent-comms remove-topic <peer-id> personal
233
+ ogp --for openclaw agent-comms remove-topic <peer-id> personal
194
234
  ```
195
235
 
196
236
  ### Reset to Global Defaults
197
237
 
198
238
  ```bash
199
- ogp agent-comms reset <peer-id>
239
+ ogp --for openclaw agent-comms reset <peer-id>
200
240
  ```
201
241
 
202
242
  ## Policy Inheritance
@@ -218,7 +258,7 @@ Effective for Stan:
218
258
 
219
259
  ## Response Policy Schema
220
260
 
221
- Stored in `~/.ogp/peers.json` under each peer:
261
+ Stored in the active framework's `peers.json` under each peer:
222
262
 
223
263
  ```json
224
264
  {
@@ -240,12 +280,16 @@ Stored in `~/.ogp/peers.json` under each peer:
240
280
  }
241
281
  ```
242
282
 
243
- **Note:** The `alias` field (formerly `petname`) is the user-friendly name for the peer.
283
+ **Note:** The `alias` field (formerly `petname`) is stored with the peer, but agent-comms commands should still prefer the peer ID shown by `ogp federation list`.
244
284
 
245
- Global defaults in `~/.ogp/config.json`:
285
+ Global defaults live in the active framework config, for example `~/.ogp/config.json` or `~/.ogp-hermes/config.json`:
246
286
 
247
287
  ```json
248
288
  {
289
+ "humanDeliveryTarget": "telegram:123456789",
290
+ "inboundFederationPolicy": {
291
+ "mode": "summarize"
292
+ },
249
293
  "agentComms": {
250
294
  "globalPolicy": {
251
295
  "general": { "level": "summary" },
@@ -266,7 +310,7 @@ Global defaults in `~/.ogp/config.json`:
266
310
  When an agent-comms message arrives:
267
311
 
268
312
  1. **Doorman** checks if the intent/topic is allowed (scope grants)
269
- 2. **Your agent** receives the message via notification
313
+ 2. **Your agent** receives the message via the local platform backend
270
314
  3. **Your agent** looks up the response policy:
271
315
  - Check peer-specific policy for this topic
272
316
  - Fall back to global policy for this topic
@@ -277,21 +321,25 @@ When an agent-comms message arrives:
277
321
  - `escalate`: "Let me check with my human and get back to you"
278
322
  - `deny`: "I'm not able to discuss that topic"
279
323
 
324
+ **OpenClaw delivery path:** OGP should hand human-facing federated work to OpenClaw through `/hooks/agent`, letting the agent run a real turn and deliver via the configured human channel. A compact `sessions.send` note may still be used to keep session state synchronized, but that is secondary.
325
+
280
326
  **Multi-Agent Routing:** When `notifyTargets` is configured, messages are routed to the appropriate agent who then applies their own policies.
281
327
 
328
+ **Human Delivery:** When `humanDeliveryTarget` is configured, the agent should treat "tell my human X" as a delivery obligation to that configured channel, not merely as something to mention in whatever session happens to be active.
329
+
282
330
  ## Activity Logging
283
331
 
284
332
  When enabled, all agent-comms interactions are logged:
285
333
 
286
334
  ```bash
287
335
  # View activity log
288
- ogp agent-comms activity
336
+ ogp --for openclaw agent-comms activity
289
337
 
290
338
  # View for specific peer
291
- ogp agent-comms activity <peer-id>
339
+ ogp --for openclaw agent-comms activity <peer-id>
292
340
 
293
341
  # View last N entries
294
- ogp agent-comms activity --last 20
342
+ ogp --for openclaw agent-comms activity --last 20
295
343
  ```
296
344
 
297
345
  Log format:
@@ -307,7 +355,7 @@ Log format:
307
355
  ### Trusted Collaborator (Full Access)
308
356
 
309
357
  ```bash
310
- ogp agent-comms configure 302a300506032b65 \
358
+ ogp --for openclaw agent-comms configure 302a300506032b65 \
311
359
  --topics "memory-management,testing,general,code-review" \
312
360
  --level full \
313
361
  --notes "Trusted peer, full collaboration"
@@ -316,7 +364,7 @@ ogp agent-comms configure 302a300506032b65 \
316
364
  ### Business Contact (Limited)
317
365
 
318
366
  ```bash
319
- ogp agent-comms configure 5f8b2c... \
367
+ ogp --for openclaw agent-comms configure 5f8b2c... \
320
368
  --topics "general,status-updates" \
321
369
  --level summary \
322
370
  --notes "Professional contact, keep it high-level"
@@ -325,12 +373,28 @@ ogp agent-comms configure 5f8b2c... \
325
373
  ### New Federation (Cautious)
326
374
 
327
375
  ```bash
328
- ogp agent-comms configure --global \
376
+ ogp --for openclaw agent-comms configure --global \
329
377
  --topics "general,testing" \
330
378
  --level escalate \
331
379
  --notes "Default: check with human for new peers"
332
380
  ```
333
381
 
382
+ ### Human Delivery Modes
383
+
384
+ These now have a first-class CLI interview via `ogp agent-comms interview`, and they remain part of the same operational policy:
385
+
386
+ - `forward` — forward all inbound federated requests/replies to the human
387
+ - `summarize` — summarize and escalate only important/actionable items
388
+ - `autonomous` — act independently unless blocked or explicitly told to relay something
389
+ - `approval-required` — do not act or reply until the human approves
390
+
391
+ Make the user's intent explicit during setup and documentation. Examples:
392
+
393
+ - "Tell me everything that comes in from peers."
394
+ - "Summarize most things, but escalate if you need me."
395
+ - "Act on your own unless you are blocked."
396
+ - "Never reply to a peer without clearing it with me first."
397
+
334
398
  ### Multi-Agent Setup
335
399
 
336
400
  With `notifyTargets` configured in `~/.ogp/config.json`:
@@ -352,29 +416,31 @@ Each agent can have independent policies. The main agent might have full access
352
416
 
353
417
  1. Verify the policy is saved:
354
418
  ```bash
355
- ogp agent-comms policies <peer-id>
419
+ ogp --for openclaw agent-comms policies <peer-id>
356
420
  ```
357
421
 
358
422
  2. Check if the topic is in scope grants (doorman):
359
423
  ```bash
360
- ogp federation scopes <peer-id>
424
+ ogp --for openclaw federation scopes <peer-id>
361
425
  ```
362
426
 
363
427
  3. Restart daemon to reload config:
364
428
  ```bash
365
- ogp stop && ogp start
429
+ ogp --for openclaw stop && ogp --for openclaw start --background
366
430
  ```
367
431
 
368
432
  ### Policy not taking effect for new peer
369
433
 
370
434
  New peers inherit global defaults. Configure them specifically:
371
435
  ```bash
372
- ogp agent-comms configure 302a300506032b65 --topics "..." --level "..."
436
+ ogp --for openclaw agent-comms configure 302a300506032b65 --topics "..." --level "..."
373
437
  ```
374
438
 
375
439
  ### Multi-Agent Routing Issues
376
440
 
377
441
  If notifications aren't reaching the right agent:
378
- 1. Check `notifyTargets` in `~/.ogp/config.json`
379
- 2. Verify the target format: `telegram:chat_id` or `session:session_id`
380
- 3. Check OpenClaw hook configuration for proper routing
442
+ 1. Check `notifyTargets` and `humanDeliveryTarget` in the active framework config
443
+ 2. Verify the target format: `telegram:chat_id` or a raw session key like `agent:main:telegram:direct:<chat-id>`
444
+ 3. For OpenClaw, verify hooks are enabled and the hook token is present
445
+ 4. For OpenClaw Gateway RPC debugging, use `wss://localhost:18789` against a TLS-enabled local gateway, not `ws://`
446
+ 5. Remember that a successful direct session injection is not the same thing as the agent correctly handling a human-delivery obligation