@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
package/README.md CHANGED
@@ -44,7 +44,28 @@ After installation, install the OGP skills for Claude Code:
44
44
  ogp-install-skills
45
45
  ```
46
46
 
47
- This auto-discovers and installs all OGP skills from the `skills/` directory.
47
+ This auto-discovers and installs all OGP skills from the `skills/` directory. The installer now replaces each installed skill directory wholesale on upgrade so stale files from older package versions do not survive.
48
+
49
+ Verify the installed copies after an upgrade:
50
+
51
+ ```bash
52
+ rg -n '^version:' ~/.openclaw/skills/ogp*/SKILL.md ~/.claude/skills/ogp*/SKILL.md 2>/dev/null
53
+ ```
54
+
55
+ For the current `0.4.2` release line, the changed skills should report:
56
+ - `ogp` `2.6.0`
57
+ - `ogp-agent-comms` `0.6.0`
58
+ - `ogp-project` `2.2.0`
59
+
60
+ ### Multi-Framework Support
61
+
62
+ OGP supports running alongside multiple AI frameworks (OpenClaw, Hermes, etc.) with isolated configurations. During setup, OGP automatically detects installed frameworks and creates framework-specific configurations:
63
+
64
+ - **OpenClaw**: `~/.ogp-openclaw/`
65
+ - **Hermes**: `~/.ogp-hermes/`
66
+ - **Standalone**: `~/.ogp/`
67
+
68
+ All framework configurations are managed from a central meta-config at `~/.ogp-meta/config.json`.
48
69
 
49
70
  ## Quick Start
50
71
 
@@ -56,15 +77,33 @@ Run the interactive setup wizard:
56
77
  ogp setup
57
78
  ```
58
79
 
59
- You'll be prompted for:
60
- - **Agent ID** - Which OpenClaw agent owns this gateway (auto-discovers available agents from your OpenClaw config)
61
- - Daemon port (default: 18790)
62
- - OpenClaw URL (default: http://localhost:18789)
63
- - OpenClaw API token
64
- - Your public gateway URL (can update later, or use rendezvous)
80
+ The wizard automatically detects installed frameworks and guides you through configuration. You'll be prompted for:
81
+ - **Framework Selection** - Which AI frameworks to enable (OpenClaw, Hermes, or standalone)
82
+ - **Agent ID** - Which agent owns each gateway (auto-discovers from framework config)
83
+ - Daemon port (default: 18790 for OpenClaw, 18793 for Hermes)
84
+ - Framework URL and API credentials
85
+ - Your public gateway URL (can update later; rendezvous is optional discovery/invite sugar, not a replacement for reachability)
65
86
  - Rendezvous configuration (optional, v0.2.14+)
66
87
  - Display name and email
67
88
 
89
+ **Working with Multiple Frameworks:**
90
+
91
+ When multiple frameworks are configured, use the `--for` flag to specify which framework:
92
+
93
+ ```bash
94
+ # Use specific framework
95
+ ogp --for openclaw federation list
96
+ ogp --for hermes federation list
97
+
98
+ # Run on all frameworks
99
+ ogp --for all status
100
+
101
+ # Set a default framework (no --for needed)
102
+ ogp config set-default openclaw
103
+ ```
104
+
105
+ If only one framework is configured, it's automatically selected (no `--for` flag needed).
106
+
68
107
  ### 2. Start the Daemon
69
108
 
70
109
  ```bash
@@ -77,6 +116,17 @@ Or run in the background:
77
116
  ogp start --background
78
117
  ```
79
118
 
119
+ **Multi-framework usage:**
120
+
121
+ ```bash
122
+ # Start daemon for specific framework
123
+ ogp --for openclaw start --background
124
+ ogp --for hermes start --background
125
+
126
+ # Start all framework daemons
127
+ ogp --for all start --background
128
+ ```
129
+
80
130
  ### 3. Making Your Gateway Reachable
81
131
 
82
132
  For OGP federation to work, peers need to be able to reach your gateway over the internet. If you already have a publicly accessible URL (cloud server, VPS, Clawporate gateway), just set it as your `gatewayUrl` in `~/.ogp/config.json` and you're done. Skip to step 4.
@@ -174,21 +224,45 @@ https://your-gateway-url.com/.well-known/ogp
174
224
 
175
225
  ## All Commands
176
226
 
227
+ All commands support the `--for <framework>` flag to specify which framework configuration to use. Use `--for all` to run commands across all configured frameworks.
228
+
229
+ **Quick Help:** Add `?` to any command for context-sensitive help:
230
+
231
+ ```bash
232
+ ogp ? # Show all commands
233
+ ogp federation ? # Show federation commands
234
+ ogp federation send ? # Show send usage with examples
235
+ ```
236
+
237
+ ### Tab Completion
238
+
239
+ Install shell completion for faster command entry:
240
+
241
+ ```bash
242
+ # Bash
243
+ ogp completion install bash
244
+
245
+ # Zsh
246
+ ogp completion install zsh
247
+ ```
248
+
249
+ After installation, restart your shell or run `source ~/.bashrc` (bash) or `source ~/.zshrc` (zsh).
250
+
177
251
  ### Daemon Management
178
252
 
179
253
  | Command | Description |
180
254
  |---------|-------------|
181
- | `ogp setup` | Interactive setup wizard |
182
- | `ogp start` | Start daemon in foreground |
183
- | `ogp start --background` | Start daemon as background process |
184
- | `ogp stop` | Stop the daemon |
185
- | `ogp status` | Show daemon status and configuration |
255
+ | `ogp setup` | Interactive setup wizard (auto-detects frameworks) |
256
+ | `ogp start [--for <framework>]` | Start daemon in foreground |
257
+ | `ogp start --background [--for <framework>]` | Start daemon as background process |
258
+ | `ogp stop [--for <framework>]` | Stop the daemon |
259
+ | `ogp status [--for <framework>]` | Show daemon status and configuration |
186
260
 
187
261
  ### Tunnel Management
188
262
 
189
263
  | Command | Description |
190
264
  |---------|-------------|
191
- | `ogp expose` | Launch guided tunnel setup wizard (coming soon) or start cloudflared tunnel in foreground |
265
+ | `ogp expose` | Start a Cloudflare quick tunnel in the foreground; use the `ogp-expose` skill/doc flow for guided setup |
192
266
  | `ogp expose --background` | Run tunnel as background process |
193
267
  | `ogp expose --method ngrok` | Use ngrok instead of cloudflared |
194
268
  | `ogp expose stop` | Stop the tunnel |
@@ -200,11 +274,21 @@ https://your-gateway-url.com/.well-known/ogp
200
274
  | `ogp install` | Install LaunchAgent for auto-start on login |
201
275
  | `ogp uninstall` | Remove LaunchAgent |
202
276
 
277
+ ### Configuration Management
278
+
279
+ | Command | Description |
280
+ |---------|-------------|
281
+ | `ogp config list` | List all configured frameworks |
282
+ | `ogp config set-default <framework>` | Set default framework (no --for needed) |
283
+ | `ogp config enable <framework>` | Enable a framework |
284
+ | `ogp config disable <framework>` | Disable a framework |
285
+ | `ogp config show [--for <framework>]` | Show current configuration |
286
+
203
287
  ### Federation Management
204
288
 
205
289
  | Command | Description |
206
290
  |---------|-------------|
207
- | `ogp federation list` | List all peers |
291
+ | `ogp federation list [--for <framework>]` | List all peers |
208
292
  | `ogp federation list --status pending` | List pending federation requests |
209
293
  | `ogp federation list --status approved` | List approved peers |
210
294
  | `ogp federation request <url> [alias]` | Request federation (alias auto-resolves if omitted) |
@@ -255,6 +339,7 @@ When approving or granting scopes:
255
339
 
256
340
  | Command | Description |
257
341
  |---------|-------------|
342
+ | `ogp agent-comms interview` | Re-run the delegated-authority / human-delivery interview |
258
343
  | `ogp agent-comms policies [peer-id]` | Show response policies |
259
344
  | `ogp agent-comms configure [peer-ids] [options]` | Configure response policies |
260
345
  | `ogp agent-comms add-topic <peer> <topic> [options]` | Add topic policy |
@@ -271,54 +356,57 @@ When approving or granting scopes:
271
356
  ogp federation request https://peer.example.com
272
357
 
273
358
  # Or specify a custom alias for easier reference
274
- ogp federation request https://peer.example.com --alias big-papa
359
+ ogp federation request https://peer.example.com --alias apollo
360
+
361
+ # Multi-framework: Request from specific framework
362
+ ogp --for openclaw federation request https://hermes.example.com --alias hermes-gateway
275
363
 
276
364
  # Check pending requests
277
365
  ogp federation list --status pending
278
366
 
279
367
  # Approve a peer (v0.1 mode - no scope restrictions)
280
- ogp federation approve alice
368
+ ogp federation approve apollo
281
369
 
282
370
  # Approve with scope grants (v0.2.0+)
283
- ogp federation approve alice \
371
+ ogp federation approve apollo \
284
372
  --intents message,agent-comms \
285
373
  --rate 100/3600 \
286
374
  --topics memory-management,task-delegation
287
375
 
288
376
  # View peer scopes
289
- ogp federation scopes alice
377
+ ogp federation scopes apollo
290
378
 
291
379
  # Update grants for an existing peer
292
- ogp federation grant alice \
380
+ ogp federation grant apollo \
293
381
  --intents agent-comms \
294
382
  --topics project-planning
295
383
 
296
384
  # Remove a peer from federation (asymmetric tear-down)
297
- ogp federation remove alice
385
+ ogp federation remove apollo
298
386
 
299
387
  # Test connectivity
300
388
  ogp federation ping https://peer.example.com
301
389
 
302
390
  # Send a simple message
303
- ogp federation send alice message '{"text":"Hello!"}'
391
+ ogp federation send apollo message '{"text":"Hello!"}'
304
392
 
305
393
  # Send agent-comms (v0.2.0+)
306
- ogp federation agent alice memory-management "How do you persist context?"
394
+ ogp federation agent apollo memory-management "How do you persist context?"
307
395
 
308
396
  # Send agent-comms with priority
309
- ogp federation agent alice task-delegation "Schedule standup" --priority high
397
+ ogp federation agent apollo task-delegation "Schedule standup" --priority high
310
398
 
311
399
  # Send agent-comms and wait for reply
312
- ogp federation agent alice queries "What's the status?" --wait --timeout 60000
400
+ ogp federation agent apollo queries "What's the status?" --wait --timeout 60000
313
401
 
314
402
  # Send a task request
315
- ogp federation send alice task-request '{
403
+ ogp federation send apollo task-request '{
316
404
  "taskType": "analysis",
317
405
  "description": "Analyze recent logs"
318
406
  }'
319
407
 
320
408
  # Send a status update
321
- ogp federation send alice status-update '{
409
+ ogp federation send apollo status-update '{
322
410
  "status": "completed",
323
411
  "message": "Task finished"
324
412
  }'
@@ -399,6 +487,8 @@ ogp agent-comms activity stan --last 20
399
487
 
400
488
  ## How Federation Works
401
489
 
490
+ ### Single Framework Architecture
491
+
402
492
  ```
403
493
  ┌─────────────┐ ┌──────────────┐ ┌─────────────┐
404
494
  │ OpenClaw │◄────────│ OGP Daemon │◄────────│ Remote │
@@ -407,26 +497,55 @@ ogp agent-comms activity stan --last 20
407
497
  └─────────────┘ └──────────────┘ └─────────────┘
408
498
  ```
409
499
 
500
+ ### Multi-Framework Architecture
501
+
502
+ ```
503
+ ┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
504
+ │ OpenClaw │◄────────│ OGP Daemon │◄────────│ Remote │
505
+ │ :18789 │ webhook│ :18790 │ signed │ Peer │
506
+ └─────────────┘ │ (~/.ogp-openclaw)│ message│ (OGP) │
507
+ └──────────────────┘ └─────────────┘
508
+
509
+ ┌─────────────┐ │
510
+ │ Hermes │◄────────┌──────────────────┐ ┌─────────────┐
511
+ │ :18792 │ webhook│ OGP Daemon │◄────────│ Remote │
512
+ └─────────────┘ │ :18793 │ signed │ Peer │
513
+ │ (~/.ogp-hermes) │ message│ (OGP) │
514
+ └──────────────────┘ └─────────────┘
515
+
516
+
517
+ ┌──────────────────┐
518
+ │ Meta Config │
519
+ │ (~/.ogp-meta/) │
520
+ │ - Framework list │
521
+ │ - Default │
522
+ │ - Aliases │
523
+ └──────────────────┘
524
+ ```
525
+
526
+ ### Federation Flow
527
+
410
528
  1. **Discovery**: Peers discover each other via `/.well-known/ogp` endpoint or rendezvous server
411
529
  2. **Request**: Alice requests federation with Bob's OGP instance
412
530
  3. **Approval**: Bob approves (or rejects) the federation request
413
531
  4. **Messaging**: Approved peers can send cryptographically signed messages
414
532
  5. **Verification**: Recipient OGP daemon verifies signatures using sender's public key
415
- 6. **Relay**: Valid messages are forwarded to the local OpenClaw agent via webhook
533
+ 6. **Relay**: Valid messages are forwarded to the local AI agent via webhook
416
534
 
417
535
  All messages are signed with Ed25519 cryptographic signatures to prevent tampering and impersonation.
418
536
 
419
- ## Rendezvous — Zero-Config Peer Discovery (v0.2.14+)
537
+ ## Rendezvous — Optional Discovery And Invite Layer (v0.2.14+)
538
+
539
+ Rendezvous is an optional convenience layer for pubkey lookup and short invite codes. It is useful when you want easier onboarding for gateways that are already publicly reachable.
420
540
 
421
- OGP's rendezvous service eliminates the need for manual URL exchange and tunnel configuration. Gateways auto-register by public key, enabling peers to discover and connect to each other with a single command.
541
+ ### What It Actually Solves
422
542
 
423
- ### The Problem It Solves
543
+ Traditional federation still requires the peer you are trying to reach to be publicly reachable. Rendezvous helps with:
544
+ - pubkey discovery
545
+ - short invite codes instead of sharing long URLs or raw pubkeys
546
+ - reducing manual coordination once each gateway already has a stable public endpoint
424
547
 
425
- Traditional federation requires both peers to be publicly reachable and manually exchange gateway URLs. With rendezvous:
426
- - No tunnel setup required (ngrok, Cloudflare Tunnel, port forwarding)
427
- - No manual URL sharing
428
- - No URL rotation issues (free ngrok tiers)
429
- - Automatic peer discovery by public key
548
+ Rendezvous does **not** provide NAT traversal, hole punching, or message relay.
430
549
 
431
550
  ### How It Works
432
551
 
@@ -435,7 +554,7 @@ Traditional federation requires both peers to be publicly reachable and manually
435
554
  3. Peers can look you up by public key (`GET /peer/:pubkey`) and connect directly
436
555
  4. On shutdown, your daemon auto-deregisters (`DELETE /peer/:pubkey`)
437
556
 
438
- The rendezvous server **never touches message content** — it only stores connection hints (IP + port). All OGP messages remain end-to-end signed between peers.
557
+ The rendezvous server **never touches message content** — it only stores connection hints. All OGP messages remain end-to-end signed between peers.
439
558
 
440
559
  ### Configuration
441
560
 
@@ -453,7 +572,7 @@ Add the `rendezvous` block to `~/.ogp/config.json`:
453
572
  }
454
573
  ```
455
574
 
456
- The setup wizard (`ogp setup`) prompts for rendezvous configuration.
575
+ Rendezvous is optional. OGP works without it if peers can share public URLs directly.
457
576
 
458
577
  **For cloud/ECS gateways behind load balancers**, set the `OGP_PUBLIC_URL` environment variable to override automatic IP detection:
459
578
 
@@ -476,7 +595,7 @@ Or add `publicUrl` to the rendezvous config:
476
595
 
477
596
  ### Federation Invite Flow (v0.2.15+)
478
597
 
479
- The invite flow removes the need to exchange public keys. One command generates a short-lived token; your peer uses it to connect instantly.
598
+ The invite flow removes the need to exchange public keys manually. One command generates a short-lived token; your peer uses it to connect instantly.
480
599
 
481
600
  **Generate an invite:**
482
601
  ```bash
@@ -512,7 +631,7 @@ Connect to any peer registered on rendezvous by their public key:
512
631
  ogp federation connect <pubkey>
513
632
  ```
514
633
 
515
- This looks up the peer on the rendezvous server and establishes federation directly.
634
+ This looks up the peer on the rendezvous server and establishes federation directly. The peer still needs a reachable gateway endpoint behind that lookup.
516
635
 
517
636
  ### Privacy & Self-Hosting
518
637
 
@@ -617,25 +736,26 @@ ogp federation agent stan memory-management \
617
736
 
618
737
  ### 3. Project Intent System (v0.2.0+)
619
738
 
620
- Collaborative project management across federated peers with activity logging and cross-peer queries.
739
+ Projects are optional collaboration boundaries layered on top of federation. They let each person keep their own tools while their agents log high-level project context and query collaborators through OGP when needed.
621
740
 
622
741
  **Features:**
623
742
  - Create projects with contextual setup (repo, workspace, notes, collaborators)
624
- - Log contributions by entry type (progress, decision, blocker, context)
625
- - Query local and peer contributions for unified team view
626
- - Agent-aware: proactive logging and context loading
627
- - **Auto-registration (v0.2.9+)**: Project IDs auto-register as agent-comms topics for all approved peers
743
+ - Log high-level contributions by entry type (progress, decision, blocker, context)
744
+ - Query local and peer contributions for project-aware coordination
745
+ - Use project IDs as agent-comms topics for collaborator questions and summaries
746
+ - **Auto-registration (v0.2.9+)**: Project IDs auto-register as agent-comms topics for approved peers who are explicit project members
628
747
 
629
748
  **Example:**
630
749
  ```bash
631
- # Create project (auto-registers as agent-comms topic for all peers)
750
+ # Create project (auto-registers as agent-comms topic for approved project members)
632
751
  ogp project create my-app "My App" --description "Expense tracker"
633
752
 
634
753
  # Log work by entry type
635
754
  ogp project contribute my-app progress "Completed authentication"
636
755
  ogp project contribute my-app decision "Using PostgreSQL"
637
756
 
638
- # Query peer's project
757
+ # Ask a collaborator or query peer project state
758
+ ogp federation agent alice my-app "My user is about to work on auth. Anything already decided?"
639
759
  ogp project query-peer alice shared-app --limit 10
640
760
  ```
641
761
 
@@ -667,9 +787,26 @@ ogp federation request https://peer.example.com --alias alice
667
787
  ogp federation request https://peer.example.com
668
788
  ```
669
789
 
670
- ### 6. Telegram Integration (v0.2.3+)
790
+ ### 6. OpenClaw Human Delivery (v0.2.3+, refined in v0.4.2+)
791
+
792
+ For OpenClaw-backed agents, OGP now prefers `POST /hooks/agent` for inbound federated work that should be interpreted and surfaced by the local agent. This lets OpenClaw run a real agent turn, apply the configured human-delivery policy, and deliver through the correct channel surface (Telegram, iMessage, etc.).
671
793
 
672
- Federation requests fire OpenClaw notifications via sessions_send, delivering directly to Telegram.
794
+ When OGP needs direct session injection, it uses Gateway RPC with the correct secure WebSocket transport (`wss://`) when the OpenClaw gateway is TLS-enabled.
795
+
796
+ ### 6.1 Delegated-Authority Precedence (v0.4.2)
797
+
798
+ Policy evaluation now follows a fixed order so more specific rules cannot be silently overwritten. The runtime in `src/daemon/notify.ts` applies:
799
+ 1. Legacy `inboundFederationPolicy` mode as a safety fallback
800
+ 2. Global default rule from the delegated-authority config
801
+ 3. Peer-specific default rule (per-peer overrides)
802
+ 4. Global message-class rule (e.g., `agent-work`, `human-relay`, `approval-request`, `status-update`)
803
+ 5. Peer message-class override for that same class
804
+ 6. Global topic-level rule
805
+ 7. Peer topic-level override
806
+
807
+ Approval requests receive immediate `approval-required` handling and `human-relay` obligations are treated according to their relay mode (deliver, summarize, or approval) before human delivery is asserted. This ordering guarantees peer defaults cannot erase more specific class/topic safeguards, so `human-relay` stays strict even when a trusted peer asks for more autonomy and topic overrides continue to behave predictably.
808
+
809
+ OGP now tries to pin `/hooks/agent` to the actual human session key when the local OpenClaw `hooks.allowRequestSessionKey` setting allows it (see `~/.openclaw/openclaw.json`). If the value is `false` or the requested key does not match the allowed prefixes, the hook still runs but falls back to the default hook session, so downstream heuristics must still parse peer identity from the injected payload. Native sender identity parity in Telegram therefore remains a known limitation for `v0.4.2`; the runtime will log a warning whenever it cannot request a session override so that the human knows the limitation is intentional.
673
810
 
674
811
  ### 7. Enhanced Daemon Status (v0.2.3+)
675
812
 
@@ -689,10 +826,10 @@ ogp agent-comms configure --global --topics "general,project-updates" --level su
689
826
 
690
827
  ### 9. Project Topic Auto-Registration (v0.2.9+)
691
828
 
692
- When you create a project, its ID is automatically registered as an agent-comms topic for all approved peers at `summary` level. When you approve a new peer, all existing local projects are auto-registered as topics for that peer.
829
+ When you create a project, its ID is automatically registered as an agent-comms topic at `summary` level for approved peers who are explicit project members. When you approve a new peer, existing local projects are auto-registered only if that peer is already in the project's member list.
693
830
 
694
831
  ```bash
695
- # Creates project AND registers as topic for all peers
832
+ # Creates project AND registers as topic for approved project members
696
833
  ogp project create my-app "My Application"
697
834
 
698
835
  # Approving a peer also registers existing projects as topics
@@ -774,6 +911,9 @@ The `off` level enables a default-deny security posture. When a topic hits `off`
774
911
  # View all policies
775
912
  ogp agent-comms policies
776
913
 
914
+ # Re-run the delegated-authority / human-delivery interview
915
+ ogp agent-comms interview
916
+
777
917
  # View policies for a specific peer
778
918
  ogp agent-comms policies stan
779
919
 
@@ -828,6 +968,10 @@ Configuration is stored in `~/.ogp/config.json`:
828
968
  "email": "you@example.com",
829
969
  "stateDir": "~/.ogp",
830
970
  "agentId": "main",
971
+ "humanDeliveryTarget": "telegram:123456789",
972
+ "inboundFederationPolicy": {
973
+ "mode": "summarize"
974
+ },
831
975
  "notifyTarget": "telegram:123456789",
832
976
  "notifyTargets": {
833
977
  "main": "telegram:123456789",
@@ -863,6 +1007,55 @@ Which agent owns this gateway? (number or ID) [1]:
863
1007
  You can also specify a custom agent ID if needed.
864
1008
  ```
865
1009
 
1010
+ ### Human Delivery Preferences (v0.4.2+)
1011
+
1012
+ OGP has two separate questions to answer for inbound federation traffic:
1013
+
1014
+ 1. **Where should human-facing followups go?**
1015
+ 2. **How should the agent behave when a peer asks it to do something?**
1016
+
1017
+ Those should not be inferred from the currently active conversation.
1018
+
1019
+ **Configuration fields:**
1020
+ - **`humanDeliveryTarget`**: Explicit human-facing destination for OGP-triggered followups. Examples: `telegram:123456789` or a raw session key like `agent:main:telegram:direct:123456789`.
1021
+ - **`inboundFederationPolicy.mode`**: Default behavior for how the local agent should handle inbound federated requests.
1022
+
1023
+ For OpenClaw specifically, this configuration feeds the `/hooks/agent` delivery path. In other words:
1024
+ - `humanDeliveryTarget` tells OGP where human-facing followups should go
1025
+ - `inboundFederationPolicy.mode` tells the local agent how to treat federated requests once they arrive
1026
+ - OGP should not infer either of those from "whatever session is active right now"
1027
+
1028
+ **Supported behavior modes:**
1029
+ - **`forward`**: Tell me everything. Forward inbound federated items to my configured channel.
1030
+ - **`summarize`**: Summarize and surface only important, actionable, or uncertain items.
1031
+ - **`autonomous`**: Act autonomously when possible, but surface blockers, approvals, or explicit relay requests.
1032
+ - **`approval-required`**: Do not act on or reply to federated requests until I explicitly approve.
1033
+
1034
+ **Example configuration:**
1035
+
1036
+ ```json
1037
+ {
1038
+ "agentId": "main",
1039
+ "humanDeliveryTarget": "telegram:123456789",
1040
+ "inboundFederationPolicy": {
1041
+ "mode": "autonomous"
1042
+ }
1043
+ }
1044
+ ```
1045
+
1046
+ When you run `ogp setup`, the wizard asks for both:
1047
+ - the primary human delivery target for OGP followups
1048
+ - the default inbound federation handling mode
1049
+
1050
+ If the user wants to revisit just this part later, use:
1051
+
1052
+ ```bash
1053
+ ogp --for openclaw agent-comms interview
1054
+ ogp --for hermes agent-comms interview
1055
+ ```
1056
+
1057
+ That command re-runs the delegated-authority / human-delivery interview for the active framework without repeating the rest of first-time setup.
1058
+
866
1059
  ### Notification Routing (v0.2.28+)
867
1060
 
868
1061
  The `notifyTargets` field enables per-agent notification routing. When OGP sends notifications to your OpenClaw instance, it routes to specific agents based on the message context.
@@ -870,6 +1063,7 @@ The `notifyTargets` field enables per-agent notification routing. When OGP sends
870
1063
  **Configuration fields:**
871
1064
  - **`notifyTarget`** (legacy, string): Single notification target for all messages. Maintained for backward compatibility.
872
1065
  - **`notifyTargets`** (object): Map of agent names to notification targets. Example: `{"main": "telegram:...", "scribe": "telegram:..."}`
1066
+ - **`humanDeliveryTarget`** (preferred for human-facing followups): Explicit destination for OGP-triggered notifications and relay obligations.
873
1067
 
874
1068
  **Example configuration with multiple agents:**
875
1069
 
@@ -883,6 +1077,10 @@ The `notifyTargets` field enables per-agent notification routing. When OGP sends
883
1077
  "email": "alice@example.com",
884
1078
  "stateDir": "~/.ogp",
885
1079
  "notifyTarget": "telegram:123456789",
1080
+ "humanDeliveryTarget": "telegram:123456789",
1081
+ "inboundFederationPolicy": {
1082
+ "mode": "summarize"
1083
+ },
886
1084
  "notifyTargets": {
887
1085
  "main": "telegram:123456789",
888
1086
  "scribe": "telegram:987654321",
@@ -896,15 +1094,25 @@ The `notifyTargets` field enables per-agent notification routing. When OGP sends
896
1094
 
897
1095
  When routing notifications, OGP resolves the target in this order:
898
1096
 
899
- 1. **`notifyTargets[agent]`** — If the agent is specified and exists in `notifyTargets`, use that target
900
- 2. **`notifyTarget`** — Fall back to the legacy single target for backward compatibility
901
- 3. **Default**If neither is set, the notification is sent without a specific target (OpenClaw routes to the default channel)
1097
+ 1. **`humanDeliveryTarget`** — If set, use it as the explicit human-facing OGP destination
1098
+ 2. **`notifyTargets[agent]`** — If the agent is specified and exists in `notifyTargets`, use that target
1099
+ 3. **`notifyTarget`**Fall back to the legacy single target for backward compatibility
1100
+ 4. **Default** — If none are set, OGP falls back to the agent's default session
902
1101
 
903
1102
  This allows you to:
904
1103
  - Route federation messages to different agents based on context
1104
+ - Explicitly separate "the agent that owns this gateway" from "the human-facing channel for OGP followups"
905
1105
  - Maintain backward compatibility with existing single-agent setups
906
1106
  - Gradually migrate to multi-agent routing without breaking existing configurations
907
1107
 
1108
+ ### OpenClaw Transport Notes
1109
+
1110
+ If you are debugging OpenClaw integration directly:
1111
+
1112
+ - **Hooks path**: `https://localhost:18789/hooks/agent` is the preferred local delivery path for human-facing federated work.
1113
+ - **Gateway RPC path**: when using `openclaw gateway call` against a TLS-enabled local gateway, use `wss://localhost:18789`, not `ws://localhost:18789`.
1114
+ - A plain session injection succeeding does not necessarily mean the agent has interpreted the task the way you want; `/hooks/agent` is the path designed for that agentic behavior.
1115
+
908
1116
  ### Environment Variables
909
1117
 
910
1118
  - `OGP_PUBLIC_URL` (v0.2.17+): Override automatic IP detection for rendezvous registration. Use this for cloud/ECS gateways behind load balancers where the detected IP differs from the public endpoint.
@@ -918,12 +1126,21 @@ This allows you to:
918
1126
 
919
1127
  ### State Files
920
1128
 
921
- - `~/.ogp/keypair.json` - Ed25519 keypair (keep secure! migrated to macOS Keychain on v0.2.13+)
1129
+ - `~/.ogp/keypair.json` - Public key cache plus key material metadata. On macOS the private key lives in an instance-specific Keychain entry; on non-macOS OGP encrypts the private key at rest when `OGP_KEYPAIR_SECRET`, `openclawToken`, or `hermesWebhookSecret` is available.
922
1130
  - `~/.ogp/peers.json` - Federated peer list with scope grants
923
1131
  - `~/.ogp/intents.json` - Intent registry (built-in + custom)
924
1132
  - `~/.ogp/projects.json` - Project contexts and contributions
925
1133
  - `~/.ogp/agent-comms-config.json` - Response policies and activity log
926
1134
 
1135
+ On macOS, deleting `keypair.json` by itself does **not** rotate the gateway identity if the matching private key is still present in Keychain. Use `ogp setup --reset-keypair` when you intentionally want a new identity.
1136
+
1137
+ On non-macOS, OGP prefers this secret source order for encrypting the private key at rest:
1138
+ - `OGP_KEYPAIR_SECRET`
1139
+ - `hermesWebhookSecret`
1140
+ - `openclawToken`
1141
+
1142
+ If no encryption secret is available, OGP falls back to legacy plaintext key storage and logs a warning. Set one of the secrets above, then run `ogp setup --reset-keypair` to harden the instance.
1143
+
927
1144
  ## Skills (Claude Code)
928
1145
 
929
1146
  OGP includes skills for Claude Code agents. Install them with:
@@ -932,24 +1149,45 @@ OGP includes skills for Claude Code agents. Install them with:
932
1149
  ogp-install-skills
933
1150
  ```
934
1151
 
1152
+ After upgrading, verify the installed skill headers:
1153
+
1154
+ ```bash
1155
+ rg -n '^version:' ~/.openclaw/skills/ogp*/SKILL.md ~/.claude/skills/ogp*/SKILL.md 2>/dev/null
1156
+ ```
1157
+
1158
+ Expected changed skill versions for the `0.4.2` release line:
1159
+ - `ogp` `2.6.0`
1160
+ - `ogp-agent-comms` `0.6.0`
1161
+ - `ogp-project` `2.2.0`
1162
+
935
1163
  ### Available Skills
936
1164
 
937
1165
  | Skill | Purpose |
938
1166
  |-------|---------|
939
1167
  | **ogp** | Core protocol: federation setup, peer management, sending messages |
940
1168
  | **ogp-expose** | Tunnel setup: cloudflared/ngrok configuration |
941
- | **ogp-agent-comms** | Interactive wizard: configure response policies per-peer |
942
- | **ogp-project** | Agent-aware project context: interviews, logging, cross-peer summarization |
1169
+ | **ogp-agent-comms** | Interactive wizard: configure response policies plus delegated-authority / human-delivery interview |
1170
+ | **ogp-project** | Agent-aware project context: interviews, logging, and project-aware peer coordination |
943
1171
 
944
- Skills auto-install from the `skills/` directory. The `ogp-agent-comms` skill provides an interactive wizard for multi-peer policy configuration. The `ogp-project` skill enables conversational project management with context interviews and proactive logging.
1172
+ Skills auto-install from the `skills/` directory. The `ogp-agent-comms` skill now uses `ogp agent-comms interview` as the canonical conversational path for delegated-authority / human-delivery configuration, plus the existing per-peer policy commands. The `ogp-project` skill enables conversational project management with context interviews, high-level project logging, and project-aware peer coordination.
945
1173
 
946
1174
  ## Documentation
947
1175
 
948
- - [Quick Start Guide](./docs/quickstart.md) - Detailed step-by-step setup
1176
+ ### Getting Started
1177
+ - [Getting Started Guide](./docs/GETTING-STARTED.md) - Comprehensive setup guide for single and multi-framework setups
1178
+ - [Quick Start Guide](./docs/quickstart.md) - Fast-track setup for single framework
1179
+ - [CLI Reference](./docs/CLI-REFERENCE.md) - Complete command reference with examples
1180
+ - [Migration Guide](./docs/MIGRATION.md) - Upgrading from single to multi-framework setup
1181
+
1182
+ ### Core Features
949
1183
  - [Federation Flow](./docs/federation-flow.md) - How federation works internally
950
1184
  - [Scope Negotiation](./docs/scopes.md) - Per-peer scope configuration (v0.2.0)
951
1185
  - [Agent Communications](./docs/agent-comms.md) - Agent-to-agent messaging (v0.2.0)
952
- - [Rendezvous & Invite Flow](./docs/rendezvous.md) - Zero-config peer discovery (v0.2.14+)
1186
+ - [Rendezvous & Invite Flow](./docs/rendezvous.md) - Optional discovery and invite service (v0.2.14+)
1187
+
1188
+ ### Advanced
1189
+ - [Multi-Framework Design](./docs/MULTI-FRAMEWORK-DESIGN.md) - Design principles for multi-framework support
1190
+ - [Multi-Framework Implementation](./docs/MULTI-FRAMEWORK-IMPL.md) - Implementation details
953
1191
  - [Protocol Specification](https://github.com/dp-pcs/openclaw-federation) - Full OGP protocol spec
954
1192
 
955
1193
  ## Security
@@ -961,7 +1199,9 @@ Skills auto-install from the `skills/` directory. The `ogp-agent-comms` skill pr
961
1199
  - **Nonce tracking**: Prevents replay attacks
962
1200
 
963
1201
  **Best practices:**
964
- - Keep `~/.ogp/keypair.json` secure with proper file permissions (`chmod 600`)
1202
+ - Treat `~/.ogp/keypair.json` as identity material even when it contains only the public key cache on macOS.
1203
+ - On macOS, remember the private key source of truth is the instance-specific Keychain entry, not `keypair.json`; use `ogp setup --reset-keypair` for intentional rotation.
1204
+ - On non-macOS, provide `OGP_KEYPAIR_SECRET` or a platform secret so OGP can encrypt the private key at rest; `chmod 600` remains enforced but is not sufficient by itself.
965
1205
  - Verify peer identity out-of-band before approving federation requests
966
1206
  - Always use HTTPS tunnels (never expose raw HTTP)
967
1207
  - Monitor OpenClaw logs for suspicious peer activity
@@ -994,7 +1234,7 @@ src/
994
1234
  projects.ts # Project storage and management (v0.2.0+)
995
1235
  intent-registry.ts # Intent definitions and custom registry
996
1236
  message-handler.ts # Message verification and routing
997
- notify.ts # OpenClaw integration (sessions_send + webhooks)
1237
+ notify.ts # OpenClaw/Hermes delivery backends
998
1238
  cli/
999
1239
  setup.ts # Setup wizard
1000
1240
  federation.ts # Federation commands (scopes, agent-comms)
@@ -1011,6 +1251,22 @@ skills/
1011
1251
  ogp-project/ # Project context management skill
1012
1252
  ```
1013
1253
 
1254
+ ## Known Issues
1255
+
1256
+ ### OpenClaw Delivery Model
1257
+
1258
+ **Current implementation:**
1259
+ - **Primary:** `POST /hooks/agent` for inbound federated requests that should be processed by the local OpenClaw agent
1260
+ - **Fallback / sync:** `openclaw gateway call ... sessions.send` over `wss://` when direct session injection is needed
1261
+
1262
+ Why this split exists:
1263
+ - `/hooks/agent` is the right primitive for "an external federated task arrived; let the agent interpret it, act on it, and deliver the result through the configured human channel."
1264
+ - `sessions.send` is still useful for direct session injection and compact synchronization notes, but it is not the primary delivery mechanism for human-facing federated work.
1265
+
1266
+ Important nuance:
1267
+ - OpenClaw may still render direct session injections with sender metadata like `cli`, so OGP continues to include peer identity in message content where needed.
1268
+ - Hook-run awareness and human-DM continuity are related but not identical. OGP can mirror a compact sync note into the DM session, but the important success criterion is correct delivery and behavior, not whether raw internal transport artifacts are visible in the user-facing transcript.
1269
+
1014
1270
  ## License
1015
1271
 
1016
1272
  MIT